author | Edouard Tisserant |
Sat, 19 Oct 2019 01:23:30 +0200 | |
branch | svghmi |
changeset 2800 | 68cee1366b9c |
parent 2020 | 6dddf3070806 |
child 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 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
36 |
typedef struct{ |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
37 |
const char *location; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
38 |
const char *network_interface; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
39 |
const char *port_number; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
40 |
const char *device_name; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
41 |
const char *comm_control_passwd; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
} server_node_t; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
46 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
47 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
48 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
49 |
/*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
|
50 |
static server_node_t server_node = { |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
51 |
"%(locstr)s", |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
52 |
"%(network_interface)s", // interface (NULL => use default (eth0)) |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
53 |
"%(port_number)s", // Port number (NULL => use default) |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
54 |
"%(BACnet_Device_Name)s", // BACnet server's device (object) name |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
55 |
"%(BACnet_Comm_Control_Password)s",// BACnet server's device (object) name |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
56 |
%(BACnet_Device_ID)s // BACnet server's device (object) ID |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
57 |
}; |
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
58 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
59 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
60 |
|
6dddf3070806
Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff
changeset
|
61 |
#endif /* SERVER_H_ */ |