Пример #1
0
 private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     BitStream con = new BitStream(new byte[12]);
       byte[] bs = con.getValueArray(4097);
       string value = HexAscii.ConvertToHexAsciiFromBytes(bs);
       //con.parseBitString("100000000001");
       //value = con.ToString();
       int val = 0;
       //control word
       val = 0;
       con.insertIntoArray(val, 0, 4);
       //messagetype
       val = 3;
       con.insertIntoArray(val, 4, 3);
       //signo
       val = 1;
       con.insertIntoArray(val, 7, 1);
       //grados
       val = 24;
       con.insertIntoArray(val, 8, 11);
       //minutos
       val = 6;
       con.insertIntoArray(val, 16, 6);
       //segundos
       val = 31;
       con.insertIntoArray(val, 22, 6);
       //centesimas segundos
       val = 27;
       con.insertIntoArray(val, 28, 7);
 }
Пример #2
0
        public byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[HeaderLenBytes]);

              stream.insertIntoArray((int)ProtocolType, offset, ProtocolTypeLen);
              offset += ProtocolTypeLen;

              stream.insertIntoArray((int)ProtocolVersionNumber, offset, ProtocolVersionNumberLen);
              offset += ProtocolVersionNumberLen;

              stream.insertIntoArray((int)MOMessageType, offset, MOMessageTypeLen);
              offset += MOMessageTypeLen;

              stream.insertIntoArray((int)Timestamp, offset, TimestampLen);
              offset += TimestampLen;

              stream.insertIntoArray((int)EmergencyFlag, offset, EmergencyFlagLen);
              offset += EmergencyFlagLen;

              return stream.ToBytes();
        }
Пример #3
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              byte[] array = new byte[0];

              array = data.ToBytes(SynchronisationLenBytes);

              BitStream stream = new BitStream(new byte[SynchronisationLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }

              stream.insertIntoArray((int)dataType, offset, DataTypeLen);
              offset += DataTypeLen;
              byte[] resp = stream.ToBytes();

              int boffset = offset / 8;

              resp = stream.ToBytes();
              byte[] tempBytes = array;

              resp[boffset] = (byte)array.Length;
              boffset++;
              for (int i = 0; i < tempBytes.Length; i++)
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = tempBytes[i];
              }

              return resp;
        }
Пример #4
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[BlockLengthBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)GeofenceStatus, offset, GeofenceStatusLen);
              offset += GeofenceStatusLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }
Пример #5
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[DiagnosticsLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }

              stream.insertIntoArray((int)BatteryVoltage, offset, BatteryVoltageLen);
              offset += BatteryVoltageLen;

              stream.insertIntoArray((int)ChargerStatus, offset, ChargerStatusLen);
              offset += ChargerStatusLen;

              stream.insertIntoArray((int)AccumulatorRange, offset, AccumulatorRangeLen);
              offset += AccumulatorRangeLen;

              stream.insertIntoArray((int)VisibleGPSSatellites, offset, VisisbleGPSSatellitesLen);
              offset += VisisbleGPSSatellitesLen;

              byte[] tempBytes = stream.ToBytes();
              byte[] FreeTextBytes = FreeText.ToBytes();

              offset /= 8;
              for (int i = 0; i < FreeTextBytes.Length; i++)
              {
            if ((i + offset) >= tempBytes.Length)
              break;
            tempBytes[i + offset] = FreeTextBytes[i];
              }

              return tempBytes;
        }
Пример #6
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[DataBlockCircleLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)AlertWhenCrossed, offset, AlertWhenCrossedLen);
              offset += AlertWhenCrossedLen;

              stream.insertIntoArray((int)FenceHysteresisUnits, offset, FenceHysteresisUnitsLen);
              offset += FenceHysteresisUnitsLen;

              stream.insertIntoArray((int)FenceHysteresis, offset, FenceHysteresisLen);
              offset += FenceHysteresisLen;

              stream.insertIntoArray((int)FenceProximityUnits, offset, FenceProximityUnitsLen);
              offset += FenceProximityUnitsLen;

              stream.insertIntoArray((int)FenceProximity, offset, FenceProximityLen);
              offset += FenceProximityLen;

              stream.insertIntoArray((int)RefreshRateInMinutes, offset, RefreshRateInMinutesLen);
              offset += RefreshRateInMinutesLen;

              stream.insertIntoArray((int)LatitudeMinutes, offset, LatitudeMinutesLen);
              offset += LatitudeMinutesLen;

              stream.insertIntoArray((int)LatitudeMinutesDecimal, offset, LatitudeMinutesDecimalLen);
              offset += LatitudeMinutesDecimalLen;

              stream.insertIntoArray((int)LongitudeHemisphere, offset, LongitudeHemisphereLen);
              offset += LongitudeHemisphereLen;

              stream.insertIntoArray((int)LongitudeDegrees, offset, LongitudeDegreesLen);
              offset += LongitudeDegreesLen;

              stream.insertIntoArray((int)LongitudeMinutes, offset, LongitudeMinutesLen);
              offset += LongitudeMinutesLen;

              stream.insertIntoArray((int)LongitudeMinutesDecimal, offset, LongitudeMinutesDecimalLen);
              offset += LongitudeMinutesDecimalLen;

              stream.insertIntoArray((int)RadiusMeasurement, offset, RadiusMeasurementLen);
              offset += RadiusMeasurementLen;

              stream.insertIntoArray((int)RadiusLength, offset, RadiusLengthLen);
              offset += RadiusLengthLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }
Пример #7
0
        public byte[] ToBytes()
        {
            int offset = 0;
              byte[] buff = new byte[0];
              BitStream stream = new BitStream(new byte[FreeTextLenBytes]);

              stream.insertIntoArray((int)FreeTextLengthIndicator, offset, FreeTextLengthIndicatorLen);
              offset += FreeTextLengthIndicatorLen;

              if (FreeTextLengthIndicator == 0)
            FreeTextLengthLen = 7;
              else
            FreeTextLengthLen = 15;

              stream.insertIntoArray((int)FreeTextLength, offset, FreeTextLengthLen);
              offset += FreeTextLengthLen;

              if (BytesText.Length >= 128)
              {
            stream.insertIntoArray((int)DecodeTextIndicator, offset, DecodeTextIndicatorLen);
            offset += DecodeTextIndicatorLen;
            //int rest = 1;
            if (DecodeTextIndicator == 0)
              DecodeTextLengthLen = 7;
            else
            {
              DecodeTextLengthLen = 15;
              //rest = 2;
            }
            stream.insertIntoArray((int)DecodeTextLength, offset, DecodeTextLengthLen);
            offset += DecodeTextLengthLen;
              }

              int boffset = offset / 8;
              byte[] tempBytes = BytesText;//GsmUtils.ToGSM7BitPacked(FreeText);
              byte[] resp = new byte[boffset + tempBytes.Length];
              stream.ToBytes().CopyTo(resp, 0);

              for (int i = 0; i < tempBytes.Length; i++)
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = tempBytes[i];
              }

              //byte[] len = new byte[1];
              //len[0] = (byte)BytesText.Length;

              //len = HexAscii.ConvertToBytes(HexAscii.ConvertToHexAsciiFromBytes(len));

              //byte[] array = new byte[tempBytes.Length + 1];
              //len.CopyTo(array, 0);
              //tempBytes.CopyTo(array, len.Length);

              //byte[] resp = new byte[boffset + array.Length + 1];
              //stream.ToBytes().CopyTo(resp, 0);

              //for (int i = 0; i < array.Length; i++)
              //{
              //  if ((i + boffset) >= resp.Length)
              //    break;
              //  resp[i + boffset] = array[i];
              //}

              return resp;
        }
Пример #8
0
        public byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[HeaderLenBytes]);

              stream.insertIntoArray((int)ProtocolType, offset, ProtocolTypeLen);
              offset += ProtocolTypeLen;

              stream.insertIntoArray((int)ProtocolVersionNumber, offset, ProtocolVersionNumberLen);
              offset += ProtocolVersionNumberLen;

              stream.insertIntoArray((int)messageType, offset, MTMessageTypeLen);
              offset += MTMessageTypeLen;

              stream.insertIntoArray((int)MessageIdentifier, offset, MessageIdentifierLen);
              offset += MessageIdentifierLen;

              return stream.ToBytes();
        }
Пример #9
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[PortalStatusLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }

              stream.insertIntoArray((int)Status, offset, StatusLen);
              offset += StatusLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              int boffset = offset / 8;

              byte[] tempBytes = GsmUtils.ToGSM7BitPacked(FreeText);
              byte[] len = new byte[1];
              len[0] = (byte)FreeText.Length;//tempBytes

              len = HexAscii.ConvertToBytes(HexAscii.ConvertToHexAsciiFromBytes(len));

              byte[] array = new byte[tempBytes.Length + 1];
              len.CopyTo(array, 0);
              tempBytes.CopyTo(array, len.Length);

              byte[] resp = new byte[boffset + array.Length];
              stream.ToBytes().CopyTo(resp, 0);

              for (int i = 0; i < array.Length; i++)//tempBytes
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = array[i];
              }
              return resp;
        }
Пример #10
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[lenPolygon]);

              var array = points.ToBytes(lenPolygon,listPoints);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)AlertWhenCrossed, offset, AlertWhenCrossedLen);
              offset += AlertWhenCrossedLen;

              stream.insertIntoArray((int)FenceHysteresisUnits, offset, FenceHysteresisUnitsLen);
              offset += FenceHysteresisUnitsLen;

              stream.insertIntoArray((int)FenceHysteresis, offset, FenceHysteresisLen);
              offset += FenceHysteresisLen;

              stream.insertIntoArray((int)FenceProximityUnits, offset, FenceProximityUnitsLen);
              offset += FenceProximityUnitsLen;

              stream.insertIntoArray((int)FenceProximity, offset, FenceProximityLen);
              offset += FenceProximityLen;

              stream.insertIntoArray((int)RefreshRateInMinutes, offset, RefreshRateInMinutesLen);
              offset += RefreshRateInMinutesLen;

              int boffset = offset / 8;

              byte[] resp = stream.ToBytes();
              byte[] tempBytes = array;

              for (int i = 0; i < tempBytes.Length; i++)
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = tempBytes[i];
              }

              return resp;
        }
Пример #11
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[PhoneSettingsLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }

              stream.insertIntoArray((int)ReportingFrecuencyRate, offset, ReportingFrecuencyRateLen);
              offset += ReportingFrecuencyRateLen;

              stream.insertIntoArray((int)ReportingFrecuencyRateUnits, offset, ReportingFrecuencyRateUnitsLen);
              offset += ReportingFrecuencyRateUnitsLen;

              stream.insertIntoArray((int)EmergencyDestination, offset, EmergencyDestinationLen);
              offset += EmergencyDestinationLen;

              stream.insertIntoArray((int)MessageEncoding, offset, MessageEncodingLen);
              offset += MessageEncodingLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;
              int boffset = offset / 8;

              byte[] resp = stream.ToBytes();
              byte[] tempBytes = GsmUtils.ToGSM7BitPacked(EmergencyCallRecipient);

              resp[boffset] = (byte)EmergencyCallRecipientLength;
              boffset++;
              for (int i = 0; i < tempBytes.Length; i++)
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = tempBytes[i];
              }
              return resp;
        }
Пример #12
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[MessageIdentifierLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)MessageIdentifier, offset, MessageIdentifierLen);
              offset += MessageIdentifierLen;

              return stream.ToBytes();
        }
Пример #13
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[LocationLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)LatitudeHemisphere, offset, LatitudeHemisphereLen);
              offset += LatitudeHemisphereLen;

              stream.insertIntoArray((int)LatitudeDegrees, offset, LatitudeDegreesLen);
              offset += LatitudeDegreesLen;

              stream.insertIntoArray((int)LatitudeMinutes, offset, LatitudeMinutesLen);
              offset += LatitudeMinutesLen;

              stream.insertIntoArray((int)LatitudeMinutesDecimal, offset, LongitudeMinutesDecimalLen);
              offset += LatitudeMinutesDecimalLen;

              stream.insertIntoArray((int)LongitudeHemisphere, offset, LongitudeHemisphereLen);
              offset += LongitudeHemisphereLen;

              stream.insertIntoArray((int)LongitudeDegrees, offset, LongitudeDegreesLen);
              offset += LongitudeDegreesLen;

              stream.insertIntoArray((int)LongitudeMinutes, offset, LongitudeMinutesLen);
              offset += LongitudeMinutesLen;

              stream.insertIntoArray((int)LongitudeMinutesDecimal, offset, LongitudeMinutesDecimalLen);
              offset += LongitudeMinutesDecimalLen;

              stream.insertIntoArray((int)SpeedOverGround, offset, SpeedOverGroundLen);
              offset += SpeedOverGroundLen;

              stream.insertIntoArray((int)VelocityDirection, offset, VelocityDirectionLen);
              offset += VelocityDirectionLen;

              stream.insertIntoArray((int)CourseOverGround, offset, CourseOverGroundLen);
              offset += CourseOverGroundLen;

              stream.insertIntoArray((int)AltitudeSign, offset, AltitudeSignLen);
              offset += AltitudeSignLen;

              stream.insertIntoArray((int)Altitude, offset, AltitudeLen);
              offset += AltitudeLen;

              stream.insertIntoArray((int)Source, offset, SourceLen);
              offset += SourceLen;

              stream.insertIntoArray((int)LatitudeAccuracyMeasurement, offset, LatitudeAccuracyMeasurementLen);
              offset += LatitudeAccuracyMeasurementLen;

              stream.insertIntoArray((int)LatitudeAccuracy, offset, LatitudeAccuracyLen);
              offset += LatitudeAccuracyLen;

              stream.insertIntoArray((int)LongitudeAccuracyMeasurement, offset, LongitudeAccuracyMeasurementLen);
              offset += LongitudeAccuracyMeasurementLen;

              stream.insertIntoArray((int)LongitudeAccuracy, offset, LongitudeAccuracyLen);
              offset += LongitudeAccuracyLen;

              stream.insertIntoArray((int)AltitudeAccuracyMeasurement, offset, AltitudeAccuracyMeasurementLen);
              offset += AltitudeAccuracyMeasurementLen;

              stream.insertIntoArray((int)AltitudeAccuracy, offset, AltitudeAccuracyLen);
              offset += AltitudeAccuracyLen;

              stream.insertIntoArray((int)IsValid, offset, IsValidLen);
              offset += IsValidLen;

              stream.insertIntoArray((int)GPSTimestampUTCYear, offset, GPSTimestampUTCYearLen);
              offset += GPSTimestampUTCYearLen;

              stream.insertIntoArray((int)GPSTimestampUTCMonth, offset, GPSTimestampUTCMonthLen);
              offset += GPSTimestampUTCMonthLen;

              stream.insertIntoArray((int)GPSTimestampUTCDay, offset, GPSTimestampUTCDayLen);
              offset += GPSTimestampUTCDayLen;

              stream.insertIntoArray((int)GPSTimestampUTCHours, offset, GPSTimestampUTCHoursLen);
              offset += GPSTimestampUTCHoursLen;

              stream.insertIntoArray((int)GPSTimestampUTCMinutes, offset, GPSTimestampUTCMinutesLen);
              offset += GPSTimestampUTCMinutesLen;

              stream.insertIntoArray((int)GPSTimestampUTCSeconds, offset, GPSTimestampUTCSecondsLen);
              offset += GPSTimestampUTCSecondsLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }
Пример #14
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[HandsetFwHwVersionLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              byte[] tempBytes = stream.ToBytes();
              byte[] FreeTextBytes = FreeText.ToBytes();

              offset /= 8;
              for (int i = 0; i < FreeTextBytes.Length; i++)
              {
            if ((i + offset) >= tempBytes.Length)
              break;
            tempBytes[i + offset] = FreeTextBytes[i];
              }

              return tempBytes;
        }
Пример #15
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              byte[] buff = new byte[0];
              BitStream stream = new BitStream(new byte[BlockLengthBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
              offset += BlockLengthBytesLen;

              stream.insertIntoArray((int)CannedMessageNumber, offset, CannedMessageNumberLen);
              offset += CannedMessageNumberLen;

              stream.insertIntoArray((int)CannedMessageNumber, offset, CannedMessageNumberLen);
              offset += CannedMessageNumberLen;

              buff = stream.ToBytes();
              return buff;
        }
Пример #16
0
        public byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[HeaderLenBytes]);

              stream.insertIntoArray((int)ProtocolType, offset, ProtocolTypeLen);
              offset += ProtocolTypeLen;

              stream.insertIntoArray((int)ProtocolVersionNumber, offset, ProtocolVersionNumberLen);
              offset += ProtocolVersionNumberLen;

              stream.insertIntoArray((int)LanguageIdentifierFirstLetter, offset, LanguageIdentifierFirstLetterLen);
              offset += LanguageIdentifierFirstLetterLen;

              stream.insertIntoArray((int)LanguageIdentifierSecondLetter, offset, LanguageIdentifierSecondLetterLen);
              offset += LanguageIdentifierSecondLetterLen;

              stream.insertIntoArray((int)MOMessageType, offset, MOMessageTypeLen);
              offset += MOMessageTypeLen;

              stream.insertIntoArray((int)SequenceNumber, offset, SequenceNumberLen);
              offset += SequenceNumberLen;

              stream.insertIntoArray((int)TimeStamp.Year, offset, TimestampUTCYearLen);
              offset += TimestampUTCYearLen;

              stream.insertIntoArray((int)TimeStamp.Month, offset, TimestampUTCMonthLen);
              offset += TimestampUTCMonthLen;

              stream.insertIntoArray((int)TimeStamp.Day, offset, TimestampUTCDayLen);
              offset += TimestampUTCDayLen;

              stream.insertIntoArray((int)TimeStamp.Hour, offset, TimestampUTCHoursLen);
              offset += TimestampUTCHoursLen;

              stream.insertIntoArray((int)TimeStamp.Minute, offset, TimestampUTCMinutesLen);
              offset += TimestampUTCMinutesLen;

              stream.insertIntoArray((int)TimeStamp.Second, offset, TimestampUTCSecondsLen);
              offset += TimestampUTCSecondsLen;

              stream.insertIntoArray((int)EmergencyFlag, offset, EmergencyFlagLen);
              offset += EmergencyFlagLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }
Пример #17
0
        public byte[] ToBytes(int SynchronisationLenBytes)
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[SynchronisationLenBytes]);

              stream.insertIntoArray((int)ProtocolType, offset, ProtocolTypeLen);
              offset += ProtocolTypeLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }
Пример #18
0
        public byte[] ToBytes(int lenPolygon, List<Point> listPoints)
        {
            int offset = 0;
              int tempOffset = 0;
              BitStream stream = new BitStream(new byte[lenPolygon]);

              foreach(Point p in listPoints)
              {
            if (tempOffset != 0)
            {
              offset = tempOffset;
            }
            stream.insertIntoArray((int)p.LatitudeHemisphere, offset, LatitudeHemisphereLen);
            offset += LatitudeHemisphereLen;

            stream.insertIntoArray((int)p.LatitudeDegrees, offset, LatitudeDegreesLen);
            offset += LatitudeDegreesLen;

            stream.insertIntoArray((int)p.LatitudeMinutes, offset, LatitudeMinutesLen);
            offset += LatitudeMinutesLen;

            stream.insertIntoArray((int)p.LatitudeMinutesDecimal, offset, LatitudeMinutesDecimalLen);
            offset += LatitudeMinutesDecimalLen;

            stream.insertIntoArray((int)p.LongitudeHemisphere, offset, LongitudeHemisphereLen);
            offset += LongitudeHemisphereLen;

            stream.insertIntoArray((int)p.LongitudeDegrees, offset, LongitudeDegreesLen);
            offset += LongitudeDegreesLen;

            stream.insertIntoArray((int)p.LongitudeMinutesDecimal, offset, LongitudeMinutesDecimalLen);
            offset += LongitudeMinutesDecimalLen;

            tempOffset = offset;
              }
              return stream.ToBytes();
        }
Пример #19
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream;

              if (IsReduced)
              {
            stream = new BitStream(new byte[ReducedLocationLenBytes - 2]);
              }
              else
              {
            stream = new BitStream(new byte[ReducedLocationLenBytes]);

            stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
            offset += BlockTypeLen;

            stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
            offset += BlockLengthIndicatorLen;

            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }

              stream.insertIntoArray((int)LatitudeHemisphere, offset, LatitudeHemisphereLen);
              offset += LatitudeHemisphereLen;

              stream.insertIntoArray((int)LatitudeDegrees, offset, LatitudeDegreesLen);
              offset += LatitudeDegreesLen;

              stream.insertIntoArray((int)LatitudeMinutes, offset, LatitudeMinutesLen);
              offset += LatitudeMinutesLen;

              stream.insertIntoArray((int)LatitudeMinutesDecimal, offset, LatitudeMinutesDecimalLen);
              offset += LatitudeMinutesDecimalLen;

              stream.insertIntoArray((int)LongitudeHemisphere, offset, LongitudeHemisphereLen);
              offset += LongitudeHemisphereLen;

              stream.insertIntoArray((int)LongitudeDegrees, offset, LongitudeDegreesLen);
              offset += LongitudeDegreesLen;

              stream.insertIntoArray((int)LongitudeMinutes, offset, LongitudeMinutesLen);
              offset += LongitudeMinutesLen;

              stream.insertIntoArray((int)LongitudeMinutesDecimal, offset, LongitudeMinutesDecimalLen);
              offset += LongitudeMinutesDecimalLen;

              stream.insertIntoArray((int)IsValid, offset, IsValidLen);
              offset += IsValidLen;

              stream.insertIntoArray((int)SourceOfFix, offset, SourceOfFixLen);
              offset += SourceOfFixLen;

              stream.insertIntoArray((int)AgeOfGPSFix, offset, AgeOfGPSFixLen);
              offset += AgeOfGPSFixLen;

              return stream.ToBytes();
        }
Пример #20
0
        //hacete este
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[CannedMessagesHashLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);

              offset += BlockLengthBytesLen;
              byte[] tempBytes = stream.ToBytes();
              offset /= 8;
              for (int i = 0; i < Hash.Length; i++)
              {
            if ((i + offset) >= tempBytes.Length)
              break;
            tempBytes[i + offset] = Hash[i];
              }
              return tempBytes;
        }
Пример #21
0
        public byte[] ToBytes(int SynchronisationLenBytes)
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[SynchronisationLenBytes]);

              stream.insertIntoArray((int)LanguageIdentifierFirstLetter, offset, LanguageIdentifierFirstLetterLen);
              offset += LanguageIdentifierFirstLetterLen;

              stream.insertIntoArray((int)LanguageIdentifierSecondLetter, offset, LanguageIdentifierSecondLetterLen);
              offset += LanguageIdentifierSecondLetterLen;

              stream.insertIntoArray((int)CannedMessageNumber, offset, CannedMessageNumberLen);
              offset += CannedMessageNumberLen;

              stream.insertIntoArray((int)IncludeLocation, offset, IncludeLocationLen);
              offset += IncludeLocationLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              int boffset = offset / 8;

              byte[] characterslen = CannedMessage;
              byte[] len = new byte[1];
              byte[] tempBytes = GsmUtils.ToGSM7BitPacked(CannedMessage);
              len[0] = (byte)characterslen.Length;//tempBytes

              len = HexAscii.ConvertToBytes(HexAscii.ConvertToHexAsciiFromBytes(len));

              byte[] array = new byte[tempBytes.Length + 1];
              len.CopyTo(array, 0);
              tempBytes.CopyTo(array, len.Length);

              byte[] resp = new byte[boffset + array.Length];
              stream.ToBytes().CopyTo(resp, 0);

              for (int i = 0; i < array.Length; i++)//tempBytes
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = array[i];
              }

              return resp;
        }
Пример #22
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[DeviceIdentifierLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }

              offset /= 8;
              byte[] tempBytes = stream.ToBytes();
              byte[] FreeTextBytes = FreeText.ToBytes();

              for (int i = 0; i < FreeTextBytes.Length; i++)
              {
            if ((i + offset) >= tempBytes.Length)
              break;
            tempBytes[i + offset] = FreeTextBytes[i];
              }

              return tempBytes;
        }
Пример #23
0
        public byte[] ToBytes(int SynchronisationLenBytes)
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[SynchronisationLenBytes]);

              stream.insertIntoArray((int)ReportingFrecuencyRate, offset, ReportingFrecuencyRateLen);
              offset += ReportingFrecuencyRateLen;

              stream.insertIntoArray((int)ReportingFrecuencyRateUnits, offset, ReportingFrecuencyRateUnitsLen);
              offset += ReportingFrecuencyRateUnitsLen;

              return stream.ToBytes();
        }
Пример #24
0
        public override byte[] ToBytes()
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[SenderLenBytes]);

              stream.insertIntoArray((int)blockType, offset, BlockTypeLen);
              offset += BlockTypeLen;

              stream.insertIntoArray((int)BlockLengthIndicator, offset, BlockLengthIndicatorLen);
              offset += BlockLengthIndicatorLen;

              if (BlockLengthIndicator == 0)
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthBytesLen);
            offset += BlockLengthBytesLen;
              }
              else
              {
            stream.insertIntoArray((int)BlockLengthBytes, offset, BlockLengthExtendedBytesLen);
            offset += BlockLengthExtendedBytesLen;
              }
              int boffset = offset / 8;

              byte[] resp = stream.ToBytes();
              byte[] tempBytes = GsmUtils.ToGSM7BitPacked(Sender);

              resp[boffset] = (byte)SenderLengthAndSender;
              boffset++;
              for (int i = 0; i < tempBytes.Length; i++)
              {
            if ((i + boffset) >= resp.Length)
              break;
            resp[i + boffset] = tempBytes[i];
              }
              return resp;
        }
Пример #25
0
        public byte[] ToBytes(int SynchronisationLenBytes)
        {
            int offset = 0;
              BitStream stream = new BitStream(new byte[SynchronisationLenBytes]);

              stream.insertIntoArray((int)EmergencyDestination, offset, EmergencyDestinationLen);
              offset += EmergencyDestinationLen;

              stream.insertIntoArray((int)Spare, offset, SpareLen);
              offset += SpareLen;

              return stream.ToBytes();
        }