Comments (14)
@BennoMeijer thank you for reporting this! I had a look at the specification and indeed you are right:
fourth octet day of week (1..7)
1 = Monday
7 = Sunday
0xFF = unspecified
But what is interesting, YABE has the same bug:
https://sourceforge.net/p/yetanotherbacnetexplorer/code/HEAD/tree/trunk/Yabe/BACnetBase.cs#l4115
I will fix this as you suggested but it will not solve your problem right? I'm up for helping you but don't have any device I could query for trendlog... Any ideas?
from bacnet.
Hi gralin
When I look at the wireshark data I see something that is different from working devices that I have here.
The datatype doesn't look right to me,
When I change in System.IO.Bacnet.Serialize
ASN1.encode_tag(buffer, (byte)record.type, false, (uint)tmp1.offset); (line 2313) the bool bool contextSpecific in true, it looks the same as my other devices
from bacnet.
@BennoMeijer good catch! Since BacnetTrendLogValueType
is being used tag number instead of BacnetApplicationTags
, therefor we need to signal this as context specific (value true
). In your case TL_TYPE_REAL
(value 2) was treated as BACNET_APPLICATION_TAG_UNSIGNED_INT
(same value 2) and that's what you were getting in first screenshot. This bug is inherited from YABE:
https://sourceforge.net/p/yetanotherbacnetexplorer/code/HEAD/tree/trunk/Yabe/BACnetBase.cs#l8383
from bacnet.
Hi Gralin
I have it almost working. After I send the historical data I need to send the next sequence number. Is there already a function in ASN1 I can use to create this last part?
from bacnet.
Hi @BennoMeijer, could you explain me your use case, what are you trying to do and where are you facing problem? Are you using BacnetClient
class or just ASN1
directly?
from bacnet.
from bacnet.
@BennoMeijer is this solved or should this case be reopened?
from bacnet.
Hi,
if I add a value to a trend log, the status is uint. I think that should be a BacnetBitstring. When i try to set some value to the status i'm getting the wrong response.
from bacnet.
@BennoMeijer could you anwser a few questions so that I fully understand your issue?
-
You are using BACnet library + AnotherStorageImplementation project from examples to show a Trend object in your BACnet network that holds some values you get from other source through rest api, correct?
-
In above screenshot Trend object has invalid Status flags. This is the Trend object served by your project and your reading it with some other tool?
-
What did you mean by 'When i try to set some value to the status'? You mean by creating a new TrendLogRecord you were able to provide a big value which is later seen as invalud Status flags? If so, please check out the commit I referenced.
from bacnet.
Hi
In response to you question that's exactly what i try to do.
I setting the status from the trendlog to '3' to see if i get correct status flags but somewhere the uint is converted to a bitstring and something strange happens, I think it shout be a bitstring from the beginning. I'm setting the value trough the trendlog.AddValue().
I reading the trend by some kind of scada system for building management.
I will have a look at the commit and will come back to you
from bacnet.
Unfortunately the 'var recordStatusFlags = BacnetBitString.ConvertFromInt((uint)record.statusFlags);' does not work as i expected. When i set status flag 'IN_ALARM' it is still converted as zero
(I have only just copied the EncodeLog Record to my own code for debugging)
from bacnet.
Hi,
If i change the code into :
/* Tag 2: status */
var recordStatusFlags = BacnetBitString.ConvertFromInt((uint)record.statusFlags);
//if (recordStatusFlags.bits_used > 0)
if (true)
{
recordStatusFlags.SetBit(0, false);
recordStatusFlags.SetBit(1, true);
recordStatusFlags.SetBit(2, false);
recordStatusFlags.SetBit(3, true);
ASN1.encode_opening_tag(buffer, 2);
ASN1.encode_application_bitstring(buffer, recordStatusFlags);
ASN1.encode_closing_tag(buffer, 2);
}
the wireshark gives me the following
from bacnet.
@BennoMeijer that's wierd... I have added some unit tests and they showed that the number of bits being used was calculted wrong but this should be connected to your problem... I have added a possibility to specify explicitly how many bits will be used so now trend log record should not get more than 4 bits for status flags. Can you check if it works for you? You can also verify the unit tests are passing.
from bacnet.
Hi,
It didn't work for me, but i found something. I have removed the opening and closing tags,
/* Tag 2: status */
var recordStatusFlags = BacnetBitString.ConvertFromInt((uint)record.statusFlags, 4);
if (recordStatusFlags.bits_used => 0)
{
recordStatusFlags.SetBit(0, false);
recordStatusFlags.SetBit(1, false);
recordStatusFlags.SetBit(2, false);
recordStatusFlags.SetBit(3, false);
encode_application_bitstring(buffer, recordStatusFlags);
}
and i had to change the call to encode_tag, set the tagNumber to BACNET_APPLICATION_TAG_UNSIGNED_INT end set the contextSpecific to true
public static void encode_application_bitstring(EncodeBuffer buffer, BacnetBitString bitString)
{
uint bitStringEncodedLength = 1; /* 1 for the bits remaining octet */
/* bit string may use more than 1 octet for the tag, so find out how many */
bitStringEncodedLength += bitstring_bytesUsed(bitString);
encode_tag(buffer, (byte)BacnetApplicationTags.BACNET_APPLICATION_TAG_UNSIGNED_INT, true, bitStringEncodedLength);
encode_bitstring(buffer, bitString);
}
now the wireshark looks ok,
from bacnet.
Related Issues (20)
- “System.IO.FileNotFoundException”类型的未经处理的异常在 BACnet.dll 中发生 HOT 1
- Decoding datetime objects - error on some devices
- Wrong text for reject code 9
- ReadPropertyAsync on OBJECT_CHARACTERSTRING_VALUE with MS/TP transport silently truncates data HOT 1
- problem with 'shared port' in bacnet ip/udp module HOT 1
- OutOfRangeException when sending big request HOT 3
- Setting up a notification class
- Trouble Publishing Due to Out-Of-Date Dependencies HOT 1
- Throws exception when parsing 'BacnetAddress' structure with broadcast mac address HOT 1
- IndexOutOfRangeException when calling BacnetClient.ReadPropertyResponse
- Setting `.DontFragment` on `UdpClient` on MacOS fails with an exception HOT 1
- SEGMENTATION NOT SUPPORTED WHEN REQUESTING DEVICE WITH MANY OBJECT PROPERTIES HOT 5
- Secure Bacnet (BACnetSC)
- BasicReadAndWrite Example got Nullreference exception when reading Analog input HOT 1
- Is it Possible to Create a BACnet/IP to BACnet/MSTP Router using This Library?
- VS2022 Compile issues with BasicReadWrite Example
- YABE compatibility
- ExceptionSchedule Property - Write
- Notification Class not receiving all notifications in .Net 6.0 Windows/Linux
- Problem in Discovering devices in a network from docker container running in Ubuntu 18 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bacnet.