Example #1
0
        public RFIDDetectado(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            var d = Devices.I().FindById(this_pdu.IdDispositivo);

            switch (CL)
            {
            case 0x00:
                IdTarjeta = UrbetrackCodec.DecodeString(buffer, ref pos);
                Posicion  = UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                Status    = 0xFE;
                break;

            case 0x20:
                IdTarjeta = UrbetrackCodec.DecodeString(buffer, ref pos);
                Posicion  = d.SupportsGPSPointEx ? UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d) : UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                Status    = UrbetrackCodec.DecodeByte(buffer, ref pos);
                break;

            default:
                throw new Exception("No conincide CL con el Tipo RFID Detectado.");
            }
        }
Example #2
0
        public ExcesoVelocidad(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            switch (CL)
            {
            case 0x10:
            {
                var d = Devices.I().FindById(IdDispositivo);
                PosicionDeAviso          = null;
                PosicionDeTicket         = d.SupportsGPSPointEx ? UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d) : UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                PosicionFinal            = d.SupportsGPSPointEx ? UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d) : UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                VelocidadMaximaPermitida = UrbetrackCodec.DecodeFloat(buffer, ref pos);
                VelocidadMaximaAlcanzada = UrbetrackCodec.DecodeFloat(buffer, ref pos);
            }
            break;

            case 0x11:
            {
                var d = Devices.I().FindById(IdDispositivo);
                PosicionDeAviso          = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
                PosicionDeTicket         = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
                PosicionFinal            = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
                VelocidadMaximaPermitida = UrbetrackCodec.DecodeFloat(buffer, ref pos);
                VelocidadMaximaAlcanzada = UrbetrackCodec.DecodeFloat(buffer, ref pos);
                RiderIdentifier          = Encoding.ASCII.GetString(UrbetrackCodec.DecodeBytes(buffer, ref pos, 10));
            }
            break;
            }
        }
Example #3
0
        public LoginRechazado(byte[] buffer, int pos)
        {
            Entrante = true;
            PDU this_pdu = this;

            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
        }
Example #4
0
        public Heartbeat(byte[] buffer, int pos)
        {
            Entrante = true;
            PDU this_pdu = this;

            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            signature = UrbetrackCodec.DecodeString(buffer, ref pos);
        }
Example #5
0
        public LoginAceptado(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            IdAsignado = UrbetrackCodec.DecodeShort(buffer, ref pos);
        }
Example #6
0
        public RemoteShell(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            Order       = UrbetrackCodec.DecodeInteger(buffer, ref pos);
            CommandLine = UrbetrackCodec.DecodeString(buffer, ref pos);
        }
Example #7
0
        public Command(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            var size = UrbetrackCodec.DecodeShort(buffer, ref pos);

            Datos = size > 0 ? UrbetrackCodec.DecodeBytes(buffer, ref pos, size) : null;
        }
Example #8
0
        public DataPage(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            if (CL != 0x00)
            {
                throw new Exception("No conincide CL con el Tipo FOTA DATA.");
            }
            Pagina = UrbetrackCodec.DecodeShort(buffer, ref pos);
            Buffer = UrbetrackCodec.DecodeBytes(buffer, ref pos, 512);
        }
Example #9
0
 public SystemReport(byte[] buffer, int pos)
 {
     PDU this_pdu = this;
     Entrante = true;
     UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
     SystemResets = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     WatchDogResets = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     GPS_FixedSeconds = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     GPS_BlindSeconds = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     GPS_Resets = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     NETWORK_UDP_ReceivedBytes = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     NETWORK_UDP_SentBytes = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     NETWORK_UDP_ReceivedDgrams = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     NETWORK_UDP_SentDgrams = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     NETWORK_Resets = UrbetrackCodec.DecodeInteger(buffer, ref pos);
     MODEM_Resets = UrbetrackCodec.DecodeInteger(buffer, ref pos);
 }
Example #10
0
        public Evento(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            var d = Devices.I().FindById(this_pdu.IdDispositivo);

            Posicion     = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
            CodigoEvento = UrbetrackCodec.DecodeShort(buffer, ref pos);
            Datos        = UrbetrackCodec.DecodeInteger(buffer, ref pos);
            Payload      = null;
            switch (CL)
            {
            case 0xFF:
                PayloadSize   = 0;
                Extra         = 0;
                RiderRevision = -1;
                if (d.Type == DeviceTypes.Types.URBETRACK_v1_0 ||
                    d.Type == DeviceTypes.Types.URBETRACK_v0_8 ||
                    d.Type == DeviceTypes.Types.URBETRACK_v0_8n)
                {
                    RiderIdentifier = Encoding.ASCII.GetString(UrbetrackCodec.DecodeBytes(buffer, ref pos, 10));
                    if (String.IsNullOrEmpty(RiderIdentifier))
                    {
                        RiderIdentifier = "0000000000";
                    }
                }
                else
                {
                    RiderIdentifier = "0000000000";
                }
                break;

            case 0xFE:
                RiderIdentifier = Encoding.ASCII.GetString(UrbetrackCodec.DecodeBytes(buffer, ref pos, 10));
                RiderRevision   = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                Extra           = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                PayloadSize     = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                if (PayloadSize > 0)
                {
                    Payload = UrbetrackCodec.DecodeBytes(buffer, ref pos, PayloadSize);
                }
                break;
            }
        }
Example #11
0
        public Posicion(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            puntos.Clear();
            switch (CL)
            {
            case 0x00:
                try
                {
                    var point = UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                    if (point != null)
                    {
                        puntos.Add(point);
                    }
                } catch (Exception e)
                {
                    STrace.Exception(GetType().FullName, e);
                }
                break;

            case 0x01:
            {
                var items = UrbetrackCodec.DecodeByte(buffer, ref pos);
                Posiciones = items;
                while (items-- > 0)
                {
                    try
                    {
                        var point = UrbetrackCodec.DecodeGPSPoint(buffer, ref pos);
                        if (point != null)
                        {
                            puntos.Add(point);
                        }
                    } catch (Exception e)
                    {
                        STrace.Exception(GetType().FullName, e);
                    }
                }
            }
            break;

            case 0x02:
            {
                var items = UrbetrackCodec.DecodeByte(buffer, ref pos);
                var d     = Devices.I().FindById(this_pdu.IdDispositivo);
                while (items-- > 0)
                {
                    try
                    {
                        var point = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
                        if (point != null)
                        {
                            puntos.Add(point);
                        }
                    }
                    catch (Exception e)
                    {
                        STrace.Exception(GetType().FullName, e);
                    }
                }
            }
            break;

            default:
                throw new Exception("DAC, Subtipo de mensaje de posicion desconocido.");
            }
        }
Example #12
0
        public LoginRequest(byte[] buffer, int pos)
        {
            PDU this_pdu = this;

            Entrante = true;
            UrbetrackCodec.DecodeHeaders(buffer, ref this_pdu, ref pos);
            IMEI           = UrbetrackCodec.DecodeString(buffer, ref pos);
            Password       = UrbetrackCodec.DecodeString(buffer, ref pos);
            Firmware       = UrbetrackCodec.DecodeString(buffer, ref pos);
            ConfigRevision = UrbetrackCodec.DecodeShort(buffer, ref pos);
            var d = Fleet.Devices.I().FindById(IdDispositivo);

            switch (CL)
            {
            case 0x00:
                DetectedDeviceType = DeviceTypes.Types.SISTELCOM_v1;
                break;

            case 0x01:
                PendingMessages    = UrbetrackCodec.DecodeShort(buffer, ref pos);
                DetectedDeviceType = DeviceTypes.Types.SISTELCOM_v2;
                break;

            case 0x02:
                DetectedDeviceType = DeviceTypes.Types.URB_v0_5;
                break;

            case 0x04:
                DetectedDeviceType = DeviceTypes.Types.URBMOBILE_v0_1;
                break;

            case 0x06:
                DetectedDeviceType = DeviceTypes.Types.URB_v0_7;
                QTreeRevision      = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                XbeeHardware       = UrbetrackCodec.DecodeString(buffer, ref pos);
                XbeeFirmware       = UrbetrackCodec.DecodeString(buffer, ref pos);
                break;

            case 0x10:
                DetectedDeviceType = DeviceTypes.Types.URBETRACK_v0_8n;
                QTreeRevision      = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                XbeeHardware       = UrbetrackCodec.DecodeString(buffer, ref pos);
                XbeeFirmware       = UrbetrackCodec.DecodeString(buffer, ref pos);
                SecureId           = UrbetrackCodec.DecodeString(buffer, ref pos);
                break;

            case 0x11:
            case 0x12:
            case 0x13:
            case 0x14:
                DetectedDeviceType = CL <= 0x12 ? DeviceTypes.Types.URBETRACK_v0_8 : DeviceTypes.Types.URBETRACK_v1_0;
                QTreeRevision      = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                if (CL > 0x12)
                {
                    MessagesRevision = UrbetrackCodec.DecodeInteger(buffer, ref pos);
                }
                XbeeHardware = UrbetrackCodec.DecodeString(buffer, ref pos);
                XbeeFirmware = UrbetrackCodec.DecodeString(buffer, ref pos);
                SecureId     = UrbetrackCodec.DecodeString(buffer, ref pos);
                if (CL == 0x11 || CL == 0x13)
                {
                    GPSPoint        = UrbetrackCodec.DecodeGPSPointEx(buffer, ref pos, d);
                    RiderIdentifier = Encoding.ASCII.GetString(UrbetrackCodec.DecodeBytes(buffer, ref pos, 10));
                }
                break;

            default:
                DetectedDeviceType = DeviceTypes.Types.UNKNOW_DEVICE;
                break;
            }
        }