コード例 #1
0
ファイル: SMSMessages.cpp プロジェクト: 57-Wolve/OpenBTS-UMTS
void TLUserData::write(TLFrame& dest, size_t& wp) const
{
#if 1
	// First write TP-User-Data-Length
	dest.writeField(wp,mLength,8);

	// Then write TP-User-Data
	// This tail() works because UD is always the last field in the PDU.
	BitVector ud_dest = dest.tail(wp);
	mRawData.copyTo(ud_dest);
	ud_dest.LSB8MSB();
#else
	// Stuff we don't support...
	assert(!mUDHI);
	assert(mDCS==0);
	unsigned numChar = strlen(mData);
	dest.writeField(wp,numChar,8);
	// This tail() works because UD is always the last field in the PDU.
	BitVector chars = dest.tail(wp);
	chars.zero();
	for (unsigned i=0; i<numChar; i++) {
		char gsm = encodeGSMChar(mData[i]);
		dest.writeFieldReversed(wp,gsm,7);
	}
	chars.LSB8MSB();
#endif
}
コード例 #2
0
void TLUserData::write(TLFrame& dest, size_t& wp) const
{
	// Stuff we don't support...
	assert(!mUDHI);
	assert(mDCS==0);
	unsigned numChar = strlen(mData);
	dest.writeField(wp,numChar,8);
	// This tail() works because UD is always the last field in the PDU.
	BitVector chars = dest.tail(wp);
	chars.zero();
	for (unsigned i=0; i<numChar; i++) {
		char gsm = encodeGSMChar(mData[i]);
		dest.writeFieldReversed(wp,gsm,7);
	}
	chars.LSB8MSB();
}
コード例 #3
0
ファイル: FEC.cpp プロジェクト: 84danielwhite/openbts
// Return decoded frame if success and B == 3, otherwise NULL.
static BitVector *decodeLowSide(const RxBurst &inBurst, int B, GprsDecoder &decoder, ChannelCodingType *ccPtr)
{
	inBurst.data1().copyToSegment(decoder.mI[B],0);
	inBurst.data2().copyToSegment(decoder.mI[B],57);
	// Save the stealing bits:
	// TODO: Save these as floats and do a correlation to pick the encoding.
	decoder.qbits[2*B] = inBurst.Hl();
	decoder.qbits[2*B+1] = inBurst.Hu();

	if (B != 3) { return NULL; }

	decoder.deinterleave();

	bool success;
	BitVector *result;
	switch ((*ccPtr = decoder.getCS())) {
	case ChannelCodingCS4:
		success = decoder.decodeCS4();
		LOG(DEBUG) << "CS-4 success=" << success;
		result = &decoder.mD_CS4;
		break;
	case ChannelCodingCS1:
		success = decoder.decode();
		LOG(DEBUG) << "CS-1 success=" << success;
		result = &decoder.mD;
		break;
	default: devassert(0);	// Others not supported yet.
		return NULL;
	}

	if (success) {
		result->LSB8MSB();
		return result;
	}
	return NULL;
}