浏览代码

Merge branch 'master' of http://192.168.100.32:3000/longsanlang/Network-Modules

Huyi 3 月之前
父节点
当前提交
9a7418fb3b

+ 6 - 2
Drivers/CONFIG.h

@@ -12,12 +12,16 @@
 
 
 
-//#define EC800M 1 //4G开关,不能数字开头
+#define EC800M 1 //4G开关,不能数字开头
 //#define BC260Y 1  // NB
-#define ESP32 1		//WiFi
+//#define ESP32 1		//WiFi
 //#define AIWB2	1	//WIFI_AIWB2-32S
 
 
+// 数据发送内容配置
+#define SEND_SIM_FLAG 1 // 发送的数据中有sim卡号
+
+
 
 
 // 何龙祥的配置

+ 13 - 1
Drivers/Modules/bc260y/BC260Y_UDP_Client5.c

@@ -86,6 +86,7 @@ enum Step{
 	STEP_QUERY_SLEEP, // 查询休眠
 	STEP_SET_SLEEP, // 开启休眠
 	STEP_QUERY_QENG_SERVINGCELL, // 查询信号质量
+	STEP_QUERY_ID,	//查询SIM卡号
 	
 	STEP_SET_QISDE_0, // 关闭发送回显
 	STEP_SET_QISDE_1,
@@ -398,13 +399,24 @@ static void UDPCLIENT_Process(void)
 			result = bc260y.set_cereg(2);
 			if(result == Result_Success)
 			{
-				PCTRL_GotoStep(&pctrl, STEP_QUERY_CGREG, "查询ps域");
+				PCTRL_GotoStep(&pctrl, STEP_QUERY_ID, "查询SIM卡号");
 			}
 			else if(result == Result_Failed)
 			{
 				goto_failure("设置ps域失败");
 			}
 			break;
+		case STEP_QUERY_ID: //查询SIM卡号
+			result = bc260y.query_qccid(pump_params.sim);
+			if(result == Result_Success)
+			{
+				PCTRL_GotoStep(&pctrl, STEP_QUERY_CGREG, "查询ps域");
+			}
+			else if(result == Result_Failed)
+			{
+				goto_failure("查询SIM卡号失败");
+			}
+			break;
 		case STEP_QUERY_CGREG: // 查询ps域
 			result = bc260y.query_cereg(&cgreg_n, &cgreg_stat, &cgreg_lac, &cgreg_ci);
 			if(result == Result_Success)

+ 14 - 2
Drivers/Modules/ec800m/EC800M_UDP_Client5.c

@@ -89,6 +89,7 @@ enum Step{
 	STEP_QUERY_SLEEP, // 查询休眠
 	STEP_SET_SLEEP, // 开启休眠
 	STEP_QUERY_QENG_SERVINGCELL, // 查询信号质量
+	STEP_QUERY_ID,	//查询SIM卡号
 	
 	STEP_SET_QISDE_0, // 关闭发送回显
 	STEP_SEND, // 发送
@@ -305,7 +306,7 @@ static void UDPCLIENT_Process(void)
 			result = ec800m.query_cgreg(&cgreg_n, &cgreg_stat, &cgreg_lac, &cgreg_ci);
 			if(result == Result_Success)
 			{
-				if(cgreg_stat == 1)
+				if(cgreg_stat == 1 || cgreg_stat == 5)
 				{
 					// 下一步
 					if(UDPCLIENT_TestModeFlag == 0)
@@ -331,13 +332,24 @@ static void UDPCLIENT_Process(void)
 			result = ec800m.qeng_servingcell(&signal.RSRP, &signal.RSRQ, &signal.RSSI, &signal.SINR);
 			if(result == Result_Success)
 			{
-				PCTRL_GotoStep(&pctrl, STEP_CLOSE, "关闭连接");
+				PCTRL_GotoStep(&pctrl, STEP_QUERY_ID, "查询SIM卡号");
 			}
 			else if(result == Result_Failed)
 			{
 				goto_failure("查询信号质量失败");
 			}
 			break;
+		case STEP_QUERY_ID: //查询SIM卡号
+			result = ec800m.query_qccid(pump_params.sim);
+			if(result == Result_Success)
+			{
+				PCTRL_GotoStep(&pctrl, STEP_CLOSE, "关闭连接");
+			}
+			else if(result == Result_Failed)
+			{
+				goto_failure("查询SIM卡号失败");
+			}
+			break;
 		case STEP_CLOSE: // 关闭连接
 			result = ec800m.close_socket(connectID);
 			if(result == Result_Success)

+ 1 - 1
Drivers/Modules/ec800m/Ec800m_Regist.c

@@ -261,7 +261,7 @@ static void REGIST_Process(void)
 			result = ec800m.query_cgreg(&cgreg_n, &cgreg_stat, &cgreg_lac, &cgreg_ci);
 			if(result == Result_Success)
 			{
-				if(cgreg_stat == 1)
+				if(cgreg_stat == 1 || cgreg_stat == 5)
 				{
 					PCTRL_GotoStep(&pctrl, STEP_QUERY_ID, "²éѯSIM¿¨ºÅ");
 				}

+ 16 - 0
Drivers/Utils/Pump_Dicts_Util.c

@@ -16,8 +16,10 @@
 
 #include "stm32f10x.h"
 #include <stdio.h>
+#include <string.h>
 
 #include "Pump_Dicts_Util.h"
+#include "CONFIG.h"
 
 static uint16_t  LastIDNumber = 0; // 上一个编号
 
@@ -63,6 +65,10 @@ void computeOptionLength(uint32_t Length,uint8_t *OptionLength,uint16_t *ExOptio
 
 void setPumpOption(uint16_t IDNumber,uint16_t Length,uint8_t * pump_data, uint16_t * pump_data_length)
 {
+	if(Length <= 0)
+	{
+		return;
+	}
 	uint16_t OptionNumber = 0;
 	uint16_t ExOptionDelta = 0;
 	uint16_t ExOptionLength = 0;
@@ -128,6 +134,16 @@ void PUMPDICTS_ProtocolEncode(struct PUMPDICTS_ParamsStruct * pump_params, uint8
   setPumpOption(2,1,pump_data,&length);
   pump_data[length++] = pump_params->networkType;
 	
+#ifdef SEND_SIM_FLAG
+	// sim卡号
+  setPumpOption(4,strlen(pump_params->sim),pump_data,&length);
+	for(int i = 0; i < strlen(pump_params->sim); i++)
+	{
+		pump_data[length++] = pump_params->sim[i];
+	}
+	
+#endif
+	
 	// 基站位置区号
 	setPumpOption(5,2,pump_data,&length);
 	pump_data[length++] = (uint8_t)( ( pump_params->lac & 0xff00 ) >> 8 );

+ 1 - 0
Drivers/Utils/Pump_Dicts_Util.h

@@ -13,6 +13,7 @@
 struct PUMPDICTS_ParamsStruct{
 	uint16_t userId; // 编号1,用户编号;医院编号。
 	uint8_t networkType; // 编号2,网络类型。
+	char sim[30]; // 编号4,sim卡号
 	uint16_t lac; // 编号5,基站ID。
 	uint32_t ci; // 编号6,基站小区ID。
 	uint8_t pumpType; // 编号101,泵类型。