Added CreateObject and DeleteObject to Load Control object. (#713)

This commit is contained in:
Steve Karg
2024-08-11 19:14:27 -05:00
committed by GitHub
parent ebb8be067f
commit e5307e280c
12 changed files with 1749 additions and 986 deletions
+27
View File
@@ -1942,3 +1942,30 @@ const char *bactext_device_communications_name(unsigned index)
return indtext_by_index_default(
bacnet_device_communications_names, index, ASHRAE_Reserved_String);
}
INDTEXT_DATA bacnet_shed_state_names[] = {
{ BACNET_SHED_INACTIVE, "shed-inactive" },
{ BACNET_SHED_REQUEST_PENDING, "shed-request-pending" },
{ BACNET_SHED_COMPLIANT, "shed-compliant" },
{ BACNET_SHED_NON_COMPLIANT, "shed-non-compliant" },
{ 0, NULL }
};
const char *bactext_shed_state_name(unsigned index)
{
return indtext_by_index_default(
bacnet_shed_state_names, index, ASHRAE_Reserved_String);
}
INDTEXT_DATA bacnet_shed_level_type_names[] = {
{ BACNET_SHED_TYPE_PERCENT, "percent" },
{ BACNET_SHED_TYPE_LEVEL, "level" },
{ BACNET_SHED_TYPE_AMOUNT, "amount" },
{ 0, NULL }
};
const char *bactext_shed_level_type_name(unsigned index)
{
return indtext_by_index_default(
bacnet_shed_level_type_names, index, ASHRAE_Reserved_String);
}
+6
View File
@@ -206,6 +206,12 @@ extern "C" {
const char *bactext_color_operation_name(
unsigned index);
BACNET_STACK_EXPORT
const char *bactext_shed_state_name(unsigned index);
BACNET_STACK_EXPORT
const char *bactext_shed_level_type_name(unsigned index);
#ifdef __cplusplus
}
#endif /* __cplusplus */
+1 -1
View File
@@ -770,7 +770,7 @@ bool Binary_Input_Active_Text_Set(uint32_t object_instance, char *new_name)
#if defined(INTRINSIC_REPORTING) && (BINARY_INPUT_INTRINSIC_REPORTING)
/**
* @brief Encode a EventTimeStamps property element
* @param object_instance [in] BACnet network port object instance number
* @param object_instance [in] BACnet object instance number
* @param index [in] array index requested:
* 0 to N for individual array members
* @param apdu [out] Buffer in which the APDU contents are built, or NULL to
+1 -1
View File
@@ -264,7 +264,7 @@ static object_functions_t My_Object_Table[] = {
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */,
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
NULL /* Create */, NULL /* Delete */, NULL /* Timer */ },
Load_Control_Create, Load_Control_Delete, Load_Control_Timer},
{ OBJECT_MULTI_STATE_INPUT, Multistate_Input_Init, Multistate_Input_Count,
Multistate_Input_Index_To_Instance, Multistate_Input_Valid_Instance,
Multistate_Input_Object_Name, Multistate_Input_Read_Property,
+1150 -670
View File
File diff suppressed because it is too large Load Diff
+130 -66
View File
@@ -2,7 +2,7 @@
* @file
* @author Steve Karg <skarg@users.sourceforge.net>
* @date 2007
* @brief The Load Control Objects from 135-2004-Addendum e
* @brief The Load Control Objects from 135-2004-Addendum e
* @copyright SPDX-License-Identifier: MIT
*/
#ifndef BACNET_BASIC_OBJECT_LOAD_CONTROL_H
@@ -16,83 +16,147 @@
#include "bacnet/rp.h"
#include "bacnet/wp.h"
typedef enum bacnet_load_control_state {
SHED_INACTIVE,
SHED_REQUEST_PENDING,
SHED_NON_COMPLIANT,
SHED_COMPLIANT,
MAX_LOAD_CONTROL_STATE
} BACNET_LOAD_CONTROL_STATE;
typedef struct shed_level_data {
/* Represents the shed levels for the LEVEL choice of
BACnetShedLevel that have meaning for this particular
Load Control object. We use 'percent' of baseline. */
float Value;
const char *Description;
} BACNET_SHED_LEVEL_DATA;
/**
* @brief Callback for manipulated object controlled value write
* @param object_type - object type of the manipulated object
* @param object_instance - object-instance number of the object
* @param property_id - property identifier of the manipulated object
* @param priority - priority of the write
* @param value - value of the write
*/
typedef void (*load_control_manipulated_object_write_callback)(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_ID property_id,
uint8_t priority,
float value);
/**
* @brief Callback for manipulated object controlled value relinquish
* @param object_type - object type of the manipulated object
* @param object_instance - object-instance number of the object
* @param property_id - property identifier of the manipulated object
* @param priority - priority of the relinquish
*/
typedef void (*load_control_manipulated_object_relinquish_callback)(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_ID property_id,
uint8_t priority);
/**
* @brief Callback for manipulated object controlled value read
* @param object_type - object type of the manipulated object
* @param object_instance - object-instance number of the object
* @param property_id - property identifier of the manipulated object
* @param priority - present priority of the object property
* @param value - present value of the object property
*/
typedef void (*load_control_manipulated_object_read_callback)(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_ID property_id,
uint8_t *priority,
float *value);
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
void Load_Control_Property_Lists(
const int **pRequired,
const int **pOptional,
const int **pProprietary);
BACNET_STACK_EXPORT
void Load_Control_State_Machine_Handler(
void);
BACNET_STACK_EXPORT
void Load_Control_Property_Lists(
const int **pRequired, const int **pOptional, const int **pProprietary);
BACNET_STACK_EXPORT
bool Load_Control_Valid_Instance(
uint32_t object_instance);
BACNET_STACK_EXPORT
unsigned Load_Control_Count(
void);
BACNET_STACK_EXPORT
uint32_t Load_Control_Index_To_Instance(
unsigned index);
BACNET_STACK_EXPORT
unsigned Load_Control_Instance_To_Index(
uint32_t object_instance);
BACNET_STACK_DEPRECATED("Use Load_Control_Timer() instead")
BACNET_STACK_EXPORT
void Load_Control_State_Machine_Handler(void);
BACNET_STACK_EXPORT
bool Load_Control_Object_Name(
uint32_t object_instance,
BACNET_CHARACTER_STRING * object_name);
BACNET_STACK_EXPORT
bool Load_Control_Valid_Instance(uint32_t object_instance);
BACNET_STACK_EXPORT
unsigned Load_Control_Count(void);
BACNET_STACK_EXPORT
uint32_t Load_Control_Index_To_Instance(unsigned index);
BACNET_STACK_EXPORT
unsigned Load_Control_Instance_To_Index(uint32_t object_instance);
BACNET_STACK_EXPORT
void Load_Control_Init(
void);
BACNET_STACK_EXPORT
bool Load_Control_Object_Name(
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
BACNET_STACK_EXPORT
bool Load_Control_Name_Set(uint32_t object_instance, char *new_name);
BACNET_STACK_EXPORT
unsigned Load_Control_Priority_For_Writing(
uint32_t object_instance);
BACNET_STACK_EXPORT
bool Load_Control_Priority_For_Writing_Set(
uint32_t object_instance, unsigned priority);
BACNET_STACK_EXPORT
bool Load_Control_Manipulated_Variable_Reference(
uint32_t object_instance,
BACNET_OBJECT_PROPERTY_REFERENCE * object_property_reference);
BACNET_STACK_EXPORT
bool Load_Control_Manipulated_Variable_Reference_Set(
uint32_t object_instance,
BACNET_OBJECT_PROPERTY_REFERENCE * object_property_reference);
BACNET_STACK_EXPORT
BACNET_SHED_STATE Load_Control_Present_Value(uint32_t object_instance);
BACNET_STACK_EXPORT
int Load_Control_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata);
BACNET_STACK_EXPORT
bool Load_Control_Shed_Level_Array_Set(
uint32_t object_instance,
uint32_t array_index,
struct shed_level_data *value);
BACNET_STACK_EXPORT
bool Load_Control_Shed_Level_Array(
uint32_t object_instance,
uint32_t array_entry,
struct shed_level_data *value);
BACNET_STACK_EXPORT
bool Load_Control_Write_Property(
BACNET_WRITE_PROPERTY_DATA * wp_data);
BACNET_STACK_EXPORT
uint32_t Load_Control_Create(uint32_t object_instance);
BACNET_STACK_EXPORT
bool Load_Control_Delete(uint32_t object_instance);
BACNET_STACK_EXPORT
void Load_Control_Cleanup(void);
/* functions used for unit testing */
BACNET_STACK_EXPORT
void Load_Control_State_Machine(
int object_index,
BACNET_DATE_TIME *bdatetime);
BACNET_STACK_EXPORT
BACNET_LOAD_CONTROL_STATE Load_Control_State(
int object_index);
BACNET_STACK_EXPORT
BACNET_OBJECT_ID Load_Control_Object_ID(
int object_index);
BACNET_STACK_EXPORT
void Load_Control_Init(void);
BACNET_STACK_EXPORT
unsigned Load_Control_Priority_For_Writing(uint32_t object_instance);
BACNET_STACK_EXPORT
bool Load_Control_Priority_For_Writing_Set(
uint32_t object_instance, unsigned priority);
BACNET_STACK_EXPORT
bool Load_Control_Manipulated_Variable_Reference(
uint32_t object_instance,
BACNET_OBJECT_PROPERTY_REFERENCE *object_property_reference);
BACNET_STACK_EXPORT
bool Load_Control_Manipulated_Variable_Reference_Set(
uint32_t object_instance,
BACNET_OBJECT_PROPERTY_REFERENCE *object_property_reference);
BACNET_STACK_EXPORT
void Load_Control_Manipulated_Object_Write_Callback_Set(
uint32_t object_instance,
load_control_manipulated_object_write_callback cb);
BACNET_STACK_EXPORT
void Load_Control_Manipulated_Object_Relinquish_Callback_Set(
uint32_t object_instance,
load_control_manipulated_object_relinquish_callback cb);
BACNET_STACK_EXPORT
void Load_Control_Manipulated_Object_Read_Callback_Set(
uint32_t object_instance, load_control_manipulated_object_read_callback cb);
BACNET_STACK_EXPORT
void Load_Control_Timer(uint32_t object_instance, uint16_t milliseconds);
BACNET_STACK_EXPORT
int Load_Control_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
BACNET_STACK_EXPORT
bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
/* functions used for unit testing */
BACNET_STACK_EXPORT
void Load_Control_State_Machine(int object_index, BACNET_DATE_TIME *bdatetime);
#ifdef __cplusplus
}
+9 -9
View File
@@ -2385,20 +2385,20 @@ Lighting_Output_Ramp_Handler(uint32_t object_instance, uint16_t milliseconds)
debug_printf("LO[%u] Ramp Handler at target=%f tracking=%f\n",
object_instance, (double)target_value, (double)old_value);
/* stop ramping */
step_value = target_value;
pObject->Lighting_Command.operation = BACNET_LIGHTS_STOP;
}
/* clamp target within min/max, if needed */
if (isgreater(step_value, max_value)) {
step_value = max_value;
}
if (isless(step_value, min_value)) {
step_value = min_value;
}
pObject->Tracking_Value = step_value;
if (pObject->Lighting_Command.operation == BACNET_LIGHTS_STOP) {
pObject->Tracking_Value = target_value;
pObject->In_Progress = BACNET_LIGHTING_IDLE;
} else {
/* clamp target within min/max, if needed */
if (isgreater(step_value, max_value)) {
step_value = max_value;
}
if (isless(step_value, min_value)) {
step_value = min_value;
}
pObject->Tracking_Value = step_value;
pObject->In_Progress = BACNET_LIGHTING_RAMP_ACTIVE;
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ extern "C" {
OS_Keylist list,
KEY key);
/* returns the data specified by key */
/* returns the data specified by index */
BACNET_STACK_EXPORT
void *Keylist_Data_Index(
OS_Keylist list,