protected override void OnMessageReceived(MessageFrame message) { switch (message.Command) { case Command.Identify: SendCommand(Command.Identify, "ff:ghg"); break; case Command.Sync: SendCommand(Command.Sync, null); OnSync(new ClientSyncEventArgs { Profile = (AppProfile)message.State }); break; case Command.StartExambro: OnStart(); break; case Command.SequentialConfig: OnSetup(new ClientSetupEventArgs { Profile = (NetworkProfile)message.State }); break; case Command.TurnOff: OnShutdown(); break; } }
protected void SendCommand(Command command, object parameter) { var msg = new MessageFrame(command, parameter); Stream.Write(msg); Stream.Flush(); Thread.Sleep(1000); }
protected override void OnMessageReceived(MessageFrame message) { switch (message.Command) { case Command.Identify: MacAddress = message.State.ToString(); break; case Command.Ready: Status = NodeStatus.Connected; break; case Command.Sync: Status = NodeStatus.Syncing; break; } }
protected abstract void OnMessageReceived(MessageFrame message);