Skip to content

c++ sdk example for connecting to RDK on localhost while offline

License

Notifications You must be signed in to change notification settings

viam-labs/cpp-offline-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

offline client demo

cmake setup:

mkdir build
/snap/bin/cmake -G Ninja -B build .

build & run:

cd build
ninja && LD_LIBRARY_PATH=/usr/local/lib ./main

set up environment variables

main.cpp consumes secrets from the shell environment. You can provide these through a tool like direnv or dotenv, hardcode them in the main.cpp, or export them manually as below:

export VIAM_HOST=my-robot.XZYXZYXYZ.local.viam.cloud:8080
export VIAM_API_KEY=xyzxyzxyzxyzxyzxy
export VIAM_ENTITY_ID=xxxx-xxx-xxx-xxx

(note: VIAM_HOST has local.viam.cloud suffix and :8080; these are both necessary for offline mode)

using TLS connection while offline

In sudo vim, create an entry in /etc/hosts like:

127.0.0.1 my-robot.XZYXZYXYZ.local.viam.cloud

(note: this MUST be 'local.viam.cloud', not the normal viam.cloud address)

$ ninja && LD_LIBRARY_PATH=/usr/local/lib ./main
Resources:
	rdk:service:motion/builtin
	rdk:service:sensors/builtin

Then cut your wifi; you should still be able to connect.

About

c++ sdk example for connecting to RDK on localhost while offline

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published