mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Testing the encoder for sending more complex messages
This commit is contained in:
@@ -95,7 +95,11 @@ bool IDeviceSettings::send() {
|
||||
bytestream[5] = gs_checksum >> 8;
|
||||
memcpy(bytestream.data() + 6, getRawStructurePointer(), structSize);
|
||||
com->sendCommand(Command::SetSettings, bytestream);
|
||||
std::shared_ptr<Message> msg = com->waitForMessageSync(Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(500));
|
||||
std::shared_ptr<Message> msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(), std::chrono::milliseconds(3000));
|
||||
if(!msg)
|
||||
std::cout << "No response from device for set settings" << std::endl;
|
||||
if(msg && msg->data[1] != 1)
|
||||
std::cout << "Response was incorrect for set settings: " << (int)msg->data[1] << std::endl;
|
||||
if(!msg || msg->data[1] != 1) { // The second byte of the response carries the result, 1 being success
|
||||
refresh(); // Refresh our buffer with what the device has
|
||||
return false;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "device/include/devicetype.h"
|
||||
#include "communication/include/communication.h"
|
||||
#include "communication/include/packetizer.h"
|
||||
#include "communication/include/encoder.h"
|
||||
#include "communication/include/decoder.h"
|
||||
#include "third-party/concurrentqueue/concurrentqueue.h"
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ public:
|
||||
NeoVIFIRE2ETH(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
||||
auto transport = std::make_shared<PCAP>(getWritableNeoDevice());
|
||||
auto packetizer = std::make_shared<Packetizer>();
|
||||
auto encoder = std::make_shared<Encoder>(packetizer);
|
||||
auto decoder = std::make_shared<Decoder>();
|
||||
com = std::make_shared<Communication>(transport, packetizer, decoder);
|
||||
com = std::make_shared<Communication>(transport, packetizer, encoder, decoder);
|
||||
settings = std::make_shared<NeoVIFIRE2Settings>(com);
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ public:
|
||||
NeoVIFIRE2USB(neodevice_t neodevice) : NeoVIFIRE2(neodevice) {
|
||||
auto transport = std::make_shared<FTDI>(getWritableNeoDevice());
|
||||
auto packetizer = std::make_shared<Packetizer>();
|
||||
auto encoder = std::make_shared<Encoder>(packetizer);
|
||||
auto decoder = std::make_shared<Decoder>();
|
||||
com = std::make_shared<Communication>(transport, packetizer, decoder);
|
||||
com = std::make_shared<Communication>(transport, packetizer, encoder, decoder);
|
||||
settings = std::make_shared<NeoVIFIRE2Settings>(com);
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user