#ifndef _INTERFACES_H_ #define _INTERFACES_H_ #include "modelbahn.h" #include "server.h" #include "UDPTCPNetwork.h" #include "json.h" #include "interface.h" #include "interfaces.h" #define INTF_F_CONNECTED 0x0001 #define INTF_F_POWER 0x0002 #define INTF_F_STOP 0x0004 #define INTF_F_SHORT_CIRCUIT 0x0008 #define INTF_F_PROGRAMMING 0x0010 #define INTF_F_NEEDUPDATE 0x8000 // if something changes during the Loop enum { INTF_T_OFF_UNKNOWN = 0, INTF_T_Z21, INTF_T_MAX }; class Interfaces { private: Interface *interfaces[INTERFACES_MAX]; int max; int changed; pthread_mutex_t mtx; int LockThread(); int UnLockThread(); // not thread safe JSONParse _GetJSON(int idx); public: Interfaces(); ~Interfaces(); bool IsChanged() { return changed; } void ClearChanged() { changed = 0; }; int Change(Interface *iface); int Delete(string name); JSONParse GetJSON(string name); void GetJSONAll(JSONParse *json); Interface GetInterfaceFromJSON(JSONParse *j); // // void PowerOnOff(int onoff); void SetLocoSpeed(Locomotive *l, int speed); void SetLocoFunction(Locomotive *l, int func, int value); void SetTurnout(Turnout *t, int active, int outputactive); void Loop(); }; #endif