This section has instructions to create a sample application using Telematics APIs.
You need to have the following in order to proceed:
- Linux Yocto Platform SDK Installer created by the system integrator or created using section 2 (Building Platform SDK)
Setup the build environment
Install the Linux platform SDK created by the platform developer for the intended device. Let's assume that the installer is named sdk_installer.sh.
- Open the terminal, Copy the sdk_installer.sh into your working directory, say for example "my_sdk_install".
1 $ mkdir my_sdk_install; cd my_sdk_install
3 // Choose to install to my_sdk_install when the SDK installer asks
- Setup the build environment as follows:
1 $ cd my_sdk_install; source environment-setup-cortexa8hf-vfp-neon-oe-linux-gnueabi
Now your development environment is set for the terminal, start your development.
To get started with a sample app
- Create a sample folder
- Create a sample application as follows:
#include <iostream>
#include <memory>
#include <telux/tel/PhoneFactory.hpp>
int main() {
auto &phoneFactory = telux::tel::PhoneFactory::getInstance();
auto phoneManager = phoneFactory.getPhoneManager();
bool status = phoneManager->isSubsystemReady();
std::cout << "PhoneManager Ready? " << (status? "Yes":"No") << std::endl;
if(!status) {
std::cout << "wait unconditionally for it to be ready " << std::endl;
std::future<bool> f = phoneManager->onSubsystemReady();
status = f.get();
}
std::cout << "PhoneManager Ready? " << (status? "Yes":"No") << std::endl;
return 0;
}
Compile the program
- Now compile your source code
1 user@machine:/sample_app$ ${CC} SampleApp.cpp -ltelux_tel -std=c++11 -lstdc++ -o sample_app
Install program on the device
- Push your binary to the /data location on the device
1 user@machine:/sample_app$ adb push sample_app /data/
2 user@machine:/sample_app$ adb shell