diff --git a/package/netease/clockFrame/Makefile b/package/netease/clockFrame/Makefile index 08c608c92..c89556eaf 100755 --- a/package/netease/clockFrame/Makefile +++ b/package/netease/clockFrame/Makefile @@ -41,6 +41,7 @@ define Build/Prepare $(CP) -r ./C1-windows/Frames/* $(PKG_BUILD_DIR)/ rm -rf $(PKG_BUILD_DIR)/main.cpp $(CP) -r ./src/* $(PKG_BUILD_DIR)/ + cat src/clockFrame.in >> $(PKG_BUILD_DIR)/$(1).pro $(CP) clockFrame.sh $(PKG_BUILD_DIR)/clockFrame endef diff --git a/package/netease/clockFrame/src/clockFrame.in b/package/netease/clockFrame/src/clockFrame.in new file mode 100755 index 000000000..9396e42f3 --- /dev/null +++ b/package/netease/clockFrame/src/clockFrame.in @@ -0,0 +1,5 @@ +#在src下的文件添加进来,会传入到Qt工程的.pro文件中。main文件已经存在.pro文件中,不需要再传入 + +SOURCES += framelogic.cpp + +HEADERS += framelogic.h \ No newline at end of file diff --git a/package/netease/clockFrame/src/framelogic.cpp b/package/netease/clockFrame/src/framelogic.cpp new file mode 100755 index 000000000..c6364cf02 --- /dev/null +++ b/package/netease/clockFrame/src/framelogic.cpp @@ -0,0 +1,48 @@ +#include +#include "framelogic.h" + +void setMailBox(void) +{ + extern MailBox *mailbox; + if(mailbox != nullptr) + { + delete mailbox; + mailbox = nullptr; + } + mailbox = new DbusMailBox(); +} + +int DbusMailBox::s_wifiConnect(QString ssid, QString passwd) +{ + cJSON* pRoot = NULL; + char* msg = NULL; + int ret = FRAMER_OK; + + CHECKR_QSTRING_NULL(ssid, FRAMER_ERR1); + CHECKR_QSTRING_NULL(passwd, FRAMER_ERR1); + + pRoot=cJSON_CreateObject(); + CHECKR_NULL(pRoot, FRAMER_ERR1); + + cJSON_AddStringToObject(pRoot, "ssid", ssid.toStdString().c_str()); + cJSON_AddStringToObject(pRoot, "pwd", passwd.toStdString().c_str()); + + msg = cJSON_Print(pRoot); + if(NULL == msg) + { + cJSON_Delete(pRoot); + return -1; + } + + cJSON_Delete(pRoot); + + ret = frameCmdSend(1< +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include "include/democlock.h" + + +#define FRAMER_OK (0) +#define FRAMER_ERR1 (-1) +#define FRAMER_ERR2 (-2) + +#define CHECKR_NULL(a, ret) {do{if(a == NULL){ \ + LOG_EX(LOG_Error ,"point is null!\n"); \ + return ret; \ + }}while(0); \ + } + +#define CHECKR_QSTRING_NULL(a, ret) {do{if(a.isNull() == TRUE){ \ + LOG_EX(LOG_Error ,"qstring is NULL!\n"); \ + return ret; \ + }}while(0); \ + } + +#define CHECKR_QSTRING_EMPTY(a, ret) {do{if(a.isEmpty() == TRUE){ \ + LOG_EX(LOG_Error ,"qstring is empty!\n"); \ + return ret; \ + }}while(0); \ + } + + +extern int frameCmdSend(int mask, uint32_t cmd, const char* pContext); + +extern void setMailBox(void); + +class DbusMailBox : public MailBox +{ + Q_OBJECT +public: + DbusMailBox(){} + ~DbusMailBox(){} + Q_INVOKABLE int s_wifiConnect(QString ssid, QString passwd) override; +}; + diff --git a/package/netease/clockFrame/src/main.cpp b/package/netease/clockFrame/src/main.cpp index 6bbd3586f..896df5751 100755 --- a/package/netease/clockFrame/src/main.cpp +++ b/package/netease/clockFrame/src/main.cpp @@ -1,27 +1,5 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include #include -#include "include/democlock.h" +#include "framelogic.h" static std::thread thdDbusLoop; static const char* g_pDBusInterfaceName = NULL; @@ -44,6 +22,23 @@ PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,PDBUS_MSG_P } +int frameCmdSend(int mask, uint32_t cmd, const char* pContext) +{ + int status = FRAMER_OK; + + status = DBusBoardcastCommand(NULL, + mask, + cmd, + pContext); + if(0 != status ) + { + LOG_EX(LOG_Info,"frame send module cmd err is %d\r\n",status); + } + + return status; +} + + int main(int argc, char *argv[]) { int ret = 0; @@ -67,5 +62,7 @@ int main(int argc, char *argv[]) thdDbusLoop = std::thread(RunUVLoop, pLoop); thdDbusLoop.detach(); + setMailBox(); + return frameShow(argc, argv); } \ No newline at end of file diff --git a/package/qt/qt5/files/qt-env.sh b/package/qt/qt5/files/qt-env.sh index e07c57d4b..8b405d2ae 100755 --- a/package/qt/qt5/files/qt-env.sh +++ b/package/qt/qt5/files/qt-env.sh @@ -5,7 +5,7 @@ export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt5/plugins export QT_QPA_FONTDIR=/usr/lib/fonts export QT_QPA_GENERIC_PLUGINS=tslib #export QT_QPA_EGLFS_INTEGRATION=none -export XDG_RUNTIME_DIR=/dev/shm +#export XDG_RUNTIME_DIR=/dev/shm #export QT_QPA_GENERIC_PLUGINS=evdevmouse:/dev/input/event1 export QT_QPA_GENERIC_PLUGINS=evdevkeyboard:/dev/input/event0 export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event4:rotate=90