Added functionality to set blocking behavior of write
parent
69b7e5b45a
commit
8c186f00cd
|
|
@ -437,6 +437,13 @@ bool icsneo_transmitMessages(const neodevice_t* device, const neomessage_t* mess
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void icsneo_setWriteBlocks(const neodevice_t* device, bool blocks) {
|
||||||
|
if(!icsneo_isValidNeoDevice(device))
|
||||||
|
return;
|
||||||
|
|
||||||
|
device->device->com->setWriteBlocks(blocks);
|
||||||
|
}
|
||||||
|
|
||||||
bool icsneo_describeDevice(const neodevice_t* device, char* str, size_t* maxLength) {
|
bool icsneo_describeDevice(const neodevice_t* device, char* str, size_t* maxLength) {
|
||||||
// TAG String copy function
|
// TAG String copy function
|
||||||
if(maxLength == nullptr) {
|
if(maxLength == nullptr) {
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,10 @@ bool Device::transmit(std::vector<std::shared_ptr<Message>> messages) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Device::setWriteBlocks(bool blocks) {
|
||||||
|
com->setWriteBlocks(blocks);
|
||||||
|
}
|
||||||
|
|
||||||
size_t Device::getNetworkCountByType(Network::Type type) const {
|
size_t Device::getNetworkCountByType(Network::Type type) const {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
for(const auto& net : getSupportedRXNetworks())
|
for(const auto& net : getSupportedRXNetworks())
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ public:
|
||||||
bool rawWrite(const std::vector<uint8_t>& bytes) { return impl->write(bytes); }
|
bool rawWrite(const std::vector<uint8_t>& bytes) { return impl->write(bytes); }
|
||||||
virtual bool sendPacket(std::vector<uint8_t>& bytes);
|
virtual bool sendPacket(std::vector<uint8_t>& bytes);
|
||||||
|
|
||||||
|
void setWriteBlocks(bool blocks) { impl->writeBlocks = blocks; }
|
||||||
|
|
||||||
virtual bool sendCommand(Command cmd, bool boolean) { return sendCommand(cmd, std::vector<uint8_t>({ (uint8_t)boolean })); }
|
virtual bool sendCommand(Command cmd, bool boolean) { return sendCommand(cmd, std::vector<uint8_t>({ (uint8_t)boolean })); }
|
||||||
virtual bool sendCommand(Command cmd, std::vector<uint8_t> arguments = {});
|
virtual bool sendCommand(Command cmd, std::vector<uint8_t> arguments = {});
|
||||||
bool getSettingsSync(std::vector<uint8_t>& data, std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
|
bool getSettingsSync(std::vector<uint8_t>& data, std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ public:
|
||||||
bool transmit(std::shared_ptr<Message> message);
|
bool transmit(std::shared_ptr<Message> message);
|
||||||
bool transmit(std::vector<std::shared_ptr<Message>> messages);
|
bool transmit(std::vector<std::shared_ptr<Message>> messages);
|
||||||
|
|
||||||
|
void setWriteBlocks(bool blocks);
|
||||||
|
|
||||||
const std::vector<Network>& getSupportedRXNetworks() const { return supportedRXNetworks; }
|
const std::vector<Network>& getSupportedRXNetworks() const { return supportedRXNetworks; }
|
||||||
const std::vector<Network>& getSupportedTXNetworks() const { return supportedTXNetworks; }
|
const std::vector<Network>& getSupportedTXNetworks() const { return supportedTXNetworks; }
|
||||||
virtual bool isSupportedRXNetwork(const Network& net) const {
|
virtual bool isSupportedRXNetwork(const Network& net) const {
|
||||||
|
|
|
||||||
|
|
@ -532,6 +532,15 @@ extern bool DLLExport icsneo_transmit(const neodevice_t* device, const neomessag
|
||||||
*/
|
*/
|
||||||
extern bool DLLExport icsneo_transmitMessages(const neodevice_t* device, const neomessage_t* messages, size_t count);
|
extern bool DLLExport icsneo_transmitMessages(const neodevice_t* device, const neomessage_t* messages, size_t count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the behavior of whether writing is a blocking action or not.
|
||||||
|
* \param[in] device A pointer to the neodevice_t structure specifying the device to transmit on.
|
||||||
|
* \param[in] blocks Whether or not writing is a blocking action.
|
||||||
|
*
|
||||||
|
* By default, writing is a blocking action.
|
||||||
|
*/
|
||||||
|
extern void DLLExport icsneo_setWriteBlocks(const neodevice_t* device, bool blocks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the friendly description for a specified device.
|
* \brief Get the friendly description for a specified device.
|
||||||
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
||||||
|
|
@ -775,6 +784,9 @@ fn_icsneo_transmit icsneo_transmit;
|
||||||
typedef bool(*fn_icsneo_transmitMessages)(const neodevice_t* device, const neomessage_t* messages, size_t count);
|
typedef bool(*fn_icsneo_transmitMessages)(const neodevice_t* device, const neomessage_t* messages, size_t count);
|
||||||
fn_icsneo_transmitMessages icsneo_transmitMessages;
|
fn_icsneo_transmitMessages icsneo_transmitMessages;
|
||||||
|
|
||||||
|
typedef bool(*fn_icsneo_setWriteBlocks)(const neodevice_t* device, bool blocks);
|
||||||
|
fn_icsneo_setWriteBlocks icsneo_setWriteBlocks;
|
||||||
|
|
||||||
typedef bool(*fn_icsneo_describeDevice)(const neodevice_t* device, char* str, size_t* maxLength);
|
typedef bool(*fn_icsneo_describeDevice)(const neodevice_t* device, char* str, size_t* maxLength);
|
||||||
fn_icsneo_describeDevice icsneo_describeDevice;
|
fn_icsneo_describeDevice icsneo_describeDevice;
|
||||||
|
|
||||||
|
|
@ -848,6 +860,7 @@ int icsneo_init() {
|
||||||
ICSNEO_IMPORTASSERT(icsneo_setFDBaudrate);
|
ICSNEO_IMPORTASSERT(icsneo_setFDBaudrate);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_transmit);
|
ICSNEO_IMPORTASSERT(icsneo_transmit);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_transmitMessages);
|
ICSNEO_IMPORTASSERT(icsneo_transmitMessages);
|
||||||
|
ICSNEO_IMPORTASSERT(icsneo_setWriteBlocks);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_describeDevice);
|
ICSNEO_IMPORTASSERT(icsneo_describeDevice);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_getVersion);
|
ICSNEO_IMPORTASSERT(icsneo_getVersion);
|
||||||
ICSNEO_IMPORTASSERT(icsneo_getEvents);
|
ICSNEO_IMPORTASSERT(icsneo_getEvents);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue