Files
bacnet_stack/bacnet-stack/bacdef.h
T
2005-03-31 11:40:56 +00:00

91 lines
3.0 KiB
C

/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2005 Steve Karg
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 BACDEF_H
#define BACDEF_H
#include <stdint.h>
#include "bacenum.h"
#include "config.h"
// largest BACnet Instance Number
// Also used as a device instance number wildcard address
#define BACNET_MAX_INSTANCE (0x3FFFFF)
// large BACnet Object Type
#define BACNET_MAX_OBJECT (0x3FF)
// Array index 0=size of array, n=array element n, MAX=all array elements
#define BACNET_ARRAY_ALL (~0)
// embedded systems need fixed name sizes
#define MAX_OBJECT_NAME 10
// device object properties
typedef struct BACnet_Object_Data
{
uint32_t Object_Identifier;
char Object_Name[MAX_OBJECT_NAME];
BACNET_OBJECT_TYPE Object_Type;
} BACNET_OBJECT_DATA;
typedef struct BACnet_Read_Property_Data
{
BACNET_OBJECT_TYPE object_type;
uint32_t object_instance;
BACNET_PROPERTY_ID object_property;
int32_t array_index;
uint8_t *application_data;
int application_data_len;
} BACNET_READ_PROPERTY_DATA;
#define BACNET_BROADCAST_NETWORK 0xFFFF
#define MAX_MAC_LEN 8
struct BACnet_Device_Address {
// mac_len = 0 if global address
int mac_len;
uint8_t mac[MAX_MAC_LEN];
// DNET,DLEN,DADR or SNET,SLEN,SADR
// the following are used if the device is behind a router
// net = 0 indicates local
uint16_t net; /* BACnet network number */
// LEN = 0 denotes broadcast MAC ADR and ADR field is absent
// LEN > 0 specifies length of ADR field
int len; /* length of MAC address */
uint8_t adr[MAX_MAC_LEN]; /* hwaddr (MAC) address */
};
typedef struct BACnet_Device_Address BACNET_ADDRESS;
#define MAX_NPDU (1+1+2+1+MAX_MAC_LEN+2+1+MAX_MAC_LEN+1+1+2)
#define MAX_PDU (MAX_APDU + MAX_NPDU)
#endif