Welcome to the CDM Service Framework.
CDM Service Framework provides easy methods to implement CDM controllee and controller applications.
cpp +---code_template | +---interface_template | +---vendor_defined_interface_template | \---xml | +---org.alljoyn.SmartSpaces.Environment | +---org.alljoyn.SmartSpaces.Operation | \---org.alljoyn.SmartSpaces.UserInterfaceSettings +---inc | \---alljoyn | \---cdm | \---interfaces | +---environment | +---input | \---operation +---samples | +---ACControllee | +---BaseSample | | +---Controllee | | +---Controller | | \---VendorDefinedInterfaces | +---CookTopControllee | +---DeviceEmulator | | \---config | +---IntegratedController | +---IntegratedControllee | +---LaundryControllee | +---RobotCleanerControllee | +---TimerSimulator | +---TvControllee | \---VDIControllee +---src | \---interfaces | +---environment | +---input | \---operation \---unittest +---DUT | +---environment | +---input | \---operation \---ServiceFramework
- cpp/code_template : Generator of CDM interfaces skeleton codes
- cpp/code_template/xml : Interospection XML files of CDM interfaces
- cpp/inc/alljoyn/cdm : CDM common header files
- cpp/inc/alljoyn/cdm/interfaces : CDM interface-related header files
- cpp/samples/BaseSample : Base sample for making other device sample
- cpp/samples/ACControllee :
- Example of cdm device composed of Base sample controllee
- Emulated virtual air conditioner sample. It has 11 interfaces. (OnOffStatus, OnControl, OffControl, ResourceSaving, ClimateControlMode, FanSpeedLevel, CurrentPower, EnergyUsage, CurrentTemperature, TargetTemperature, WindDirection)
- cpp/samples/CookTopControllee :
- Example of cdm device composed of Base sample controllee
- Emulated virtual cook top sample. It has 3 interfaces. (HeatingZone, OvenCyclePhase, RapidMode)
- cpp/samples/DeviceEmulator :
- Device emulator (Refer to Device Emulator section in this document.)
- cpp/samples/IntegratedControllee :
- Integrated controllee based on Base sample controllee
- Integrated controllee is designed to make it easier to add other interfaces.
- cpp/samples/IntegratedController :
- Integrated controller based on Base sample controller
- Integrated controller is designed to make it easier to add other interfaces.
- cpp/samples/LaundryControllee :
- Example of cdm device composed of Base sample controllee
- Emulated virtual laundry sample. It has 8 interfaces. (OnOffStatus, CycleControl, SoilLevel, SpinSpeedLevel, WaterLevel, DishWashingCyclePhase, LaundryCyclePhase, Timer)
- cpp/samples/RobotCleanerControllee :
- Example of cdm device composed of Base sample controllee
- Emulated virtual robot cleaner sample. It has 5 interfaces. (OnOffStatus, BatteryStatus, RepeatMode, RobotCleaningCyclePhase, CurrentPower)
- cpp/samples/TimerSimulator :
- Timer simulator. It has CycleControl and Timer interfaces.
- cpp/samples/TVControllee :
- Example of cdm device composed of Base sample controllee
- Emulated virtual TV sample. It has 4 interfaces. (Channel, AudioVolume, AudioVideoInput, Hid)
You can build CDM Service Framework using 'scons'. Please refer to AllJoyn Build Instruction for more details on setting up your environment.
- Folder structure
root-source-dir +---core | +---alljoyn | \---ajtcl \---services +---base \---cdm
- Build
cd root-source-dir/services/cdm scons BINDINGS=cpp WS=off BT=off ICE=off
- Output
cdm/ +---bin +---inc | \---alljoyn | \---cdm | \---interfaces | +---environment | +---input | \---operation \---lib
- path : root-source-dir/services/cdm/build/$OS/$TARGET_CPU/debug/dist/cdm
- bin : IntegratedController, TvControllee
- lib : liballjoyn_cdm.a, liballjoyn_cdm.so
- inc : header files
- Build unit tests To build the unit tests add a GTEST_DIR='/GTEST/googletest' parameter to the scons command line.
tests can be found and run from: /services/cdm/build/{OS}/{CPU}/{VARIANT}/test/cdm/bin
- Make manual
cd root-source-dir/services/cdm/cpp/docs doxygen Doxygen_html
- Make manual in the building step
cd root-source-dir/services/cdm scons BINDINGS=cpp WS=off BT=off ICE=off DOCS=html
- Generate the skeleton codes using make_interface.py script.
- Fill the codes for properties, methods and signals in all files generated.
- Create skeleton codes for new interface
cd root-source-dir/services/cdm/cpp/code_template python make_interface.py -n InterfaceName -c CategoryName (InterfaceName and CategoryName are case sensitive.) [example] python make_interface.py -n TargetTemperature -c Environment Created: ../inc/alljoyn/cdm/interfaces/environment/TargetTemperatureInterface.h Created: ../inc/alljoyn/cdm/interfaces/environment/TargetTemperatureIntfControllee.h Created: ../inc/alljoyn/cdm/interfaces/environment/TargetTemperatureIntfControlleeListener.h Created: ../inc/alljoyn/cdm/interfaces/environment/TargetTemperatureIntfController.h Created: ../inc/alljoyn/cdm/interfaces/environment/TargetTemperatureIntfControllerListener.h Created: ../src/interfaces/environment/TargetTemperatureInterface.cc Created: ../src/interfaces/environment/TargetTemperatureIntfControlleeImpl.h Created: ../src/interfaces/environment/TargetTemperatureIntfControlleeImpl.cc Created: ../src/interfaces/environment/TargetTemperatureIntfControllerImpl.h Created: ../src/interfaces/environment/TargetTemperatureIntfControllerImpl.cc
- Delete files related new interface
cd root-source-dir/services/cdm/cpp/code_template python make_interface.py -n InterfaceName -c Category -d
- Generate the skeleton codes using make_interface.py script.
- Copy all files to your application folder
- Fill the codes for properties, methods and signals in all files generated.
- Create skeleton codes for vendor defined interface
cd root-source-dir/services/cdm/cpp/code_template python make_interface.py -n InterfaceName -v (InterfaceName is case sensitive.) [example] python make_interface.py -n Test -v Created: ./vendor_defined/TestInterface.h Created: ./vendor_defined/TestIntfControllee.h Created: ./vendor_defined/TestIntfControlleeListener.h Created: ./vendor_defined/TestIntfController.h Created: ./vendor_defined/TestIntfControllerListener.h Created: ./vendor_defined/TestInterface.cc Created: ./vendor_defined/TestIntfControlleeImpl.h Created: ./vendor_defined/TestIntfControlleeImpl.cc Created: ./vendor_defined/TestIntfControllerImpl.h Created: ./vendor_defined/TestIntfControllerImpl.cc
- Delete files related vendor defined interface
cd root-source-dir/services/cdm/cpp/code_template python make_interface.py -n InterfaceName -v -d
Device emulator is an emulator for the CDM Service Framework based devices. You can launch the virtual device using the configuration XML file.
- Run emulator
cd /services/cdm/build/{OS}/{CPU}/{VARIANT}/dist/cdm/bin ./DeviceEmulator config.xml
- Sample config.xml for air conditioner
<DeviceEmulator> <AboutData> <AppId>000102030405060708090A0B0C0D0E0C</AppId> <DefaultLanguage>en</DefaultLanguage> <DeviceName>My Device Name</DeviceName> <DeviceName lang = 'es'>Nombre de mi dispositivo</DeviceName> <DeviceId>baddeviceid</DeviceId> <AppName>My Application Name</AppName> <AppName lang = 'es'>Mi Nombre de la aplicación</AppName> <Manufacturer>Company</Manufacturer> <Manufacturer lang = 'es'>Empresa</Manufacturer> <ModelNumber>Wxfy388i</ModelNumber> <Description>A detailed description provided by the application.</Description> <Description lang = 'es'>Una descripción detallada proporcionada por la aplicación.</Description> <DateOfManufacture>2014-01-08</DateOfManufacture> <SoftwareVersion>1.0.0</SoftwareVersion> <HardwareVersion>1.0.0</HardwareVersion> <SupportUrl>www.example.com</SupportUrl> <UserDefinedTag>Can only accept strings anything other than strings must be done using the AboutData Class SetField method</UserDefinedTag> <UserDefinedTag lang='es'>Sólo se puede aceptar cadenas distintas de cadenas nada debe hacerse utilizando el método AboutData Clase SetField</UserDefinedTag> <CountryOfProduction>Room1</CountryOfProduction> <Location>Room1</Location> <ProductBrand>Room1</ProductBrand> <Location>upstairs bedroom</Location> <Location lang='es'>habitación del segundo piso</Location> <DeviceTypeDescription> <TypeDescription> <device_type>5</device_type> <object_path>/Cdm/AirConditioner</object_path> </TypeDescription> </DeviceTypeDescription> </AboutData> <InterfaceList> <Object path='/Cdm/AirConditioner'> <Interface name='org.alljoyn.SmartSpaces.Environment.TargetTemperature'/> <Interface name='org.alljoyn.SmartSpaces.Environment.CurrentTemperature'/> <Interface name='org.alljoyn.SmartSpaces.Environment.WindDirection'/> <Interface name='org.alljoyn.SmartSpaces.Operation.OnControl'/> <Interface name='org.alljoyn.SmartSpaces.Operation.OffControl'/> <Interface name='org.alljoyn.SmartSpaces.Operation.OnOffStatus'/> <Interface name='org.alljoyn.SmartSpaces.Operation.FanSpeedLevel'/> <Interface name='org.alljoyn.SmartSpaces.Operation.ClimateControlMode'/> </Object> </InterfaceList> </DeviceEmulator>
java \---CdmController +---app | +---libs | \---src \---gradle
- java/CdmController/app/libs: alljoyn.jar, alljoyn_about.jar, liballjoyn_java.so
- java/CdmController/app/src: source files
- java/CdmController/gradle: build script for Android Studio
- Open project folder(/java/CdmController/) in the Android Studio
- If you are using the Android Studio 2.0, you should change your config of the Android Studio. (http://tools.android.com/tech-docs/instant-run)
- Open the Settings or Preferences dialog.
- Navigate to Build, Execution, Deployment > Instant Run.
- Uncheck the box next to Restart activity on code changes.
- Uncheck the box next to Enable Instant Run to ~~~
- Run > Clean and Rerun 'app'