thermferm/devices.h

Thu, 02 May 2024 15:49:16 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 02 May 2024 15:49:16 +0200
changeset 716
5c30c8ef83a8
parent 715
f5d85af156ab
permissions
-rw-r--r--

Version 0.9.19b3. The simulator thread can be paused to be able to add and delete simulators. Added simulated door and PSU status. Devices can now fully use multiple simulators. Better rounding of simulated temperature values. The server SIMULATOR DEL and ADD commands pause the simulator when the linked list is manipulated. Fixed SIGSEGV when a simulator is added. Added socket SO_REUSEADDR again to the server socket.

#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