- Main
- Tutorials
- Library
- Samples

- File List
- Globals

DataSet.h
Go to the documentation of this file.
1 #ifndef __DATA_SET__
2 #define __DATA_SET__
3
4 #include <sys/time.h>
5 #include <stdio.h>
6 #include <mx_node_sdk/mx_node_interface_basic.h>
7 #include <mx_node_sdk/mx_node_interface_data_access.h>
8
9 #include "cJSON.h"
10 #define MX_PARSE_CONFIG_ERR -1
11 #define MX_IO_CONTROL_OK 0
12 #define MX_IO_CONTROL_ERR -1
13
14 typedef struct _io_node
15 {
16 int ch; //uint8_t
17 char name[64];
18 int var_type;
19 int func_type;
20 int access;
21 char description[64];
22 MX_NODE_NODE_HANDLE node_handle;
23 MX_NODE_VARIANT data;
24 struct timeval timestamp;
25 }NODE;
26
27 typedef enum {
28 OPC_DI_MODE = 10,
29 OPC_DI_STATUS,
30 OPC_DI_COUNTERSTATUS,
31 OPC_DI_COUNTERVALUE,
32 OPC_DO_MODE = 20,
33 OPC_DO_STATUS,
34 OPC_DO_PULSESTATUS,
35 OPC_DO_PULSECOUNT,
36 OPC_AI_MODE = 30,
37 OPC_AI_STATUS,
38 OPC_AI_RAWVALUE,
39 OPC_AI_MINIMUMRAWVALUE,
40 OPC_AI_MAXIMUMRAWVALUE,
41 OPC_AI_SCALEDVALUE,
42 OPC_RELAY_VALUE = 40
43 }FUNC_TYPE;
44
45 int parse_json_file(const char *filename);/* Read a file, parse, render back, etc. */
46 int cJSON_to_struct_array(char *text);
47 int io_control_read(int slot, int index, MX_NODE_VARIANT* node_value);
48 int io_control_write(int slot, int index, const MX_NODE_VARIANT* node_value);
49
50 struct timeval Now()
51 {
52 struct timeval now;
53 gettimeofday(&now, NULL);
54 return now;
55 }
56 #endif
io_control_write
int io_control_write(int slot, int index, const MX_NODE_VARIANT *node_value)
Definition: io_node_operator.c:622
_io_node
Definition: DataSet.h:14
_MX_NODE_VARIANT
A variant structure is used to store different type&#39;s data.
Definition: mx_node_node_def.h:97
MX_NODE_NODE_HANDLE
size_t MX_NODE_NODE_HANDLE
Handle of a node.
Definition: mx_node_node.h:42
Now
struct timeval Now()
Definition: DataSet.h:50
OPC_DI_COUNTERSTATUS
Definition: DataSet.h:30
OPC_AI_STATUS
Definition: DataSet.h:37
_io_node::access
int access
Definition: DataSet.h:20
_io_node::ch
int ch
Definition: DataSet.h:16
OPC_AI_MAXIMUMRAWVALUE
Definition: DataSet.h:40
_io_node::timestamp
struct timeval timestamp
Definition: DataSet.h:24
index
int index
Definition: cJSON.h:168
OPC_RELAY_VALUE
Definition: DataSet.h:42
OPC_DO_PULSECOUNT
Definition: DataSet.h:35
parse_json_file
int parse_json_file(const char *filename)
Definition: io_node_operator.c:315
OPC_AI_MODE
Definition: DataSet.h:36
cJSON.h
OPC_DI_MODE
Definition: DataSet.h:28
FUNC_TYPE
FUNC_TYPE
Definition: DataSet.h:27
OPC_DO_STATUS
Definition: DataSet.h:33
OPC_AI_MINIMUMRAWVALUE
Definition: DataSet.h:39
now
struct timeval now()
Definition: demo_node_operator.c:303
OPC_DI_STATUS
Definition: DataSet.h:29
_io_node::func_type
int func_type
Definition: DataSet.h:19
cJSON_to_struct_array
int cJSON_to_struct_array(char *text)
Definition: io_node_operator.c:340
_io_node::name
char name[64]
Definition: DataSet.h:17
OPC_AI_SCALEDVALUE
Definition: DataSet.h:41
io_control_read
int io_control_read(int slot, int index, MX_NODE_VARIANT *node_value)
Definition: io_node_operator.c:449
NODE
struct _io_node NODE
OPC_AI_RAWVALUE
Definition: DataSet.h:38
_io_node::node_handle
MX_NODE_NODE_HANDLE node_handle
Definition: DataSet.h:22
_io_node::var_type
int var_type
Definition: DataSet.h:18
_io_node::data
MX_NODE_VARIANT data
Definition: DataSet.h:23
OPC_DO_MODE
Definition: DataSet.h:32
_io_node::description
char description[64]
Definition: DataSet.h:21
OPC_DI_COUNTERVALUE
Definition: DataSet.h:31
OPC_DO_PULSESTATUS
Definition: DataSet.h:34