Skip to content

Commit

Permalink
Use public JSON api instead of private msgpack one
Browse files Browse the repository at this point in the history
  • Loading branch information
seriyps committed Nov 22, 2024
1 parent ec86d81 commit abc8a2d
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
rm -r /boot/* #save space
apt-get update
apt clean
apt-get install -y cmake g++ git pkg-config librockchip-mpp-dev libcairo-dev libdrm-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libspdlog-dev nlohmann-json3-dev libmsgpack-dev
apt-get install -y cmake g++ git pkg-config librockchip-mpp-dev libcairo-dev libdrm-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libspdlog-dev nlohmann-json3-dev
apt clean
cmake -B build
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ set(SOURCE_FILES
file(GLOB ICONS src/icons/*.png)
file(GLOB OSD_CONFIGS *_osd.json)

include_directories("/usr/include/libdrm" "/usr/include/cairo" "/usr/include/spdlog" "/usr/include/msgpack")
include_directories("/usr/include/libdrm" "/usr/include/cairo" "/usr/include/spdlog")

configure_file("${PROJECT_NAME}_config.h.in" "${PROJECT_NAME}_config.h")

find_package(spdlog REQUIRED)
find_package(nlohmann_json 3 REQUIRED)
#find_package(msgpack REQUIRED) # called msgpack-c in Ubunty

add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} rockchip_mpp pthread drm m cairo spdlog::spdlog nlohmann_json::nlohmann_json) # msgpack)
target_link_libraries(${PROJECT_NAME} rockchip_mpp pthread drm m cairo spdlog::spdlog nlohmann_json::nlohmann_json)

# Embed gstreamer
find_package(PkgConfig REQUIRED)
Expand Down
50 changes: 41 additions & 9 deletions config_osd.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,32 +297,64 @@
"name": "Dump raw facts to the scren (remove `--` from `type` to enable)",
"type": "---DebugWidget",
"x": 10,
"y": -100,
"y": -200,
"facts": [
{
"name": "mavlink.heartbeet.base_mode.armed"
},
{
"name": "mavlink.radio_status.rssi",
"name": "wfbcli.rx.packets.all",
"tags": {
"sysid": "3",
"compid": "68"
"id": "video rx"
}
},
{
"name": "mavlink.gps_raw.lat"
"name": "wfbcli.rx.packets.lost",
"tags": {
"id": "video rx"
}
},
{
"name": "mavlink.gps_raw.lon"
"name": "wfbcli.rx.ant_stats.freq",
"tags": {
"id": "video rx",
"ant_id": "0"
}
},
{
"name": "mavlink.gps_raw.fix_type"
"name": "wfbcli.rx.ant_stats.mcs",
"tags": {
"id": "video rx",
"ant_id": "0"
}
},
{
"name": "mavlink.global_position_int.lat"
"name": "wfbcli.rx.ant_stats.rssi_avg",
"tags": {
"id": "video rx",
"ant_id": "0"
}
},
{
"name": "wfbcli.rx.ant_stats.freq",
"tags": {
"id": "video rx",
"ant_id": "1"
}
},
{
"name": "mavlink.global_position_int.lon"
"name": "wfbcli.rx.ant_stats.mcs",
"tags": {
"id": "video rx",
"ant_id": "1"
}
},
{
"name": "wfbcli.rx.ant_stats.rssi_avg",
"tags": {
"id": "video rx",
"ant_id": "1"
}
}
]
},
Expand Down
8 changes: 7 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ int main(int argc, char **argv)
int mp4_fragmentation_mode = 0;
uint16_t listen_port = 5600;
uint16_t mavlink_port = 14550;
uint16_t wfb_port = 8103;
uint16_t mode_width = 0;
uint16_t mode_height = 0;
uint32_t mode_vrefresh = 0;
Expand Down Expand Up @@ -693,6 +694,11 @@ int main(int argc, char **argv)
continue;
}

__OnArgument("--wfb-api-port") {
wfb_port = atoi(__ArgValue);
continue;
}

__OnArgument("--version") {
printf("PixelPilot Rockchip %d.%d\n", APP_VERSION_MAJOR, APP_VERSION_MINOR);
return 0;
Expand Down Expand Up @@ -806,7 +812,7 @@ int main(int argc, char **argv)
assert(!ret);
}
wfb_thread_params *wfb_args = (wfb_thread_params *)malloc(sizeof *wfb_args);
wfb_args->port = 8003; // TODO: configurable
wfb_args->port = wfb_port;
ret = pthread_create(&tid_wfbcli, NULL, __WFB_CLI_THREAD__, wfb_args);
assert(!ret);

Expand Down
Loading

0 comments on commit abc8a2d

Please sign in to comment.