public void Test2()
 {
     IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();
     var result1 = jT808SessionServiceDefaultImpl.GetUdpAll();
     var result2 = jT808SessionServiceDefaultImpl.RemoveByTerminalPhoneNo("123456789001");
     var result3 = jT808SessionServiceDefaultImpl.GetUdpAll();
 }
Ejemplo n.º 2
0
        public void GetUdpAllTest()
        {
            IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();
            var result = jT808SessionServiceDefaultImpl.GetUdpAll();
            var tons   = result.Data.Select(s => s.TerminalPhoneNo).ToList();

            foreach (var item in TNos)
            {
                Assert.Contains(item, tons);
            }
            Assert.Equal(JT808ResultCode.Ok, result.Code);
        }
        public void Test3()
        {
            // 判断通道是否关闭
            IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();
            JT808SessionManager  jT808UdpSessionManager         = ServiceProvider.GetService <JT808SessionManager>();
            var result1 = jT808SessionServiceDefaultImpl.GetUdpAll();

            SimpleUdpClient1.Down();
            var session = jT808UdpSessionManager.GetSessionByTerminalPhoneNo("123456789001");
            var result3 = jT808UdpSessionManager.GetUdpAll();

            Thread.Sleep(100000);
        }
Ejemplo n.º 4
0
        public void RemoveByTerminalPhoneNoTest()
        {
            string tno = "123456789006";
            IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();

            SeedSession(tno);
            var result1 = jT808SessionServiceDefaultImpl.RemoveByTerminalPhoneNo(tno);

            Assert.Equal(JT808ResultCode.Ok, result1.Code);
            Assert.True(result1.Data);
            var result2 = jT808SessionServiceDefaultImpl.GetUdpAll();

            Assert.Equal(JT808ResultCode.Ok, result2.Code);
            Assert.DoesNotContain(tno, result2.Data.Select(s => s.TerminalPhoneNo));
        }
Ejemplo n.º 5
0
        public override Task <UdpSessionInfoReply> GetUdpSessionAll(Empty request, ServerCallContext context)
        {
            var result = jT808SessionService.GetUdpAll();
            UdpSessionInfoReply reply = new UdpSessionInfoReply();

            if (result.Data != null)
            {
                foreach (var item in result.Data)
                {
                    reply.UdpSessions.Add(new SessionInfo
                    {
                        LastActiveTime  = item.LastActiveTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        StartTime       = item.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        RemoteAddressIP = item.RemoteAddressIP,
                        TerminalPhoneNo = item.TerminalPhoneNo
                    });
                }
            }
            return(Task.FromResult(reply));
        }
        public void Test1()
        {
            //"126 131 0 0 13 18 52 86 120 144 1 0 11 5 115 109 97 108 108 99 104 105 32 53 49 56 24 126"
            jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();
            jT808UnificationSendService    = ServiceProvider.GetService <IJT808UnificationSendService>();
            jT808SessionServiceDefaultImpl.GetUdpAll();
            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 = jT808UnificationSendService.Send(no, data);

            Thread.Sleep(1000);
            Assert.Equal(200, jt808Result.Code);
            Assert.True(jt808Result.Data);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 会话服务集合
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public JT808HttpResponse GetUdpSessionAll(JT808HttpRequest request)
        {
            var result = jT808SessionService.GetUdpAll();

            return(CreateJT808HttpResponse(result));
        }
 public void Test1()
 {
     IJT808SessionService jT808SessionServiceDefaultImpl = ServiceProvider.GetService <IJT808SessionService>();
     var result = jT808SessionServiceDefaultImpl.GetUdpAll();
 }