📄 cbcfunction.c
字号:
#include "..\sys\Include.h"
/* 选择路由相关函数 */
int Process_Add_Failure_CellId_To_DivideCellListBuf(unsigned char *CellId,DIVIDE_CELLLIST_BUF_t *s_DivideCellListBuf);
/* 将不可用小区加到响应小区列表 */
int Process_Add_Failure_CellId_To_ResponseCellListBuf(unsigned char *LpCellId,CELLLIST_i *LPs_ResponseCellList,unsigned char *LPBSCID);
/* 将小区加到响应小区列表 */
int Process_Add_CellId_To_ResponseCellListBuf(unsigned char *LpCellId,unsigned char *LPBSCID,unsigned short NoOfBroadcastReq,CELLLIST_i *LPs_ResponseCellList);
/* 根据BSCID加一个列表 */
int Process_Add_CellList_According_Bsc(unsigned char *BSCidentifier,DIVIDE_CELLLIST_BUF_t *s_DivideCellListBuf);
/* 根据LAC加一个列表 */
int Process_Add_CellList_According_LAC(unsigned char *LACidentifier,DIVIDE_CELLLIST_BUF_t *s_DivideCellListBuf);
//
/*--------------------------------
//拆分小区列表
//out: s_DivideCellListBuf 拆分结果
//out: s_CellId失败时返回不识别的小区编码
//int: s_CellList
//返回: <0失败,1成功;
//不用了
//------------------------------*/
int Process_Divide_CellList(CELLLIST_t *s_CellList,DIVIDE_CELLLIST_BUF_t *s_DivideCellListBuf,CELLID_t *s_CellId)
{
int iReturnValue;
unsigned char cBSCID[BSC_INDENTIFIER_LEN];
int i;
iReturnValue=SUCCESS;
switch (s_CellList->cCellIdDisc)
{
/* 2字节区域码加2字节小区识别号 */
case LAC_AND_CI:
{
/* 对所有收到的小区列表 */
for(i=0;i<s_CellList->iLength;i++)
{
iReturnValue=Process_Search_BscId_AccordingTo_CellId(&s_CellList->s_CellList[i].cCellId[0],cBSCID);
if (iReturnValue<0)
{
memcpy(s_CellId,&s_CellList->s_CellList[i],sizeof(CELLID_t));
return NO_RECOGNIZEABLE_CELL;
}
if (iReturnValue==0)
{
Process_Add_Failure_CellId_To_DivideCellListBuf(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
}
if (iReturnValue>0)/* ==SUCCESS) */
{
/* 已做了CellId和BSC对应的合法性检查,该函数不会返回错误 */
Process_Add_CellId_To_DivideCellListBuf(&s_CellList->s_CellList[i].cCellId[0],cBSCID,s_DivideCellListBuf);
}
}
}
break;
/* 只填小区码 */
case CI_ONLY:
{
printf("Not suport this CellIdDisc: %d\n",s_CellList->cCellIdDisc);
iReturnValue=CELLIDDISC_OUTOFRANG;
}
break;
//lac
case LAC_ONLY:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据LAC加一个列表
iReturnValue=Process_Add_CellList_According_LAC(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
//Bss
case ALL_CELLS:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据BSCID加一个列表
iReturnValue=Process_Add_CellList_According_Bsc(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
default:
printf("CellIdDisc Error!\n");
iReturnValue=CELLIDDISC_OUTOFRANG;
break;
}
return iReturnValue;
}
/*--------------------------------
//拆分小区列表到响应缓冲区
//out: LPs_ResponseCellList 拆分结果
//out: s_CellId 失败时返回不识别的小区编码
//in: s_CellList 小区列表
//in: NoOfBroadcastReq 请求广播的次数
//返回: <0失败,1成功;
//------------------------------*/
int Process_Divide_CellList_AccordingToResponse(CELLLIST_t *s_CellList,
unsigned short NoOfBroadcastReq,
CELLLIST_i *LPs_ResponseCellList,
CELLID_t *s_CellId)
{
int iReturnValue;
unsigned char cBSCID[BSC_INDENTIFIER_LEN];
int i;
iReturnValue=SUCCESS;
LPs_ResponseCellList->bFlag=1;
switch (s_CellList->cCellIdDisc)
{
/* 2字节区域码加2字节小区识别号 */
case LAC_AND_CI:
{
/* 对所有收到的小区列表 */
for(i=0;i<s_CellList->iLength;i++)
{
iReturnValue=Process_Search_BscId_AccordingTo_CellId(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0]);
if (iReturnValue<0)
{
memcpy(s_CellId,&s_CellList->s_CellList[i],sizeof(CELLID_t));
return NO_RECOGNIZEABLE_CELL;
}
if (iReturnValue==0)
{
/* 将不可用小区加到响应小区列表 */
Process_Add_Failure_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],LPs_ResponseCellList,&cBSCID[0]);
}
if (iReturnValue>0)
{
/* 已做了CellId和BSC对应的合法性检查,该函数不会返回错误 */
/* 将小区加到响应小区列表 */
Process_Add_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0],NoOfBroadcastReq,LPs_ResponseCellList);
}
}
}
break;
/* 只填小区码 */
case CI_ONLY :
case LAC_ONLY:
case ALL_CELLS:
{
printf("Not suport this CellIdDisc: %d\n",s_CellList->cCellIdDisc);
iReturnValue=CELLIDDISC_OUTOFRANG;
}
break;
/* //lac
case 5:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据LAC加一个列表
iReturnValue=Process_Add_CellList_According_LAC(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
//Bss
case 6:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据BSCID加一个列表
// iReturnValue=Process_Add_CellList_According_Bsc(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
*/
default:
printf("CellIdDisc Error!\n");
iReturnValue=CELLIDDISC_OUTOFRANG;
break;
}
return iReturnValue;
}
/*--------------------------------
//拆分小区列表到响应缓冲区
//out: LPs_ResponseCellList 拆分结果
//out: s_CellId 失败时返回不识别的小区编码
//in: s_CellList 小区列表
//in: NoOfBroadcastReq 请求广播的次数
//返回: <0失败,1成功;
//------------------------------*/
int Process_Divide_CellList_AccordingToResetResponse(CELLLIST_t *s_CellList,
unsigned short NoOfBroadcastReq,
CELLLIST_i *LPs_ResponseCellList,
CELLID_t *s_CellId)
{
int iReturnValue;
unsigned char cBSCID[BSC_INDENTIFIER_LEN];
int i;
iReturnValue=SUCCESS;
LPs_ResponseCellList->bFlag=1;
switch (s_CellList->cCellIdDisc)
{
/* 2字节区域码加2字节小区识别号 */
case LAC_AND_CI:
{
/* 对所有收到的小区列表 */
for(i=0;i<s_CellList->iLength;i++)
{
iReturnValue=Process_Search_BscId_AccordingTo_CellId(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0]);
if (iReturnValue<0)
{
memcpy(s_CellId,&s_CellList->s_CellList[i],sizeof(CELLID_t));
return NO_RECOGNIZEABLE_CELL;
}
// if (iReturnValue==0)
// {
/* 将不可用小区加到响应小区列表 */
// Process_Add_Failure_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],LPs_ResponseCellList,&cBSCID[0]);
// }
// if (iReturnValue==SUCCESS)
else
{
/* 已做了CellId和BSC对应的合法性检查,该函数不会返回错误 */
/* 将小区加到响应小区列表 */
Process_Add_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0],NoOfBroadcastReq,LPs_ResponseCellList);
}
}
}
break;
/* 只填小区码 */
case CI_ONLY :
case LAC_ONLY:
case ALL_CELLS:
{
printf("Not suport this CellIdDisc: %d\n",s_CellList->cCellIdDisc);
iReturnValue=CELLIDDISC_OUTOFRANG;
}
break;
/* //lac
case 5:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据LAC加一个列表
iReturnValue=Process_Add_CellList_According_LAC(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
//Bss
case 6:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据BSCID加一个列表
// iReturnValue=Process_Add_CellList_According_Bsc(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
*/
default:
printf("CellIdDisc Error!\n");
iReturnValue=CELLIDDISC_OUTOFRANG;
break;
}
return iReturnValue;
}
/*--------------------------------
//拆分小区列表到响应缓冲区
有流量控制
//out: LPs_ResponseCellList 拆分结果
//out: s_CellId 失败时返回不识别的小区编码
//in: s_CellList 小区列表
//in: NoOfBroadcastReq 请求广播的次数
//返回: <0失败,1成功;
//------------------------------*/
int Process_Divide_CellList_AccordingToResponse_LC(CELLLIST_t *s_CellList,
unsigned short NoOfBroadcastReq,
CELLLIST_i *LPs_ResponseCellList,
CELLID_t *s_CellId,
unsigned char cCategory)
{
int iReturnValue;
unsigned char cBSCID[BSC_INDENTIFIER_LEN];
int i;
iReturnValue=SUCCESS;
LPs_ResponseCellList->bFlag=1;
switch (s_CellList->cCellIdDisc)
{
/* 2字节区域码加2字节小区识别号 */
case LAC_AND_CI:
{
/* 对所有收到的小区列表 */
for(i=0;i<s_CellList->iLength;i++)
{
iReturnValue=Process_Search_BscId_AccordingTo_CellId(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0]);
if (iReturnValue<0)
{
memcpy(s_CellId,&s_CellList->s_CellList[i],sizeof(CELLID_t));
return NO_RECOGNIZEABLE_CELL;
}
if (iReturnValue==0)
{
/* 将不可用小区加到响应小区列表 */
Process_Add_Failure_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],LPs_ResponseCellList,&cBSCID[0]);
}
/* 该小区信道负荷为80% */
if (iReturnValue==8)
{
if ((cCategory==HIGH_PRIORITY)||
(cCategory==NORMAL_PRIORITY))
{
/* 将小区加到响应小区列表 */
Process_Add_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0],NoOfBroadcastReq,LPs_ResponseCellList);
}
else
{
/* 将不可用小区加到响应小区列表 */
Process_Add_Failure_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],LPs_ResponseCellList,&cBSCID[0]);
}
}
/* 该小区信道负荷为90% */
if (iReturnValue==9)
{
if (cCategory==HIGH_PRIORITY)
{
/* 将小区加到响应小区列表 */
Process_Add_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0],NoOfBroadcastReq,LPs_ResponseCellList);
}
else
{
/* 将不可用小区加到响应小区列表 */
Process_Add_Failure_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],LPs_ResponseCellList,&cBSCID[0]);
}
}
if (iReturnValue==SUCCESS)
{
/* 已做了CellId和BSC对应的合法性检查,该函数不会返回错误 */
/* 将小区加到响应小区列表 */
Process_Add_CellId_To_ResponseCellListBuf(&s_CellList->s_CellList[i].cCellId[0],&cBSCID[0],NoOfBroadcastReq,LPs_ResponseCellList);
}
}
}
break;
/* 只填小区码 */
case CI_ONLY :
case LAC_ONLY:
case ALL_CELLS:
{
printf("Not suport this CellIdDisc: %d\n",s_CellList->cCellIdDisc);
iReturnValue=CELLIDDISC_OUTOFRANG;
}
break;
/* //lac
case 5:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据LAC加一个列表
iReturnValue=Process_Add_CellList_According_LAC(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
//Bss
case 6:
{
for(i=0;i<s_CellList->iLength;i++)
{
//根据BSCID加一个列表
// iReturnValue=Process_Add_CellList_According_Bsc(&s_CellList->s_CellList[i].cCellId[0],s_DivideCellListBuf);
if (iReturnValue<0)
return iReturnValue;
}
}
break;
*/
default:
printf("CellIdDisc Error!\n");
iReturnValue=CELLIDDISC_OUTOFRANG;
break;
}
return iReturnValue;
}
//根据BSCID加一个列表
int Process_Add_CellList_According_Bsc(unsigned char *BSCidentifier,DIVIDE_CELLLIST_BUF_t *s_DivideCellListBuf)
{
int i;
int j;
int m;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -