Beispiel #1
0
        public static int CreateDevice(int index)
        {
            int serial;
            uint deviceId = 0;
            var ports = new TssComPort[20];
            tss_getComPorts(ports, 20, 0, TssFind.TSS_FIND_ALL_KNOWN);

            //I am assuming that sensor type 4 is a dongle. Someone will have to test this who have the wireless version
            if (ports[index].sensor_type == 4)
            {
                uint dongle_id = tss_createTSDeviceStr(ports[index].com_port, TssTimestampMode.TSS_TIMESTAMP_NONE);
                for (int i = 0; i < 15; i++)
                {
                    tss_getSensorFromDongle((int)dongle_id, i, out deviceId);
                    if ((TssDeviceIdMask)deviceId != TssDeviceIdMask.TSS_NO_DEVICE_ID)
                    {
                        tss_getSerialNumber((int)deviceId, out serial);
                        StartStreamingU((int)deviceId);
                        break;
                    }
                }
            }
            else
            {
                deviceId = tss_createTSDeviceStr(ports[index].com_port, TssTimestampMode.TSS_TIMESTAMP_NONE);
                if ((TssDeviceIdMask)deviceId != TssDeviceIdMask.TSS_NO_DEVICE_ID)
                {
                    tss_getSerialNumber((int)deviceId, out serial);
                    StartStreamingU((int)deviceId);
                }
            }

            return (int)deviceId;
        }
Beispiel #2
0
        public static int GetComPorts()
        {
            serial_info.Clear();
            var     ports = new TssComPort[20];
            TssFind search;

            if (poll_unknown_devices)
            {
                search = TssFind.TSS_FIND_ALL;
            }
            else
            {
                search = TssFind.TSS_FIND_ALL_KNOWN;
            }
            var        count    = tss_getComPorts(ports, 20, 0, search);
            TssComInfo com_info = new TssComInfo();

            for (int i = 0; i < count; i++)
            {
                if (tss_getTSDeviceInfoFromComPort(ports[i].com_port, out com_info) == TssError.TSS_NO_ERROR)
                {
                    if (com_info.device_type == TssType.TSS_DNG)
                    {
                        count--; //dongle itself is not a device that can stream
                        uint dongle_id = (uint)TssDeviceIdMask.TSS_NO_DEVICE_ID;
                        dongle_id = tss_createTSDeviceStr(ports[i].com_port, TssTimestampMode.TSS_TIMESTAMP_NONE);
                        active_dongles.Add(dongle_id);
                        for (byte j = 0; j < 15; j++)
                        {
                            uint serial_number, timestamp;
                            tss_getSerialNumberAtLogicalID(dongle_id, j, out serial_number, out timestamp);
                            if (serial_number != 0)
                            {
                                SerialInfo info = new SerialInfo();
                                info.com_port              = ports[i].com_port;
                                info.logical_id            = j;
                                serial_info[serial_number] = info;
                                count++;
                            }
                        }
                    }
                    else
                    {
                        SerialInfo info = new SerialInfo();
                        info.com_port   = ports[i].com_port;
                        info.logical_id = 0xff;
                        serial_info[com_info.serial_number] = info;
                    }
                }
            }
            found_serials = new List <uint>(serial_info.Keys);
            return(count);
        }
Beispiel #3
0
 public static int GetComPorts()
 {
     serial_info.Clear();
     var ports = new TssComPort[20];
     TssFind search;
     if (poll_unknown_devices)
     {
         search = TssFind.TSS_FIND_ALL;
     }
     else
     {
         search = TssFind.TSS_FIND_ALL_KNOWN;
     }
     var count = tss_getComPorts(ports, 20, 0, search);
     TssComInfo com_info = new TssComInfo();
     for (int i = 0; i < count; i++)
     {
         if( tss_getTSDeviceInfoFromComPort(ports[i].com_port, out com_info) == TssError.TSS_NO_ERROR)
         {
             if (com_info.device_type == TssType.TSS_DNG)
             {
                 count--; //dongle itself is not a device that can stream
                 uint dongle_id = (uint)TssDeviceIdMask.TSS_NO_DEVICE_ID;
                 dongle_id = tss_createTSDeviceStr(ports[i].com_port, TssTimestampMode.TSS_TIMESTAMP_NONE);
                 active_dongles.Add(dongle_id);
                 for (byte j = 0; j < 15; j++)
                 {
                     uint serial_number, timestamp;
                     tss_getSerialNumberAtLogicalID(dongle_id, j, out serial_number, out timestamp);
                     if (serial_number != 0)
                     {
                         SerialInfo info = new SerialInfo();
                         info.com_port = ports[i].com_port;
                         info.logical_id = j;
                         serial_info[serial_number] = info;
                         count++;
                     }
                 }
             }
             else
             {
                 SerialInfo info = new SerialInfo();
                 info.com_port = ports[i].com_port;
                 info.logical_id = 0xff;
                 serial_info[com_info.serial_number] = info;
             }
         }
     }
     found_serials = new List<uint>(serial_info.Keys);
     return count;
 }
Beispiel #4
0
 private static extern int tss_getComPorts(out TssComPort port, uint size, int offset, TssFind filter);
Beispiel #5
0
 public static int GetComPorts()
 {
     var port = new TssComPort();
     var count = tss_getComPorts(out port, 1, 0, TssFind.TSS_FIND_ALL_KNOWN);
     return count;
 }
Beispiel #6
0
 private static extern int tss_getComPorts(out TssComPort port, uint size, int offset, TssFind filter);