void StartTest()
        {
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);
            ActivityStatusTextView.SetText(Resource.String.activity_status_testing);
            ModeChangeButton.SetText(Resource.String.test_cancel);
            TestTimeRemain = TestTimePeriod;
            TestPeriodMenuItem.SetEnabled(false);
            TransfarRateMenuItem.SetEnabled(false);
            TestModeMenuItem.SetEnabled(false);
            Log.Debug(TAG, "Test started ");

            string trancefarRate;

            if (!IsCdcDevice)
            {
                trancefarRate = TransfarRate.ToString();
            }
            else
            {
                trancefarRate = "CDC";
            }

            UpdateTestInfo("Test start  : " + DateTime.Now.ToString("HH:mm:ss.fff") + "/" + trancefarRate + "\n");
            StartTestMainTimer();
            StartUpdateTestResultTimer();
            UseUsbSerialPort.ResetReadBuffer();
            CheckInstance.StartProc();
            ActivityStatus = TEST_STATUS.TESTING;
        }
 void CancelTest()
 {
     ActivityStatus = TEST_STATUS.STANDBY;
     UpdateTestResultTimer.Dispose();
     TestMainTimer.Dispose();
     ActivityStatusTextView.SetText(Resource.String.activity_status_standby);
     ModeChangeButton.SetText(Resource.String.test_start);
     TestPeriodMenuItem.SetEnabled(true);
     if (!IsCdcDevice || TestModeResourceId == Resource.Id.test_mode_send_data_cdc)
     {
         TransfarRateMenuItem.SetEnabled(true);
     }
     TestModeMenuItem.SetEnabled(true);
     Log.Debug(TAG, "Test canceld : Error count" + CheckInstance.ErrorCountString);
     if (CheckInstance is SendDataCheck)
     {
         ((SendDataCheck)CheckInstance).StopSendData();
     }
     UpdateTestInfo("Test cancel : " + DateTime.Now.ToString("HH:mm:ss.fff/") + CheckInstance.GoodCountString + "-" + CheckInstance.ErrorCountString + "-" + CheckInstance.TotalCountString + "\n");
     Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
 }
 void FinishTestMainTimerHandler(Object sender)
 {
     lock (FinishTestMainTimerHandlerLock)
     {
         ActivityStatus = TEST_STATUS.STANDBY;
         UpdateTestResultTimer.Dispose();
         TestMainTimer.Dispose();
         lock (UpdateTestResultDisplayLock)
         {
             RunOnUiThread(() =>
             {
                 ActivityStatusTextView.SetText(Resource.String.activity_status_standby);
                 RemainTimeTextView.SetText(Resource.String.remain_time_normal_end);
                 if (TestModeResourceId != Resource.Id.test_mode_send_data)
                 {
                     GoodCountTextView.SetText(CheckInstance.GoodCountString, TextView.BufferType.Normal);
                     ErrorCountTextView.SetText(CheckInstance.ErrorCountString, TextView.BufferType.Normal);
                 }
                 TotalCountTextView.SetText(CheckInstance.TotalCountString, TextView.BufferType.Normal);
                 ModeChangeButton.SetText(Resource.String.test_start);
                 TestPeriodMenuItem.SetEnabled(true);
                 if (!IsCdcDevice || TestModeResourceId == Resource.Id.test_mode_send_data_cdc)
                 {
                     TransfarRateMenuItem.SetEnabled(true);
                 }
                 TestModeMenuItem.SetEnabled(true);
                 // 以下の3行は、なぜか UI スレッド実行しないと Activity を異常終了させる
                 UpdateTestInfo("Test finish : " + DateTime.Now.ToString("HH:mm:ss.fff/") + CheckInstance.GoodCountString + "-" + CheckInstance.ErrorCountString + "-" + CheckInstance.TotalCountString + "\n");
                 Log.Debug(TAG, "Test finished : Error count " + CheckInstance.ErrorCountString);
                 Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
             });
         }
         if (CheckInstance is SendDataCheck)
         {
             ((SendDataCheck)CheckInstance).StopSendData();
         }
         UpdateTestResultDisplay(null);
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.serial_console);

            ActionBar.SetTitle(Resource.String.test_console_title);

            ActivityStatus = TEST_STATUS.STANDBY;

            TransfarRate = DEFAULT_TRANSFAR_RATE;

            DeviceName = UseUsbSerialPort.GetType().Name;

            if (0 == String.Compare(DeviceName, 0, "Cdc", 0, 3))
            {
                IsCdcDevice = true;
            }
            else
            {
                IsCdcDevice = false;
            }

            TestModeTextView = (TextView)FindViewById(Resource.Id.test_mode);
            TitleTextView    = (TextView)FindViewById(Resource.Id.serial_device_name);

            TransfarRateTitleTextView = (TextView)FindViewById(Resource.Id.title_transfar_rate);
            TransfarRateValueTextView = (TextView)FindViewById(Resource.Id.transfar_rate_value);
            if (IsCdcDevice)
            {
                TransfarRateTitleTextView.Enabled = false;
                TransfarRateValueTextView.Enabled = false;
            }
            else
            {
                TransfarRateValueTextView.SetText(TransfarRate.ToString(), TextView.BufferType.Normal);
            }

            DumpTextView = (TextView)FindViewById(Resource.Id.consoleText);
            ScrollView   = (ScrollView)FindViewById(Resource.Id.demoScroller);

            ActivityStatusTextView = (TextView)FindViewById(Resource.Id.activity_status);
            ActivityStatusTextView.SetText(Resource.String.activity_status_standby);

            TestTimeTextView = (TextView)FindViewById(Resource.Id.test_time);
            TestTimeTextView.SetText(string.Format("{0:0#}:{1:0#}", TestTimePeriod / 60, TestTimePeriod % 60), TextView.BufferType.Normal);

            RemainTimeTextView = (TextView)FindViewById(Resource.Id.remain_time);
            RemainTimeTextView.SetText(Resource.String.remain_time_initial);

            TitleGoodTextView  = (TextView)FindViewById(Resource.Id.title_good);
            GoodCountTextView  = (TextView)FindViewById(Resource.Id.good_count);
            TitleErrorTextView = (TextView)FindViewById(Resource.Id.title_error);
            ErrorCountTextView = (TextView)FindViewById(Resource.Id.error_count);
            TitleTotalTextView = (TextView)FindViewById(Resource.Id.title_total);
            TotalCountTextView = (TextView)FindViewById(Resource.Id.total_count);

            ModeChangeButton        = (Button)FindViewById(Resource.Id.modeChange);
            ModeChangeButton.Click += ModeChangeButtonHandler;

            UseUsbSerialPort.DataReceivedEventLinser += DataReceivedHandler;

            CheckNmeaCheckSumInstance = new CheckNmeaCheckSum(this);
            CheckCyclic00ToFFInstance = new CheckCyclic00ToFF(this);
            CheckCyclic41To5AInstance = new CheckCyclic41To5A(this);
            CheckSendDataInstance     = new CheckSendData(this);
            CheckSendDataCdcInstance  = new CheckSendDataCdc(this);

            CheckInstance = CheckCyclic00ToFFInstance;
            TestModeTextView.SetText(CheckInstance.TestMode, TextView.BufferType.Normal);
        }
예제 #5
0
 public void SetStatus(TEST_STATUS status, string message)
 {
     base.legacyStatus.Attributes.Add(TASchema.DrTestLegacyStatusAttributeStatus, (int)status, ResolveConflict.OVERWRITE);
     base.legacyStatus.Attributes.Add(TASchema.DrTestLegacyStatusAttributeMessage, message, ResolveConflict.OVERWRITE);
 }