예제 #1
0
        /// <summary>
        /// 终端注册
        /// </summary>
        /// <param name="client"></param>
        /// <param name="bodies"></param>
        /// <param name="minBufferSize"></param>
        public static void Send(this JT808TcpClient client, JT808_0x0100 bodies, int minBufferSize = 100)
        {
            JT808Header header = new JT808Header();

            header.MsgId = JT808MsgId.终端注册.ToUInt16Value();
            client.Send(header, bodies, minBufferSize);
        }
예제 #2
0
        public static void Send(this JT808TcpClient client, JT808Package package, int minBufferSize = 4096)
        {
            package.Header.TerminalPhoneNo = client.DeviceConfig.TerminalPhoneNo;
            JT808ClientRequest request = new JT808ClientRequest(package, minBufferSize);

            client.Send(request);
        }
예제 #3
0
        public static void Send(this JT808TcpClient client, JT808Header header, JT808Bodies bodies, int minBufferSize = 1024)
        {
            JT808Package package = new JT808Package();

            package.Header = header;
            package.Bodies = bodies;
            package.Header.TerminalPhoneNo = client.DeviceConfig.TerminalPhoneNo;
            package.Header.MsgNum          = client.DeviceConfig.MsgSNDistributed.Increment();
            JT808ClientRequest request = new JT808ClientRequest(package, minBufferSize);

            client.Send(request);
        }
예제 #4
0
 public JT808TcpClient Create(DeviceConfig deviceConfig)
 {
     if (dict.TryGetValue(deviceConfig.TerminalPhoneNo, out var client))
     {
         return(client);
     }
     else
     {
         JT808TcpClient jT808TcpClient = new JT808TcpClient(deviceConfig, serviceProvider);
         dict.TryAdd(deviceConfig.TerminalPhoneNo, jT808TcpClient);
         return(jT808TcpClient);
     }
 }