chatClient.close();
chatClient = null;
}
+ isStart = false;
connectChat();
break;
case MSG_SENDPING:
handler.removeMessages(MSG_RECONNECT);
handler.sendEmptyMessageDelayed(MSG_RECONNECT,2000);
}*/
+ isStart = false;
if (!ischeckoutChannel) {
handler.removeMessages(MSG_RECONNECT);
handler.sendEmptyMessageDelayed(MSG_RECONNECT, 1500);
VoiceChatPayload payload = new VoiceChatPayload();
payload.setDevice_id(MyConfig.DEVICE_ID);
payload.setUser_agent("python");
- payload.setIn_format(in_format);
- payload.setIn_sample_rate(in_sample_rate);
payload.setOut_format(out_format);
payload.setSample_rate(out_sample_rate);
- payload.setSpace_time(100);
payload.setVolume("100");
+ payload.setVoice("zh_female_shuangkuaisisi_moon_bigtts");
+ VoiceChatPayload.CustomVariablesBean customVariablesBean = new VoiceChatPayload.CustomVariablesBean();
+ customVariablesBean.setBot_name("柒先生");
+
param.put("header", header);
param.put("payload", payload);
String msg = new Gson().toJson(param);
if(chatClient==null||chatClient.isClosed()){
return;
}
- SobLog.d(TAG, "RequestToSpeak:-"+isStart);
+ SobLog.d(TAG, "RequestToRespond:-"+isStart);
if(!isStart){
return;
}
param.put("header", header);
param.put("payload", payload);
String msg = new Gson().toJson(param);
-
+ SobLog.d(TAG, "RequestToRespond:-"+msg);
chatClient.send(msg);
}
public class VoiceChatPayload {
+
/**
* device_id : test_device_id
* user_agent : python
- * in_format : pcm
- * in_sample_rate : 16000
- * out_format : pcm
- * sample_rate : 16000
- * space_time : 100
- * volume : 2
+ * dialog_id :
+ * out_format : pcm
+ * volume : 10
+ * sample_rate : 16000
+ * voice : zh_female_shuangkuaisisi_moon_bigtts
+ * simple_response : true
+ * custom_variables : {"bot_name":"柒先生"}
*/
private String device_id;
private String user_agent;
- private String in_format;
- private int in_sample_rate;
+ private String dialog_id;
private String out_format;
- private int sample_rate;
- private int space_time;
private String volume;
+ private int sample_rate;
+ private String voice;
+ private boolean simple_response;
+ private CustomVariablesBean custom_variables;
public String getDevice_id() {
return device_id;
this.user_agent = user_agent;
}
- public String getIn_format() {
- return in_format;
- }
-
- public void setIn_format(String in_format) {
- this.in_format = in_format;
- }
-
- public int getIn_sample_rate() {
- return in_sample_rate;
+ public String getDialog_id() {
+ return dialog_id;
}
- public void setIn_sample_rate(int in_sample_rate) {
- this.in_sample_rate = in_sample_rate;
+ public void setDialog_id(String dialog_id) {
+ this.dialog_id = dialog_id;
}
public String getOut_format() {
this.out_format = out_format;
}
+ public String getVolume() {
+ return volume;
+ }
+
+ public void setVolume(String volume) {
+ this.volume = volume;
+ }
+
public int getSample_rate() {
return sample_rate;
}
this.sample_rate = sample_rate;
}
- public int getSpace_time() {
- return space_time;
+ public String getVoice() {
+ return voice;
}
- public void setSpace_time(int space_time) {
- this.space_time = space_time;
+ public void setVoice(String voice) {
+ this.voice = voice;
}
- public String getVolume() {
- return volume;
+ public boolean isSimple_response() {
+ return simple_response;
}
- public void setVolume(String volume) {
- this.volume = volume;
+ public void setSimple_response(boolean simple_response) {
+ this.simple_response = simple_response;
+ }
+
+ public CustomVariablesBean getCustom_variables() {
+ return custom_variables;
+ }
+
+ public void setCustom_variables(CustomVariablesBean custom_variables) {
+ this.custom_variables = custom_variables;
+ }
+
+ public static class CustomVariablesBean {
+ /**
+ * bot_name : 柒先生
+ */
+
+ private String bot_name;
+
+ public String getBot_name() {
+ return bot_name;
+ }
+
+ public void setBot_name(String bot_name) {
+ this.bot_name = bot_name;
+ }
}
}