/// <summary> /// Creates an incoming message. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="payload">The payload.</param> /// <returns>A specific message type</returns> public static P3bbleMessage CreateMessage(Endpoint endpoint, List<byte> payload) { P3bbleMessage frame = null; switch (endpoint) { case Endpoint.Ping: frame = new PingMessage(); break; case Endpoint.Version: frame = new VersionMessage(); break; case Endpoint.Time: frame = new TimeMessage(); break; case Endpoint.Logs: frame = new LogsMessage(); break; case Endpoint.AppManager: frame = new AppManagerMessage(); break; case Endpoint.MusicControl: frame = new MusicMessage(); break; case Endpoint.ApplicationMessage: frame = new AppMessage(endpoint); break; case Endpoint.PutBytes: frame = new PutBytesMessage(); break; } if (frame != null) { frame.GetContentFromMessage(payload); } return frame; }
/// <summary> /// Initializes a new instance of the <see cref="ProtocolException"/> class. /// </summary> /// <param name="logMessage">The log message.</param> internal ProtocolException(LogsMessage logMessage) : base(logMessage.Message) { this.LogMessage = logMessage; }