Indented using indent script. Corrected any C++ comments using the comment script.
This commit is contained in:
@@ -141,7 +141,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -158,7 +159,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -217,21 +218,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
@@ -189,7 +189,7 @@ void PrintReadPropertyData(
|
||||
bacapp_print_value(stdout, &value, data->object_property);
|
||||
if (Object_List_Index <= Object_List_Length) {
|
||||
fprintf(stdout, ",");
|
||||
if (!(Object_List_Index%4)) {
|
||||
if (!(Object_List_Index % 4)) {
|
||||
fprintf(stdout, "\r\n ");
|
||||
}
|
||||
} else {
|
||||
@@ -300,7 +300,7 @@ static uint8_t Read_Properties(
|
||||
printf(" %s: ", bactext_property_name(pRequired[index]));
|
||||
invoke_id =
|
||||
Send_Read_Property_Request(device_instance, OBJECT_DEVICE,
|
||||
device_instance, pRequired[index], BACNET_ARRAY_ALL);
|
||||
device_instance, pRequired[index], BACNET_ARRAY_ALL);
|
||||
if (invoke_id) {
|
||||
index++;
|
||||
}
|
||||
@@ -310,7 +310,8 @@ static uint8_t Read_Properties(
|
||||
return invoke_id;
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -386,21 +387,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -437,13 +434,11 @@ int main(
|
||||
timeout_seconds =
|
||||
(Device_APDU_Timeout() / 1000) * Device_Number_Of_APDU_Retries();
|
||||
/* try to bind with the device */
|
||||
found = address_bind_request(
|
||||
Target_Device_Object_Instance,
|
||||
&max_apdu,
|
||||
found =
|
||||
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance,
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
}
|
||||
printf("List of Objects in test device:\r\n");
|
||||
|
||||
@@ -116,24 +116,20 @@ static int cov_encode_subscription(
|
||||
apdu_len += len;
|
||||
/* network-number Unsigned16, */
|
||||
/* -- A value of 0 indicates the local network */
|
||||
len = encode_application_unsigned(
|
||||
&apdu[apdu_len],
|
||||
len =
|
||||
encode_application_unsigned(&apdu[apdu_len],
|
||||
cov_subscription->dest.net);
|
||||
apdu_len += len;
|
||||
/* mac-address OCTET STRING */
|
||||
/* -- A string of length 0 indicates a broadcast */
|
||||
if (cov_subscription->dest.net) {
|
||||
octetstring_init(&octet_string,
|
||||
&cov_subscription->dest.adr[0],
|
||||
octetstring_init(&octet_string, &cov_subscription->dest.adr[0],
|
||||
cov_subscription->dest.len);
|
||||
} else {
|
||||
octetstring_init(&octet_string,
|
||||
&cov_subscription->dest.mac[0],
|
||||
octetstring_init(&octet_string, &cov_subscription->dest.mac[0],
|
||||
cov_subscription->dest.mac_len);
|
||||
}
|
||||
len = encode_application_octet_string(
|
||||
&apdu[apdu_len],
|
||||
&octet_string);
|
||||
len = encode_application_octet_string(&apdu[apdu_len], &octet_string);
|
||||
apdu_len += len;
|
||||
/* CHOICE - address [1] BACnetAddress - closing */
|
||||
len = encode_closing_tag(&apdu[apdu_len], 1);
|
||||
@@ -142,38 +138,37 @@ static int cov_encode_subscription(
|
||||
len = encode_closing_tag(&apdu[apdu_len], 0);
|
||||
apdu_len += len;
|
||||
/* processIdentifier [1] Unsigned32 */
|
||||
len = encode_context_unsigned(&apdu[apdu_len],1,
|
||||
len =
|
||||
encode_context_unsigned(&apdu[apdu_len], 1,
|
||||
cov_subscription->subscriberProcessIdentifier);
|
||||
apdu_len += len;
|
||||
/* Recipient [0] BACnetRecipientProcess - closing */
|
||||
len = encode_closing_tag(&apdu[apdu_len], 0);
|
||||
apdu_len += len;
|
||||
/* MonitoredPropertyReference [1] BACnetObjectPropertyReference,*/
|
||||
/* MonitoredPropertyReference [1] BACnetObjectPropertyReference, */
|
||||
len = encode_opening_tag(&apdu[apdu_len], 1);
|
||||
apdu_len += len;
|
||||
/* objectIdentifier [0] */
|
||||
len = encode_context_object_id(
|
||||
&apdu[apdu_len],0,
|
||||
len =
|
||||
encode_context_object_id(&apdu[apdu_len], 0,
|
||||
cov_subscription->monitoredObjectIdentifier.type,
|
||||
cov_subscription->monitoredObjectIdentifier.instance);
|
||||
apdu_len += len;
|
||||
/* propertyIdentifier [1] */
|
||||
/* FIXME: we are monitoring 2 properties! How to encode? */
|
||||
len = encode_context_enumerated(
|
||||
&apdu[apdu_len],1,
|
||||
PROP_PRESENT_VALUE);
|
||||
len = encode_context_enumerated(&apdu[apdu_len], 1, PROP_PRESENT_VALUE);
|
||||
apdu_len += len;
|
||||
/* MonitoredPropertyReference [1] - closing */
|
||||
len = encode_closing_tag(&apdu[apdu_len], 1);
|
||||
apdu_len += len;
|
||||
/* IssueConfirmedNotifications [2] BOOLEAN, */
|
||||
len = encode_context_boolean(
|
||||
&apdu[apdu_len],2,
|
||||
len =
|
||||
encode_context_boolean(&apdu[apdu_len], 2,
|
||||
cov_subscription->issueConfirmedNotifications);
|
||||
apdu_len += len;
|
||||
/* TimeRemaining [3] Unsigned, */
|
||||
len = encode_context_unsigned(
|
||||
&apdu[apdu_len],3,
|
||||
len =
|
||||
encode_context_unsigned(&apdu[apdu_len], 3,
|
||||
cov_subscription->lifetime);
|
||||
apdu_len += len;
|
||||
|
||||
@@ -181,7 +176,8 @@ static int cov_encode_subscription(
|
||||
}
|
||||
|
||||
int handler_cov_encode_subscriptions(
|
||||
uint8_t * apdu, int max_apdu)
|
||||
uint8_t * apdu,
|
||||
int max_apdu)
|
||||
{
|
||||
int len = 0;
|
||||
int apdu_len = 0;
|
||||
@@ -190,10 +186,9 @@ int handler_cov_encode_subscriptions(
|
||||
if (apdu) {
|
||||
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
|
||||
if (COV_Subscriptions[index].valid) {
|
||||
len = cov_encode_subscription(
|
||||
&apdu[apdu_len],
|
||||
max_apdu - apdu_len,
|
||||
&COV_Subscriptions[index]);
|
||||
len =
|
||||
cov_encode_subscription(&apdu[apdu_len],
|
||||
max_apdu - apdu_len, &COV_Subscriptions[index]);
|
||||
apdu_len += len;
|
||||
if (apdu_len > max_apdu) {
|
||||
return -2;
|
||||
@@ -304,7 +299,7 @@ static bool cov_send_request(
|
||||
BACNET_ADDRESS my_address;
|
||||
int bytes_sent = 0;
|
||||
uint8_t invoke_id = 0;
|
||||
bool status = false; /* return value */
|
||||
bool status = false; /* return value */
|
||||
BACNET_COV_DATA cov_data;
|
||||
BACNET_PROPERTY_VALUE value_list[2];
|
||||
|
||||
@@ -314,31 +309,25 @@ static bool cov_send_request(
|
||||
datalink_get_my_address(&my_address);
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(
|
||||
&Handler_Transmit_Buffer[0],
|
||||
&cov_subscription->dest,
|
||||
&my_address,
|
||||
&npdu_data);
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &cov_subscription->dest,
|
||||
&my_address, &npdu_data);
|
||||
/* load the COV data structure for outgoing message */
|
||||
cov_data.subscriberProcessIdentifier =
|
||||
cov_subscription->subscriberProcessIdentifier;
|
||||
cov_data.initiatingDeviceIdentifier =
|
||||
Device_Object_Instance_Number();
|
||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
||||
cov_data.monitoredObjectIdentifier.type =
|
||||
cov_subscription->monitoredObjectIdentifier.type;
|
||||
cov_data.monitoredObjectIdentifier.instance =
|
||||
cov_subscription->monitoredObjectIdentifier.instance;
|
||||
cov_data.timeRemaining =
|
||||
cov_subscription->lifetime;
|
||||
cov_data.timeRemaining = cov_subscription->lifetime;
|
||||
/* encode the value list */
|
||||
cov_data.listOfValues = &value_list[0];
|
||||
value_list[0].next = &value_list[1];
|
||||
value_list[1].next = NULL;
|
||||
switch (cov_subscription->monitoredObjectIdentifier.type) {
|
||||
case OBJECT_BINARY_INPUT:
|
||||
Binary_Input_Encode_Value_List(
|
||||
cov_subscription->monitoredObjectIdentifier.instance,
|
||||
&value_list[0]);
|
||||
Binary_Input_Encode_Value_List(cov_subscription->
|
||||
monitoredObjectIdentifier.instance, &value_list[0]);
|
||||
break;
|
||||
default:
|
||||
goto COV_FAILED;
|
||||
@@ -346,37 +335,31 @@ static bool cov_send_request(
|
||||
if (cov_subscription->issueConfirmedNotifications) {
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
len = ccov_notify_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len],
|
||||
invoke_id,
|
||||
&cov_data);
|
||||
len =
|
||||
ccov_notify_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
invoke_id, &cov_data);
|
||||
} else {
|
||||
goto COV_FAILED;
|
||||
}
|
||||
} else {
|
||||
len = ucov_notify_encode_apdu(
|
||||
&Handler_Transmit_Buffer[pdu_len],
|
||||
len =
|
||||
ucov_notify_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
&cov_data);
|
||||
}
|
||||
pdu_len += len;
|
||||
if (cov_subscription->issueConfirmedNotifications) {
|
||||
tsm_set_confirmed_unsegmented_transaction(
|
||||
invoke_id,
|
||||
&cov_subscription->dest,
|
||||
&npdu_data,
|
||||
&Handler_Transmit_Buffer[0],
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id,
|
||||
&cov_subscription->dest, &npdu_data, &Handler_Transmit_Buffer[0],
|
||||
(uint16_t) pdu_len);
|
||||
}
|
||||
bytes_sent = datalink_send_pdu(
|
||||
&cov_subscription->dest,
|
||||
&npdu_data,
|
||||
&Handler_Transmit_Buffer[0],
|
||||
pdu_len);
|
||||
bytes_sent =
|
||||
datalink_send_pdu(&cov_subscription->dest, &npdu_data,
|
||||
&Handler_Transmit_Buffer[0], pdu_len);
|
||||
if (bytes_sent > 0) {
|
||||
status = true;
|
||||
}
|
||||
|
||||
COV_FAILED:
|
||||
COV_FAILED:
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -400,9 +383,8 @@ void handler_cov_task(
|
||||
if (lifetime_seconds >= elapsed_seconds) {
|
||||
COV_Subscriptions[index].lifetime -= elapsed_seconds;
|
||||
#if 0
|
||||
fprintf(stderr,"COVtask: subscription[%d].lifetime=%d\n",
|
||||
index,
|
||||
COV_Subscriptions[index].lifetime);
|
||||
fprintf(stderr, "COVtask: subscription[%d].lifetime=%d\n",
|
||||
index, COV_Subscriptions[index].lifetime);
|
||||
#endif
|
||||
} else {
|
||||
COV_Subscriptions[index].lifetime = 0;
|
||||
@@ -419,8 +401,7 @@ void handler_cov_task(
|
||||
case OBJECT_BINARY_INPUT:
|
||||
if (Binary_Input_Change_Of_Value(object_id.instance)) {
|
||||
COV_Subscriptions[index].send_requested = true;
|
||||
Binary_Input_Change_Of_Value_Clear(
|
||||
object_id.instance);
|
||||
Binary_Input_Change_Of_Value_Clear(object_id.instance);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -445,8 +426,8 @@ static bool cov_subscribe(
|
||||
switch (cov_data->monitoredObjectIdentifier.type) {
|
||||
case OBJECT_BINARY_INPUT:
|
||||
status = true;
|
||||
status = cov_list_subscribe(src, cov_data,
|
||||
error_class, error_code);
|
||||
status =
|
||||
cov_list_subscribe(src, cov_data, error_class, error_code);
|
||||
break;
|
||||
default:
|
||||
*error_class = ERROR_CLASS_OBJECT;
|
||||
|
||||
@@ -42,31 +42,36 @@
|
||||
/* list of devices */
|
||||
static OS_Keylist Device_List = NULL;
|
||||
|
||||
void objects_init(void)
|
||||
void objects_init(
|
||||
void)
|
||||
{
|
||||
if (!Device_List)
|
||||
Device_List = Keylist_Create();
|
||||
}
|
||||
|
||||
int objects_device_count(void)
|
||||
int objects_device_count(
|
||||
void)
|
||||
{
|
||||
objects_init();
|
||||
return Keylist_Count(Device_List);
|
||||
}
|
||||
|
||||
OBJECT_DEVICE_T *objects_device_data(int index)
|
||||
OBJECT_DEVICE_T *objects_device_data(
|
||||
int index)
|
||||
{
|
||||
objects_init();
|
||||
return Keylist_Data_Index(Device_List, index);
|
||||
}
|
||||
|
||||
OBJECT_DEVICE_T *objects_device_by_instance(uint32_t device_instance)
|
||||
OBJECT_DEVICE_T *objects_device_by_instance(
|
||||
uint32_t device_instance)
|
||||
{
|
||||
objects_init();
|
||||
return Keylist_Data(Device_List, device_instance);
|
||||
}
|
||||
|
||||
OBJECT_DEVICE_T *objects_device_new(uint32_t device_instance)
|
||||
OBJECT_DEVICE_T *objects_device_new(
|
||||
uint32_t device_instance)
|
||||
{
|
||||
OBJECT_DEVICE_T *pDevice = NULL;
|
||||
KEY key = device_instance;
|
||||
@@ -85,7 +90,8 @@ OBJECT_DEVICE_T *objects_device_new(uint32_t device_instance)
|
||||
pDevice->Object_List = Keylist_Create();
|
||||
Keylist_Data_Add(Device_List, key, pDevice);
|
||||
} else {
|
||||
fprintf(stderr,"Objects: Unable to allocate device %d buffer\n",
|
||||
fprintf(stderr,
|
||||
"Objects: Unable to allocate device %d buffer\n",
|
||||
device_instance);
|
||||
}
|
||||
}
|
||||
@@ -94,7 +100,8 @@ OBJECT_DEVICE_T *objects_device_new(uint32_t device_instance)
|
||||
return pDevice;
|
||||
}
|
||||
|
||||
OBJECT_DEVICE_T *objects_device_delete(int index)
|
||||
OBJECT_DEVICE_T *objects_device_delete(
|
||||
int index)
|
||||
{
|
||||
OBJECT_DEVICE_T *pDevice = NULL;
|
||||
BACNET_OBJECT_ID *pObject;
|
||||
@@ -102,12 +109,12 @@ OBJECT_DEVICE_T *objects_device_delete(int index)
|
||||
if (Device_List) {
|
||||
pDevice = Keylist_Data_Delete_By_Index(Device_List, index);
|
||||
if (pDevice) {
|
||||
fprintf(stderr,"Objects: removing device %d",
|
||||
fprintf(stderr, "Objects: removing device %d",
|
||||
pDevice->Object_Identifier.instance);
|
||||
if (pDevice->Object_List) {
|
||||
do {
|
||||
pObject =
|
||||
Keylist_Data_Delete_By_Index(pDevice->Object_List,0);
|
||||
Keylist_Data_Delete_By_Index(pDevice->Object_List, 0);
|
||||
/* free any dynamic memory used */
|
||||
if (pObject) {
|
||||
free(pObject);
|
||||
@@ -130,7 +137,7 @@ OBJECT_DEVICE_T *objects_device_delete(int index)
|
||||
/* test the object creation and deletion */
|
||||
void testBACnetObjectsCompare(
|
||||
Test * pTest,
|
||||
OBJECT_DEVICE_T *pDevice,
|
||||
OBJECT_DEVICE_T * pDevice,
|
||||
uint32_t device_id)
|
||||
{
|
||||
ct_test(pTest, pDevice != NULL);
|
||||
@@ -150,28 +157,26 @@ void testBACnetObjects(
|
||||
const unsigned max_test_points = 20;
|
||||
OBJECT_DEVICE_T *pDevice;
|
||||
|
||||
for (test_point = 0;test_point < max_test_points;test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE/max_test_points);
|
||||
for (test_point = 0; test_point < max_test_points; test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
|
||||
pDevice = objects_device_new(device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
pDevice = objects_device_by_instance(device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
}
|
||||
ct_test(pTest, max_test_points == objects_device_count());
|
||||
for (test_point = 0;test_point < max_test_points;test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE/max_test_points);
|
||||
for (test_point = 0; test_point < max_test_points; test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
|
||||
pDevice = objects_device_by_instance(device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
testBACnetObjectsCompare(pTest, pDevice, device_id);
|
||||
}
|
||||
for (test_point = 0;test_point < max_test_points;test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE/max_test_points);
|
||||
for (test_point = 0; test_point < max_test_points; test_point++) {
|
||||
device_id = test_point * (BACNET_MAX_INSTANCE / max_test_points);
|
||||
pDevice = objects_device_data(test_point);
|
||||
testBACnetObjectsCompare(
|
||||
pTest,
|
||||
pDevice,
|
||||
Keylist_Key(Device_List, test_point));
|
||||
testBACnetObjectsCompare(pTest, pDevice, Keylist_Key(Device_List,
|
||||
test_point));
|
||||
}
|
||||
for (test_point = 0;test_point < max_test_points;test_point++) {
|
||||
for (test_point = 0; test_point < max_test_points; test_point++) {
|
||||
pDevice = objects_device_delete(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ void Binary_Input_Change_Of_Value_Clear(
|
||||
|
||||
bool Binary_Input_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE *value_list)
|
||||
BACNET_PROPERTY_VALUE * value_list)
|
||||
{
|
||||
value_list->propertyIdentifier = PROP_PRESENT_VALUE;
|
||||
value_list->propertyArrayIndex = BACNET_ARRAY_ALL;
|
||||
@@ -224,20 +224,18 @@ bool Binary_Input_Encode_Value_List(
|
||||
value_list->value.context_specific = false;
|
||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||
bitstring_init(&value_list->value.type.Bit_String);
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_IN_ALARM, false);
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_FAULT, false);
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM,
|
||||
false);
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String, STATUS_FLAG_FAULT,
|
||||
false);
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_OVERRIDDEN, false);
|
||||
if (Binary_Input_Out_Of_Service(object_instance)) {
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_OUT_OF_SERVICE,
|
||||
true);
|
||||
STATUS_FLAG_OUT_OF_SERVICE, true);
|
||||
} else {
|
||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||
STATUS_FLAG_OUT_OF_SERVICE,
|
||||
false);
|
||||
STATUS_FLAG_OUT_OF_SERVICE, false);
|
||||
}
|
||||
value_list->priority = BACNET_NO_PRIORITY;
|
||||
|
||||
|
||||
@@ -877,8 +877,7 @@ int Device_Encode_Property_APDU(
|
||||
#endif
|
||||
case PROP_ACTIVE_COV_SUBSCRIPTIONS:
|
||||
/* FIXME: the real max apdu should be passed into function */
|
||||
apdu_len = handler_cov_encode_subscriptions(
|
||||
&apdu[0], MAX_APDU);
|
||||
apdu_len = handler_cov_encode_subscriptions(&apdu[0], MAX_APDU);
|
||||
break;
|
||||
default:
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
|
||||
@@ -196,7 +196,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -213,7 +214,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -272,21 +273,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
@@ -133,7 +133,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -150,7 +151,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -209,21 +210,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -282,8 +279,7 @@ int main(
|
||||
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance,
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
|
||||
@@ -136,7 +136,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -153,7 +154,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -212,21 +213,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
@@ -98,7 +98,8 @@ static void cleanup(
|
||||
datalink_cleanup();
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -115,7 +116,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -175,21 +176,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t last_seconds = 0;
|
||||
@@ -200,43 +197,43 @@ int main(
|
||||
/* allow the device ID to be set */
|
||||
if (argc > 1)
|
||||
Device_Set_Object_Instance_Number(strtol(argv[1], NULL, 0));
|
||||
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
|
||||
Device_Object_Instance_Number(), MAX_APDU);
|
||||
Init_Service_Handlers();
|
||||
Init_DataLink();
|
||||
atexit(cleanup);
|
||||
/* configure the timeout values */
|
||||
last_seconds = time(NULL);
|
||||
/* broadcast an I-Am on startup */
|
||||
iam_send(&Handler_Transmit_Buffer[0]);
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
/* input */
|
||||
current_seconds = time(NULL);
|
||||
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
|
||||
Device_Object_Instance_Number(), MAX_APDU);
|
||||
Init_Service_Handlers();
|
||||
Init_DataLink();
|
||||
atexit(cleanup);
|
||||
/* configure the timeout values */
|
||||
last_seconds = time(NULL);
|
||||
/* broadcast an I-Am on startup */
|
||||
iam_send(&Handler_Transmit_Buffer[0]);
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
/* input */
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* returns 0 bytes on timeout */
|
||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||
/* returns 0 bytes on timeout */
|
||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
elapsed_seconds = current_seconds - last_seconds;
|
||||
if (elapsed_seconds) {
|
||||
last_seconds = current_seconds;
|
||||
dcc_timer_seconds(elapsed_seconds);
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
bvlc_maintenance_timer(elapsed_seconds);
|
||||
#endif
|
||||
Load_Control_State_Machine_Handler();
|
||||
elapsed_milliseconds = elapsed_seconds * 1000;
|
||||
handler_cov_task(elapsed_seconds);
|
||||
tsm_timer_milliseconds(elapsed_milliseconds);
|
||||
}
|
||||
/* output */
|
||||
|
||||
/* blink LEDs, Turn on or off outputs, etc */
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
elapsed_seconds = current_seconds - last_seconds;
|
||||
if (elapsed_seconds) {
|
||||
last_seconds = current_seconds;
|
||||
dcc_timer_seconds(elapsed_seconds);
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
bvlc_maintenance_timer(elapsed_seconds);
|
||||
#endif
|
||||
Load_Control_State_Machine_Handler();
|
||||
elapsed_milliseconds = elapsed_seconds * 1000;
|
||||
handler_cov_task(elapsed_seconds);
|
||||
tsm_timer_milliseconds(elapsed_milliseconds);
|
||||
}
|
||||
/* output */
|
||||
|
||||
/* blink LEDs, Turn on or off outputs, etc */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -122,7 +123,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -181,21 +182,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t elapsed_seconds = 0;
|
||||
|
||||
@@ -66,7 +66,8 @@ static void Init_Service_Handlers(
|
||||
handler_read_property);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -83,7 +84,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -142,27 +143,22 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
char *value_string = NULL;
|
||||
bool status = false;
|
||||
BACNET_COV_DATA cov_data;
|
||||
BACNET_PROPERTY_VALUE value_list;
|
||||
uint8_t tag;
|
||||
|
||||
if (argc < 7) {
|
||||
if (argc < 7) {
|
||||
/* note: priority 16 and 0 should produce the same end results... */
|
||||
printf("Usage: %s pid device-id object-type object-instance "
|
||||
"time property tag value [priority] [index]\r\n" "\r\n" "pid:\r\n"
|
||||
@@ -215,8 +211,8 @@ int main(
|
||||
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
||||
return 0;
|
||||
}
|
||||
/* decode the command line parameters */
|
||||
cov_data.subscriberProcessIdentifier = strtol(argv[1], NULL, 0);
|
||||
/* decode the command line parameters */ cov_data.
|
||||
subscriberProcessIdentifier = strtol(argv[1], NULL, 0);
|
||||
cov_data.initiatingDeviceIdentifier = strtol(argv[2], NULL, 0);
|
||||
cov_data.monitoredObjectIdentifier.type = strtol(argv[3], NULL, 0);
|
||||
cov_data.monitoredObjectIdentifier.instance = strtol(argv[4], NULL, 0);
|
||||
|
||||
@@ -105,7 +105,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -122,7 +123,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -181,21 +182,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t elapsed_seconds = 0;
|
||||
|
||||
@@ -141,7 +141,8 @@ static void print_address_cache(
|
||||
}
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -158,7 +159,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -217,21 +218,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
time_t total_seconds = 0;
|
||||
|
||||
@@ -150,7 +150,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -167,7 +168,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -226,21 +227,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
@@ -147,7 +147,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_reject_handler(MyRejectHandler);
|
||||
}
|
||||
|
||||
static void Init_DataLink(void)
|
||||
static void Init_DataLink(
|
||||
void)
|
||||
{
|
||||
char *pEnv = NULL;
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
@@ -164,7 +165,7 @@ static void Init_DataLink(void)
|
||||
datalink_set(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
@@ -223,21 +224,17 @@ static void Init_DataLink(void)
|
||||
struct in_addr addr;
|
||||
addr.s_addr = bbmd_address;
|
||||
printf("WhoIs: Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr),bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(
|
||||
bbmd_address,
|
||||
bbmd_port,
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
||||
int main(int argc, char *argv[]) {
|
||||
BACNET_ADDRESS src = {
|
||||
0}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 100; /* milliseconds */
|
||||
unsigned max_apdu = 0;
|
||||
@@ -399,8 +396,7 @@ int main(
|
||||
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||
&Target_Address);
|
||||
if (!found) {
|
||||
Send_WhoIs(
|
||||
Target_Device_Object_Instance,
|
||||
Send_WhoIs(Target_Device_Object_Instance,
|
||||
Target_Device_Object_Instance);
|
||||
}
|
||||
/* loop forever */
|
||||
|
||||
Reference in New Issue
Block a user