|
@@ -58,7 +58,7 @@ func GetDeviceInfoByKey(params martini.Params, req *http.Request, r render.Rende
|
|
|
key := req.URL.Query().Get("device_key")
|
|
|
server.Log.Printf("ACTION GetDeviceInfoByKey, key:: %v", key)
|
|
|
device := &models.Device{}
|
|
|
- err := server.RPCCallByName("registry", "Registry.ValidateDevice", key, device)
|
|
|
+ err := server.RPCCallByName(nil, "registry", "Registry.ValidateDevice", key, device)
|
|
|
if err != nil {
|
|
|
r.JSON(http.StatusOK, renderError(ErrDeviceNotFound, err))
|
|
|
return
|
|
@@ -80,7 +80,7 @@ func GetDeviceInfoByIdentifier(urlparams martini.Params, r render.Render) {
|
|
|
identifier := urlparams["identifier"]
|
|
|
server.Log.Printf("ACTION GetDeviceInfoByIdentifier, identifier:: %v", identifier)
|
|
|
device := &models.Device{}
|
|
|
- err := server.RPCCallByName("registry", "Registry.FindDeviceByIdentifier", identifier, device)
|
|
|
+ err := server.RPCCallByName(nil, "registry", "Registry.FindDeviceByIdentifier", identifier, device)
|
|
|
if err != nil {
|
|
|
r.JSON(http.StatusOK, renderError(ErrDeviceNotFound, err))
|
|
|
return
|
|
@@ -106,7 +106,7 @@ func GetDeviceCurrentStatus(device *models.Device, config *productconfig.Product
|
|
|
Id: uint64(device.ID),
|
|
|
}
|
|
|
statusreply := rpcs.ReplyGetStatus{}
|
|
|
- err := server.RPCCallByName("controller", "Controller.GetStatus", statusargs, &statusreply)
|
|
|
+ err := server.RPCCallByName(nil, "controller", "Controller.GetStatus", statusargs, &statusreply)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("get devie status error: %v", err)
|
|
|
r.JSON(http.StatusOK, renderError(ErrSystemFault, err))
|
|
@@ -159,7 +159,7 @@ func SetDeviceStatus(device *models.Device, config *productconfig.ProductConfig,
|
|
|
Status: status,
|
|
|
}
|
|
|
statusreply := rpcs.ReplySetStatus{}
|
|
|
- err = server.RPCCallByName("controller", "Controller.SetStatus", statusargs, &statusreply)
|
|
|
+ err = server.RPCCallByName(nil, "controller", "Controller.SetStatus", statusargs, &statusreply)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("set devie status error: %v", err)
|
|
|
r.JSON(http.StatusOK, renderError(ErrSystemFault, err))
|
|
@@ -206,7 +206,7 @@ func SendCommandToDevice(device *models.Device, config *productconfig.ProductCon
|
|
|
Params: command.Params,
|
|
|
}
|
|
|
cmdreply := rpcs.ReplySendCommand{}
|
|
|
- err = server.RPCCallByName("controller", "Controller.SendCommand", cmdargs, &cmdreply)
|
|
|
+ err = server.RPCCallByName(nil, "controller", "Controller.SendCommand", cmdargs, &cmdreply)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("send devie command error: %v", err)
|
|
|
r.JSON(http.StatusOK, renderError(ErrSystemFault, err))
|
|
@@ -236,7 +236,7 @@ func AddRule(device *models.Device, req *http.Request, r render.Render) {
|
|
|
}
|
|
|
reply := &rpcs.ReplyEmptyResult{}
|
|
|
|
|
|
- err = server.RPCCallByName("registry", "Registry.CreateRule", rule, reply)
|
|
|
+ err = server.RPCCallByName(nil, "registry", "Registry.CreateRule", rule, reply)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("create device rule error: %v", err)
|
|
|
r.JSON(http.StatusOK, renderError(ErrSystemFault, err))
|