Beispiel #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.");
            }
        }
Beispiel #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;
            }
        }
Beispiel #3
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.");
            }
        }