public ServiceComponentsStateChangedMessage(HesStatus hesStatus, RfidStatus rfidStatus, BluetoothStatus bluetoothStatus, HesStatus tbHesStatus)
 {
     HesStatus       = hesStatus;
     RfidStatus      = rfidStatus;
     BluetoothStatus = bluetoothStatus;
     TbHesStatus     = tbHesStatus;
 }
Example #2
0
 public Device(string macId, string name, DateTime lastConnected, BluetoothStatus status)
 {
     MacId         = macId;
     Name          = name;
     LastConnected = lastConnected;
     Status        = status;
 }
Example #3
0
    private void OnBluetoothDeviceStateChanged(int status)
    {
        BluetoothStatus bluetoothStatus = (BluetoothStatus)status;

        this.m_imgOffline.gameObject.SetActive(bluetoothStatus != BluetoothStatus.CONNECTED);
        this.m_imgOnline.gameObject.SetActive(bluetoothStatus == BluetoothStatus.CONNECTED);

        //1分钟一次请求剩余电量
        if (bluetoothStatus == BluetoothStatus.CONNECTED)
        {
            TimeModule.Instance.ExecuteOnNextFrame(() => GetSkaterBatteryPower());
            TimeModule.Instance.SetTimeInterval(GetSkaterBatteryPower, 60f);
        }
        else
        {
            TimeModule.Instance.RemoveTimeaction(GetSkaterBatteryPower);
        }
    }
Example #4
0
        public BluetoothStream(CircularBuffer buffer, CircularBuffer sbuffer, byte[] address, string pin)
        {
            this.address = new byte[MAC_SIZE];

#if (PocketPC)
            if (BitConverter.IsLittleEndian)
            {
                //reverse address depending on the architecture
                for (int i = 0; i < address.Length; i++)
                {
                    this.address[this.address.Length - 1 - i] = address[i];
                }
            }
            else
            {
                for (int i = 0; i < address.Length; i++)
                {
                    this.address[i] = address[i];
                }
            }
#else
            if (BitConverter.IsLittleEndian)
            {
                //reverse address depending on the architecture
                for (int i = 0; i < address.Length; i++)
                {
                    this.address[this.address.Length - 1 - i] = address[i];
                }
            }
            else
            {
                for (int i = 0; i < address.Length; i++)
                {
                    this.address[i] = address[i];
                }
            }
#endif
            this.pin     = pin;
            this.buffer  = buffer;
            this.sbuffer = sbuffer;
            this._Status = BluetoothStatus.Disconnected;
            mylock       = new object();
        }
Example #5
0
 private void OnBluetoothStateChangedCallback(int bluetoothStatus)
 {
     this.m_bluetoothStatus = (BluetoothStatus)bluetoothStatus;
 }
        public async Task SendStatus(HesStatus hesStatus, HesStatus tbHesStatus, RfidStatus rfidStatus, BluetoothStatus bluetoothStatus)
        {
            WriteLine($"SendStatus: hes:{hesStatus}; tb_hes: {tbHesStatus}; rfid:{rfidStatus}; ble:{bluetoothStatus};");

            var uiList = GetClientUiList();

            foreach (var ui in uiList)
            {
                if (ui != null)
                {
                    await ui.SendStatus(hesStatus, tbHesStatus, rfidStatus, bluetoothStatus);
                }
            }
        }
Example #7
0
 public async Task SendStatus(HesStatus hesStatus, HesStatus tbHesStatus, RfidStatus rfidStatus, BluetoothStatus bluetoothStatus)
 {
     await _metaMessenger.Publish(new ServiceComponentsStateChangedMessage(hesStatus, rfidStatus, bluetoothStatus, tbHesStatus));
 }
Example #8
0
        public BluetoothStream(CircularBuffer buffer,CircularBuffer sbuffer,byte[] address,string pin)
        {
            this.address = new byte[MAC_SIZE];

            #if (PocketPC)

                if (BitConverter.IsLittleEndian)
                {
                    //reverse address depending on the architecture
                    for (int i = 0; i < address.Length; i++)
                        this.address[this.address.Length - 1 - i] = address[i];
                }
                else
                {
                    for (int i = 0; i < address.Length; i++)
                        this.address[i] = address[i];
                }

            #else
            if (BitConverter.IsLittleEndian)
            {
              //reverse address depending on the architecture
                for (int i = 0; i < address.Length; i++)
                    this.address[this.address.Length - 1 - i] = address[i];

            }
            else
            {

                for (int i = 0; i < address.Length; i++)
                    this.address[i] = address[i];

            }
            #endif
            this.pin = pin;
            this.buffer = buffer;
            this.sbuffer = sbuffer;
            this._Status = BluetoothStatus.Disconnected;
            mylock = new object();
        }
        public async Task SendStatus(HesStatus hesStatus, HesStatus tbHesStatus, RfidStatus rfidStatus, BluetoothStatus bluetoothStatus)
        {
            var statuses = new List <string>();

            if (bluetoothStatus != BluetoothStatus.Ok)
            {
                statuses.Add(TranslationSource.Instance.Format("ServiceComponentStatus.Bluetooth.NotAvailable", bluetoothStatus));
            }

            if (rfidStatus != RfidStatus.Disabled && rfidStatus != RfidStatus.Ok)
            {
                if (rfidStatus == RfidStatus.RfidServiceNotConnected)
                {
                    statuses.Add(TranslationSource.Instance["ServiceComponentStatus.RFID.ServiceNotConnected"]);
                }
                else if (rfidStatus == RfidStatus.RfidReaderNotConnected)
                {
                    statuses.Add(TranslationSource.Instance["ServiceComponentStatus.RFID.ReaderNotConnected"]);
                }
            }

            if (hesStatus != HesStatus.Ok)
            {
                if (hesStatus == HesStatus.NotApproved)
                {
                    statuses.Add(TranslationSource.Instance["ServiceComponentStatus.HES.WorkstationNotApproved"]);
                }
                else
                {
                    statuses.Add(TranslationSource.Instance["ServiceComponentStatus.HES.NotConnected"]);
                }
            }

            if (statuses.Count > 0)
            {
                await SendStatus(TranslationSource.Instance.Format("ServiceComponentStatus.Message.Base", string.Join("; ", statuses)));
            }
            else
            {
                await SendStatus(string.Empty);
            }
        }
    public BluetoothStatus GetBluetoothDeviceStatus()
    {
        BluetoothStatus bluetoothStatus = (BluetoothStatus)AndroidBridgeInstance.Call <int>("getCurrentBluetoothStatus");

        return(bluetoothStatus);
    }