diff --git a/bacnet-stack/demo/handler/dlenv.c b/bacnet-stack/demo/handler/dlenv.c index da89c7ef..b7979e53 100644 --- a/bacnet-stack/demo/handler/dlenv.c +++ b/bacnet-stack/demo/handler/dlenv.c @@ -33,7 +33,7 @@ #include "apdu.h" #include "datalink.h" #include "handlers.h" -#include "client.h" +#include "dlenv.h" #include "tsm.h" /** @file dlenv.c Initialize the DataLink configuration. */ diff --git a/bacnet-stack/demo/handler/h_arf.c b/bacnet-stack/demo/handler/h_arf.c index df98515f..b51e710a 100644 --- a/bacnet-stack/demo/handler/h_arf.c +++ b/bacnet-stack/demo/handler/h_arf.c @@ -42,6 +42,7 @@ #if defined(BACFILE) #include "bacfile.h" #endif +#include "handlers.h" /** @file h_arf.c Handles Atomic Read File request. */ diff --git a/bacnet-stack/demo/handler/h_arf_a.c b/bacnet-stack/demo/handler/h_arf_a.c index 026c684f..07983a9b 100644 --- a/bacnet-stack/demo/handler/h_arf_a.c +++ b/bacnet-stack/demo/handler/h_arf_a.c @@ -25,7 +25,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" diff --git a/bacnet-stack/demo/handler/h_awf.c b/bacnet-stack/demo/handler/h_awf.c index e38f4919..28c94c94 100644 --- a/bacnet-stack/demo/handler/h_awf.c +++ b/bacnet-stack/demo/handler/h_awf.c @@ -42,6 +42,7 @@ #if defined(BACFILE) #include "bacfile.h" #endif +#include "handlers.h" /** @file h_awf.c Handles Atomic Write File request. */ diff --git a/bacnet-stack/demo/handler/h_cov.c b/bacnet-stack/demo/handler/h_cov.c index 8d325402..b96878b4 100644 --- a/bacnet-stack/demo/handler/h_cov.c +++ b/bacnet-stack/demo/handler/h_cov.c @@ -51,6 +51,7 @@ #if defined(BACFILE) #include "bacfile.h" #endif +#include "handlers.h" /** @file h_cov.c Handles Change of Value (COV) services. */ @@ -186,7 +187,7 @@ static int cov_encode_subscription( * @param apdu [out] Buffer in which the APDU contents are built. * @param max_apdu [in] Max length of the APDU buffer. * @return How many bytes were encoded in the buffer, or -2 if the response - * would not fit within the buffer. + * would not fit within the buffer. */ int handler_cov_encode_subscriptions( uint8_t * apdu, @@ -214,7 +215,7 @@ int handler_cov_encode_subscriptions( return apdu_len; } -/** Handler to initialize the COV list, clearing and disabling each entry. +/** Handler to initialize the COV list, clearing and disabling each entry. * @ingroup DSCOV */ void handler_cov_init( @@ -383,7 +384,7 @@ static bool cov_send_request( return status; } -/** Handler to check the list of subscribed objects for any that have changed +/** Handler to check the list of subscribed objects for any that have changed * and so need to have notifications sent. * @ingroup DSCOV * This handler will be invoked by the main program every second or so. @@ -396,12 +397,12 @@ static bool cov_send_request( * (eg, check with Binary_Input_Change_Of_Value() ) * - If changed, * - Clear the COV (eg, Binary_Input_Change_Of_Value_Clear() ) - * - Send the notice with cov_send_request() - * - Will be confirmed or unconfirmed, as per the subscription. - * + * - Send the notice with cov_send_request() + * - Will be confirmed or unconfirmed, as per the subscription. + * * @note worst case tasking: MS/TP with the ability to send only * one notification per task cycle. - * + * * @param elapsed_seconds [in] How many seconds have elapsed since last called. */ void handler_cov_task( @@ -490,13 +491,13 @@ static bool cov_subscribe( * - the message is segmented * - if decoding fails * - an ACK, if cov_subscribe() succeeds - * - an Error if cov_subscribe() fails - * + * - an Error if cov_subscribe() fails + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_cov_subscribe( uint8_t * service_request, diff --git a/bacnet-stack/demo/handler/h_dcc.c b/bacnet-stack/demo/handler/h_dcc.c index 8354e5cc..71082e0e 100644 --- a/bacnet-stack/demo/handler/h_dcc.c +++ b/bacnet-stack/demo/handler/h_dcc.c @@ -37,6 +37,7 @@ #include "abort.h" #include "reject.h" #include "dcc.h" +#include "handlers.h" /** @file h_dcc.c Handles Device Communication Control request. */ @@ -78,12 +79,12 @@ void handler_dcc_password_set( * - an Error if the DCC password is incorrect * - else tries to send a simple ACK for the DCC on success, * and sets the DCC state requested. - * + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_device_communication_control( uint8_t * service_request, diff --git a/bacnet-stack/demo/handler/h_getevent.c b/bacnet-stack/demo/handler/h_getevent.c index 52331ad1..f5499e2c 100644 --- a/bacnet-stack/demo/handler/h_getevent.c +++ b/bacnet-stack/demo/handler/h_getevent.c @@ -37,6 +37,7 @@ #include "abort.h" #include "event.h" #include "getevent.h" +#include "handlers.h" /** @file h_getevent.c Handles Get Event Information request. */ diff --git a/bacnet-stack/demo/handler/h_iam.c b/bacnet-stack/demo/handler/h_iam.c index f60b7927..98a8c8bf 100644 --- a/bacnet-stack/demo/handler/h_iam.c +++ b/bacnet-stack/demo/handler/h_iam.c @@ -31,6 +31,7 @@ #include "bacdcode.h" #include "iam.h" #include "address.h" +#include "handlers.h" /** @file h_iam.c Handles I-Am requests. */ @@ -77,8 +78,8 @@ void handler_i_am_add( /** Handler for I-Am responses (older binding-update-only version). * Will update the responder's binding, but if already in our cache. - * @note This handler is deprecated, in favor of handler_i_am_add(). - * + * @note This handler is deprecated, in favor of handler_i_am_add(). + * * @param service_request [in] The received message to be handled. * @param service_len [in] Length of the service_request message. * @param src [in] The BACNET_ADDRESS of the message's source. diff --git a/bacnet-stack/demo/handler/h_ihave.c b/bacnet-stack/demo/handler/h_ihave.c index ebd1ee61..e5f21aee 100644 --- a/bacnet-stack/demo/handler/h_ihave.c +++ b/bacnet-stack/demo/handler/h_ihave.c @@ -31,6 +31,7 @@ #include "bacdcode.h" #include "bactext.h" #include "ihave.h" +#include "handlers.h" /** @file h_ihave.c Handles incoming I-Have messages. */ diff --git a/bacnet-stack/demo/handler/h_npdu.c b/bacnet-stack/demo/handler/h_npdu.c index 9c6be5b0..4d6fc96b 100644 --- a/bacnet-stack/demo/handler/h_npdu.c +++ b/bacnet-stack/demo/handler/h_npdu.c @@ -31,6 +31,8 @@ #include "bits.h" #include "npdu.h" #include "apdu.h" +#include "handlers.h" +#include "client.h" #if PRINT_ENABLED #include diff --git a/bacnet-stack/demo/handler/h_pt.c b/bacnet-stack/demo/handler/h_pt.c index 667f9ef7..625c0b44 100644 --- a/bacnet-stack/demo/handler/h_pt.c +++ b/bacnet-stack/demo/handler/h_pt.c @@ -44,6 +44,7 @@ #endif #include "mydata.h" #include "ptransfer.h" +#include "handlers.h" /** @file h_pt.c Handles Confirmed Private Transfer requests. */ @@ -85,13 +86,13 @@ void ProcessPT( cBlockNumber = (char) ulTemp; if (cBlockNumber < MY_MAX_BLOCK) { if (data->serviceNumber == MY_SVC_READ) { - /* Read Response is an unsigned int with + /* Read Response is an unsigned int with 0 for success or a non 0 error code - For a successful read the 0 success + For a successful read the 0 success code is followed by the block number - and then the block contents which + and then the block contents which consist of 2 unsigned ints (in 0 to 255 - range as they are really chars) a single + range as they are really chars) a single precision real and a string which will be up to 32 chars + a nul */ @@ -119,11 +120,11 @@ void ProcessPT( &bsTemp); } else { /* Write operation */ - /* Write block consists of the block number + /* Write block consists of the block number followed by the block contents as - described above for the read operation. + described above for the read operation. The returned result is an unsigned - response which is 0 for success and + response which is 0 for success and a non 0 error code otherwise. */ tag_len = @@ -260,11 +261,11 @@ void handler_conf_private_trans( goto CPT_ABORT; } - /* Simple example with service number of 0 for + /* Simple example with service number of 0 for read block and 1 for write block - We also only support our own vendor ID. + We also only support our own vendor ID. In theory we could support others - for compatability purposes but these + for compatability purposes but these interfaces are rarely documented... */ if ((data.vendorID == BACNET_VENDOR_ID) && (data.serviceNumber <= MY_SVC_WRITE)) { diff --git a/bacnet-stack/demo/handler/h_pt_a.c b/bacnet-stack/demo/handler/h_pt_a.c index f2af8998..5a6e1ec8 100644 --- a/bacnet-stack/demo/handler/h_pt_a.c +++ b/bacnet-stack/demo/handler/h_pt_a.c @@ -44,13 +44,13 @@ #if defined(BACFILE) #include "bacfile.h" #endif +#include "handlers.h" /** @file h_pt_a.c Handles Confirmed Private Transfer Acknowledgment. */ extern uint8_t IOBufferPT[300]; /* Somewhere to build the encoded result block for Private Transfers */ - -void DecodeBlock( +static void DecodeBlock( char cBlockNum, uint8_t * pData) { @@ -116,9 +116,7 @@ void DecodeBlock( printf(" String : %s\n\n", Response.sMyString); } - - -void ProcessPTA( +static void ProcessPTA( BACNET_PRIVATE_TRANSFER_DATA * data) { int iLen; /* Index to current location in data */ diff --git a/bacnet-stack/demo/handler/h_rd.c b/bacnet-stack/demo/handler/h_rd.c index 304e8f6b..6dca7cb0 100644 --- a/bacnet-stack/demo/handler/h_rd.c +++ b/bacnet-stack/demo/handler/h_rd.c @@ -39,6 +39,7 @@ #include "rd.h" /* custom handling in device object */ #include "device.h" +#include "handlers.h" /** @file h_rd.c Handles Reinitialize Device requests. */ @@ -50,17 +51,17 @@ * - an Abort if * - the message is segmented * - if decoding fails - * - an Error if + * - an Error if * - the RD password is incorrect * - the Reinitialize Device operation fails * - a Reject if the request state is invalid * - else tries to send a simple ACK for the RD on success. - * + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_reinitialize_device( uint8_t * service_request, diff --git a/bacnet-stack/demo/handler/h_rp.c b/bacnet-stack/demo/handler/h_rp.c index b0e8053c..15d45624 100644 --- a/bacnet-stack/demo/handler/h_rp.c +++ b/bacnet-stack/demo/handler/h_rp.c @@ -40,6 +40,7 @@ #include "rp.h" /* device object has custom handler for all objects */ #include "device.h" +#include "handlers.h" /** @file h_rp.c Handles Read Property requests. */ @@ -54,14 +55,14 @@ * - if decoding fails * - if the response would be too large * - the result from Device_Read_Property(), if it succeeds - * - an Error if Device_Read_Property() fails + * - an Error if Device_Read_Property() fails * or there isn't enough room in the APDU to fit the data. - * + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_read_property( uint8_t * service_request, @@ -139,7 +140,7 @@ void handler_read_property( RP_FAILURE: if (error) { if (len == BACNET_STATUS_ABORT) { - /* Kludge alert! At the moment we assume any abort is due to + /* Kludge alert! At the moment we assume any abort is due to * to space issues due to segmentation or lack thereof. I wanted to show the proper * handling via the abort_convert_error_code() so I put the error code * in here, if you are sure all aborts properly set up the error_code then diff --git a/bacnet-stack/demo/handler/h_rp_a.c b/bacnet-stack/demo/handler/h_rp_a.c index e684a6c3..a051b081 100644 --- a/bacnet-stack/demo/handler/h_rp_a.c +++ b/bacnet-stack/demo/handler/h_rp_a.c @@ -26,7 +26,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" diff --git a/bacnet-stack/demo/handler/h_rpm_a.c b/bacnet-stack/demo/handler/h_rpm_a.c index 9149653f..cdbef20d 100644 --- a/bacnet-stack/demo/handler/h_rpm_a.c +++ b/bacnet-stack/demo/handler/h_rpm_a.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" diff --git a/bacnet-stack/demo/handler/h_rr.c b/bacnet-stack/demo/handler/h_rr.c index 30260ceb..45d01311 100644 --- a/bacnet-stack/demo/handler/h_rr.c +++ b/bacnet-stack/demo/handler/h_rr.c @@ -37,6 +37,7 @@ #include "abort.h" #include "readrange.h" #include "device.h" +#include "handlers.h" /** @file h_rr.c Handles Read Range requests. */ @@ -44,7 +45,7 @@ static uint8_t Temp_Buf[MAX_APDU] = { 0 }; /* Encodes the property APDU and returns the length, or sets the error, and returns -1 */ -int Encode_RR_payload( +static int Encode_RR_payload( uint8_t * apdu, BACNET_READ_RANGE_DATA * pRequest) { diff --git a/bacnet-stack/demo/handler/h_rr_a.c b/bacnet-stack/demo/handler/h_rr_a.c index 10208703..adc7b2f3 100644 --- a/bacnet-stack/demo/handler/h_rr_a.c +++ b/bacnet-stack/demo/handler/h_rr_a.c @@ -25,7 +25,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" diff --git a/bacnet-stack/demo/handler/h_ts.c b/bacnet-stack/demo/handler/h_ts.c index b728f0f2..d9cd76fe 100644 --- a/bacnet-stack/demo/handler/h_ts.c +++ b/bacnet-stack/demo/handler/h_ts.c @@ -30,6 +30,7 @@ #include "bacdef.h" #include "bacdcode.h" #include "timesync.h" +#include "handlers.h" /** @file h_ts.c Handles TimeSync requests. */ diff --git a/bacnet-stack/demo/handler/h_ucov.c b/bacnet-stack/demo/handler/h_ucov.c index 2e45a735..f5c198e0 100644 --- a/bacnet-stack/demo/handler/h_ucov.c +++ b/bacnet-stack/demo/handler/h_ucov.c @@ -37,6 +37,7 @@ /* special for this module */ #include "cov.h" #include "bactext.h" +#include "handlers.h" #ifndef MAX_COV_PROPERTIES #define MAX_COV_PROPERTIES 2 @@ -48,10 +49,10 @@ /** Handler for an Unconfirmed COV Notification. * @ingroup DSCOV * Decodes the received list of Properties to update, - * and print them out with the subscription information. + * and print them out with the subscription information. * @note Nothing is specified in BACnet about what to do with the * information received from Unconfirmed COV Notifications. - * + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message (unused) @@ -69,7 +70,7 @@ void handler_ucov_notification( /* src not needed for this application */ src = src; - /* create linked list to store data if more + /* create linked list to store data if more than one property value is expected */ pProperty_value = &property_value[0]; while (pProperty_value) { diff --git a/bacnet-stack/demo/handler/h_upt.c b/bacnet-stack/demo/handler/h_upt.c index 0f84c434..8ce97311 100644 --- a/bacnet-stack/demo/handler/h_upt.c +++ b/bacnet-stack/demo/handler/h_upt.c @@ -35,6 +35,7 @@ #include "npdu.h" #include "abort.h" #include "ptransfer.h" +#include "handlers.h" /** @file h_upt.c Handles Unconfirmed Private Transfer requests. */ diff --git a/bacnet-stack/demo/handler/h_whohas.c b/bacnet-stack/demo/handler/h_whohas.c index 7e894ab0..b8e0e44f 100644 --- a/bacnet-stack/demo/handler/h_whohas.c +++ b/bacnet-stack/demo/handler/h_whohas.c @@ -34,6 +34,7 @@ #include "whohas.h" #include "device.h" #include "client.h" +#include "handlers.h" /** @file h_whohas.c Handles Who-Has requests. */ diff --git a/bacnet-stack/demo/handler/h_whois.c b/bacnet-stack/demo/handler/h_whois.c index c8e50bf8..7d1261f4 100644 --- a/bacnet-stack/demo/handler/h_whois.c +++ b/bacnet-stack/demo/handler/h_whois.c @@ -36,6 +36,7 @@ #include "device.h" #include "client.h" #include "txbuf.h" +#include "handlers.h" /** @file h_whois.c Handles Who-Is requests. */ diff --git a/bacnet-stack/demo/handler/h_wp.c b/bacnet-stack/demo/handler/h_wp.c index d740a3c5..1f07541a 100644 --- a/bacnet-stack/demo/handler/h_wp.c +++ b/bacnet-stack/demo/handler/h_wp.c @@ -38,6 +38,7 @@ #include "wp.h" /* device object has the handling for all objects */ #include "device.h" +#include "handlers.h" /** @file h_wp.c Handles Write Property requests. */ @@ -51,14 +52,14 @@ * - the message is segmented * - if decoding fails * - an ACK if Device_Write_Property() succeeds - * - an Error if Device_Write_Property() fails + * - an Error if Device_Write_Property() fails * or there isn't enough room in the APDU to fit the data. - * + * * @param service_request [in] The contents of the service request. * @param service_len [in] The length of the service_request. * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_write_property( uint8_t * service_request, @@ -200,7 +201,7 @@ bool WPValidateArgType( { bool bResult; - /* + /* * start out assuming success and only set up error * response if validation fails. */ diff --git a/bacnet-stack/demo/handler/noserv.c b/bacnet-stack/demo/handler/noserv.c index 99c64c43..b0d2e112 100644 --- a/bacnet-stack/demo/handler/noserv.c +++ b/bacnet-stack/demo/handler/noserv.c @@ -33,19 +33,20 @@ #include "apdu.h" #include "npdu.h" #include "reject.h" +#include "handlers.h" /** @file noserv.c Handles an unrecognized/unsupported service. */ -/** Handler to be invoked when a Service request is received for which no +/** Handler to be invoked when a Service request is received for which no * handler has been defined. * @ingroup MISCHNDLR * This handler builds a Reject response packet, and sends it. - * + * * @param service_request [in] The contents of the service request (unused). * @param service_len [in] The length of the service_request (unused). * @param src [in] BACNET_ADDRESS of the source of the message - * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information - * decoded from the APDU header of this message. + * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information + * decoded from the APDU header of this message. */ void handler_unrecognized_service( uint8_t * service_request, diff --git a/bacnet-stack/demo/handler/s_ack_alarm.c b/bacnet-stack/demo/handler/s_ack_alarm.c index dbc14756..2835deff 100644 --- a/bacnet-stack/demo/handler/s_ack_alarm.c +++ b/bacnet-stack/demo/handler/s_ack_alarm.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -43,6 +42,7 @@ #include "handlers.h" #include "txbuf.h" #include "alarm_ack.h" +#include "client.h" /** @file s_ack_alarm.c Send an Alarm Acknowledgment. */ diff --git a/bacnet-stack/demo/handler/s_arfs.c b/bacnet-stack/demo/handler/s_arfs.c index 27592828..15d43971 100644 --- a/bacnet-stack/demo/handler/s_arfs.c +++ b/bacnet-stack/demo/handler/s_arfs.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,6 +41,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_arfs.c Send part of an Atomic Read File Stream. */ diff --git a/bacnet-stack/demo/handler/s_awfs.c b/bacnet-stack/demo/handler/s_awfs.c index a25789ac..b0aef8bb 100644 --- a/bacnet-stack/demo/handler/s_awfs.c +++ b/bacnet-stack/demo/handler/s_awfs.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,6 +41,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_awfs.c Send part of an Atomic Write File Stream request. */ diff --git a/bacnet-stack/demo/handler/s_cevent.c b/bacnet-stack/demo/handler/s_cevent.c index 662df472..52f8bda2 100644 --- a/bacnet-stack/demo/handler/s_cevent.c +++ b/bacnet-stack/demo/handler/s_cevent.c @@ -33,16 +33,17 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_cevent.c Send a ConfirmedEventNotification Request. */ /** Sends an Confirmed Alarm/Event Notification. * @ingroup EVNOTFCN - * + * * @param device_id [in] ID of the destination device * @param data [in] The information about the Event to be sent. * @return invoke id of outgoing message, or 0 if communication is disabled, - * or no tsm slot is available. + * or no tsm slot is available. */ uint8_t Send_CEvent_Notify( uint32_t device_id, diff --git a/bacnet-stack/demo/handler/s_cov.c b/bacnet-stack/demo/handler/s_cov.c index 4dee2c78..6cefdaab 100644 --- a/bacnet-stack/demo/handler/s_cov.c +++ b/bacnet-stack/demo/handler/s_cov.c @@ -40,6 +40,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_cov.c Send a Change of Value (COV) update or a Subscribe COV request. */ @@ -66,7 +67,7 @@ int ucov_notify_encode_pdu( /** Sends an Unconfirmed COV Notification. * @ingroup DSCOV - * + * * @param buffer [in,out] The buffer to build the message in for sending. * @param cov_data [in] The COV update information to be encoded. * @return Size of the message sent (bytes), or a negative value on error. @@ -88,7 +89,7 @@ int Send_UCOV_Notify( /** Sends a COV Subscription request. * @ingroup DSCOV - * + * * @param device_id [in] ID of the destination device * @param cov_data [in] The COV subscription information to be encoded. * @return invoke id of outgoing message, or 0 if communication is disabled or diff --git a/bacnet-stack/demo/handler/s_dcc.c b/bacnet-stack/demo/handler/s_dcc.c index 78c82dec..1f4653f7 100644 --- a/bacnet-stack/demo/handler/s_dcc.c +++ b/bacnet-stack/demo/handler/s_dcc.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -41,14 +40,15 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_dcc.c Send a Device Communication Control (DCC) request. */ /** Sends a Device Communication Control (DCC) request. * @ingroup DMDCC - * + * * @param device_id [in] The index to the device address in our address cache. - * @param timeDuration [in] If non-zero, the minutes that the remote device + * @param timeDuration [in] If non-zero, the minutes that the remote device * shall ignore all APDUs except DCC and, if supported, RD APDUs. * @param state [in] Choice to Enable or Disable communication. * @param password [in] Optional password, up to 20 chars. diff --git a/bacnet-stack/demo/handler/s_iam.c b/bacnet-stack/demo/handler/s_iam.c index 844b19b2..3126c8d5 100644 --- a/bacnet-stack/demo/handler/s_iam.c +++ b/bacnet-stack/demo/handler/s_iam.c @@ -39,6 +39,7 @@ #include "iam.h" /* some demo stuff needed */ #include "handlers.h" +#include "client.h" /** @file s_iam.c Send an I-Am message. */ @@ -71,7 +72,7 @@ int iam_encode_pdu( /** Broadcast an I Am message. * @ingroup DMDDB - * + * * @param buffer [in] The buffer to use for building and sending the message. */ void Send_I_Am( @@ -108,7 +109,7 @@ void Send_I_Am( /** Encode an I Am message to be unicast directly back to the src. * * @param buffer [in,out] The buffer to use for building the message. - * @param src [in] The source address information. If the src address is not + * @param src [in] The source address information. If the src address is not * given, the dest address will be a broadcast address. * @param dest [out] The destination address information. * @param npdu_data [out] The NPDU structure describing the message. diff --git a/bacnet-stack/demo/handler/s_ihave.c b/bacnet-stack/demo/handler/s_ihave.c index 544d81c0..75cd6d6a 100644 --- a/bacnet-stack/demo/handler/s_ihave.c +++ b/bacnet-stack/demo/handler/s_ihave.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,12 +41,13 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_ihave.c Send an I-Have (property) message. */ /** Broadcast an I Have message. * @ingroup DMDOB - * + * * @param device_id [in] My device ID. * @param object_type [in] The BACNET_OBJECT_TYPE that I Have. * @param object_instance [in] The Object ID that I Have. diff --git a/bacnet-stack/demo/handler/s_lso.c b/bacnet-stack/demo/handler/s_lso.c index 791a6f68..bc518144 100644 --- a/bacnet-stack/demo/handler/s_lso.c +++ b/bacnet-stack/demo/handler/s_lso.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -43,6 +42,7 @@ #include "handlers.h" #include "txbuf.h" #include "lso.h" +#include "client.h" /** @file s_lso.c Send BACnet Life Safety Operation message. */ diff --git a/bacnet-stack/demo/handler/s_ptransfer.c b/bacnet-stack/demo/handler/s_ptransfer.c index e1fe7a3b..577739b6 100644 --- a/bacnet-stack/demo/handler/s_ptransfer.c +++ b/bacnet-stack/demo/handler/s_ptransfer.c @@ -28,7 +28,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -44,6 +43,7 @@ #include "handlers.h" #include "txbuf.h" #include "mydata.h" +#include "client.h" /** @file s_ptransfer.c Send a Private Transfer request. */ diff --git a/bacnet-stack/demo/handler/s_rd.c b/bacnet-stack/demo/handler/s_rd.c index 626e65c1..f2fdc5b0 100644 --- a/bacnet-stack/demo/handler/s_rd.c +++ b/bacnet-stack/demo/handler/s_rd.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,12 +41,13 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_rd.c Send a Reinitialize Device request. */ /** Sends a Reinitialize Device (RD) request. * @ingroup DMRD - * + * * @param device_id [in] The index to the device address in our address cache. * @param state [in] Specifies the desired state of the device after reinitialization. * @param password [in] Optional password, up to 20 chars. diff --git a/bacnet-stack/demo/handler/s_readrange.c b/bacnet-stack/demo/handler/s_readrange.c index c8b5946a..e342bb78 100644 --- a/bacnet-stack/demo/handler/s_readrange.c +++ b/bacnet-stack/demo/handler/s_readrange.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -43,6 +42,7 @@ #include "handlers.h" #include "txbuf.h" #include "readrange.h" +#include "client.h" /** @file s_readrange.c Send a ReadRange request. */ diff --git a/bacnet-stack/demo/handler/s_router.c b/bacnet-stack/demo/handler/s_router.c index 17d8551f..0add8343 100644 --- a/bacnet-stack/demo/handler/s_router.c +++ b/bacnet-stack/demo/handler/s_router.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -40,6 +39,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_router.c Send BACnet Router requests. */ diff --git a/bacnet-stack/demo/handler/s_rp.c b/bacnet-stack/demo/handler/s_rp.c index 6a549131..240f16d3 100644 --- a/bacnet-stack/demo/handler/s_rp.c +++ b/bacnet-stack/demo/handler/s_rp.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,21 +41,22 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_rp.c Send Read Property request. */ /** Sends a Read Property request. * @ingroup DSRP - * + * * @param device_id [in] ID of the destination device * @param object_type [in] Type of the object whose property is to be read. * @param object_instance [in] Instance # of the object to be read. * @param object_property [in] Property to be read, but not ALL, REQUIRED, or OPTIONAL. - * @param array_index [in] Optional: if the Property is an array, + * @param array_index [in] Optional: if the Property is an array, * - 0 for the array size * - 1 to n for individual array members * - -1 for the full array to be read. - * @return invoke id of outgoing message, or 0 if device is not bound or no tsm available + * @return invoke id of outgoing message, or 0 if device is not bound or no tsm available */ uint8_t Send_Read_Property_Request( uint32_t device_id, /* destination device */ diff --git a/bacnet-stack/demo/handler/s_rpm.c b/bacnet-stack/demo/handler/s_rpm.c index b503a427..25700f96 100644 --- a/bacnet-stack/demo/handler/s_rpm.c +++ b/bacnet-stack/demo/handler/s_rpm.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,18 +41,19 @@ /* some demo stuff needed */ #include "handlers.h" #include "sbuf.h" +#include "client.h" /** @file s_rpm.c Send Read Property Multiple request. */ /** Sends a Read Property Multiple request. * @ingroup DSRPM - * + * * @param pdu [out] Buffer to build the outgoing message into * @param max_pdu [in] Length of the pdu buffer. * @param device_id [in] ID of the destination device - * @param read_access_data [in] Ptr to structure with the linked list of + * @param read_access_data [in] Ptr to structure with the linked list of * properties to be read. - * @return invoke id of outgoing message, or 0 if device is not bound or no tsm available + * @return invoke id of outgoing message, or 0 if device is not bound or no tsm available */ uint8_t Send_Read_Property_Multiple_Request( uint8_t * pdu, diff --git a/bacnet-stack/demo/handler/s_ts.c b/bacnet-stack/demo/handler/s_ts.c index 49b705fe..eaefd658 100644 --- a/bacnet-stack/demo/handler/s_ts.c +++ b/bacnet-stack/demo/handler/s_ts.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,6 +41,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_ts.c Send TimeSync requests. */ diff --git a/bacnet-stack/demo/handler/s_uevent.c b/bacnet-stack/demo/handler/s_uevent.c index 4c7b03ea..4821e419 100644 --- a/bacnet-stack/demo/handler/s_uevent.c +++ b/bacnet-stack/demo/handler/s_uevent.c @@ -27,12 +27,13 @@ #include #include "event.h" #include "datalink.h" +#include "client.h" /** @file s_uevent.c Send an Unconfirmed Event Notification. */ /** Sends an Unconfirmed Alarm/Event Notification. * @ingroup EVNOTFCN - * + * * @param buffer [in,out] The buffer to build the message in for sending. * @param data [in] The information about the Event to be sent. * @param dest [in] The destination address information (may be a broadcast). diff --git a/bacnet-stack/demo/handler/s_upt.c b/bacnet-stack/demo/handler/s_upt.c index 222a2a81..2c1253ab 100644 --- a/bacnet-stack/demo/handler/s_upt.c +++ b/bacnet-stack/demo/handler/s_upt.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,6 +41,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_upt.c Send an Unconfirmed Private Transfer request. */ diff --git a/bacnet-stack/demo/handler/s_whohas.c b/bacnet-stack/demo/handler/s_whohas.c index e7e83159..7916a9cd 100644 --- a/bacnet-stack/demo/handler/s_whohas.c +++ b/bacnet-stack/demo/handler/s_whohas.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,13 +41,14 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_whohas.c Send Who-Has requests. */ /** Send a Who-Has request for a device which has a named Object. * @ingroup DMDOB * If low_limit and high_limit both are -1, then the device ID range is unlimited. - * If low_limit and high_limit have the same non-negative value, then only + * If low_limit and high_limit have the same non-negative value, then only * that device will respond. * Otherwise, low_limit must be less than high_limit for a range. * @param low_limit [in] Device Instance Low Range, 0 - 4,194,303 or -1 @@ -97,7 +97,7 @@ void Send_WhoHas_Name( /** Send a Who-Has request for a device which has a specific Object type and ID. * @ingroup DMDOB * If low_limit and high_limit both are -1, then the device ID range is unlimited. - * If low_limit and high_limit have the same non-negative value, then only + * If low_limit and high_limit have the same non-negative value, then only * that device will respond. * Otherwise, low_limit must be less than high_limit for a range. * @param low_limit [in] Device Instance Low Range, 0 - 4,194,303 or -1 diff --git a/bacnet-stack/demo/handler/s_whois.c b/bacnet-stack/demo/handler/s_whois.c index a76ddbd3..c68aa0c3 100644 --- a/bacnet-stack/demo/handler/s_whois.c +++ b/bacnet-stack/demo/handler/s_whois.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -43,6 +42,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_whois.c Send a Who-Is request. */ diff --git a/bacnet-stack/demo/handler/s_wp.c b/bacnet-stack/demo/handler/s_wp.c index 8a961f57..d6e46192 100644 --- a/bacnet-stack/demo/handler/s_wp.c +++ b/bacnet-stack/demo/handler/s_wp.c @@ -27,7 +27,6 @@ #include #include #include "config.h" -#include "config.h" #include "txbuf.h" #include "bacdef.h" #include "bacdcode.h" @@ -42,6 +41,7 @@ /* some demo stuff needed */ #include "handlers.h" #include "txbuf.h" +#include "client.h" /** @file s_wp.c Send a Write Property request. */ @@ -128,16 +128,16 @@ uint8_t Send_Write_Property_Request_Data( /** Sends a Write Property request. * @ingroup DSWP - * + * * @param device_id [in] ID of the destination device * @param object_type [in] Type of the object whose property is to be written. * @param object_instance [in] Instance # of the object to be written. * @param object_property [in] Property to be written. * @param object_value [in] The value to be written to the property. * @param priority [in] Write priority of 1 (highest) to 16 (lowest) - * @param array_index [in] Optional: if the Property is an array, + * @param array_index [in] Optional: if the Property is an array, * the index from 1 to n for the individual array member to be written. - * @return invoke id of outgoing message, or 0 on failure. + * @return invoke id of outgoing message, or 0 on failure. */ uint8_t Send_Write_Property_Request( uint32_t device_id, diff --git a/bacnet-stack/include/client.h b/bacnet-stack/include/client.h index 0fb58ad8..cc3e5a89 100644 --- a/bacnet-stack/include/client.h +++ b/bacnet-stack/include/client.h @@ -39,6 +39,7 @@ #include "lso.h" #include "alarm_ack.h" #include "ptransfer.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -53,6 +54,11 @@ extern "C" { void Send_I_Am_Unicast( uint8_t * buffer, BACNET_ADDRESS * src); + int iam_unicast_encode_pdu( + uint8_t * buffer, + BACNET_ADDRESS * src, + BACNET_ADDRESS * dest, + BACNET_NPDU_DATA * npdu_data); void Send_WhoIs( int32_t low_limit, @@ -101,6 +107,11 @@ extern "C" { BACNET_ADDRESS * dest, BACNET_NPDU_DATA * npdu_data, BACNET_COV_DATA * cov_data); + uint8_t Send_COV_Subscribe( + uint32_t device_id, + BACNET_SUBSCRIBE_COV_DATA * cov_data); + + /* returns the invoke ID for confirmed request, or 0 if failed */ uint8_t Send_Read_Property_Request( diff --git a/bacnet-stack/include/handlers.h b/bacnet-stack/include/handlers.h index 580052ee..cafeea45 100644 --- a/bacnet-stack/include/handlers.h +++ b/bacnet-stack/include/handlers.h @@ -139,6 +139,8 @@ extern "C" { uint16_t service_len, BACNET_ADDRESS * src, BACNET_CONFIRMED_SERVICE_DATA * service_data); + void handler_dcc_password_set( + char *new_password); void handler_i_have( uint8_t * service_request, diff --git a/bacnet-stack/include/timesync.h b/bacnet-stack/include/timesync.h index 433bfa7f..69759dd6 100644 --- a/bacnet-stack/include/timesync.h +++ b/bacnet-stack/include/timesync.h @@ -42,7 +42,7 @@ extern "C" { #endif /* __cplusplus */ -/* encode service */ + /* encode service */ int timesync_utc_encode_apdu( uint8_t * apdu, BACNET_DATE * my_date, @@ -51,7 +51,12 @@ extern "C" { uint8_t * apdu, BACNET_DATE * my_date, BACNET_TIME * my_time); -/* decode the service request only */ + int timesync_encode_apdu_service( + uint8_t * apdu, + BACNET_UNCONFIRMED_SERVICE service, + BACNET_DATE * my_date, + BACNET_TIME * my_time); + /* decode the service request only */ int timesync_decode_service_request( uint8_t * apdu, unsigned apdu_len, diff --git a/bacnet-stack/src/address.c b/bacnet-stack/src/address.c index 5852ca43..745d652a 100644 --- a/bacnet-stack/src/address.c +++ b/bacnet-stack/src/address.c @@ -135,7 +135,7 @@ void address_remove_device( *****************************************************************************/ -struct Address_Cache_Entry *address_remove_oldest( +static struct Address_Cache_Entry *address_remove_oldest( void) { struct Address_Cache_Entry *pMatch; @@ -198,7 +198,7 @@ note: useful for MS/TP Slave static binding */ static const char *Address_Cache_Filename = "address_cache"; -void address_file_init( +static void address_file_init( const char *pFilename) { FILE *pFile = NULL; /* stream pointer */ @@ -404,7 +404,7 @@ void address_add( /* Note: Previously this function would ignore bind request marked entries and in fact would probably overwrite the first bind request entry blindly with the device info which may - have nothing to do with that bind request. Now it honours the + have nothing to do with that bind request. Now it honours the bind request if it exists */ /* existing device or bind request outstanding - update address */ @@ -603,7 +603,7 @@ int address_list_encode( struct Address_Cache_Entry *pMatch; BACNET_OCTET_STRING MAC_Address; - /* FIXME: I really shouild check the length remaining here but it is + /* FIXME: I really shouild check the length remaining here but it is fairly pointless until we have the true length remaining in the packet to work with as at the moment it is just MAX_APDU */ apdu_len = apdu_len; @@ -707,7 +707,7 @@ int rr_address_list_encode( * start index/positive count and then process as * normal. This assumes that the order to return items * is always first to last, if this is not true we will - * have to handle this differently. + * have to handle this differently. * * Note: We need to be careful about how we convert these * values due to the mix of signed and unsigned types - don't @@ -753,7 +753,7 @@ int rr_address_list_encode( while (uiIndex <= uiTarget) { if (uiRemaining < ACACHE_MAX_ENC) { /* - * Can't fit any more in! We just set the result flag to say there + * Can't fit any more in! We just set the result flag to say there * was more and drop out of the loop early */ bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_MORE_ITEMS, @@ -811,7 +811,7 @@ int rr_address_list_encode( * Scan the cache and eliminate any expired entries. Should be called * * periodically to ensure the cache is managed correctly. If this function * * is never called at all the whole cache is effectivly rendered static and * - * entries never expire unless explictely deleted. * + * entries never expire unless explictely deleted. * ****************************************************************************/ void address_cache_timer( diff --git a/bacnet-stack/src/debug.c b/bacnet-stack/src/debug.c index f3766841..17d7a94c 100644 --- a/bacnet-stack/src/debug.c +++ b/bacnet-stack/src/debug.c @@ -37,6 +37,7 @@ #include /* Standard I/O */ #include /* Standard Library */ #include +#include "debug.h" /** @file debug.c Debug print function */ diff --git a/bacnet-stack/src/iam.c b/bacnet-stack/src/iam.c index 76bb6c62..6ba7c359 100755 --- a/bacnet-stack/src/iam.c +++ b/bacnet-stack/src/iam.c @@ -39,6 +39,7 @@ #include "device.h" #include "bacdcode.h" #include "address.h" +#include "iam.h" /** @file iam.c Encode/Decode I-Am service */ diff --git a/bacnet-stack/src/reject.c b/bacnet-stack/src/reject.c index 67c8d9d0..3bb63e9f 100644 --- a/bacnet-stack/src/reject.c +++ b/bacnet-stack/src/reject.c @@ -35,6 +35,7 @@ #include "bacenum.h" #include "bacdcode.h" #include "bacdef.h" +#include "reject.h" /** @file reject.c Encode/Decode Reject APDUs */ diff --git a/bacnet-stack/src/whois.c b/bacnet-stack/src/whois.c index b7188a1b..12ad6aca 100644 --- a/bacnet-stack/src/whois.c +++ b/bacnet-stack/src/whois.c @@ -35,6 +35,7 @@ #include "bacenum.h" #include "bacdcode.h" #include "bacdef.h" +#include "whois.h" /** @file whois.c Encode/Decode Who-Is requests */