internal virtual void initialize() { StringBuilder sb = new StringBuilder(); sb.Append("Ready"); MotionTest.displayData(0, sb.ToString()); }
internal virtual void initialize() { string status = "Ready"; StringBuilder sb = new StringBuilder(); for (int i = 0; i < sResults.Length; i++) { if (i >= 6) { if (mIsUpDownAvailable) { sb.Append(sResults[i] + " : \n"); } } else { sb.Append(sResults[i] + " : \n"); } } if (mMode == MotionTest.MODE_PEDOMETER_PERIODIC || MotionTest.mTestMode == MotionTest.MODE_PEDOMETER_PERIODIC) { sb.Append("Interval : "); } MotionTest.displayData(0, status, sb.ToString()); }
internal virtual void initialize() { StringBuilder sb = new StringBuilder(); sb.Append("Ready"); MotionTest.displayData(0, sb.ToString()); mInfo = new SmotionActivity.Info[1]; mQueue = new string[2]; }
internal virtual void start(int mode, bool isPeriodicMode, long interval) { initialize(); mMode = mode; mIsPeriodicMode = isPeriodicMode; mInterval = interval; mActivity.start(mMode, changeListener); if (mIsPeriodicMode) { startTimer(); } mIsStarting = true; MotionTest.displayData(0, getMode(mode), ""); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_main; if (initialize()) { mBtn_start.Enabled = true; mSpin.Clickable = true; mTv_timestamp.Visibility = View.VISIBLE; } else { MotionTest.displayData(0, "Not supported", ""); } }
private void displayData(SmotionCall.Info info) { StringBuilder sb = new StringBuilder(); long timestamp = DateTimeHelperClass.CurrentUnixTimeMillis(); switch (info.CallPosition) { case SmotionCall.POSITION_LEFT: sb.Append("Left"); break; case SmotionCall.POSITION_RIGHT: sb.Append("Right"); break; default: break; } MotionTest.displayData(timestamp, sb.ToString()); }
private void displayData(SmotionActivityNotification.Info info) { StringBuilder sb = new StringBuilder(); string str = null; long timestamp = info.TimeStamp; Time time = new Time(); time.set(timestamp); Formatter form = new Formatter(); form.format("%02d:%02d:%02d", time.hour, time.minute, time.second); sb.Append("[" + form.ToString() + "] "); form.close(); str = getStatus(info.Status); sb.Append("(" + getAccuracy(info.Accuracy) + ")"); if (str != null) { MotionTest.displayData(0, str, sb.ToString()); } }
private void displayData(SmotionPedometer.Info info) { // TODO Auto-generated method stub long timestamp = DateTimeHelperClass.CurrentUnixTimeMillis(); StringBuilder sb = new StringBuilder(); double calorie = info.Calorie; double distance = info.Distance; double speed = info.Speed; long totalCount = info.getCount(SmotionPedometer.Info.COUNT_TOTAL); long runCount = info.getCount(SmotionPedometer.Info.COUNT_RUN_FLAT); long walkCount = info.getCount(SmotionPedometer.Info.COUNT_WALK_FLAT); long runUpCount = info.getCount(SmotionPedometer.Info.COUNT_RUN_UP); long runDownCount = info.getCount(SmotionPedometer.Info.COUNT_RUN_DOWN); long walkUpCount = info.getCount(SmotionPedometer.Info.COUNT_WALK_UP); long walkDownCount = info.getCount(SmotionPedometer.Info.COUNT_WALK_DOWN); sb.Append(sResults[0] + " : " + calorie + "\n"); sb.Append(sResults[1] + " : " + distance + "\n"); sb.Append(sResults[2] + " : " + speed + "\n"); sb.Append(sResults[3] + " : " + totalCount + "\n"); sb.Append(sResults[4] + " : " + runCount + "\n"); sb.Append(sResults[5] + " : " + walkCount + "\n"); if (mIsUpDownAvailable) { sb.Append(sResults[6] + " : " + runUpCount + "\n"); sb.Append(sResults[7] + " : " + runDownCount + "\n"); sb.Append(sResults[8] + " : " + walkUpCount + "\n"); sb.Append(sResults[9] + " : " + walkDownCount + "\n"); } if (mMode == MotionTest.MODE_PEDOMETER_PERIODIC || MotionTest.mTestMode == MotionTest.MODE_PEDOMETER_PERIODIC) { sb.Append("Interval : " + mInterval / 1000 + " sec"); } string str = getStatus(info.Status); if (str != null) { MotionTest.displayData(timestamp, str, sb.ToString()); } }
public override void onItemSelected <T1>(AdapterView <T1> adapterView, View view, int position, long flag) { // TODO Auto-generated method stub mTestMode = position; outerInstance.mBtn_start.Enabled = true; switch (mTestMode) { case MODE_CALL: mBtn_updateInfo.Visibility = View.GONE; outerInstance.setTextView(mTv_result1, true); if (!outerInstance.mMotion.isFeatureEnabled(Smotion.TYPE_CALL)) { outerInstance.mBtn_start.Enabled = false; MotionTest.displayData(0, "Not supported", ""); } else { if (outerInstance.mCall == null) { outerInstance.mCall = new MotionCall(Looper.MainLooper, outerInstance.mMotion); } outerInstance.mCall.initialize(); } break; case MODE_PEDOMETER: case MODE_PEDOMETER_PERIODIC: mBtn_updateInfo.Visibility = View.GONE; outerInstance.setTextView(mTv_result1, true); if (!outerInstance.mMotion.isFeatureEnabled(Smotion.TYPE_PEDOMETER)) { outerInstance.mBtn_start.Enabled = false; MotionTest.displayData(0, "Not supported", ""); } else { if (outerInstance.mPedometer == null) { bool isPedometerUpDownAvailable = outerInstance.mMotion.isFeatureEnabled(Smotion.TYPE_PEDOMETER_WITH_UPDOWN_STEP); outerInstance.mPedometer = new MotionPedometer(Looper.MainLooper, outerInstance.mMotion, isPedometerUpDownAvailable); } outerInstance.mPedometer.initialize(); } break; case MODE_ACTIVITY: if (!outerInstance.mMotion.isFeatureEnabled(Smotion.TYPE_ACTIVITY)) { outerInstance.mBtn_start.Enabled = false; outerInstance.mRadio_acitivity_realtime.Enabled = false; outerInstance.mRadio_acitivity_batch.Enabled = false; outerInstance.mRadio_acitivity_all.Enabled = false; outerInstance.mCheckBox_Activity_Periodic.Enabled = false; MotionTest.displayData(0, "Not supported", ""); } else { outerInstance.mRadioGroup_activity_mode.check(R.id.radio_realtime); outerInstance.setTextView(mTv_result1, false); mBtn_updateInfo.Visibility = View.VISIBLE; mBtn_updateInfo.Enabled = false; if (outerInstance.mActivity == null) { outerInstance.mActivity = new MotionActivity(Looper.MainLooper, outerInstance.mMotion); } outerInstance.mActivity.initialize(); outerInstance.displayActivityStatus(outerInstance.mActivity.checkActivityStatus()); } break; case MODE_ACTIVITY_NOTIFICATION: mBtn_updateInfo.Visibility = View.GONE; outerInstance.setTextView(mTv_result1, false); if (!outerInstance.mMotion.isFeatureEnabled(Smotion.TYPE_ACTIVITY_NOTIFICATION)) { outerInstance.mBtn_start.Enabled = false; outerInstance.mCheckBox_Stationary.Enabled = false; outerInstance.mCheckBox_Walk.Enabled = false; outerInstance.mCheckBox_Run.Enabled = false; outerInstance.mCheckBox_Vehicle.Enabled = false; MotionTest.displayData(0, "Not supported", ""); } else { if (outerInstance.mActivityNotification == null) { outerInstance.mActivityNotification = new MotionActivityNotification(Looper.MainLooper, outerInstance.mMotion); } outerInstance.mActivityNotification.initialize(); outerInstance.displayActivityStatus(outerInstance.mActivityNotification.checkActivityStatus()); } break; default: break; } outerInstance.initializeView(); }
private void displayData(int mode, SmotionActivity.Info[] info) { // TODO Auto-generated method stub string str = getMode(mMode); StringBuilder sb = new StringBuilder(); if (mIsPeriodicMode && (mode == SmotionActivity.Info.MODE_REALTIME)) { sb.Append("Periodic Mode : " + mInterval / 1000 + " sec" + "\n"); } sb.Append("<" + getMode(mode) + ">"); if (MotionTest.mIsUpdateInfo) { if (mMode == SmotionActivity.Info.MODE_ALL) { if (UpdateInfoBatchModeSupport) { sb.Append(" - Update" + " All" + " Data"); } else { sb.Append(" - Update " + getMode(mode) + " Data"); } } else { sb.Append(" - Update " + getMode(mode) + " Data"); } MotionTest.mIsUpdateInfo = false; } sb.Append("\n"); for (int i = 0; i < info.Length; i++) { long timestamp = 0; if (mIsPeriodicMode) { if (mode == SmotionActivity.Info.MODE_REALTIME) { timestamp = DateTimeHelperClass.CurrentUnixTimeMillis(); } else if (mode == SmotionActivity.Info.MODE_BATCH) { timestamp = info[i].TimeStamp; } } else { timestamp = info[i].TimeStamp; } Time time = new Time(); time.set(timestamp); Formatter form = new Formatter(); form.format("%02d:%02d:%02d", time.hour, time.minute, time.second); sb.Append("[" + form.ToString() + "] "); form.close(); sb.Append(getStatus(info[i].Status)); sb.Append("(" + getAccuracy(info[i].Accuracy) + ")"); sb.Append("\n"); } switch (mode) { case SmotionActivity.Info.MODE_REALTIME: mQueue[0] = sb.ToString(); break; case SmotionActivity.Info.MODE_BATCH: mQueue[1] = sb.ToString(); break; default: break; } sb = new StringBuilder(); for (int i = 0; i < mQueue.Length; i++) { if (mQueue[i] != null) { sb.Append(mQueue[i] + "\n"); } } if (str != null) { MotionTest.displayData(0, str, sb.ToString()); } }