Samples

= Where are the CAR programming samples? = The CAR programming samples should be located at: ~/ElastosRDKforUbuntu/Sources/Elastos/Samples Samples
 * -- ComponentTechnology
 * |-- FooBar
 * |-- GoingToSchool
 * |-- OldMacDonald
 * `-- PickCarrier
 * -- GettingStarted
 * |-- HelloWorld1
 * |-- HelloWorld2
 * `-- HelloWorld3
 * |-- HelloWorld2
 * `-- HelloWorld3

= Build sample code in Arm Android Environment =
 * Open the RDK box by double clicking the shortcut of Arm Android shortcut.
 * Go to ~/ElastosRDKforUbuntu/Sources/Elastos/Samples.
 * Then, run emake.



= Start the emulator =
 * Open a new Arm Android RDK box, and run emu -c to start the emulator.



= Change to the Targets directory and eldrop =
 * In the first RDK box, change to the Targets directory by runing the pd @ command.
 * Then, run eldrop to push Elastos runtime files to the device.



= Copy samples to the emulator = Take HelloWorld3 for example, there are two files that should be copied to the emulator: FooBarDemo.eco and FooBarDemo. The two files should have been generated in the target directory after emake. ~/ElastosRDKforUbuntu/Sources/Elastos/Samples$pd @ ~/ElastosRDKforUbuntu/Targets/rdk/arm.gnu.linux.dbg/bin ~/ElastosRDKforUbuntu/Sources/Elastos/Samples ~/ElastosRDKforUbuntu/Targets/rdk/arm.gnu.linux.dbg/bin$elcopy HelloWorldServer.eco Copying HelloWorldServer.eco to /data/data/com.elastos.runtime/elastos... 513 KB/s (21220 bytes in 0.040s) ~/ElastosRDKforUbuntu/Targets/rdk/arm.gnu.linux.dbg/bin$elcopy HelloWorld3 Copying HelloWorld3 to /data/data/com.elastos.runtime/elastos... 107 KB/s (4871 bytes in 0.044s) ~/ElastosRDKforUbuntu/Targets/rdk/arm.gnu.linux.dbg/bin$

= Start an adb shell =
 * Run elrsh to open an adb shell window.



= Run the HelloWorld3 sample =
 * a. In the adb shell, change the current directory to /data/data/com.elastos.runtime/elastos
 * b. Run ./HelloWorld3 to launch the HelloWorld3 sample.
 * c. You should get this as a result.



= Introduction of Samples =

HelloWorld1
 * A pure C/C++ "Hello World" program.

HelloWorld2
 * ElastosMain version of "Hello World".

HelloWorld3
 * The client/service version of "Hello World" on Elastos.
 * HelloWorldServer.eco is the server. It is a CAR component which can be loaded at runtime.
 * Helloworld3.ecx is the client. It is an executable program with a spacial "ElastosMain" running entry.

FooBar |-- FooBarClient `-- FooBarServer

GoingToSchool |-- Go2SchoolDll `-- Go2SchoolExe

OldMacDonald |-- Animals |-- NewPets `-- OldMac

PickCarrier |-- PickCarrierDemo |-- PickCarrierDll `-- PickCarrierWiFi

Home