Example #1
0
 public static void CreateTouchDetector(TactonicDevice device)
 {
     detector = new TactonicTouchDetector();
     detector.SetTouchInfo(device);
     deviceHandle = new TactonicDevice();
     deviceHandle.serialNumber = device.serialNumber;
 }
Example #2
0
 public static void AddTouchCallback(TactonicDevice device, TactonicTouchCallback callback)
 {
     if (device.serialNumber == deviceHandle.serialNumber)
     {
         detector.AddTouchCallback(callback);
     }
 }
        internal TactonicTouchDetector()
        {
            nextID=(0);
            stopping=(false);
            touchCallbackLen=(0);
            gestureCallbackLen=(0);

            device = new TactonicDevice();
        }
 public TactonicFrame(TactonicDevice device)
 {
     forces = new int[device.rows*device.cols];
     rows = device.rows;
     cols = device.cols;
     numForces = device.rows*device.cols;
     frameNumber = 0;
     time = 0;
 }
 internal TactonicTouchEvent(TactonicDevice deviceInfo)
 {
     device = new TactonicDevice();
     device.cols = deviceInfo.cols;
     device.rows = deviceInfo.rows;
     device.serialNumber = deviceInfo.serialNumber;
     device.rowSpacingUM = deviceInfo.rowSpacingUM;
     device.colSpacingUM = deviceInfo.colSpacingUM;
     frame = new TactonicTouchFrame();
 }
Example #6
0
 public static void AddFrameCallback(TactonicDevice device, TactonicFrameCallback callback)
 {
     for (int i = 0; i < deviceList.numDevices; i++)
     {
         if (device.serialNumber == deviceList.devices[i].serialNumber)
         {
             tactonicUSBList[i].AddFrameCallback(callback);
         }
     }
 }
 internal TactonicUSB(FTDI ftdiHandle)
 {
     ftdi = ftdiHandle;
     deviceFrameInfo = new TactonicDevice();
     tileFrameInfo = new TactonicDevice();
     frameCallbackList = new TactonicFrameCallback[32];
     frameCallbackLen = 0;
     deviceFrames = new TactonicFrame[2];
     isStopped = false;
     isTiles = false;
     numTiles = 1;
     tileX = new int[16];
     tileY = new int[16];
     tileID = new int[16];
     stackPath = new int[16];
     tileNum = 0;
 }
 // Use this for initialization
 void Start()
 {
     rend = GetComponent<Renderer> ();
     tex = new Texture2D (1,1,TextureFormat.RGBAFloat,false);
     rend.material.mainTexture = tex;
     TactonicDeviceList dl = Tactonic.GetDeviceList ();
     if (dl.GetNumDevices () > id) {
         device = dl.GetDevice (id);
         Debug.Log ("id: " + id + ", serial number: " + device.serialNumber);
         frame = new TactonicFrame (device);
         Tactonic.AddFrameCallback (device, this);
         Tactonic.StartDevice (device);
         newFrame = false;
         tex.Resize (device.GetRows (), device.GetCols ());
         Debug.Log ("rows: " + device.GetRows() + ", cols: " + device.GetCols());
     } else {
         Debug.Log ("id " + id + " not found! " + dl.GetNumDevices () + " devices found.");
     }
 }
 internal void GetDeviceInfo(TactonicDevice info)
 {
     info.rows = deviceFrameInfo.rows;
     info.cols = deviceFrameInfo.cols;
     info.rowSpacingUM = deviceFrameInfo.rowSpacingUM;
     info.colSpacingUM = deviceFrameInfo.colSpacingUM;
     info.serialNumber = deviceFrameInfo.serialNumber;
 }
 internal void SetTouchInfo(TactonicDevice deviceInfo)
 {
     frameEvent = new TactonicFrameEvent(device);
     touchEvent = new TactonicTouchEvent(device);
     device.serialNumber = deviceInfo.serialNumber;
     device.rows = deviceInfo.rows;
     device.cols = deviceInfo.cols;
     device.rowSpacingUM = deviceInfo.rowSpacingUM;
     device.colSpacingUM = deviceInfo.colSpacingUM;
     frameEvent.device = device;
     for(int i = 0; i < 8; i++){
         forceFrames[i] = new TactonicFrame(device);
         touchFrames[i] = new TactonicTouchFrame();
     }
 }
Example #11
0
 public static void DestroyTouchDetector(TactonicDevice device)
 {
     RemoveFrameCallback(device, detector);
 }
Example #12
0
 public static void StopTouchDetector(TactonicDevice device)
 {
     if (device.serialNumber == deviceHandle.serialNumber)
     {
         RemoveFrameCallback(device, detector);
         detector.Stop();
     }
 }
Example #13
0
 public static void StopDevice(TactonicDevice device)
 {
     for (int i = 0; i < deviceList.numDevices; i++)
     {
         if (device.serialNumber == deviceList.devices[i].serialNumber)
         {
             tactonicUSBList[i].StopDevice();
         }
     }
 }
Example #14
0
 public static void StartTouchDetector(TactonicDevice device)
 {
     if (device.serialNumber == deviceHandle.serialNumber)
     {
         detector.Start();
         AddFrameCallback(device, detector);
     }
 }