Example #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);
        }
Example #2
0
 public SenselDevice()
 {
     handle      = new IntPtr(0);
     frame       = new SenselFrame();
     frame_data  = new SenselFrameData();
     sensor_info = new SenselSensorInfo();
     fw_info     = new SenselFirmwareInfo();
 }
Example #3
0
        public static int senselAllocateFrameData(IntPtr handle, SenselFrame frame)
        {
            SenselSensorInfo info = new SenselSensorInfo();

            Sensel.senselGetSensorInfo(handle, ref info);
            frame.force_array  = new float[info.num_rows * info.num_cols];
            frame.labels_array = new byte[info.num_rows * info.num_cols];
            frame.accel_data   = new SenselAccelData();
            frame.frame_data   = new SenselFrameData();

            Sensel.senselAllocateFrameData(handle, ref frame.frame_data);
            return(0);
        }
Example #4
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);
            }
        }
Example #5
0
 internal extern static SenselStatus senselGetSensorInfo(IntPtr handle, ref SenselSensorInfo info);
Example #6
0
 public extern static int senselGetSensorInfo(IntPtr handle, ref SenselSensorInfo info);