thermferm/devices.h

Wed, 01 May 2024 14:38:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 01 May 2024 14:38:37 +0200
changeset 715
f5d85af156ab
parent 687
f5d05b420732
permissions
-rw-r--r--

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.

#ifndef MY_DEVICES_H
#define	MY_DEVICES_H


/**
 * @brief Read one byte from a 1-wire device like a DS2413
 * @param address The device address string
 * @param file The file in the address space
 * @return The read value or negative value if error
 */
int read_w1(char *address, char *file);
int write_w1(char *address, char *file, uint8_t val);

int device_out(char *uuid, int value);
int device_in(char *uuid, int *value);

/**
 * @brief Set present status
 * @param address The device address string
 * @param present The desired present value
 * @return -1 if error. 0 if ok and 1 if ok and changed.
 */
int device_present(char *address, int present);


char *device_json(devices_list *device);


void devices_ws(void);

int devices_detect(void);

void *my_devices_loop(void *);

#endif

mercurial