Compare commits

...

3 Commits

@ -87,6 +87,10 @@ SET(CAMERA2_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/camera2)
SET(FREETYPE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/freetype) SET(FREETYPE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/freetype)
SET(MQTT_ROOT ${TERM_CORE_ROOT}/Client/mqtt)
SET(SSL_LIBRARY_PATH "${TERM_CORE_ROOT}/Client/mqtt/lib/${ANDROID_ABI}/libssl.a")
SET(CRYPTO_LIBRARY_PATH "${TERM_CORE_ROOT}/Client/mqtt/lib/${ANDROID_ABI}/libcrypto.a")
# SET(EVPP_SRC_DIR ${EVPP_ROOT}/evpp) # SET(EVPP_SRC_DIR ${EVPP_ROOT}/evpp)
include_directories(${YAMC_INC_DIR}) include_directories(${YAMC_INC_DIR})
@ -182,6 +186,63 @@ SET(CAMERA2_SOURCES
# ${CAMERA2_ROOT_DIR}/utils/camera_utils.cpp # ${CAMERA2_ROOT_DIR}/utils/camera_utils.cpp
${CAMERA2_ROOT_DIR}/ndkcamera.cpp) ${CAMERA2_ROOT_DIR}/ndkcamera.cpp)
SET(MQTT_SOURCES
${MQTT_ROOT}/mosquitto/lib/actions.c
${MQTT_ROOT}/mosquitto/lib/alias_mosq.c
${MQTT_ROOT}/mosquitto/lib/callbacks.c
${MQTT_ROOT}/mosquitto/lib/connect.c
${MQTT_ROOT}/mosquitto/lib/handle_auth.c
${MQTT_ROOT}/mosquitto/lib/handle_connack.c
${MQTT_ROOT}/mosquitto/lib/handle_disconnect.c
${MQTT_ROOT}/mosquitto/lib/handle_ping.c
${MQTT_ROOT}/mosquitto/lib/handle_pubackcomp.c
${MQTT_ROOT}/mosquitto/lib/handle_publish.c
${MQTT_ROOT}/mosquitto/lib/handle_pubrec.c
${MQTT_ROOT}/mosquitto/lib/handle_pubrel.c
${MQTT_ROOT}/mosquitto/lib/handle_suback.c
${MQTT_ROOT}/mosquitto/lib/handle_unsuback.c
${MQTT_ROOT}/mosquitto/lib/helpers.c
${MQTT_ROOT}/mosquitto/lib/logging_mosq.c
${MQTT_ROOT}/mosquitto/lib/loop.c
${MQTT_ROOT}/mosquitto/lib/memory_mosq.c
${MQTT_ROOT}/mosquitto/lib/messages_mosq.c
${MQTT_ROOT}/mosquitto/lib/mosquitto.c
${MQTT_ROOT}/mosquitto/lib/net_mosq_ocsp.c
${MQTT_ROOT}/mosquitto/lib/net_mosq.c
${MQTT_ROOT}/mosquitto/lib/options.c
${MQTT_ROOT}/mosquitto/lib/packet_datatypes.c
${MQTT_ROOT}/mosquitto/lib/packet_mosq.c
${MQTT_ROOT}/mosquitto/lib/property_mosq.c
${MQTT_ROOT}/mosquitto/lib/read_handle.c
${MQTT_ROOT}/mosquitto/lib/send_connect.c
${MQTT_ROOT}/mosquitto/lib/send_disconnect.c
${MQTT_ROOT}/mosquitto/lib/send_mosq.c
${MQTT_ROOT}/mosquitto/lib/send_publish.c
${MQTT_ROOT}/mosquitto/lib/send_subscribe.c
${MQTT_ROOT}/mosquitto/lib/send_unsubscribe.c
${MQTT_ROOT}/mosquitto/lib/socks_mosq.c
${MQTT_ROOT}/mosquitto/lib/srv_mosq.c
${MQTT_ROOT}/mosquitto/lib/thread_mosq.c
${MQTT_ROOT}/mosquitto/lib/time_mosq.c
${MQTT_ROOT}/mosquitto/lib/tls_mosq.c
${MQTT_ROOT}/mosquitto/lib/utf8_mosq.c
${MQTT_ROOT}/mosquitto/lib/util_mosq.c
${MQTT_ROOT}/mosquitto/lib/util_topic.c
${MQTT_ROOT}/mosquitto/lib/will_mosq.c
${MQTT_ROOT}/mosquitto_wrapper.cpp
${MQTT_ROOT}/JNIEnvHandler.cpp
${MQTT_ROOT}/MqttClient.cpp
${MQTT_ROOT}/RespJson.cpp
)
include_directories(
${MQTT_ROOT}
${MQTT_ROOT}/openssl/include
${MQTT_ROOT}/uthash/src
${MQTT_ROOT}/mosquitto
${MQTT_ROOT}/mosquitto/lib)
add_definitions(-DFT2_BUILD_LIBRARY=1) add_definitions(-DFT2_BUILD_LIBRARY=1)
SET(FREETYPE_SRC_FILES SET(FREETYPE_SRC_FILES
${FREETYPE_ROOT}/src/autofit/autofit.c ${FREETYPE_ROOT}/src/autofit/autofit.c
@ -253,6 +314,26 @@ add_library( # Sets the name of the library.
add_definitions(-DDARWIN_NO_CARBON) add_definitions(-DDARWIN_NO_CARBON)
add_definitions(-DFT2_BUILD_LIBRARY) add_definitions(-DFT2_BUILD_LIBRARY)
add_library(
mqtt
STATIC
${MQTT_SOURCES}
)
target_compile_definitions(mqtt PRIVATE
WITH_SOCKS
WITH_EC
WITH_UUID
WITH_SYS_TREE
WITH_MEMORY_TRACKING
WITH_PERSISTENCE
WITH_BRIDGE
WITH_THREADING
WITH_TLS_PSK
WITH_TLS
)
add_library( add_library(
freetype freetype
STATIC STATIC
@ -345,6 +426,14 @@ find_library( # Sets the name of the path variable.
# can link multiple libraries, such as libraries you define in this # can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries. # build script, prebuilt third-party libraries, or system libraries.
add_library(ssl STATIC IMPORTED)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${SSL_LIBRARY_PATH})
add_library(ssl_crypto STATIC IMPORTED)
set_target_properties(ssl_crypto PROPERTIES IMPORTED_LOCATION ${CRYPTO_LIBRARY_PATH})
target_link_libraries(mqtt PRIVATE ssl)
target_link_libraries(mqtt PRIVATE ssl_crypto)
target_link_libraries( # Specifies the target library. target_link_libraries( # Specifies the target library.
microphoto microphoto
@ -353,7 +442,7 @@ target_link_libraries( # Specifies the target library.
freetype freetype
# breakpad # breakpad
mqtt
# Links the target library to the log library # Links the target library to the log library
# included in the NDK. # included in the NDK.
${log-lib} ${log-lib}

@ -137,14 +137,15 @@ std::string GpioControl::getString(int cmd)
bool GpioControl::SetN938Cmd(int cmd, int val) bool GpioControl::SetN938Cmd(int cmd, int val)
{ {
char buf[32] = { 0 }; char buf[32] = { 0 };
snprintf(buf, "out %d %d", cmd, val); sprintf(buf, "out %d %d", cmd, val);
IOT_PARAM param; IOT_PARAM param;
int len = MAX_STRING_LEN < strlen(buf) ? MAX_STRING_LEN : strlen(buf); int len = MAX_STRING_LEN < strlen(buf) ? MAX_STRING_LEN : strlen(buf);
param.cmd = cmd; param.cmd = cmd;
memset(param.str, 0, MAX_STRING_LEN); memset(param.str, 0, MAX_STRING_LEN);
memcpy(param.str, value.c_str(), len); // memcpy(param.str, value.c_str(), len);
memcpy(param.str, buf, len);
int fd = open(GPIO_NODE_MP, O_RDONLY); int fd = open(GPIO_NODE_MP, O_RDONLY);
if( fd > 0 ) if( fd > 0 )
@ -152,7 +153,7 @@ bool GpioControl::SetN938Cmd(int cmd, int val)
ioctl(fd, IOT_PARAM_WRITE, &param); ioctl(fd, IOT_PARAM_WRITE, &param);
close(fd); close(fd);
} }
return; return true;
} }
bool GpioControl::OpenSensors() bool GpioControl::OpenSensors()

Loading…
Cancel
Save