36 #ifndef _LibMultiSense_details_channel_hh 37 #define _LibMultiSense_details_channel_hh 54 #ifndef WIN32_LEAN_AND_MEAN 55 #define WIN32_LEAN_AND_MEAN 1 62 #include <netinet/ip.h> 65 #ifndef INVALID_SOCKET 66 #define INVALID_SOCKET (-1) 78 namespace multisense {
96 impl(
const std::string& address);
191 std::vector<imu::Info>& info);
193 std::vector<imu::Config>& c);
195 uint32_t samplesPerMessage,
196 const std::vector<imu::Config>& c);
199 uint32_t& bufferSize);
201 uint32_t bufferSize);
210 const uint8_t *dataP,
214 template <
typename T>
217 uint32_t µSeconds)
const 219 const T oneBillion =
static_cast<T
>(1e9);
221 seconds =
static_cast<uint32_t
>(nanoSeconds / oneBillion);
222 microSeconds =
static_cast<uint32_t
>((nanoSeconds % oneBillion) /
223 static_cast<T>(1000));
226 template <
class WireT>
229 uint32_t µSeconds)
234 toHeaderTime(wire->ptpNanoSeconds, seconds, microSeconds);
241 seconds = wire->timeSeconds;
242 microSeconds = wire->timeMicroSeconds;
248 1e-6 * static_cast<double>(wire->timeMicroSeconds),
249 seconds, microSeconds);
319 const uint8_t *dataP) {
381 typedef std::vector<utility::BufferStreamWriter*>
BufferPool;
472 int32_t attempts=DEFAULT_ACK_ATTEMPTS);
473 #if defined (_MSC_VER) 476 const double& timeout,
485 int32_t attempts=DEFAULT_ACK_ATTEMPTS);
488 template<
class T>
void publish (
const T& message);
516 uint32_t& microseconds);
532 static DWORD WINAPI
rxThread (
void *userDataP);
535 static void *
rxThread (
void *userDataP);
543 #endif // LibMultiSense_details_channel_hh
std::list< ImageListener * > m_imageListeners
static uint32_t imagerWireToApi(uint32_t h)
virtual Status setNetworkConfig(const system::NetworkConfig &c)
int64_t m_unWrappedRxSeqId
#define CRL_EXCEPTION(fmt,...)
static uint32_t hardwareWireToApi(uint32_t h)
virtual Status getPtpStatus(int64_t frameId, system::PtpStatus &ptpStatus)
BufferPool m_rxLargeBufferPool
virtual Status getMtu(int32_t &mtu)
virtual Status verifyBitstream(const std::string &file)
virtual Status getLocalUdpPort(uint16_t &port)
virtual Status setImuConfig(bool storeSettingsInFlash, uint32_t samplesPerMessage, const std::vector< imu::Config > &c)
double sensorToLocalTime(const double &sensorTime)
virtual Status verifyFirmware(const std::string &file)
virtual Status setTriggerSource(TriggerSource s)
virtual Status getMotorPos(int32_t &mtu)
virtual Status getExternalCalibration(system::ExternalCalibration &calibration)
bool assemble(uint32_t bytes, uint32_t offset, const uint8_t *dataP)
static CRL_CONSTEXPR uint32_t MAX_DIRECTED_STREAMS
virtual Status getLightingSensorStatus(lighting::SensorStatus &status)
struct sockaddr_in m_sensorAddress
virtual Status networkTimeSynchronization(bool enabled)
virtual Status removeIsolatedCallback(image::Callback callback)
UdpTracker(uint32_t t, UdpAssembler a, utility::BufferStreamWriter &s)
void(* Callback)(const Header &header, void *userDataP)
UdpAssemblerMap m_udpAssemblerMap
virtual Status ptpTimeSynchronization(bool enabled)
virtual Status setExternalCalibration(const system::ExternalCalibration &calibration)
virtual Status getLightingConfig(lighting::Config &c)
virtual Status getImageConfig(image::Config &c)
void applySensorTimeOffset(const double &offset)
wire::StatusResponse m_statusResponseMessage
virtual Status setLidarCalibration(const lidar::Calibration &c)
static wire::SourceType sourceApiToWire(DataSource mask)
std::list< PpsListener * > m_ppsListeners
virtual Status getLargeBufferDetails(uint32_t &bufferCount, uint32_t &bufferSize)
virtual Status startDirectedStream(const DirectedStream &stream)
virtual Status setMotorSpeed(float rpm)
DepthCache< int64_t, wire::ImageMeta > m_imageMetaCache
void dispatch(utility::BufferStreamWriter &buffer)
virtual Status setMtu(int32_t mtu)
DepthCache< int64_t, UdpTracker > m_udpTrackerCache
virtual Status getDeviceStatus(system::StatusMessage &status)
utility::Thread * m_rxThreadP
uint32_t m_bytesAssembled
UdpAssembler getUdpAssembler(const uint8_t *udpDatagramP, uint32_t length)
void(* Callback)(const Header &header, void *userDataP)
virtual Status stopStreams(DataSource mask)
virtual Status getNetworkConfig(system::NetworkConfig &c)
bool m_ptpTimeSyncEnabled
virtual Status getSensorCalibration(image::SensorCalibration &c)
void eraseFlashRegion(uint32_t region)
void getImageTime(const WireT *wire, uint32_t &seconds, uint32_t µSeconds)
virtual Status setSensorCalibration(const image::SensorCalibration &c)
std::vector< uint8_t > m_incomingBuffer
static CRL_CONSTEXPR uint32_t RX_POOL_SMALL_BUFFER_COUNT
virtual Status startDirectedStreams(const std::vector< DirectedStream > &streams)
static CRL_CONSTEXPR uint32_t RX_POOL_SMALL_BUFFER_SIZE
virtual Status addIsolatedCallback(image::Callback callback, DataSource imageSourceMask, void *userDataP)
void(* UdpAssembler)(utility::BufferStreamWriter &stream, const uint8_t *dataP, uint32_t offset, uint32_t length)
utility::Mutex m_dispatchLock
static CRL_CONSTEXPR uint32_t MAX_USER_PPS_QUEUE_SIZE
virtual Status getVersionInfo(system::VersionInfo &v)
static double DEFAULT_ACK_TIMEOUT()
static CRL_CONSTEXPR uint32_t IMAGE_META_CACHE_DEPTH
virtual Status getSensorVersion(VersionType &version)
static CRL_CONSTEXPR VersionType API_VERSION
static CRL_CONSTEXPR uint16_t DEFAULT_SENSOR_TX_PORT
virtual Status getImuConfig(uint32_t &samplesPerMessage, std::vector< imu::Config > &c)
uint16_t m_serverSocketPort
static CRL_CONSTEXPR uint32_t RX_POOL_LARGE_BUFFER_COUNT
virtual Status getEnabledStreams(DataSource &mask)
wire::VersionResponse m_sensorVersion
utility::BufferStreamWriter & stream()
static CRL_CONSTEXPR uint32_t MAX_USER_IMU_QUEUE_SIZE
const int64_t & unwrapSequenceId(uint16_t id)
utility::BufferStreamWriter & findFreeBuffer(uint32_t messageLength)
bool m_networkTimeSyncEnabled
static CRL_CONSTEXPR uint32_t DEFAULT_ACK_ATTEMPTS
virtual Status getImageHistogram(int64_t frameId, image::Histogram &histogram)
virtual Status setLargeBuffers(const std::vector< uint8_t * > &buffers, uint32_t bufferSize)
static uint32_t imagerApiToWire(uint32_t h)
utility::Mutex m_streamLock
static CRL_CONSTEXPR uint32_t MAX_MTU_SIZE
static CRL_CONSTEXPR uint32_t UDP_TRACKER_CACHE_DEPTH
virtual Status startStreams(DataSource mask)
virtual Status setDeviceInfo(const std::string &key, const system::DeviceInfo &i)
virtual void * reserveCallbackBuffer()
virtual Status getApiVersion(VersionType &version)
virtual Status setImageCalibration(const image::Calibration &c)
static CRL_CONSTEXPR uint32_t MAX_USER_LASER_QUEUE_SIZE
void dispatchImu(imu::Header &header)
Status waitAck(const T &msg, wire::IdType id=MSG_ID(T::ID), const double &timeout=DEFAULT_ACK_TIMEOUT(), int32_t attempts=DEFAULT_ACK_ATTEMPTS)
virtual Status stopDirectedStream(const DirectedStream &stream)
void dispatchPps(pps::Header &header)
utility::Mutex m_timeLock
virtual Status getImageCalibration(image::Calibration &c)
static CRL_CONSTEXPR uint32_t RX_POOL_LARGE_BUFFER_SIZE
uint32_t m_totalBytesInMessage
BufferPool m_rxSmallBufferPool
std::list< LidarListener * > m_lidarListeners
virtual Status getImuInfo(uint32_t &maxSamplesPerMessage, std::vector< imu::Info > &info)
virtual Status maxDirectedStreams(uint32_t &maximum)
virtual Status getDeviceModes(std::vector< system::DeviceMode > &modes)
static uint32_t hardwareApiToWire(uint32_t h)
impl(const std::string &address)
void toHeaderTime(T nanoSeconds, uint32_t &seconds, uint32_t µSeconds) const
virtual Status flashBitstream(const std::string &file)
void publish(const T &message)
void(* Callback)(const Header &header, void *userDataP)
static void * rxThread(void *userDataP)
virtual Status setTransmitDelay(const image::TransmitDelay &c)
void dispatchLidar(utility::BufferStream &buffer, lidar::Header &header)
std::list< ImuListener * > m_imuListeners
std::vector< utility::BufferStreamWriter * > BufferPool
static CRL_CONSTEXPR uint32_t TIME_SYNC_OFFSET_DECAY
virtual Status getLidarCalibration(lidar::Calibration &c)
virtual Status getTransmitDelay(image::TransmitDelay &c)
uint32_t m_packetsAssembled
utility::BufferStreamWriter m_stream
std::map< wire::IdType, UdpAssembler > UdpAssemblerMap
static CRL_CONSTEXPR uint32_t MAX_USER_IMAGE_QUEUE_SIZE
Status waitData(const T &command, U &data, const double &timeout=DEFAULT_ACK_TIMEOUT(), int32_t attempts=DEFAULT_ACK_ATTEMPTS)
static void * statusThread(void *userDataP)
virtual Status flashFirmware(const std::string &file)
DataSource m_streamsEnabled
virtual Status setLightingConfig(const lighting::Config &c)
void programOrVerifyFlashRegion(std::ifstream &file, uint32_t operation, uint32_t region)
virtual Status setImageConfig(const image::Config &c)
virtual Status getDirectedStreams(std::vector< DirectedStream > &streams)
utility::Thread * m_statusThreadP
static DataSource sourceWireToApi(wire::SourceType mask)
Status doFlashOp(const std::string &filename, uint32_t operation, uint32_t region)
virtual Status getDeviceInfo(system::DeviceInfo &info)
void(* Callback)(const Header &header, void *userDataP)
void dispatchImage(utility::BufferStream &buffer, image::Header &header)
virtual Status releaseCallbackBuffer(void *referenceP)