package

com.nuwarobotics.service.agent

Interfaces

RobotEventListener Nuwa SDK bind Nuwa Robot Services to provide API of control robot RobotEventListener provide robot related event callback Such as Nuwa Core Service status change , Motion status, Sensor Event etc ... 
VoiceEvaluateListener  
VoiceEventListener register the VoiceEventListener into RobotAPI instance and get callback return after listen event trigger Suggest to move the action into handler (or thread) avoid blocing the codeflow. 

Classes

NuwaRobotAPI A NuwaRobotAPI is a single, focused thing that the NuwaRobot developer can do. 
NuwaRobotAPI.JointMotor System Behavior Service API -- END  
SimpleGrammarData SimpleGrammarData allow user easy to create grammar data
 //prepare local command list
 ArrayList cmdList = new ArrayList() {{
     add("今日の天気");
     add("おはよう");
 }};//you can customize this list
 //Create Grammar class object
 //NOTICE : please only use "lower case letter" as naming of grammar name
 SimpleGrammarData mGrammarData = new SimpleGrammarData("example");
 //setup local command list to grammar class
 for (String string : cmdList) {
     mGrammarData.addSlot(string);
     Log.d(TAG, "add string : " + string);
 }
 //generate grammar data
 mGrammarData.updateBody();
 //create and update Grammar to Robot
 Log.d(TAG, "createGrammar " + mGrammarData.body);
 //NOTICE : please only use "lower case letter" as naming of grammar name
 mRobotAPI.createGrammar(mGrammarData.grammar, mGrammarData.body); // Regist cmd

The body in SimpleGrammarData is JSON format and as below
 {
  "version“: 1.0,
   “grammar": "test", //grammar set name
   “command": {  //command array, if single command only, just only write single array
     "single": [
       "今日の天気",
       "おはよう"
     ],
    }
 }
 
 
VoiceResultJsonParser Simple tool to parser Result JSON format
@Override
public void onSpeech2TextComplete(boolean isError, String json) {
    String result_string = VoiceResultJsonParser.parseVoiceResult(json);
}
@Override
public void onWakeup(boolean isError, String score, float direction) {
    String wakeup_word = VoiceResultJsonParser.parseVoiceResult(score);
}
Json format
 {
  "version": 1.0, //version control (double base)
   "type": 1, //Result format, 1 is Command type, 2 is Recognized type
   "result": "Hello", // ASR result(String base)
   "class": "com.xxx.lib.voice.hybrid.engine.XXXTWMixEngine", // Engine class name(for debug)
   "engine": "ASR solution", //engine solution name
   "extra":  //extra tag for solution extention (OPTION)
       {
         //Define : 
         "content":"String"
       },
   "content": "XXX", //Extra section  (OPTION)
 }
 
 

Enums

VoiceEventListener.HotwordState The running state for Always-wakeup  
VoiceEventListener.HotwordType The result type for Always-wakeup  
VoiceEventListener.ListenType Listen trigger by which mode  
VoiceEventListener.ResultType voice type of result  
VoiceEventListener.SpeakState The state of speak  
VoiceEventListener.SpeakType The type of speak  
VoiceEventListener.SpeechState List the speech state