diff --git a/src/device.h b/src/device.h index 8467648..ec96b7b 100644 --- a/src/device.h +++ b/src/device.h @@ -24,9 +24,10 @@ // │ │ // └────────┘ +// forward decl typedef struct Device_s Device_t; - +// the interface that you would use to interface with the state typedef struct DeviceInterface_s{ // all the actions that change the state // normally there wouldnt be any args @@ -38,12 +39,14 @@ typedef struct DeviceInterface_s{ void (*pressLock)(Device_t*); }DeviceInterface_t; +// the states themselves typedef struct DeviceState_s{ const char* state_name; Device_t* device; DeviceInterface_t methods; }DeviceState_t; +// the device struct Device_s{ // in theroy this is also the flyweight pattern DeviceState_t state; @@ -53,5 +56,5 @@ struct Device_s{ DeviceInterface_t methods; }; - +// creates the device void initDevice(Device_t* device);