Ejemplo n.º 1
0
 public BleWriteAttribute(BleProtocol ble, SerialPort port, byte connection, ushort attributeHandle, Bytes value)
     : base(ble, port)
 {
     this.Connection      = connection;
     this.AttributeHandle = attributeHandle;
     this.Value           = value;
 }
Ejemplo n.º 2
0
		public BleWriteAttribute (BleProtocol ble, SerialPort port, byte connection, ushort attributeHandle, Bytes value)
			: base (ble, port)
		{
			this.Connection = connection;
			this.AttributeHandle = attributeHandle;
			this.Value = value;
		}
Ejemplo n.º 3
0
        private void Client_OnCharacteristicChanged(object sender, ushort handle, byte[] value)
        {
            TraceEvent(((wclGattClient)sender).Address, "ValueChanged", "Handle", handle.ToString("X4"));
            if (value == null)
            {
                TraceEvent(0, "", "Value", "");
            }
            else if (value.Length == 0)
            {
                TraceEvent(0, "", "Value", "");
            }
            else
            {
                var str = "";

                for (var i = 0; i < value.Length; i++)
                {
                    str = str + value[i].ToString("X2");
                }

                BleProtocol.PackageAnalyze(value);
                if (BleProtocol.Record != null)
                {
                    var record = BleProtocol.Record;

                    string sOperType = "";
                    switch (record.OperationType)
                    {
                    case 1:
                        sOperType = "密码";
                        break;

                    case 2:
                        sOperType = "刷卡";
                        break;

                    case 3:
                        sOperType = "指纹";
                        break;

                    default:
                        break;
                    }

                    var item = lvOperationRecord.Items.Add(record.Date.ToString());
                    item.SubItems.Add(record.UserId.ToString());
                    item.SubItems.Add(sOperType);
                    item.SubItems.Add(record.UserType.ToString());
                    BleProtocol.Record = null;

                    WriteCommand(val_GetRecord);  //20180823 zy
                }

                TraceEvent(0, "", "Value", str);
            }
        }
Ejemplo n.º 4
0
		public BleDisconnectFromService (BleProtocol ble, SerialPort port, byte connection)
			: base (ble, port)
		{
			this.Connection = connection;
		}
Ejemplo n.º 5
0
 public BleDisconnectFromService(BleProtocol ble, SerialPort port, byte connection)
     : base(ble, port)
 {
     this.Connection = connection;
 }
Ejemplo n.º 6
0
		public BleConnectToService (BleProtocol ble, SerialPort port, Bytes service, byte address)
			: base (ble, port)
		{
			this.ServiceUUID = service;
			this.Address = address;
		}
Ejemplo n.º 7
0
 public BleReadAttribute(BleProtocol ble, SerialPort port, byte connection, ushort attributeHandle)
     : base(ble, port)
 {
     this.Connection      = connection;
     this.AttributeHandle = attributeHandle;
 }
		public BleFindServicesAndCharacteristics (BleProtocol ble, SerialPort port, byte connection)
			: base (ble, port)
		{
			this.Connection = connection;
		}
Ejemplo n.º 9
0
		protected BleBlock (BleProtocol ble, SerialPort port)
		{
			this.Ble = ble;
			this.Port = port;
		}
Ejemplo n.º 10
0
 /// <summary>
 /// 设置系统时间
 /// </summary>
 public static void SetCurrentTime()
 {
     byte[] package = BleProtocol.GetUpdateTimePackage();
     EventClass.GetInstance().WriteCommand(package);
     RecordLog.GetInstance().WriteLog(Level.Info, "设置时间行为结束");
 }
Ejemplo n.º 11
0
		public BleReadAttribute (BleProtocol ble, SerialPort port, byte connection, ushort attributeHandle)
			: base (ble, port)
		{
			this.Connection = connection;
			this.AttributeHandle = attributeHandle;
		}
Ejemplo n.º 12
0
 public BleDiscoverService(BleProtocol ble, SerialPort port, Bytes service)
     : base(ble, port)
 {
     this.ServiceUUID = service;
 }
Ejemplo n.º 13
0
 protected BleBlock(BleProtocol ble, SerialPort port)
 {
     this.Ble  = ble;
     this.Port = port;
 }
Ejemplo n.º 14
0
        private void btSetTime_Click(object sender, EventArgs e)
        {
            var package = BleProtocol.GetUpdateTimePackage();

            WriteCommand(package);
        }
Ejemplo n.º 15
0
 public BleConnectToService(BleProtocol ble, SerialPort port, Bytes service, byte address)
     : base(ble, port)
 {
     this.ServiceUUID = service;
     this.Address     = address;
 }
 public BleFindServicesAndCharacteristics(BleProtocol ble, SerialPort port, byte connection)
     : base(ble, port)
 {
     this.Connection = connection;
 }
Ejemplo n.º 17
0
		public BleDiscoverService (BleProtocol ble, SerialPort port, Bytes service)
			: base (ble, port)
		{
			this.ServiceUUID = service;
		}