public void UnificationSendTest()
        {
            JT808ResultDto <bool> jT808ResultDto = new JT808ResultDto <bool>();

            jT808ResultDto.Data = true;
            jT808ResultDto.Code = 200;
            JT808UnificationSendRequestDto jT808UnificationSendRequestDto = new JT808UnificationSendRequestDto
            {
                TerminalPhoneNo = "123456789",
                Data            = new byte[] { 1, 2, 3, 4 }
            };
            JT808HttpClient jT808HttpClient = new JT808HttpClient(CreateHttpClient(JT808NettyConstants.JT808WebApiRouteTable.UnificationSend, JsonSerializer.Serialize(jT808UnificationSendRequestDto), JsonSerializer.Serialize(jT808ResultDto)));
            var             result          = jT808HttpClient.UnificationSend(jT808UnificationSendRequestDto);

            Assert.Equal(jT808ResultDto.Code, result.Code);
            Assert.Equal(jT808ResultDto.Data, result.Data);
        }
Exemplo n.º 2
0
 public Task StartAsync(CancellationToken cancellationToken)
 {
     Task.Run(async() =>
     {
         while (!cancellationToken.IsCancellationRequested)
         {
             var result2 = await jT808HttpClient.GetTcpSessionAll();
             var result3 = await jT808HttpClient.UnificationSend(new Abstractions.Dtos.JT808UnificationSendRequestDto
             {
                 TerminalPhoneNo = "123456789012",
                 HexData         = "7E02000026123456789012007D02000000010000000200BA7F0E07E4F11C0028003C00001810151010100104000000640202007D01137E"
             });
             Logger.LogInformation($"[GetTcpAtomicCounter]:{JsonSerializer.Serialize(result2)}");
             Logger.LogInformation($"[GetTcpSessionAll]:{JsonSerializer.Serialize(result3)}");
             Thread.Sleep(3000);
         }
     }, cancellationToken);
     return(Task.CompletedTask);
 }