Ejemplo n.º 1
0
        //METING
        public NetCommand(Meting m, int session)
        {
            Type      = CommandType.DATA;
            Session   = session;
            Timestamp = Helper.Now;

            Meting = m;
        }
Ejemplo n.º 2
0
        //METING
        public NetCommand(Meting m, int session)
        {
            Type = CommandType.DATA;
            Session = session;
            Timestamp = Helper.Now;

            Meting = m;
        }
Ejemplo n.º 3
0
        private static NetCommand ParseData(int session, string[] args)
        {
            if (args.Length != 9)
            {
                throw new MissingFieldException("Error in NetCommand: Data is missing arguments");
            }

            NetCommand temp = new NetCommand(CommandType.DATA, session);

            temp.Meting = Meting.Parse(string.Join("\t", args));

            return(temp);
        }
 public int getMetingType(Meting meting)
 {
     switch (type)
     {
         case MetingType.HEARTBEAT:
             return meting.HeartBeat;
         case MetingType.RPM:
             return meting.RPM;
         case MetingType.SPEED:
             return (int)(meting.Speed*100);
         case MetingType.DISTANCE:
             return (int)(meting.Distance*100);
         case MetingType.POWER:
             return meting.Power;
         case MetingType.ENERGY:
             return meting.Energy;
         case MetingType.SECONDS:
             return meting.Seconds;
         case MetingType.ACTUALPOWER:
             return meting.ActualPower;
         default:
             return 0;
     }
 }
Ejemplo n.º 5
0
        public void SaveMeting(Meting m)
        {
            heartBeat.updateValue(m.HeartBeat);
            RPM.updateValue(m.RPM);
            speed.updateValue(m.Speed*100);
            distance.updateValue(m.Distance*100);
            power.updateValue(m.Power);
            energy.updateValue(m.Energy);
            actualpower.updateValue(m.ActualPower);
            time.updateValue(m.Seconds);

            if (count >= 10)
            {
                count = 0;
                panelGraphView.updateAllCharts(client.Metingen);
            }

            count++;
        }
Ejemplo n.º 6
0
        public override string ToString()
        {
            string command = "";

            switch (Type)
            {
            case CommandType.LOGIN:
                command += "1»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password) + "»" + IsDoctor;
                break;

            case CommandType.DATA:
                command += "2»ses" + Session + "»" + Meting.ToCommand();
                break;

            case CommandType.CHAT:
                command += "3»ses" + Session + "»" + ChatMessage + "»" + IsDoctor;
                break;

            case CommandType.LOGOUT:
                command += "4»ses" + Session + "»logout";
                break;

            case CommandType.SESSION:
                command += "5»ses" + Session;
                break;

            case CommandType.RESPONSE:
                command += "6»ses" + Session + "»" + Response.ToString().ToLower();
                break;

            case CommandType.VALUESET:
                command += "7»ses" + Session + "»" + Value.ToString().ToLower() + "»" + SetValue;
                break;

            case CommandType.USER:
                command += "8»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password);
                break;

            case CommandType.REQUEST:
                command += "9»ses" + Session + "»" + Request.ToString().ToLower();
                break;

            case CommandType.LENGTH:
                command += "10»ses" + Session + "»" + Length.ToString().ToLower() + "»" + LengthValue;
                break;

            case CommandType.SESSIONDATA:
                command += "11»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.BROADCAST:
                command += "12»ses" + Session + "»" + ChatMessage;
                break;

            case CommandType.UITLEG:
                command += "13»ses" + Session + "»" + UitlegText.Replace('\n', '«');
                break;

            case CommandType.PERSONDATA:
                command += "14»ses" + Session + "»" + Gewicht + "»" + Lengte + "»" + Leeftijd + "»" + Geslacht;
                Console.WriteLine(command);
                break;

            case CommandType.TESTRESULT:
                command += "15»ses" + Session + "»" + VO2Max + "»" + MET + "»" + PopulationAvg + "»" + ZScore + "»" + Rating;
                break;

            case CommandType.OLDSESSIONDATA:
                command += "16»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.ERROR:
                command += "ERROR IN NETCOMMAND";
                break;

            default:
                throw new FormatException("Error in NetCommand: Cannot find type of command");
            }


            return(command);
        }
        public override string ToString()
        {
            string command = "";

            switch (Type)
            {
            case CommandType.LOGIN:
                command += "1»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password) + "»" + IsDoctor;
                break;

            case CommandType.DATA:
                command += "2»ses" + Session + "»" + Meting.ToCommand();
                break;

            case CommandType.CHAT:
                command += "3»ses" + Session + "»" + ChatMessage + "»" + IsDoctor;
                break;

            case CommandType.LOGOUT:
                command += "4»ses" + Session + "»logout";
                break;

            case CommandType.SESSION:
                command += "5»ses" + Session;
                break;

            case CommandType.RESPONSE:
                command += "6»ses" + Session + "»" + Response.ToString().ToLower();
                break;

            case CommandType.VALUESET:
                command += "7»ses" + Session + "»" + Value.ToString().ToLower() + "»" + SetValue;
                break;

            case CommandType.USER:
                command += "8»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password);
                break;

            case CommandType.REQUEST:
                command += "9»ses" + Session + "»" + Request.ToString().ToLower();
                break;

            case CommandType.LENGTH:
                command += "10»ses" + Session + "»" + Length.ToString().ToLower() + "»" + LengthValue;
                break;

            case CommandType.SESSIONDATA:
                command += "11»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.BROADCAST:
                command += "12»ses" + Session + "»" + ChatMessage;
                break;

            case CommandType.ERROR:
                command += "ERROR IN NETCOMMAND";
                break;

            default:
                throw new FormatException("Error in NetCommand: Cannot find type of command");
            }

            return(command);
        }