コード例 #1
0
 /*
  * Send message to native via JNICommandAdapter
  */
 @Override
 public int dispatchMessageDown(VoiceMessage message) {
   // TODO Auto-generated method stub
   int errorid = VoiceCommandListener.VOICE_NO_ERROR;
   switch (message.mMainAction) {
     case VoiceCommandListener.ACTION_MAIN_VOICE_UI:
       errorid = mVoiceUI.handleSyncVoiceMessage(message);
       break;
     case VoiceCommandListener.ACTION_MAIN_VOICE_TRAINING:
       errorid = mVoiceTraining.handleSyncVoiceMessage(message);
       break;
     case VoiceCommandListener.ACTION_MAIN_VOICE_RECOGNIZE:
       errorid = mVoiceRecognize.handleSyncVoiceMessage(message);
       break;
     case VoiceCommandBusiness.ACTION_MAIN_VOICE_SERVICE:
       errorid = mVoiceServiceInternal.handleSyncVoiceMessage(message);
       break;
     case VoiceCommandListener.ACTION_MAIN_VOICE_CONTACTS:
       errorid = mVoiceContacts.handleSyncVoiceMessage(message);
       break;
     default:
       // do nothing here
       break;
   }
   return errorid;
 }
コード例 #2
0
 @Override
 public void onReceive(Context context, Intent intent) {
   VoiceMessage msg = new VoiceMessage();
   msg.mMainAction = VoiceCommandBusiness.ACTION_MAIN_VOICE_BROADCAST;
   if (intent.getIntExtra("state", 0) == 0) {
     msg.mSubAction = VoiceCommandBusiness.ACTION_VOICE_BROADCAST_HEADSETPLUGOUT;
   } else {
     msg.mSubAction = VoiceCommandBusiness.ACTION_VOICE_BROADCAST_HEADSETPLUGIN;
   }
   mVoiceServiceInternal.handleSyncVoiceMessage(msg);
 }
コード例 #3
0
 @Override
 public int dispatchMessageUp(VoiceMessage message) {
   // TODO Auto-generated method stub
   int errorid = VoiceCommandListener.VOICE_NO_ERROR;
   switch (message.mMainAction) {
     case VoiceCommandBusiness.ACTION_MAIN_VOICE_SERVICE:
       if (message.mSubAction == VoiceCommandBusiness.ACTION_VOICE_SERVICE_SELFEXIT) {
         mService.mContext.unregisterReceiver(mHeadsetPlugReceiver);
         mVoiceContacts.handleDataRelease();
       }
       errorid = mVoiceServiceInternal.handleSyncVoiceMessage(message);
       break;
     default:
       errorid = mUpDispatcher.dispatchMessageUp(message);
       break;
   }
   return errorid;
 }