⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svdisp.cpp

📁 七号信令解码器
💻 CPP
📖 第 1 页 / 共 3 页
字号:

//proc H1H0
			  dfieldno=10;
			  temp1 = *recbuf;  //get H1H0
			  proc8bitsdisp(10);  //display fld:10

			  slen--;

			  if(slen!=0)
				{
				 switch(temp1)
				  {
					case 0x11://COO
					case 0x21://COA
//COOFSN:7BITS
					 *dispbuf++ = 11;     //display fld:11
					 *dispbuf++ =1;
					 temp1=*recbuf;
					 *dispbuf++ = temp1;
					 *dispbuf++ =7;
					 *dispbuf++ = temp1<<1;
					 *dispbuf++ = 0xcc;
					 displen +=6;
					 break;

					case 0x51://CBD
					case 0x61://CBA
//CHANGE BACK CODE(8bits)
					 proc8bitsdisp(11);  //display fld:11
					 break;

					case 0x14://TFP
					case 0x54://TFA
					case 0x34://TFR
					case 0x15://RSM/
					 if(is24bits==1)//destination:24bits
					    proc24bitsdisp(11);  //display fld:11
					 else  //destination:14bits
					  {*dispbuf++ = 11;
						*dispbuf++ =2;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =14;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =0xcc;
						displen +=8;
					  }
					 break;

					case 0x18://DLC
//Signal Data Link IDentity-12bits)
					 *dispbuf++ = 11;    //display fld:11
					 *dispbuf++ =2;
					 temp16 = (*recbuf+*(recbuf+1)*256)<<4;
					 *dispbuf++ = *recbuf++;
					 *dispbuf++ = *recbuf++;
					 *dispbuf++ =12;
					 *dispbuf++ = HIBYTE(temp16);
					 *dispbuf++ = LOBYTE(temp16);
					 *dispbuf++ =0xcc;
					 displen +=8;

					 break;

					case 0x23://TFC
					 if(is24bits==1)//destination:24bits
					    proc24bitsdisp(11);  //display fld:11
					 else //destination:14bits
					  {*dispbuf++ = 11;
						*dispbuf++ =2;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =14;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =0xcc;
						displen +=8;
					  }
//status:2bits
					 *dispbuf++ = 12;              //display fld:12
					 *dispbuf++ =1;
					 *dispbuf++ = *recbuf;
					 *dispbuf++ =2;
					 *dispbuf++ = (*recbuf)<<6;
					 *dispbuf++ =0xcc;
					 displen +=6;
					 break;

					case 0x1a://UPU
					 if(is24bits==1)//destination:24bits
					    proc24bitsdisp(11); //display fld:11
					 else //destination:16bits
					  {*dispbuf++ = 11;   //display fld:11
						*dispbuf++ =2;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =16;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =0xcc;
						displen +=8;
					  }
//user part id:4bits
					 *dispbuf++ = 12;
					 *dispbuf++ =1;
					 *dispbuf++ = *recbuf;
					 *dispbuf++ =4;
					 *dispbuf++ = (*recbuf)<<4;
					 *dispbuf++ =0xcc;
					 displen +=6;

					 break;
					default:
					 break;
				  }//switch:h1h0
				 }//if slen!=0

			  break;

		  case 1://SNT
//process DPC/OPC/SLC
		    proc8bitsdisp(dfieldno);
			slen--;
			temp1 = temp2&0xf0;       //get SSF
			if (temp1==0xc0 && slen>5)     //DPC/OPC is 14bits
			  {procDPCOPCSLC14disp();
				dfieldno +=3;
				slen -= 4;
				is24bits=0;
			  }//DPC/OPC is 14bits
			else if (temp1!=0xc0 && slen>8) //DPC/OPC is 24bits
			  {
//process dpc:24bits
				proc24bitsdisp(7);  //display fld:7
//process opc:24bits
				proc24bitsdisp(8);  //display fld:8
//process slc:D3-D0,4bits
				*dispbuf++ = 9;           //display fld:9
				*dispbuf++ = 1; 				//source data byte
				temp1 = *recbuf++;
				*dispbuf++ = temp1;       //source data
				*dispbuf++ =4;				//display bit len:24
				*dispbuf++ = temp1<<4;
				*dispbuf++ = 0xcc;			//end flag
				displen += 6;

				slen -= 7;
			  }//DPC/OPC is 14bits
			else //illegal data
			  {procmoredatadisp(slen);
				 break;
			  }

//proc H1H0
				dfieldno=10;
				temp1 = *recbuf;   //get H1H0
				proc8bitsdisp(10);  //display fld:10
				slen--;

				if (slen!=0 && (temp1==0x11 || temp1==0x21))//SLTM\SLTA
				 {
//proc LI:d7-d4,4bits
				  *dispbuf++ = 11;     //display fld:11
				  *dispbuf++ =1;
				  temp1 = *recbuf++;
				  *dispbuf++ = temp1;
				  *dispbuf++ =4;
				  temp1 &= 0xf0;
				  *dispbuf++ = temp1;
				  *dispbuf++ = 0xcc;
				  displen +=6;
				  slen--;
//process test code:decided by LI
				  temp1/=0x10;
				  displen += temp1*2+4;
				  *dispbuf++ = 12;        //display fld:12
				  *dispbuf++ =temp1;
				  for (i=0;i<temp1;i++)  *dispbuf++ = *(recbuf+i);
				  *dispbuf++ = temp1*8;
				  for (i=0;i<temp1;i++)  *dispbuf++ = *recbuf++;
				  *dispbuf++ = 0xcc;
				 }//data isn't over
			break;

		  case 3://SCCP
			if ((Version&0x01)==0) procmoredatadisp(slen);
			else procSCCPdisp(slen);
			break;

		  case 4://TUP
//process DPC/OPC/SLC
		    proc8bitsdisp(dfieldno);
			slen--;
			temp1 = temp2&0xf0;       //get SSF
			if (temp1==0xc0 && slen>6)     //DPC/OPC is 14bits
			 {is24bits=0;
//process DPC
			  *dispbuf++ = 7;      //display fld:7
			  *dispbuf++ = 2;
			  *dispbuf++ = *recbuf;
			  *dispbuf++ = *(recbuf+1);
			  *dispbuf++ =16;
			  *dispbuf++ = *(recbuf+1) & 0x3f;
			  *dispbuf++ = *recbuf;
			  *dispbuf++ = 0xcc;
			  displen += 8;
//process OPC
			  *dispbuf++ = 8;      //display fld:8
			  *dispbuf++ =2;
			  *dispbuf++ = *(recbuf+2);
			  *dispbuf++ = *(recbuf+3);
			  *dispbuf++ = 16;
			  temp16 = (*(recbuf+1)>>6) + *(recbuf+2)*4 + (*(recbuf+3)&0x0f)*1024;  //get opc(14bits)
			  *dispbuf++=HIBYTE(temp16);
			  *dispbuf++=LOBYTE(temp16);
			  *dispbuf++ = 0xcc;
			  displen += 8;
//process CIC:D11-D0
			  *dispbuf++ = 9;       //display fld:9
			  *dispbuf++ = 1;
			  *dispbuf++ = *(recbuf+4);
			  *dispbuf++ = 12;
			  temp16 = (*(recbuf+3)>>4)+*(recbuf+4)*16;
			  temp16 &= 0xfff;
			  *dispbuf++ = HIBYTE(temp16);
			  *dispbuf++ = LOBYTE(temp16);
			  *dispbuf++ = 0xcc;
			  displen +=7;

			  recbuf += 5;
			  slen -= 5;
			 }
			else if (temp1!=0xc0 && slen>9)//DPC/OPC is 24bits
			 {is24bits=1;
//process dpc:24bits
			  proc24bitsdisp(7); //display fld:7
//process opc:24bits
			  proc24bitsdisp(8); //display fld:8
//process cic:D11-D0,12bits
			  *dispbuf++ = 9;         //display fld:9
			  *dispbuf++ = 2; 			 //source data byte
			  temp16 = (*recbuf+*(recbuf+1)*256)<<4;
			  *dispbuf++ = *recbuf++;       //source data
			  *dispbuf++ = *recbuf++;       //source data
			  *dispbuf++ =12;			 //display bit len:12
			  *dispbuf++ = HIBYTE(temp16);
			  *dispbuf++ = LOBYTE(temp16);
			  *dispbuf++ = 0xcc;		 //end flag
			  displen += 8;

			  slen -= 8;
			 }
			else //illegal data
			 {procmoredatadisp(slen);
			  break;
			 }//illegal data

//proc TUP H1H0
			  dfieldno=10;
			  temp1 = *recbuf;  //get H1H0
			  proc8bitsdisp(10);  //display fld:8
			  slen--;

			  if(slen!=0)
				{temp2=temp1;
				 temp1 &= 0x0f;

				 if (temp1==0x08 && temp2!=0x98)//GRM
//there are RANGE(8) & STATUS(8n)
				  {temp1 = *recbuf;  //get RANGE
					proc8bitsdisp(11); //display fld:11
//process STATUS
					if (temp1!=0)//exist STATUS
					 {*dispbuf++ = 12;     //display fld:12
					  temp2=temp1;
					  temp1 /= 8;
					  temp1++;
					  *dispbuf++ = temp1;
					  memcpy(dispbuf,recbuf,temp1);
					  dispbuf += temp1;
					  *dispbuf++ = temp2+1;
					  memcpy(dispbuf,recbuf,temp1);
					  dispbuf += temp1;
					  recbuf += temp1;
					  *dispbuf++=0xcc;
					  displen += temp1*2+4;
					 }//exist STATUS
				  }//GRM
				 else
				  {switch(temp2)
					 {
					  case 0x11://IAM
					  case 0x21://IAI
//CLGPC(6bits):D5-D0
					  *dispbuf++ = 11;    //display fld:11
					  *dispbuf++ = 1;
					  temp1 = *recbuf++;
					  *dispbuf++ = temp1;
					  *dispbuf++ =6;
					  *dispbuf++ = temp1<<2;
					  *dispbuf++ =0xcc;
					  slen--;
					  displen +=6;
//MIN:12bits
					  *dispbuf++ = 12;    //display fld:8
					  *dispbuf++ = 2;
					  *dispbuf++ = *recbuf;  //source data
					  *dispbuf++ = *(recbuf+1);
					  *dispbuf++ =12;
					  temp16 = (*recbuf + *(recbuf+1)*256)<<4;  //get 12bits
					  *dispbuf++ = HIBYTE(temp16);
					  *dispbuf++ = LOBYTE(temp16);
					  *dispbuf++ = 0xcc;
					  displen +=8;
//NOA:,4bits,D7-D4
					  *dispbuf++ = 13;    //display fld:8
					  *dispbuf++ = 0;
					  *dispbuf++ = 4;
					  temp1 = *(recbuf+1);
					  temp1 &= 0xf0;
					  *dispbuf++ = temp1;
					  *dispbuf++ = 0xcc;
					  displen += 5;
					  recbuf +=2;
					  slen -=2;
//BADDR
					  temp1=temp1 >>4;
					  if (temp1 !=0)//NOA !=0
						 procaddr(0,temp1,14); //display fld:14
//if IAI go on
					  if (temp2==0x21)
						{
//IN1:8BITS
						 temp1 = *recbuf;  //get IN1
						 proc8bitsdisp(15); //display fld:15
//NATUS
						 if (temp1 & 0x01)//exist NATUS:8bits
						    proc8bitsdisp(16);
						 if (temp1&0x02 )//exist CUGIN:40bits
						  {
							*dispbuf++ = 17;   //display fld:17
							*dispbuf++ =5;
							memcpy(dispbuf,recbuf,5);
							dispbuf += 5;
							*dispbuf++ =40;
							memcpy(dispbuf,recbuf,5);
							dispbuf += 5;
							recbuf += 5;
							*dispbuf++ = 0xcc;
							displen += 14;
							slen -=5;
						  }//exist CUGIN
#if BYTEOFACUIN
						 if (temp1&0x04)//exist ACUIN
						  {
							  *dispbuf++ = 18;    //display fld:18
							  *dispbuf++ =BYTEOFACUIN;
							  for (c=0;c<BYTEOFACUIN;c++) *dispbuf++ = *(recbuf+c);
							  *dispbuf++ =BYTEOFACUIN*8;
							  for (c=0;c<BYTEOFACUIN;c++) *dispbuf++ = *recbuf++;
							  *dispbuf++ = 0xcc;
							  displen += 4;
							  displen += BYTEOFACUIN*2;
							  slen -= BYTEOFACUIN;
						  }//exist ACUIN
#endif
#if BYTEOFAPIN
						 if (temp1&0x08)//exist APIN
						  {
							*dispbuf++ = 19; //display fld:19
							*dispbuf++ =BYTEOFAPIN;
							for (c=0;c<BYTEOFAPIN;c++) *dispbuf++ = *(recbuf+c);
							*dispbuf++ =BYTEOFAPIN*8;
							for (c=0;c<BYTEOFAPIN;c++) *dispbuf++ = *recbuf++;
							*dispbuf++ = 0xcc;
							displen += 4;
							displen += BYTEOFAPIN*2;
							slen -= BYTEOFAPIN;
						  }//exist APIN
#endif
						 if (temp1&0x10)//exist CULIN
							 procauliddisp(20); //display fld:20

						 if (temp1&0x20)//exist OULIN
							 procobuliddisp(23); //display fld:23
#if BYTEOFCHGIN
						 if (temp1&0x40)//exist CHGIN
						  {*dispbuf++ = 26;    //display fld:26
							*dispbuf++ =BYTEOFCHGIN;
							for (c=0;c<BYTEOFCHGIN;c++) *dispbuf++ = *(recbuf+c);
							*dispbuf++ =BYTEOFCHGIN*8;
							for (c=0;c<BYTEOFCHGIN;c++) *dispbuf++ = *recbuf++;
							*dispbuf++ = 0xcc;
							displen += 4;
							displen += BYTEOFCHGIN*2;
							slen -= BYTEOFCHGIN;
						  }//exist CHGIN
#endif
						}//IAI
					  break;

					  case 0x31://SAM
//NOA:D7-D4,4BITS
						*dispbuf++ = 11;    //display fld:11
						*dispbuf++ =1;
						temp1 = *recbuf++;
						*dispbuf++ = temp1;
						*dispbuf++ =4;
						*dispbuf++ = temp1&0xf0;
						*dispbuf++ = 0xcc;
						displen +=6;
//BADDR
						if (temp1 !=0)//NOA !=0
						  {temp1=temp1 >>4;
							procaddr(0,temp1,12); //display fld:12
						  }
						break;

					  case 0x41://SAO
//SAO:D3-D0,4BITS
						*dispbuf++ = 11;   //display fld:11
						*dispbuf++ =1;
						temp1 = *recbuf++;
						*dispbuf++ = temp1;
						*dispbuf++ =4;
						*dispbuf++ = temp1<<4;
						*dispbuf++ = 0xcc;
						displen +=6;
						break;

					  case 0x12://GSM
//ACKIN,8BITS
						temp1 = *recbuf;  //get ACKIN
						proc8bitsdisp(11); //display fld:11

						if (temp1&0x01)//exist CLGPC
						 {*dispbuf++ = 12;    //display fld:12
						  *dispbuf++ =1;
						  temp2 = *recbuf++;
						  *dispbuf++ = temp2;
						  *dispbuf++ =6;
						  *dispbuf++ = temp2<<2;
						  *dispbuf++ = 0xcc;
						  displen +=6;
						 }//exist CLGPC

						if(temp1&0x02)//exist CULIN
							procauliddisp(13); //display fld:13

						if (temp1&0x04)//exist ITTXID
						 {
//IDTIN:D3-D0,4BITS
						  *dispbuf++ = 16;    //display fld:16
						  *dispbuf++ =1;
						  temp2 = *dispbuf++ =*recbuf++;
						  *dispbuf++ =4;
						  *dispbuf++ = temp2<<4;
						  *dispbuf++ = 0xcc;
						  displen +=6;
//XIDLI:D7-D4,4BITS
						  *dispbuf++ = 17;   //display fld:17
						  *dispbuf++ =0;
						  *dispbuf++ =4;
						  *dispbuf++ = temp2&0xf0;
						  *dispbuf++ = 0xcc;
						  displen +=5;

						  if ((temp2&0xf0) == 0)//TXID is SP CODE
							  proc24bitsdisp(18);  //display fld:18
						  else//TXID is ADDR
							{noa=temp2>>4;
							 procaddr(0,noa,18); //display fld:18
							}//TXID is ADDR
//FLIN:D7-D4
						*dispbuf++ = 19;    //display fld:19
						*dispbuf++ = 1;
						temp2 =*dispbuf++ = *recbuf++;
						*dispbuf++ =4;
						*dispbuf++ = temp2&0xf0;
						*dispbuf++ =0xcc;
						displen +=6;

						if((temp2&0xf0) !=0)//exist ITID
						 {*dispbuf++ = 20;   //display fld:20
						  *dispbuf++ = temp2>>4;
						  temp2 /=16;
						  for (c=0;c<temp2;c++) *dispbuf++ = *(recbuf+c);
						  *dispbuf++ = temp2*8;
							for (c=0;c<temp2;c++) *dispbuf++ = *recbuf++;
						  *dispbuf++ = 0xcc;
						  displen += temp2*2+4;
						 }//exist ITID
						}//exist ITTXID

						if (temp1&0x08)//exist OADDR
						  procobuliddisp(21); //display fld:21
						break;

					  case 0x13://GRQ
					  case 0x14://ACM
					  case 0x1a://ACC
//there is IN(8)
						proc8bitsdisp(11); //display fld:11
						break;

					  case 0x24://CHG
//there is charg information:8nbits
//waiting for reserxh
						break;

					  case 0xf5://EUM
//there are IN(8) & SPCODE(24/14)
//IN:8BITS
						proc8bitsdisp(11); //display fld:11
//SPCODE:24BITS
						proc24bitsdisp(12); //display fld:12
						break;

					  case 0x2c://MPM
//there is charg information:16bits
						*dispbuf++ = 11;    //display fld:11
						*dispbuf++ = 2;
						*dispbuf++ = *recbuf;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ =16;
						*dispbuf++ = *(recbuf+1);
						*dispbuf++ = *recbuf;
						*dispbuf++ =0xcc;
						displen +=8;
						break;
					  }//TUP:switch:H1H0
					 }//else not GRM message:x8
					}//slen!=0
				 break;

		  case 5://ISUP
			    if ((Version&0x02)==0) procmoredatadisp(slen);
				else  procISUPdisp(slen);
				 break;

		  case 6://DUP1
				 procmoredatadisp(slen);break;
		  case 7://DUP2
				 procmoredatadisp(slen);break;
		  case 2:
		  case 8:
		  case 9:
		  case 10:
		  case 11:
		  case 12:
		  case 13:
		  case 14:
		  case 15:
				 procmoredatadisp(slen);break;
				default:break;
		 }//switch temp1
	  }//MSU
  }//if LI<0x3f
  else if (slen!=0) procmoredatadisp(slen); //illegal data

  *dispbuf++ = 0xee;    //message end
  displen++;
  *dispbuf++ = 0xaa;    //total end
  olen += displen+4; //set total length:add msg ch(2) & msg len(2);

  BUFDISPLAY[2] = LOBYTE(olen); //set total length(L)
  BUFDISPLAY[3] = HIBYTE(olen); //set total length(H)
  *bufbak = LOBYTE(displen);  //set single len(L)
  *(bufbak+1) = HIBYTE(displen);  //set single len(H)
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -