Commit 4c67b246 by 浦耀宗

更新了库和demo

parent bfab9e23
......@@ -13,6 +13,7 @@ import com.csjbot.coshandler.core.CsjRobot;
import com.csjbot.coshandler.core.Speech;
import com.csjbot.coshandler.core.State;
import com.csjbot.coshandler.core.interfaces.DirectListener;
import com.csjbot.coshandler.listener.OnDoubleDoorStateListener;
import com.csjbot.coshandler.listener.OnGoRotationListener;
import com.csjbot.coshandler.listener.OnSpeechListener;
import com.csjbot.coshandler.listener.OnWakeupListener;
......@@ -30,7 +31,7 @@ import java.util.Date;
import java.util.Locale;
public class ActionActivity extends BaseActivity {
private TextView asr_result, nlp_result, wakeup_angle;
private TextView asr_result, nlp_result, wakeup_angle, double_door_state;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -38,6 +39,8 @@ public class ActionActivity extends BaseActivity {
setContentView(R.layout.activity_action);
initLogShow();
double_door_state = (TextView) findViewById(R.id.double_door_state);
AutoTestManager.getInstance().setOnMsgListener(new AutoTestManager.OnMsgListener() {
@Override
public void msg(String msg) {
......@@ -48,8 +51,21 @@ public class ActionActivity extends BaseActivity {
});
}
});
mCsjBot.getAction().getDoubleDoorState(stateListener);
}
private OnDoubleDoorStateListener stateListener = new OnDoubleDoorStateListener() {
@Override
public void onDoorState(int state) {
if (state == 5) {
showMsgInTextView(double_door_state, "door state is error");
return;
}
showMsgInTextView(double_door_state, "door state is " + (state == 1 ? "open" : "closed"));
}
};
@Override
public void onBackPressed() {
this.finish();
......@@ -122,4 +138,12 @@ public class ActionActivity extends BaseActivity {
public void aliceAutoTestClose(View view) {
AutoTestManager.getInstance().stop();
}
public void openDoubleDoor(View view) {
mCsjBot.getAction().openDoubleDoor(stateListener);
}
public void closeOpenDoor(View view) {
mCsjBot.getAction().closeDoubleDoor(stateListener);
}
}
......@@ -332,6 +332,40 @@
android:layout_height="match_parent"
android:background="@color/android:black" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Amanda_action"
android:textSize="20dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:id="@+id/double_door_state"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Door state: "
android:textSize="20dp" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="openDoubleDoor"
android:text="@string/open_double_door" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="closeOpenDoor"
android:text="@string/close_double_door" />
</LinearLayout>
</LinearLayout>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论