BACnetStack_InsertTrendLogMultipleRecord
bool BACnetStack_InsertTrendLogMultipleRecord( const uint32_t deviceInstance, const uint32_t objectInstance, const CASBACnetTime timestamp, const uint8_t dataType, const char * dataAsString, const uint32_t dataLength);Adds a log record to a Trend Log Multiple object.
The log record is passed in as string. Using the dataType the CAS BACnet Stack will decode the record accordingly and insert it into the Trend Log object
Returns true if successful or false if failed. Can fail for the following reasons:
- Object doesn’t exist
- Device doesn’t exist
- If required parameters are NULL or invalid
- Timestamp is invalid
- Datatype is invalid
- Can’t decode the dataAsString
- If trendlog is set to stop_when_full and you insert a record when its full.
BACnet reference: ANSI/ASHRAE 135-2024 clause 12.30 (Trend Log Multiple Object Type).
Parameters
Section titled “Parameters”| Parameter | Direction | Description |
|---|---|---|
deviceInstance |
in | The instance of the device that contains the trend log multiple object |
objectInstance |
in | The instance of the trend log multiple object. |
timestamp |
in | The timestamp of the record to insert, in UTC epoch seconds. The stack stores it as the Device’s local time, using the UTC_Offset (and Daylight_Savings_Status) your application serves for the Device at the time of the call. BACnetStack_ReadTrendLogMultipleRecord() converts it back with the offset served at the time of the read, so a backup and restore keeps each timestamp, but a record stored under the other Daylight_Savings_Status reads out one hour off. |
dataType |
in | The type of data to insert: which alternative of the record’s BACnetLogData CHOICE (cl. 21) it carries. Valid values are: - 0 = Log Status (a BACnetLogStatus BIT STRING) - 1 = Log Data (a list of logged values) - 2 = Time Change (a REAL) |
dataAsString |
in | The value of the record in string format Examples: - Log Status: “b101” - Log Data: Format is a Json like array of values where each element is a dataType, dataString pair - Data Types: - 0 = boolean value - 1 = real value - 2 = enumerated value - 3 = unsigned value - 4 = integer value - 5 = bitstring value - 6 = null value - 7 = failure - 8 = any value (a logged value of any other datatype, such as a Double or a CharacterString) - The exact grammar is [{“<type>”:“<value>”},{“<type>”:“<value>”}] - each pair in braces, BOTH halves in double quotes, separated by a COLON. An unquoted comma-separated form such as [{1,123.45}] does NOT parse and the whole call is rejected. - Boolean values are the words “true” and “false”; a failure value is “<errorClass>-<errorCode>” with a HYPHEN, e.g. “1-31”; a null value is the empty string; an empty bitstring is “b”; an any value is the encoded value in hex, two digits per octet, e.g. [{“8”:“720041”}] for the CharacterString “A”, or “x” for a value with no elements. Any value hex is stored as the value it decodes to, so non-canonical hex reads back in the stack’s lower-case encoding. - Example of 2 Real Values: [{“1”:“123.45”},{“1”:“234.5”}] - Example of 1 Enumerated, 1 Bitstring and 1 Null: [{“2”:“5”},{“5”:“b101010”},{“6”:“”}] - Time Change: “3600.0” |
dataLength |
in | The length of the dataAsString. |
Returns
Section titled “Returns”Returns true if successful, false if failed.
Topic: Schedules, calendars, trend logs and other object configuration. Declared in CASBACnetStackDLL.h.