protected void OnConnected(string pheriperalID, string pheriperalName, WristbandProfile profile)
 {
     foreach (IWristbandObserver observer in observers)
     {
         observer.OnWristbandConnected(pheriperalID, pheriperalName, profile);
     }
 }
Example #2
0
        public void Disconnect()
        {
            connectedWristbandProfile = null;

            if (bluetoothDeviceScript != null && bluetoothDeviceScript.DeviceList() != null && bluetoothDeviceScript.DeviceList().Count > 0)
            {
                busy = true;
                bluetoothLEHardwareInterface.DisconnectPeripheral(bluetoothDeviceScript.DeviceList()[0], DisconnectDeviceComplete);
            }
            else
            {
                OnDisconnected();
            }
        }
Example #3
0
        private void NotificationHandler(string str)
        {
            OnDebugMSG("NotificationHandler :: Subscribtion successfull @:" + str);

            connectedWristbandProfile = services.GetProfileByName(pheriperalName);
            //if (OnMatchingProfile != null) OnMatchingProfile(profile);

            if (connectedWristbandProfile != null)
            {
                OnConnected(pheriperalID, pheriperalName, connectedWristbandProfile);
            }
            else
            {
                OnERROR(WristbandProtocolError.NOTIFICATION_SUBSCRTIPTION_FAILED, "NotificationHandler :: unknown profile -> device-id=" + pheriperalID + ", device-name=" + pheriperalName);
                OnUnknownProfile(pheriperalID, pheriperalName);
            }
        }
        public WristbandCharacteristic GetCharacteristicByTag(string peripheralName, WristbandCharacteristicTag characteristicTag)
        {
            WristbandProfile profile = GetProfileByName(peripheralName);

            if (profile == null)
            {
                return(null);
            }

            foreach (WristbandCharacteristic characteristic in profile.characteristics)
            {
                if (characteristic.tag == characteristicTag)
                {
                    return(characteristic);
                }
            }

            //Debug.LogError("GetCharacteristicByTag ERROR :: characteristic tag '"+characteristicTag.ToString()+"' not found!");
            throw new WristbandServiceException("GetProfileByName ERROR :: profile '" + peripheralName + "' not found!");
            return(null);
        }
 public void OnWristbandConnected(string pheriperalID, string pheriperalName, WristbandProfile profile)
 {
     EventHistory.Add(new WristbandHistoryEvent("OnWristbandConnected > name:" + pheriperalName + ", id:" + pheriperalID + ", profile: " + profile.description.ToString(), false));
 }