/// <summary>
        /// 基于Tcp的统一下发信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public JT808HttpResponse UnificationTcpSend(JT808HttpRequest request)
        {
            if (string.IsNullOrEmpty(request.Json))
            {
                return(EmptyHttpResponse());
            }
            JT808UnificationSendRequestDto jT808UnificationSendRequestDto = JsonConvert.DeserializeObject <JT808UnificationSendRequestDto>(request.Json);
            var result = jT808UnificationTcpSendService.Send(jT808UnificationSendRequestDto.TerminalPhoneNo, jT808UnificationSendRequestDto.Data);

            return(CreateJT808HttpResponse(result));
        }
Ejemplo n.º 2
0
        public void Test1()
        {
            jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808TcpSessionService>();
            jT808UnificationTcpSendService = ServiceProvider.GetService <IJT808UnificationTcpSendService>();
            jT808SessionServiceDefaultImpl.GetAll();
            string no = "123456789001";
            // 文本信息包
            JT808Package jT808Package2 = JT808.Protocol.Enums.JT808MsgId.文本信息下发.Create(no, new JT808_0x8300
            {
                TextFlag = 5,
                TextInfo = "smallchi 518"
            });
            var data = JT808Serializer.Serialize(jT808Package2);
            JT808ResultDto <bool> jt808Result = jT808UnificationTcpSendService.Send(no, data);

            Thread.Sleep(1000);
            Assert.AreEqual(200, jt808Result.Code);
            Assert.IsTrue(jt808Result.Data);
        }