NUWA APP Feature Interface

This lesson teaches how to call nuwa feature by delegating the work to another nuwa app on the device.

It allow developer do not need implement detail specific flow, and quick integrate on 3rd app.

NUWA APP Feature List

Face Training

Allow developer call nuwa face recognition app to add one Contact user.

Robot Support Version :

Support Kebbi Face

No

Example

private final int ACTIVITY_FACE_RECOGNITION = 1;
private void lunchFaceRecogActivity() {
    Intent intent = new Intent("com.nuwarobotics.action.FACE_REC");
    intent.setPackage("com.nuwarobotics.app.facerecognition2");
    intent.putExtra("EXTRA_3RD_REC_ONCE", true);//enroll once or not
    intent.putExtra("EXTRA_3RD_CONFIG_NAME", string );//provide name and skip input name step.
    startActivityForResult(intent, ACTIVITY_FACE_RECOGNITION);
}   

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult, requestCode=" + requestCode + ", resultCode=" + resultCode);
    if (resultCode > 0) {
        switch (requestCode) {
            case ACTIVITY_FACE_RECOGNITION:
                Long mFaceID = data.getLongExtra("EXTRA_RESULT_FACEID", 0);
                String mName = data.getStringExtra("EXTRA_RESULT_NAME");
                Log.d(TAG, "onActivityResult, faceid=" + mFaceID + ", name=" + mName);
                //developer code
                break;
        }
    } else {
        Log.d(TAG, "unexception exit");
    }
}

=================================================

Measure Temperature

Allow developer call nuwa health app to get human temperature

NOTICE : It must download Nuwa Health App from NuwaStore and work with NUWA Ocular product

Robot Support Version :

Support Kebbi Face

Yes

Parameters

| Intent | | | | ------------ | --------------------------------------------- | ------------------------------------------------ | | Action | com.nuwarobotics.health.action.facerec | | | Extra | HealthConstant.EXTRA_REPORT | 1: return name and temperature | | Extra | HealthConstant.EXTRA_PRECISE | 0: Flir
1: Melexis | | Extra | HealthConstant.EXTRA_KEBBI_FACE | 0: Don’t show Kebbi face
1: Show Kebbi face | | Request Code | HealthConstant.MEASURE_FLOW_CONTINUOUS_SINGLE | 1: Measure single person. |

Get Activity Result

| Filed | Intent Extra | DataType | | ----------- | ------------------------------------------------------ | ---------------------------- | | Face Name | getStringExtra(HealthConstant.INTENT_DATA_FACE) | String | | Temperature | getStringExtra(HealthConstant.INTENT_DATA_TEMPERATURE) | String | | Time | getStringExtra(HealthConstant.INTENT_DATA_TIME) | DateTime | | Mask | getStringExtra(HealthConstant.INTENT_DATA_MASK) | Y: Wear mask
N: No mask |

Example

private void lunchTemperatureActivity() {
  Intent intent = new Intent("com.nuwarobotics.health.action.facerec");​
  intent.putExtra(HealthConstant.EXTRA_REPORT,1);​
  intent.putExtra(HealthConstant.EXTRA_PRECISE,0);​
  startActivityForResult(intent, HealthConstant.MEASURE_FLOW_CONTINUOUS_SINGLE);
}​

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult, requestCode=" + requestCode + ", resultCode=" + resultCode);
    if (resultCode > 0) {
        switch(resultCode) {​
            case HealthConstant.FACE_RESULT_SUCCESS:​
                String face_name = data.getStringExtra(HealthConstant.INTENT_DATA_FACE);​
                String temperature = data.getStringExtra(HealthConstant.INTENT_DATA_TEMPERATURE);​
                String time = data.getStringExtra(HealthConstant.INTENT_DATA_TIME);​
                String mask = data.getStringExtra(HealthConstant.INTENT_DATA_MASK);​
                break;​
        }
    } else {
        Log.d(TAG, "unexception exit");
    }
} 

=================================================

Video Call

Allow developer lunch NUWA Video Call App and call to target contact

Robot Support Version :

Support Kebbi Face

No

Example

String contact_name = "xxx";//specific name of family contact 
Bundle mIntentBundle = new Bundle();
mIntentBundle.putString("callee", contact_name);

Intent intent = new Intent();
intent.putExtras(mIntentBundle);
intent.setClassName("com.nuwarobotics.app.videocall", "com.nuwarobotics.app.videocall.SignalingService");
mContext.startService(intent);

=================================================

Play mbtx format Content

Allow user play exported file mbtx from Content Editor(WEB)

Robot Support Version :

Support Kebbi Face

No

Start play mbtx Example

Intent intent = new Intent();
ComponentName comp = new ComponentName("com.nuwarobotics.app.nuwaplayer","com.nuwarobotics.app.nuwaplayer.PlayContentEditorActivity");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
intent.setAction("com.nuwarobotics.app.nuwaplayer.action.PLAY_MBTX"); 
intent.setComponent(comp); 
intent.putExtra("PlayId", "file name");//the file name put in  /sdcard/contenteditor/ 
context.startActivity(intent);

Receive Play status

public class PlayerStatusReceiver extends BroadcastReceiver {
    public static final String TAG = "PlayerStatusReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (Constant.PLAYER_PLAYING.equals(intent.getAction())) {
            //playing status, do something
        } else if (Constant.PLAYER_STOP.equals(intent.getAction())) {
            //motion play finished, do something
        } else if (Constant.PLAYER_PAUSE.equals(intent.getAction())) {
            //motion player was paused, do something
        }
    }
}

private void registerPlayerReceiver() {
    receiver = new PlayerStatusReceiver();
    IntentFilter filter = new IntentFilter(Constant.PLAYER_PAUSE);
    filter.addAction(Constant.PLAYER_PLAYING);
    filter.addAction(Constant.PLAYER_STOP);
    registerReceiver(receiver, filter);
}