Пример #1
0
        protected override async Task <(DeviceStatus devSt, CTAPResponse ctapRes)> sendCommandandResponseAsync(CTAPCommand cmd, CTAPResponse res)
        {
            try
            {
                // 送信コマンドを作成(byte[]) | Create send command
                var payload = cmd.CreatePayload();

                // 送信して、応答受信(byte[]) | Send and receive response
                var sender = new CTAPHIDSender();
                sender.KeepAlive += this.KeepAlive;
                var response = await sender.SendCommandandResponseAsync(DevicePath, payload, ReceiveResponseTimeoutmillisecond);

                // 応答をパース | Parse response
                if (response.ctapRes != null)
                {
                    res.Parse(response.ctapRes);
                }
                res.SendPayloadJson = cmd.PayloadJson;

                return(response.devSt, res);
            }
            catch (Exception ex)
            {
                Logger.Log($"Exception...{ex.Message})");
                return(DeviceStatus.Unknown, null);
            }
        }
Пример #2
0
        protected override async Task <(DeviceStatus devSt, CTAPResponse ctapRes)> sendCommandandResponseAsync(CTAPCommand cmd, CTAPResponse res)
        {
            try {
                // 送信コマンドを作成(byte[]) | Create send command
                var payload = cmd.CreatePayload();

                // 送信して、応答受信(byte[]) | Send and receive response (byte [])
                var sender   = new CTAPBLESender(PacketSizeByte, receiver);
                var response = await sender.SendCommandandResponseAsync(characteristic_Send, payload, 10000);

                // 応答をパース | Parse response
                res.Parse(response.ctapRes);
                res.SendPayloadJson = cmd.PayloadJson;

                return(response.devSt, res);
            } catch (Exception ex) {
                Logger.Log($"Exception...{ex.Message})");
                return(DeviceStatus.Unknown, null);
            }
        }