Esempio n. 1
0
        static void Main(string[] args)
        {
            IntPtr           handle      = new IntPtr(0);
            SenselFrame      frame       = new SenselFrame();
            SenselDeviceList list        = new SenselDeviceList();
            SenselSensorInfo sensor_info = new SenselSensorInfo();

            list.num_devices = 0;
            Sensel.senselGetDeviceList(ref list);
            Console.WriteLine("Num Devices: " + list.num_devices);
            if (list.num_devices != 0)
            {
                Sensel.senselOpenDeviceByID(ref handle, list.devices[0].idx);
            }
            if (handle.ToInt64() != 0)
            {
                Sensel.senselGetSensorInfo(handle, ref sensor_info);
                Console.WriteLine("Sensel Device: " + System.Text.Encoding.Default.GetString(list.devices[0].serial_num));
                Console.WriteLine("Width: " + sensor_info.width + "mm");
                Console.WriteLine("Height: " + sensor_info.height + "mm");
                Console.WriteLine("Cols: " + sensor_info.num_cols);
                Console.WriteLine("Rows: " + sensor_info.num_rows);
            }
            Thread.Sleep(4000);
        }
Esempio n. 2
0
        public static SenselDeviceList GetDeviceList()
        {
            SenselDeviceList list = new SenselDeviceList();

            list.num_devices = 0;
            SenselLib.senselGetDeviceList(ref list);
            return(list);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            IntPtr           handle      = new IntPtr(0);
            SenselFrame      frame       = new SenselFrame();
            SenselDeviceList list        = new SenselDeviceList();
            SenselSensorInfo sensor_info = new SenselSensorInfo();
            float            total_force = 0;

            list.num_devices = 0;
            Sensel.senselGetDeviceList(ref list);
            Console.WriteLine("Num Devices: " + list.num_devices);
            if (list.num_devices != 0)
            {
                Sensel.senselOpenDeviceByID(ref handle, list.devices[0].idx);
                Sensel.senselSetFrameContent(handle, 1);
                Sensel.senselAllocateFrameData(handle, frame);
                Sensel.senselStartScanning(handle);
            }
            if (handle.ToInt64() != 0)
            {
                Sensel.senselGetSensorInfo(handle, ref sensor_info);
                for (int c = 0; c < 500; c++)
                {
                    Int32 num_frames = 0;
                    Sensel.senselReadSensor(handle);
                    Sensel.senselGetNumAvailableFrames(handle, ref num_frames);
                    for (int f = 0; f < num_frames; f++)
                    {
                        Sensel.senselGetFrame(handle, frame);
                        total_force = 0;
                        for (int i = 0; i < sensor_info.num_cols * sensor_info.num_rows; i++)
                        {
                            total_force = total_force + frame.force_array[i];
                        }
                        Console.WriteLine("Total Force: " + total_force);
                    }
                }

                Sensel.senselStopScanning(handle);
                Sensel.senselClose(handle);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            IntPtr           handle = new IntPtr(0);
            SenselFrame      frame  = new SenselFrame();
            SenselDeviceList list   = new SenselDeviceList();

            list.num_devices = 0;
            Sensel.senselGetDeviceList(ref list);
            Console.WriteLine("Num Devices: " + list.num_devices);
            if (list.num_devices != 0)
            {
                Sensel.senselOpenDeviceByID(ref handle, list.devices[0].idx);
                Sensel.senselSetFrameContent(handle, 4);
                Sensel.senselAllocateFrameData(handle, frame);
                Sensel.senselStartScanning(handle);
            }
            if (handle.ToInt64() != 0)
            {
                for (int c = 0; c < 500; c++)
                {
                    Int32 num_frames = 0;
                    Sensel.senselReadSensor(handle);
                    Sensel.senselGetNumAvailableFrames(handle, ref num_frames);
                    for (int f = 0; f < num_frames; f++)
                    {
                        Sensel.senselGetFrame(handle, frame);
                        Console.WriteLine("\nNum Contacts: " + frame.n_contacts);
                        for (int i = 0; i < frame.n_contacts; i++)
                        {
                            Console.WriteLine("Contact ID: " + frame.contacts[i].id);
                        }
                    }
                }

                Sensel.senselStopScanning(handle);
                Sensel.senselClose(handle);
            }
        }
Esempio n. 5
0
 internal extern static SenselStatus senselGetDeviceList(ref SenselDeviceList device_list);
Esempio n. 6
0
 public extern static int senselGetDeviceList(ref SenselDeviceList device_list);