Exemplo n.º 1
0
        /// <summary>
        /// Sends a completed test taken by a patient to the sever
        /// </summary>
        /// <param name="patient">Patient taking the test</param>
        /// <param name="user">Current user logged into Movement</param>
        /// <param name="samples">Data captured during the test</param>
        /// <param name="id">Script ID</param>
        /// <returns></returns>
        public Boolean SendTestData(PatientObject patient, UserObject user, List <global::Movement.TestEngine.Capture.CalibratedInkSample> samples, int id)
        {
            movement_web_service.Test completed_test = new global::Movement.UserInterface.movement_web_service.Test();
            ScriptInfo tempScript = new ScriptInfo();

            tempScript.scriptID = id;
            Scripting.ScriptEngine script_engine = new global::Movement.Scripting.ScriptEngine(Connection.Servicer.getScript(tempScript).scriptData);
            Data[] test_data = new Data[samples.Count];
            short  average_x = 0, average_y = 0;
            Data   temp;

            //get the data in a form to send to the server
            for (int x = 0; x < samples.Count; x++)
            {
                temp          = new Data();
                temp.pressure = (short)samples[x].Pressure;
                temp.time     = samples[x].Time;
                temp.x        = (short)samples[x].X;
                temp.y        = (short)samples[x].Y;

                //we also need to compute the average x and y coordinates
                average_x += temp.x;
                average_y += temp.y;

                test_data[x] = temp;
            }

            //get the rest of the information about the test together to send to the sever
            completed_test.hand    = patient.handedness;
            completed_test.patient = patient;
            completed_test.user    = user;
            if (script_engine.Cognitive)
            {
                completed_test.mode = 'C';
            }
            else
            {
                completed_test.mode = 'D';
            }

            completed_test.rotation        = 0;
            completed_test.avg_X           = average_x / samples.Count;
            completed_test.avg_Y           = average_y / samples.Count;
            completed_test.script          = new Script();
            completed_test.script.scriptID = id;
            completed_test.data            = test_data;

            //try to store the completed test
            if (Connection.Servicer.storeTest(completed_test))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends a completed test taken by a patient to the sever
        /// </summary>
        /// <param name="patient">Patient taking the test</param>
        /// <param name="user">Current user logged into Movement</param>
        /// <param name="samples">Data captured during the test</param>
        /// <param name="id">Script ID</param>
        /// <returns></returns>
        public Boolean SendTestData(PatientObject patient, UserObject user, List<global::Movement.TestEngine.Capture.CalibratedInkSample> samples, int id)
        {
            movement_web_service.Test completed_test = new global::Movement.UserInterface.movement_web_service.Test();
            ScriptInfo tempScript = new ScriptInfo();
            tempScript.scriptID = id;
            Scripting.ScriptEngine script_engine = new global::Movement.Scripting.ScriptEngine(Connection.Servicer.getScript(tempScript).scriptData);
            Data[] test_data = new Data[samples.Count];
            short average_x =0, average_y=0;
            Data temp;

            //get the data in a form to send to the server
            for (int x = 0; x < samples.Count; x++)
            {
                temp = new Data();
                temp.pressure = (short)samples[x].Pressure;
                temp.time = samples[x].Time;
                temp.x = (short)samples[x].X;
                temp.y = (short)samples[x].Y;

                //we also need to compute the average x and y coordinates
                average_x += temp.x;
                average_y += temp.y;

                test_data[x] = temp;
            }

            //get the rest of the information about the test together to send to the sever
            completed_test.hand = patient.handedness;
            completed_test.patient = patient;
            completed_test.user = user;
            if(script_engine.Cognitive)
                completed_test.mode = 'C';
            else
                completed_test.mode = 'D';

            completed_test.rotation = 0;
            completed_test.avg_X = average_x/samples.Count;
            completed_test.avg_Y = average_y/samples.Count;
            completed_test.script = new Script();
            completed_test.script.scriptID = id;
            completed_test.data = test_data;

            //try to store the completed test
            if (Connection.Servicer.storeTest(completed_test))
                return true;

            return false;
        }