/// <summary> /// Check if logs have been read and pulls from subscriber /// </summary> public void Update() { // check if logs have been read if (operatorLogTextMesh.IsActive() == true) { operatorUnreadCount = 0; UpdateOperatorUnreadCounter(); } // Pull from subscriber if (LogSubscriber.Instance.MessageQueueCount() != 0) { AudioManager.Instance.PlayMessageSound(); RosSharp.RosBridgeClient.Message messageObject = LogSubscriber.Instance.DequeueOperatorMessage(); AddOperatorLogMessage(messageObject); } }
/// <summary> /// New message was pulled and has to be processed /// </summary> /// <param name="logMessage">message object in RosSharp</param> public void AddOperatorLogMessage(RosSharp.RosBridgeClient.Message logMessage) { LogLevel logLevel = LogLevel.info; string message = ""; if (logMessage is RosSharp.RosBridgeClient.Messages.Roboy.ErrorNotification) { logLevel = LogLevel.error; message = ((RosSharp.RosBridgeClient.Messages.Roboy.ErrorNotification)logMessage).msg; } else if (logMessage is RosSharp.RosBridgeClient.Messages.Roboy.WarningNotification) { logLevel = LogLevel.warning; message = ((RosSharp.RosBridgeClient.Messages.Roboy.WarningNotification)logMessage).msg; } else if (logMessage is RosSharp.RosBridgeClient.Messages.Roboy.InfoNotification) { logLevel = LogLevel.info; message = ((RosSharp.RosBridgeClient.Messages.Roboy.InfoNotification)logMessage).msg; } if (logLevel == LogLevel.error) { //Debug.Log("Toastr"); OperatorToastr(message); } else if (logLevel == LogLevel.info || logLevel == LogLevel.warning) { //Debug.Log("Info/Warning"); addToOperatorText(message, logLevel); // Update unread counter if (operatorLogTextMesh.IsActive() == false) { operatorUnreadCount++; } // Display new unread counter UpdateOperatorUnreadCounter(); } }
public void EnqueueOperatorMessage(RosSharp.RosBridgeClient.Message msg) { operatorMessageQueue.Enqueue(msg); }
private void Receive(Message message) { MessageReceiver.RaiseMessageReception(new MessageEventArgs(message)); }