Updated prototypes and include as required and found by compile with extra checking. Thanks to Nigel Jones for his "setting a bad example" article.
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#if defined(BACFILE)
|
||||
#include "bacfile.h"
|
||||
#endif
|
||||
#include "handlers.h"
|
||||
|
||||
/** @file h_arf.c Handles Atomic Read File request. */
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#if defined(BACFILE)
|
||||
#include "bacfile.h"
|
||||
#endif
|
||||
#include "handlers.h"
|
||||
|
||||
/** @file h_awf.c Handles Atomic Write File request. */
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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. */
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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. */
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "bits.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
|
||||
#if PRINT_ENABLED
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#include "txbuf.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "bacdef.h"
|
||||
#include "bacdcode.h"
|
||||
#include "timesync.h"
|
||||
#include "handlers.h"
|
||||
|
||||
/** @file h_ts.c Handles TimeSync requests. */
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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. */
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "whohas.h"
|
||||
#include "device.h"
|
||||
#include "client.h"
|
||||
#include "handlers.h"
|
||||
|
||||
/** @file h_whohas.c Handles Who-Has requests. */
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "device.h"
|
||||
#include "client.h"
|
||||
#include "txbuf.h"
|
||||
#include "handlers.h"
|
||||
|
||||
/** @file h_whois.c Handles Who-Is requests. */
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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.
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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.
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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 */
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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,
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
#include <errno.h>
|
||||
#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).
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <stdio.h> /* Standard I/O */
|
||||
#include <stdlib.h> /* Standard Library */
|
||||
#include <stdarg.h>
|
||||
#include "debug.h"
|
||||
|
||||
/** @file debug.c Debug print function */
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "device.h"
|
||||
#include "bacdcode.h"
|
||||
#include "address.h"
|
||||
#include "iam.h"
|
||||
|
||||
/** @file iam.c Encode/Decode I-Am service */
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "bacenum.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacdef.h"
|
||||
#include "reject.h"
|
||||
|
||||
/** @file reject.c Encode/Decode Reject APDUs */
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "bacenum.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacdef.h"
|
||||
#include "whois.h"
|
||||
|
||||
/** @file whois.c Encode/Decode Who-Is requests */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user