예제 #1
0
 // Send Raw Message
 public static async Task <bool> SendNotification(Notification.MessageData msg)
 {
     if (_notification == null)
     {
         _logger.LogWarning("Brain | server not started, ignore notification");
         return(false);
     }
     _logger.LogDebug($"Brain | msgtype {msg.Type}");
     return(await _notification.Send(msg));
 }
예제 #2
0
        public static async Task <bool> SendNotification(NEEONotification msg, string deviceId)
        {
            if (_notification == null)
            {
                _logger.LogWarning("Brain | server not started, ignore notification");
                return(false);
            }
            string notificationKey = await _notificationMapping.GetNotificationKey(msg.UniqueDeviceId, deviceId, msg.Component);

            if (notificationKey != null)
            {
                _logger.LogDebug($"Brain | notificationKey {notificationKey}");
                Notification.MessageData notificationData = new Notification.MessageData {
                    Type = notificationKey, Data = msg.Value
                };
                return(await _notification.Send(notificationData));
            }
            return(false);
        }