README.md 3.4 KB

4G DTU AT指令远程配置服务端

  • 4G DTU有一个socket通道接入本服务,并保持长连接
  • 本服务通过RPCX对外暴露服务接口

1.rpc接口文档

通用参数

type BaseArgs struct {
    IMEI string
}

1.1 查询基站GPS信息

返回的lat, lng为原始坐标

  • 方法名: GetGPSInfo
  • 请求参数:

    type BaseArgs struct {
    	IMEI string
    }
    
    • 返回参数:
    type GPSInfoReply struct {
    	Lat float64
    	Lng float64
    }
    

1.2 查询IMEI

  • 方法名: GetIMEI
  • 请求参数:

    type BaseArgs struct {
    	IMEI string
    }
    
    • 返回参数: *string

    1.3 查询ICCID

    • 方法名: GetICCID
    • 请求参数: go type BaseArgs struct { IMEI string }
  • 返回参数: *string

1.4 配置工作模式

第一个参数 0 不启用该通道; 1 TCP/UDP 透传; 2 MQTT 透传; 3 塔石 DTU 云连接; 4 塔石 IOT 云连接; 5 HTTP 传输模式; 6 阿里云直连 B 取值范围 1~4,代表 4 个不同的 SOCKET 通道,省略时仅配置通道 1 默认值:+DTUMODE:1,0,0,0 默认第一路为 TCP/UDP 透传,其他几路为默认关闭

  • 方法名: SetDTUMode
  • 请求参数:

    type SetDTUModeArgs struct {
    BaseArgs
    Mode    int // 模式
    Channel int // 通道
    }
    
    • 返回参数: *string

    1.5 设置连接服务地址

    A 取值范围 1-4,代表 4 个不同的 SOCKET 通道 B 为 TCP 或者 UDP C 为服务器地址,可填域名或 IP,长度最大 255 D 为端口号,范围 1~65535

    • 方法名:SetServerAddr
    • 请求参数: go type ServerAddrArgs struct { BaseArgs Channel int // 通道 LinkType string // 连接类型 Ip string // Ip或域名 Port int // 端口 }
  • 返回参数: EmptyResult

1.6 查询服务器连接地址

  • 方法名: GetServerAddr
  • 请求参数: BaseArgs
  • 返回参数: ```go type ServerAddrReply struct { Addrs []*Addr }

type Addr struct { Channel int // 通道 LinkType string // 连接类型 Addr string // IP或域名 Port int // 端口 }


#### 1.7 设置串口参数

> 格式:AT+UARTCFG=A,B,C,D
A 串口波特率,支持的波特率为 115200、57600、38400、19200、14400、9600、4800、 2400、1200
B 数据位,取值范围 0~1 0 7 位数据位 1 8 位数据位
C 校验位,取值范围 0~2 0 无校验 NONE 1 奇校验 ODD 2 偶校验 EVEN
D 停止位,取值范围 0~1 0 1 位停止位 1 2 位停止位
默认值:+UARTCFG:9600,1,0,0(9600,8,N,1)

* 方法名: `SetUARTParam`
* 请求参数:
```go
type UARTArgs struct {
	BaseArgs
	Rate int // 波特率
	DBit int // 数据位
	CBit int // 校验位
	SBit int // 停止位
}
  • 返回参数: EmptyResult

1.8 查询串口参数

返回值含义参考1.7说明

  • 方法名:GetUARTParam
  • 请求参数: BaseArgs
  • 返回参数:

    type UARTReply struct {
    	Rate int // 波特率
    	DBit int // 数据位
    	CBit int // 校验位
    	SBit int // 停止位
    }
    

    1.9 注册包设置

    • 方法名:SetDTUID
    • 请求参数: go type DTUIDArgs struct { BaseArgs Mode int IdType int Format int Content string Channel int }
  • 返回参数: EmptyResult

1.10 查询注册包设置

  • 方法名:GetDTUID
  • 请求参数: BaseArgs
  • 返回参数: ```go type DTUIDReply struct { DTUIDs []*DTUID }

type DTUID struct { Mode int IdType int Format int Content string Channel int } ```