author | Nadim Khan <34601107+nadim4114@users.noreply.github.com> |
Fri, 26 Apr 2024 13:40:34 +0530 | |
changeset 3942 | ac6408084c60 |
parent 2649 | db68cb0e6bdc |
permissions | -rw-r--r-- |
2020
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
1 |
/************************************************************************** |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
2 |
* |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
3 |
* Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net> |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
4 |
* Copyright (C) 2017 Mario de Sousa <msousa@fe.up.pt> |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
5 |
* |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
7 |
* a copy of this software and associated documentation files (the |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
8 |
* "Software"), to deal in the Software without restriction, including |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
9 |
* without limitation the rights to use, copy, modify, merge, publish, |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
10 |
* distribute, sublicense, and/or sell copies of the Software, and to |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
11 |
* permit persons to whom the Software is furnished to do so, subject to |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
12 |
* the following conditions: |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
13 |
* |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
14 |
* The above copyright notice and this permission notice shall be included |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
15 |
* in all copies or substantial portions of the Software. |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
16 |
* |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
18 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
19 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
20 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
21 |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
22 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
23 |
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
24 |
* |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
25 |
*********************************************************************/ |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
26 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
27 |
#ifndef SERVER_H_ |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
28 |
#define SERVER_H_ |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
29 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
30 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
31 |
#include <stddef.h> |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
32 |
#include <stdint.h> |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
33 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
34 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
35 |
|
2649
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
36 |
|
2020
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
37 |
typedef struct{ |
2649
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
38 |
char location [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
39 |
char network_interface [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
40 |
char port_number [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
41 |
char device_name [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
42 |
char device_location [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
43 |
char device_description [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
44 |
char device_appsoftware_ver[%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
45 |
char comm_control_passwd [%(BACnet_Param_String_Size)d]; |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
46 |
// int override_local_config; // bool flag => |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
47 |
// // true : use these parameter values |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
48 |
// // false: use values stored on local file in PLC |
2020
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
49 |
uint32_t device_id; // device ID is 22 bits long! uint16_t is not enough! |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
50 |
int init_state; // store how far along the server's initialization has progressed |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
51 |
pthread_t thread_id; // thread handling this server |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
52 |
} server_node_t; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
53 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
54 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
55 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
56 |
/*initialization following all parameters given by user in application*/ |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
57 |
static server_node_t server_node = { |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
58 |
"%(locstr)s", |
2649
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
59 |
"%(network_interface)s", // interface (NULL => use default (eth0)) |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
60 |
"%(port_number)s", // Port number (NULL => use default) |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
61 |
"%(BACnet_Device_Name)s", // BACnet server's device (object) Name |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
62 |
"%(BACnet_Device_Location)s", // BACnet server's device (object) Location |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
63 |
"%(BACnet_Device_Description)s", // BACnet server's device (object) Description |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
64 |
"%(BACnet_Device_AppSoft_Version)s", // BACnet server's device (object) App. Software Ver. |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
65 |
"%(BACnet_Comm_Control_Password)s", // BACnet server's device (object) Password |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
66 |
// (Override_Parameters_Saved_on_PLC)d, // override locally saved parameters (bool flag) |
db68cb0e6bdc
BACnet plugin: Add web interface for online parameter configuration
Mario de Sousa <msousa@fe.up.pt>
parents:
2020
diff
changeset
|
67 |
%(BACnet_Device_ID)s // BACnet server's device (object) ID |
2020
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
68 |
}; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
69 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
70 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
71 |
#endif /* SERVER_H_ */ |