thermferm/devices.h

Sun, 05 May 2024 17:24:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 05 May 2024 17:24:54 +0200
changeset 730
6eba006ed8f5
parent 715
f5d85af156ab
permissions
-rw-r--r--

Much faster shutdown of the websocket service.

158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 #ifndef MY_DEVICES_H
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 #define MY_DEVICES_H
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
715
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
4
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
5 /**
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
6 * @brief Read one byte from a 1-wire device like a DS2413
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
7 * @param address The device address string
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
8 * @param file The file in the address space
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
9 * @return The read value or negative value if error
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
10 */
654
e981d0185485 Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
11 int read_w1(char *address, char *file);
e981d0185485 Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
12 int write_w1(char *address, char *file, uint8_t val);
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13
654
e981d0185485 Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
14 int device_out(char *uuid, int value);
e981d0185485 Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
15 int device_in(char *uuid, int *value);
684
b2265c7e5707 Updated dependencies. Devices json data is created in de devices source for all places where it is needed. Added devices_ws function to broadcast all devices, to be used when any device is changed. The devices loop detects changes in input values and calls devices_ws if so. The server uses the general devices json data.
Michiel Broek <mbroek@mbse.eu>
parents: 654
diff changeset
16
715
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
17 /**
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
18 * @brief Set present status
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
19 * @param address The device address string
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
20 * @param present The desired present value
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
21 * @return -1 if error. 0 if ok and 1 if ok and changed.
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
22 */
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
23 int device_present(char *address, int present);
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
24
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
25
687
f5d05b420732 Devices edit popup layout ready.
Michiel Broek <mbroek@mbse.eu>
parents: 684
diff changeset
26 char *device_json(devices_list *device);
684
b2265c7e5707 Updated dependencies. Devices json data is created in de devices source for all places where it is needed. Added devices_ws function to broadcast all devices, to be used when any device is changed. The devices loop detects changes in input values and calls devices_ws if so. The server uses the general devices json data.
Michiel Broek <mbroek@mbse.eu>
parents: 654
diff changeset
27
715
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
28
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
29 void devices_ws(void);
f5d85af156ab Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.
Michiel Broek <mbroek@mbse.eu>
parents: 687
diff changeset
30
158
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 int devices_detect(void);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 void *my_devices_loop(void *);
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
f1b7e2ef90be Added device configuration
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 #endif

mercurial