Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Latest commit

 

History

History
82 lines (52 loc) · 2.6 KB

DEVELOPER_NOTES.md

File metadata and controls

82 lines (52 loc) · 2.6 KB

Developer notes

Documented diff between main repo (for the node.js / next.js part)

Diff between main opendatacam node.js app and node.js app for mobile

https://github.com/opendatacam/opendatacam/compare/development...mobile

Will need to build adapters / if(Android) in the code to have the same codebase

Build app

# Copy web assets to native projects
npx cap copy

# Go to main opendatacam project to build the node.js app
cd ../opendatacam
# checkout mobile branch

# build front-end code and export app as static
npm i
npm run build
npm run export

# prune node_module from dev dependencies
npm prune --production

# pack as a zip (ignore useless folder) and put in assets folder of the mobile project

# delete previous zip
rm ../opendatacam-mobile/android/app/src/main/assets/nodejs-project.zip

# zip new one (only include necessary folders)
zip -0 -r ../opendatacam-mobile/android/app/src/main/assets/nodejs-project.zip . -i "out/*" "node_modules/*" "server/*" "server.js" "package.json" "config.json" -x "out/static/placeholder/*" "out/static/demo/*" "node_modules/node-moving-things-tracker/benchmark/*"

Full command

npm i;npm run build;npm run export;npm prune --production;rm ../opendatacam-mobile/android/app/src/main/assets/nodejs-project.zip;zip -0 -r ../opendatacam-mobile/android/app/src/main/assets/nodejs-project.zip . -i "out/*" "node_modules/*" "server/*" "server.js" "package.json" "config.json" -x "out/static/placeholder/*" "out/static/demo/*" "node_modules/node-moving-things-tracker/benchmark/*"

Dev workflow

Open chrome, and open chrome://inspect , the webview should show up.

diff for local development

use /start to start YOLO and then request again on localhost:8080

Apply this patch: https://github.com/opendatacam/opendatacam/blob/mobile/mobile-branch-dev.patch

git apply mobile-branch-dev.patch    

This will:

  • renable next() on node.js side to serve front-end
  • change paths of NeDB location
  • renable YOLOSimulation
  • Mock cameraLocation
  • Display component in MainPage.js (when on android device we do not render it as the native code render the camera view)

To generate the patch git diff > mobile-branch-dev.patch, and then remove the part in the patch that create a diff of the patch itself...

Troubleshooting

Infinite cmake loop on android build

# remove android/app/.cxx folder
rm -rf android/app/.cxx/

External Dependencies