|
@@ -10,6 +10,8 @@ import android.support.v7.app.AlertDialog;
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.support.v7.widget.helper.ItemTouchHelper;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
@@ -27,6 +29,7 @@ import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.wdkl.callingmainnursemanager.MyApplication;
|
|
|
import com.wdkl.callingmainnursemanager.R;
|
|
|
+import com.wdkl.callingmainnursemanager.adapter.CallListAdapter;
|
|
|
import com.wdkl.callingmainnursemanager.adapter.DoctorHostAdapter;
|
|
|
import com.wdkl.callingmainnursemanager.adapter.DutyDoctorAdapter;
|
|
|
import com.wdkl.callingmainnursemanager.adapter.DutyNurseAdapter;
|
|
@@ -43,6 +46,7 @@ import com.wdkl.callingmainnursemanager.entity.PartInfoEntity;
|
|
|
import com.wdkl.callingmainnursemanager.entity.UdpEntity;
|
|
|
import com.wdkl.callingmainnursemanager.ui.activity.MainFragmentActivity;
|
|
|
import com.wdkl.callingmainnursemanager.util.LogUtil;
|
|
|
+import com.wdkl.callingmainnursemanager.util.PalyPhonetics;
|
|
|
import com.wdkl.callingmainnursemanager.util.SharedPreferencesUtil;
|
|
|
import com.wdkl.callingmainnursemanager.util.StringUtils;
|
|
|
import com.wdkl.callingmainnursemanager.util.UIUtils;
|
|
@@ -77,7 +81,7 @@ import static com.wdkl.callingmainnursemanager.util.ToastUtil.showToast;
|
|
|
* Changed by Waderson on 2017/12/1
|
|
|
*/
|
|
|
|
|
|
-public class CallingHostFragment extends BaseFragment implements DoctorHostAdapter.DoctorHostItemOnclickListener,
|
|
|
+public class CallingHostFragment extends BaseFragment implements DoctorHostAdapter.DoctorHostItemOnclickListener, CallListAdapter.CallingListItemOnclickListener,
|
|
|
NurseHostAdapter.NurseHostItemOnclickListener, NurseHostAdapter.NurseHostCallOnClickListener, View.OnClickListener, SerialPortUtil.ISerialPortHandsFree,
|
|
|
MedicalHostsCallingQueuingInfoAdapter.CallingQueuingBarItemOnClickListener, RecyclerView.OnItemTouchListener, SwipeRefreshLayout.OnRefreshListener {
|
|
|
|
|
@@ -100,6 +104,10 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
*/
|
|
|
@Bind(R.id.fragment_rv_doctor)
|
|
|
RecyclerView rvDoctor;
|
|
|
+
|
|
|
+ @Bind(R.id.fragment_rv_incoming_call_list)
|
|
|
+ RecyclerView rvCallingList;
|
|
|
+
|
|
|
/**
|
|
|
* 医生主机的实体
|
|
|
*/
|
|
@@ -179,6 +187,20 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
private DutyDoctorAdapter dutyDoctorAdapter;
|
|
|
private DutyNurseAdapter dutyNurseAdapter;
|
|
|
|
|
|
+ /**
|
|
|
+ * 呼叫列表适配器
|
|
|
+ */
|
|
|
+ private CallListAdapter callListAdapter;
|
|
|
+ /**
|
|
|
+ * 用户拨打电话的当前实例
|
|
|
+ */
|
|
|
+ protected UdpEntity callingEntity;
|
|
|
+ /**
|
|
|
+ * 用户向上滑动的item的Position
|
|
|
+ */
|
|
|
+ private int upScrllPosition = -1;
|
|
|
+ private int lastSelectCall = -1;
|
|
|
+
|
|
|
@Nullable
|
|
|
@Override
|
|
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
@@ -239,6 +261,34 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
rvDoctor.setAdapter(doctorHostAdapter);
|
|
|
doctorHostAdapter.setDoctorHostItemOnclickListener(this);
|
|
|
|
|
|
+ //呼叫列表
|
|
|
+ LinearLayoutManager linearLayoutCallListManager = new LinearLayoutManager(getActivity());
|
|
|
+ linearLayoutCallListManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
+ rvCallingList.setLayoutManager(linearLayoutCallListManager);
|
|
|
+
|
|
|
+ callListAdapter = new CallListAdapter(getActivity(), ((MyApplication) getActivity().getApplication()).callEntityList);
|
|
|
+ rvCallingList.setAdapter(callListAdapter);
|
|
|
+ callListAdapter.setCallingListItemOnClickListener(this);
|
|
|
+
|
|
|
+ ItemTouchHelper.Callback mCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.UP) {
|
|
|
+ @Override
|
|
|
+ public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { //上滑删除item
|
|
|
+ upScrllPosition = viewHolder.getAdapterPosition();
|
|
|
+ UdpEntity upScrllUdpEntity = MyApplication.callEntityList.get(upScrllPosition);
|
|
|
+ deleteCallingItem(upScrllUdpEntity);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ //用Callback构造ItemtouchHelper
|
|
|
+ ItemTouchHelper touchHelper = new ItemTouchHelper(mCallback);
|
|
|
+ //调用ItemTouchHelper的attachToRecyclerView方法建立联系
|
|
|
+ touchHelper.attachToRecyclerView(rvCallingList);
|
|
|
+
|
|
|
+
|
|
|
//护士主机列表
|
|
|
//LinearLayoutManager nurseManager = new LinearLayoutManager(getActivity());
|
|
|
//nurseManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
@@ -609,6 +659,14 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void sendCall(UdpEntity entity) {
|
|
|
+ if (Constants.CALL_STATE.equals(Constants.STANDBY)) {
|
|
|
+ UdpSendUtil.sendManagerCancelCall(entity);
|
|
|
+ Constants.CALL_STATE = Constants.IN_CALL;
|
|
|
+ ((MainFragmentActivity) getActivity()).initiateCall(entity.getSipAddress(), Constants.MUlTITAP_CALL, entity.getDeviceMAC());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void endCall(String hostId) {
|
|
|
if (!Constants.CALL_STATE.equals(Constants.STANDBY) && Constants.CallType.equals(Constants.MANAGER_CALL)) {
|
|
|
((MainFragmentActivity) getActivity()).endCalled();
|
|
@@ -619,6 +677,16 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 结束呼叫
|
|
|
+ */
|
|
|
+ public void endCall() {
|
|
|
+ if (!Constants.CALL_STATE.equals(Constants.STANDBY)) {
|
|
|
+ ((MainFragmentActivity) getActivity()).endCalled();
|
|
|
+ Constants.CALL_STATE = Constants.STANDBY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
@@ -741,6 +809,29 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
return dialog;
|
|
|
}
|
|
|
|
|
|
+ private AlertDialog createCallDialog(final UdpEntity entity) {
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CallingDialog);
|
|
|
+ final AlertDialog dialog = builder.create();
|
|
|
+ dialog.setCanceledOnTouchOutside(false);
|
|
|
+ View dialogView = View.inflate(getActivity(), R.layout.dialog_host_call_layout, null);
|
|
|
+ TextView tvCallStatus = dialogView.findViewById(R.id.tv_call_status);
|
|
|
+ tvCallStatus.setText("通话接通中...");
|
|
|
+ TextView tvPartName = dialogView.findViewById(R.id.tv_call_part_name);
|
|
|
+ String text = entity.getRoomNumber() + "房" + entity.getBedNumber() + "床";
|
|
|
+ tvPartName.setText(text);
|
|
|
+ Button button = dialogView.findViewById(R.id.btn_call);
|
|
|
+ button.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ deleteCallingItem(entity);
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dialog.setView(dialogView);
|
|
|
+
|
|
|
+ return dialog;
|
|
|
+ }
|
|
|
+
|
|
|
private void updateCallDialogStatus(String status) {
|
|
|
if (callDialog != null && callDialog.isShowing()) {
|
|
|
TextView textView = (TextView) callDialog.findViewById(R.id.tv_call_status);
|
|
@@ -751,6 +842,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
private void callDialogDismiss() {
|
|
|
if (callDialog != null && callDialog.isShowing()) {
|
|
|
callDialog.dismiss();
|
|
|
+ callDialog = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -793,18 +885,39 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
case Constants.EVENT_UDP2:
|
|
|
UdpEntity udpEntity = (UdpEntity) messageEvent.getMessage();
|
|
|
String nurseHostID = udpEntity.getNurseHostID();
|
|
|
- if (Constants.CALLING_HOST_ID.equals(nurseHostID)) {
|
|
|
- //对方挂断
|
|
|
- //ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
- //nurse_CallStaus.setText("");
|
|
|
- Constants.CALL_STATE = Constants.STANDBY;
|
|
|
- Constants.CALLING_HOST_ID = "";
|
|
|
- callDialogDismiss();
|
|
|
+ LogUtil.d("CallingHostFragment", "udpEntityString==" + udpEntity.toString());
|
|
|
+ switch (udpEntity.getIndexes()) {
|
|
|
+ case "call_12_upremove":
|
|
|
+ if (Constants.CALLING_HOST_ID.equals(nurseHostID)) {
|
|
|
+ //对方挂断
|
|
|
+ //ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
+ //nurse_CallStaus.setText("");
|
|
|
+ Constants.CALL_STATE = Constants.STANDBY;
|
|
|
+ Constants.CALLING_HOST_ID = "";
|
|
|
+ callDialogDismiss();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "call_16":
|
|
|
+ if (!PalyPhonetics.speakEntityList.contains(udpEntity)) {
|
|
|
+ addPhonetics(udpEntity); //在此加入列表队列 Waderson 20171101
|
|
|
+ }
|
|
|
+ if (!MyApplication.callEntityList.contains(udpEntity)) {
|
|
|
+ if (isHaveThisWSHtype(udpEntity)) return;
|
|
|
+ MyApplication.callEntityList.add(udpEntity);
|
|
|
+ }
|
|
|
+ callListAdapter.notifyDataSetChanged();
|
|
|
+ break;
|
|
|
+ case "call_15_cancel":
|
|
|
+ Log.e("CallingHostFragment","call_15_cancel.....mac"+udpEntity.getDeviceMAC()+" "+Constants.MAC_ADDRESS);
|
|
|
+ if(!udpEntity.getDeviceMAC().equals(Constants.MAC_ADDRESS)){
|
|
|
+ deleteCallingItem(udpEntity);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
break;
|
|
|
case Constants.EVENT_SIP:
|
|
|
//LogUtil.d("CallingHost", "Constants.CallType == " + Constants.CallType);
|
|
|
- if (Constants.CallType.equals(Constants.MANAGER_CALL)) {
|
|
|
+ if (Constants.CallType.equals(Constants.MANAGER_CALL) || Constants.CallType.equals(Constants.MUlTITAP_CALL)) {
|
|
|
if (Constants.CALL_STATE.equals(Constants.IN_CALL)) {
|
|
|
((MainFragmentActivity) getActivity()).autoCall();
|
|
|
} else if (Constants.CALL_STATE.equals(Constants.IN_CALLING)) {
|
|
@@ -834,6 +947,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
//nurse_CallStaus.setText("");
|
|
|
Constants.CALLING_HOST_ID = "";
|
|
|
callDialogDismiss();
|
|
|
+ deleteCallingItem(callingEntity);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -855,7 +969,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
|
|
|
@Override
|
|
|
public void isHandsFree(int state) {
|
|
|
- LogUtil.d("wzl", "isHandsFree: " + state);
|
|
|
+ //LogUtil.d("wzl", "isHandsFree: " + state);
|
|
|
Message msg = handler.obtainMessage();
|
|
|
Bundle data_p = new Bundle();
|
|
|
data_p.putInt(SPRINGCLICK_CONTENT, state);
|
|
@@ -964,4 +1078,225 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void callListItemOnclick(View view, int position) {
|
|
|
+ if (!Constants.CALL_STATE.equals(Constants.STANDBY)) {
|
|
|
+ ToastUtil.showToast("请先取消当前呼叫");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (lastSelectCall == position) {
|
|
|
+ callingEntity = MyApplication.callEntityList.get(position);
|
|
|
+ if (callingEntity != null) {
|
|
|
+ //清除语音播报
|
|
|
+ if (null != loopVoice) {
|
|
|
+ loopVoice.setPalyDismiss(true);
|
|
|
+ }
|
|
|
+ PalyPhonetics.speakEntityList.clear();
|
|
|
+
|
|
|
+ callDialog = createCallDialog(callingEntity);
|
|
|
+ Window window = callDialog.getWindow();
|
|
|
+ callDialog.show();
|
|
|
+ if (window != null) {
|
|
|
+ WindowManager.LayoutParams lp = window.getAttributes();
|
|
|
+ lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
|
|
+ lp.height = WindowManager.LayoutParams.MATCH_PARENT;
|
|
|
+ window.setAttributes(lp);
|
|
|
+ }
|
|
|
+ sendCall(callingEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lastSelectCall = position;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void deleteCallingItem(UdpEntity deleteEntity) {
|
|
|
+ if (deleteEntity == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ endCall();
|
|
|
+
|
|
|
+ //清除语音播报
|
|
|
+ if (null != loopVoice) {
|
|
|
+ loopVoice.setPalyDismiss(true);
|
|
|
+ }
|
|
|
+ PalyPhonetics.speakEntityList.clear();
|
|
|
+
|
|
|
+ for (int i=0; i< MyApplication.callEntityList.size(); i++) {//将列表也删除该元素 两种实体格式不一样,所以要用循环
|
|
|
+ if(MyApplication.callEntityList.get(i).equals(deleteEntity)) {
|
|
|
+ UdpSendUtil.sendManagerHangUpPhone(deleteEntity);
|
|
|
+ MyApplication.callEntityList.remove(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ callListAdapter.updateList(MyApplication.callEntityList);
|
|
|
+ lastSelectCall = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ /************语音播报**************/
|
|
|
+ private PalyPhonetics loopVoice;
|
|
|
+ private UdpEntity loopingUdpentity;
|
|
|
+ private Thread palyPhoneticsThread;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 播放语音(waderson 20171031)
|
|
|
+ */
|
|
|
+ private void palyPhonetics() {
|
|
|
+ if (null != PalyPhonetics.speakEntityList && PalyPhonetics.speakEntityList.size() > 0) {
|
|
|
+ if (null == loopVoice) {
|
|
|
+ loopVoice = PalyPhonetics.getInstance(getActivity());
|
|
|
+ }
|
|
|
+ if (!Constants.CALL_STATE.equals(Constants.IN_CALLING)) {
|
|
|
+ loopVoice.setVolumes(1.0f);
|
|
|
+ }
|
|
|
+ loopVoice.setPalyDismiss(false);
|
|
|
+ loopVoice.setLooping(2);
|
|
|
+ loopingUdpentity = PalyPhonetics.speakEntityList.get(0);
|
|
|
+ ArrayList<Integer> resIdlist = new ArrayList<>();
|
|
|
+ resIdlist.clear();
|
|
|
+ String type = loopingUdpentity.getType();
|
|
|
+
|
|
|
+ //护士主机转接过来的
|
|
|
+ if(!TextUtils.isEmpty(loopingUdpentity.getDeviceMAC())&&loopingUdpentity.getDeviceMAC().length()<3
|
|
|
+ &&!loopingUdpentity.getDeviceMAC().equals("0")){
|
|
|
+ type = loopingUdpentity.getDeviceMAC();
|
|
|
+ }
|
|
|
+
|
|
|
+ String rnb = loopingUdpentity.getRoomNumber();
|
|
|
+ String bnb = loopingUdpentity.getBedNumber();
|
|
|
+ boolean haveVip = false;
|
|
|
+ if (StringUtils.isHaveStr(bnb, "-")) {// add by waderson 20191212
|
|
|
+ String b1 = bnb.substring(0, bnb.indexOf("-"));//前
|
|
|
+ bnb = bnb.substring(bnb.indexOf("-") + 1);//后
|
|
|
+ haveVip = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ String roomnumber = PalyPhonetics.changeNumType(rnb, false);
|
|
|
+ String bednumber = PalyPhonetics.changeNumType(bnb, false);
|
|
|
+ switch (type) {
|
|
|
+ case Constants.SON_CALL://床位
|
|
|
+ ArrayList<String> list_str3 = StringUtils.substringBySing(roomnumber);
|
|
|
+ ArrayList<String> list_str33 = StringUtils.substringBySing(bednumber);
|
|
|
+ //不播房号
|
|
|
+ //for (String s : list_str3) {
|
|
|
+ // resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ //}
|
|
|
+ //resIdlist.add(R.raw.fang);
|
|
|
+
|
|
|
+ if (null != list_str33) {
|
|
|
+ if (haveVip) {// add by waderson 20191212
|
|
|
+ resIdlist.add(R.raw.vip);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String s : list_str33) {
|
|
|
+ resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.chuang);
|
|
|
+ resIdlist.add(R.raw.hujiao);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Constants.TRADITION_CALL://传统床位
|
|
|
+ ArrayList<String> list_str6 = StringUtils.substringBySing(roomnumber);
|
|
|
+ ArrayList<String> list_str66 = StringUtils.substringBySing(bednumber);
|
|
|
+ //不播房号
|
|
|
+ //if (StringUtils.listNotEmpty(list_str6)) {
|
|
|
+ // for (String s : list_str6) {
|
|
|
+ // resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ // }
|
|
|
+ // resIdlist.add(R.raw.fang);
|
|
|
+ //}
|
|
|
+
|
|
|
+ if (StringUtils.listNotEmpty(list_str66)) {
|
|
|
+ if (haveVip) {// add by waderson 20191212
|
|
|
+ resIdlist.add(R.raw.vip);
|
|
|
+ }
|
|
|
+ for (String s : list_str66) {
|
|
|
+ resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.chuang);
|
|
|
+ resIdlist.add(R.raw.hujiao);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Constants.ROOMHELP_CALL://请求增援
|
|
|
+ ArrayList<String> list_str4 = StringUtils.substringBySing(roomnumber);
|
|
|
+ ArrayList<String> list_str44 = StringUtils.substringBySing(bednumber);
|
|
|
+ if (null != list_str4) {//是否要播报“房” 0不要 1要
|
|
|
+ for (String s : list_str4) {
|
|
|
+ resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.fang);
|
|
|
+ }
|
|
|
+ if (null != list_str44) {
|
|
|
+ if (haveVip) {// add by waderson 20191212
|
|
|
+ resIdlist.add(R.raw.vip);
|
|
|
+ }
|
|
|
+ for (String s : list_str44) {
|
|
|
+ resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.chuang);
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.qingqiuzhenyuan);
|
|
|
+ break;
|
|
|
+ case Constants.WSHROOM_CALL://卫生间
|
|
|
+ ArrayList<String> list_str5 = StringUtils.substringBySing(roomnumber);
|
|
|
+ if (null != list_str5) {
|
|
|
+ for (String s : list_str5) {
|
|
|
+ resIdlist.add(PalyPhonetics.getResIdInt(s));
|
|
|
+ }
|
|
|
+ resIdlist.add(R.raw.fang);
|
|
|
+ resIdlist.add(R.raw.weishejian);
|
|
|
+ resIdlist.add(R.raw.jinjihujiao);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (null != loopVoice) {
|
|
|
+ try {
|
|
|
+ loopVoice.speak(resIdlist);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (PalyPhonetics.speakEntityList.contains(loopingUdpentity)) {
|
|
|
+ PalyPhonetics.speakEntityList.remove(loopingUdpentity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addPhonetics(UdpEntity udpEntity) {
|
|
|
+ startPalyPhonetics();
|
|
|
+ PalyPhonetics.speakEntityList.add(udpEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void startPalyPhonetics() {
|
|
|
+ if (null == palyPhoneticsThread) {
|
|
|
+ palyPhoneticsThread = new Thread(new palyPhoneticsRunnable());
|
|
|
+ palyPhoneticsThread.start();
|
|
|
+ } else if (null != palyPhoneticsThread && !palyPhoneticsThread.isAlive()) {
|
|
|
+ palyPhoneticsThread.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public class palyPhoneticsRunnable implements Runnable {
|
|
|
+ public void run() {
|
|
|
+ while (true) {
|
|
|
+ palyPhonetics();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否已经有该卫生间紧急呼叫<br></>
|
|
|
+ */
|
|
|
+ private boolean isHaveThisWSHtype(UdpEntity udpEntity) {
|
|
|
+ if (!Constants.WSHROOM_CALL.equals(udpEntity.getType())) return false;
|
|
|
+ ArrayList<UdpEntity> callEntityList = ((MyApplication) getActivity().getApplication()).callEntityList;
|
|
|
+ for (int i = 0; i < callEntityList.size(); i++) {
|
|
|
+ if (Constants.WSHROOM_CALL.equals(callEntityList.get(i).getType()) && udpEntity.getRoomNumber().equals(callEntityList.get(i).getRoomNumber())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|