# cd services/base/controlpanel
# scons OS=android CPU=arm BINDINGS=core,cpp SERVICES=about,controlpanel BUILD_SERVICES_SAMPLES=off WS=off ANDROID_NDK=/data4/dsshin/Android/android-ndk-r9d ANDROID_SRC=/data4/dsshin/TCC_STB_JELLYBEAN/SDK_v13.05/ VARIANT=debug
# cd cpp/tools/CPSAppGenerator
# mkdir path_for_generated_files
# python generateCPSApp.py <XML file the generate code from> -p <destination path for generated files>
아래는 내 xml 파일
<?xml version="1.0"?>
<controlPanelDevice xmlns="http://www.alljoyn.org/controlpanel/gen">
<name>M370_Control</name>
<headerCode>#include "ControlPanelProvided.h"</headerCode>
<languageSet name="myLanguages">
<language>en</language>
</languageSet>
<controlPanels>
<controlPanel languageSet="myLanguages">
<rootContainer>
<name>rootContainer</name>
<secured>false</secured>
<enabled>true</enabled>
<bgcolor>0x1e90ff</bgcolor>
<hints>
<hint>vertical_linear</hint>
<hint>horizontal_linear</hint>
</hints>
<elements>
<container>
<name>powerControl</name>
<secured>false</secured>
<enabled>true</enabled>
<bgcolor>0x200</bgcolor>
<hints>
<hint>vertical_linear</hint>
</hints>
<elements>
<action>
<name>powerOnOff</name>
<onAction>
<executeCode>powerOnOff();</executeCode>
</onAction>
<secured>false</secured>
<enabled>true</enabled>
<label>
<value type="literal" language="en">Power</value>
</label>
<bgcolor>0x400</bgcolor>
<hints>
<hint>actionButton</hint>
</hints>
</action>
</elements>
</container>
<container>
<name>volumeControl</name>
<secured>false</secured>
<enabled>true</enabled>
<bgcolor>0x200</bgcolor>
<hints>
<hint>vertical_linear</hint>
</hints>
<elements>
<action>
<name>volumeUp</name>
<onAction>
<executeCode>volumeUp();</executeCode>
</onAction>
<secured>false</secured>
<enabled>true</enabled>
<label>
<value type="literal" language="en">Volume Up</value>
</label>
<bgcolor>0x400</bgcolor>
<hints>
<hint>actionButton</hint>
</hints>
</action>
<action>
<name>volumeDown</name>
<onAction>
<executeCode>volumeDown();</executeCode>
</onAction>
<secured>false</secured>
<enabled>true</enabled>
<label>
<value type="literal" language="en">Volume Down</value>
</label>
<bgcolor>0x400</bgcolor>
<hints>
<hint>actionButton</hint>
</hints>
</action>
</elements>
</container>
</elements>
</rootContainer>
</controlPanel>
</controlPanels>
</controlPanelDevice>
LOCAL_PATH:=$(call my-dir)
NDK_DIR = /Android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.6
GEN_DIR = generated
PRO_DIR = provided
SAM_DIR = samples_common
include $(CLEAR_VARS)
# for static libs
LOCAL_PREBUILT_LIBS := \
lib/libajrouter.a \
lib/liballjoyn-daemon.a \
lib/liballjoyn.a \
lib/liballjoyn_controlpanel.a \
lib/libbbdaemon-lib.a \
lib/liballjoyn_about.a \
lib/liballjoyn_services_common.a \
lib/libbundledRouter.a \
lib/libgnustl_static.a \
lib/libstdc++.a
include $(BUILD_MULTI_PREBUILT)
include $(CLEAR_VARS)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
# for binary build
LOCAL_MODULE := control_panel
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS := -Wall -Wno-psabi -Wno-write-strings -DANDROID_NDK -DTARGET_ANDROID -DLINUX -DQCC_OS_GROUP_POSIX -DQCC_OS_ANDROID -DQCC_CPU_ARM -DANDROID
LOCAL_SRC_FILES := \
main_ControlPanel.cc
LOCAL_SRC_FILES += \
$(GEN_DIR)/ControlPanelGenerated.cc \
$(GEN_DIR)/M370_ControlPowerOnOff.cc \
$(GEN_DIR)/M370_ControlVolumeDown.cc \
$(GEN_DIR)/M370_ControlVolumeUp.cc
LOCAL_SRC_FILES += \
$(PRO_DIR)/ControlPanelProvided.cc
LOCAL_SRC_FILES += \
$(SAM_DIR)/AnnounceHandlerImpl.cc \
$(SAM_DIR)/AsyncSessionJoiner.cc \
$(SAM_DIR)/CommonBusListener.cc \
$(SAM_DIR)/CommonSampleUtil.cc \
$(SAM_DIR)/IniParser.cc \
$(SAM_DIR)/PropertyStoreImpl.cc \
$(SAM_DIR)/SessionListenerImpl.cc \
$(SAM_DIR)/SrpKeyXListener.cc
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/inc \
$(LOCAL_PATH)/innopia_M370_generated \
$(LOCAL_PATH)/innopia_M370_provided \
$(LOCAL_PATH)/samples_common \
$(NDK_DIR)/include \
$(NDK_DIR)/libs/armeabi/include
LOCAL_STATIC_LIBRARIES := libajrouter liballjoyn-daemon liballjoyn liballjoyn_controlpanel libbbdaemon-lib liballjoyn_about liballjoyn_services_common libbundledRouter \
libgnustl_static libstdc++
LOCAL_SHARED_LIBRARIES := libcrypto libssl
include $(BUILD_EXECUTABLE)
#include <stdlib.h>
#include "ControlPanelProvided.h"
void powerOnOff() {
printf("powerOff called!!\n");
system("input keyevent 26");
}
void volumeUp() {
printf("volumeUp called!!\n");
system("input keyevent 24");
}
void volumeDown() {
printf("volumeDown called!!\n");
system("input keyevent 25");
}
AllJoyn Audio Service for Android (5) | 2014.07.17 |
---|