upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
UPM Utility API for BACnet. More...
This class implements some common access functions that are useful to any driver making use of the bacnetmstp driver.
It provides some basic functionality for reading and writing a proprty (with and without relability checking) as well as access to error conditions. It is intended to be inherited by your driver class.
Data Structures | |
struct | binaryData_t |
struct | multiStateData_t |
Public Member Functions | |
BACNETUTIL (uint32_t targetDeviceObjectID) | |
virtual | ~BACNETUTIL () |
virtual void | initMaster (std::string port, int baudRate, int deviceInstanceNumber, int macAddr, int maxMaster=DEFAULT_MAX_MASTER, int maxInfoFrames=1) |
virtual void | setDebug (bool enable) |
virtual float | getAnalogValue (uint32_t objInstance) |
virtual void | setAnalogValue (uint32_t objInstance, float value) |
virtual float | getAnalogInput (uint32_t objInstance) |
virtual std::string | getAnalogValueUnits (uint32_t objInstance) |
virtual std::string | getAnalogInputUnits (uint32_t objInstance) |
virtual bool | getBinaryInput (uint32_t objInstance) |
virtual std::string | lookupBinaryInputText (uint32_t objInstance, bool value) |
virtual std::string | getBinaryInputText (uint32_t objInstance) |
virtual bool | getBinaryValue (uint32_t objInstance) |
virtual void | setBinaryValue (uint32_t objInstance, bool value) |
virtual std::string | lookupBinaryValueText (uint32_t objInstance, bool value) |
virtual std::string | getBinaryValueText (uint32_t objInstance) |
virtual unsigned int | getMultiStateValue (uint32_t objInstance) |
virtual std::string | lookupMultiStateValueText (uint32_t objInstance, unsigned int value) |
virtual std::string | getMultiStateValueText (uint32_t objInstance) |
virtual unsigned int | getMultiStateValueMaxStates (uint32_t objInstance) |
virtual void | setMultiStateValue (uint32_t objInstance, unsigned int value) |
virtual void | checkReliability (bool enable) |
virtual std::string | getDeviceDescription () |
virtual std::string | getDeviceLocation () |
virtual bool | setDeviceLocation (std::string location) |
virtual std::string | getDeviceName () |
virtual bool | setDeviceName (std::string name) |
virtual std::string | getAllErrorString () |
virtual BACNETMSTP::BACERR_TYPE_T | getErrorType () |
virtual uint8_t | getRejectReason () |
virtual std::string | getRejectString () |
virtual uint8_t | getAbortReason () |
virtual std::string | getAbortString () |
virtual BACNET_ERROR_CLASS | getErrorClass () |
virtual BACNET_ERROR_CODE | getErrorCode () |
virtual std::string | getErrorString () |
virtual std::string | getUPMErrorString () |
Protected Types | |
typedef std::map< uint32_t, binaryData_t > | binaryInfo_t |
typedef std::map< uint32_t, multiStateData_t > | multiStateInfo_t |
typedef std::map< uint32_t, std::string > | avCacheMap_t |
typedef std::map< uint32_t, std::string > | aiCacheMap_t |
Protected Attributes | |
bool | m_debugging |
bool | m_checkReliability |
uint32_t | m_targetDeviceObjectID |
BACNETMSTP * | m_instance |
bool | m_initialized |
binaryInfo_t | m_bvInfo |
binaryInfo_t | m_biInfo |
multiStateInfo_t | m_msvInfo |
avCacheMap_t | m_avUnitCache |
aiCacheMap_t | m_aiUnitCache |
BACNETUTIL | ( | uint32_t | targetDeviceObjectID | ) |
|
virtual |
BACNETUTIL Destructor
|
virtual |
This function initializes the underlying BACNETMSTP Master singleton in the event it has not already been initialized. If the BACNETMSTP Master singleton has already been initialized, then this call will be ignored.
port | The serial port that the RS-485 interface is connected to. |
baudRate | The baudrate of the RS-485 interface. All devices on a BACnet RS-485 bus must run at the same baudrate. Valid values are 9600, 19200, 38400, 57600, 76800, and 115200. |
deviceInstanceNumber | This is the unique Device Object Instance number that will be used for our BACnet Master in order to communicate over the BACnet interface. This number must be between 1-4194302 and must be unique on the BACnet network. |
macAddr | This is the MAC address of our BACnet Master. It must be unique on the BACnet segment, and must be between 1-127. |
maxMaster | This specifies to our Master the maximum MAC address used by any other Masters on the BACnet network. This must be between 1-127, the default is 127. Do not change this unless you know what you are doing or you could introduce token passing errors on the BACnet network. |
maxInfoFrames | This number specifies the maximum number of transmissions (like requests for data) our Master is allowed to make before passing the token to the next Master. The default is 1. |
|
virtual |
Enable some debugging output in this module as well as the BACNETMSTP module. Debugging is disabled by default.
enable | true to enable, false to disable. |
|
virtual |
Retrieve the Present_Value property of an Analog Value object. If checkReliability() has been enabled, then the Reliability property of the object will be retrieved first. If the Reliability property is anything other than RELIABILITY_NO_FAULT_DETECTED, then the method will throw. Reliability checking is disabled by default for performance reasons.
objInstance | The Analog Value Object instance. |
|
virtual |
Set the Present_Value property of an Analog Value object. This method will throw on an error.
objInstance | The Analog Value Object instance. |
value | The data value to write. |
|
virtual |
Retrieve the Present_Value property of an Analog Input object. If checkReliability() has been enabled, then the Reliability property of the object will be retrieved first. If the Reliability property is anything other than RELIABILITY_NO_FAULT_DETECTED, then the method will throw. Reliability checking is disabled by default for performance reasons.
objInstance | The Analog Input Object instance. |
|
virtual |
Query an Analog Value object for the unit code, translate it into a string and cache the result for future use. Return the BACnet text for the Unit enumeration. Unit enumerations are things like 'kilowatt-hours', 'volts', etc. For Objects which do not have a Units property defined for them, or for which Units has no meaning, 'no-units' will typically be returned and cached for the object.
objInstance | The Analog Value Object instance. |
|
virtual |
Query an Analog Input object for the unit code, translate it into a string and cache the result for future use. Return the BACnet text for the Unit enumeration. Unit enumerations are things like 'kilowatt-hours', 'volts', etc. For Objects which do not have a Units property defined for them, or for which Units has no meaning, 'no-units' will typically be returned and cached for the object.
objInstance | The Analog Input Object instance. |
|
virtual |
Retrieve the Present_Value property of a Binary Input object. If checkReliability() has been enabled, then the Reliability property of the object will be retrieved first. If the Reliability property is anything other than RELIABILITY_NO_FAULT_DETECTED, then the method will throw. Reliability checking is disabled by default for performance reasons.
objInstance | The Object Instance number to query |
|
virtual |
Lookup (retrieve if necessary) the Inactive_Text and Active_Text properties of a Binary Input object. These text properties are optional and can provide a string representing a given state (true/false) that can be more informational than just the boolean value the object represents. This is useful in applications that display this data to a user for example. If this text is not present in the object (as it is not required), then a string representation of the value will be returned instead ("active" and "inactive").
objInstance | The Object Instance number of the object |
value | The value you want to lookup the text representation for. |
|
virtual |
Return a string representation of the Present_Value property of a BinaryInput object. This method just calls getBinaryInput() on the object, uses lookupBinaryInputText() to lookup the corresponding text value, and returns the result.
objInstance | The Object Instance number of the object. |
|
virtual |
Retrieve the Present_Value property of a Binary Value object. If checkReliability() has been enabled, then the Reliability property of the object will be retrieved first. If the Reliability property is anything other than RELIABILITY_NO_FAULT_DETECTED, then the method will throw. Reliability checking is disabled by default for performance reasons.
objInstance | The Object Instance number to query |
|
virtual |
Set the Present_Value property of a Binary Value object. This method will throw on an error.
objInstance | The Analog Value Object instance. |
value | The data value to write |
|
virtual |
Lookup (retrieve if necessary) the Inactive_Text and Active_Text properties of a Binary Value object. These text properties are optional and can provide a string representing a given state (true/false) that can be more informational than just the boolean value the object represents. This is useful in applications that display this data to a user for example. If this text is not present in the object (as it is not required), then a string representation of the value will be returned instead ("active" and "inactive").
objInstance | The Object Instance number of the object. |
value | The value you want to lookup the text representation for. |
|
virtual |
Return a string representation of the Present_Value property of a Binary Value object. This method just calls getBinaryValue() on the object, uses lookupBinaryValueText() to lookup the corresponding text value, and returns the result.
objInstance | The Object Instance number of the object. |
|
virtual |
Retrieve the Present_Value property of a Multi State Value object. If checkReliability() has been enabled, then the Reliability property of the object will be retrieved first. If the Reliability property is anything other than RELIABILITY_NO_FAULT_DETECTED, then the method will throw. Reliability checking is disabled by default for performance reasons.
objInstance | The Object Instance number to query. |
|
virtual |
Lookup (retrieve if necessary) the State_Text strings corresponding to the supplied value of a MultiStateValue object. State_Text is an optional property that can provide strings representing a given state that can be more informational than just the unsigned integer the object represents. This is useful in applications that display this data to a user for example. If this text is not present in the object (as it is not required), then a string representation of the integer value will be returned instead.
objInstance | The Object Instance number of the object. |
value | The value you want to lookup the text representation for. |
|
virtual |
Return a string representation of the Present_Value property of a MultiStateValue object. This method just calls getMultiStateValue() on the object, uses lookupMultiStateValueText() to lookup the corresponding State_Text value, and returns the result.
objInstance | The Object Instance number of the object. |
|
virtual |
Return the maximum legal value of a Multi State Value Object. The value represents the highest value the Present_Value porperty of the object will allow.
objInstance | The Object Instance number of the object. |
|
virtual |
Set the Present_Value property of a Multi State Value object. The value provided must not be 0, and must not exceed the object's Number_Of_States property. Use getMultiStateValueMaxStates() to determine the maximum value the object supports. This method will throw on an error.
objInstance | The MultiStateValue Object instance. |
value | The data value to write. |
|
inlinevirtual |
Enable or disable reliability checking. When retrieving data, the Present_Value property is returned. There is also an optional property called Reliability that can be checked to ensure that the Present_Value property is currently valid.
Enabling Reliability Checking has the data retrieval functions check for a RELIABILITY_NO_FAULT_DETECTED value for the Reliability property before querying the Present_Value property. If anything other than RELIABILITY_NO_FAULT_DETECTED is set, then the method will throw.
This checking is disabled by default since it will double the number of queries needed to retrieve a given value. In addition, since it is an optional property, calling it for an object that does not support it will also throw. However, if you need to ensure that the values returned are always completely valid as determined by the device firmware, and the objects you are querying support the reliability property, you can enable this.
enable | true to check Reliability before returning a value, false otherwise. |
|
virtual |
Query the Device Object of the device and return it's Description property. This typically contains information like the Vendor, model and serial number of a device.
|
virtual |
Query the Device Object of the device and return it's Location property. This typically contains a string indication of a customer specific value. Use setLocation() to change.
|
virtual |
Set the Device Object's Location property. This must be a string containing no more than 63 characters. Not all devices allow setting the location.
location | The new location to set, if supported. |
|
virtual |
Query the Device Object of the device and return it's Name property. This should contain a unique string value. Use setName() to change. Note, according to the spec, the Device Object Name must be unique within a given BACnet network.
|
virtual |
Set the Device Object's Name property. This must be a string containing at least one character and no more than 63 characters. Note, according to the spec, the Device Object Name must be unique within a given BACnet network.
name | The name to set. |
|
virtual |
This is a utility function that will return a string reporting on the various types of errors that can occur in BACnet operation.
|
virtual |
Return an enumration of the last error type to occur. The value returned will be one of the BACNETMSTP::BACERR_TYPE_T values.
|
virtual |
In the event of a BACnet Reject error, return the error code.
|
virtual |
In the event of a BACnet Reject error, return the error string.
|
virtual |
In the event of a BACnet Abort error, return the Abort reason code.
|
virtual |
In the event of a BACnet Abort error, return the Abort string.
|
virtual |
In the event of a general BACnet error, return the BACnet error class.
|
virtual |
In the event of a general BACnet error, return the BACnet error code.
|
virtual |
In the event of a general BACnet error, return the BACnet error string.
|
virtual |
In the event of a non-BACnet UPM error, return a string describing the error.