Updated vendor name and ID to use the one specified in config.h or DEFINED.
This commit is contained in:
@@ -26,6 +26,9 @@
|
|||||||
#if !defined(BACNET_VENDOR_ID)
|
#if !defined(BACNET_VENDOR_ID)
|
||||||
#define BACNET_VENDOR_ID 260
|
#define BACNET_VENDOR_ID 260
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(BACNET_VENDOR_NAME)
|
||||||
|
#define BACNET_VENDOR_NAME "BACnet Stack at SourceForge"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Max number of bytes in an APDU. */
|
/* Max number of bytes in an APDU. */
|
||||||
/* Typical sizes are 50, 128, 206, 480, 1024, and 1476 octets */
|
/* Typical sizes are 50, 128, 206, 480, 1024, and 1476 octets */
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ void Device_Property_Lists(
|
|||||||
static uint32_t Object_Instance_Number = 0;
|
static uint32_t Object_Instance_Number = 0;
|
||||||
static char Object_Name[16] = "SimpleServer";
|
static char Object_Name[16] = "SimpleServer";
|
||||||
static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
|
static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
|
||||||
static char Vendor_Name[16] = "ASHRAE";
|
static 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[16] = "GNU";
|
static char Model_Name[16] = "GNU";
|
||||||
static char Application_Software_Version[16] = "1.0";
|
static char Application_Software_Version[16] = "1.0";
|
||||||
@@ -220,19 +220,6 @@ const char *Device_Vendor_Name(void)
|
|||||||
return Vendor_Name;
|
return Vendor_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device_Set_Vendor_Name(const char *name, size_t length)
|
|
||||||
{
|
|
||||||
bool status = false; /*return value */
|
|
||||||
|
|
||||||
if (length < sizeof(Vendor_Name)) {
|
|
||||||
memmove(Vendor_Name, name, length);
|
|
||||||
Vendor_Name[length] = 0;
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t Device_Vendor_Identifier(void)
|
uint16_t Device_Vendor_Identifier(void)
|
||||||
{
|
{
|
||||||
return Vendor_Identifier;
|
return Vendor_Identifier;
|
||||||
@@ -1012,11 +999,7 @@ void testDevice(Test * pTest)
|
|||||||
Device_Set_System_Status(STATUS_NON_OPERATIONAL);
|
Device_Set_System_Status(STATUS_NON_OPERATIONAL);
|
||||||
ct_test(pTest, Device_System_Status() == STATUS_NON_OPERATIONAL);
|
ct_test(pTest, Device_System_Status() == STATUS_NON_OPERATIONAL);
|
||||||
|
|
||||||
Device_Set_Vendor_Name(name, strlen(name));
|
ct_test(pTest, Device_Vendor_Identifier() == BACNET_VENDOR_ID);
|
||||||
ct_test(pTest, strcmp(Device_Vendor_Name(), name) == 0);
|
|
||||||
|
|
||||||
Device_Set_Vendor_Identifier(42);
|
|
||||||
ct_test(pTest, Device_Vendor_Identifier() == 42);
|
|
||||||
|
|
||||||
Device_Set_Model_Name(name, strlen(name));
|
Device_Set_Model_Name(name, strlen(name));
|
||||||
ct_test(pTest, strcmp(Device_Model_Name(), name) == 0);
|
ct_test(pTest, strcmp(Device_Model_Name(), name) == 0);
|
||||||
|
|||||||
@@ -60,10 +60,8 @@ extern "C" {
|
|||||||
void Device_Set_System_Status(BACNET_DEVICE_STATUS status);
|
void Device_Set_System_Status(BACNET_DEVICE_STATUS status);
|
||||||
|
|
||||||
const char *Device_Vendor_Name(void);
|
const char *Device_Vendor_Name(void);
|
||||||
bool Device_Set_Vendor_Name(const char *name, size_t length);
|
|
||||||
|
|
||||||
uint16_t Device_Vendor_Identifier(void);
|
uint16_t Device_Vendor_Identifier(void);
|
||||||
void Device_Set_Vendor_Identifier(uint16_t vendor_id);
|
|
||||||
|
|
||||||
const char *Device_Model_Name(void);
|
const char *Device_Model_Name(void);
|
||||||
bool Device_Set_Model_Name(const char *name, size_t length);
|
bool Device_Set_Model_Name(const char *name, size_t length);
|
||||||
|
|||||||
@@ -112,10 +112,9 @@ void Device_Set_System_Status(BACNET_DEVICE_STATUS status)
|
|||||||
System_Status = status;
|
System_Status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: put your vendor ID here! */
|
|
||||||
uint16_t Device_Vendor_Identifier(void)
|
uint16_t Device_Vendor_Identifier(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return BACNET_VENDOR_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Device_Protocol_Version(void)
|
uint8_t Device_Protocol_Version(void)
|
||||||
@@ -277,7 +276,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
|||||||
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_NAME:
|
case PROP_VENDOR_NAME:
|
||||||
characterstring_init_ansi(&char_string, "ASHRAE");
|
characterstring_init_ansi(&char_string, BACNET_VENDOR_NAME);
|
||||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_IDENTIFIER:
|
case PROP_VENDOR_IDENTIFIER:
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
|||||||
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_NAME:
|
case PROP_VENDOR_NAME:
|
||||||
characterstring_init_ansi(&char_string, "ASHRAE");
|
characterstring_init_ansi(&char_string, BACNET_VENDOR_NAME);
|
||||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_IDENTIFIER:
|
case PROP_VENDOR_IDENTIFIER:
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
|||||||
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
encode_tagged_enumerated(&apdu[0], Device_System_Status());
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_NAME:
|
case PROP_VENDOR_NAME:
|
||||||
(void) strcpypgm2ram(&string_buffer[0], "ASHRAE");
|
(void) strcpypgm2ram(&string_buffer[0], BACNET_VENDOR_NAME);
|
||||||
characterstring_init_ansi(&char_string, string_buffer);
|
characterstring_init_ansi(&char_string, string_buffer);
|
||||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user