public async Task<OperationResult> StopVideoRecord() { RequestMessage request = new RequestMessage(MessageTypeId.StopVideoRec); var res = await _cameraConnectionService.SendMessageAsync<BaseResponseMessage>(request); if (!res.Success) { return OperationResult.FromResult(res); } else { return new OperationResult { Success = res.Result.Success, ResultMessage = res.Result.Result.ToString(), }; } }
public async Task<OperationResult> CapturePhoto(CameraCaptureMode mode) { RequestMessage request; if (mode == CameraCaptureMode.PreciseQualityCont) { request = new RequestMessage(MessageTypeId.CapturePhotoCont); } else { request = new RequestMessage(MessageTypeId.CapturePhoto); } var res = await _cameraConnectionService.SendMessageAsync<BaseResponseMessage>(request); if (!res.Success) { return OperationResult.FromResult(res); } else { return new OperationResult { Success = res.Result.Success, ResultMessage = res.Result.Result.ToString(), }; } }
public async Task<OperationResult<BatteryInfo>> GetBatteryInfoAsync() { RequestMessage requestMsg = new RequestMessage { MessageId = (int)MessageTypeId.BatteryInfo,}; var opRes = await _connectionManager.SendMessageAsync<BatteryInfoResponseMessage>(requestMsg); if (opRes.Success) { BatteryInfo info = new BatteryInfo(); info.BatteryLevel = opRes.Result.BatteryLevel; info.BatteryStatus = opRes.Result.BatteryMode == "adapter" ? BatteryStatus.InCharge : BatteryStatus.InUse; //TODO use constant return OperationResult.GetSucces(info); } else { return OperationResult<BatteryInfo>.FromResult(opRes); } /* tosend = '{"msg_id":13,"token":%s}' %self.token resp = self.Comm(tosend) Ctype = resp["type"] charge = resp["param"] if Ctype == "adapter": Ctype = "Charging" else: Ctype = "Battery" battery = "%s: %s%%" %(Ctype, charge) */ }