mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: Implement allowSleep for Wireless neoVI support
This commit is contained in:
@@ -23,6 +23,7 @@ enum class Command : uint8_t {
|
||||
ReadSettings = 0xC7, // Previously known as 3G_READ_SETTINGS_EX
|
||||
SetVBattMonitor = 0xDB, // Previously known as RED_CMD_CM_VBATT_MONITOR
|
||||
RequestBitSmash = 0xDC, // Previously known as RED_CMD_CM_BITSMASH
|
||||
WiVICommand = 0xDD, // Previously known as RED_CMD_WIVI_COMM
|
||||
GetVBattReq = 0xDF, // Previously known as RED_CMD_VBATT_REQUEST
|
||||
MiscControl = 0xE7,
|
||||
Extended = 0xF0,
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
EthernetPhyRegister = 0x8007,
|
||||
LogicalDiskInfo = 0x8008,
|
||||
ExtendedResponse = 0x8009,
|
||||
WiVICommandResponse = 0x800a,
|
||||
};
|
||||
|
||||
Message(Type t) : type(t) {}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef __WIVIRESPONSEMESSAGE_H_
|
||||
#define __WIVIRESPONSEMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include "icsneo/communication/command.h"
|
||||
#include "icsneo/platform/optional.h"
|
||||
#include "icsneo/communication/packet/wivicommandpacket.h"
|
||||
#include <string>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
namespace WiVI {
|
||||
|
||||
struct Info {
|
||||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
std::vector<CaptureInfo> captures;
|
||||
};
|
||||
|
||||
// The response for Command::WiVICommand
|
||||
class ResponseMessage : public Message {
|
||||
public:
|
||||
ResponseMessage() : Message(Message::Type::WiVICommandResponse) {}
|
||||
bool success = true;
|
||||
optional<Command> responseTo;
|
||||
optional<int32_t> value;
|
||||
optional<Info> info;
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -118,6 +118,7 @@ public:
|
||||
LIN6 = 98,
|
||||
LSFTCAN2 = 99,
|
||||
LogicalDiskInfo = 187,
|
||||
WiVICommand = 221,
|
||||
EthPHYControl = 239,
|
||||
ExtendedCommand = 240,
|
||||
FlexRayControl = 243,
|
||||
@@ -274,6 +275,7 @@ public:
|
||||
case NetID::Main51:
|
||||
case NetID::ReadSettings:
|
||||
case NetID::LogicalDiskInfo:
|
||||
case NetID::WiVICommand:
|
||||
case NetID::EthPHYControl:
|
||||
case NetID::ExtendedCommand:
|
||||
case NetID::NeoMemorySDRead:
|
||||
@@ -514,6 +516,8 @@ public:
|
||||
return "LSFTCAN 2";
|
||||
case NetID::LogicalDiskInfo:
|
||||
return "Logical Disk Information";
|
||||
case NetID::WiVICommand:
|
||||
return "WiVI Command";
|
||||
case NetID::EthPHYControl:
|
||||
return "Ethernet PHY Register Control";
|
||||
case NetID::ExtendedCommand:
|
||||
@@ -917,6 +921,7 @@ private:
|
||||
#define ICSNEO_NETID_LIN6 98
|
||||
#define ICSNEO_NETID_LSFTCAN2 99
|
||||
#define ICSNEO_NETID_LOGICAL_DISK_INFO 187
|
||||
#define ICSNEO_NETID_WIVI_COMMAND 221
|
||||
#define ICSNEO_NETID_ETH_PHY_CONTROL 239
|
||||
#define ICSNEO_NETID_EXTENDED_COMMAND 240
|
||||
#define ICSNEO_NETID_FLEXRAY_CONTROL 243
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
#ifndef __WIVICOMMANDPACKET_H_
|
||||
#define __WIVICOMMANDPACKET_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/packet.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#pragma pack(push,2)
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
union CoreMiniFixedPointValue {
|
||||
CoreMiniFixedPointValue() {}
|
||||
CoreMiniFixedPointValue(int32_t integralValue) { ValueInt32 = integralValue; }
|
||||
|
||||
struct {
|
||||
union {
|
||||
uint32_t ValueFractionPart;
|
||||
struct {
|
||||
int16_t ValueInt16FractionLSB;
|
||||
int16_t ValueInt16FractionMSB;
|
||||
};
|
||||
};
|
||||
union {
|
||||
int32_t ValueInt32;
|
||||
struct {
|
||||
int16_t ValueInt16;
|
||||
int16_t ValueInt16PartMSB;
|
||||
};
|
||||
struct{
|
||||
uint8_t ValueInt8;
|
||||
uint8_t ValueInt8PartMSB;
|
||||
int16_t ValueInt8Part16MSB;
|
||||
};
|
||||
};
|
||||
};
|
||||
int64_t ValueLarge;
|
||||
};
|
||||
|
||||
namespace WiVI {
|
||||
|
||||
class ResponseMessage; // Forward declaration to avoid cyclic includes
|
||||
|
||||
enum class Command : uint16_t {
|
||||
GetAll = 0x0010,
|
||||
ClearUploads = 0x0011,
|
||||
SetSignal = 0x0012,
|
||||
GetSignal = 0x0013,
|
||||
Result = 0x0014,
|
||||
GetPhysicalSignal = 0x0015,
|
||||
};
|
||||
|
||||
enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||
WokeUpOnSMS = 0x0067,
|
||||
AvailableDiskSpaceKB = 0x0069,
|
||||
ManualTrigger = 0x006c,
|
||||
SleepRequest = 0x006d,
|
||||
ConnectionTimeout = 0x006e,
|
||||
TimeSinceLastMessageMs = 0x006f,
|
||||
UploadsPending = 0x0077,
|
||||
};
|
||||
|
||||
struct Upload {
|
||||
uint32_t startSector;
|
||||
uint32_t endSector;
|
||||
struct {
|
||||
uint16_t pending : 1;
|
||||
uint16_t started : 1;
|
||||
uint16_t reserved : 14;
|
||||
} flags;
|
||||
};
|
||||
|
||||
struct CaptureInfo {
|
||||
uint16_t captureBlockIndex; // What capture block is this for
|
||||
struct {
|
||||
uint16_t isPrePost : 1;
|
||||
uint16_t isPreTime : 1; // Only valid if the capture block's bPrePostExtract is set
|
||||
uint16_t uploadOverCellular : 1;
|
||||
uint16_t uploadOverWiFi : 1;
|
||||
uint16_t uploadStackSize : 3; // 0 => size of 1
|
||||
uint16_t uploadOverflow : 1;
|
||||
uint16_t uploadPriority : 4;
|
||||
uint16_t reserved : 4;
|
||||
} flags;
|
||||
// Only valid if the capture block's bPrePostExtract is set
|
||||
uint32_t preTriggerSize;
|
||||
Upload uploadStage;
|
||||
Upload uploadStack[2];
|
||||
};
|
||||
|
||||
struct CommandPacket {
|
||||
static std::shared_ptr<WiVI::ResponseMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
|
||||
struct Header {
|
||||
WiVI::Command cmd;
|
||||
uint16_t length;
|
||||
};
|
||||
|
||||
struct Result {
|
||||
Header header;
|
||||
WiVI::Command responseTo;
|
||||
uint16_t result;
|
||||
};
|
||||
|
||||
struct GetSignal {
|
||||
static std::vector<uint8_t> Encode(WiVI::SignalType type);
|
||||
|
||||
Header header;
|
||||
WiVI::SignalType type;
|
||||
};
|
||||
|
||||
struct SetSignal {
|
||||
static std::vector<uint8_t> Encode(WiVI::SignalType type, CoreMiniFixedPointValue value);
|
||||
|
||||
Header header;
|
||||
WiVI::SignalType type;
|
||||
CoreMiniFixedPointValue value;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -289,6 +289,8 @@ public:
|
||||
*/
|
||||
optional<double> getAnalogIO(IO type, size_t number = 1);
|
||||
|
||||
bool allowSleep(bool remoteWakeup = false);
|
||||
|
||||
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||
|
||||
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
|
||||
|
||||
Reference in New Issue
Block a user