#ifndef TAHOMA_H #define TAHOMA_H #include #include #include #include #include #include // Include the ArduinoJson library for JSON parsing #define MAX_NUM_DEVICES 11 // Maximum number of devices to fetch class Tahoma { public: typedef union { uint16_t movement; struct { uint16_t position : 8; uint16_t rotation : 8; }; } rolloCommand_t; typedef struct { String name; // Device name uint16_t index; // Device URL bool selected; } device_t; // Constructor with hostname and token // Initializes the Tahoma object with the provided hostname and token Tahoma(void); // Destructor ~Tahoma(); uint8_t getMyDevices(bool _force_update=false); // Fetches the device name from the Tahoma system rolloCommand_t getPos(int8_t deviceIndex=-1); uint8_t sendMove(uint8_t deviceIndex, uint8_t position, uint8_t rotation); uint8_t sendfinalRot(uint8_t deviceIndex); void moveSelected(uint8_t position, uint8_t rotation); void selectDev(uint8_t i, bool _selected); bool isDeviceSelected(uint8_t deviceIndex); void loop(void); device_t devicelist[MAX_NUM_DEVICES]; uint8_t numDevs{0}; static rolloCommand_t movement[MAX_NUM_DEVICES]; private: bool checkMovement(uint8_t deviceIndex); static constexpr char serverURL[]{"http://nas.local/smart/ajax/tahoma.php"}; // Hostname of the Tahoma system Ticker movementCheckTicker; // Simulate fetching data from the Tahoma system }; #endif // TAHOMA_H