Updated Lighting Output object. Added Channel object. Not complete and not fully tested.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date 2013
|
||||
* @brief Channel objects, customize for your use
|
||||
*
|
||||
* @section DESCRIPTION
|
||||
*
|
||||
* The Channel object is a command object without a priority array, and the
|
||||
* present-value property uses a priority array and a single precision floating point
|
||||
* data type.
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* 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 CHANNEL_H
|
||||
#define CHANNEL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "bacdef.h"
|
||||
#include "rp.h"
|
||||
#include "wp.h"
|
||||
#include "lo.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* BACNET_CHANNEL_VALUE decodes WriteProperty service requests
|
||||
Choose the datatypes that your application supports */
|
||||
#if !(defined(CHANNEL_NUMERIC) || \
|
||||
defined(CHANNEL_NULL) || \
|
||||
defined(CHANNEL_BOOLEAN) || \
|
||||
defined(CHANNEL_UNSIGNED) || \
|
||||
defined(CHANNEL_SIGNED) || \
|
||||
defined(CHANNEL_REAL) || \
|
||||
defined(CHANNEL_DOUBLE) || \
|
||||
defined(CHANNEL_OCTET_STRING) || \
|
||||
defined(CHANNEL_CHARACTER_STRING) || \
|
||||
defined(CHANNEL_BIT_STRING) || \
|
||||
defined(CHANNEL_ENUMERATED) || \
|
||||
defined(CHANNEL_DATE) || \
|
||||
defined(CHANNEL_TIME) || \
|
||||
defined(CHANNEL_OBJECT_ID) || \
|
||||
defined(CHANNEL_LIGHTING_COMMAND))
|
||||
#define CHANNEL_NUMERIC
|
||||
#endif
|
||||
|
||||
#if defined (CHANNEL_NUMERIC)
|
||||
#define CHANNEL_NULL
|
||||
#define CHANNEL_BOOLEAN
|
||||
#define CHANNEL_UNSIGNED
|
||||
#define CHANNEL_SIGNED
|
||||
#define CHANNEL_REAL
|
||||
#define CHANNEL_DOUBLE
|
||||
#define CHANNEL_ENUMERATED
|
||||
#define CHANNEL_LIGHTING_COMMAND
|
||||
#endif
|
||||
|
||||
typedef struct BACnet_Channel_Value_t {
|
||||
uint8_t tag;
|
||||
union {
|
||||
/* NULL - not needed as it is encoded in the tag alone */
|
||||
#if defined (CHANNEL_BOOLEAN)
|
||||
bool Boolean;
|
||||
#endif
|
||||
#if defined (CHANNEL_UNSIGNED)
|
||||
uint32_t Unsigned_Int;
|
||||
#endif
|
||||
#if defined (CHANNEL_SIGNED)
|
||||
int32_t Signed_Int;
|
||||
#endif
|
||||
#if defined (CHANNEL_REAL)
|
||||
float Real;
|
||||
#endif
|
||||
#if defined (CHANNEL_DOUBLE)
|
||||
double Double;
|
||||
#endif
|
||||
#if defined (CHANNEL_OCTET_STRING)
|
||||
BACNET_OCTET_STRING Octet_String;
|
||||
#endif
|
||||
#if defined (CHANNEL_CHARACTER_STRING)
|
||||
BACNET_CHARACTER_STRING Character_String;
|
||||
#endif
|
||||
#if defined (CHANNEL_BIT_STRING)
|
||||
BACNET_BIT_STRING Bit_String;
|
||||
#endif
|
||||
#if defined (CHANNEL_ENUMERATED)
|
||||
uint32_t Enumerated;
|
||||
#endif
|
||||
#if defined (CHANNEL_DATE)
|
||||
BACNET_DATE Date;
|
||||
#endif
|
||||
#if defined (CHANNEL_TIME)
|
||||
BACNET_TIME Time;
|
||||
#endif
|
||||
#if defined (CHANNEL_OBJECT_ID)
|
||||
BACNET_OBJECT_ID Object_Id;
|
||||
#endif
|
||||
#if defined (CHANNEL_LIGHTING_COMMAND)
|
||||
BACNET_LIGHTING_COMMAND Lighting_Command;
|
||||
#endif
|
||||
} type;
|
||||
/* simple linked list if needed */
|
||||
struct BACnet_Channel_Value_t *next;
|
||||
} BACNET_CHANNEL_VALUE;
|
||||
|
||||
void Channel_Property_Lists(const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Channel_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Channel_Count(void);
|
||||
uint32_t Channel_Index_To_Instance(unsigned index);
|
||||
unsigned Channel_Instance_To_Index(uint32_t instance);
|
||||
bool Channel_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
bool Channel_Object_Name(uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
bool Channel_Name_Set(uint32_t object_instance,
|
||||
char *new_name);
|
||||
|
||||
int Channel_Read_Property(BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
bool Channel_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
BACNET_CHANNEL_VALUE * Channel_Present_Value(uint32_t object_instance);
|
||||
bool Channel_Present_Value_Set(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
bool Channel_Out_Of_Service(uint32_t object_instance);
|
||||
void Channel_Out_Of_Service_Set(uint32_t object_instance,
|
||||
bool oos_flag);
|
||||
|
||||
unsigned Channel_Last_Priority(uint32_t object_instance);
|
||||
BACNET_WRITE_STATUS Channel_Write_Status(uint32_t object_instance);
|
||||
uint16_t Channel_Number(uint32_t object_instance);
|
||||
bool Channel_Number_Set(uint32_t object_instance, uint16_t value);
|
||||
|
||||
void Channel_Init(void);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testChannelObject(Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "bi.h"
|
||||
#include "bo.h"
|
||||
#include "bv.h"
|
||||
#include "channel.h"
|
||||
#include "csv.h"
|
||||
#include "lc.h"
|
||||
#include "lsp.h"
|
||||
@@ -197,7 +198,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if 0
|
||||
{OBJECT_CHARACTERSTRING_VALUE,
|
||||
CharacterString_Value_Init,
|
||||
CharacterString_Value_Count,
|
||||
@@ -213,7 +213,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
{OBJECT_NOTIFICATION_CLASS,
|
||||
Notification_Class_Init,
|
||||
@@ -291,7 +290,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if 0
|
||||
{OBJECT_MULTI_STATE_VALUE,
|
||||
Multistate_Value_Init,
|
||||
Multistate_Value_Count,
|
||||
@@ -307,7 +305,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
{OBJECT_TRENDLOG,
|
||||
Trend_Log_Init,
|
||||
Trend_Log_Count,
|
||||
@@ -323,6 +320,36 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_LIGHTING_OUTPUT,
|
||||
Lighting_Output_Init,
|
||||
Lighting_Output_Count,
|
||||
Lighting_Output_Index_To_Instance,
|
||||
Lighting_Output_Valid_Instance,
|
||||
Lighting_Output_Object_Name,
|
||||
Lighting_Output_Read_Property,
|
||||
Lighting_Output_Write_Property,
|
||||
Lighting_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_CHANNEL,
|
||||
Channel_Init,
|
||||
Channel_Count,
|
||||
Channel_Index_To_Instance,
|
||||
Channel_Valid_Instance,
|
||||
Channel_Object_Name,
|
||||
Channel_Read_Property,
|
||||
Channel_Write_Property,
|
||||
Channel_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if defined(BACFILE)
|
||||
{OBJECT_FILE,
|
||||
bacfile_init,
|
||||
|
||||
+967
-271
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,8 @@
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#ifndef LO_H
|
||||
#define LO_H
|
||||
#ifndef LIGHTING_OUTPUT_H
|
||||
#define LIGHTING_OUTPUT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -36,14 +36,21 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool Analog_Output_Valid_Instance(
|
||||
void Lighting_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Lighting_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Lighting_Output_Count(
|
||||
void);
|
||||
uint32_t Lighting_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Lighting_Output_Name(
|
||||
uint32_t object_instance);
|
||||
unsigned Lighting_Output_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
bool Lighting_Output_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
|
||||
float Lighting_Output_Present_Value(
|
||||
uint32_t object_instance);
|
||||
unsigned Lighting_Output_Present_Value_Priority(
|
||||
@@ -54,12 +61,106 @@ extern "C" {
|
||||
unsigned priority);
|
||||
bool Lighting_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance,
|
||||
int priority);
|
||||
unsigned priority);
|
||||
|
||||
float Lighting_Output_Relinquish_Default(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance,
|
||||
float value);
|
||||
|
||||
bool Lighting_Output_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
void Lighting_Output_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
bool Lighting_Output_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
float Lighting_Output_COV_Increment(
|
||||
uint32_t instance);
|
||||
void Lighting_Output_COV_Increment_Set(
|
||||
uint32_t instance,
|
||||
float value);
|
||||
|
||||
bool Lighting_Output_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
bool Lighting_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
|
||||
char *Lighting_Output_Description(
|
||||
uint32_t instance);
|
||||
bool Lighting_Output_Description_Set(
|
||||
uint32_t instance,
|
||||
char *new_name);
|
||||
|
||||
bool Lighting_Output_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
void Lighting_Output_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
|
||||
bool Lighting_Output_Lighting_Command_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_LIGHTING_COMMAND *value);
|
||||
bool Lighting_Output_Lighting_Command(
|
||||
uint32_t object_instance,
|
||||
BACNET_LIGHTING_COMMAND *value);
|
||||
|
||||
BACNET_LIGHTING_IN_PROGRESS Lighting_Output_In_Progress(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_In_Progress_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_LIGHTING_IN_PROGRESS in_progress);
|
||||
|
||||
float Lighting_Output_Tracking_Value(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Tracking_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value);
|
||||
|
||||
bool Lighting_Output_Blink_Warn_Enable(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Blink_Warn_Enable_Set(
|
||||
uint32_t object_instance,
|
||||
bool enable);
|
||||
|
||||
uint32_t Lighting_Output_Egress_Time(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Egress_Time_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t seconds);
|
||||
|
||||
uint32_t Lighting_Output_Default_Fade_Time(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Default_Fade_Time_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t milliseconds);
|
||||
|
||||
float Lighting_Output_Default_Ramp_Rate(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Default_Ramp_Rate_Set(
|
||||
uint32_t object_instance,
|
||||
float percent_per_second);
|
||||
|
||||
float Lighting_Output_Default_Step_Increment(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Default_Step_Increment_Set(
|
||||
uint32_t object_instance,
|
||||
float step_increment);
|
||||
|
||||
unsigned Lighting_Output_Default_Priority(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Default_Priority_Set(
|
||||
uint32_t object_instance,
|
||||
unsigned priority);
|
||||
|
||||
void Lighting_Output_Init(
|
||||
void);
|
||||
|
||||
/* ReadProperty service support */
|
||||
int Lighting_Output_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
/* WriteProperty service support */
|
||||
bool Lighting_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user