|
|
@@ -104,7 +104,7 @@ func DetectJsonRole(jsonStr string) string {
|
|
|
}
|
|
|
|
|
|
// 处理控制板返回的-请求应答
|
|
|
-func handleRpcResp(jsonStr string) {
|
|
|
+func handleResponse(jsonStr string) {
|
|
|
}
|
|
|
|
|
|
//export RTU_ProcessJsonString
|
|
|
@@ -112,7 +112,7 @@ func RTU_ProcessJsonString(jsonStr *C.char) *C.char {
|
|
|
s := C.GoString(jsonStr)
|
|
|
role := DetectJsonRole(s)
|
|
|
if role == "response" {
|
|
|
- handleRpcResp(s)
|
|
|
+ handleResponse(s)
|
|
|
return nil
|
|
|
} else if role != "request" {
|
|
|
return nil
|
|
|
@@ -135,16 +135,16 @@ func RTU_ProcessJsonString(jsonStr *C.char) *C.char {
|
|
|
switch r.Method {
|
|
|
// 控制板查询数据板状态
|
|
|
case "get_rtu_status":
|
|
|
- w = call(handleGetRTUStatus)
|
|
|
+ w = call(getRTUStatus)
|
|
|
// 控制板发送传感器数据
|
|
|
case "send_sensor_data":
|
|
|
- w = call(handleSendSensorData)
|
|
|
+ w = call(sendSensorData)
|
|
|
// 控制板请求数据板拍照
|
|
|
case "take_photo":
|
|
|
- w = call(handleTakePhoto)
|
|
|
+ w = call(takePhoto)
|
|
|
// 控制板发送预掉电通知
|
|
|
case "power_down":
|
|
|
- w = call(handlePowerDown)
|
|
|
+ w = call(powerDown)
|
|
|
default:
|
|
|
w = jsonrpc2.BuildError(r, jsonrpc2.ErrMethodNotFound, "")
|
|
|
}
|
|
|
@@ -158,7 +158,7 @@ func RTU_ProcessJsonString(jsonStr *C.char) *C.char {
|
|
|
}
|
|
|
|
|
|
// 控制板查询数据板状态
|
|
|
-func handleGetRTUStatus(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
+func getRTUStatus(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
netst := "offline"
|
|
|
if netmgrd.IsInetAvailable() {
|
|
|
netst = "online"
|
|
|
@@ -180,7 +180,7 @@ func handleGetRTUStatus(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
}
|
|
|
|
|
|
// 控制板发送传感器数据
|
|
|
-func handleSendSensorData(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
+func sendSensorData(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
if Board == nil || Board.OneEnvDataCh == nil {
|
|
|
return jsonrpc2.BuildError(r, jsonrpc2.ErrInternal, ""), nil
|
|
|
}
|
|
|
@@ -204,7 +204,7 @@ func handleSendSensorData(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
}
|
|
|
|
|
|
// 控制板请求数据板拍照
|
|
|
-func handleTakePhoto(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
+func takePhoto(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
if Board == nil || Board.ReqTakePhoCh == nil {
|
|
|
return jsonrpc2.BuildError(r, jsonrpc2.ErrInternal, ""), nil
|
|
|
}
|
|
|
@@ -220,7 +220,7 @@ func handleTakePhoto(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
}
|
|
|
|
|
|
// 控制板发送预掉电通知
|
|
|
-func handlePowerDown(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
+func powerDown(r *jsonrpc2.Request) (*jsonrpc2.Response, error) {
|
|
|
netst := "offline"
|
|
|
if netmgrd.IsInetAvailable() {
|
|
|
netst = "online"
|