Beispiel #1
0
 public JObject InsertDeviceCommand(StubWebSocketConnection connection,
                                    Guid deviceGuid, JObject command)
 {
     return(InvokeAction(connection, "command/insert", new JObject(
                             new JProperty("deviceGuid", deviceGuid),
                             new JProperty("command", command))));
 }
        protected JObject InvokeAction(StubWebSocketConnection connection, string actionName, JObject args)
        {
            JObject jsonMessage = null;

            connection.SendMessageHandler = msg => jsonMessage = JObject.Parse(msg);
            _controller.InvokeAction(connection, actionName, args);
            return(jsonMessage);
        }
Beispiel #3
0
 public JObject UpdateDeviceCommand(StubWebSocketConnection connection, Guid deviceId, string deviceKey,
                                    int commandId, JObject command)
 {
     return(InvokeAction(connection, "command/update", new JObject(
                             new JProperty("commandId", commandId),
                             new JProperty("command", command),
                             new JProperty("deviceId", deviceId),
                             new JProperty("deviceKey", deviceKey))));
 }
Beispiel #4
0
 public JObject UnsubscribeFromDeviceNotifications(StubWebSocketConnection connection, Guid[] devieGuids)
 {
     return(InvokeAction(connection, "notification/unsubscribe", new JObject(
                             new JProperty("deviceGuids", new JArray(devieGuids)))));
 }
Beispiel #5
0
 public JObject UnsubscribeFromDeviceNotifications(StubWebSocketConnection connection)
 {
     return(InvokeAction(connection, "notification/unsubscribe", null));
 }
Beispiel #6
0
 public JObject Authenticate(StubWebSocketConnection connection, string login, string password)
 {
     return(InvokeAction(connection, "authenticate", new JObject(
                             new JProperty("login", login),
                             new JProperty("password", password))));
 }
 public JObject SubscribeToDeviceNotifications(StubWebSocketConnection connection, string[] devieGuids)
 {
     return(InvokeAction(connection, "notification/subscribe", new JObject(
                             new JProperty("deviceGuids", new JArray(devieGuids)))));
 }
Beispiel #8
0
 public JObject SaveDevice(StubWebSocketConnection connection, Guid deviceGuid, JObject device)
 {
     return(InvokeAction(connection, "device/save", new JObject(
                             new JProperty("deviceId", deviceGuid),
                             new JProperty("device", device))));
 }
Beispiel #9
0
 public JObject GetDevice(StubWebSocketConnection connection)
 {
     return(InvokeAction(connection, "device/get", null));
 }
Beispiel #10
0
 public JObject UnsubsrcibeFromDeviceCommands(StubWebSocketConnection connection)
 {
     return(InvokeAction(connection, "command/unsubscribe", null));
 }
Beispiel #11
0
 public JObject InsertDeviceNotification(StubWebSocketConnection connection, JObject notification)
 {
     return(InvokeAction(connection, "notification/insert", new JObject(
                             new JProperty("notification", notification))));
 }
Beispiel #12
0
 public JObject Authenticate(StubWebSocketConnection connection, Guid deviceId, string deviceKey)
 {
     return(InvokeAction(connection, "authenticate", new JObject(
                             new JProperty("deviceId", deviceId),
                             new JProperty("deviceKey", deviceKey))));
 }