csrdpdu.cpp
来自「ABis无线接口全套资料」· C++ 代码 · 共 115 行
CPP
115 行
//
// csrdpdu.cpp
// Define SRD interface analysis class methods.
// 2005-12-14
// Wu jianjin
//
#ifndef _CSRDPDU_HPP
#include "csrdpdu.hpp"
#endif
#ifndef _PCUIE_HPP
#include "pcuie.hpp"
#endif
CSrdPdu::CSrdPdu( )
{
Init( );
}
CSrdPdu::CSrdPdu(CSrdPdu& s) : CPduBase(s)
{
}
CSrdPdu::~CSrdPdu( )
{
}
void CSrdPdu::Init( )
{
CPduBase::Init( );
}
int CSrdPdu::Unpacked(char * ptr, UINT16 len) // Unpacked the PDU octets string.
{
// Nothing to do.
return 0;
}
char * CSrdPdu::Output(UINT16& len) // Packed the PDU in dedicat model.
{
char * pPdu = NULL;
len = 0;
pPdu = ComposeSrdPdu(len);
return pPdu;
}
int CSrdPdu::DecomposeJoyitApi(char * ptr, UINT16 len) // Not used.
{
// Nothing to do.
return 0;
}
char * CSrdPdu::ComposeJoyitApi(UINT16& len) // Not used.
{
// Nothing to do.
return NULL;
}
// ===========================================================================
//
// Description: Pack up IE into SRD interface.
// Input: Null
// Output:
// len Length of Joyit API message.
// Return: char *
// NULL Failure.
// Other Pointer point to Joyit API message.
//
// ===========================================================================
char * CSrdPdu::ComposeSrdPdu(UINT16& len)
{
char * pPdu = NULL;
char pdu[MAX_MSGLEN] = { 0 };
UINT16 pos = 0;
UINT16 l;
int i;
UINT8 totalie = NoIe( );
if (totalie != totalie)
{
return pPdu;
}
// Make up all other IEs.
for (i=0; i<totalie; ++i)
{
if (PCU_IE_COSM == IE[i].id)
{
pdu[pos++] = IE[i].len; // IE[i].GetIeData( );
}
memcpy(pdu+pos, IE[i].GetIeData(l), IE[i].len);
pos += IE[i].len;
}
// Allocate memory for this PDU.
pPdu = new char[pos];
if (pPdu != NULL)
{
memcpy(pPdu, pdu, pos);
len = pos;
}
else
{ // Out of memory.
printf("Make up SRD interface PDU out of memory.\n");
}
return pPdu;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?