Resolve macOS warnings and standardize style
parent
b634e6a443
commit
2099ba9d1e
|
|
@ -7,7 +7,9 @@
|
||||||
#include "device/include/device.h"
|
#include "device/include/device.h"
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
|
||||||
};
|
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -13,7 +13,7 @@ int Communication::messageCallbackIDCounter = 1;
|
||||||
|
|
||||||
uint8_t Communication::ICSChecksum(const std::vector<uint8_t>& data) {
|
uint8_t Communication::ICSChecksum(const std::vector<uint8_t>& data) {
|
||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
for(auto i = 0; i < data.size(); i++)
|
for(size_t i = 0; i < data.size(); i++)
|
||||||
checksum += data[i];
|
checksum += data[i];
|
||||||
checksum = ~checksum;
|
checksum = ~checksum;
|
||||||
checksum++;
|
checksum++;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,6 @@ private:
|
||||||
void readTask();
|
void readTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -38,6 +38,6 @@ protected:
|
||||||
std::atomic<bool> closing{false};
|
std::atomic<bool> closing{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -41,6 +41,6 @@ public:
|
||||||
CANMessageCallback(CANMessageFilter f, fn_messageCallback cb) : MessageCallback(cb, std::make_shared<CANMessageFilter>(f)) {}
|
CANMessageCallback(CANMessageFilter f, fn_messageCallback cb) : MessageCallback(cb, std::make_shared<CANMessageFilter>(f)) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -67,6 +67,6 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -97,6 +97,6 @@ private:
|
||||||
void readTask();
|
void readTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -335,6 +335,6 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -10,6 +10,6 @@ public:
|
||||||
uint32_t arbid;
|
uint32_t arbid;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -14,6 +14,6 @@ public:
|
||||||
uint64_t timestamp;
|
uint64_t timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -33,8 +33,10 @@ typedef struct {
|
||||||
#include "communication/message/include/message.h"
|
#include "communication/message/include/message.h"
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
neomessage_t CreateNeoMessage(const Message& message);
|
|
||||||
};
|
neomessage_t CreateNeoMessage(const Message& message);
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -97,7 +97,7 @@ void MultiChannelCommunication::readTask() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto i = 0; i < currentReadIndex; i++)
|
for(size_t i = 0; i < currentReadIndex; i++)
|
||||||
usbReadFifo.pop_front();
|
usbReadFifo.pop_front();
|
||||||
|
|
||||||
payloadBytes.clear();
|
payloadBytes.clear();
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ bool Packetizer::input(const std::vector<uint8_t>& inputBytes) {
|
||||||
break;
|
break;
|
||||||
case ReadState::GetData:
|
case ReadState::GetData:
|
||||||
// We do not include the checksum in packetLength so it doesn't get copied into the payload buffer
|
// We do not include the checksum in packetLength so it doesn't get copied into the payload buffer
|
||||||
if(bytes.size() < packetLength + (checksum ? 1 : 0)) { // Read until we have the rest of the packet
|
if(bytes.size() < (size_t)(packetLength + (checksum ? 1 : 0))) { // Read until we have the rest of the packet
|
||||||
haveEnoughData = false;
|
haveEnoughData = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,6 @@ private:
|
||||||
void enforcePollingMessageLimit();
|
void enforcePollingMessageLimit();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -12,6 +12,6 @@ public:
|
||||||
static std::vector<std::shared_ptr<Device>> FindAll();
|
static std::vector<std::shared_ptr<Device>> FindAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
// A forward declaration is needed as there is a circular dependency
|
// A forward declaration is needed as there is a circular dependency
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
class Device;
|
|
||||||
};
|
class Device;
|
||||||
|
|
||||||
|
}
|
||||||
typedef icsneo::Device* devicehandle_t;
|
typedef icsneo::Device* devicehandle_t;
|
||||||
#else
|
#else
|
||||||
typedef void* devicehandle_t;
|
typedef void* devicehandle_t;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -27,6 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -50,6 +50,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -14,6 +14,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -24,6 +24,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -24,6 +24,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -25,6 +25,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -25,6 +25,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -14,6 +14,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -27,6 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -27,6 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -29,6 +29,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -26,6 +26,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -27,6 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -29,6 +29,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -46,6 +46,6 @@ private:
|
||||||
FTDIDevice ftdiDevice;
|
FTDIDevice ftdiDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -26,6 +26,6 @@ private:
|
||||||
void writeTask();
|
void writeTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -273,8 +273,8 @@ void STM32::writeTask() {
|
||||||
if(!writeQueue.wait_dequeue_timed(writeOp, std::chrono::milliseconds(100)))
|
if(!writeQueue.wait_dequeue_timed(writeOp, std::chrono::milliseconds(100)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto writeSize = writeOp.bytes.size();
|
const ssize_t writeSize = (ssize_t)writeOp.bytes.size();
|
||||||
int actualWritten = ::write(fd, writeOp.bytes.data(), writeSize);
|
ssize_t actualWritten = ::write(fd, writeOp.bytes.data(), writeSize);
|
||||||
if(actualWritten != writeSize)
|
if(actualWritten != writeSize)
|
||||||
std::cout << "Failure to write " << writeSize << " bytes, wrote " << actualWritten << std::endl;
|
std::cout << "Failure to write " << writeSize << " bytes, wrote " << actualWritten << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ public:
|
||||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"serenum"); }
|
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"serenum"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -65,6 +65,6 @@ private:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -28,6 +28,6 @@ private:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -11,6 +11,6 @@ public:
|
||||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"usbser"); }
|
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"usbser"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -43,6 +43,6 @@ private:
|
||||||
void writeTask();
|
void writeTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -48,6 +48,6 @@ private:
|
||||||
void closeDLL();
|
void closeDLL();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue