mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
@@ -48,7 +48,8 @@ public:
|
||||
MessageMaxLengthExceeded = 0x1012,
|
||||
ValueNotYetPresent = 0x1013,
|
||||
Timeout = 0x1014,
|
||||
|
||||
WiVINotSupported = 0x1015,
|
||||
|
||||
// Device Events
|
||||
PollingMessageOverflow = 0x2000,
|
||||
NoSerialNumber = 0x2001, // api
|
||||
@@ -86,6 +87,8 @@ public:
|
||||
SettingsDefaultsUsed = 0x2033,
|
||||
AtomicOperationRetried = 0x2034,
|
||||
AtomicOperationCompletedNonatomically = 0x2035,
|
||||
WiVIStackRefreshFailed = 0x2036,
|
||||
WiVIUploadStackOverflow = 0x2037,
|
||||
|
||||
// Transport Events
|
||||
FailedToRead = 0x3000,
|
||||
|
||||
@@ -122,6 +122,24 @@ struct CommandPacket {
|
||||
WiVI::SignalType type;
|
||||
CoreMiniFixedPointValue value;
|
||||
};
|
||||
|
||||
struct GetAll {
|
||||
static std::vector<uint8_t> Encode();
|
||||
|
||||
Header header;
|
||||
uint8_t version;
|
||||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
uint16_t numCaptureInfos;
|
||||
CaptureInfo captureInfos[0];
|
||||
};
|
||||
|
||||
struct ClearUploads {
|
||||
static std::vector<uint8_t> Encode(const std::vector<uint8_t>& bitmask);
|
||||
|
||||
Header header;
|
||||
uint8_t bitmask[0];
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "icsneo/communication/decoder.h"
|
||||
#include "icsneo/communication/io.h"
|
||||
#include "icsneo/communication/message/resetstatusmessage.h"
|
||||
#include "icsneo/communication/message/wiviresponsemessage.h"
|
||||
#include "icsneo/device/extensions/flexray/controller.h"
|
||||
#include "icsneo/communication/message/flexray/control/flexraycontrolmessage.h"
|
||||
#include "icsneo/communication/message/ethphymessage.h"
|
||||
@@ -289,6 +290,46 @@ public:
|
||||
*/
|
||||
optional<double> getAnalogIO(IO type, size_t number = 1);
|
||||
|
||||
typedef std::function< void(uint32_t startSector, uint32_t endSector) > NewCaptureCallback;
|
||||
|
||||
/**
|
||||
* Add a callback which will be called for all new captures.
|
||||
*
|
||||
* This is invalid for devices which are not running the Wireless neoVI stack.
|
||||
*/
|
||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addNewCaptureCallback(NewCaptureCallback cb);
|
||||
|
||||
typedef std::function< void(uint16_t connectionTimeoutMinutes) > SleepRequestedCallback;
|
||||
|
||||
/**
|
||||
* Add a callback which will be called when a Wireless neoVI device is
|
||||
* ready for sleep, pending any uploads we might want to complete first.
|
||||
*
|
||||
* Call Device::allowSleep() once ready to signal that status to the device.
|
||||
*
|
||||
* Check Device::isSleepRequested() to check if the sleep request was interrupted.
|
||||
* In that case, the sleep requested callbacks will be called again.
|
||||
*
|
||||
* This is invalid for devices which are not running the Wireless neoVI stack.
|
||||
*/
|
||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addSleepRequestedCallback(SleepRequestedCallback cb);
|
||||
|
||||
/**
|
||||
* Check whether sleep has been requested by a VSSAL Wireless neoVI script.
|
||||
*/
|
||||
optional<bool> isSleepRequested() const;
|
||||
|
||||
/**
|
||||
* Signal to a running VSSAL Wireless neoVI script that we are ready for
|
||||
* sleep.
|
||||
*
|
||||
* If @param remoteWakeup is specified, the modem will be kept running in sleep
|
||||
* mode, where supported.
|
||||
*
|
||||
* This is invalid for devices which are not running the Wireless neoVI stack.
|
||||
*/
|
||||
bool allowSleep(bool remoteWakeup = false);
|
||||
|
||||
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||
@@ -319,6 +360,11 @@ public:
|
||||
*/
|
||||
virtual bool getEthPhyRegControlSupported() const { return false; }
|
||||
|
||||
/**
|
||||
* Returns true if this device supports the Wireless neoVI featureset
|
||||
*/
|
||||
virtual bool supportsWiVI() const { return false; }
|
||||
|
||||
optional<EthPhyMessage> sendEthPhyMsg(const EthPhyMessage& message, std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
|
||||
|
||||
std::shared_ptr<Communication> com;
|
||||
@@ -411,7 +457,7 @@ protected:
|
||||
virtual bool afterCommunicationOpen() { return true; }
|
||||
|
||||
virtual bool requiresVehiclePower() const { return true; }
|
||||
|
||||
|
||||
template<typename Extension>
|
||||
std::shared_ptr<Extension> getExtension() const {
|
||||
std::shared_ptr<Extension> ret;
|
||||
@@ -473,6 +519,17 @@ private:
|
||||
std::atomic<bool> stopHeartbeatThread{false};
|
||||
std::mutex heartbeatMutex;
|
||||
std::thread heartbeatThread;
|
||||
|
||||
// Wireless neoVI Stack
|
||||
std::atomic<bool> stopWiVIThread{false};
|
||||
std::condition_variable stopWiVIcv;
|
||||
mutable std::mutex wiviMutex;
|
||||
std::thread wiviThread;
|
||||
std::atomic<bool> wiviSleepRequested{false};
|
||||
std::vector<NewCaptureCallback> newCaptureCallbacks;
|
||||
std::vector< std::pair<SleepRequestedCallback, bool /* notified */> > sleepRequestedCallbacks;
|
||||
void wiviThreadBody();
|
||||
void stopWiVIThreadIfNecessary(std::unique_lock<std::mutex> lk);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ protected:
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool supportsWiVI() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ protected:
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool supportsWiVI() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +88,8 @@ protected:
|
||||
const fire2vnet_status_t* status = reinterpret_cast<const fire2vnet_status_t*>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
bool supportsWiVI() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user