Browse Source

增加门口机应答

vothin 5 months ago
parent
commit
e5949fdb2a
46 changed files with 396 additions and 106 deletions
  1. 2 2
      .settings/language.settings.xml
  2. 3 0
      i18n/en_US.tr
  3. 3 0
      i18n/es_ES-西班牙语.tr
  4. 3 0
      i18n/zh_CN.tr
  5. 21 0
      jni/activity/functionActivity.cpp
  6. 6 0
      jni/activity/functionActivity.h
  7. 2 1
      jni/core/utilities.cpp
  8. 114 71
      jni/logic/callLogic.cc
  9. 115 5
      jni/logic/functionLogic.cc
  10. 2 1
      jni/logic/navibar.cc
  11. 65 10
      jni/logic/startLogic.cc
  12. 5 0
      jni/net/tcp_model.h
  13. 36 11
      jni/net/tcp_util.cpp
  14. 8 1
      jni/net/tcp_util.h
  15. 11 4
      jni/service/BusinessConfig.h
  16. BIN
      libs/armeabi/libzkgui.so
  17. BIN
      obj/activity/callActivity.o
  18. BIN
      obj/activity/customerAffairActivity.o
  19. BIN
      obj/activity/deviceAddActivity.o
  20. BIN
      obj/activity/deviceInfoActivity.o
  21. BIN
      obj/activity/functionActivity.o
  22. BIN
      obj/activity/interactionActivity.o
  23. BIN
      obj/activity/mainActivity.o
  24. BIN
      obj/activity/medicalCareActivity.o
  25. BIN
      obj/activity/moreActivity.o
  26. BIN
      obj/activity/navibar.o
  27. BIN
      obj/activity/promptActivity.o
  28. BIN
      obj/activity/settingActivity.o
  29. BIN
      obj/activity/sipTestActivity.o
  30. BIN
      obj/activity/startActivity.o
  31. BIN
      obj/activity/statusbar.o
  32. BIN
      obj/activity/updateActivity.o
  33. BIN
      obj/core/update_assistant.o
  34. BIN
      obj/core/utilities.o
  35. BIN
      obj/net/tcp_client.o
  36. BIN
      obj/net/tcp_model.o
  37. BIN
      obj/net/tcp_util.o
  38. BIN
      obj/server/http_server.o
  39. BIN
      obj/service/BusinessConfig.o
  40. BIN
      obj/service/time.o
  41. BIN
      obj/uart/UartContext.o
  42. BIN
      resources/function/chooseBed-pink-400x52.png
  43. BIN
      resources/function/chooseBed_400x52.png
  44. BIN
      resources/function/noChooseBed-400x52.png
  45. BIN
      resources/function/noChooseBed_400x52.png
  46. BIN
      ui/function.ftu

+ 2 - 2
.settings/language.settings.xml

@@ -5,7 +5,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1598342317999435929" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-897966030472691006" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>
 			</provider>
@@ -16,7 +16,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="461008373916" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1866745283451" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>
 			</provider>

+ 3 - 0
i18n/en_US.tr

@@ -140,6 +140,8 @@
 	<string name="Handle4Disconnected">handset 4 disconnected</string>
 	<string name="Handle4Disconnected">handset 4 disconnected</string>
 	<string name="Handle5Disconnected">handset 5 disconnected</string>
 	<string name="Handle5Disconnected">handset 5 disconnected</string>
 	<string name="Handle6Disconnected">handset 6 disconnected</string>
 	<string name="Handle6Disconnected">handset 6 disconnected</string>
+    <string name="GainCall">Extension calling, click to answer</string>
+	<string name="InitiateCall">Start Call</string>
     <!-- 医护界面 -->
     <!-- 医护界面 -->
 	<string name="MedicalLoginMsg">Please enter the correct password to begin medical care</string>
 	<string name="MedicalLoginMsg">Please enter the correct password to begin medical care</string>
 	<string name="InputMedicalPassword">Enter the password to begin medical care</string>
 	<string name="InputMedicalPassword">Enter the password to begin medical care</string>
@@ -308,6 +310,7 @@
 	<string name="AddDeviceFrameFailed">No space id can be registered</string>
 	<string name="AddDeviceFrameFailed">No space id can be registered</string>
 	<string name="HandleError">Handset:</string>
 	<string name="HandleError">Handset:</string>
 	<string name="NotAdd">Not registered</string>
 	<string name="NotAdd">Not registered</string>
+	<string name="CallAnswered">The call has been answered or cancelled, cannot answer</string>
     <!-- 版本界面 -->
     <!-- 版本界面 -->
 	<string name="VersionTitle">Version Upgrade</string>
 	<string name="VersionTitle">Version Upgrade</string>
 	<string name="VersionInfo">Version Information</string>
 	<string name="VersionInfo">Version Information</string>

+ 3 - 0
i18n/es_ES-西班牙语.tr

@@ -202,6 +202,8 @@
 	<string name="Handle4Disconnected">Pulsador de cama 4 desconectado</string>
 	<string name="Handle4Disconnected">Pulsador de cama 4 desconectado</string>
 	<string name="Handle5Disconnected">Pulsador de cama 5 desconectado</string>
 	<string name="Handle5Disconnected">Pulsador de cama 5 desconectado</string>
 	<string name="Handle6Disconnected">Pulsador de cama 6 desconectado</string>
 	<string name="Handle6Disconnected">Pulsador de cama 6 desconectado</string>
+    <string name="GainCall">Llamada de extensión, clic para responder</string>
+    <string name="InitiateCall">Iniciar Llamada</string>
     <!-- 医护界面 -->
     <!-- 医护界面 -->
 	<string name="MedicalLoginMsg">Ingrese la contraseña correcta para comenzar la atención médica</string>
 	<string name="MedicalLoginMsg">Ingrese la contraseña correcta para comenzar la atención médica</string>
 	<string name="InputMedicalPassword">Ingrese la contraseña para comenzar la atención médica</string>
 	<string name="InputMedicalPassword">Ingrese la contraseña para comenzar la atención médica</string>
@@ -371,6 +373,7 @@
 	<string name="AddDeviceFrameFailed">No se puede registrar ningún ID estructural</string>
 	<string name="AddDeviceFrameFailed">No se puede registrar ningún ID estructural</string>
 	<string name="HandleError">Manejador:</string>
 	<string name="HandleError">Manejador:</string>
 	<string name="NotAdd">No registrado</string>
 	<string name="NotAdd">No registrado</string>
+    <string name="CallAnswered">La llamada ha sido contestada o cancelada, no se puede contestar</string>
     <!-- 版本界面 -->
     <!-- 版本界面 -->
 	<string name="VersionTitle">Nombre de versión</string>
 	<string name="VersionTitle">Nombre de versión</string>
 	<string name="VersionInfo">Información de versión</string>
 	<string name="VersionInfo">Información de versión</string>

+ 3 - 0
i18n/zh_CN.tr

@@ -140,6 +140,8 @@
     <string name="Handle4Disconnected">手柄4已断连</string>
     <string name="Handle4Disconnected">手柄4已断连</string>
     <string name="Handle5Disconnected">手柄5已断连</string>
     <string name="Handle5Disconnected">手柄5已断连</string>
     <string name="Handle6Disconnected">手柄6已断连</string>
     <string name="Handle6Disconnected">手柄6已断连</string>
+	<string name="GainCall">分机正在呼叫,可以点击接听按钮进行接听</string>
+    <string name="InitiateCall">发起呼叫</string>
     <!-- 医护界面 -->
     <!-- 医护界面 -->
     <string name="MedicalLoginMsg">请输入正确的密码,进入医护功能</string>
     <string name="MedicalLoginMsg">请输入正确的密码,进入医护功能</string>
     <string name="InputMedicalPassword">输入密码进入医护</string>
     <string name="InputMedicalPassword">输入密码进入医护</string>
@@ -308,6 +310,7 @@
     <string name="AddDeviceFrameFailed">没有能够注册的空间id</string>
     <string name="AddDeviceFrameFailed">没有能够注册的空间id</string>
     <string name="HandleError">手柄:</string>
     <string name="HandleError">手柄:</string>
     <string name="NotAdd"> 没有注册</string>
     <string name="NotAdd"> 没有注册</string>
+    <string name="CallAndwered">该通话已被接听或取消,无法接听</string>
     <!-- 版本界面 -->
     <!-- 版本界面 -->
     <string name="VersionTitle">版本升级</string>
     <string name="VersionTitle">版本升级</string>
     <string name="VersionInfo">版本信息</string>
     <string name="VersionInfo">版本信息</string>

+ 21 - 0
jni/activity/functionActivity.cpp

@@ -4,6 +4,12 @@
 #include "functionActivity.h"
 #include "functionActivity.h"
 
 
 /*TAG:GlobalVariable全局变量*/
 /*TAG:GlobalVariable全局变量*/
+static ZKListView* mGainCallListViewPtr;
+static ZKButton* mGainCancelButtonPtr;
+static ZKButton* mGainCallButtonPtr;
+static ZKTextView* mGainCallTextViewPtr;
+static ZKPainter* mGainCallPainterPtr;
+static ZKWindow* mGainCallWindowPtr;
 static ZKTextView* mHandleStatusTextViewPtr;
 static ZKTextView* mHandleStatusTextViewPtr;
 static ZKButton* mHandleBackButtonPtr;
 static ZKButton* mHandleBackButtonPtr;
 static ZKButton* mHandleConfirmButtonPtr;
 static ZKButton* mHandleConfirmButtonPtr;
@@ -105,6 +111,8 @@ typedef struct {
 
 
 /*TAG:ButtonCallbackTab按键映射表*/
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_FUNCTION_GainCancelButton, onButtonClick_GainCancelButton,
+    ID_FUNCTION_GainCallButton, onButtonClick_GainCallButton,
     ID_FUNCTION_HandleBackButton, onButtonClick_HandleBackButton,
     ID_FUNCTION_HandleBackButton, onButtonClick_HandleBackButton,
     ID_FUNCTION_HandleConfirmButton, onButtonClick_HandleConfirmButton,
     ID_FUNCTION_HandleConfirmButton, onButtonClick_HandleConfirmButton,
     ID_FUNCTION_CancelButton, onButtonClick_CancelButton,
     ID_FUNCTION_CancelButton, onButtonClick_CancelButton,
@@ -153,6 +161,7 @@ typedef struct {
 }S_ListViewFunctionsCallback;
 }S_ListViewFunctionsCallback;
 /*TAG:ListViewFunctionsCallback*/
 /*TAG:ListViewFunctionsCallback*/
 static S_ListViewFunctionsCallback SListViewFunctionsCallbackTab[] = {
 static S_ListViewFunctionsCallback SListViewFunctionsCallbackTab[] = {
+    ID_FUNCTION_GainCallListView, getListItemCount_GainCallListView, obtainListItemData_GainCallListView, onListItemClick_GainCallListView,
     ID_FUNCTION_TimeListView, getListItemCount_TimeListView, obtainListItemData_TimeListView, onListItemClick_TimeListView,
     ID_FUNCTION_TimeListView, getListItemCount_TimeListView, obtainListItemData_TimeListView, onListItemClick_TimeListView,
     ID_FUNCTION_CallBedListView, getListItemCount_CallBedListView, obtainListItemData_CallBedListView, onListItemClick_CallBedListView,
     ID_FUNCTION_CallBedListView, getListItemCount_CallBedListView, obtainListItemData_CallBedListView, onListItemClick_CallBedListView,
 };
 };
@@ -205,6 +214,12 @@ functionActivity::~functionActivity() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     onUI_quit();
     mActivityPtr = NULL;
     mActivityPtr = NULL;
+    mGainCallListViewPtr = NULL;
+    mGainCancelButtonPtr = NULL;
+    mGainCallButtonPtr = NULL;
+    mGainCallTextViewPtr = NULL;
+    mGainCallPainterPtr = NULL;
+    mGainCallWindowPtr = NULL;
     mHandleStatusTextViewPtr = NULL;
     mHandleStatusTextViewPtr = NULL;
     mHandleBackButtonPtr = NULL;
     mHandleBackButtonPtr = NULL;
     mHandleConfirmButtonPtr = NULL;
     mHandleConfirmButtonPtr = NULL;
@@ -278,6 +293,12 @@ const char* functionActivity::getAppName() const{
 //TAG:onCreate
 //TAG:onCreate
 void functionActivity::onCreate() {
 void functionActivity::onCreate() {
 	Activity::onCreate();
 	Activity::onCreate();
+    mGainCallListViewPtr = (ZKListView*)findControlByID(ID_FUNCTION_GainCallListView);if(mGainCallListViewPtr!= NULL){mGainCallListViewPtr->setListAdapter(this);mGainCallListViewPtr->setItemClickListener(this);}
+    mGainCancelButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_GainCancelButton);
+    mGainCallButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_GainCallButton);
+    mGainCallTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_GainCallTextView);
+    mGainCallPainterPtr = (ZKPainter*)findControlByID(ID_FUNCTION_GainCallPainter);
+    mGainCallWindowPtr = (ZKWindow*)findControlByID(ID_FUNCTION_GainCallWindow);
     mHandleStatusTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_HandleStatusTextView);
     mHandleStatusTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_HandleStatusTextView);
     mHandleBackButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleBackButton);
     mHandleBackButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleBackButton);
     mHandleConfirmButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleConfirmButton);
     mHandleConfirmButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleConfirmButton);

+ 6 - 0
jni/activity/functionActivity.h

@@ -27,6 +27,12 @@
 #include "window/ZKSlideWindow.h"
 #include "window/ZKSlideWindow.h"
 
 
 /*TAG:Macro宏ID*/
 /*TAG:Macro宏ID*/
+#define ID_FUNCTION_GainCallListView    80003
+#define ID_FUNCTION_GainCancelButton    20025
+#define ID_FUNCTION_GainCallButton    20024
+#define ID_FUNCTION_GainCallTextView    50016
+#define ID_FUNCTION_GainCallPainter    52010
+#define ID_FUNCTION_GainCallWindow    110008
 #define ID_FUNCTION_HandleStatusTextView    50015
 #define ID_FUNCTION_HandleStatusTextView    50015
 #define ID_FUNCTION_HandleBackButton    20023
 #define ID_FUNCTION_HandleBackButton    20023
 #define ID_FUNCTION_HandleConfirmButton    20015
 #define ID_FUNCTION_HandleConfirmButton    20015

+ 2 - 1
jni/core/utilities.cpp

@@ -86,7 +86,8 @@ voip::Telephone* GetTelephone() {
 //  LOGD("password: %s", conf.password.c_str());
 //  LOGD("password: %s", conf.password.c_str());
 //  LOGD("user_agent: %s", conf.user_agent.c_str());
 //  LOGD("user_agent: %s", conf.user_agent.c_str());
 #endif
 #endif
-  bool enable_video = StoragePreferences::getBool(SIP_ENABLE_VIDEO, true);
+//  bool enable_video = StoragePreferences::getBool(SIP_ENABLE_VIDEO, true);
+  bool enable_video = StoragePreferences::getBool(SIP_ENABLE_VIDEO, false);
   conf.auto_transmit_video_to_remote = enable_video;
   conf.auto_transmit_video_to_remote = enable_video;
   //单实例
   //单实例
   telephone = new voip::Telephone(conf);
   telephone = new voip::Telephone(conf);

+ 114 - 71
jni/logic/callLogic.cc

@@ -15,7 +15,7 @@
 #include "manager/LanguageManager.h"
 #include "manager/LanguageManager.h"
 
 
 
 
-std::string _isOutgoing;
+std::string _callActivityType = "wait";
 std::string _toIdStr;
 std::string _toIdStr;
 
 
 //voip::WAVPlayer wavPlayer;	// 播放音频
 //voip::WAVPlayer wavPlayer;	// 播放音频
@@ -27,6 +27,7 @@ static base::MediaPlayer mediaPlayer;
 static bool _isSleepTimerRegistered = false;
 static bool _isSleepTimerRegistered = false;
 
 
 #define CALLING_TIME 60		// 用于控制呼叫时间,定时器
 #define CALLING_TIME 60		// 用于控制呼叫时间,定时器
+#define GAIN_CALL_TIME 61
 
 
 
 
 
 
@@ -66,6 +67,11 @@ void callActivityFinish(CallFinishType type){
 			mTextViewNamePtr->setTextTr("CallFailed");
 			mTextViewNamePtr->setTextTr("CallFailed");
 			mActivityPtr->registerUserTimer(goBack, 5000);
 			mActivityPtr->registerUserTimer(goBack, 5000);
 			break;
 			break;
+        case END:
+            LOGD("end");
+			mediaPlayer.Stop();
+			EASYUICONTEXT->goBack();
+            break;
 		case NOT_FOUND:
 		case NOT_FOUND:
 		{
 		{
 			mTextViewNamePtr->setTextTr("NotFound");
 			mTextViewNamePtr->setTextTr("NotFound");
@@ -100,49 +106,58 @@ void callActivityFinish(CallFinishType type){
 		case ACCEPT:
 		case ACCEPT:
 			mActivityPtr->unregisterUserTimer(CALLING_TIME);
 			mActivityPtr->unregisterUserTimer(CALLING_TIME);
 			break;
 			break;
+        case GAIN_OK:
+            mActivityPtr->unregisterUserTimer(GAIN_CALL_TIME);
+            break;
+        case GAIN_FAIL:
+            mediaPlayer.Stop();
+            mTextViewNamePtr->setTextTr("CallAndwered");
+            mActivityPtr->registerUserTimer(goBack, 5000);
+            break;
 		case A1CLICK:
 		case A1CLICK:
 			LOGD("a1 click");
 			LOGD("a1 click");
 
 
 			if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
 			if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
 				TcpModel storeModel = CallingStatus::instance()->getTcpModel();
 				TcpModel storeModel = CallingStatus::instance()->getTcpModel();
-				//只回传iId
-				storeModel.data = storeModel.json["id"].asString();
-
-				voip::CallInfo info = GetTelephone()->GetCallInfo();
-				LOGD("info state = %d",info.state);
-				if (info.state == voip::STATE_CALL_CALLING
-						|| info.state == voip::STATE_CALL_CALLING
-						|| info.state == voip::STATE_CALL_CONFIRMED){
-					sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
-					GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
-					GetTelephone()->Hangup();
-
-					setSleepTimerRegistered(_isSleepTimerRegistered);
-					EASYUICONTEXT->goBack();
-				}
-				else if (_isOutgoing == "false"){	//state = 5
-					mButtonAnswerPtr->setVisible(false);
-					TcpModel model = CallingStatus::instance()->getTcpModel();
-					model.data = model.json["id"].asString();
-					sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
-
-					mActivityPtr->unregisterUserTimer(CALLING_TIME);
-
-				}
-				else if (_isOutgoing == "true") {
-					sendVoiceTcp(VoiceAction::CANCEL, storeModel, storeModel.from_id);
-
-					setSleepTimerRegistered(_isSleepTimerRegistered);
-					EASYUICONTEXT->goBack();
-				}
-				else if (_isOutgoing == "handleHCall") {
-					sendVoiceCancel(storeModel.to_id, 0);
-
-					setSleepTimerRegistered(_isSleepTimerRegistered);
-					EASYUICONTEXT->goBack();
-				}
-			}
-
+                if (!storeModel.json.isNull() && storeModel.json > 0 && storeModel.json.isMember("id")) {
+                    //只回传iId
+                    storeModel.data = storeModel.json["id"].asString();
+
+                    voip::CallInfo info = GetTelephone()->GetCallInfo();
+                    LOGD("info state = %d",info.state);
+                    if (info.state == voip::STATE_CALL_CALLING
+                            || info.state == voip::STATE_CALL_CALLING
+                            || info.state == voip::STATE_CALL_CONFIRMED){
+                        sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
+                        GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
+                        GetTelephone()->Hangup();
+
+                        setSleepTimerRegistered(_isSleepTimerRegistered);
+                        EASYUICONTEXT->goBack();
+                    }
+                    else if (_callActivityType == "toCall"){    //state = 5
+                        mediaPlayer.Stop();
+                        mButtonAnswerPtr->setVisible(false);
+                        TcpModel model = CallingStatus::instance()->getTcpModel();
+                        model.data = model.json["id"].asString();
+                        sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
+
+                        mActivityPtr->unregisterUserTimer(CALLING_TIME);
+                    }
+                    else if (_callActivityType == "fromCall") {
+                        sendVoiceCancel(storeModel.from_id);
+                    }
+                    else if (_callActivityType == "handleHCall") {
+    					sendVoiceCancel(storeModel.to_id, 0);
+
+    					setSleepTimerRegistered(_isSleepTimerRegistered);
+    					EASYUICONTEXT->goBack();
+                    }
+                }
+                else {
+                    sendVoiceCancel(0);
+                }
+            }
 			break;
 			break;
 		case KEY6_CLICK:
 		case KEY6_CLICK:
 			LOGD("KEY6 click");
 			LOGD("KEY6 click");
@@ -166,7 +181,7 @@ void callActivityFinish(CallFinishType type){
 
 
 					lightControl("DOORLED", "000F");
 					lightControl("DOORLED", "000F");
 				}
 				}
-				else if (_isOutgoing == "false"){	//state = 5
+                else if (_callActivityType == "toCall"){    //state = 5
 					mButtonAnswerPtr->setVisible(false);
 					mButtonAnswerPtr->setVisible(false);
 					TcpModel model = CallingStatus::instance()->getTcpModel();
 					TcpModel model = CallingStatus::instance()->getTcpModel();
 					model.data = model.json["id"].asString();
 					model.data = model.json["id"].asString();
@@ -299,42 +314,36 @@ static void onUI_intent(const Intent *intentPtr) {
 		_isSleepTimerRegistered = getSleepTimerRegistered();
 		_isSleepTimerRegistered = getSleepTimerRegistered();
 		setSleepTimerRegistered(false);
 		setSleepTimerRegistered(false);
 
 
-//		wavPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"));
-//		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"));
 		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"), "", 1000,
 		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"), "", 1000,
 		        base::MediaPlayer::PlayMode::Loop);
 		        base::MediaPlayer::PlayMode::Loop);
-		// 键值解析
-		_isOutgoing = intentPtr->getExtra(isOutgoing);
 
 
 		if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
 		if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
 			return;
 			return;
 		}
 		}
 
 
-		if (_isOutgoing == "true"){
+        _callActivityType = intentPtr->getExtra(callActivityType);
+
+        if (_callActivityType == "fromCall") {
 			int toId = 0;
 			int toId = 0;
 			_toIdStr = intentPtr->getExtra(toIdStr);
 			_toIdStr = intentPtr->getExtra(toIdStr);
 			if (_toIdStr != "") {
 			if (_toIdStr != "") {
 				toId = atoi(_toIdStr.c_str());
 				toId = atoi(_toIdStr.c_str());
 			}
 			}
+//			else {
+//				std::string _callRoleType = intentPtr->getExtra(callRoleType);
+//				if (_callRoleType == "") {
+//					_callRoleType = "NURSE";
+//				}
+//
+//				Json::Value json;
+//				json["roleType"] = _callRoleType;
+//				tid = sendVoiceCall(json);
+//			}
 
 
 			// 呼叫的时候需要把tid放进去
 			// 呼叫的时候需要把tid放进去
 			tid = sendVoiceCall(toId);
 			tid = sendVoiceCall(toId);
-			mButtonAnswerPtr->setVisible(false);
-
-			std::string _callName = intentPtr->getExtra(callName);
-			if (_callName != "") {
-				mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
-			} else {
-				mTextViewNamePtr->setTextTr("CallOutTitle");
-			}
+			setCallTid(tid);
 
 
-			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
-		}
-		else if (_isOutgoing == "handleHCall") {
-			string handleCallIdStr = intentPtr->getExtra(handleCallId);
-			int _handleCallId = std::stoi(handleCallIdStr);
-			// 呼叫的时候需要把tid放进去
-			tid = sendVoiceHCall(_handleCallId);
 			mButtonAnswerPtr->setVisible(false);
 			mButtonAnswerPtr->setVisible(false);
 
 
 			std::string _callName = intentPtr->getExtra(callName);
 			std::string _callName = intentPtr->getExtra(callName);
@@ -346,7 +355,7 @@ static void onUI_intent(const Intent *intentPtr) {
 
 
 			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
 			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
 		}
 		}
-		else {
+        else if (_callActivityType == "toCall") {
 			TcpModel storeModel = CallingStatus::instance()->getTcpModel();
 			TcpModel storeModel = CallingStatus::instance()->getTcpModel();
             TcpModel backTcp = storeModel;
             TcpModel backTcp = storeModel;
             backTcp.data = storeModel.json["id"].asString();
             backTcp.data = storeModel.json["id"].asString();
@@ -366,8 +375,37 @@ static void onUI_intent(const Intent *intentPtr) {
 					sendVoiceTcp(VoiceAction::ACCEPT, storeModel, storeModel.from_id);
 					sendVoiceTcp(VoiceAction::ACCEPT, storeModel, storeModel.from_id);
 				}
 				}
 			}
 			}
-		}
+        }
+		else if (_callActivityType == "handleHCall") {
+			string handleCallIdStr = intentPtr->getExtra(handleCallId);
+			int _handleCallId = std::stoi(handleCallIdStr);
+			// 呼叫的时候需要把tid放进去
+			tid = sendVoiceHCall(_handleCallId);
+			setCallTid(tid);
+
+			mButtonAnswerPtr->setVisible(false);
+
+			std::string _callName = intentPtr->getExtra(callName);
+			if (_callName != "") {
+				mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
+			} else {
+				mTextViewNamePtr->setTextTr("CallOutTitle");
+			}
 
 
+			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
+		}
+        else if (_callActivityType == "gainCall") {
+            mButtonAnswerPtr->setVisible(false);
+
+            std::string _callName = intentPtr->getExtra(callName);
+            if (_callName != "") {
+                mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
+            } else {
+                mTextViewNamePtr->setTextTr("CallOutTitle");
+            }
+
+            mActivityPtr->registerUserTimer(GAIN_CALL_TIME, 60000);
+        }
 	}
 	}
 }
 }
 
 
@@ -389,13 +427,13 @@ static void onUI_hide() {
  * 当界面完全退出时触发
  * 当界面完全退出时触发
  */
  */
 static void onUI_quit() {
 static void onUI_quit() {
-	if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
-		EASYUICONTEXT->showNaviBar();
-		EASYUICONTEXT->showStatusBar();
+	EASYUICONTEXT->showNaviBar();
+	EASYUICONTEXT->showStatusBar();
 
 
-		CallingStatus::instance()->setBusy(false);
-		CallingStatus::instance()->clearTcpModel();
+	CallingStatus::instance()->setBusy(false);
+	CallingStatus::instance()->clearTcpModel();
 
 
+	if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
 		voip::CallInfo info = GetTelephone()->GetCallInfo();
 		voip::CallInfo info = GetTelephone()->GetCallInfo();
 		if (info.state == voip::STATE_CALL_CALLING
 		if (info.state == voip::STATE_CALL_CALLING
 				|| info.state == voip::STATE_CALL_CALLING
 				|| info.state == voip::STATE_CALL_CALLING
@@ -405,7 +443,7 @@ static void onUI_quit() {
 		}
 		}
 	}
 	}
 
 
-
+    _callActivityType = "wait";
     mediaPlayer.Stop();
     mediaPlayer.Stop();
 	mActivityPtr->unregisterUserTimer(goBack);
 	mActivityPtr->unregisterUserTimer(goBack);
 }
 }
@@ -482,6 +520,11 @@ static bool onUI_Timer(int id){
 
 
 		break;
 		break;
 	}
 	}
+    case GAIN_CALL_TIME: {
+        setSleepTimerRegistered(_isSleepTimerRegistered);
+        EASYUICONTEXT->goBack();
+    }
+    	break;
 	default:
 	default:
 		break;
 		break;
 	}
 	}
@@ -540,14 +583,14 @@ static bool onButtonClick_ButtonHangup(ZKButton *pButton) {
 				sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
 				sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
 				GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
 				GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
 				GetTelephone()->Hangup();
 				GetTelephone()->Hangup();
-			}
-			else if (_isOutgoing == "true") {
+        	}
+			else if (_callActivityType == "fromCall" || _callActivityType == "gainCall") {
 				string storeModelStr = getTcpModelString(storeModel);
 				string storeModelStr = getTcpModelString(storeModel);
 				sendVoiceTcp(VoiceAction::CANCEL, storeModel, storeModel.from_id);
 				sendVoiceTcp(VoiceAction::CANCEL, storeModel, storeModel.from_id);
 
 
 				lightControl("DOORLED", "000F");
 				lightControl("DOORLED", "000F");
 			}
 			}
-			else if (_isOutgoing == "handleHCall") {
+			else if (_callActivityType == "handleHCall") {
 				LOGD("storeModel.from_id ============> %d", storeModel.from_id);
 				LOGD("storeModel.from_id ============> %d", storeModel.from_id);
 				sendVoiceCancel(storeModel.to_id, 0);
 				sendVoiceCancel(storeModel.to_id, 0);
 
 

+ 115 - 5
jni/logic/functionLogic.cc

@@ -53,6 +53,9 @@ static string _functionTransmitDeviceId;
 
 
 static base::MediaPlayer mediaPlayer;
 static base::MediaPlayer mediaPlayer;
 
 
+int gainCallId = 0;
+static Json::Value gainCallDataList;
+
 #define FUNCTION_TIMER_HANDLE 3	// 功能模块的定时器id
 #define FUNCTION_TIMER_HANDLE 3	// 功能模块的定时器id
 
 
 static int chooseNursingTime = 0;
 static int chooseNursingTime = 0;
@@ -90,8 +93,7 @@ void setFunctionTheme() {
         mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
         mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
         mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
         mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
         mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
         mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
-
-
+        mGainCallButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule.png");
 
 
         functionColor = buleDeepColour;
         functionColor = buleDeepColour;
     }
     }
@@ -110,11 +112,10 @@ void setFunctionTheme() {
         mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
         mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
         mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
         mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
         mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
         mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
-//
+        mGainCallButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink.png");
 
 
         functionColor = redDeepColour;
         functionColor = redDeepColour;
     }
     }
-
 }
 }
 
 
 
 
@@ -491,6 +492,39 @@ void setLanguage(string functionText) {
 	mFunctionWindowPtr->showWnd();
 	mFunctionWindowPtr->showWnd();
 }
 }
 
 
+void addGainCallData(Json::Value data) {
+    gainCallDataList.append(data);
+    if (mActivityPtr != NULL) {
+        mGainCallListViewPtr->refreshListView();
+    }
+}
+
+
+void deleteGainCallData(string id) {
+    if (gainCallDataList.size() == 0) {
+        return;
+    }
+
+    for (int i = 0; i < gainCallDataList.size(); ++i) {
+        string _id = gainCallDataList[i]["id"].asString();
+        if (_id == id) {
+            Json::Value deleteGainCall;
+            gainCallDataList.removeIndex(i, &deleteGainCall);
+            break;
+        }
+    }
+
+    if (gainCallDataList.size() > 0) {
+        if (gainCallId >= gainCallDataList.size()) {
+            gainCallId = 0;
+        }
+        mGainCallListViewPtr->refreshListView();
+    }
+    else {
+        gainCallId = 0;
+        EASYUICONTEXT->closeActivity("functionActivity");
+    }
+}
 
 
 
 
 /**
 /**
@@ -650,6 +684,13 @@ static void onUI_intent(const Intent *intentPtr) {
 		else if (_functionWindows == "nursingEnd3") {
 		else if (_functionWindows == "nursingEnd3") {
 			nursingEnd3();
 			nursingEnd3();
 		}
 		}
+        else if (_functionWindows == "gainCall") {
+            mGainCallWindowPtr->showWnd();
+        }
+        else {
+            _warnText = "Not Activity";
+            warn(_warnText);
+        }
     }
     }
 }
 }
 
 
@@ -817,7 +858,7 @@ static bool onButtonClick_ConfirmCallButton(ZKButton *pButton) {
 		}
 		}
 		else {
 		else {
 			Intent* intent = new Intent();
 			Intent* intent = new Intent();
-			intent->putExtra(isOutgoing, "true");
+            intent->putExtra(callActivityType, "fromCall");
 			intent->putExtra(toIdStr, toId);
 			intent->putExtra(toIdStr, toId);
 			intent->putExtra(callName, chooseBed["frame_bed"]["full_name"].asString()  + " " +  chooseBed["customer_name"].asString());
 			intent->putExtra(callName, chooseBed["frame_bed"]["full_name"].asString()  + " " +  chooseBed["customer_name"].asString());
 			EASYUICONTEXT->openActivity("callActivity", intent);
 			EASYUICONTEXT->openActivity("callActivity", intent);
@@ -1440,3 +1481,72 @@ static bool onButtonClick_HandleBackButton(ZKButton *pButton) {
     return false;
     return false;
 }
 }
 
 
+static int getListItemCount_GainCallListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_GainCallListView !\n");
+    return gainCallDataList.size();
+}
+
+static void obtainListItemData_GainCallListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ GainCallListView  !!!\n");
+    if (functionThemeInt == 1) {
+        pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_SELECTED, "/function/chooseBed_400x52.png");
+    }
+    else if (functionThemeInt == 2) {
+        pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_SELECTED, "/function/chooseBed-pink_400x52.png");
+    }
+    pListItem->setTextStatusColor(ZK_CONTROL_STATUS_SELECTED, functionColor);
+
+    if (gainCallDataList.size() > 0) {
+        pListItem->setText(gainCallDataList[index]["fromFrameFullName"].asString() + " " + gainCallDataList[index]["fromMemberName"].asString() + " " +  LANGUAGEMANAGER->getValue("InitiateCall"));
+    }
+
+    if (index == gainCallId) {
+        pListItem->setSelected(true);
+        gainCallId = index;
+    }
+    else {
+        pListItem->setSelected(false);
+    }
+}
+
+static void onListItemClick_GainCallListView(ZKListView *pListView, int index, int id) {
+    //LOGD(" onListItemClick_ GainCallListView  !!!\n");
+    gainCallId = index;
+}
+
+static bool onButtonClick_GainCallButton(ZKButton *pButton) {
+    LOGD(" ButtonClick GainCallButton !!!\n");
+    if (gainCallId < gainCallDataList.size()) {
+        Json::Value it;
+        it = gainCallDataList[gainCallId];
+        sendVoiceGainCall(it["tid"].asString(), it);
+
+        gainCallDataList.clear();
+        gainCallId = 0;
+
+        Intent* intent = new Intent();
+        intent->putExtra(callActivityType, "gainCall");
+        intent->putExtra(callName, it["fromFrameFullName"].asString()  + " " +  it["fromMemberName"].asString());
+        EASYUICONTEXT->openActivity("callActivity", intent);
+        EASYUICONTEXT->closeActivity("functionActivity");
+    }
+    else {
+        gainCallDataList.clear();
+        mGainCallWindowPtr->hideWnd();
+
+        warn(LANGUAGEMANAGER->getValue("CallAndwered"));
+    }
+
+    return false;
+}
+
+static bool onButtonClick_GainCancelButton(ZKButton *pButton) {
+    LOGD(" ButtonClick GainCancelButton !!!\n");
+    LOGD(" ButtonClick GainCancelButton !!!\n");
+    gainCallDataList.clear();
+    gainCallId = 0;
+
+    mGainCallWindowPtr->hideWnd();
+    EASYUICONTEXT->closeActivity("functionActivity");
+    return false;
+}

+ 2 - 1
jni/logic/navibar.cc

@@ -417,7 +417,8 @@ static bool onButtonClick_CallNurseButton(ZKButton *pButton) {
 		GetTelephone()->MakeCall(od_number_uri);
 		GetTelephone()->MakeCall(od_number_uri);
 	} else {
 	} else {
 		Intent* intent = new Intent();
 		Intent* intent = new Intent();
-		intent->putExtra(isOutgoing, "true");
+        intent->putExtra(callActivityType, "fromCall");
+//        intent->putExtra(callRoleType, "NURSE");
 		EASYUICONTEXT->openActivity("callActivity", intent);
 		EASYUICONTEXT->openActivity("callActivity", intent);
 	}
 	}
     return false;
     return false;

+ 65 - 10
jni/logic/startLogic.cc

@@ -196,13 +196,22 @@ namespace {
 			pjsua_call_get_info(call_id, &ci);
 			pjsua_call_get_info(call_id, &ci);
 			LOGD("通话结束的状态码 ===> %d", ci.last_status);
 			LOGD("通话结束的状态码 ===> %d", ci.last_status);
 			if (ci.last_status == voip::SIP_NOT_FOUND) {
 			if (ci.last_status == voip::SIP_NOT_FOUND) {
-				callActivityFinish(CallFinishType::NOT_FOUND);
+                if (CallingStatus::instance()->busy()){
+                	callActivityFinish(CallFinishType::NOT_FOUND);
+                }
 				mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 				mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 			}
 			}
 			else if (ci.last_status == voip::SIP_REQUEST_TIMES) {
 			else if (ci.last_status == voip::SIP_REQUEST_TIMES) {
-				callActivityFinish(CallFinishType::REQUEST_TIMES);
+                if (CallingStatus::instance()->busy()){
+                	callActivityFinish(CallFinishType::REQUEST_TIMES);
+                }
 				mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 				mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 			}
 			}
+            else {
+                if (CallingStatus::instance()->busy()){
+                    callActivityFinish(CallFinishType::END);
+                }
+            }
 
 
 //			//保存通话记录
 //			//保存通话记录
 //			voip::CallInfo info = telephone->GetCallInfo(call_id);
 //			voip::CallInfo info = telephone->GetCallInfo(call_id);
@@ -440,10 +449,8 @@ void handleMsg(byte* inBytes){
 		}
 		}
 	} else if (tcpModel.type == TcpType::VOICE){
 	} else if (tcpModel.type == TcpType::VOICE){
 		if (tcpModel.action == VoiceAction::FAILED){
 		if (tcpModel.action == VoiceAction::FAILED){
-
-			const char* currentAppName = EASYUICONTEXT->currentAppName();
-			string _currentAppName = currentAppName;
-			if (_currentAppName == "callActivity") {
+			sleep(1);
+			if (CallingStatus::instance()->busy()){
 				callActivityFinish(CallFinishType::FAILED);
 				callActivityFinish(CallFinishType::FAILED);
 			}
 			}
 
 
@@ -489,7 +496,7 @@ void handleMsg(byte* inBytes){
 
 
 				//来电话了
 				//来电话了
 				Intent* intent = new Intent();
 				Intent* intent = new Intent();
-				intent->putExtra(isOutgoing, "false");
+				intent->putExtra(callActivityType, "toCall");
 				EASYUICONTEXT->openActivity("callActivity", intent);
 				EASYUICONTEXT->openActivity("callActivity", intent);
 			}
 			}
 		} else if (tcpModel.action == VoiceAction::HANDOFF){
 		} else if (tcpModel.action == VoiceAction::HANDOFF){
@@ -505,6 +512,16 @@ void handleMsg(byte* inBytes){
 		else if (tcpModel.action == VoiceAction::SIP_RECONNECT) {
 		else if (tcpModel.action == VoiceAction::SIP_RECONNECT) {
 			mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 			mActivityPtr->registerUserTimer(SIP_RECONNECT_TIME_HANDLE, 1 * 1000);
 		}
 		}
+        else if (tcpModel.action == VoiceAction::GAIN_OK) {
+            CallingStatus::instance()->setTcpModel(tcpModel);
+            sleep(1);
+            callActivityFinish(CallFinishType::GAIN_OK);
+        }
+        else if (tcpModel.action == VoiceAction::GAIN_FAIL) {
+            if (CallingStatus::instance()->busy()){
+                callActivityFinish(CallFinishType::GAIN_FAIL);
+            }
+        }
 	}
 	}
 	else if (tcpModel.type == TcpType::SOS) {
 	else if (tcpModel.type == TcpType::SOS) {
 		if (tcpModel.action == SosAction::CANCEL) {
 		if (tcpModel.action == SosAction::CANCEL) {
@@ -596,6 +613,41 @@ void handleMsg(byte* inBytes){
 
 
 			statusLight();
 			statusLight();
 		}
 		}
+        else if (tcpModel.action == SideAction::SHOW) {
+            const char* currentAppName = EASYUICONTEXT->currentAppName();
+            string _currentAppName = currentAppName;
+            if (_currentAppName == "callActivity") {
+                return;
+            }
+
+            Json::Value _it = tcpModel.json;
+            if (_it["actionType"].asString() != "VOICE") {
+                return;
+            }
+
+            if (_currentAppName != "functionActivity") {
+                Intent* intent = new Intent();
+                intent->putExtra(functionWindows, "gainCall");
+                EASYUICONTEXT->openActivity("functionActivity", intent);
+            }
+
+            size_t pos = tcpModel.tid.find("_");
+            if (pos != std::string::npos) {
+                _it["tid"] = tcpModel.tid.substr(0, pos);
+            } else {
+                 _it["tid"] = tcpModel.tid;
+            }
+
+            addGainCallData(_it);
+        }
+        else if (tcpModel.action == SideAction::CLEAR) {
+
+            const char* currentAppName = EASYUICONTEXT->currentAppName();
+            string _currentAppName = currentAppName;
+            if (_currentAppName == "functionActivity") {
+                deleteGainCallData(tcpModel.json["id"].asString());
+            }
+        }
 	}
 	}
 	else if (tcpModel.type == TcpType::CALLBACK) {
 	else if (tcpModel.type == TcpType::CALLBACK) {
 		if (tcpModel.action == CallbackAction::ACK) {
 		if (tcpModel.action == CallbackAction::ACK) {
@@ -615,6 +667,7 @@ void handleMsg(byte* inBytes){
 			}
 			}
 		}
 		}
 		else if (tcpModel.action == CallbackAction::FAILED) {
 		else if (tcpModel.action == CallbackAction::FAILED) {
+			sleep(1);
 
 
 			//回调
 			//回调
 			TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
 			TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
@@ -725,7 +778,7 @@ void handleHCall(int id) {
 
 
 		string handleIdStr = to_string(handleId);
 		string handleIdStr = to_string(handleId);
 		Intent* intent = new Intent();
 		Intent* intent = new Intent();
-		intent->putExtra(isOutgoing, "handleHCall");
+        intent->putExtra(callActivityType, "handleHCall");
 		intent->putExtra(handleCallId, handleIdStr);
 		intent->putExtra(handleCallId, handleIdStr);
 		EASYUICONTEXT->openActivity("callActivity", intent);
 		EASYUICONTEXT->openActivity("callActivity", intent);
 	}
 	}
@@ -811,7 +864,8 @@ void handleCall(string key, string roleType) {
 		} else {
 		} else {
 
 
 			Intent* intent = new Intent();
 			Intent* intent = new Intent();
-			intent->putExtra(isOutgoing, "true");
+            intent->putExtra(callActivityType, "fromCall");
+//            intent->putExtra(callRoleType, roleType);
 			EASYUICONTEXT->openActivity("callActivity", intent);
 			EASYUICONTEXT->openActivity("callActivity", intent);
 		}
 		}
 	}
 	}
@@ -984,7 +1038,8 @@ public:
 				callActivityFinish(CallFinishType::A1CLICK);
 				callActivityFinish(CallFinishType::A1CLICK);
 			} else {
 			} else {
 				Intent* intent = new Intent();
 				Intent* intent = new Intent();
-				intent->putExtra(isOutgoing, "true");
+                intent->putExtra(callActivityType, "fromCall");
+//                intent->putExtra(callRoleType, "NURSE");
 				EASYUICONTEXT->openActivity("callActivity", intent);
 				EASYUICONTEXT->openActivity("callActivity", intent);
 			}
 			}
 		}
 		}

+ 5 - 0
jni/net/tcp_model.h

@@ -51,6 +51,9 @@ public:
 	inline static std::string FAILED = "FAILED";
 	inline static std::string FAILED = "FAILED";
 	inline static std::string CANCEL_BY_DOOR = "CANCEL_BY_DOOR";
 	inline static std::string CANCEL_BY_DOOR = "CANCEL_BY_DOOR";
 	inline static std::string SIP_RECONNECT = "SIP_RECONNECT";
 	inline static std::string SIP_RECONNECT = "SIP_RECONNECT";
+	inline static std::string GAIN_OK = "GAIN_OK";
+	inline static std::string GAIN_CALL = "GAIN_CALL";
+	inline static std::string GAIN_FAIL = "GAIN_FAIL";
 };
 };
 
 
 class SosAction {
 class SosAction {
@@ -110,6 +113,8 @@ public:
 	inline static std::string SOS_CANCEL = "SOS_CANCEL";	// sos取消
 	inline static std::string SOS_CANCEL = "SOS_CANCEL";	// sos取消
 	inline static std::string NURSING = "NURSING";	// 护理
 	inline static std::string NURSING = "NURSING";	// 护理
 	inline static std::string NURSING_END = "NURSING_END";	// 护理结束
 	inline static std::string NURSING_END = "NURSING_END";	// 护理结束
+	inline static std::string SHOW = "SHOW";	// 护理结束
+	inline static std::string CLEAR = "CLEAR";	// 护理结束
 };
 };
 
 
 class BlueCodeAction {
 class BlueCodeAction {

+ 36 - 11
jni/net/tcp_util.cpp

@@ -139,17 +139,6 @@ void sendReinforceCall() {
 	sendTcpModel(tcpModel);
 	sendTcpModel(tcpModel);
 }
 }
 
 
-void sendCallByDoor() {
-    // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
-	TcpModel tcpModel;
-	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
-	tcpModel.type = TcpType::VOICE;
-	tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
-	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-    tcpModel.to_id = 0;
-	sendTcpModel(tcpModel);
-}
-
 
 
 void sendBlueCodeCall() {
 void sendBlueCodeCall() {
 	TcpModel tcpModel;
 	TcpModel tcpModel;
@@ -173,6 +162,17 @@ void sendBlueCodeResponse(std::string tid, std::string blueCodeId) {
 	sendTcpModel(tcpModel);
 	sendTcpModel(tcpModel);
 }
 }
 
 
+void sendCallByDoor() {
+    // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::VOICE;
+	tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+    tcpModel.to_id = 0;
+	sendTcpModel(tcpModel);
+}
+
 
 
 std::string sendVoiceCall(int toId) {
 std::string sendVoiceCall(int toId) {
 	TcpModel tcpModel;
 	TcpModel tcpModel;
@@ -186,6 +186,19 @@ std::string sendVoiceCall(int toId) {
 	return tcpModel.tid;
 	return tcpModel.tid;
 }
 }
 
 
+std::string sendVoiceCall(Json::Value data) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::VOICE;
+	tcpModel.action = VoiceAction::CALL;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.json = data;
+	tcpModel.to_id = 0;
+
+	sendTcpModel(tcpModel);
+	return tcpModel.tid;
+}
+
 
 
 void sendVoiceTcp(std::string action, TcpModel model, int toId){
 void sendVoiceTcp(std::string action, TcpModel model, int toId){
 	//发出TCP
 	//发出TCP
@@ -240,6 +253,18 @@ std::string sendVoiceHCall(int id) {
 	return tcpModel.tid;
 	return tcpModel.tid;
 }
 }
 
 
+void sendVoiceGainCall(std::string tid, Json::Value it) {
+    TcpModel tcpModel;
+    tcpModel.tid = tid;
+    tcpModel.type = TcpType::VOICE;
+    tcpModel.action = VoiceAction::GAIN_CALL;
+    tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+    tcpModel.json = it;
+    tcpModel.to_id = it["fromDeviceId"].asInt();
+    sendTcpModel(tcpModel);
+}
+
+
 
 
 void sendSosCall(std::string sosMsg) {
 void sendSosCall(std::string sosMsg) {
 	TcpModel tcpModel;
 	TcpModel tcpModel;

+ 8 - 1
jni/net/tcp_util.h

@@ -13,17 +13,24 @@ void sendAuthLogout(std::string authItId);
 void sendSignIn(std::string clerkNfc);
 void sendSignIn(std::string clerkNfc);
 void sendPostionStart(std::string clerkNfc);
 void sendPostionStart(std::string clerkNfc);
 void sendRoomCheckStart(std::string clerkNfc);
 void sendRoomCheckStart(std::string clerkNfc);
+
 void sendNursing();
 void sendNursing();
 void sendNursingEnd();
 void sendNursingEnd();
+
 void sendReinforceCall();
 void sendReinforceCall();
-void sendCallByDoor();
+
 void sendBlueCodeCall();
 void sendBlueCodeCall();
 void sendBlueCodeResponse(std::string tid, std::string blueCodeId);
 void sendBlueCodeResponse(std::string tid, std::string blueCodeId);
+
+void sendCallByDoor();
 std::string sendVoiceCall(int toId);
 std::string sendVoiceCall(int toId);
+std::string sendVoiceCall(Json::Value data);
 void sendVoiceTcp(std::string action, TcpModel model, int toId);
 void sendVoiceTcp(std::string action, TcpModel model, int toId);
 void sendVoiceCancel(int fromId, int toId);
 void sendVoiceCancel(int fromId, int toId);
 void sendVoiceCancel(int toId);
 void sendVoiceCancel(int toId);
 std::string sendVoiceHCall(int id);
 std::string sendVoiceHCall(int id);
+void sendVoiceGainCall(std::string tid, Json::Value it);
+
 void sendSosCall(std::string sosMsg);
 void sendSosCall(std::string sosMsg);
 void sendSosCancel(std::string sosId);
 void sendSosCancel(std::string sosId);
 void sendDataRemindOhter(std::string msg);
 void sendDataRemindOhter(std::string msg);

+ 11 - 4
jni/service/BusinessConfig.h

@@ -73,6 +73,7 @@
 #define STORE_LANG "language"
 #define STORE_LANG "language"
 //static std::string defaultLang = "zh_CN";
 //static std::string defaultLang = "zh_CN";
 static std::string defaultLang = "en_US";
 static std::string defaultLang = "en_US";
+//static std::string defaultLang = "es_ES";
 
 
 static uint32_t redLightColour = 0xFFFEB8BF;
 static uint32_t redLightColour = 0xFFFEB8BF;
 static uint32_t redDeepColour = 0xFFF78B8F;
 static uint32_t redDeepColour = 0xFFF78B8F;
@@ -89,8 +90,8 @@ static uint32_t defaultGreen = 0xFF2EA22A;
 static uint32_t defaultBlue = 0xFF68A5FF;
 static uint32_t defaultBlue = 0xFF68A5FF;
 static uint32_t defaultYellow = 0xFFE68024;
 static uint32_t defaultYellow = 0xFFE68024;
 
 
-static std::string versionCode = "v2.0.12";
-static int versionNo = 59;
+static std::string versionCode = "v2.0.13";
+static int versionNo = 60;
 static std::string serverIP = "172.28.100.100";
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
 static int serverHttpPort = 8006;
@@ -238,6 +239,9 @@ void cleanSosDataList();
 void clearDeviceButtonFunction();
 void clearDeviceButtonFunction();
 void setDeviceButtonFunction(std::string deviceButtonFunctionStr);
 void setDeviceButtonFunction(std::string deviceButtonFunctionStr);
 
 
+void addGainCallData(Json::Value data);
+void deleteGainCallData(std::string id);
+
 enum CallFinishType {
 enum CallFinishType {
 	CANCEL,
 	CANCEL,
 	REJECT,
 	REJECT,
@@ -246,10 +250,13 @@ enum CallFinishType {
 	HANDOFF,
 	HANDOFF,
 	FAILED,
 	FAILED,
 	ACCEPT,
 	ACCEPT,
+	GAIN_OK,
+	GAIN_FAIL,
 	A1CLICK,
 	A1CLICK,
 	KEY6_CLICK,
 	KEY6_CLICK,
 	NOT_FOUND,
 	NOT_FOUND,
 	REQUEST_TIMES,
 	REQUEST_TIMES,
+	END,
 };
 };
 void callActivityFinish(CallFinishType type);
 void callActivityFinish(CallFinishType type);
 void buildSIP(std::string toSipId);
 void buildSIP(std::string toSipId);
@@ -362,8 +369,8 @@ static bool checkIsDay(){
 	//LOGD("tiDayStart %ld . tNightStart %ld . currentTime %ld", tDayStart, tNightStart, currentTime);
 	//LOGD("tiDayStart %ld . tNightStart %ld . currentTime %ld", tDayStart, tNightStart, currentTime);
 }
 }
 
 
-static std::string isOutgoing = "isOutgoing";
-static std::string audioOnly = "audioOnly";
+static std::string callActivityType = "callActivityType";
+static std::string callRoleType = "callRoleType";
 static std::string handleCallId = "handleCallId";
 static std::string handleCallId = "handleCallId";
 static std::string toIdStr = "toIdStr";
 static std::string toIdStr = "toIdStr";
 static std::string callName = "callName";
 static std::string callName = "callName";

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/customerAffairActivity.o


BIN
obj/activity/deviceAddActivity.o


BIN
obj/activity/deviceInfoActivity.o


BIN
obj/activity/functionActivity.o


BIN
obj/activity/interactionActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/medicalCareActivity.o


BIN
obj/activity/moreActivity.o


BIN
obj/activity/navibar.o


BIN
obj/activity/promptActivity.o


BIN
obj/activity/settingActivity.o


BIN
obj/activity/sipTestActivity.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/updateActivity.o


BIN
obj/core/update_assistant.o


BIN
obj/core/utilities.o


BIN
obj/net/tcp_client.o


BIN
obj/net/tcp_model.o


BIN
obj/net/tcp_util.o


BIN
obj/server/http_server.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o


BIN
obj/uart/UartContext.o


BIN
resources/function/chooseBed-pink-400x52.png


BIN
resources/function/chooseBed_400x52.png


BIN
resources/function/noChooseBed-400x52.png


BIN
resources/function/noChooseBed_400x52.png


BIN
ui/function.ftu