Added Code::Blocks project for read property demo.
Added value decoding and display for read property demo. Removed the I-Am at the beginning of read property demo.
This commit is contained in:
@@ -44,8 +44,16 @@
|
|||||||
/* for debugging... */
|
/* for debugging... */
|
||||||
static void PrintReadPropertyData(BACNET_READ_PROPERTY_DATA *data)
|
static void PrintReadPropertyData(BACNET_READ_PROPERTY_DATA *data)
|
||||||
{
|
{
|
||||||
|
BACNET_APPLICATION_DATA_VALUE value; /* for decode value data */
|
||||||
|
int len = 0;
|
||||||
|
uint8_t *application_data;
|
||||||
|
int application_data_len;
|
||||||
|
bool first_value = true;
|
||||||
|
bool print_brace = false;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (data->array_index == BACNET_ARRAY_ALL)
|
if (data->array_index == BACNET_ARRAY_ALL)
|
||||||
fprintf(stderr,"%s #%u %s\n",
|
fprintf(stderr,"%s #%u %s\n",
|
||||||
bactext_object_type_name(data->object_type),
|
bactext_object_type_name(data->object_type),
|
||||||
@@ -57,6 +65,41 @@ static void PrintReadPropertyData(BACNET_READ_PROPERTY_DATA *data)
|
|||||||
data->object_instance,
|
data->object_instance,
|
||||||
bactext_property_name(data->object_property),
|
bactext_property_name(data->object_property),
|
||||||
data->array_index);
|
data->array_index);
|
||||||
|
#endif
|
||||||
|
application_data = data->application_data;
|
||||||
|
application_data_len = data->application_data_len;
|
||||||
|
/* value? need to loop until all of the len is gone... */
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
len = bacapp_decode_application_data(
|
||||||
|
application_data,
|
||||||
|
application_data_len,
|
||||||
|
&value);
|
||||||
|
if (first_value && (len < application_data_len))
|
||||||
|
{
|
||||||
|
first_value = false;
|
||||||
|
fprintf(stdout,"{");
|
||||||
|
print_brace = true;
|
||||||
|
}
|
||||||
|
bacapp_print_value(stdout,&value,data->object_property);
|
||||||
|
if (len)
|
||||||
|
{
|
||||||
|
if (len < application_data_len)
|
||||||
|
{
|
||||||
|
application_data += len;
|
||||||
|
application_data_len -= len;
|
||||||
|
/* there's more! */
|
||||||
|
fprintf(stdout,",");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (print_brace)
|
||||||
|
fprintf(stdout,"}");
|
||||||
|
fprintf(stdout,"\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +118,9 @@ void handler_read_property_ack(
|
|||||||
service_request,
|
service_request,
|
||||||
service_len,
|
service_len,
|
||||||
&data);
|
&data);
|
||||||
|
#if 0
|
||||||
fprintf(stderr,"Received Read-Property Ack!\n");
|
fprintf(stderr,"Received Read-Property Ack!\n");
|
||||||
|
#endif
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
PrintReadPropertyData(&data);
|
PrintReadPropertyData(&data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,369 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE CodeBlocks_project_file>
|
||||||
|
<CodeBlocks_project_file>
|
||||||
|
<FileVersion major="1" minor="1"/>
|
||||||
|
<Project>
|
||||||
|
<Option title="BACnet Read Property Demo"/>
|
||||||
|
<Option makefile="Makefile"/>
|
||||||
|
<Option makefile_is_custom="0"/>
|
||||||
|
<Option compiler="2"/>
|
||||||
|
<Build>
|
||||||
|
<Target title="default">
|
||||||
|
<Option output="C:\code\bacnet-stack\demo\readprop\bacrp.exe"/>
|
||||||
|
<Option working_dir="."/>
|
||||||
|
<Option object_output=".objs"/>
|
||||||
|
<Option deps_output=".deps"/>
|
||||||
|
<Option type="1"/>
|
||||||
|
<Option compiler="2"/>
|
||||||
|
<Option projectResourceIncludeDirsRelation="1"/>
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-DBACDL_BIP=1;TSM_ENABLED=1"/>
|
||||||
|
<Add directory="..\handler"/>
|
||||||
|
<Add directory="..\object"/>
|
||||||
|
<Add directory="..\..\..\bacnet-stack"/>
|
||||||
|
<Add directory="..\..\ports\win32"/>
|
||||||
|
</Compiler>
|
||||||
|
<Linker>
|
||||||
|
<Add library="..\..\..\..\BCC55\Lib\import32.lib"/>
|
||||||
|
<Add library="..\..\..\..\BCC55\Lib\cw32mt.lib"/>
|
||||||
|
</Linker>
|
||||||
|
</Target>
|
||||||
|
</Build>
|
||||||
|
<Unit filename="..\..\abort.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\abort.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\address.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\address.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\apdu.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\apdu.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\arf.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\arf.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\awf.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\awf.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacapp.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacapp.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacdcode.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacdcode.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacdef.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacenum.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacerror.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacerror.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacstr.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bacstr.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bactext.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bactext.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bigend.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bigend.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bip.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\bip.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\config.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\datalink.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\datalink.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\client.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\h_iam.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\h_rp.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\h_rp_a.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\h_whois.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\handlers.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\noserv.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\s_rp.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\s_whois.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\txbuf.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\handler\txbuf.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\ai.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\ai.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\ao.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\ao.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\bacfile.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\bacfile.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\device.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\object\device.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="readprop.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\filename.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\filename.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\iam.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\iam.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\indtext.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\indtext.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\npdu.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\npdu.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\ports\win32\bip-init.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\reject.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\reject.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\rp.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\rp.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\tsm.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\tsm.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\whois.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\whois.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\wp.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="..\..\wp.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
</Project>
|
||||||
|
</CodeBlocks_project_file>
|
||||||
@@ -71,10 +71,8 @@ static void MyErrorHandler(
|
|||||||
/* FIXME: verify src and invoke id */
|
/* FIXME: verify src and invoke id */
|
||||||
(void)src;
|
(void)src;
|
||||||
(void)invoke_id;
|
(void)invoke_id;
|
||||||
printf("\r\nBACnet Error!\r\n");
|
printf("BACnet Error: %s: %s\r\n",
|
||||||
printf("Error Class: %s\r\n",
|
bactext_error_class_name(error_class),
|
||||||
bactext_error_class_name(error_class));
|
|
||||||
printf("Error Code: %s\r\n",
|
|
||||||
bactext_error_code_name(error_code));
|
bactext_error_code_name(error_code));
|
||||||
Error_Detected = true;
|
Error_Detected = true;
|
||||||
}
|
}
|
||||||
@@ -87,8 +85,7 @@ void MyAbortHandler(
|
|||||||
/* FIXME: verify src and invoke id */
|
/* FIXME: verify src and invoke id */
|
||||||
(void)src;
|
(void)src;
|
||||||
(void)invoke_id;
|
(void)invoke_id;
|
||||||
printf("\r\nBACnet Abort!\r\n");
|
printf("BACnet Abort: %s\r\n",
|
||||||
printf("Abort Reason: %s\r\n",
|
|
||||||
bactext_abort_reason_name(abort_reason));
|
bactext_abort_reason_name(abort_reason));
|
||||||
Error_Detected = true;
|
Error_Detected = true;
|
||||||
}
|
}
|
||||||
@@ -101,15 +98,14 @@ void MyRejectHandler(
|
|||||||
/* FIXME: verify src and invoke id */
|
/* FIXME: verify src and invoke id */
|
||||||
(void)src;
|
(void)src;
|
||||||
(void)invoke_id;
|
(void)invoke_id;
|
||||||
printf("\r\nBACnet Reject!\r\n");
|
printf("BACnet Reject: %s\r\n",
|
||||||
printf("Reject Reason: %s\r\n",
|
|
||||||
bactext_reject_reason_name(reject_reason));
|
bactext_reject_reason_name(reject_reason));
|
||||||
Error_Detected = true;
|
Error_Detected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Init_Service_Handlers(void)
|
static void Init_Service_Handlers(void)
|
||||||
{
|
{
|
||||||
/* we need to handle who-is
|
/* we need to handle who-is
|
||||||
to support dynamic device binding to us */
|
to support dynamic device binding to us */
|
||||||
apdu_set_unconfirmed_handler(
|
apdu_set_unconfirmed_handler(
|
||||||
SERVICE_UNCONFIRMED_WHO_IS,
|
SERVICE_UNCONFIRMED_WHO_IS,
|
||||||
@@ -147,12 +143,12 @@ int main(int argc, char *argv[])
|
|||||||
unsigned timeout = 100; // milliseconds
|
unsigned timeout = 100; // milliseconds
|
||||||
unsigned max_apdu = 0;
|
unsigned max_apdu = 0;
|
||||||
time_t elapsed_seconds = 0;
|
time_t elapsed_seconds = 0;
|
||||||
time_t last_seconds = 0;
|
time_t last_seconds = 0;
|
||||||
time_t current_seconds = 0;
|
time_t current_seconds = 0;
|
||||||
time_t timeout_seconds = 0;
|
time_t timeout_seconds = 0;
|
||||||
uint8_t invoke_id = 0;
|
uint8_t invoke_id = 0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (argc < 5)
|
if (argc < 5)
|
||||||
{
|
{
|
||||||
printf("%s device-instance object-type object-instance property [index]\r\n",
|
printf("%s device-instance object-type object-instance property [index]\r\n",
|
||||||
@@ -190,7 +186,7 @@ int main(int argc, char *argv[])
|
|||||||
Target_Object_Property,MAX_BACNET_PROPERTY_ID+1);
|
Target_Object_Property,MAX_BACNET_PROPERTY_ID+1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup my info */
|
/* setup my info */
|
||||||
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
|
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
|
||||||
address_init();
|
address_init();
|
||||||
@@ -204,6 +200,8 @@ int main(int argc, char *argv[])
|
|||||||
last_seconds = time(NULL);
|
last_seconds = time(NULL);
|
||||||
timeout_seconds = (Device_APDU_Timeout() / 1000) *
|
timeout_seconds = (Device_APDU_Timeout() / 1000) *
|
||||||
Device_Number_Of_APDU_Retries();
|
Device_Number_Of_APDU_Retries();
|
||||||
|
/* no need to spam the world */
|
||||||
|
I_Am_Request = false;
|
||||||
/* try to bind with the device */
|
/* try to bind with the device */
|
||||||
Send_WhoIs(Target_Device_Object_Instance,Target_Device_Object_Instance);
|
Send_WhoIs(Target_Device_Object_Instance,Target_Device_Object_Instance);
|
||||||
/* loop forever */
|
/* loop forever */
|
||||||
@@ -246,7 +244,7 @@ int main(int argc, char *argv[])
|
|||||||
&Target_Address);
|
&Target_Address);
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
if (invoke_id == 0)
|
if (invoke_id == 0)
|
||||||
{
|
{
|
||||||
invoke_id = Send_Read_Property_Request(
|
invoke_id = Send_Read_Property_Request(
|
||||||
Target_Device_Object_Instance,
|
Target_Device_Object_Instance,
|
||||||
|
|||||||
Reference in New Issue
Block a user