Added Device_Set_Firmware_Revision and Device_Object_Name_ANSI to basic device object. (#1018)
This commit is contained in:
@@ -582,7 +582,7 @@ static const char *Vendor_Name = BACNET_VENDOR_NAME;
|
|||||||
static uint16_t Vendor_Identifier = BACNET_VENDOR_ID;
|
static uint16_t Vendor_Identifier = BACNET_VENDOR_ID;
|
||||||
static char Model_Name[MAX_DEV_MOD_LEN + 1] = "GNU";
|
static char Model_Name[MAX_DEV_MOD_LEN + 1] = "GNU";
|
||||||
static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0";
|
static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0";
|
||||||
static const char *BACnet_Version = BACNET_VERSION_TEXT;
|
static char Firmware_Version[MAX_DEV_VER_LEN + 1] = BACNET_VERSION_TEXT;
|
||||||
static char Location[MAX_DEV_LOC_LEN + 1] = "USA";
|
static char Location[MAX_DEV_LOC_LEN + 1] = "USA";
|
||||||
static char Description[MAX_DEV_DESC_LEN + 1] = "server";
|
static char Description[MAX_DEV_DESC_LEN + 1] = "server";
|
||||||
static char Serial_Number[MAX_DEV_DESC_LEN + 1] =
|
static char Serial_Number[MAX_DEV_DESC_LEN + 1] =
|
||||||
@@ -838,6 +838,15 @@ bool Device_Object_Name_ANSI_Init(const char *value)
|
|||||||
return characterstring_init_ansi(&My_Object_Name, value);
|
return characterstring_init_ansi(&My_Object_Name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the Device Object Name as a C string
|
||||||
|
* @return The object name as a null-terminated string
|
||||||
|
*/
|
||||||
|
char *Device_Object_Name_ANSI(void)
|
||||||
|
{
|
||||||
|
return (char *)characterstring_value(&My_Object_Name);
|
||||||
|
}
|
||||||
|
|
||||||
BACNET_DEVICE_STATUS Device_System_Status(void)
|
BACNET_DEVICE_STATUS Device_System_Status(void)
|
||||||
{
|
{
|
||||||
return System_Status;
|
return System_Status;
|
||||||
@@ -946,7 +955,20 @@ bool Device_Set_Model_Name(const char *name, size_t length)
|
|||||||
|
|
||||||
const char *Device_Firmware_Revision(void)
|
const char *Device_Firmware_Revision(void)
|
||||||
{
|
{
|
||||||
return BACnet_Version;
|
return Firmware_Version;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Device_Set_Firmware_Revision(const char *name, size_t length)
|
||||||
|
{
|
||||||
|
bool status = false; /*return value */
|
||||||
|
|
||||||
|
if (length < sizeof(Firmware_Version)) {
|
||||||
|
memmove(Firmware_Version, name, length);
|
||||||
|
Firmware_Version[length] = 0;
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Device_Application_Software_Version(void)
|
const char *Device_Application_Software_Version(void)
|
||||||
@@ -1430,7 +1452,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
encode_application_character_string(&apdu[0], &char_string);
|
encode_application_character_string(&apdu[0], &char_string);
|
||||||
break;
|
break;
|
||||||
case PROP_FIRMWARE_REVISION:
|
case PROP_FIRMWARE_REVISION:
|
||||||
characterstring_init_ansi(&char_string, BACnet_Version);
|
characterstring_init_ansi(&char_string, Firmware_Version);
|
||||||
apdu_len =
|
apdu_len =
|
||||||
encode_application_character_string(&apdu[0], &char_string);
|
encode_application_character_string(&apdu[0], &char_string);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user