#ifndef LINUX_DEVICES_SUSPOLLING_H_ #define LINUX_DEVICES_SUSPOLLING_H_ #include #include #include #include #include #include "devices/addresses.h" #include "mission/devices/devicedefinitions/acsPolling.h" class SusPolling : public SystemObject, public ExecutableObjectIF, public DeviceCommunicationIF { public: SusPolling(object_id_t objectId, SpiComIF& spiComIF, GpioIF& gpioIF); ReturnValue_t performOperation(uint8_t operationCode) override; ReturnValue_t initialize() override; private: enum class InternalState { IDLE, BUSY } state = InternalState::IDLE; struct SusDev { SpiCookie* cookie = nullptr; bool performStartup = false; acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF; ReturnValue_t replyResult = returnvalue::OK; acs::SusReply ownReply{}; acs::SusReply readerReply{}; }; MutexIF* ipcLock; SemaphoreIF* semaphore; uint8_t* rawReply = nullptr; size_t dummy = 0; SpiComIF& spiComIF; GpioIF& gpioIF; std::array susDevs; std::array cmdBuf; ReturnValue_t initializeInterface(CookieIF* cookie) override; ReturnValue_t sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) override; ReturnValue_t getSendSuccess(CookieIF* cookie) override; ReturnValue_t requestReceiveMessage(CookieIF* cookie, size_t requestLen) override; ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override; ReturnValue_t handleSusPolling(); static int addressToIndex(address_t addr); }; #endif /* LINUX_DEVICES_SUSPOLLING_H_ */