private void oscServer_MessageReceived(object sender, OscMessageReceivedEventArgs e) { sMessagesReceivedCount++; LogHelper.Log(LogLevel.Info, string.Format("[OSC] Msg Rcv [{0}]: {1} / Message contains {2} objects. [{3}]", e.Message.SourceEndPoint.Address, e.Message.Address, e.Message.Data.Count, sMessagesReceivedCount)); for (int i = 0; i < e.Message.Data.Count; i++) { LogHelper.Log(LogLevel.Debug, string.Format("[OSC] {0}: Value={1}", i, convertDataString(e.Message.Data[i]))); } OscEvent oscEvent = processTouchOscMessageForNuvoControl(e.Message); if (oscEvent != null) { LogHelper.Log(LogLevel.Info, string.Format("[OSC] NuvoControl OscEvent={0}", oscEvent.ToString())); //raise the event, and pass data to next layer if (onOscNuvoEventReceived != null) { onOscNuvoEventReceived(this, new OscEventReceivedEventArgs(_oscDevice.DeviceId, oscEvent, e.Message.SourceEndPoint)); } if (onOscEventReceived != null) { onOscEventReceived(this, new OscEventReceivedEventArgs(_oscDevice.DeviceId, oscEvent, e.Message.SourceEndPoint)); } } else { oscEvent = processTouchOscMessageFromDefaultLayouts(e.Message); if (oscEvent != null) { LogHelper.Log(LogLevel.Info, string.Format("[OSC] OscEvent={0}", oscEvent.ToString())); //raise the event, and pass data to next layer if (onOscEventReceived != null) { onOscEventReceived(this, new OscEventReceivedEventArgs(_oscDevice.DeviceId, oscEvent, e.Message.SourceEndPoint)); } } else { LogHelper.Log(LogLevel.Warn, string.Format("[OSC] Unknown message: {0}", e.Message.Address)); } } }
/// <summary> /// Public method called by the osc server, to process osc event messages. /// </summary> /// <param name="zoneAddress">Zone address</param> /// <param name="oscEvent">Osc event</param> public void processOscNuvoEventForClients(Address zoneAddress, OscEvent oscEvent) { // forward message to client _oscDriver.SendMessage(oscEvent); // forward (debug) message to client _oscDriver.SendMessage("/NuvoControl/message", String.Format("Notify {0}: {1}", _oscDeviceId, oscEvent.ToString())); if (oscEvent.OscLabel.Contains("/Generic")) { if (oscEvent.OscLabel.Contains("/ZoneSelection")) { if (oscEvent.getOscData == 0) { // ignore message with value 0, as this is only the "disable" message for the previous selected source } else if (oscEvent.getOscData == 1) { _genericZoneId = oscEvent.getZoneId; _oscDriver.SendMessage(String.Format("/NuvoControl/Generic/ZoneName"), _zones[zoneAddress].Name); _oscDriver.SendMessage("/NuvoControl/message", String.Format("Zone '{0}' selected", _zones[zoneAddress].Name)); // update generic items with zone status of selected zone Address genericZoneAddress = new Address(zoneAddress.DeviceId, _genericZoneId); UpdateZoneStateOnOscClient(genericZoneAddress, _zoneStateList[genericZoneAddress]); } } } }