| @@ -1,17 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="deploymentTargetDropDown"> | |||
| <runningDeviceTargetSelectedWithDropDown> | |||
| <Target> | |||
| <type value="RUNNING_DEVICE_TARGET" /> | |||
| <deviceKey> | |||
| <Key> | |||
| <type value="SERIAL_NUMBER" /> | |||
| <value value="7d656601c9f0070f" /> | |||
| </Key> | |||
| </deviceKey> | |||
| </Target> | |||
| </runningDeviceTargetSelectedWithDropDown> | |||
| <timeTargetWasSelectedWithDropDown value="2023-07-23T06:07:31.789079600Z" /> | |||
| </component> | |||
| </project> | |||
| @@ -23,7 +23,6 @@ import com.aispeech.dui.dds.DDSAuthListener; | |||
| import com.aispeech.dui.dds.DDSConfig; | |||
| import com.aispeech.dui.dds.DDSInitListener; | |||
| import com.aispeech.dui.dds.DDSMode; | |||
| import com.aispeech.dui.dds.agent.AsrListener; | |||
| import com.aispeech.dui.dds.agent.tts.TTSEngine; | |||
| import com.aispeech.dui.dds.exceptions.DDSNotInitCompleteException; | |||
| import com.aispeech.nativedemo.face.FaceManager; | |||
| @@ -129,7 +128,7 @@ public class DDSService extends Service { | |||
| // DDS.getInstance().getAgent().getTTSEngine().setMode(DDSMode.TTS_SILENCE); | |||
| // DDS.getInstance().getAgent().getTTSEngine().setSpeaker("zhilingfp"); | |||
| DDS.getInstance().getAgent().getTTSEngine().setSpeaker("hqqiaf","hqqiaf_lstm_210909.bin"); | |||
| startAsrListening(); | |||
| // startAsrListening(); | |||
| } catch (DDSNotInitCompleteException e) { | |||
| throw new RuntimeException(e); | |||
| } | |||
| @@ -137,7 +136,7 @@ public class DDSService extends Service { | |||
| } else{ | |||
| Logger.e("思必驰++++++++++++++++++++"); | |||
| } | |||
| DDS.getInstance().setAudioDebug(true); | |||
| // DDS.getInstance().setAudioDebug(true); | |||
| // startTtsListening(); | |||
| } | |||
| @@ -341,29 +340,29 @@ public class DDSService extends Service { | |||
| private long mAsrTime = 0; | |||
| public void startAsrListening() { | |||
| DDS.getInstance().getAgent().getASREngine().setAsrListener(new AsrListener() { | |||
| @Override | |||
| public void onAsr(byte[] bytes) { | |||
| if(mTime == 0){ | |||
| mTime = System.currentTimeMillis(); | |||
| mAsrTime = System.currentTimeMillis(); | |||
| } | |||
| if(System.currentTimeMillis() - mAsrTime > 3000){ | |||
| mTime = System.currentTimeMillis(); | |||
| } | |||
| mAsrTime = System.currentTimeMillis(); | |||
| File file = createFile("asr-" + mTime + ".pcm"); | |||
| RandomAccessFile raf = null; | |||
| try { | |||
| raf = new RandomAccessFile(file, "rw"); | |||
| raf.seek(file.length()); | |||
| raf.write(bytes); | |||
| raf.close(); | |||
| } catch (IOException e) { | |||
| throw new RuntimeException(e); | |||
| } | |||
| } | |||
| }); | |||
| // DDS.getInstance().getAgent().getASREngine().setAsrListener(new AsrListener() { | |||
| // @Override | |||
| // public void onAsr(byte[] bytes) { | |||
| // if(mTime == 0){ | |||
| // mTime = System.currentTimeMillis(); | |||
| // mAsrTime = System.currentTimeMillis(); | |||
| // } | |||
| // if(System.currentTimeMillis() - mAsrTime > 3000){ | |||
| // mTime = System.currentTimeMillis(); | |||
| // } | |||
| // mAsrTime = System.currentTimeMillis(); | |||
| // File file = createFile("asr-" + mTime + ".pcm"); | |||
| // RandomAccessFile raf = null; | |||
| // try { | |||
| // raf = new RandomAccessFile(file, "rw"); | |||
| // raf.seek(file.length()); | |||
| // raf.write(bytes); | |||
| // raf.close(); | |||
| // } catch (IOException e) { | |||
| // throw new RuntimeException(e); | |||
| // } | |||
| // } | |||
| // }); | |||
| } | |||
| public File createFile(String name) { | |||
| @@ -9,7 +9,7 @@ public class Config { | |||
| public static final String PROD_BASE_URL= "http://123.57.75.177:8080/"; | |||
| public static final String TEST_BASE_URL= "http://39.107.77.235:8080/"; | |||
| public static final String DEV_BASE_URL= "http://192.168.10.244:8080/"; | |||
| public static final String CURRENT_URL= DEV_BASE_URL; | |||
| public static final String CURRENT_URL= PROD_BASE_URL; | |||
| public static final long ONE_SECOND = 1000L; | |||
| public static final long ONE_MINUTE = 60 * ONE_SECOND; | |||
| @@ -1,5 +1,7 @@ | |||
| package com.aispeech.nativedemo.entity; | |||
| import androidx.annotation.NonNull; | |||
| import org.json.JSONArray; | |||
| import org.json.JSONException; | |||
| import org.json.JSONObject; | |||
| @@ -52,9 +54,31 @@ public class Reception implements Serializable { | |||
| second.add(thirdArray.getString(i)); | |||
| } | |||
| } | |||
| if(object.has("welcome")){ | |||
| this.underpinWord = object.optString("welcome"); | |||
| } | |||
| } catch (JSONException e) { | |||
| throw new RuntimeException(e); | |||
| } | |||
| return this; | |||
| } | |||
| @NonNull | |||
| @Override | |||
| public String toString() { | |||
| try { | |||
| JSONObject obj = new JSONObject(); | |||
| obj.put("name", name); | |||
| obj.put("date", date); | |||
| obj.put("guide", guide); | |||
| obj.put("first", first); | |||
| obj.put("second", second); | |||
| obj.put("third", third); | |||
| obj.put("underpinWord", underpinWord); | |||
| return obj.toString(); | |||
| } catch (JSONException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| return super.toString(); | |||
| } | |||
| } | |||
| @@ -74,7 +74,7 @@ public class FaceChatMode { | |||
| if(person != null){ | |||
| person.dfeatures = feat; | |||
| person.bitmap = textureBitmap; | |||
| Logger.e("识别对象为:" + person.name); | |||
| // Logger.e("识别对象为:" + person.name); | |||
| if(mSelectPerson != null && person.id.equals(mSelectPerson.id)){ | |||
| isContainSelectPerson = true; | |||
| } | |||
| @@ -441,7 +441,7 @@ public class FaceChatMode { | |||
| recRes = FaceManager.getInstance().identifyFace(feat); | |||
| if (recRes == null) { | |||
| Logger.e("----------底库中查无此人----------"); | |||
| // Logger.e("----------底库中查无此人----------"); | |||
| // return null; | |||
| return new PersonInfo(id, name, tag, -1, gender, result.track_id, 0, result); | |||
| } | |||
| @@ -456,7 +456,7 @@ public class FaceChatMode { | |||
| name = !TextUtils.isEmpty(emp.nickName) ? emp.nickName : emp.name; //两个名称都传给H5 | |||
| gender = emp.gender == 0 ? (int) result.bd_gender : emp.gender; | |||
| tag = emp.typeId +""; | |||
| Logger.e(TAG, "------------识别到人:" + name + "-------------"); | |||
| // Logger.e(TAG, "------------识别到人:" + name + "-------------"); | |||
| Set<String> strings = Utils.userLogs.keySet(); | |||
| if (strings.contains(id)) { | |||
| times = 1; | |||
| @@ -74,7 +74,7 @@ public class FaceReceptionMode { | |||
| if(person != null){ | |||
| person.dfeatures = feat; | |||
| person.bitmap = textureBitmap; | |||
| Logger.e("识别对象为:" + person.name); | |||
| // Logger.e("识别对象为:" + person.name); | |||
| if(person.id.equals("-2")){ //添加识别条件 人脸质量高和识别置信度底 | |||
| if(mUndeterminedPersons.containsKey(person.trackId)){ | |||
| PersonInfo origin = mUndeterminedPersons.get(person.trackId); | |||
| @@ -118,7 +118,14 @@ public class FaceReceptionMode { | |||
| mCollectTimes++; | |||
| if(mCollectTimes == ROUND_TIMES){ | |||
| MessageUtils.receptionModeStep("第3轮收集数据,开始打招呼"); | |||
| StringBuilder builder = new StringBuilder(); | |||
| mUngreetPersons.forEach((key, person) -> { | |||
| builder.append(person.name).append(","); | |||
| }); | |||
| mUndeterminedPersons.forEach((key, person) -> { | |||
| builder.append("陌生人").append(","); | |||
| }); | |||
| MessageUtils.receptionModeStep("第3轮收集数据,开始打招呼:" + builder.toString()); | |||
| mCollectTimes = 0; | |||
| return true; | |||
| } else{ | |||
| @@ -149,7 +156,7 @@ public class FaceReceptionMode { | |||
| SimpleDateFormat time = new SimpleDateFormat("MM-dd"); | |||
| String dateStr = time.format(date); | |||
| if(!dateStr.equals(reception.date)){ | |||
| MessageUtils.receptionModeStep("不在接待时间范围内"); | |||
| MessageUtils.receptionModeStep("不在接待时间范围内" + reception.toString()); | |||
| return; | |||
| } | |||
| StringBuilder word = new StringBuilder(); | |||
| @@ -160,6 +167,10 @@ public class FaceReceptionMode { | |||
| word.append(person.name).append(","); | |||
| } | |||
| }); | |||
| int length = word.length(); | |||
| if(length > 0){ | |||
| word.deleteCharAt(word.lastIndexOf(",")); | |||
| } | |||
| if(index1.get() > 0){ | |||
| word.append(index1.get() > 1 ? "你们好," : "您好,"); | |||
| } | |||
| @@ -170,10 +181,6 @@ public class FaceReceptionMode { | |||
| word.append(person.name).append(","); | |||
| } | |||
| }); | |||
| if(index2.get() > 0){ | |||
| word.append(index2.get() > 1 ? "你们好," : "你好,"); | |||
| } | |||
| AtomicInteger index3 = new AtomicInteger(0); | |||
| mUngreetPersons.forEach((key, person) -> { | |||
| String id = person.id; | |||
| @@ -196,10 +203,12 @@ public class FaceReceptionMode { | |||
| word.append(person.name).append(","); | |||
| } | |||
| }); | |||
| if(word.length() > 0 && word.length() - length > 0){ | |||
| word.deleteCharAt(word.lastIndexOf(",")); | |||
| } | |||
| if(index3.get() > 0){ | |||
| word.append(index3.get() > 1 ? "你们好" : "你好"); | |||
| } | |||
| if(TextUtils.isEmpty(word.toString())){ | |||
| if(mUndeterminedPersons.size() > 2 && !isStrangerAsk){ | |||
| MessageUtils.receptionModeStep("播放托底话术"); | |||
| @@ -353,7 +362,7 @@ public class FaceReceptionMode { | |||
| recRes = FaceManager.getInstance().identifyFace(feat); | |||
| if (recRes == null) { | |||
| Logger.e("----------底库中查无此人----------"); | |||
| // Logger.e("----------底库中查无此人----------"); | |||
| // return null; | |||
| return new PersonInfo(id, name, tag, -1, gender, result.track_id, 0, result); | |||
| } | |||
| @@ -368,7 +377,7 @@ public class FaceReceptionMode { | |||
| name = !TextUtils.isEmpty(emp.nickName) ? emp.nickName : emp.name; //两个名称都传给H5 | |||
| gender = emp.gender == 0 ? (int) result.bd_gender : emp.gender; | |||
| tag = emp.typeId +""; | |||
| Logger.e(TAG, "------------识别到人:" + name + "-------------"); | |||
| // Logger.e(TAG, "------------识别到人:" + name + "-------------"); | |||
| Set<String> strings = Utils.userLogs.keySet(); | |||
| if (strings.contains(id)) { | |||
| times = 1; | |||
| @@ -133,6 +133,8 @@ public class DigiWebSocketServer extends WebSocketServer { | |||
| IdentityMode.MODE_CURRENT = IdentityMode.MODE_CHAT; | |||
| FaceReceptionMode.checkSessionExpire(true); | |||
| } | |||
| } else if(type.equals("getWakeupStatus")){ | |||
| MessageUtils.sendFetchWakeupStatus(!DuiMessageObserver.mIsSleep); | |||
| } | |||
| } catch (JSONException e) { | |||
| throw new RuntimeException(e); | |||
| @@ -47,6 +47,17 @@ public class MessageUtils { | |||
| } | |||
| } | |||
| public static void sendFetchWakeupStatus(boolean isWakeUp){ | |||
| try { | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type", "fetchWakeupStatus"); | |||
| jo.put("data", isWakeUp); | |||
| sendMessage(jo.toString()); | |||
| } catch (JSONException e) { | |||
| throw new RuntimeException(e); | |||
| } | |||
| } | |||
| public static void sendDoa(String type, int doa){ | |||
| try { | |||
| JSONObject jo = new JSONObject(); | |||