private void CreateObserverImpl(CreateObserverReq req, CreateObserverResp resp)
        {
            ObserverInfo oi = Server.GameManager.CreateObserver(Server.TeamRegistry.GetTeam(req.Auth.TeamName), req.Auth.ClientName);

            resp.ObserverId = oi.ObserverId;
            // FIXME This is probably used by admin client to enter observer mode and/or disable some controls
            resp.Role = oi.Team.Role;
        }
Exemplo n.º 2
0
        private void UpdateCommands(Object p_sender, EventArgs p_args)
        {
            if (m_commands.Count == 0)
            {
                return;
            }

            ObserverInfo info = m_commands[0] as ObserverInfo;

            switch (info.Command)
            {
            case EBTEvent.BTE_OnTodaysActivity:
            {
                this.UpdateTodaysScreen(info.TodaysData);
            }
            break;

            case EBTEvent.BTE_OnOverallActivity:
            {
                this.UpdateOverallScreen(info.OverallData);
            }
            break;

            case EBTEvent.BTE_OnReadySportsMode:
            {
                this.MoveToPage(EPivotPage.SportsMode);
            }
            break;

            case EBTEvent.BTE_OnStartSportsMode:
            {
                this.OnStartSportsTimer(info.SportsData);
            }
            break;

            case EBTEvent.BTE_OnFinishSportsMode:
            {
                this.OnFinishSports();
            }
            break;
            }

            //~~~remove the first command
            m_commands.RemoveAt(0);
        }
Exemplo n.º 3
0
		private async Task<ObserverInfo> GetOrAdd<TObserver, IObserver>(string key) 
			where TObserver : class, IObserver, new()
			where IObserver : IGrainObserver
		{
			ObserverInfo info;
			if (this.observers.ContainsKey(key))
			{
				info = this.observers[key];
			}
			else
			{
				TObserver obsvr = (TObserver)Activator.CreateInstance(typeof(TObserver));
				IObserver refer = await cluster.CreateObjectReference<IObserver>(obsvr);
				info = new ObserverInfo() { value = obsvr, reference = refer, cc = 0 };
				this.observers.Add(key, info);
			}

			return info;
		}
Exemplo n.º 4
0
		public uint UnsubscribeWrap<IObserver>(string key, SubscribeCallback<IObserver> callback)
			where IObserver : IGrainObserver
		{
			if (!observers.ContainsKey(key))
			{
				logger.Error($"{key}don't find observer instance.({nameof(IObserver)})");
				return uint.MaxValue;
			}

			ObserverInfo info = observers[key];
			if (!(info.reference is IObserver))
			{
				logger.Error($"Type of observer isn't {nameof(IObserver)}.");
				return uint.MaxValue;
			}

			--info.cc;
			if (info.cc <= 0) callback.Invoke((IObserver)info.reference);

			return info.cc;
		}
Exemplo n.º 5
0
        /****************************************************************
         * Bluetooth Delegate Methods
         **/
        private void HandleCommand(ObserverInfo p_command)
        {
            switch (p_command.Command)
            {
            case EBTEvent.BTE_OnFetchedDevices:
            {
                this.OnFetchedKreyosDevices(p_command.Devices);
            }
            break;

            case EBTEvent.BTE_OnDeviceConnected:
            {
                this.OnDeviceConnected(p_command.Device);
            }
            break;

            case EBTEvent.BTE_OnDeviceDisconnected:
            {
                this.OnDeviceDisconnected(p_command.Error);
            }
            break;
            }
        }
Exemplo n.º 6
0
 public void AddCommand(ObserverInfo p_info)
 {
     m_commands.Add(p_info);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Handle commands
 /// </summary>
 private void HandleCommand(ObserverInfo p_command)
 {
     this.AddCommand(p_command);
 }
Exemplo n.º 8
0
        private void CreateObserverImpl(CreateObserverReq req, CreateObserverResp resp)
        {
            ObserverInfo oi = Server.GameManager.CreateObserver(Server.TeamRegistry.GetTeam(req.Auth.TeamName), req.Auth.ClientName);

            resp.ObserverId = oi.ObserverId;
        }