Exemplo n.º 1
0
        public async Task<OperationResult<float>> GetSdCardSizeAsync()
        {
            RequestMessageWithType requestMsg = new RequestMessageWithType
            {
                MessageId = (int)MessageTypeId.SdCardInfo,
                Type = SdCardInfoMessageType.TOTAL_SPACE,
            };

            var opRes = await _connectionManager.SendMessageAsync<ResponseMessageWithParam>(requestMsg);

            if (opRes.Success)
            {
                return OperationResult.GetSucces(float.Parse(opRes.Result.Param));
            }
            else
            {
                return OperationResult<float>.FromResult(opRes);
            }
            /*
            tosend = '{"msg_id":5,"token":%s,"type":"total"}' %self.token
		self.totalspace = self.Comm(tosend)["param"]
		tosend = '{"msg_id":5,"token":%s,"type":"free"}' %self.token
		self.freespace = float(self.Comm(tosend)["param"])
  */
        }
Exemplo n.º 2
0
        public async Task<OperationResult<float>> GetSdCardFreeSpaceAsync()
        {
            RequestMessageWithType requestMsg = new RequestMessageWithType
            {
                MessageId = (int)MessageTypeId.SdCardInfo,
                Type = SdCardInfoMessageType.FREE_SPACE,
            };

            var opRes = await _connectionManager.SendMessageAsync<ResponseMessageWithParam>(requestMsg);

            if (opRes.Success)
            {
                return OperationResult.GetSucces(float.Parse(opRes.Result.Param));
            }
            else
            {
                return OperationResult<float>.FromResult(opRes);
            }

        }