IDTech Windows SDK Guide  1.2.177.4
API reference for NEO2
Connecting to NEO2

Most NEO2 devices connects through USB, Serial Interface (COM), or IP depending on hardware capabnilities.

Connect with USB:

All NEO2 devices use USB-HID (Human Interface Device) and does not need any vendor-specific drivers. Simply by plugging into an available USB port makes it available for SDK connectivity. To inform the SDK you are using the USB interface of the SpectrumPro, you would execute the following command during program initialization to establish a connection:

IDT_NEO2.useUSB();

Connect with Serial Interface (COM)

Most NEO2 devices can connect via Serial Interface. The default serial port settings are as follows:

  • Speed: 115,200
  • Bits: 8
  • Stop Bit: 1
  • Parity: None

To inform the SDK you are using the Serial Interface of a NEO2 device, you would execute the following command during program initialization to establish a connection by passing the correct COM port number. In the following example, we are connecting to COM1 non-SRED device:

IDT_NEO2.useSerialPort(1, false);

If you change the default baud rate, then there is an overloaded method to also include the baud rate:

IDT_NEO2.useSerialPort(1, 115200, false);

Connect with TCP/IP

Some NEO2 devices can connect via a network connection. The default port is is 1025.

To inform the SDK you are using the IP interface of a NEO2 device, you would execute the following command during program initialization to establish a connection by passing the correct address. In the following example, we are connecting to a device as IP address 10.0.1.1:

IDT_NEO2.ip_connectToSocket("10.0.1.1")

The IP address can optionally contain a port, separated by a colon:

IDT_NEO2.ip_connectToSocket("10.0.1.1:1025")

The IP address can optionally contain a description, separated by hash tag:

IDT_NEO2.ip_connectToSocket("10.0.1.1#Description")

The IP address can optionally contain both a port and a description:

IDT_NEO2.ip_connectToSocket("10.0.1.1:1025#Description")

There can be multiple IP connected devices to a single SDK instance. Each one is initially connected and registered with ip_connectToSocket.

To get a listing of all registered devices the SDK has access to, a listing of all the strings passed to ip_connectToSocket can be retrieved by the following

List<string> devices = IDT_NEO2.ip_getSocketList();

To switch between devices listed in ip_getSocketList():

IDT_NEO2.ip_switchToSocket("10.0.1.1");

NOTE: the string passed to ip_switchToSocket must match the complete gateway string as originally defined, and reported by ip_getSocketList.'

Auto-connect with TCP/IP

The IDTechSDK.dll framework uses a data file called NEO2_Devices.xml that resides in the same location. This file provides information for automatically connecting to NEO2 devices via USB or TCP/IP. The file is comprised of Device entries as follows:

<Device>
<Product>VP6800</Product>
<Name>VP6800</Name>
<VID>0x0acd</VID>
<PID>0x4460</PID>
<UsageID>0x0001</UsageID>
<UsagePage>0xFF00</UsagePage>
<BaseIP>10.12.34.98</BaseIP>
<IP_Count>2</IP_Count>
<IP_Port></IP_Port>
</Device>
  • BaseIP = IP address of first device to look for
  • IP_Count - # of consecutive IP address to search, up to an IP address of xx.xx.xx.255
  • IP_Port - Optional. Defaults to port 1025

Multiple device connections can be defined by a single Device entry, if those devices will use consecutive IP addresses, or multiple device connections can be defined by multiple Device entries, each with unique IP.

Every IP connection attempt is reported to a callback as connection successful, or connection could not be established

To activate autoConnect when NEO2_Devices.xml is properly configured:

IDT_NEO2.ip_autoConnectToSocket();

Monitor Disconnect and Connect over TCP/IP

The SDK has a method that can ping any of it's known connected devices on a regular interval, and report when it is not longer reachable via a callback. It can also be configured to execute ip_autoConnectToSocket() on a regular interval to detect devices connected on a regular interval:

public static bool ip_monitorSocketConnectionStatus(bool enable, bool monitorConnect, int interval, int retryCount)
  • enable TRUE = enable polling for device disconnect and optional connect, at specified interval and retryCount
  • monitorConnect If TRUE, and auto-connect attempt will be made at the specified interval
  • interval Interval, in seconds, to monitor IP. Minimum value 5 seconds
  • retryCount Number of retries trying to communicate before determining device not available and issue disconnect notification.