Testing the encoder for sending more complex messages

This commit is contained in:
Paul Hollinsky
2018-10-03 14:33:30 -04:00
parent 590a99d995
commit dffae23e54
13 changed files with 78 additions and 37 deletions
+5 -1
View File
@@ -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;
+1
View File
@@ -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"
+2 -1
View File
@@ -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;
}
+2 -1
View File
@@ -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;
}