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

📄 svdisp.cpp

📁 七号信令解码器
💻 CPP
📖 第 1 页 / 共 3 页
字号:
				 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*/
			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++ =14;
			  *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++ = 14;
			  temp16 = (*(WORD *)(recbuf+1))>>6;
			  temp1=(*(recbuf+3)&0x0f)<<2;
			  *dispbuf++=temp1 | HIBYTE(temp16);
			  *dispbuf++=LOBYTE(temp16);
			  *dispbuf++ = 0xcc;
			  displen += 8;
/*process CIC:D11-D0*/
			  temp16 = *(WORD *)(recbuf+3);
			  *dispbuf++ = 9;       /*display fld:9*/
			  *dispbuf++ = 1;
			  *dispbuf++ = HIBYTE(temp16);
			  *dispbuf++ = 12;
			  temp16 &= 0xfff0;
			  *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 = *(WORD *)recbuf;
			  recbuf+=2;
			  *(WORD *)dispbuf = temp16;       /*source data*/
			  dispbuf +=2;
			  *dispbuf++ =12;			 /*display bit len:12*/
			  temp16=temp16 <<4;
			  *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;
					  for (c=0;c<temp1;c++) *dispbuf++ = *(recbuf+c);
					  *dispbuf++ = temp2+1;
					  for (c=0;c<temp1;c++) *dispbuf++ = *recbuf++;
					  *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;
					  temp16 = *(WORD *)recbuf;
					  *(WORD *)dispbuf=temp16;
					  dispbuf +=2;
					  *dispbuf++ =12;
					  temp16=temp16 << 4;
					  *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)temp1=16;//aiming modify 01/28/2002
					  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;
							for (c=0;c<5;c++) *dispbuf++ = *(recbuf+c);
							*dispbuf++ =40;
							for (c=0;c<5;c++) *dispbuf++ = *recbuf++;
							*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++ =5;
							for (c=0;c<BYTEOFAPIN;c++) *dispbuf++ = *(recbuf+c);
							*dispbuf++ =40;
							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++ =5;
							for (c=0;c<BYTEOFCHGIN;c++) *dispbuf++ = *(recbuf+c);
							*dispbuf++ =40;
							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)/*illegal data*/
	procmoredatadisp(slen);

  *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)
}
void procdisplay1(char * msg)
{
	if(msg == NULL)
		return ;
  WORD slen,i,temp16,time,olen;
  BYTE temp1,temp2,dfieldno,is24bits,c,noa,*bufbak;

  recbuf =  (unsigned char*)msg;
  dispbuf = BUFDISPLAY;
  slen = (*recbuf + *(recbuf+1)*256)&0xfff;  //get message length(low 12bits)
  recbuf+=2;     //recbuf-->message source

  Version=0xff;
  olen = 1;
  dispbuf += olen+3;

  *dispbuf++ = *recbuf++;     //display message channel No.(L)
  *dispbuf++ = *recbuf++;     //display message channel No.(H,high 4bits is Node No)

  bufbak=dispbuf;  //single message len
  dispbuf += 2;	   //reserved for single len:2bytes

  dispmsgno++;
  *dispbuf++ = LOBYTE(dispmsgno); //display message No(L)
  *dispbuf++ = HIBYTE(dispmsgno); //display message No(H)

  *(WORD *)dispbuf = 0;  		 //reserved for display:2byte
  dispbuf +=2;

//msg time:display area:5bytes,rec area:4byte
  time=*recbuf+*(recbuf+1)*256;  //get num of minute
  recbuf+=2;
  *dispbuf++ = time/60;  //hour
  *dispbuf++ = time%60;  //minute
  time=*recbuf+*(recbuf+1)*256;  //get num of ms
  recbuf+=2;
  *dispbuf++ = time/1000;  //second
  time %= 1000;
  *dispbuf++ = LOBYTE(time);  //ms(L)
  *dispbuf++ = HIBYTE(time);  //ms(H)

  displen = 9;             //display length is 9
  slen -=6;               //5byte of time + source


  dfieldno=0;					//display field No init to 0
  for (c=0;c<2;c++)
	{
//process BIB+BSN/FIB+FSN
	 dfieldno++;
	 *dispbuf++ = dfieldno;
	 *dispbuf++ = 1;          //source data byte
	 *dispbuf++ = *recbuf;	  //get BIB(1)+BSN(7)
	 *dispbuf++ = 7;          //display bit length
	 temp1=*recbuf;           //get BIB(1)+BSN(7)
	 *dispbuf++ = temp1<<1;   //display data(7)
	 *dispbuf++ =0xcc;        //sub field end

	 dfieldno++;
	 *dispbuf++ = dfieldno;
	 *dispbuf++ = 0;           //source length:0
	 *dispbuf++ = 1;           //display bit length:1
	 temp1=*recbuf++;          //get BIB(1)+BSN(7)
	 *dispbuf++ = temp1&0x80;  //display data(1)
	 *dispbuf++ =0xcc;         //sub field end

	 displen += 11;
	}//for

  slen -= 2;					//dec 2bytes:bsn+fsn

  temp1 = *recbuf++;         //LI to temp
  slen--;

  msgType = temp1;
  if(temp1<=0x3f)
	{
//process LI
	 dfieldno++;
	 *dispbuf++ = dfieldno;
	 *dispbuf++ = 1;            //source data byte
	 *dispbuf++ = temp1;	    //LI
	 *dispbuf++ = 6;            //display bit length:6
	 *dispbuf++ = temp1<<2;     //display data(6)
	 *dispbuf++ =0xcc;          //sub field end
	 displen += 6;              //add 6 byte

	 if (temp1==0)//FISU
	  {
		 *dispbuf++ = *(recbuf+1);  //get con Fisu Counter
		 *dispbuf++ = *recbuf;
		 *dispbuf++ = 0xcc;
		 displen +=3;
	  }
	 else if (temp1 <=2)//LSSU
	  {
		 temp1 = *recbuf;					//get SF
		 if (temp1<=5)
		  {
//process SF
			dfieldno++;
			proc8bitsdisp(dfieldno);

		   *dispbuf++ = *(recbuf+1);  //get con LSSU Counter
		   *dispbuf++ = *recbuf;
		   *dispbuf++ = 0xcc;
		   displen +=3;

		  }
		 else if(slen!=0)
			procmoredatadisp(slen);

	  }//LSSU
	 else if (slen!=0)//MSU
	  {

//process SIO
		dfieldno++;
		temp1=temp2= *recbuf;  //get SIO

		temp1 &= 0x0f;         //get SI
		subMsg = temp1;
		switch (temp1)
		 {
		  case 0://SNM
//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;
				is24bits=1;
			  }//DPC/OPC is 14bits
			else //illegal data
			  {procmoredatadisp(slen);
			   break;
			  }

⌨️ 快捷键说明

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