private void Notify(WebSocketConnectionBase connection, Guid subscriptionId, DeviceNotification notification, Device device, bool isInitialNotification = false) { if (!isInitialNotification) { var initialNotificationList = GetInitialNotificationList(connection, subscriptionId); lock (initialNotificationList) // wait until all initial notifications are sent { if (initialNotificationList.Contains(notification.ID)) { return; } } if (!IsDeviceAccessible(connection, device, "GetDeviceNotification")) { return; } } connection.SendResponse("notification/insert", new JProperty("subscriptionId", subscriptionId), new JProperty("deviceGuid", device.GUID), new JProperty("notification", GetMapper <DeviceNotification>().Map(notification))); }
private void Notify(WebSocketConnectionBase connection, Guid subscriptionId, DeviceCommand command, Device device, bool isInitialCommand = false) { if (!isInitialCommand) { var initialCommandList = GetInitialCommandList(connection, subscriptionId); lock (initialCommandList) // wait until all initial commands are sent { if (initialCommandList.Contains(command.ID)) { return; } } if (!IsDeviceAccessible(connection, device, "GetDeviceCommand")) { return; } } connection.SendResponse("command/insert", new JProperty("subscriptionId", subscriptionId), new JProperty("deviceGuid", device.GUID), new JProperty("command", GetMapper <DeviceCommand>().Map(command))); }
private void Notify(WebSocketConnectionBase connection, DeviceNotification notification, Device device) { var user = (User)connection.Session["user"]; if (user == null || !IsNetworkAccessible(device.NetworkID, user)) { return; } connection.SendResponse("notification/insert", new JProperty("deviceGuid", device.GUID), new JProperty("notification", NotificationMapper.Map(notification))); }
/// <summary> /// Notifies the device about new command. /// </summary> /// <action>command/insert</action> /// <response> /// <parameter name="deviceGuid" type="string">Device unique identifier.</parameter> /// <parameter name="command" cref="DeviceCommand">A <see cref="DeviceCommand"/> resource representing the command.</parameter> /// </response> private void Notify(WebSocketConnectionBase connection, Device device, DeviceCommand command, bool isInitialCommand = false) { if (!isInitialCommand) { var initialCommandList = GetInitialCommandList(connection); lock (initialCommandList) // wait until all initial commands are sent { if (initialCommandList.Contains(command.ID)) { return; } } } connection.SendResponse("command/insert", new JProperty("deviceGuid", device.GUID), new JProperty("command", MapDeviceCommand(command))); }
private void Notify(WebSocketConnectionBase connection, Guid subscriptionId, DeviceCommand command, Device device, bool isInitialCommand = false) { if (!isInitialCommand) { var initialCommandList = GetInitialCommandList(connection, subscriptionId); lock (initialCommandList) // wait until all initial commands are sent { if (initialCommandList.Contains(command.ID)) return; } if (!IsDeviceAccessible(connection, device, "GetDeviceCommand")) return; } connection.SendResponse("command/insert", new JProperty("subscriptionId", subscriptionId), new JProperty("deviceGuid", device.GUID), new JProperty("command", GetMapper<DeviceCommand>().Map(command))); }
private void Notify(WebSocketConnectionBase connection, Guid subscriptionId, DeviceNotification notification, Device device, bool isInitialNotification = false) { if (!isInitialNotification) { var initialNotificationList = GetInitialNotificationList(connection, subscriptionId); lock (initialNotificationList) // wait until all initial notifications are sent { if (initialNotificationList.Contains(notification.ID)) return; } if (!IsDeviceAccessible(connection, device, "GetDeviceNotification")) return; } connection.SendResponse("notification/insert", new JProperty("subscriptionId", subscriptionId), new JProperty("deviceGuid", device.GUID), new JProperty("notification", GetMapper<DeviceNotification>().Map(notification))); }
private void Notify(WebSocketConnectionBase connection, Device device, DeviceCommand command) { connection.SendResponse("command/insert", new JProperty("deviceGuid", device.GUID), new JProperty("command", CommandMapper.Map(command))); }
private void Notify(WebSocketConnectionBase connection, Device device, DeviceCommand command) { connection.SendResponse("command/insert", new JProperty("deviceGuid", device.GUID), new JProperty("command", CommandMapper.Map(command))); }
private void Notify(WebSocketConnectionBase connection, DeviceNotification notification, Device device) { var user = (User) connection.Session["user"]; if (user == null || !IsNetworkAccessible(device.NetworkID, user)) return; connection.SendResponse("notification/insert", new JProperty("deviceGuid", device.GUID), new JProperty("notification", NotificationMapper.Map(notification))); }
/// <summary> /// Notifies the device about new command. /// </summary> /// <action>command/insert</action> /// <response> /// <parameter name="deviceGuid" type="string">Device unique identifier.</parameter> /// <parameter name="command" cref="DeviceCommand">A <see cref="DeviceCommand"/> resource representing the command.</parameter> /// </response> private void Notify(WebSocketConnectionBase connection, Device device, DeviceCommand command, bool isInitialCommand = false) { if (!isInitialCommand) { var initialCommandList = GetInitialCommandList(connection); lock (initialCommandList) // wait until all initial commands are sent { if (initialCommandList.Contains(command.ID)) return; } } connection.SendResponse("command/insert", new JProperty("deviceGuid", device.GUID), new JProperty("command", MapDeviceCommand(command))); }