Device: Update the capture callback to include all of the wivi capture information
parent
dc1c4ede9d
commit
4229d8b66a
|
|
@ -926,9 +926,8 @@ void Device::wiviThreadBody() {
|
||||||
|
|
||||||
if(processCaptures) {
|
if(processCaptures) {
|
||||||
std::vector<uint8_t> clearMasks;
|
std::vector<uint8_t> clearMasks;
|
||||||
size_t i = 0;
|
for (size_t i = 0; i < resp->info->captures.size(); i++) {
|
||||||
for(const auto& capture : resp->info->captures) {
|
const auto capture = resp->info->captures.at(i);
|
||||||
i++;
|
|
||||||
|
|
||||||
if(capture.flags.uploadOverflow)
|
if(capture.flags.uploadOverflow)
|
||||||
report(APIEvent::Type::WiVIUploadStackOverflow, APIEvent::Severity::Error);
|
report(APIEvent::Type::WiVIUploadStackOverflow, APIEvent::Severity::Error);
|
||||||
|
|
@ -950,12 +949,24 @@ void Device::wiviThreadBody() {
|
||||||
clearMasks.resize(resp->info->captures.size());
|
clearMasks.resize(resp->info->captures.size());
|
||||||
clearMasks[i] |= (1 << j);
|
clearMasks[i] |= (1 << j);
|
||||||
|
|
||||||
|
WiVIUpload wiviUpload {};
|
||||||
|
wiviUpload.captureIndex = capture.captureBlockIndex;
|
||||||
|
wiviUpload.cellular = capture.flags.uploadOverCellular;
|
||||||
|
wiviUpload.wifi = capture.flags.uploadOverWiFi;
|
||||||
|
wiviUpload.isPrePost = capture.flags.isPrePost;
|
||||||
|
wiviUpload.isPreTime = capture.flags.isPreTime;
|
||||||
|
wiviUpload.preTriggerSize = capture.preTriggerSize;
|
||||||
|
wiviUpload.priority = capture.flags.uploadPriority;
|
||||||
|
wiviUpload.startSector = upload.startSector;
|
||||||
|
wiviUpload.endSector = upload.endSector;
|
||||||
|
|
||||||
// Notify the client
|
// Notify the client
|
||||||
for(const auto& cb : newCaptureCallbacks) {
|
for(const auto& cb : newCaptureCallbacks) {
|
||||||
if(cb) {
|
if(cb) {
|
||||||
|
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
try {
|
try {
|
||||||
cb(upload.startSector, upload.endSector);
|
cb(wiviUpload);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
||||||
}
|
}
|
||||||
|
|
@ -975,9 +986,11 @@ void Device::wiviThreadBody() {
|
||||||
if(!clearMasksGenericResp
|
if(!clearMasksGenericResp
|
||||||
|| clearMasksGenericResp->type != Message::Type::WiVICommandResponse
|
|| clearMasksGenericResp->type != Message::Type::WiVICommandResponse
|
||||||
|| !std::static_pointer_cast<WiVI::ResponseMessage>(clearMasksGenericResp)->success)
|
|| !std::static_pointer_cast<WiVI::ResponseMessage>(clearMasksGenericResp)->success)
|
||||||
|
{
|
||||||
report(APIEvent::Type::WiVIStackRefreshFailed, APIEvent::Severity::Error);
|
report(APIEvent::Type::WiVIStackRefreshFailed, APIEvent::Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Process sleep requests
|
// Process sleep requests
|
||||||
if(resp->info->sleepRequest & 1 /* sleep requested by VSSAL */) {
|
if(resp->info->sleepRequest & 1 /* sleep requested by VSSAL */) {
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,19 @@ public:
|
||||||
*/
|
*/
|
||||||
std::optional<double> getAnalogIO(IO type, size_t number = 1);
|
std::optional<double> getAnalogIO(IO type, size_t number = 1);
|
||||||
|
|
||||||
typedef std::function< void(uint32_t startSector, uint32_t endSector) > NewCaptureCallback;
|
struct WiVIUpload
|
||||||
|
{
|
||||||
|
bool cellular;
|
||||||
|
bool wifi;
|
||||||
|
bool isPrePost;
|
||||||
|
bool isPreTime;
|
||||||
|
uint32_t preTriggerSize;
|
||||||
|
uint16_t priority;
|
||||||
|
uint16_t captureIndex;
|
||||||
|
uint32_t startSector;
|
||||||
|
uint32_t endSector;
|
||||||
|
};
|
||||||
|
typedef std::function< void(WiVIUpload upload) > NewCaptureCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a callback which will be called for all new captures.
|
* Add a callback which will be called for all new captures.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue