Added in object handlers to make the demo work more like it did before the property access API was changed. This is handy when testing as multiple copies of the program can then read from each others device. Also added in Visual Studio 2008 Express project files.
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bacnet", "bacnet.vcproj", "{966C8DD2-C0ED-4B7F-8EFB-1F64F2453D6A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{966C8DD2-C0ED-4B7F-8EFB-1F64F2453D6A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{966C8DD2-C0ED-4B7F-8EFB-1F64F2453D6A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{966C8DD2-C0ED-4B7F-8EFB-1F64F2453D6A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{966C8DD2-C0ED-4B7F-8EFB-1F64F2453D6A}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,10 +42,175 @@
|
||||
#include "datalink.h"
|
||||
#include "txbuf.h"
|
||||
#include "dlenv.h"
|
||||
/* include the objects */
|
||||
#include "device.h"
|
||||
#include "ai.h"
|
||||
#include "ao.h"
|
||||
#include "av.h"
|
||||
#include "bi.h"
|
||||
#include "bo.h"
|
||||
#include "bv.h"
|
||||
#include "lc.h"
|
||||
#include "lsp.h"
|
||||
#include "mso.h"
|
||||
#include "bacfile.h"
|
||||
|
||||
/* buffer used for receive */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
static void Init_Object(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
rpm_property_lists_function rpm_list_function,
|
||||
read_property_function rp_function,
|
||||
object_valid_instance_function object_valid_function,
|
||||
write_property_function wp_function,
|
||||
object_count_function count_function,
|
||||
object_index_to_instance_function index_function,
|
||||
object_name_function name_function)
|
||||
{
|
||||
handler_read_property_object_set(
|
||||
object_type,
|
||||
rp_function,
|
||||
object_valid_function);
|
||||
handler_write_property_object_set(
|
||||
object_type,
|
||||
wp_function);
|
||||
handler_read_property_multiple_list_set(
|
||||
object_type,
|
||||
rpm_list_function);
|
||||
Device_Object_Function_Set(
|
||||
object_type,
|
||||
count_function,
|
||||
index_function,
|
||||
name_function);
|
||||
}
|
||||
|
||||
static void Init_Objects(void)
|
||||
{
|
||||
Device_Init();
|
||||
Init_Object(
|
||||
OBJECT_DEVICE,
|
||||
Device_Property_Lists,
|
||||
Device_Encode_Property_APDU,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Write_Property,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Analog_Input_Init();
|
||||
Init_Object(
|
||||
OBJECT_ANALOG_INPUT,
|
||||
Analog_Input_Property_Lists,
|
||||
Analog_Input_Encode_Property_APDU,
|
||||
Analog_Input_Valid_Instance,
|
||||
NULL,
|
||||
Analog_Input_Count,
|
||||
Analog_Input_Index_To_Instance,
|
||||
Analog_Input_Name);
|
||||
|
||||
Analog_Output_Init();
|
||||
Init_Object(
|
||||
OBJECT_ANALOG_OUTPUT,
|
||||
Analog_Output_Property_Lists,
|
||||
Analog_Output_Encode_Property_APDU,
|
||||
Analog_Output_Valid_Instance,
|
||||
Analog_Output_Write_Property,
|
||||
Analog_Output_Count,
|
||||
Analog_Output_Index_To_Instance,
|
||||
Analog_Output_Name);
|
||||
|
||||
Analog_Value_Init();
|
||||
Init_Object(
|
||||
OBJECT_ANALOG_VALUE,
|
||||
Analog_Value_Property_Lists,
|
||||
Analog_Value_Encode_Property_APDU,
|
||||
Analog_Value_Valid_Instance,
|
||||
Analog_Value_Write_Property,
|
||||
Analog_Value_Count,
|
||||
Analog_Value_Index_To_Instance,
|
||||
Analog_Value_Name);
|
||||
|
||||
Binary_Input_Init();
|
||||
Init_Object(
|
||||
OBJECT_BINARY_INPUT,
|
||||
Binary_Input_Property_Lists,
|
||||
Binary_Input_Encode_Property_APDU,
|
||||
Binary_Input_Valid_Instance,
|
||||
NULL,
|
||||
Binary_Input_Count,
|
||||
Binary_Input_Index_To_Instance,
|
||||
Binary_Input_Name);
|
||||
|
||||
Binary_Output_Init();
|
||||
Init_Object(
|
||||
OBJECT_BINARY_OUTPUT,
|
||||
Binary_Output_Property_Lists,
|
||||
Binary_Output_Encode_Property_APDU,
|
||||
Binary_Output_Valid_Instance,
|
||||
Binary_Output_Write_Property,
|
||||
Binary_Output_Count,
|
||||
Binary_Output_Index_To_Instance,
|
||||
Binary_Output_Name);
|
||||
|
||||
Binary_Value_Init();
|
||||
Init_Object(
|
||||
OBJECT_BINARY_VALUE,
|
||||
Binary_Value_Property_Lists,
|
||||
Binary_Value_Encode_Property_APDU,
|
||||
Binary_Value_Valid_Instance,
|
||||
Binary_Value_Write_Property,
|
||||
Binary_Value_Count,
|
||||
Binary_Value_Index_To_Instance,
|
||||
Binary_Value_Name);
|
||||
|
||||
Life_Safety_Point_Init();
|
||||
Init_Object(
|
||||
OBJECT_LIFE_SAFETY_POINT,
|
||||
Life_Safety_Point_Property_Lists,
|
||||
Life_Safety_Point_Encode_Property_APDU,
|
||||
Life_Safety_Point_Valid_Instance,
|
||||
Life_Safety_Point_Write_Property,
|
||||
Life_Safety_Point_Count,
|
||||
Life_Safety_Point_Index_To_Instance,
|
||||
Life_Safety_Point_Name);
|
||||
|
||||
Load_Control_Init();
|
||||
Init_Object(
|
||||
OBJECT_LOAD_CONTROL,
|
||||
Load_Control_Property_Lists,
|
||||
Load_Control_Encode_Property_APDU,
|
||||
Load_Control_Valid_Instance,
|
||||
Load_Control_Write_Property,
|
||||
Load_Control_Count,
|
||||
Load_Control_Index_To_Instance,
|
||||
Load_Control_Name);
|
||||
|
||||
Multistate_Output_Init();
|
||||
Init_Object(
|
||||
OBJECT_MULTI_STATE_OUTPUT,
|
||||
Multistate_Output_Property_Lists,
|
||||
Multistate_Output_Encode_Property_APDU,
|
||||
Multistate_Output_Valid_Instance,
|
||||
Multistate_Output_Write_Property,
|
||||
Multistate_Output_Count,
|
||||
Multistate_Output_Index_To_Instance,
|
||||
Multistate_Output_Name);
|
||||
|
||||
#if defined(BACFILE)
|
||||
bacfile_init();
|
||||
Init_Object(
|
||||
OBJECT_FILE,
|
||||
BACfile_Property_Lists,
|
||||
bacfile_encode_property_apdu,
|
||||
bacfile_valid_instance,
|
||||
bacfile_write_property,
|
||||
bacfile_count,
|
||||
bacfile_index_to_instance,
|
||||
bacfile_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* send a whois to see who is on the network */
|
||||
static bool Who_Is_Request = true;
|
||||
bool I_Am_Request = true;
|
||||
@@ -168,8 +333,8 @@ static void Init_Service_Handlers(
|
||||
apdu_set_unrecognized_service_handler_handler
|
||||
(handler_unrecognized_service);
|
||||
/* we must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE, handler_read_property_multiple);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property_ack);
|
||||
@@ -222,7 +387,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
Device_Set_Object_Instance_Number(4194303);
|
||||
Device_Set_Object_Instance_Number(4194300);
|
||||
Init_Objects();
|
||||
address_init();
|
||||
Init_Service_Handlers();
|
||||
dlenv_init();
|
||||
datalink_get_broadcast_address(&broadcast_address);
|
||||
|
||||
Reference in New Issue
Block a user