Quellcode durchsuchen

增加智慧生活设备控制

vothin vor 8 Monaten
Ursprung
Commit
8034e9e580

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

@@ -5,7 +5,7 @@
 			<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.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-372444128849131468" 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="-1053523870950090559" 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.g++"/>
 			</provider>
@@ -16,7 +16,7 @@
 			<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.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-933989040777" 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="-1423314729276" 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.g++"/>
 			</provider>

+ 40 - 0
jni/activity/mainActivity.cpp

@@ -4,6 +4,16 @@
 #include "mainActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mButton14Ptr;
+static ZKButton* mButton13Ptr;
+static ZKButton* mButton12Ptr;
+static ZKButton* mButton11Ptr;
+static ZKButton* mButton10Ptr;
+static ZKButton* mButton9Ptr;
+static ZKButton* mButton4Ptr;
+static ZKButton* mButton3Ptr;
+static ZKButton* mButton2Ptr;
+static ZKButton* mButton1Ptr;
 static ZKListView* mBedListView4Ptr;
 static ZKTextView* mNurseHeadTextViewPtr;
 static ZKTextView* mNurseTitleTextViewPtr;
@@ -64,6 +74,16 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_MAIN_Button14, onButtonClick_Button14,
+    ID_MAIN_Button13, onButtonClick_Button13,
+    ID_MAIN_Button12, onButtonClick_Button12,
+    ID_MAIN_Button11, onButtonClick_Button11,
+    ID_MAIN_Button10, onButtonClick_Button10,
+    ID_MAIN_Button9, onButtonClick_Button9,
+    ID_MAIN_Button4, onButtonClick_Button4,
+    ID_MAIN_Button3, onButtonClick_Button3,
+    ID_MAIN_Button2, onButtonClick_Button2,
+    ID_MAIN_Button1, onButtonClick_Button1,
 };
 /***************/
 
@@ -139,6 +159,16 @@ mainActivity::~mainActivity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    mButton14Ptr = NULL;
+    mButton13Ptr = NULL;
+    mButton12Ptr = NULL;
+    mButton11Ptr = NULL;
+    mButton10Ptr = NULL;
+    mButton9Ptr = NULL;
+    mButton4Ptr = NULL;
+    mButton3Ptr = NULL;
+    mButton2Ptr = NULL;
+    mButton1Ptr = NULL;
     mBedListView4Ptr = NULL;
     mNurseHeadTextViewPtr = NULL;
     mNurseTitleTextViewPtr = NULL;
@@ -172,6 +202,16 @@ const char* mainActivity::getAppName() const{
 //TAG:onCreate
 void mainActivity::onCreate() {
 	Activity::onCreate();
+    mButton14Ptr = (ZKButton*)findControlByID(ID_MAIN_Button14);
+    mButton13Ptr = (ZKButton*)findControlByID(ID_MAIN_Button13);
+    mButton12Ptr = (ZKButton*)findControlByID(ID_MAIN_Button12);
+    mButton11Ptr = (ZKButton*)findControlByID(ID_MAIN_Button11);
+    mButton10Ptr = (ZKButton*)findControlByID(ID_MAIN_Button10);
+    mButton9Ptr = (ZKButton*)findControlByID(ID_MAIN_Button9);
+    mButton4Ptr = (ZKButton*)findControlByID(ID_MAIN_Button4);
+    mButton3Ptr = (ZKButton*)findControlByID(ID_MAIN_Button3);
+    mButton2Ptr = (ZKButton*)findControlByID(ID_MAIN_Button2);
+    mButton1Ptr = (ZKButton*)findControlByID(ID_MAIN_Button1);
     mBedListView4Ptr = (ZKListView*)findControlByID(ID_MAIN_BedListView4);if(mBedListView4Ptr!= NULL){mBedListView4Ptr->setListAdapter(this);mBedListView4Ptr->setItemClickListener(this);}
     mNurseHeadTextViewPtr = (ZKTextView*)findControlByID(ID_MAIN_NurseHeadTextView);
     mNurseTitleTextViewPtr = (ZKTextView*)findControlByID(ID_MAIN_NurseTitleTextView);

+ 10 - 0
jni/activity/mainActivity.h

@@ -27,6 +27,16 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_MAIN_Button14    20014
+#define ID_MAIN_Button13    20013
+#define ID_MAIN_Button12    20012
+#define ID_MAIN_Button11    20011
+#define ID_MAIN_Button10    20010
+#define ID_MAIN_Button9    20009
+#define ID_MAIN_Button4    20004
+#define ID_MAIN_Button3    20003
+#define ID_MAIN_Button2    20002
+#define ID_MAIN_Button1    20001
 #define ID_MAIN_NurseTitleSubItem4    24034
 #define ID_MAIN_DoctorTitleSubItem4    24033
 #define ID_MAIN_NurseSubItem4    24032

+ 59 - 0
jni/logic/mainLogic.cc

@@ -1061,3 +1061,62 @@ static void obtainListItemData_BedListView4(ZKListView *pListView,ZKListView::ZK
 static void onListItemClick_BedListView4(ZKListView *pListView, int index, int id) {
     //LOGD(" onListItemClick_ BedListView4  !!!\n");
 }
+static bool onButtonClick_Button1(ZKButton *pButton) {
+    LOGD(" ButtonClick Button1 !!!\n");
+    sendCurtainCommon("100", 11947);
+    return false;
+}
+
+static bool onButtonClick_Button2(ZKButton *pButton) {
+    LOGD(" ButtonClick Button2 !!!\n");
+    sendCurtainCommon("0", 11947);
+    return false;
+}
+
+static bool onButtonClick_Button3(ZKButton *pButton) {
+    LOGD(" ButtonClick Button3 !!!\n");
+    sendSwitchCommon("1", 11944);
+    return false;
+}
+
+static bool onButtonClick_Button4(ZKButton *pButton) {
+    LOGD(" ButtonClick Button4 !!!\n");
+    sendSwitchCommon("0", 11944);
+    return false;
+}
+
+
+static bool onButtonClick_Button9(ZKButton *pButton) {
+    LOGD(" ButtonClick Button9 !!!\n");
+    sendSwitchCommon("100", 11946);
+    return false;
+}
+
+static bool onButtonClick_Button10(ZKButton *pButton) {
+    LOGD(" ButtonClick Button10 !!!\n");
+    sendSwitchCommon("000", 11946);
+    return false;
+}
+
+static bool onButtonClick_Button11(ZKButton *pButton) {
+    LOGD(" ButtonClick Button11 !!!\n");
+    sendSwitchCommon("001", 11946);
+    return false;
+}
+
+static bool onButtonClick_Button12(ZKButton *pButton) {
+    LOGD(" ButtonClick Button12 !!!\n");
+    sendSwitchCommon("000", 11946);
+    return false;
+}
+static bool onButtonClick_Button13(ZKButton *pButton) {
+    LOGD(" ButtonClick Button13 !!!\n");
+    sendCurtainQuery(11947);
+    return false;
+}
+
+static bool onButtonClick_Button14(ZKButton *pButton) {
+    LOGD(" ButtonClick Button14 !!!\n");
+    sendSwitchQuery(11946);
+    return false;
+}

+ 38 - 0
jni/logic/startLogic.cc

@@ -509,6 +509,44 @@ void handleMsg(byte* inBytes){
 			}
 		}
 	}
+	else if (tcpModel.type == TcpType::CURTAIN) {
+		if (tcpModel.action == CurtainAction::COMMON) {
+			LOGD("窗帘===>动作");
+
+		}
+		else if (tcpModel.action == CurtainAction::QUERY) {
+			LOGD("窗帘===>查询");
+
+		}
+		else if (tcpModel.action == CurtainAction::SUCCESS) {
+			LOGD("窗帘===>成功");
+
+		}
+		else if (tcpModel.action == CurtainAction::FAILED) {
+			LOGD("窗帘===>失败");
+
+		}
+
+	}
+	else if (tcpModel.type == TcpType::SWITCH) {
+		if (tcpModel.action == SwitchAction::COMMON) {
+			LOGD("开关===>动作");
+
+		}
+		else if (tcpModel.action == SwitchAction::QUERY) {
+			LOGD("开关===>查询");
+
+		}
+		else if (tcpModel.action == SwitchAction::SUCCESS) {
+			LOGD("开关===>成功");
+
+		}
+		else if (tcpModel.action == SwitchAction::FAILED) {
+			LOGD("开关===>失败");
+
+		}
+
+	}
 }
 
 bool getSleepTimerRegistered() {

+ 21 - 1
jni/net/tcp_model.h

@@ -25,13 +25,17 @@ public:
 	inline static std::string SIDE = "SIDE";
 	inline static std::string CALLBACK = "CALLBACK";
 
-    /** 新增床旁交互Tcp类型 **/
+    /** 床旁交互Tcp类型 **/
 	inline static std::string SIGN_IN = "SIGN_IN";
 	inline static std::string POSITION = "POSITION";
 	inline static std::string COUNTDOWN = "COUNTDOWN";
 	inline static std::string ROOMCHECK = "ROOMCHECK";
 	inline static std::string SCREEN_TIP = "SCREEN_TIP";
 	inline static std::string AUTH = "AUTH";
+
+	/** 智能家电交互Tcp类型 **/
+	inline static std::string CURTAIN = "CURTAIN";
+	inline static std::string SWITCH = "SWITCH";
 };
 
 class VoiceAction {
@@ -153,6 +157,22 @@ public:
 	inline static std::string LOGOUT = "LOGOUT";	// 退出登录
 };
 
+class CurtainAction {
+public:
+	inline static std::string QUERY = "QUERY";	// 查询
+	inline static std::string COMMON = "COMMON";	// 动作
+	inline static std::string SUCCESS = "SUCCESS";	// 成功
+	inline static std::string FAILED = "FAILED";	// 失败
+};
+
+class SwitchAction {
+public:
+	inline static std::string QUERY = "QUERY";	// 查询
+	inline static std::string COMMON = "COMMON";	// 动作
+	inline static std::string SUCCESS = "SUCCESS";	// 成功
+	inline static std::string FAILED = "FAILED";	// 失败
+};
+
 class TcpAction{
 	VoiceAction voiceAction;
 };

+ 46 - 0
jni/net/tcp_util.cpp

@@ -229,3 +229,49 @@ void sendSosCancel(std::string sosId) {
 	sendTcpModel(tcpModel);
 }
 
+void sendCurtainQuery(int toId) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::CURTAIN;
+	tcpModel.action = CurtainAction::QUERY;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+	tcpModel.to_id = toId;
+
+	sendTcpModel(tcpModel);
+}
+
+void sendCurtainCommon(std::string data, int toId) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::CURTAIN;
+	tcpModel.action = CurtainAction::COMMON;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+	tcpModel.to_id = toId;
+	tcpModel.data = data;
+
+	sendTcpModel(tcpModel);
+}
+
+void sendSwitchQuery(int toId) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::SWITCH;
+	tcpModel.action = SwitchAction::QUERY;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+	tcpModel.to_id = toId;
+
+	sendTcpModel(tcpModel);
+}
+
+void sendSwitchCommon(std::string data, int toId) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::SWITCH;
+	tcpModel.action = SwitchAction::COMMON;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+	tcpModel.to_id = toId;
+	tcpModel.data = data;
+
+	sendTcpModel(tcpModel);
+}
+

+ 6 - 0
jni/net/tcp_util.h

@@ -32,5 +32,11 @@ void sendVoiceCancel(int fromId, int toId);
 void sendSosCall(std::string sosMsg);
 void sendSosCancel(std::string sosId);
 
+void sendCurtainQuery(int toId);
+void sendCurtainCommon(std::string data, int toId);
+
+void sendSwitchQuery(int toId);
+void sendSwitchCommon(std::string data, int toId);
+
 
 #endif /* JNI_NET_TCP_UTIL_H_ */

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/deviceInfoActivity.o


BIN
obj/activity/functionActivity.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/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/Harmony_240509.ttf


BIN
ui/main.ftu