diff --git a/Samples/BuzzerTest/BuzzerTest.csproj b/Samples/BuzzerTest/BuzzerTest.csproj
index 3d1e9e7..5266484 100644
--- a/Samples/BuzzerTest/BuzzerTest.csproj
+++ b/Samples/BuzzerTest/BuzzerTest.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/Samples/DatabaseTest/DatabaseTest.csproj b/Samples/DatabaseTest/DatabaseTest.csproj
index d2f71e4..cdff48f 100644
--- a/Samples/DatabaseTest/DatabaseTest.csproj
+++ b/Samples/DatabaseTest/DatabaseTest.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Samples/KeyTest/KeyTest.csproj b/Samples/KeyTest/KeyTest.csproj
index fa808e8..cc5ee0e 100644
--- a/Samples/KeyTest/KeyTest.csproj
+++ b/Samples/KeyTest/KeyTest.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/Samples/LedTest/LedTest.csproj b/Samples/LedTest/LedTest.csproj
index e0d2372..8446531 100644
--- a/Samples/LedTest/LedTest.csproj
+++ b/Samples/LedTest/LedTest.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/Samples/NetClientTest/NetClientTest.csproj b/Samples/NetClientTest/NetClientTest.csproj
index 8f4ef61..5e0f081 100644
--- a/Samples/NetClientTest/NetClientTest.csproj
+++ b/Samples/NetClientTest/NetClientTest.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Samples/NetServerTest/NetServerTest.csproj b/Samples/NetServerTest/NetServerTest.csproj
index db353fc..8ace9b9 100644
--- a/Samples/NetServerTest/NetServerTest.csproj
+++ b/Samples/NetServerTest/NetServerTest.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Samples/Serial2NetClientTest/Serial2NetClientTest.csproj b/Samples/Serial2NetClientTest/Serial2NetClientTest.csproj
index 2d54860..8604c3f 100644
--- a/Samples/Serial2NetClientTest/Serial2NetClientTest.csproj
+++ b/Samples/Serial2NetClientTest/Serial2NetClientTest.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Samples/Serial2NetServerTest/Serial2NetServerTest.csproj b/Samples/Serial2NetServerTest/Serial2NetServerTest.csproj
index ef06ac2..dd8bb3e 100644
--- a/Samples/Serial2NetServerTest/Serial2NetServerTest.csproj
+++ b/Samples/Serial2NetServerTest/Serial2NetServerTest.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Samples/SerialTest/SerialTest.csproj b/Samples/SerialTest/SerialTest.csproj
index fa7cc05..f1e24f9 100644
--- a/Samples/SerialTest/SerialTest.csproj
+++ b/Samples/SerialTest/SerialTest.csproj
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/Samples/UsbPowerTest/UsbPowerTest.csproj b/Samples/UsbPowerTest/UsbPowerTest.csproj
index ddaf437..04fa74c 100644
--- a/Samples/UsbPowerTest/UsbPowerTest.csproj
+++ b/Samples/UsbPowerTest/UsbPowerTest.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/SmartA2/Net/ErrorCodes.cs b/SmartA2/Net/ErrorCodes.cs
new file mode 100644
index 0000000..95498c0
--- /dev/null
+++ b/SmartA2/Net/ErrorCodes.cs
@@ -0,0 +1,22 @@
+namespace SmartA2.Net;
+
+/// 错误代码
+public enum ErrorCodes : UInt16
+{
+ /// 成功
+ Success = 0,
+
+ Fail = 1,
+
+ 执行过程信息输出 = 5,
+
+ 参数错误 = 10,
+
+ 当前模式错误 = 11,
+
+ Busy = 12,
+
+ 模块复位中 = 13,
+
+ 无此命令 = 20,
+}
diff --git a/SmartA2/Net/NetInfo.cs b/SmartA2/Net/NetInfo.cs
index e80c353..0043387 100644
--- a/SmartA2/Net/NetInfo.cs
+++ b/SmartA2/Net/NetInfo.cs
@@ -9,5 +9,9 @@ public class NetInfo
public String ICCID { get; set; }
+ public String COPS { get; set; }
+
public Int32 CSQ { get; set; }
+
+ public String LACCI { get; set; }
}
diff --git a/SmartA2/Net/NetModule.cs b/SmartA2/Net/NetModule.cs
index c96fd95..531959b 100644
--- a/SmartA2/Net/NetModule.cs
+++ b/SmartA2/Net/NetModule.cs
@@ -73,8 +73,11 @@ public NetResult Send(UInt16 cmd, Byte[] args)
if (reader.ReadFixedString(3) != "HTR") return null;
var cmd2 = reader.ReadUInt16();
- var code = reader.ReadUInt16();
+ var code = (ErrorCodes)reader.ReadUInt16();
var str = reader.ReadFixedString(-1);
+#if DEBUG
+ XTrace.WriteLine("cmd={0} code={1} message={2}", cmd2, code, str);
+#endif
return new NetResult { Cmd = cmd2, Code = code, Message = str };
}
@@ -167,13 +170,25 @@ public String GetState()
///
public NetInfo GetNetInfo()
{
- var inf = new NetInfo
- {
- IMEI = GetIMEI(),
- IMSI = GetIMSI(),
- ICCID = GetICCID(),
- CSQ = GetCSQ().ToInt(),
- };
+ var inf = new NetInfo();
+
+ inf.IMEI = GetIMEI();
+
+ Thread.Sleep(100);
+ inf.IMSI = GetIMSI();
+
+ Thread.Sleep(100);
+ inf.ICCID = GetICCID();
+
+ Thread.Sleep(100);
+ inf.COPS = GetCOPS();
+
+ Thread.Sleep(100);
+ inf.CSQ = GetCSQ().ToInt();
+
+ Thread.Sleep(100);
+ inf.LACCI = GetLACCI();
+
return inf;
}
#endregion
diff --git a/SmartA2/Net/NetResult.cs b/SmartA2/Net/NetResult.cs
index 82ec697..d14eaca 100644
--- a/SmartA2/Net/NetResult.cs
+++ b/SmartA2/Net/NetResult.cs
@@ -4,7 +4,7 @@ public class NetResult
{
public UInt16 Cmd { get; set; }
- public UInt16 Code { get; set; }
+ public ErrorCodes Code { get; set; }
public String Message { get; set; }
}
diff --git a/SmartA2/SmartA2.csproj b/SmartA2/SmartA2.csproj
index 68e9f47..f69a959 100644
--- a/SmartA2/SmartA2.csproj
+++ b/SmartA2/SmartA2.csproj
@@ -49,7 +49,7 @@
-
+
diff --git a/Test/Program.cs b/Test/Program.cs
index 43184d7..da6321f 100644
--- a/Test/Program.cs
+++ b/Test/Program.cs
@@ -71,28 +71,28 @@ static void Test3()
XTrace.WriteLine("Info:\t{0}", module.GetInfo());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("Version:\t{0}", module.GetVersion());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("State:\t{0}", module.GetState());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("IMEI:\t{0}", module.GetIMEI());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("IMSI:\t{0}", module.GetIMSI());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("CSQ:\t{0}", module.GetCSQ());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("COPS:\t{0}", module.GetCOPS());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("ICCID:\t{0}", module.GetICCID());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("LACCI:\t{0}", module.GetLACCI());
- //Thread.Sleep(1000);
+ Thread.Sleep(1000);
XTrace.WriteLine("LBS:\t{0}", module.GetLBS());
module.Close();
diff --git a/XUnitTest/XUnitTest.csproj b/XUnitTest/XUnitTest.csproj
index bee2254..0f10b7f 100644
--- a/XUnitTest/XUnitTest.csproj
+++ b/XUnitTest/XUnitTest.csproj
@@ -13,7 +13,7 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all