|
@@ -47,19 +47,12 @@ func (a *Access) SetStatus(args rpcs.ArgsSetStatus, reply *rpcs.ReplySetStatus)
|
|
|
func (a *Access) GetStatus(args rpcs.ArgsGetStatus, reply *rpcs.ReplyGetStatus) error {
|
|
|
server.Log.Infof("Access Get Status: %v", args)
|
|
|
// first send a get status command
|
|
|
- //cmdArgs := rpcs.ArgsSendCommand{
|
|
|
- // DeviceId: args.Id,
|
|
|
- // SubDevice: 65535,
|
|
|
- // No: commandGetCurrentStatus,
|
|
|
- // Priority: 99,
|
|
|
- // WaitTime: 0,
|
|
|
- //}
|
|
|
- //cmdReply := rpcs.ReplySendCommand{}
|
|
|
- //err := a.SendCommand(cmdArgs, &cmdReply)
|
|
|
- //if err != nil {
|
|
|
- // return err
|
|
|
- //}
|
|
|
- //
|
|
|
+ cmdArgs := rpcs.ArgsSendCommand{
|
|
|
+ DeviceId: args.Id,
|
|
|
+ WaitTime: 0,
|
|
|
+ Cmd: "report",
|
|
|
+ }
|
|
|
+ cmdReply := rpcs.ReplySendCommand{}
|
|
|
//// then wait for status report
|
|
|
//StatusChan[args.Id] = make(chan *protocol.Data)
|
|
|
//after := time.After(defaultTimeoutSecond * time.Second)
|
|
@@ -77,7 +70,7 @@ func (a *Access) GetStatus(args rpcs.ArgsGetStatus, reply *rpcs.ReplyGetStatus)
|
|
|
// reply.Status = data.SubData
|
|
|
// return nil
|
|
|
//}
|
|
|
- return nil
|
|
|
+ return a.SendCommand(cmdArgs, &cmdReply)
|
|
|
}
|
|
|
|
|
|
func (a *Access) SendCommand(args rpcs.ArgsSendCommand, reply *rpcs.ReplySendCommand) error {
|