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_LOCAL_DATE,
|
||||||
PROP_DAYLIGHT_SAVINGS_STATUS,
|
PROP_DAYLIGHT_SAVINGS_STATUS,
|
||||||
PROP_PROTOCOL_CONFORMANCE_CLASS,
|
PROP_PROTOCOL_CONFORMANCE_CLASS,
|
||||||
|
PROP_LOCATION,
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,8 +133,11 @@ static char Description[16] = "server";
|
|||||||
/* Active_VT_Sessions */
|
/* Active_VT_Sessions */
|
||||||
BACNET_TIME Local_Time; /* rely on OS, if there is one */
|
BACNET_TIME Local_Time; /* rely on OS, if there is one */
|
||||||
BACNET_DATE Local_Date; /* 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 */
|
/* NOTE: BACnet UTC Offset is inverse of common practice.
|
||||||
static int UTC_Offset = 5;
|
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 */
|
static bool Daylight_Savings_Status = false; /* rely on OS */
|
||||||
/* List_Of_Session_Keys */
|
/* List_Of_Session_Keys */
|
||||||
/* Time_Synchronization_Recipients */
|
/* Time_Synchronization_Recipients */
|
||||||
@@ -673,6 +677,12 @@ int Device_Encode_Property_APDU(
|
|||||||
apdu_len =
|
apdu_len =
|
||||||
encode_application_character_string(&apdu[0], &char_string);
|
encode_application_character_string(&apdu[0], &char_string);
|
||||||
break;
|
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 */
|
/* FIXME: if you support time */
|
||||||
case PROP_LOCAL_TIME:
|
case PROP_LOCAL_TIME:
|
||||||
/* FIXME: get the actual value */
|
/* FIXME: get the actual value */
|
||||||
@@ -684,7 +694,6 @@ int Device_Encode_Property_APDU(
|
|||||||
break;
|
break;
|
||||||
/* FIXME: if you support time */
|
/* FIXME: if you support time */
|
||||||
case PROP_UTC_OFFSET:
|
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);
|
apdu_len = encode_application_signed(&apdu[0], UTC_Offset);
|
||||||
break;
|
break;
|
||||||
/* FIXME: if you support date */
|
/* FIXME: if you support date */
|
||||||
|
|||||||
@@ -436,8 +436,9 @@ int Device_Encode_Property_APDU(
|
|||||||
apdu_len = encode_application_time(&apdu[0], &local_time);
|
apdu_len = encode_application_time(&apdu[0], &local_time);
|
||||||
break;
|
break;
|
||||||
case PROP_UTC_OFFSET:
|
case PROP_UTC_OFFSET:
|
||||||
/* Note: BACnet Time Zone is inverse of everybody else */
|
/* Note: BACnet Time Zone is offset of local time and UTC,
|
||||||
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
|
rather than offset of GMT. It is expressed in minutes */
|
||||||
|
apdu_len = encode_application_signed(&apdu[0], 5*60 /* EST */ );
|
||||||
break;
|
break;
|
||||||
case PROP_LOCAL_DATE:
|
case PROP_LOCAL_DATE:
|
||||||
/* FIXME: if you support date */
|
/* FIXME: if you support date */
|
||||||
|
|||||||
@@ -448,8 +448,9 @@ int Device_Encode_Property_APDU(
|
|||||||
apdu_len = encode_application_time(&apdu[0], &local_time);
|
apdu_len = encode_application_time(&apdu[0], &local_time);
|
||||||
break;
|
break;
|
||||||
case PROP_UTC_OFFSET:
|
case PROP_UTC_OFFSET:
|
||||||
/* Note: BACnet Time Zone is inverse of everybody else */
|
/* Note: BACnet Time Zone is offset of local time and UTC,
|
||||||
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
|
rather than offset of GMT. It is expressed in minutes */
|
||||||
|
apdu_len = encode_application_signed(&apdu[0], 5*60 /* EST */ );
|
||||||
break;
|
break;
|
||||||
case PROP_LOCAL_DATE:
|
case PROP_LOCAL_DATE:
|
||||||
/* FIXME: if you support date */
|
/* FIXME: if you support date */
|
||||||
|
|||||||
Reference in New Issue
Block a user