livoxProto1: Open pcloudDataSocket in UdpCmdDemux
The pcloudData socket is now opened by UdpCommandDemuxer, when libLivoxProto1 is initialized. We can now just pick up the socket and be certain it'll be there if the lib is being executed.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#include <stdexcept>
|
||||
#include <callback.h>
|
||||
#include <boost/asio/posix/stream_descriptor.hpp>
|
||||
#include "livoxProto1.h"
|
||||
#include "device.h"
|
||||
#include "core.h"
|
||||
#include "udpCommandDemuxer.h"
|
||||
|
||||
|
||||
extern "C" {
|
||||
@@ -104,4 +106,17 @@ void livoxProto1_device_getReturnModeReq(
|
||||
device->getReturnModeReq(callback);
|
||||
}
|
||||
|
||||
std::shared_ptr<boost::asio::posix::stream_descriptor>
|
||||
livoxProto1_getPcloudDataFdDesc(void)
|
||||
{
|
||||
auto& protoState = livoxProto1::getProtoState();
|
||||
if (!protoState.deviceManager)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": DeviceManager not initialized");
|
||||
}
|
||||
|
||||
return protoState.deviceManager->udpCommandDemuxer.pcloudDataSocketDesc;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user