Пример #1
0
        protected override void SendDataCore(string url, int channelCount, int itemCount)
        {
            int channelId = _channelId;

            for (int i = 1; i <= channelCount; ++i)
            {
                for (int j = 1; j <= itemCount; ++j)
                {
                    DateTime now                = DateTime.Now;
                    Random   random             = new Random();
                    VideoStructAdapterData bike = new VideoStructAdapterData
                    {
                        VideoStructType = VideoStructType.非机动车,
                        ChannelId       = $"channel_{channelId}_{i}",
                        LaneId          = $"{j:D2}",
                        Timestamp       = TimeStampConvert.ToUtcTimeStamp(now),
                        Feature         = "AQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYMY+AAAAAADo7UEAAAAAALsIQgAAAAAA2IRAAD6vQYBQmkGAfZRBAAAAAAAEEUAAAAAAgIHfQQA23EAAaFVBAAAAAAAtRUIALwNBAAAAAADV5kEAzq9BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJxMQAAAAAAAXxZCAL1XQQAAAAAAruJBAAAAAAAAAAAA1EFAAMCUQQA9mUEAmHhAAIA1QADlK0EAAAAAAO4SQYDZWEIAhd5BABryQADQekAA0Gg/AAAAAADYiUEAf9xBAL7oQYBrK0KAOkVCAAAAAAAAAAAAFJlAAAiyPwAZxUGAvKxBAAAAAAAAAAAAAAAAACxOQAAAAACAZ/NBAAAAAAC9D0IAzBNBAMniQYDh0UEAeG5BAMDHQQAAAAAAHNFAAAAAAIBOKUIAAAAAAPSRQQAAAAAA4SZCAMqYQQAAAABAihJCAJtbQQAAAAAAAAAAAA4UQQAAAAAAAAAAAJ6EQAB4xT8AAAAAgPz7QQA1nkEAAAAAAFcTQgAAAAAAAAAAAALvQIAAkkEALm1BAJ0QQQCotEAArtJAAAAAAABcrkDAODZCAOQ2QoBZq0EAAAAAAAAAAAAAAAAAKOtAgDbmQQDWJkGAxTBCQHNJQgAAAAAAAAAAAAAAAABxGUGAYMpBACKJQQAwbEAAAAAAAAAAAADe80AAAAAAwOYPQgAAAACA+IFBgCjiQYASA0IAjU5BAJSUQIBQqkE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QAAQJ3AAECAxEEBSEx\r\nBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\r\nU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3\r\nuLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDpWXAw\r\nenaq8gVepAq0SV32/wB4fnUDAdiDTGRlaNh9T+dSBvSDPTrjpTwba1toBdWJlnlUsVP8I/GmIYs+\r\nl4+bSnX6N/8AXqIrpV3J5NqlxBclSUBRsOR7nigZmKxkQMylTyCD2I60nFAjdhsIbq7Erq3mICUI\r\nJwD2JFTNbaurY/twrjpmyX5v1zUsaAwa4Rxq0eR62R5+tQuPEeQFvdJLg8eZE4/rQgMKK0uWv724\r\nu54PtJfE8MWdqnsR9RT/ACz6H8qoRd1bVptEEE8SQu8wYIkjY3Yx0OaxZviNerFgQWfmE4OA7bPc\r\n/wD66mwy4fHVoyIV1bD7RvH2QlQfbvUcXj2TczPp8NwycCVJNm4euG6UWGTaZcNq1tdauYxCLiXa\r\nEDZwB61YwaZJh/EuRo10srj5EcgdutS6c1hd2kHn6LphJRckQkE8A+tMZtxeF9AlSF20mAGTOQrO\r\nB/Os7xp4Z0bSfDVxc2NkscygBX3MSvPbJpAL4MHm+Cogxx++bOO/Irof7Ph/vP8AmP8ACmI//9k=",
                        BikeType        = random.Next(2, 3)
                    };
                    WebSocketMiddleware.Broadcast(url, bike);

                    VideoStructAdapterData vehicle = new VideoStructAdapterData
                    {
                        VideoStructType = VideoStructType.机动车,
                        ChannelId       = $"channel_{channelId}_{i}",
                        LaneId          = $"{j:D2}",
                        Timestamp       = TimeStampConvert.ToUtcTimeStamp(now),
                        Feature         = "AQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYMY+AAAAAADo7UEAAA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SnX6N/8AXqIrpV3J5NqlxBclSUBRsOR7nigZmKxkQMylTyCD2I60nFAjdhsIbq7Erq3mICUI\r\nJwD2JFTNbaurY/twrjpmyX5v1zUsaAwa4Rxq0eR62R5+tQuPEeQFvdJLg8eZE4/rQgMKK0uWv724\r\nu54PtJfE8MWdqnsR9RT/ACz6H8qoRd1bVptEEE8SQu8wYIkjY3Yx0OaxZviNerFgQWfmE4OA7bPc\r\n/wD66mwy4fHVoyIV1bD7RvH2QlQfbvUcXj2TczPp8NwycCVJNm4euG6UWGTaZcNq1tdauYxCLiXa\r\nEDZwB61YwaZJh/EuRo10srj5EcgdutS6c1hd2kHn6LphJRckQkE8A+tMZtxeF9AlSF20mAGTOQrO\r\nB/Os7xp4Z0bSfDVxc2NkscygBX3MSvPbJpAL4MHm+Cogxx++bOO/Irof7Ph/vP8AmP8ACmI//9k=",
                        CarBrand        = "品牌" + random.Next(1, 10),
                        CarType         = random.Next(1, 21),
                        CarColor        = random.Next(1, 21),
                        PlateNumber     = "京A0000" + random.Next(1, 9),
                        PlateType       = random.Next(1, 29)
                    };
                    WebSocketMiddleware.Broadcast(url, vehicle);

                    VideoStructAdapterData pedestrain = new VideoStructAdapterData
                    {
                        VideoStructType = VideoStructType.行人,
                        ChannelId       = $"channel_{channelId}_{i}",
                        LaneId          = $"{j:D2}",
                        Timestamp       = TimeStampConvert.ToUtcTimeStamp(now),
                        Feature         = "AQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYMY+AAAAAADo7UEAAAAAALsIQgAAAAAA2IRAAD6vQYBQmkGAfZRBAAAAAAAEEUAAAAAAgIHfQQA23EAAaFVBAAAAAAAtRUIALwNBAAAAAADV5kEAzq9BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJxMQAAAAAAAXxZCAL1XQQAAAAAAruJBAAAAAAAAAAAA1EFAAMCUQQA9mUEAmHhAAIA1QADlK0EAAAAAAO4SQYDZWEIAhd5BABryQADQekAA0Gg/AAAA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IV1bD7RvH2QlQfbvUcXj2TczPp8NwycCVJNm4euG6UWGTaZcNq1tdauYxCLiXa\r\nEDZwB61YwaZJh/EuRo10srj5EcgdutS6c1hd2kHn6LphJRckQkE8A+tMZtxeF9AlSF20mAGTOQrO\r\nB/Os7xp4Z0bSfDVxc2NkscygBX3MSvPbJpAL4MHm+Cogxx++bOO/Irof7Ph/vP8AmP8ACmI//9k=",
                        Sex             = random.Next(1, 2),
                        Age             = random.Next(1, 5),
                        UpperColor      = random.Next(1, 9)
                    };
                    WebSocketMiddleware.Broadcast(url, pedestrain);
                }

                channelId += 1;
            }
        }
Пример #2
0
        /// <summary>
        /// 封包请求协议
        /// </summary>
        /// <param name="protocol">协议</param>
        /// <returns>第一个字段表示请求字节流,第二个字段表示时间戳</returns>
        public static Tuple <List <byte>, long> Request(Protocol protocol)
        {
            List <byte> content = ByteFormatter.Serialize(protocol);

            ProtocolHead head = new ProtocolHead()
            {
                Id          = protocol.Id,
                ContentSize = Convert.ToUInt16(content.Count),
                TimeStamp   = TimeStampConvert.ToUtcTimeStamp()
            };
            List <byte> buffer = ByteFormatter.Serialize(head);

            buffer.AddRange(content);
            return(new Tuple <List <byte>, long>(buffer, head.TimeStamp));
        }
Пример #3
0
        /// <summary>
        /// 发送字节流
        /// </summary>
        /// <param name="remoteEndPoint">udp远程地址,如果为null表示tcp发送</param>
        /// <param name="buffer">字节流</param>
        /// <param name="match">响应匹配函数,不使用匹配标识不等待响应</param>
        /// <param name="action">成功响应后的异步回调,默认为null,表示同步等待响应</param>
        /// <param name="receiveBuffer">同步等待响应后得到的响应字节流,默认为null</param>
        /// <param name="timeout">等待响应时间,默认为3秒</param>
        /// <returns>发送结果</returns>
        public SocketResult Send(IPEndPoint remoteEndPoint, List <byte> buffer, Func <ReceivedEventArgs, bool> match = null, Action <ReceivedEventArgs> action = null, List <byte> receiveBuffer = null, int timeout = 3000)
        {
            if (match == null)
            {
                return(SendCore(remoteEndPoint, buffer));
            }
            else
            {
                long timeStamp = TimeStampConvert.ToUtcTimeStamp();
                if (action == null)
                {
                    AutoResetEvent resetEvent = new AutoResetEvent(false);
                    lock (_lockObj)
                    {
                        _responseItems.AddLast(new ResponseItem
                        {
                            Match         = match,
                            Action        = null,
                            ReceiveBuffer = receiveBuffer,
                            ResetEvent    = resetEvent,
                            TimeStamp     = timeStamp + timeout
                        });
                    }

                    SocketResult result = SendCore(remoteEndPoint, buffer);
                    if (result == SocketResult.Success)
                    {
                        result = resetEvent.WaitOne(timeout) ? SocketResult.Success : SocketResult.Timeout;
                    }
                    return(result);
                }
                else
                {
                    lock (_lockObj)
                    {
                        _responseItems.AddLast(new ResponseItem
                        {
                            Match         = match,
                            Action        = action,
                            ReceiveBuffer = receiveBuffer,
                            ResetEvent    = null,
                            TimeStamp     = timeStamp + timeout
                        });
                    }
                    return(SendCore(remoteEndPoint, buffer));
                }
            }
        }
Пример #4
0
        protected override void SendDataCore(string url, int channelCount, int itemCount)
        {
            int channelId = _channelId;

            for (int i = 1; i <= channelCount; ++i)
            {
                for (int j = 1; j <= itemCount; ++j)
                {
                    IOData data = new IOData
                    {
                        ChannelId = $"channel_{channelId}",
                        LaneId    = $"{j:D2}",
                        Timestamp = TimeStampConvert.ToUtcTimeStamp(),
                        Status    = _random.Next(1, 100) % 2 == 1 ? 1 : 0
                    };
                    WebSocketMiddleware.Broadcast(url, data);
                }

                channelId += 1;
            }
        }
Пример #5
0
        protected override void SendDataCore(string url, int channelCount, int itemCount)
        {
            DateTime now       = DateTime.Now;
            long     timestamp =
                TimeStampConvert.ToUtcTimeStamp(new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0));
            Random random = new Random();

            int channelId = _channelId;

            for (int i = 1; i <= channelCount; ++i)
            {
                FlowAdapterData flow = new FlowAdapterData
                {
                    Data = new LaneAdapterData[itemCount]
                };
                for (int j = 1; j <= itemCount; ++j)
                {
                    if (_mode == DataCreateMode.Random)
                    {
                        flow.Data[j - 1] = new LaneAdapterData
                        {
                            ChannelId     = $"channel_{channelId}",
                            LaneId        = $"{j:D2}",
                            Timestamp     = timestamp,
                            Bikes         = random.Next(1, 10),
                            Buss          = random.Next(1, 10),
                            Cars          = random.Next(1, 10),
                            Motorcycles   = random.Next(1, 10),
                            Persons       = random.Next(1, 10),
                            Tricycles     = random.Next(1, 10),
                            Trucks        = random.Next(1, 10),
                            Vans          = random.Next(1, 10),
                            AverageSpeed  = random.Next(1, 10),
                            HeadSpace     = random.Next(1, 10),
                            HeadDistance  = random.Next(1, 10),
                            Occupancy     = random.Next(1, 100),
                            TimeOccupancy = random.Next(1, 100),
                            TrafficStatus = (TrafficStatus)random.Next(1, 5)
                        };
                    }
                    else if (_mode == DataCreateMode.Sequence)
                    {
                        flow.Data[j - 1] = new LaneAdapterData
                        {
                            ChannelId     = $"channel_{channelId}",
                            LaneId        = $"{j:D2}",
                            Timestamp     = timestamp,
                            Bikes         = now.Minute,
                            Buss          = now.Minute,
                            Cars          = now.Minute,
                            Motorcycles   = now.Minute,
                            Persons       = now.Minute,
                            Tricycles     = now.Minute,
                            Trucks        = now.Minute,
                            Vans          = now.Minute,
                            AverageSpeed  = now.Minute,
                            HeadSpace     = now.Minute,
                            HeadDistance  = now.Minute,
                            Occupancy     = now.Minute,
                            TimeOccupancy = now.Minute,
                            TrafficStatus = TrafficStatus.通畅
                        };
                    }
                    else
                    {
                        flow.Data[j - 1] = new LaneAdapterData
                        {
                            ChannelId     = $"channel_{channelId}",
                            LaneId        = $"{j:D2}",
                            Timestamp     = timestamp,
                            Bikes         = 1,
                            Buss          = 1,
                            Cars          = 1,
                            Motorcycles   = 1,
                            Persons       = 1,
                            Tricycles     = 1,
                            Trucks        = 1,
                            Vans          = 1,
                            AverageSpeed  = 1,
                            HeadSpace     = 1,
                            HeadDistance  = 1,
                            Occupancy     = 1,
                            TimeOccupancy = 1,
                            TrafficStatus = TrafficStatus.通畅
                        };
                    }
                }
                WebSocketMiddleware.Broadcast(url, flow);

                channelId += 1;
            }
        }
Пример #6
0
        /// <summary>
        /// 处理接收字节流
        /// </summary>
        /// <param name="buffer">字节流</param>
        /// <param name="size">字节流长度</param>
        /// <param name="remoteEndPoint">远程地址</param>
        public void Handle(byte[] buffer, int size, IPEndPoint remoteEndPoint = null)
        {
            ReceiveSize += Convert.ToUInt32(size);

            Log(remoteEndPoint == null
                ? $"{Socket.Handle} + {size} {ByteConvert.ToHex(buffer, size)}"
                : $"{Socket.Handle} {remoteEndPoint} + {size} {ByteConvert.ToHex(buffer, size)}");

            _residueBuffer.AddRange(buffer.Take(size));

            int offset = 0;

            do
            {
                SocketPack packet = _handler.Unpack(Socket, remoteEndPoint, _residueBuffer, offset);
                if (packet.Result == AnalysisResult.Full)
                {
                    ReceivedEventArgs args = new ReceivedEventArgs
                    {
                        Socket         = Socket,
                        RemoteEndPoint = remoteEndPoint,
                        Channel        = this,
                        Buffer         = _residueBuffer.GetRange(packet.Offset, packet.Size),
                        ProtocolId     = packet.ProtocolId,
                        TimeStamp      = packet.TimeStamp
                    };
                    long timeStamp = TimeStampConvert.ToUtcTimeStamp();
                    lock (_lockObj)
                    {
                        LinkedListNode <ResponseItem> node = _responseItems.First;
                        while (node != null)
                        {
                            if (node.Value.TimeStamp >= timeStamp)
                            {
                                if (node.Value.Match(args))
                                {
                                    if (node.Value.Action == null)
                                    {
                                        node.Value.ReceiveBuffer?.AddRange(args.Buffer);
                                        node.Value.ResetEvent.Set();
                                    }
                                    else
                                    {
                                        node.Value.Action(args);
                                    }
                                    LinkedListNode <ResponseItem> nextNode = node.Next;
                                    _responseItems.Remove(node);
                                    node = nextNode;
                                }
                                else
                                {
                                    node = node.Next;
                                }
                            }
                            else
                            {
                                LinkedListNode <ResponseItem> nextNode = node.Next;
                                _responseItems.Remove(node);
                                node = nextNode;
                            }
                        }
                    }


                    Received?.Invoke(this, args);
                }
                else if (packet.Result == AnalysisResult.Half)
                {
                    _residueBuffer.RemoveRange(0, offset);
                    return;
                }
                offset += packet.Offset + packet.Size;
            } while (offset < _residueBuffer.Count);
            _residueBuffer.Clear();
        }