Exemplo n.º 1
0
        public double HandleServerParams()
        {
            double threshold = 0;

            Classes.Msgs.Parameters serverParams = ReceiveParameters();
            if (serverParams == null)
            {
                return(threshold);
            }

            switch (serverParams.MsgType)
            {
            case 0:     // Started task - receive my task id
                _taskId = serverParams.TaskId;
                break;

            case 1:     // Ended task - receive confirm msg from server about ending
                break;

            case 2:     // Receive params from server
                threshold = serverParams.Threshold;
                SettingsHandler.SetThreshold((int)threshold);
                break;
            }

            return(threshold);
        }
Exemplo n.º 2
0
        public Classes.Msgs.Parameters ReceiveParameters()
        {
            Classes.Msgs.Parameters recParams = null;
            try {
                string recMsg = _client.MsgListener();
                if (string.IsNullOrEmpty(recMsg))
                {
                    return(null);
                }
                recParams = new Classes.Msgs.Parameters(recMsg);
            } catch (Exception) {
                Debug.Log("Exceptin parsing params");
            }

            return(recParams);
        }