Skip to main content
Version: latest

SerialDeviceProvider

Haply::HardwareAPI::Devices::SerialDeviceProvider

Index

Methods

NameTypeDescription
ListSerialDevicesstatic std::vector< std::pair< std::string, ...)Lists all the serial ports currently available categorized ...
ListSerialDevicesstatic int(std::string, const wchar_t *)Lists all the serial ports currently available.
SelectComPortstatic int(std::string)It lists all the available serial ports on the system, and ...

Methods

ListSerialDevices

static std::vector< std::pair< std::string, Type > > ListSerialDevices()

Lists all the serial ports currently available categorized by the type of devices that could be detected on it.

Note that not all ports returned is guranteed to contain a Haply device. Use the DeviceDetection class to get a list of available and usable serial ports.

Returns

Returns a vector of pairs containing the serial port (e.g. COM7) and the type of device that could be discovered on it.

ListSerialDevices

static int ListSerialDevices(         std::string portNames,         const wchar_t * portType)

Lists all the serial ports currently available.

Parameters

  • portNames an array of strings that will be populated with the names of the ports found.

  • portType This is the type of port you're looking for. For example, if you're looking for a serial port, you would pass in "USBSER"

Returns

the number of ports found.

SelectComPort

static int SelectComPort(std::string portNames)

It lists all the available serial ports on the system, and then prompts the user to select one.

Parameters

  • portNames An array of strings that will be populated with the names of the available ports.

Returns

The index of the port name in the array.