Indented.

This commit is contained in:
skarg
2008-11-24 12:48:09 +00:00
parent fdfd6a9f9f
commit d1a1c1c8a6
71 changed files with 6873 additions and 6754 deletions
+47 -47
View File
@@ -112,10 +112,10 @@ extern "C" {
bool decode_context_boolean(
uint8_t * apdu);
int decode_context_boolean2(
uint8_t * apdu,
uint8_t tag_number,
bool *boolean_value);
int decode_context_boolean2(
uint8_t * apdu,
uint8_t tag_number,
bool * boolean_value);
/* from clause 20.2.10 Encoding of a Bit String Value */
/* returns the number of apdu bytes consumed */
@@ -126,7 +126,7 @@ extern "C" {
int decode_context_bitstring(
uint8_t * apdu,
uint8_t tag_number,
uint8_t tag_number,
BACNET_BIT_STRING * bit_string);
/* returns the number of apdu bytes consumed */
int encode_bitstring(
@@ -154,15 +154,15 @@ extern "C" {
/* from clause 20.2.7 Encoding of a Double Precision Real Number Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_application_double(
uint8_t * apdu,
double value);
int encode_context_double(
uint8_t * apdu,
int tag_number,
double value);
int encode_application_double(
uint8_t * apdu,
double value);
int encode_context_double(
uint8_t * apdu,
int tag_number,
double value);
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
@@ -171,11 +171,11 @@ int encode_context_double(
uint16_t * object_type,
uint32_t * instance);
int decode_context_object_id(
uint8_t * apdu,
uint8_t tag_number,
uint16_t *object_type,
uint32_t * instance);
int decode_context_object_id(
uint8_t * apdu,
uint8_t tag_number,
uint16_t * object_type,
uint32_t * instance);
int encode_bacnet_object_id(
uint8_t * apdu,
@@ -210,7 +210,7 @@ int encode_context_double(
BACNET_OCTET_STRING * octet_string);
int decode_context_octet_string(
uint8_t * apdu,
uint8_t tag_number,
uint8_t tag_number,
BACNET_OCTET_STRING * octet_string);
@@ -231,10 +231,10 @@ int encode_context_double(
uint8_t * apdu,
uint32_t len_value,
BACNET_CHARACTER_STRING * char_string);
int decode_context_character_string(
uint8_t * apdu,
uint8_t tag_number,
BACNET_CHARACTER_STRING * char_string);
int decode_context_character_string(
uint8_t * apdu,
uint8_t tag_number,
BACNET_CHARACTER_STRING * char_string);
/* from clause 20.2.4 Encoding of an Unsigned Integer Value */
@@ -254,10 +254,10 @@ int encode_context_double(
uint8_t * apdu,
uint32_t len_value,
uint32_t * value);
int decode_context_unsigned(
uint8_t * apdu,
uint8_t tag_number,
uint32_t * value);
int decode_context_unsigned(
uint8_t * apdu,
uint8_t tag_number,
uint32_t * value);
/* from clause 20.2.5 Encoding of a Signed Integer Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
@@ -276,10 +276,10 @@ int encode_context_double(
uint8_t * apdu,
uint32_t len_value,
int32_t * value);
int decode_context_signed(
uint8_t * apdu,
uint8_t tag_number,
int32_t * value);
int decode_context_signed(
uint8_t * apdu,
uint8_t tag_number,
int32_t * value);
/* from clause 20.2.11 Encoding of an Enumerated Value */
@@ -289,10 +289,10 @@ int encode_context_double(
uint8_t * apdu,
uint32_t len_value,
int *value);
int decode_context_enumerated(
uint8_t * apdu,
uint8_t tag_value,
int *value);
int decode_context_enumerated(
uint8_t * apdu,
uint8_t tag_value,
int *value);
int encode_bacnet_enumerated(
uint8_t * apdu,
int value);
@@ -320,13 +320,13 @@ int encode_context_double(
uint8_t * apdu,
int tag_number,
BACNET_TIME * btime);
int decode_application_time(
uint8_t * apdu,
BACNET_TIME * btime);
int decode_context_bacnet_time(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIME * btime);
int decode_application_time(
uint8_t * apdu,
BACNET_TIME * btime);
int decode_context_bacnet_time(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIME * btime);
/* BACnet Date */
@@ -354,10 +354,10 @@ int encode_context_double(
int decode_application_date(
uint8_t * apdu,
BACNET_DATE * bdate);
int decode_context_date(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE * bdate);
int decode_context_date(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE * bdate);
/* from clause 20.1.2.4 max-segments-accepted */
/* and clause 20.1.2.5 max-APDU-length-accepted */
+72 -75
View File
@@ -1,75 +1,72 @@
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _BAC_DEV_PROP_REF_H_
#define _BAC_DEV_PROP_REF_H_
typedef struct {
BACNET_OBJECT_ID objectIdentifier;
BACNET_PROPERTY_ID propertyIdentifier;
uint32_t arrayIndex;
BACNET_OBJECT_ID deviceIndentifier;
} BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_encode_device_obj_property_ref(
uint8_t * apdu,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_encode_context_device_obj_property_ref(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_decode_device_obj_property_ref(
uint8_t * apdu,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_decode_context_device_obj_property_ref(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif //_BAC_DEV_PROP_REF_H_
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _BAC_DEV_PROP_REF_H_
#define _BAC_DEV_PROP_REF_H_
typedef struct {
BACNET_OBJECT_ID objectIdentifier;
BACNET_PROPERTY_ID propertyIdentifier;
uint32_t arrayIndex;
BACNET_OBJECT_ID deviceIndentifier;
} BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_encode_device_obj_property_ref(
uint8_t * apdu,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_encode_context_device_obj_property_ref(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_decode_device_obj_property_ref(
uint8_t * apdu,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
int bacapp_decode_context_device_obj_property_ref(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif //_BAC_DEV_PROP_REF_H_
+102 -104
View File
@@ -1,104 +1,102 @@
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _BAC_PROP_STATES_H_
#define _BAC_PROP_STATES_H_
#include "bacenum.h"
#include <stdint.h>
#include <stdbool.h>
#include "bacapp.h"
#include <time.h>
#include "timestamp.h"
typedef enum {
BOOLEAN_VALUE,
BINARY_VALUE,
EVENT_TYPE,
POLARITY,
PROGRAM_CHANGE,
PROGRAM_STATE,
REASON_FOR_HALT,
RELIABILITY,
STATE,
SYSTEM_STATUS,
UNITS,
UNSIGNED_VALUE,
LIFE_SAFETY_MODE,
LIFE_SAFETY_STATE,
} BACNET_PROPERTY_STATE_TYPE;
typedef struct {
BACNET_PROPERTY_STATE_TYPE tag;
union {
bool booleanValue;
BACNET_BINARY_PV binaryValue;
BACNET_EVENT_TYPE eventType;
BACNET_POLARITY polarity;
BACNET_PROGRAM_REQUEST programChange;
BACNET_PROGRAM_STATE programState;
BACNET_PROGRAM_ERROR programError;
BACNET_RELIABILITY reliability;
BACNET_EVENT_STATE state;
BACNET_DEVICE_STATUS systemStatus;
BACNET_ENGINEERING_UNITS units;
uint32_t unsignedValue;
BACNET_LIFE_SAFETY_MODE lifeSafetyMode;
BACNET_LIFE_SAFETY_STATE lifeSafetyState;
} state;
} BACNET_PROPERTY_STATE;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_decode_property_state(
uint8_t * apdu,
BACNET_PROPERTY_STATE * value);
int bacapp_decode_context_property_state(
uint8_t * apdu,
uint8_t tag_number,
BACNET_PROPERTY_STATE * value);
int bacapp_encode_property_state(
uint8_t * apdu,
BACNET_PROPERTY_STATE * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // _BAC_PROP_STATES_H_
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _BAC_PROP_STATES_H_
#define _BAC_PROP_STATES_H_
#include "bacenum.h"
#include <stdint.h>
#include <stdbool.h>
#include "bacapp.h"
#include <time.h>
#include "timestamp.h"
typedef enum {
BOOLEAN_VALUE,
BINARY_VALUE,
EVENT_TYPE,
POLARITY,
PROGRAM_CHANGE,
PROGRAM_STATE,
REASON_FOR_HALT,
RELIABILITY,
STATE,
SYSTEM_STATUS,
UNITS,
UNSIGNED_VALUE,
LIFE_SAFETY_MODE,
LIFE_SAFETY_STATE,
} BACNET_PROPERTY_STATE_TYPE;
typedef struct {
BACNET_PROPERTY_STATE_TYPE tag;
union {
bool booleanValue;
BACNET_BINARY_PV binaryValue;
BACNET_EVENT_TYPE eventType;
BACNET_POLARITY polarity;
BACNET_PROGRAM_REQUEST programChange;
BACNET_PROGRAM_STATE programState;
BACNET_PROGRAM_ERROR programError;
BACNET_RELIABILITY reliability;
BACNET_EVENT_STATE state;
BACNET_DEVICE_STATUS systemStatus;
BACNET_ENGINEERING_UNITS units;
uint32_t unsignedValue;
BACNET_LIFE_SAFETY_MODE lifeSafetyMode;
BACNET_LIFE_SAFETY_STATE lifeSafetyState;
} state;
} BACNET_PROPERTY_STATE;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_decode_property_state(
uint8_t * apdu,
BACNET_PROPERTY_STATE * value);
int bacapp_decode_context_property_state(
uint8_t * apdu,
uint8_t tag_number,
BACNET_PROPERTY_STATE * value);
int bacapp_encode_property_state(
uint8_t * apdu,
BACNET_PROPERTY_STATE * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // _BAC_PROP_STATES_H_
+1 -1
View File
@@ -48,7 +48,7 @@ extern "C" {
int decode_context_real(
uint8_t * apdu,
uint8_t tag_number,
uint8_t tag_number,
float *real_value);
int encode_bacnet_real(
float value,
+2 -2
View File
@@ -78,8 +78,8 @@ extern "C" {
uint8_t Send_Read_Property_Multiple_Request(
uint8_t * pdu,
size_t max_pdu,
uint32_t device_id, /* destination device */
BACNET_READ_ACCESS_DATA *read_access_data);
uint32_t device_id, /* destination device */
BACNET_READ_ACCESS_DATA * read_access_data);
/* returns the invoke ID for confirmed request, or 0 if failed */
uint8_t Send_Write_Property_Request(
+11 -11
View File
@@ -138,19 +138,19 @@ extern "C" {
void datetime_time_wildcard_set(
BACNET_TIME * btime);
int bacapp_encode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
int bacapp_encode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
int bacapp_decode_datetime(
uint8_t * apdu,
BACNET_DATE_TIME * value);
int bacapp_decode_datetime(
uint8_t * apdu,
BACNET_DATE_TIME * value);
int bacapp_decode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
int bacapp_decode_context_datetime(
uint8_t * apdu,
uint8_t tag_number,
BACNET_DATE_TIME * value);
#ifdef __cplusplus
}
+15 -18
View File
@@ -38,26 +38,23 @@
#include <stdbool.h>
#include <stdio.h>
#include "bacdef.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if DEBUG_ENABLED
void debug_printf(
const char *format,
...);
void debug_printf(
const char *format,
...);
#else
static void debug_printf(
const char *format,
...)
{
format = format;
static void debug_printf(
const char *format,
...) {
format = format;
}
#endif
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif
+212 -212
View File
@@ -1,212 +1,212 @@
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef BACNET_EVENT_H_
#define BACNET_EVENT_H_
#include "bacenum.h"
#include <stdint.h>
#include <stdbool.h>
#include "bacapp.h"
#include "timestamp.h"
#include "bacpropstates.h"
#include "bacdevobjpropref.h"
typedef enum {
CHANGE_OF_VALUE_BITS,
CHANGE_OF_VALUE_REAL
} CHANGE_OF_VALUE_TYPE;
/*
** Based on UnconfirmedEventNotification-Request
*/
typedef struct BACnet_Event_Notification_Data {
uint32_t processIdentifier;
BACNET_OBJECT_ID initiatingObjectIdentifier;
BACNET_OBJECT_ID eventObjectIdentifier;
BACNET_TIMESTAMP timeStamp;
uint32_t notificationClass;
uint8_t priority;
BACNET_EVENT_TYPE eventType;
BACNET_CHARACTER_STRING* messageText; /* OPTIONAL - Set to NULL if not being used */
BACNET_NOTIFY_TYPE notifyType;
bool ackRequired;
BACNET_EVENT_STATE fromState;
BACNET_EVENT_STATE toState;
/*
** Each of these structures in the union maps to a particular eventtype
** Based on BACnetNotificationParameters
*/
union {
/*
** EVENT_CHANGE_OF_BITSTRING
*/
struct {
BACNET_BIT_STRING referencedBitString;
BACNET_BIT_STRING statusFlags;
} changeOfBitstring;
/*
** EVENT_CHANGE_OF_STATE
*/
struct {
BACNET_PROPERTY_STATE newState;
BACNET_BIT_STRING statusFlags;
} changeOfState;
/*
** EVENT_CHANGE_OF_VALUE
*/
struct {
union {
BACNET_BIT_STRING changedBits;
float changeValue;
} newValue;
CHANGE_OF_VALUE_TYPE tag;
BACNET_BIT_STRING statusFlags;
} changeOfValue;
/*
** EVENT_COMMAND_FAILURE
**
** Not Supported!
*/
/*
** EVENT_FLOATING_LIMIT
*/
struct {
float referenceValue;
BACNET_BIT_STRING statusFlags;
float setPointValue;
float errorLimit;
} floatingLimit;
/*
** EVENT_OUT_OF_RANGE
*/
struct {
float exceedingValue;
BACNET_BIT_STRING statusFlags;
float deadband;
float exceededLimit;
} outOfRange;
/*
** EVENT_CHANGE_OF_LIFE_SAFETY
*/
struct {
BACNET_LIFE_SAFETY_STATE newState;
BACNET_LIFE_SAFETY_MODE newMode;
BACNET_BIT_STRING statusFlags;
BACNET_LIFE_SAFETY_OPERATION operationExpected;
} changeOfLifeSafety;
/*
** EVENT_EXTENDED
**
** Not Supported!
*/
/*
** EVENT_BUFFER_READY
*/
struct {
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE bufferProperty;
uint32_t previousNotification;
uint32_t currentNotification;
} bufferReady;
/*
** EVENT_UNSIGNED_RANGE
*/
struct {
uint32_t exceedingValue;
BACNET_BIT_STRING statusFlags;
uint32_t exceededLimit;
} unsignedRange;
} notificationParams;
} BACNET_EVENT_NOTIFICATION_DATA;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/***************************************************
**
** Creates a Confirmed Event Notification APDU
**
****************************************************/
int cevent_notify_encode_apdu(
uint8_t * apdu,
uint8_t invoke_id,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Creates an Unconfirmed Event Notification APDU
**
****************************************************/
int uevent_notify_encode_apdu(
uint8_t * apdu,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Encodes the service data part of Event Notification
**
****************************************************/
int event_notify_encode_service_request(
uint8_t * apdu,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Decodes the service data part of Event Notification
**
****************************************************/
int event_notify_decode_service_request(
uint8_t * apdu,
unsigned apdu_len,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Sends an Unconfirmed Event Notifcation to a dest
**
****************************************************/
int uevent_notify_send(
uint8_t * buffer,
BACNET_EVENT_NOTIFICATION_DATA * data,
BACNET_ADDRESS *dest);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BACNET_EVENT_H_ */
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef BACNET_EVENT_H_
#define BACNET_EVENT_H_
#include "bacenum.h"
#include <stdint.h>
#include <stdbool.h>
#include "bacapp.h"
#include "timestamp.h"
#include "bacpropstates.h"
#include "bacdevobjpropref.h"
typedef enum {
CHANGE_OF_VALUE_BITS,
CHANGE_OF_VALUE_REAL
} CHANGE_OF_VALUE_TYPE;
/*
** Based on UnconfirmedEventNotification-Request
*/
typedef struct BACnet_Event_Notification_Data {
uint32_t processIdentifier;
BACNET_OBJECT_ID initiatingObjectIdentifier;
BACNET_OBJECT_ID eventObjectIdentifier;
BACNET_TIMESTAMP timeStamp;
uint32_t notificationClass;
uint8_t priority;
BACNET_EVENT_TYPE eventType;
BACNET_CHARACTER_STRING *messageText; /* OPTIONAL - Set to NULL if not being used */
BACNET_NOTIFY_TYPE notifyType;
bool ackRequired;
BACNET_EVENT_STATE fromState;
BACNET_EVENT_STATE toState;
/*
** Each of these structures in the union maps to a particular eventtype
** Based on BACnetNotificationParameters
*/
union {
/*
** EVENT_CHANGE_OF_BITSTRING
*/
struct {
BACNET_BIT_STRING referencedBitString;
BACNET_BIT_STRING statusFlags;
} changeOfBitstring;
/*
** EVENT_CHANGE_OF_STATE
*/
struct {
BACNET_PROPERTY_STATE newState;
BACNET_BIT_STRING statusFlags;
} changeOfState;
/*
** EVENT_CHANGE_OF_VALUE
*/
struct {
union {
BACNET_BIT_STRING changedBits;
float changeValue;
} newValue;
CHANGE_OF_VALUE_TYPE tag;
BACNET_BIT_STRING statusFlags;
} changeOfValue;
/*
** EVENT_COMMAND_FAILURE
**
** Not Supported!
*/
/*
** EVENT_FLOATING_LIMIT
*/
struct {
float referenceValue;
BACNET_BIT_STRING statusFlags;
float setPointValue;
float errorLimit;
} floatingLimit;
/*
** EVENT_OUT_OF_RANGE
*/
struct {
float exceedingValue;
BACNET_BIT_STRING statusFlags;
float deadband;
float exceededLimit;
} outOfRange;
/*
** EVENT_CHANGE_OF_LIFE_SAFETY
*/
struct {
BACNET_LIFE_SAFETY_STATE newState;
BACNET_LIFE_SAFETY_MODE newMode;
BACNET_BIT_STRING statusFlags;
BACNET_LIFE_SAFETY_OPERATION operationExpected;
} changeOfLifeSafety;
/*
** EVENT_EXTENDED
**
** Not Supported!
*/
/*
** EVENT_BUFFER_READY
*/
struct {
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE bufferProperty;
uint32_t previousNotification;
uint32_t currentNotification;
} bufferReady;
/*
** EVENT_UNSIGNED_RANGE
*/
struct {
uint32_t exceedingValue;
BACNET_BIT_STRING statusFlags;
uint32_t exceededLimit;
} unsignedRange;
} notificationParams;
} BACNET_EVENT_NOTIFICATION_DATA;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/***************************************************
**
** Creates a Confirmed Event Notification APDU
**
****************************************************/
int cevent_notify_encode_apdu(
uint8_t * apdu,
uint8_t invoke_id,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Creates an Unconfirmed Event Notification APDU
**
****************************************************/
int uevent_notify_encode_apdu(
uint8_t * apdu,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Encodes the service data part of Event Notification
**
****************************************************/
int event_notify_encode_service_request(
uint8_t * apdu,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Decodes the service data part of Event Notification
**
****************************************************/
int event_notify_decode_service_request(
uint8_t * apdu,
unsigned apdu_len,
BACNET_EVENT_NOTIFICATION_DATA * data);
/***************************************************
**
** Sends an Unconfirmed Event Notifcation to a dest
**
****************************************************/
int uevent_notify_send(
uint8_t * buffer,
BACNET_EVENT_NOTIFICATION_DATA * data,
BACNET_ADDRESS * dest);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BACNET_EVENT_H_ */
+6 -6
View File
@@ -47,12 +47,12 @@ extern "C" {
/* copy len bytes from src to offset of dest if there is enough space. */
/* returns 0 if there is not enough space, or the number of bytes copied. */
size_t memcopy(
void * dest,
void * src,
size_t offset, /* where in dest to put the data */
size_t len, /* amount of data to copy */
size_t max); /* total size of destination */
size_t memcopy(
void *dest,
void *src,
size_t offset, /* where in dest to put the data */
size_t len, /* amount of data to copy */
size_t max); /* total size of destination */
#ifdef __cplusplus
}
+1 -1
View File
@@ -82,7 +82,7 @@ extern "C" {
uint8_t * apdu,
size_t max_apdu,
uint8_t invoke_id,
BACNET_READ_ACCESS_DATA *read_access_data);
BACNET_READ_ACCESS_DATA * read_access_data);
/* decode the object portion of the service request only */
int rpm_decode_object_id(
+76 -78
View File
@@ -1,78 +1,76 @@
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include "bacdcode.h"
typedef enum {
TIME_STAMP_TIME = 0,
TIME_STAMP_SEQUENCE = 1,
TIME_STAMP_DATETIME = 2,
} BACNET_TIMESTAMP_TAG;
typedef uint8_t TYPE_BACNET_TIMESTAMP_TYPE;
typedef struct {
TYPE_BACNET_TIMESTAMP_TYPE tag;
union {
BACNET_TIME time;
uint16_t sequenceNum;
BACNET_DATE_TIME dateTime;
} value;
} BACNET_TIMESTAMP;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_encode_context_timestamp(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIMESTAMP * value);
int bacapp_decode_context_timestamp(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIMESTAMP * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2008 John Minack
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include "bacdcode.h"
typedef enum {
TIME_STAMP_TIME = 0,
TIME_STAMP_SEQUENCE = 1,
TIME_STAMP_DATETIME = 2,
} BACNET_TIMESTAMP_TAG;
typedef uint8_t TYPE_BACNET_TIMESTAMP_TYPE;
typedef struct {
TYPE_BACNET_TIMESTAMP_TYPE tag;
union {
BACNET_TIME time;
uint16_t sequenceNum;
BACNET_DATE_TIME dateTime;
} value;
} BACNET_TIMESTAMP;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int bacapp_encode_context_timestamp(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIMESTAMP * value);
int bacapp_decode_context_timestamp(
uint8_t * apdu,
uint8_t tag_number,
BACNET_TIMESTAMP * value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif