//设置IP /// <summary> /// 0x0018 DWORD 服务器TCP 端口 /// 0x0013 STRING 主服务器地址,IP 或域名 /// </summary> /// <param name="apn"></param> /// <param name="type"></param> /// <param name="ips"></param> /// <param name="port"></param> /// <param name="span"></param> /// <returns></returns> public override byte[] SetNetConfigure(APNType apn, IpType type, byte[] ips, int port, int span) { uint ipId = 0x0018; uint portId = 0x0042; if (IpType.Udp == type) { portId = 0x0019; } string ip = string.Format("{0}.{1}.{2}.{3}", ips[0], ips[1], ips[2], ips[3]); var ipBytes = Bit.StringToBytes(ip); uint nport = Convert.ToUInt32(port); var portBytes = BitConverter.GetBytes(Endian.SwapUInt32(nport)); var p = new TerminalParam(ipId, (byte)ipBytes.Length, ipBytes); var p2 = new TerminalParam(portId, (byte)portBytes.Length, portBytes); var list = new List<TerminalParam>(); list.Add(p); list.Add(p2); return this.SetParamMessageByList(list); }
public static void SetAPN(APNType type ,string apn) { // Safety measure // We don't want our H/W to be exposed to idiots :-S apn = apn.Replace("\"", ""); // Defaulting to IP... string types = "IP"; switch (type) { case APNType.IPv4: types = "IP"; break; case APNType.IPv6: types = "IPV6"; break; case APNType.PPP: types = "PPP"; break; } string response = command("AT+CGDCONT=1,\""+ types + "\",\"" + apn + "\""); if (!response.Contains("OK")) throw new Exception("Could not set APN."); }
/// <summary> /// 下发指令使终端升级 /// </summary> /// <param name="apn"></param> /// <param name="iptype"></param> /// <param name="ip"></param> /// <param name="prot"></param> /// <param name="version"></param> /// <returns></returns> public override byte[] SetDownload(APNType apn, IpType iptype, byte[] ip, int prot, string version) { }