Updated Lighting Output object. Added Channel object. Not complete and not fully tested.

This commit is contained in:
skarg
2013-11-11 22:27:55 +00:00
parent 5f3ec51291
commit 4d79c26a8c
16 changed files with 3301 additions and 289 deletions
+4
View File
@@ -30,6 +30,7 @@
#include "bacdef.h"
#include "bacstr.h"
#include "datetime.h"
#include "lighting.h"
struct BACnet_Application_Data_Value;
typedef struct BACnet_Application_Data_Value {
@@ -73,6 +74,9 @@ typedef struct BACnet_Application_Data_Value {
#endif
#if defined (BACAPP_OBJECT_ID)
BACNET_OBJECT_ID Object_Id;
#endif
#if defined (BACAPP_LIGHTING_COMMAND)
BACNET_LIGHTING_COMMAND Lighting_Command;
#endif
} type;
/* simple linked list if needed */
+1 -1
View File
@@ -40,7 +40,7 @@
/* Although this stack can implement a later revision,
* sometimes another revision is desired */
#ifndef BACNET_PROTOCOL_REVISION
#define BACNET_PROTOCOL_REVISION 12
#define BACNET_PROTOCOL_REVISION 14
#endif
/* there are a few dependencies on the BACnet Protocol-Revision */
+13 -3
View File
@@ -399,7 +399,7 @@ typedef enum {
PROP_DEFAULT_FADE_TIME = 374,
PROP_DEFAULT_RAMP_RATE = 375,
PROP_DEFAULT_STEP_INCREMENT = 376,
PROP_EGRESS_TIMER = 377,
PROP_EGRESS_TIME = 377,
PROP_IN_PROGRESS = 378,
PROP_INSTANTANEOUS_POWER = 379,
PROP_LIGHTING_COMMAND = 380,
@@ -1689,7 +1689,12 @@ typedef enum BACnetLightingOperation {
BACNET_LIGHTS_WARN = 7,
BACNET_LIGHTS_WARN_OFF = 8,
BACNET_LIGHTS_WARN_RELINQUISH = 9,
BACNET_LIGHTS_STOP = 10
BACNET_LIGHTS_STOP = 10,
/* Enumerated values 0-255 are reserved for definition by ASHRAE.
Enumerated values 256-65535 may be used by others subject to
the procedures and constraints described in Clause 23 */
BACNET_LIGHTS_PROPRIETARY_FIRST = 256,
BACNET_LIGHTS_PROPRIETARY_LAST = 65535
} BACNET_LIGHTING_OPERATION;
typedef enum BACnetLightingInProgress {
@@ -1703,7 +1708,12 @@ typedef enum BACnetLightingInProgress {
typedef enum BACnetLightingTransition {
BACNET_LIGHTING_TRANSITION_IDLE = 0,
BACNET_LIGHTING_TRANSITION_FADE = 1,
BACNET_LIGHTING_TRANSITION_RAMP = 2
BACNET_LIGHTING_TRANSITION_RAMP = 2,
/* Enumerated values 0-63 are reserved for definition by ASHRAE.
Enumerated values 64-255 may be used by others subject to
the procedures and constraints described in Clause 23. */
BACNET_LIGHTING_TRANSITION_PROPRIETARY_FIRST = 64,
BACNET_LIGHTING_TRANSITION_PROPRIETARY_LAST = 255
} BACNET_LIGHTING_TRANSITION;
/* NOTE: BACNET_DAYS_OF_WEEK is different than BACNET_WEEKDAY */
+3
View File
@@ -111,6 +111,9 @@ extern "C" {
const char *bactext_network_layer_msg_name(
unsigned index);
const char *bactext_lighting_operation_name(
unsigned index);
#ifdef __cplusplus
}
#endif /* __cplusplus */
+2
View File
@@ -125,6 +125,7 @@
defined(BACAPP_ENUMERATED) || \
defined(BACAPP_DATE) || \
defined(BACAPP_TIME) || \
defined(BACAPP_LIGHTING_COMMAND) || \
defined(BACAPP_OBJECT_ID))
#define BACAPP_ALL
#endif
@@ -143,6 +144,7 @@
#define BACAPP_DATE
#define BACAPP_TIME
#define BACAPP_OBJECT_ID
#define BACAPP_LIGHTING_COMMAND
#endif
/*
+82
View File
@@ -0,0 +1,82 @@
/**************************************************************************
*
* Copyright (C) 2012 Steve Karg <skarg@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*********************************************************************/
#ifndef LIGHTING_H
#define LIGHTING_H
#include <stdint.h>
#include <stdbool.h>
#include "bacenum.h"
/* BACnetLightingCommand ::= SEQUENCE {
operation [0] BACnetLightingOperation,
target-level [1] REAL (0.0..100.0) OPTIONAL,
ramp-rate [2] REAL (0.1..100.0) OPTIONAL,
step-increment [3] REAL (0.1..100.0) OPTIONAL,
fade-time [4] Unsigned (100.. 86400000) OPTIONAL,
priority [5] Unsigned (1..16) OPTIONAL
}
-- Note that the combination of level, ramp-rate, step-increment, and fade-time fields is
-- dependent on the specific lighting operation. See Table 12-67.
*/
typedef struct BACnetLightingCommand {
BACNET_LIGHTING_OPERATION operation;
/* fields are optional */
bool use_target_level:1;
bool use_ramp_rate:1;
bool use_step_increment:1;
bool use_fade_time:1;
bool use_priority:1;
float target_level;
float ramp_rate;
float step_increment;
uint32_t fade_time;
uint8_t priority;
} BACNET_LIGHTING_COMMAND;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int lighting_command_encode(
uint8_t * apdu,
BACNET_LIGHTING_COMMAND * data);
int lighting_command_encode_context(
uint8_t * apdu,
uint8_t tag_number,
BACNET_LIGHTING_COMMAND * value);
int lighting_command_decode(
uint8_t * apdu,
unsigned apdu_max_len,
BACNET_LIGHTING_COMMAND * data);
bool lighting_command_copy(
BACNET_LIGHTING_COMMAND * dst,
BACNET_LIGHTING_COMMAND * src);
bool lighting_command_same(
BACNET_LIGHTING_COMMAND * dst,
BACNET_LIGHTING_COMMAND * src);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif