SourceForge.net bug ID: 2785704. Added case in demo device object to return the Location property. Corrected comment and value of UTC Offset. Thank you piotrek ( bacpack )!
This commit is contained in:
@@ -86,6 +86,7 @@ static const int Device_Properties_Optional[] = {
|
||||
PROP_LOCAL_DATE,
|
||||
PROP_DAYLIGHT_SAVINGS_STATUS,
|
||||
PROP_PROTOCOL_CONFORMANCE_CLASS,
|
||||
PROP_LOCATION,
|
||||
-1
|
||||
};
|
||||
|
||||
@@ -132,8 +133,11 @@ static char Description[16] = "server";
|
||||
/* Active_VT_Sessions */
|
||||
BACNET_TIME Local_Time; /* rely on OS, if there is one */
|
||||
BACNET_DATE Local_Date; /* rely on OS, if there is one */
|
||||
/* BACnet UTC is inverse of standard offset - i.e. relative to local */
|
||||
static int UTC_Offset = 5;
|
||||
/* NOTE: BACnet UTC Offset is inverse of common practice.
|
||||
If your UTC offset is -5hours of GMT,
|
||||
then BACnet UTC offset is +5hours.
|
||||
BACnet UTC offset is expressed in minutes. */
|
||||
static int32_t UTC_Offset = 5*60;
|
||||
static bool Daylight_Savings_Status = false; /* rely on OS */
|
||||
/* List_Of_Session_Keys */
|
||||
/* Time_Synchronization_Recipients */
|
||||
@@ -673,6 +677,12 @@ int Device_Encode_Property_APDU(
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_LOCATION:
|
||||
characterstring_init_ansi(&char_string, Location);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
case PROP_LOCAL_TIME:
|
||||
/* FIXME: get the actual value */
|
||||
@@ -684,7 +694,6 @@ int Device_Encode_Property_APDU(
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
case PROP_UTC_OFFSET:
|
||||
/* NOTE: if your UTC offset is -5, then BACnet UTC offset is 5 */
|
||||
apdu_len = encode_application_signed(&apdu[0], UTC_Offset);
|
||||
break;
|
||||
/* FIXME: if you support date */
|
||||
|
||||
@@ -436,8 +436,9 @@ int Device_Encode_Property_APDU(
|
||||
apdu_len = encode_application_time(&apdu[0], &local_time);
|
||||
break;
|
||||
case PROP_UTC_OFFSET:
|
||||
/* Note: BACnet Time Zone is inverse of everybody else */
|
||||
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
|
||||
/* Note: BACnet Time Zone is offset of local time and UTC,
|
||||
rather than offset of GMT. It is expressed in minutes */
|
||||
apdu_len = encode_application_signed(&apdu[0], 5*60 /* EST */ );
|
||||
break;
|
||||
case PROP_LOCAL_DATE:
|
||||
/* FIXME: if you support date */
|
||||
|
||||
@@ -448,8 +448,9 @@ int Device_Encode_Property_APDU(
|
||||
apdu_len = encode_application_time(&apdu[0], &local_time);
|
||||
break;
|
||||
case PROP_UTC_OFFSET:
|
||||
/* Note: BACnet Time Zone is inverse of everybody else */
|
||||
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
|
||||
/* Note: BACnet Time Zone is offset of local time and UTC,
|
||||
rather than offset of GMT. It is expressed in minutes */
|
||||
apdu_len = encode_application_signed(&apdu[0], 5*60 /* EST */ );
|
||||
break;
|
||||
case PROP_LOCAL_DATE:
|
||||
/* FIXME: if you support date */
|
||||
|
||||
Reference in New Issue
Block a user