[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10093 - openbts/branches/developers/dburgess00/smswor
From: |
dburgess00 |
Subject: |
[Commit-gnuradio] r10093 - openbts/branches/developers/dburgess00/smswork/SMS |
Date: |
Sat, 29 Nov 2008 21:12:27 -0700 (MST) |
Author: dburgess00
Date: 2008-11-29 21:12:27 -0700 (Sat, 29 Nov 2008)
New Revision: 10093
Removed:
openbts/branches/developers/dburgess00/smswork/SMS/SMSMessages.cpp
openbts/branches/developers/dburgess00/smswork/SMS/SMSMessages.h
Modified:
openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.cpp
openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.h
openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.cpp
openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.h
openbts/branches/developers/dburgess00/smswork/SMS/CMTest.cpp
openbts/branches/developers/dburgess00/smswork/SMS/Makefile.am
openbts/branches/developers/dburgess00/smswork/SMS/RLMessage.h
openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.cpp
openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.h
Log:
Starting to get SMS to compile again.
Modified: openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.cpp
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.cpp
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.cpp
2008-11-30 04:12:27 UTC (rev 10093)
@@ -71,18 +71,10 @@
CPMessage * retVal = CPFactory(MTI);
if( retVal==NULL ) return NULL;
- try {
- retVal->TIFlag(frame.TIFlag());
- retVal->TIValue(frame.TIValue());
- retVal->parse(frame);
- return retVal;
-
- }
-
- catch(const dvectorError &dverr) {
- L3_READ_ERROR;
- }
-
+ retVal->TIFlag(frame.TIFlag());
+ retVal->TIValue(frame.TIValue());
+ retVal->parse(frame);
+ return retVal;
}
@@ -94,39 +86,53 @@
-void CPMessage::write(L3Frame& dest, size_t start) const
+void CPMessage::write(L3Frame& dest) const
{
- if (dest.size() != (8*length()+ 16) ) dest.resize( 8*length() + 16);
- size_t wp = start;
- dest.writeField(wp, mTIFlag, 1);
- dest.writeField(wp, mTIValue, 3);
- dest.writeField(wp, PD(), 4);
- dest.writeField(wp, MTI(), 8);
-
+ // We override L3Message::write for the transaction identifier.
+ size_t l3len = bitsNeeded();
+ if (dest.size()!=l3len) dest.resize(l3len);
+ size_t wp = 0;
+ dest.writeField(wp,mTIFlag,1);
+ dest.writeField(wp,mTIValue,3);
+ dest.writeField(wp,PD(),4);
+ dest.writeField(wp,MTI(),8);
writeBody(dest, wp);
- dest.fixHistory();
}
void CPData::parseBody( const L3Frame& src, size_t &rp )
{
- mPayload = src.segmentAlias(24);
- DCOUT("CPData::parse = "<<mPayload<<" "<<mPayload.size())
+ mData.parseLV(src,rp);
}
void CPData::writeBody( L3Frame& dest, size_t &wp ) const
{
- mPayload.copyToSegment(dest, 24);
+ mData.writeLV(dest,wp);
}
void CPData::text(ostream& os) const
{
CPMessage::text(os);
- os<<"RPDU payload = ( "<<mPayload<<" )";
+ os << "RPDU=(" << mData << ")";
}
void CPError::writeBody( L3Frame& dest, size_t &wp ) const {
- dest.writeField(wp, mCause, 8);
+ mCause.writeV(dest,wp);
}
+void CPUserData::parseV(const L3Frame& src, size_t &rp, size_t expectedLength)
+{
+ unsigned numBits = expectedLength*8;
+ src.segmentCopyTo(mRPDU,rp,numBits);
+ rp += numBits;
+}
+void CPUserData::writeV(L3Frame& dest, size_t &wp) const
+{
+ unsigned numBits = mRPDU.size();
+ mRPDU.copyToSegment(dest,wp,numBits);
+ wp += numBits;
+}
+
+
+// vim: ts=4 sw=4
Modified: openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.h
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.h
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/CMMessage.h
2008-11-30 04:12:27 UTC (rev 10093)
@@ -24,19 +24,31 @@
#ifndef CM_MESSAGE_H
#define CM_MESSAGE_H
+#include <GSML3Message.h>
+
namespace SMS {
/**
- CP-Messages
+ A virtual class for SMS CM-layer messages.
+ See GSM 04.11 7.
+ This is probably nearly the same as GSM::L3CCMessage,
+ but with different message types.
*/
class CPMessage : public GSM::L3Message
{
-
+ private:
+
+ /address@hidden Header information ref. Figure 8. GSM 04.11 */
+ //@{
+ unsigned mTIFlag; ///< 0 for originating side, see GSM 04.07
11.2.3.1.3
+ unsigned mTIValue; ///< short transaction ID, GSM 04.07 11.2.3.1.3
+ //@}
+
+
public:
- CommSig mPayload; ///< RPDU
-
+
/** Message type defined in GSM 04.11 8.1.3 Table 8.1 */
enum MessageType {
Data=0x01,
@@ -45,23 +57,14 @@
};
- /* Header information ref. Figure 8. GSM 04.11 */
-
- unsigned mTIFlag; ///< 0 for originating side, see GSM 04.07
11.2.3.1.3
- unsigned mTIValue; ///< short transaction ID, GSM 04.07 11.2.3.1.3
-
CPMessage( unsigned wTIFlag, unsigned wTIValue )
- :L3Message(), mTIFlag(wTIFlag), mTIValue(wTIValue)
+ :L3Message(),
+ mTIFlag(wTIFlag), mTIValue(wTIValue)
{}
- CPMessage( const CommSig wPayload ):
- mPayload(wPayload)
- { }
-
-
- virtual ~CPMessage(){}
-
- void write( GSM::L3Frame& dest, size_t start=0 )const;
+ /** Override the write method to include transaction identifiers in
header. */
+ void write(GSM::L3Frame& dest) const;
+
GSM::L3PD PD() const { return GSM::L3SMSPD; }
unsigned TIValue() const { return mTIValue; }
@@ -70,73 +73,145 @@
unsigned TIFlag() const { return mTIFlag; }
void TIFlag( unsigned wTIFlag) { mTIFlag=wTIFlag; }
- const CommSig payload() const { return mPayload; }
void text(std::ostream&) const;
};
std::ostream& operator<<(std::ostream& os, CPMessage::MessageType MTI);
+
+/** Parse a complete SMS L3 (CM) message. */
CPMessage * parseSMS( const GSM::L3Frame& frame );
+
+/** A factory method for SMS L3 (CM) messages. */
CPMessage * CPFactory( CPMessage::MessageType MTI );
+
+
+/address@hidden CP Elements for SMS */
+//@{
+
+/** GSM 04.11 8.1.4.2 */
+class CPCause : public GSM::L3ProtocolElement {
+
+ private:
+
+ unsigned mValue;
+
+ public:
+
+ CPCause(unsigned wValue)
+ :L3ProtocolElement(),
+ mValue(wValue)
+ {}
+
+ size_t lengthV() const { return 1; }
+
+ void parseV(const GSM::L3Frame& src, size_t &rp)
+ { mValue = src.readField(rp,8); }
+
+ void writeV(GSM::L3Frame& dest, size_t &wp) const
+ { dest.writeField(wp,mValue,8); }
+
+ void text(std::ostream& os) const
+ { os << std::hex << "0x" << mValue << std::dec; }
+};
+
+
+/** GSM 04.11 8.1.4.1 */
+class CPUserData : public GSM::L3ProtocolElement {
+
+ private:
+
+ // The BitVector is a placeholder for a higher-layer object.
+ BitVector mRPDU;
+
+ public:
+
+ CPUserData()
+ :L3ProtocolElement(),
+ mRPDU()
+ {}
+
+ CPUserData(const BitVector& wRPDU)
+ :L3ProtocolElement(),
+ mRPDU(wRPDU)
+ {}
+
+ size_t lengthV() const { return mRPDU.size()/8; }
+
+ void parseV(const GSM::L3Frame& src, size_t &rp, size_t expectedLength);
+
+ void writeV(GSM::L3Frame& dest, size_t &wp) const;
+
+ void text(std::ostream& os) const { os << mRPDU; }
+};
+
+//@} // CP Elements
+
+
+/** GSM 04.11 7.2.1 */
class CPAck : public CPMessage
{
public:
+
CPAck( unsigned wTIFlag=0, unsigned wTIValue=7)
:CPMessage(wTIFlag, wTIValue)
{ }
- ~CPAck(){}
int MTI() const { return Ack; }
- size_t length() const { return 1; }
+ size_t bodyLength() const { return 0; }
void parseBody( const GSM::L3Frame& dest, size_t &rp ){};
void writeBody( GSM::L3Frame& dest, size_t &wp ) const{};
- //void text(std::ostream&) const;
+ void text(std::ostream& os) const { CPMessage::text(os); }
};
+
+/** GSM 04.11 7.2.3 */
class CPError : public CPMessage
{
- // default 0x6F Protocol error unspecified
- // ref Table 8.2 GSM 04.11
- unsigned mCause;
+ private:
+ CPCause mCause;
+
public:
- CPError( unsigned wCause=111, unsigned wTIFlag=0, unsigned wTIValue=7)
- :CPMessage(wTIFlag, wTIValue)
+ CPError(unsigned wTIFlag=0, unsigned wTIValue=0, const CPCause& wCause
= 0x7f)
+ :CPMessage(wTIFlag, wTIValue),
+ mCause(wCause)
{ }
- ~CPError(){}
int MTI() const { return Error; }
- size_t length() const { return 1; }
+ size_t bodyLength() const { return mCause.lengthV(); }
void writeBody( GSM::L3Frame& dest, size_t &wp ) const;
};
+
+/** GSM 04.11 7.2.1 */
class CPData : public CPMessage
{
+ private:
+
+ CPUserData mData;
+
public:
CPData( unsigned wTIFlag=0, unsigned wTIValue=7)
:CPMessage(wTIFlag, wTIValue)
{ }
- CPData( const CommSig wPayload )
- :CPMessage(wPayload)
- { }
-
- ~CPData(){}
int MTI() const { return Data; }
- size_t length() const {
- COUT("CPData::length = "<<mPayload.size()/8)
- return mPayload.size()/8 +1;
- }
+ size_t bodyLength() const { return mData.lengthLV(); }
void parseBody( const GSM::L3Frame& dest, size_t &rp );
void writeBody( GSM::L3Frame& dest, size_t &wp ) const;
void text(std::ostream&) const;
};
+
}; // namespace SMS {
+
#endif
+
+// vim: ts=4 sw=4
Modified: openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.cpp
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.cpp
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.cpp
2008-11-30 04:12:27 UTC (rev 10093)
@@ -28,11 +28,10 @@
#include <stdio.h>
-#include "Common.h"
-#include "GSMCommon.h"
-#include "GSMLogicalChannel.h"
-#include "ControlCommon.h"
+#include <GSMCommon.h>
+#include <GSMLogicalChannel.h>
+#include <ControlCommon.h>
#include "SMSTransfer.h"
#include "CMMessage.h"
@@ -49,7 +48,6 @@
using namespace SMS;
using namespace Control;
-#define DEBUG 1
@@ -110,11 +108,8 @@
void CMProcessor::writeCPMessage( const CPMessage& msg )
{
DCOUT("CMProcessor::writeCPMessage "<<msg)
- if(mDownstream==NULL) {
- CERR("Warning -- L2 not connected to L3, dropped L3Frame ")
- return;
- }
- mDownstream->sendL3(msg,DATA_REQUEST, 3);
+ assert(mDownstream);
+ mDownstream->send(msg,DATA_REQUEST, 3);
}
Modified: openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.h
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.h
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/CMProcessor.h
2008-11-30 04:12:27 UTC (rev 10093)
@@ -55,9 +55,9 @@
volatile bool mMobileOriginated;
Mutex mLock; ///< protect shared variables in
uplink/downlink operations.
- GSM::SDCCHLogicalChannel * mDownstream; ///< Downstream
SDDCHLogicalChannel sapi=3.
+ GSM::SDCCHLogicalChannel *mLCH; ///< Downstream SDDCHLogicalChannel
sapi=3.
- RLProcessor * mUpstream; ///< Uplink RP-Layer.
+ RLProcessor *mRL; ///< Uplink RP-Layer.
CMState mState; ///< state for cp layer.
GSM::Z100Timer mTCM1; ///< timer value in 04.11-10 is 40 seconds.
unsigned mTIFlag;
@@ -87,12 +87,10 @@
void sendCPError();
- CMProcessor():
- mDownstream(NULL), mUpstream(NULL), mTCM1(30)
+ CMProcessor(GSM::GSMLogicalChannel wLCH, RLProcessor *wRL)
+ :mLCH(wLCH), mRL(wRL), mTCM1(40000)
{ }
- ~CMProcessor() { stop(); }
-
// all CMMessages need the same TI:flag+value so
// this is set in the control layer or someplace else
// after receiving first message.
Modified: openbts/branches/developers/dburgess00/smswork/SMS/CMTest.cpp
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/CMTest.cpp
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/CMTest.cpp
2008-11-30 04:12:27 UTC (rev 10093)
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <iostream>
-#include "CommSig.h"
+#include <BitVector.h>
#include "GSMTransfer.h"
Modified: openbts/branches/developers/dburgess00/smswork/SMS/Makefile.am
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/Makefile.am
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/Makefile.am
2008-11-30 04:12:27 UTC (rev 10093)
@@ -22,12 +22,9 @@
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
-# NOT COMPILED, ONLY HERE TO GET IN DISTRIBUTION TARBALL
-#noinst_LTLIBRARIES = libSMS.la
+noinst_LTLIBRARIES = libSMS.la
-#libSMS_la_SOURCES =
-EXTRA_DIST = \
- README.SMS \
+libSMS_la_SOURCES = \
CMMessage.cpp \
CMProcessor.cpp \
RLMessage.cpp \
Modified: openbts/branches/developers/dburgess00/smswork/SMS/RLMessage.h
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/RLMessage.h
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/RLMessage.h
2008-11-30 04:12:27 UTC (rev 10093)
@@ -35,7 +35,7 @@
class RPMessage
{
public:
- CommSig mPayload; ///< TPDU
+ BitVector mPayload; ///< TPDU
unsigned mMessageReference;
// ref. Table 8.3 GSM 04.11
@@ -46,7 +46,7 @@
SMMA=0x6
};
RPMessage(){}
- RPMessage( const CommSig& wPayload )
+ RPMessage( const BitVector& wPayload )
:mPayload(wPayload)
{ }
@@ -63,7 +63,7 @@
void write( RLFrame& frame ) const;
virtual void writeBody( RLFrame& frame, size_t &rp) const {abort();}
- const CommSig& payload(){ return mPayload; }
+ const BitVector& payload(){ return mPayload; }
};
@@ -94,7 +94,7 @@
int MTI() const { return Ack; }
RPAck():RPMessage(){}
- RPAck( const CommSig& frame )
+ RPAck( const BitVector& frame )
:RPMessage(frame)
{ }
Deleted: openbts/branches/developers/dburgess00/smswork/SMS/SMSMessages.cpp
Deleted: openbts/branches/developers/dburgess00/smswork/SMS/SMSMessages.h
Modified: openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.cpp
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.cpp
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.cpp
2008-11-30 04:12:27 UTC (rev 10093)
@@ -21,7 +21,7 @@
-#include "CommSig.h"
+#include <BitVector.>
#include "SMSTransfer.h"
using namespace std;
@@ -55,14 +55,14 @@
ostream& SMS::operator<<(ostream& os, const RLFrame& msg)
{
os<<" primitive="<<msg.primitive();
- os<<" data=("<<(const CommSig&)msg<<")";
+ os<<" data=("<<(const BitVector&)msg<<")";
return os;
}
ostream& SMS::operator<<(ostream& os, const TLFrame& msg)
{
os<<" primitive="<<msg.primitive();
- os<<" data=("<<(const CommSig&)msg<<")";
+ os<<" data=("<<(const BitVector&)msg<<")";
return os;
}
Modified: openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.h
===================================================================
--- openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.h
2008-11-30 03:58:26 UTC (rev 10092)
+++ openbts/branches/developers/dburgess00/smswork/SMS/SMSTransfer.h
2008-11-30 04:12:27 UTC (rev 10093)
@@ -57,7 +57,7 @@
-class RLFrame : public CommSig
+class RLFrame : public BitVector
{
SMSPrimitive mPrimitive;
@@ -67,11 +67,11 @@
unsigned MTI() const { return peekField(0, 8); }
RLFrame(SMSPrimitive wPrimitive=UNDEFINED_PRIMITIVE, size_t len=0)
- :CommSig(len), mPrimitive(wPrimitive)
+ :BitVector(len), mPrimitive(wPrimitive)
{ }
- RLFrame(const CommSig& source, SMSPrimitive
wPrimitive=UNDEFINED_PRIMITIVE)
- :CommSig(source), mPrimitive(wPrimitive)
+ RLFrame(const BitVector& source, SMSPrimitive
wPrimitive=UNDEFINED_PRIMITIVE)
+ :BitVector(source), mPrimitive(wPrimitive)
{ }
~RLFrame(){}
@@ -81,7 +81,7 @@
std::ostream& operator<<(std::ostream& os, const RLFrame& );
-class TLFrame : public CommSig
+class TLFrame : public BitVector
{
SMSPrimitive mPrimitive;
@@ -91,11 +91,11 @@
unsigned MTI() const { return peekField(0, 2); }
TLFrame(SMSPrimitive wPrimitive=UNDEFINED_PRIMITIVE, size_t len=0)
- :CommSig(len), mPrimitive(wPrimitive)
+ :BitVector(len), mPrimitive(wPrimitive)
{ }
- TLFrame(const CommSig& source, SMSPrimitive
wPrimitive=UNDEFINED_PRIMITIVE)
- :CommSig(source), mPrimitive(wPrimitive)
+ TLFrame(const BitVector& source, SMSPrimitive
wPrimitive=UNDEFINED_PRIMITIVE)
+ :BitVector(source), mPrimitive(wPrimitive)
{ }
~TLFrame(){ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10093 - openbts/branches/developers/dburgess00/smswork/SMS,
dburgess00 <=