public static byte[] FromGSM7BitPacked(byte[] bytes) { BitStream stream = new BitStream(new byte[0]); byte[] bytesa = new byte[bytes.Length]; for (int i = 0, j = bytes.Length - 1; i < bytes.Length; i++, j--) bytesa[j] = bytes[i]; string stra = stream.ToBitString(bytesa); string strb = ""; for (int i = stra.Length-1; (i/7) > 0; i -= 7) strb = string.Format("{0}0{1}", strb, stra.Substring(i - 6, 7)); stream.parseBitString(strb); byte[] bytese = stream.ToBytes(); return bytese; }
public static byte[] ToGSM7BitPacked(byte[] bytes) { BitStream stream = new BitStream(new byte[0]); string strb = stream.ToBitString(bytes); string strc = ""; for (int i = 1; i < strb.Length; i += 8) { strc = string.Format("{0}{1}", strb.Substring(i, 7), strc); } while (strc.Length % 8 > 0) strc = string.Format("{0}{1}", 0, strc); stream.parseBitString(strc); byte[] bytesd = stream.ToBytes(); byte[] bytese = new byte[bytesd.Length]; for (int i = 0, j = bytesd.Length - 1; i < bytesd.Length; i++, j--) bytese[j] = bytesd[i]; return bytese; }
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; }
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; }
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; }
//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; }
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(); }
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(); }
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; }
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(); }
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(); }
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; }
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(); }
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(); }
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(); }
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; }
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; }
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(); }
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; }
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; }
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(); }
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(); }
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; }
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; }
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(); }