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

📄 cfprach.cpp

📁 3G中FP协议的DCH和RACH解码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
			return 0;
		}
		else
		{
			str.Format(_T("待解码数据错误!"));
			res+=str;
			return 1;
		}
		
	}
	else 
	{
		str.Format(_T("待解码数据错误!"));
		res+=str;
		return 1;
	}
//		return 0;
}//4 3月15日,修改增加程序健壮性。
	
  else
   {str.Format(_T("数据与传输格式集不符!"));
	   res+=str;
	   return   1;
   }
    return 0; 
}//11
else
{str.Format(_T("待解码数据错误!"));
	res+=str;
	return 1;
}
  return 0;

}

WORD CFpRach::CCHControlFrameDecode(BYTE *pMsg, WORD Length, CString &res)
{
	BYTE* temp=pMsg;
	Length=Length/8;
	CString str;

	BYTE Type=*(temp+1);
	WORD a;
	DWORD a1;
	int toa;
	long toa1;
	DWORD t1;
	DWORD t2;
	DWORD t3;
	BYTE t_h;
	BYTE t_m;
	BYTE t_l;
	float t;
	BYTE toa_h;
	BYTE toa_m;
	BYTE toa_l;

	switch(Type) {
	case 0x01:
		str.Format(_T("#FP RACH: Outer Loop Power Control"));// Modify on 4/12 by QiYing
		res+=str;
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		
		str.Format(_T("Outer Loop Power Control"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;

		str.Format(_T("@UL_SIR_TARGET|%X|SIR目标值:%f dB"),*temp,0.1*(*temp)-8.2);
		res+=str;
		temp++;
		if(Length-3)
		{
			str.Format(_T("⑴Trailer"));
			res+=str;

			str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-3,TRUE));
			res+=str;
//			return 0;
		}
//		else
			return 0;
		break;
	case 0x02:
		str.Format(_T("#FP RACH: Timing adjustment"));// Modify on 4/12 by QiYing
		res+=str;
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		
		str.Format(_T("Timing adjustment"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;

		if(ConfigInf.eTrChType==P_CH)
		{
			str.Format(_T("@CFN(Connection Frame Number)|%02X %02X|连接帧号"),*temp,(*(temp+1)&0xf0)>>4);
			res+=str;
			temp+=2;
			toa_h=*temp;
			toa_m=*(temp+1);
			toa_l=(*(temp+2)&0xf0)>>4;
			a1=(toa_h<<12)+(toa_m<<4)+toa_l;
			toa1=(long)a1;
			str.Format(_T("@ToA|%02X %02X %02X|到达时间:%f ms"),*temp,*(temp+1),(*(temp+2)&0xf0)>>4,0.125*toa1);
			res+=str;
			temp+=3;
			if(Length-7)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-7,TRUE));
				res+=str;
//				return 0;
			}
//			else
				return 0;
		}
		else
		{
			str.Format(_T("@CFN(Connection Frame Number)|%X|连接帧号"),*temp);
			res+=str;
			temp++;
			temp++;
			toa_h=*temp;
			toa_l=*(temp+1);
			a=(toa_h<<8)+toa_l;
			toa=(int)a;
			str.Format(_T("@ToA|%02X %02X|到达时间:%f ms"),*temp,*(temp+1),toa*0.125);
			res+=str;
			temp+=2;
			if(Length-5)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-5,TRUE));
				res+=str;
//				return 0;
			}
//			else
				return 0;
		}
		break;
	case 0x03:
		str.Format(_T("#FP RACH: DL synchronisation"));// Modify on 4/12 by QiYing
		res+=str;
		
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		
		str.Format(_T("DL synchronisation"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;
		
		if(ConfigInf.eTrChType==P_CH)
		{
			str.Format(_T("@CFN(Connection Frame Number)|%02X %02X|连接帧号"),*temp,(*(temp+1)&0xf0)>>4);
			temp+=2;
			if(Length-4)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-4,TRUE));
				res+=str;
//				return 0;
			}
//			else
				return 0;
		}
		else
		{
			str.Format(_T("@CFN(Connection Frame Number)|%X|连接帧号"),*temp);
			if(Length-3)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-4,TRUE));
				res+=str;
//				return 0;
			}
//			else
				return 0;
		}
		
		break;
	case 0x04:
		str.Format(_T("#FP RACH: UL synchronisation"));// Modify on 4/12 by QiYing
		res+=str;
		
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		
		str.Format(_T("UL synchronisation"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;
		
		if(ConfigInf.eTrChType==P_CH)
		{
			str.Format(_T("@CFN(Connection Frame Number)|%02X %02X|连接帧号"),*temp,(*(temp+1)&0xf0)>>4);
			res+=str;
			temp+=2;
			toa_h=*temp;
			toa_m=*(temp+1);
			toa_l=(*(temp+2)&0xf0)>>4;
			a1=(toa_h<<12)+(toa_m<<4)+toa_l;
			toa1=(long)a1;
			str.Format(_T("@ToA|%02X %02X %02X|到达时间:%f ms"),*temp,*(temp+1),(*(temp+2)&0xf0)>>4,0.125*toa1);
			res+=str;
			temp+=3;
			if(Length-7)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-7,TRUE));
				res+=str;
//				return 0;
			}
//			else
				return 0;
		}
		else
		{
			str.Format(_T("@CFN(Connection Frame Number)|%X|连接帧号"),*temp);
			res+=str;
			temp++;
			toa_h=*temp;
			toa_l=*(temp+1);
			a=(toa_h<<8)+toa_l;
			toa=(int)a;
			str.Format(_T("@ToA|%02X %02X|到达时间:%f ms"),*temp,*(temp+1),0.125*toa);
			res+=str;
			temp+=2;
			if(Length-5)
			{
				str.Format(_T("⑴Trailer"));
				res+=str;
				str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-5,TRUE));
				res+=str;
//				return 0;
			}
//			else 
				return 0;
		}		
		break;
	case 0x06:
		str.Format(_T("#FP RACH: DL Node synchronisation"));// Modify on 4/12 by QiYing
		res+=str;
		
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		str.Format(_T("DL Node synchronisation"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;
		
		t_h=*temp;
		t_m=*(temp+1);
		t_l=*(temp+2);
		t1=(t_h<<16)+(t_m<<8)+t_l;
		t=t1*0.125;
		str.Format(_T("@T1|%s|RNC特定帧号(指示RNC通过SAP将帧发送到传输层的时间):%f ms"),ConvertToHexStr(temp,3,TRUE),t);
		res+=str;
		temp+=3;
		if(Length-5)
		{
			str.Format(_T("⑴Trailer"));
			res+=str;
			str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-5,TRUE));
			res+=str;
//			return 0;
		}
//		else
			return 0;
		break;
	case 0x07:
		str.Format(_T("#FP RACH: UL Node synchronisation"));// Modify on 4/12 by QiYing
		res+=str;
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		str.Format(_T("UL Node synchronisation"));
		res+=str;
		temp++;
		
		str.Format(_T("⑴Payload"));
		res+=str;
		
		t_h=*temp;
		t_m=*(temp+1);
		t_l=*(temp+2);
		t1=(t_h<<16)+(t_m<<8)+t_l;
		t=t1*0.125;
		str.Format(_T("@T1|%s|RNC特定帧号(指示RNC通过SAP将帧发送到传输层的时间):%f ms"),ConvertToHexStr(temp,3,TRUE),t);
		res+=str;
		temp+=3;

		t_h=*temp;
		t_m=*(temp+1);
		t_l=*(temp+2);
		t2=(t_h<<16)+(t_m<<8)+t_l;
		t=t2*0.125;
		str.Format(_T("@T2|%s|Node B 特定帧号(BFN)(指示当Node B从传输层通过SAP收到相应下行同步帧的时间):%f ms"),ConvertToHexStr(temp,3,TRUE),t);
		res+=str;
		temp+=3;

		t_h=*temp;
		t_m=*(temp+1);
		t_l=*(temp+2);
		t3=(t_h<<16)+(t_m<<8)+t_l;
		t=t3*0.125;
		str.Format(_T("@T3|%s|Node B 特定帧号(BFN)(指示当Node B 通过SAP向传输层发送帧的时间):%f ms"),ConvertToHexStr(temp,3,TRUE),t);
		res+=str;
		temp+=3;
		if(Length-11)
		{
			str.Format(_T("⑴Trailer"));
			res+=str;
			str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-11,TRUE));
			res+=str;
//			return 0;
		}
//		else
			return 0;
		break;
	case 0x08:

		str.Format(_T("#FP RACH: Dynamic PUSCH assignment"));// Modify on 4/12 by QiYing
		res+=str;
		
		str.Format(_T("⑴Header"));
		res+=str;
		
		str.Format(_T("@FT(Frame Type)|%X|控制帧"),*temp&0x01);
		res+=str;
		
		str.Format(_T("@Frame CRC|%X|帧头CRC"),(*temp&0xfe)>>1);
		res+=str;
		temp++;
		
		str.Format(_T("@Control Frame Type|%X|"),*temp);
		res+=str;
		str.Format(_T("Dynamic PUSCH assignment"));
		res+=str;
		temp++;
		str.Format(_T("⑴Payload"));
		res+=str;
		str.Format(_T("@PUSCH Set Id|%X|PUSCH集指示"),*temp);
		res+=str;
		temp++;
		str.Format(_T("@Activation CFN|%X|激活CFN:指定PUSCH集分配周期开始处的连接帧号"),*temp);
		res+=str;
		temp++;
		if(Length-4)
		{
			str.Format(_T("⑴Trailer"));
			res+=str;
			str.Format(_T("@Spare Extension|%s|备用扩展"),ConvertToHexStr(temp,Length-4,TRUE));
			res+=str;
//			return 0;
		}
//		else
			return 0;
		break;
	default:
		str.Format(_T("@error"));
		res+=str;
		return 1;
		break;
	}
}

⌨️ 快捷键说明

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