Overview
The PelcoDParser is a C++ library for encoding and decoding PelcoD responses and commands. The library includes basic methods for preparing commands (encoding) and interpreting the camera responses (decoding). It uses C++17 standard. The library provides simple interface and doesn’t have third party dependencies to be installed in OS. Also, the library provides test application to check communication with cameras via serial ports. Test application depends on SerialPort (provides methods to work with serial ports, source code included. Apache 2.0 license).
Documentation
Documentation: GO TO DOCUMENTATION
Simple interface
class PelcoDParser
{
public:
/// Get library version.
static std::string getVersion();
/// Encode standard command.
bool getStandardCommand(uint8_t *message, uint8_t addr,
bool sense, bool autoScan, bool cameraOn, bool irisOpen,
bool irisClose, bool focusNear, bool focusFar, bool zoomWide,
bool zoomTele, bool up, bool down, bool left, bool right,
uint8_t panSpeed = 0x00, uint8_t tiltSpeed = 0x00);
/// Encode extended command.
bool getExtendedCommand(uint8_t *message, uint8_t addr,
PelcoDCommand id, int data1, int data2);
/// Encode response.
bool getResponse(uint8_t *message, uint8_t addr,
PelcoDResponse id, uint8_t &responseSize, int data1, int data2);
/// Decode response.
PelcoDResponse decodeResponse(uint8_t byte, int &data1, int &data2);
/// Decode standard and extended command.
PelcoDCommand decodeCommand(uint8_t byte, int& address,
int& data1, int& data2, bool& sense, bool& autoScan,
bool& cameraOn, bool& irisOpen, bool& irisClose,
bool& focusNear, bool& focusFar, bool& zoomWide,
bool& zoomTele, bool& up, bool& down, bool& left,
bool& right, uint8_t& panSpeed, uint8_t& tiltSpeed);
};