Exemple #1
0
        static void Main(string[] args)
        {
            var imei = TeleofisHelper.GetNewImei();
            AsyncWrxTcpDeviceAuthorizer deviceAuthorizer = new AsyncWrxTcpDeviceAuthorizer(0, imei, "0.1", "1.0", "0000", WrxTcpChannelType.Service);
            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000);
            var        socket   = SocketFactory.Instance.Create(SocketType.Stream, ProtocolType.Tcp);

            socket.ConnectAsync(endPoint);
            SimpleSocketInputStream  inputStream  = new SimpleSocketInputStream(socket);
            SimpleSocketOutputStream outputStream = new SimpleSocketOutputStream(socket);
            var model = new TeleofisModel(imei)
            {
                AuthorizeSettingsPassword = "******",
                WrxGsmMode                 = WrxGsmMode.ThreeG,
                DiagnosticsLevel           = WrxDiagnosticsLevel.Messages,
                OutputAlarmDueTimeMinutes  = 0,
                OutputAlarmDurationSeconds = 0,
                OutputAlarmSchedule        = 0,
                OutputAlarmType            = WrxAlarmType.Monthly
            };
            AsyncWrxCommandHandler handler          = new AsyncWrxCommandHandler(model);
            WrxPacketReader        reader           = new WrxPacketReader(inputStream);
            WrxPacketWriter        writer           = new WrxPacketWriter(outputStream);
            WrxCommandServer       wrxCommandServer = new WrxCommandServer(inputStream, outputStream, handler);

            Authorize(reader, writer, deviceAuthorizer, wrxCommandServer);
            Console.WriteLine("Включился");
            Console.ReadKey();
        }
 public AsyncWrxCommandHandler(TeleofisModel teleofisModel)
 {
     _model = teleofisModel;
 }