/*
* pdu_deliver.cpp
* libPDU
*
* Created by James Pitts on 07/02/2005.
* Copyright 2005 James Pitts. All rights reserved.
*
*/
#include "pdu_deliver.h"
#include "pdu_log.h"
#include "pdu_userdata.h"
Pdu_Deliver::Pdu_Deliver ( Pdu_Base & base ) : Pdu_Base ( base ), protocol_( 0 ),
dataCoding_ ( 0 ), timeStamp_ ( "" ), userDataLength_ ( 0 ), userData_ ( 0 )
{
}
Pdu_Deliver::~Pdu_Deliver ( )
{
if ( userData_ )
delete userData_;
}
/*
* dump
*/
void Pdu_Deliver::dump ( void ) const
{
Pdu_Base::dump();
PDU_LOG->log ("Pdu_Deliver\n");
if ( moreMessagesToSend () == true )
PDU_LOG->log ( "MMS : true\n" );
else
PDU_LOG->log ( "MMS : false\n" );
if ( statusReportIndicator () == true )
PDU_LOG->log ( "SRI : true\n" );
else
PDU_LOG->log ( "SRI : false\n" );
if ( userDataHeaderIndicator () == true )
PDU_LOG->log ( "UDHI : true\n" );
else
PDU_LOG->log ( "UDHI : false\n" );
if ( replyPath () == true )
PDU_LOG->log ( "RP : true\n" );
else
PDU_LOG->log ( "RP : false\n" );
PDU_LOG->log ( "Origin: %s\n", senderNumber_.getValue().c_str() );
dataCoding_.dump();
PDU_LOG->log ( "Timestamp: %s\n", timeStamp_.c_str() );
PDU_LOG->log ( "User Data Length: %d\n", userDataLength_ );
if ( userData_ )
userData_->dump();
}
/*
* decode
*/
void Pdu_Deliver::decode ( void )
{
getAddressField ( senderNumber_ );
protocol_ = getOctetAsInt();
dataCoding_.setDataCode ( getOctetAsInt() );
getSemiOctetAsString ( timeStamp_, 14 ); // timestamp is 7 octets, TP_SCTS
userDataLength_ = getOctetAsInt();
userData_ = new Pdu_User_Data ( this, userDataLength_ );
userData_->decodeUserData( dataCoding_ );
}
/*
*
* moreMessagesToSend
*
* The logic on this appears to be opposite to what you'd expect.
*
* 0 in bit 2, more messages to send
* 1 in bit 2, no more messages to send
* TP_MMS
*/
bool Pdu_Deliver::moreMessagesToSend ( void ) const
{
if ( ( getHeader() >> 2 ) & 1 == 1)
{
return false;
}
else
{
return true;
}
}
/*
* replyPath
*
* TP-RP
*/
bool Pdu_Deliver::replyPath ( void ) const
{
if ( ( getHeader() >> 7 ) & 1 == 1)
{
return true;
}
else
{
return false;
}
}
/*
* userDataHeaderIndicator
*
* TP_UDHI
*
*/
bool Pdu_Deliver::userDataHeaderIndicator (void) const
{
if ( ( getHeader() >> 6 ) & 1 == 1)
{
return true;
}
else
{
return false;
}
}
/*
*
* TP-SRI
*/
bool Pdu_Deliver::statusReportIndicator (void) const
{
if ( ( getHeader() >> 6 ) & 1 == 1)
{
return true;
}
else
{
return false;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于AT命令发送中文短信的库
需积分: 12 88 下载量 92 浏览量
2009-05-21
17:18:05
上传
评论
收藏 6KB GZ 举报
温馨提示
共23个文件
cpp:10个
h:10个
makefile:3个
C++写的基于AT命令的中文中文短信程序; 修改了一些错误,在Linux下编译通过。
资源推荐
资源详情
资源评论
收起资源包目录
libPdu-0.1.tar.gz (23个子文件)
libPdu-0.1
test
pdutest.h 133B
pdutest.cpp 1KB
Makefile 294B
src
pdu_submit.cpp 195B
pdu_deliver.h 782B
Pdu.h 589B
Pdu.cpp 657B
pdu_address.cpp 1KB
pdu_datacoding.cpp 2KB
pdu_log.h 514B
pdu_address.h 1KB
pdu_base.h 818B
pdu_userdata.cpp 662B
pdu_deliver.cpp 3KB
pdu_packed.cpp 3KB
pdu_log.cpp 706B
pdu_datacoding.h 841B
Makefile 1KB
pdu_packed.h 645B
pdu_userdata.h 525B
pdu_base.cpp 1KB
pdu_submit.h 268B
Makefile 143B
共 23 条
- 1
资源评论
mountain2007
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功