pax_global_header00006660000000000000000000000064127214717000014513gustar00rootroot0000000000000052 comment=09dc552aadd4cc30bb8fc328a13f8fff21062d9e base-16.04/000077500000000000000000000000001272147170000124375ustar00rootroot00000000000000base-16.04/.gitignore000066400000000000000000000004721272147170000144320ustar00rootroot00000000000000*.a *.class *.jar *.o *.so *~ .cproject .project .sconsign.dblite .settings/* */.settings/* */whitespace.db libs QA ajlite.nvram alljoyn-daemon bin !build_core/tools/bin build deploy docs/*.html docs/html/*.html gen lib local.properties obj* .DS_Store xcuserdata xccheckout xcshareddata alljoyn-deviceId.txt .idea base-16.04/README.md000066400000000000000000000024731272147170000137240ustar00rootroot00000000000000Notice of Export Control Law ============================ Cryptographic software is subject to the US government export control and economic sanctions laws ("US export laws") including the US Department of Commerce Bureau of Industry and Security's ("BIS") Export Administration Regulations ("EAR", 15 CFR 730 et seq., http://www.bis.doc.gov/). You may also be subject to US export laws, including the requirements of license exception TSU in accordance with part 740.13(e) of the EAR. Software and/or technical data subject to the US export laws may not be directly or indirectly exported, reexported, transferred, or released ("exported") to US embargoed or sanctioned destinations currently including Cuba, Iran, North Korea, Sudan, or Syria, but any amendments to this list shall apply. In addition, software and/or technical data may not be exported to any entity barred by the US government from participating in export activities. Denied persons or entities include those listed on BIS's Denied Persons and Entities Lists, and the US Department of Treasury's Office of Foreign Assets Control's Specially Designated Nationals List. The country in which you are currently located may have restrictions on the import, possession, use of encryption software. You are responsible for compliance with the laws where You are located. base-16.04/ReleaseNotes.txt000066400000000000000000000105321272147170000155720ustar00rootroot00000000000000AllJoyn Standard Base Services Version 16.04 Release Notes ================================================== Fully Validated Platforms ------------------------- 1) Linux Ubuntu 14.04 LTS (64 bit) 2) Android 4.3, Android 5.0, Android 6.0 (ARM7) (support 4.3+) 3) iOS 8.0, iOS 9.0 (support 8.0+) 4) OpenWRT Chaos Calmer 5) Windows 10 Focus of Version 16.04 ------------------------------- Platform and language support Base Services has been built and continually tested on every supported platform to ensure that it builds and functions correctly. The samples and documentation have also both been updated in order to improve the developer experience. Remaining prominent issues are listed in the Known Issues section below. Updating to Core 16.04 Base Services has been updated to use the most recent 16.04 version of AllJoyn Core. Updating for Security 2.0 Security 2.0 is still developer preview however in preparation for eventual release, Base Services has been updated to include Security 2.0 support. Specifically, the onboarding sample has been updated to demonstrate claiming permissions. Features added in Version 16.04 ------------------------------- ASABASE-593 Allow Android SDK of any API level >=16 to satisfy build requirements ASABASE-575 Improvements to Onboarding for integration with Security 2.0 ASABASE-506 Sec 2.0: Base Services support for security 2 ASABASE-501 Remove dependency on core/alljoyn source tree Full list: https://jira.allseenalliance.org/issues/?filter=12417 Issues Addressed in Version 16.04 ------------------------------- ASABASE-692 Android ControlPanelBrowser sample crashes when screen is rotated while connecting to controllee ASABASE-688 Onboarding Client sample - Cannot connect to hidden network when running on Android 5.0+ ASABASE-687 Onboarding Client sample - Networks with empty SSIDs can appear in scanned WiFi list ASABASE-684 iOS devices do not receive active notifications if 'Consumer' is turned off/on while also a producer ASABASE-683 Notification produced by iOS device continues to broadcast when dismissed ASABASE-678 ControlPanelBrowser is frequently unresponsive on iPhone 6 8.2 ASABASE-675 iOS ControlPanelBrowser crashes on iPhone 5S 7.1 ASABASE-674 Onboarding Manager Sample app fails to connect to the Onboardee when running on Android 6.0 device ASABASE-672 Android Onboardee does not handle delay or failure of wifi enabling ASABASE-629 IOS Notification Sample Consumer not receiving notifications ASABASE-628 IOS Notification Sample App TTL units misleading ASABASE-589 Action' function is not implemented for consumer in NotificationService android sample ASABASE-570 Onboarding configuration interface does not appear in OnboardingService app on iOS simulator ASABASE-569 ControlPanelService app can become stuck on control panel screen if controllee goes offline ASABASE-568 ControlPanelBrowser does not display controllee widgets on Android ASABASE-567 NotificationService iOS sample producer screen not showing ASABASE-557 Incorrect multi-language display in Control Panel ASABASE-408 iOS ControlPanelService does not display buttons / other widgets like Android ControlPanelBrowser ASABASE-301 Android Onboarding Manager not removing soft AP entry after onoboarding succeeds ASABASE-189 Onboarding Script Offboard method should delete key1 as well ASABASE-167 Wrong ScanWifi Info Was Returned Upon an WPA2 TKIP Security Configured Router Full list: https://jira.allseenalliance.org/issues/?filter=12419 Known Issues added in Version 16.04 ------------------------------- ASABASE-711 iOS Onboarding Client sample's "Onboarding succeeded" popup box appears even when onboarding fails ASABASE-689 Android 5.0+ device running Onboarding Server simulator cannot be onboarded to hidden network when OPEN or WEP auth type used ASABASE-679 iOS Control Panel controllers do not update their values ASABASE-654 Onboarding Manager sample app unable to onboard Nexus 4 device running Android 6.0.1 ASABASE-653 Onboarding Client on Android does not populate 'Scan Info' combo box ASABASE-624 Android N platform in SDK causes min API level check in SConscript to fail ASABASE-428 OpenWRT Barrier Braker onboardee doesn't remain onboarded if WEP Shared Key auth is used Full list: https://jira.allseenalliance.org/issues/?filter=12418 base-16.04/build_core/000077500000000000000000000000001272147170000145465ustar00rootroot00000000000000base-16.04/build_core/SConscript000066400000000000000000000250311272147170000165610ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os import platform def CheckCXXFlag(context, flag): prog = "int main(void) { return 0; }" context.Message('Checking c++ compiler support for %s flag... ' % flag) prevCXXFLAGS = context.env.get('CXXFLAGS') prefix = flag.split('=')[0] checkCXXFLAGS = [x for x in prevCXXFLAGS if not x.startswith(prefix)] checkCXXFLAGS.append(flag) context.env.Replace(CXXFLAGS = checkCXXFLAGS) r = context.TryCompile(prog, '.cc') if not r: context.env.Replace(CXXFLAGS = prevCXXFLAGS) context.Result(r) return r if platform.system() == 'Linux': default_target_os = 'linux' allowed_target_oss = ('linux', 'android', 'openwrt') if platform.machine() == 'x86_64': default_target_cpu = 'x86_64' else: default_target_cpu = 'x86' allowed_target_cpus = ('x86', 'x86_64', 'arm', 'openwrt') default_msvc_version = None default_crypto = 'openssl' # Override for OS=android is below allowed_crypto = ('openssl', 'builtin') elif platform.system() == 'Windows': default_target_os = 'win7' allowed_target_oss = ('win7', 'win10', 'android') if platform.machine() == 'x86_64': default_target_cpu = 'x86_64' else: default_target_cpu = 'x86' allowed_target_cpus = ('x86', 'x86_64', 'arm') default_msvc_version = '12.0' default_crypto = 'cng' allowed_crypto = ('cng', 'openssl', 'builtin') elif platform.system() == 'Darwin': default_target_os = 'darwin' allowed_target_oss = ('darwin', 'android', 'openwrt') # Darwin maps both 32-bit and 64-bit x86 CPUs to "x86" default_target_cpu = 'x86' allowed_target_cpus = ('x86', 'arm', 'armv7', 'armv7s', 'arm64', 'openwrt') default_msvc_version = None default_crypto = 'openssl' allowed_crypto = ('openssl', 'builtin') vars = Variables() # Common build variables vars.Add('V', 'Build verbosity', '0') vars.Add(EnumVariable('OS', 'Target OS', default_target_os, allowed_values = allowed_target_oss)) vars.Add(EnumVariable('CPU', 'Target CPU', default_target_cpu, allowed_values = allowed_target_cpus)) vars.Add(EnumVariable('VARIANT', 'Build variant', 'debug', allowed_values=('debug', 'release'), ignorecase=2)) vars.Add(EnumVariable('BR', 'Have bundled router built-in for C++ test samples', 'on', allowed_values=('on', 'off'))) vars.Add(EnumVariable('DOCS', '''Output doc type. Setting the doc type to "dev" will produce HTML output that includes all developer files not just the public API. ''', 'none', allowed_values=('none', 'pdf', 'html', 'dev', 'chm', 'sandcastle'))) vars.Add(EnumVariable('WS', 'Whitespace Policy Checker', 'off', allowed_values=('check', 'detail', 'fix', 'off'))) vars.Add(PathVariable('GTEST_DIR', 'The path to Google Test (gTest) source code', os.environ.get('GTEST_DIR'), PathVariable.PathIsDir)) vars.Add(EnumVariable('NDEBUG', 'Override NDEBUG default for release variant', 'defined', allowed_values=('defined', 'undefined'))) vars.Add(PathVariable('SQLITE_DIR', 'The path to sqlite3.c and sqlite3.h, for building the Security Manager sample app', os.environ.get('SQLITE_DIR'), PathVariable.PathIsDir)) vars.Add('CXX', 'C++ compiler to use') if default_msvc_version: vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', default_msvc_version, allowed_values=('11.0', '11.0Exp', '12.0', '12.0Exp', '14.0', '14.0Exp'))) # Standard variant directories build_dir = 'build/${OS}/${CPU}/${VARIANT}' vars.AddVariables(('OBJDIR', '', '#' + build_dir + '/obj'), ('DISTDIR', '', '#' + build_dir + '/dist'), ('TESTDIR', '', '#' + build_dir + '/test')) target_os = ARGUMENTS.get('OS', default_target_os) target_cpu = ARGUMENTS.get('CPU', default_target_cpu) if target_os == 'android': default_crypto = 'builtin' if target_os == 'darwin' and target_cpu in ['x86', 'x86_64']: default_crypto = 'builtin' vars.Add(EnumVariable('CRYPTO', 'Crypto implementation', default_crypto, allowed_values = allowed_crypto)) if target_os in ['win10', 'win7']: # The Win7/Win10 MSI installation package takes a long time to build. Let it be optional. if target_os in ['win10', 'win7']: vars.Add(EnumVariable('WIN7_MSI', 'Build the .MSI installation package', 'false', allowed_values=('false', 'true'))) path = [] if os.environ.has_key('MIKTEX_HOME'): path = os.path.normpath(os.environ['MIKTEX_HOME'] + '/bin') msvc_version = ARGUMENTS.get('MSVC_VERSION') env = Environment(variables = vars, TARGET_ARCH=target_cpu, MSVC_VERSION=msvc_version, tools = ['default', 'jar'], ENV = {'PATH' : path}) else: env = Environment(variables = vars, tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'javac', 'javah', 'jar', 'pdf', 'pdflatex']) if env['V'] == '0': env.Replace(CCCOMSTR = '\t[CC] $SOURCE', SHCCCOMSTR = '\t[CC-SH] $SOURCE', CXXCOMSTR = '\t[CXX] $SOURCE', SHCXXCOMSTR = '\t[CXX-SH] $SOURCE', LINKCOMSTR = '\t[LINK] $TARGET', SHLINKCOMSTR = '\t[LINK-SH] $TARGET', JAVACCOMSTR = '\t[JAVAC] $SOURCE', JARCOMSTR = '\t[JAR] $TARGET', ARCOMSTR = '\t[AR] $TARGET', RANLIBCOMSTR = '\t[RANLIB] $TARGET' ) # Some tools aren't in default path if os.environ.has_key('JAVA_HOME'): env.PrependENVPath('PATH', os.path.normpath(os.environ['JAVA_HOME'] + '/bin')) if os.environ.has_key('DOXYGEN_HOME'): env.PrependENVPath('PATH', os.path.normpath(os.environ['DOXYGEN_HOME'] + '/bin')) if os.environ.has_key('GRAPHVIZ_HOME'): env.PrependENVPath('PATH', os.path.normpath(os.environ['GRAPHVIZ_HOME'] + '/bin')) # Warn user about building stand alone daemon on unsupported platforms if env['OS'] not in ['android', 'linux', 'openwrt'] and env['BR'] != "on": print "Daemon is not supported on OS=%s, building with BR=on anyway" % (env['OS']) env['BR'] = "on" Help(vars.GenerateHelpText(env)) # Don't silently break people still building with BD in place of BR. We're adding the variable here # after generating the help text above so that it does not show up in the help. bd = Variables(); bd.Add(EnumVariable('BD', 'Have bundled router built-in for C++ test samples', 'invalid', allowed_values=('invalid', 'on', 'off'))) bd.Update(env) if 'invalid' != env['BD']: print 'BD has been replaced by BR, setting BR to ' + env['BD'] env['BR'] = env['BD'] # Validate build vars if env['OS'] == 'linux': env['OS_GROUP'] = 'posix' env['OS_CONF'] = 'linux' elif env['OS'] in ['win10', 'win7']: env['OS_GROUP'] = 'windows' env['OS_CONF'] = 'windows' elif env['OS'] == 'android': env['OS_GROUP'] = 'posix' env['OS_CONF'] = 'android' elif env['OS'] == 'darwin': env['OS_GROUP'] = 'posix' env['OS_CONF'] = 'darwin' elif env['OS'] == 'openwrt': env['OS_GROUP'] = 'posix' env['OS_CONF'] = 'openwrt' else: print 'Unsupported OS/CPU combination' if not GetOption('help'): Exit(1) if env['VARIANT'] == 'release' and env['NDEBUG'] == 'defined': env.Append(CPPDEFINES = 'NDEBUG') if env['BR'] == 'on': env.Append(CPPDEFINES = 'ROUTER') env.Append(CPPDEFINES = ['QCC_OS_GROUP_%s' % env['OS_GROUP'].upper()]) # Setup additional builders if os.path.exists('tools/scons/doxygen.py'): env.Tool('doxygen', toolpath=['tools/scons']) else: def dummy_emitter(target, source, env): return [], [] def dummy_action(target, source, env): pass dummyBuilder = Builder(action = dummy_action, emitter = dummy_emitter); env.Append(BUILDERS = {'Doxygen' : dummyBuilder}) env.Tool('genversion', toolpath=['tools/scons']) env.Tool('javadoc', toolpath=['tools/scons']) env.Tool('Csharp', toolpath=['tools/scons']) env.Tool('jsdoc3', toolpath=['tools/scons']) # Create the builder that generates Status.h from Status.xml import sys import SCons.Util sys.path.append('tools/bin') import make_status def status_emitter(target, source, env): base = SCons.Util.splitext(str(target[0]))[0] target.append(base + '.h') return target, source def status_action(target, source, env): base = os.path.dirname(os.path.dirname(SCons.Util.splitext(str(target[1]))[0])) cmdList = [] cmdList.append('--code=%s' % str(target[0])) cmdList.append('--header=%s' % str(target[1])) if env.has_key('STATUS_FLAGS'): cmdList.extend(env['STATUS_FLAGS']) cmdList.append(str(source[0])) return make_status.main(cmdList) statusBuilder = Builder(action = status_action, emitter = status_emitter, suffix = '.cc', src_suffix = '.xml') env.Append(BUILDERS = {'Status' : statusBuilder}) if env['OS'] in ['linux', 'openwrt']: env['LIBTYPE'] = 'both' else: env['LIBTYPE'] = 'static' # Read OS and CPU specific SConscript file Export('env', 'CheckCXXFlag') env.SConscript('conf/${OS_CONF}/SConscript') # Whitespace policy if env['WS'] != 'off' and not env.GetOption('clean'): import sys sys.path.append('tools/bin') import whitespace def wsbuild(target, source, env): print "Evaluating whitespace compliance..." curdir = os.path.abspath(os.path.dirname(wsbuild.func_code.co_filename)) version = whitespace.get_uncrustify_version() if (version == "0.57"): config = os.path.join(curdir, 'tools', 'conf', 'ajuncrustify.0.57.cfg') else: #use latest known version config = os.path.join(curdir, 'tools', 'conf', 'ajuncrustify.0.61.cfg') print "Config:", config print "Note: enter 'scons -h' to see whitespace (WS) options" return whitespace.main([env['WS'], config]) ws = env.Command('#/ws', Dir('$DISTDIR'), wsbuild) if env['WS'] != 'off': env.Clean(env.File('SConscript'), env.File('#/whitespace.db')) Return('env') base-16.04/build_core/conf/000077500000000000000000000000001272147170000154735ustar00rootroot00000000000000base-16.04/build_core/conf/android/000077500000000000000000000000001272147170000171135ustar00rootroot00000000000000base-16.04/build_core/conf/android/Android.mk000066400000000000000000000013421272147170000210240ustar00rootroot00000000000000include $(CLEAR_VARS) LOCAL_MODULE := aj-check include $(BUILD_SHARED_LIBRARY) $(info AJ> TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)) $(info AJ> TOOLCHAIN_PREBUILT_ROOT = $(TOOLCHAIN_PREBUILT_ROOT)) $(info AJ> CFLAGS = $(TARGET_CFLAGS) $(TARGET_NO_EXECUTE_CFLAGS)) $(info AJ> CXXFLAGS = $(TARGET_CXXFLAGS) $(TARGET_NO_EXECUTE_CFLAGS)) $(info AJ> LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NO_EXECUTE_LDFLAGS) $(TARGET_NO_UNDEFINED_LDFLAGS)) $(info AJ> INCLUDES = $(TARGET_C_INCLUDES) $(__ndk_modules.$(APP_STL).EXPORT_C_INCLUDES)) $(info AJ> debug_FLAGS = $(TARGET_$(TARGET_ARCH)_debug_CFLAGS)) $(info AJ> release_FLAGS = $(TARGET_$(TARGET_ARCH)_release_CFLAGS)) $(info AJ> SYSROOT = $(NDK_PLATFORM_$(NDK_APP_PLATFORM)_$(TARGET_ARCH)_SYSROOT)) base-16.04/build_core/conf/android/SConscript000066400000000000000000000241771272147170000211400ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os import string import subprocess import re import platform # JellyBean is API level 16 min_api_level = 16 # Minimal required NDK version min_ndk_version = "r9b" # NDK should be equal to or lower as min_api_level ndk_level = min_api_level Import('env', 'CheckCXXFlag') env['ANDROID_STL'] = 'gnustl_static' # android specific vars vars = Variables() vars.Add(PathVariable('ANDROID_SRC', 'Base directory of Android source tree', os.environ.get('ANDROID_SRC'))) vars.Add(PathVariable('ANDROID_NDK', 'Base directory of Android NDK', os.environ.get('ANDROID_NDK'))) vars.Add(PathVariable('ANDROID_SDK', 'Base directory of Android SDK', os.environ.get('ANDROID_SDK'))) vars.Add('ANDROID_TARGET', 'Target to be used for the build', os.environ.get('ANDROID_TARGET')) # java 6 related vars.Add(PathVariable('JAVA6_BOOT', 'Base directory for Java 6 bootclass', os.environ.get('JAVA6_BOOT'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if env.get('ANDROID_NDK', '') == '': print 'ANDROID_NDK variable is required' if not GetOption('help'): Exit(1) if env.get('ANDROID_SRC', '') == '' and env['CRYPTO'] == 'openssl': print 'ANDROID_SRC variable is required' if not GetOption('help'): Exit(1) if env.get('ANDROID_TARGET', '') == '': env['ANDROID_TARGET'] = 'generic' if env.get('ANDROID_SDK', '') != '': # Get the list of supported SDK platforms. # Use the latest one as compileSdkVersion (to define which android.jar to use). # It should be pretty safe always to compile with the latest one. # This should not be done for minSdkVersion or targetSdkVersion! api_levels = [ level for level in set([ int(d.split('-')[-1]) for d in os.listdir(env['ANDROID_SDK'] + '/platforms') ]) if level >= min_api_level ] api_levels.sort() vars2 = Variables() vars2.Add('ANDROID_API_LEVEL', 'Android API level', os.environ.get('ANDROID_API_LEVEL', str(api_levels[-1]))) vars2.Update(env) Help(vars2.GenerateHelpText(env)) #take ndk_level same as SDK level ndk_platform_path = env['ANDROID_NDK'] + '/platforms/android-' + str(ndk_level) if not os.path.exists(ndk_platform_path) and not GetOption('help'): print "Android NDK level not found" Exit(1) # Read NDK RELEASE.TXT and check if the version is ok ndk_release = '' with open(env['ANDROID_NDK'] + '/RELEASE.TXT', 'r') as f: ndk_release = f.read() f.closed ndk_version_required = re.match("^r(\d+)([a-z])", min_ndk_version) ndk_version_found = re.match("^r(\d+)([a-z])", ndk_release) if ndk_version_found == None or ndk_version_required == None: print "WARNING: can't parse NDK release version" else: # check if version is higher or equal to the required version. if (int(ndk_version_found.group(1)) < int(ndk_version_required.group(1)) or (int(ndk_version_found.group(1)) == int(ndk_version_required.group(1)) and ord(ndk_version_found.group(2)) < ord(ndk_version_required.group(2)))): if not GetOption('help'): print "ERROR: This Android NDK is too old. Minimal required: \"" + min_ndk_version + "\", found \"" + ndk_version_found.group(0) + "\"" Exit(1) # Override MSVC build settings when building on windows. if 'win32' == env.subst('$HOST_OS') or 'Darwin' == platform.system(): env['OBJPREFIX'] = '' env['OBJSUFFIX'] = '.o' env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '.os' # SCons uses ".os" for shared object files on Linux env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '' env['LIBPREFIX'] = 'lib' env['LIBSUFFIX'] = '.a' env['SHLIBPREFIX'] = '$LIBPREFIX' env['SHLIBSUFFIX'] = '.so' env['LIBPREFIXES'] = [ '$LIBPREFIX' ] env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] if not GetOption('help') and env.has_key('ANDROID_NDK'): abi_map = { 'arm': 'armeabi', 'mips': 'mips', 'x86': 'x86' } curdir = env.Dir('.').srcnode() if 'win32' == env.subst('$HOST_OS'): cmd_suffix = '.cmd' else: cmd_suffix = '' # Do a "test build" using ndk-build on our special Android.mk file to get # the command line options used by Android when building code. # We do not need stderr but setting it suppresses an error on Windows. tb = subprocess.Popen([ env.subst('$ANDROID_NDK/ndk-build' + cmd_suffix), 'APP_BUILD_SCRIPT=%s/Android.mk' % curdir, 'NDK_PROJECT_PATH=%s' % curdir, 'APP_ABI=%s' % abi_map[env['CPU']], 'APP_STL=%s' % env['ANDROID_STL'], 'APP_PLATFORM=android-%s' % str(ndk_level), '-n' ], stdout = subprocess.PIPE, stderr = subprocess.PIPE, universal_newlines = True) stdoutdata, stderrdata = tb.communicate() # Message the output from ndk-build into a dictionary. settings = dict( [ map(string.strip, line[4:].split('=', 1)) for line in stdoutdata.split('\n') if line.startswith('AJ> ') ] ) # Some versions of the Android NDK leave out # .../gnu-libstdc++//include/backward include path so we need # to add it if it is missing. Also need to figure out where the STL # library lives. stl_lib_path = '' inc_paths = map(string.strip, settings['INCLUDES'].split()) for ip in inc_paths: bpath = ip + '/backward' if bpath not in inc_paths and os.path.exists(bpath): # Get the "backward" include path inc_paths.append(bpath) if '/libs/' in ip: # Get the STL library path stl_lib_path = os.path.split(ip)[0] path = settings['TOOLCHAIN_PREBUILT_ROOT'] + '/bin' prefix = settings['TOOLCHAIN_PREFIX'][len(path) + 1:] env['AR'] = prefix + 'ar' env['CC'] = prefix + 'gcc' env['CXX'] = prefix + 'g++' env['LINK'] = prefix + 'gcc' env['RANLIB'] = prefix + 'ranlib' env.PrependENVPath('PATH', path) env.Append(CPPPATH = inc_paths) env.AppendUnique(CFLAGS = settings['CFLAGS'].split()) env.AppendUnique(CXXFLAGS = settings['CXXFLAGS'].split()) env.AppendUnique(LINKFLAGS = settings['LDFLAGS'].split()) vflags = [f for f in settings[env['VARIANT'] + '_FLAGS'].split() if (f != '-g' and f != '-DNDEBUG' and f != '-UNDEBUG' and not f.startswith('-O'))] env.MergeFlags(vflags) env.Append(LIBPATH = [ settings['SYSROOT'] + '/usr/lib', stl_lib_path ]) env.Append(LINKFLAGS = [ '--sysroot=' + settings['SYSROOT'], '-Wl,-rpath-link=' + settings['SYSROOT'] + '/usr/lib' ]) if env['CRYPTO'] == 'openssl': # Get OpenSSL from Android source. env.Append(CPPPATH = '$ANDROID_SRC/external/openssl/include') env.Append(LIBPATH = '$ANDROID_SRC/out/target/product/$ANDROID_TARGET/system/lib') env.Append(CPPDEFINES = 'QCC_OS_ANDROID') config = Configure(env, custom_tests = { 'CheckCXXFlag' : CheckCXXFlag }) if not config.CheckCXXFlag('-std=c++11'): if not config.CheckCXXFlag('-std=c++0x'): print '*** Compiler too old to build AllJoyn. Aborting.' Exit(1) env = config.Finish() env.Append(CFLAGS = ['-Wall', '-pipe', '-Wno-long-long', '-Wno-deprecated', '-Wno-unknown-pragmas', '-pie', '-fPIE']) env.Append(CXXFLAGS = ['-Wall', '-pipe', '-Wno-long-long', '-Wno-deprecated', '-Wno-unknown-pragmas', '-pie', '-fPIE']) env.Append(LINKFLAGS = ['-Wl,--gc-sections', '-Wl,-z,nocopyreloc', '-pie', '-fPIE']) # Java 6 compile options java6Flags = '-source 1.6 -target 1.6 ' # bootclasspath for java 6 java6BootClassOption = '-bootclasspath ' java6BootPath = env.get('JAVA6_BOOT', '') # Use default java6 bootclass path if JAVA6_BOOT not set if java6BootPath == '': java6BootPath = '/usr/lib/jvm/java-6-sun/jre/lib/' elif not java6BootPath.endswith('/'): java6BootPath = java6BootPath + '/' java6BootClassJar = 'rt.jar' # Add bootclasspath compile option if java6 rt.jar exist if FindFile(java6BootClassJar, java6BootPath): java6Boot = java6BootClassOption + java6BootPath + java6BootClassJar java6Flags = java6Flags + java6Boot # Debug/Release variants if env['VARIANT'] == 'debug': env.Append(CFLAGS = ['-O0', '-g']) env.Append(CXXFLAGS = ['-O0', '-g']) env.Append(JAVACFLAGS='-g -Xlint -Xlint:-serial ' + java6Flags) else: env.Append(CFLAGS = '-Os') env.Append(CXXFLAGS = '-Os') env.Append(LINKFLAGS='-s') env.Append(JAVACFLAGS='-Xlint -Xlint:-serial ' + java6Flags) env.SConscript('${CPU}/SConscript') env.AppendUnique(LIBS = ['m', 'c', 'stdc++', 'log', 'gcc', '$ANDROID_STL']) if env['CRYPTO'] == 'openssl': env.AppendUnique(LIBS =['crypto']) print 'Using OpenSSL crypto' elif env['CRYPTO'] == 'builtin': print 'Using builtin crypto' else: print 'Only CRYPTO=builtin or CRYPTO=openssl are supported for Android.' Exit(1) base-16.04/build_core/conf/android/arm/000077500000000000000000000000001272147170000176725ustar00rootroot00000000000000base-16.04/build_core/conf/android/arm/SConscript000066400000000000000000000015701272147170000217070ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') # Arm specific flags env.Append(LINKFLAGS = '-Wl,--fix-cortex-a8') base-16.04/build_core/conf/android/x86/000077500000000000000000000000001272147170000175405ustar00rootroot00000000000000base-16.04/build_core/conf/android/x86/SConscript000066400000000000000000000015331272147170000215540ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os Import('env') # x86 specific compiler flags base-16.04/build_core/conf/darwin/000077500000000000000000000000001272147170000167575ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/SConscript000066400000000000000000000056271272147170000210030ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env', 'CheckCXXFlag') import os # Darwin specific flags env.Append(CPPDEFINES=['QCC_OS_DARWIN']) config = Configure(env, custom_tests = { 'CheckCXXFlag' : CheckCXXFlag }) if not config.CheckCXXFlag('-std=c++11'): if not config.CheckCXXFlag('-std=c++0x'): print '*** Compiler too old to build AllJoyn. Aborting.' Exit(1) env = config.Finish() env.Append(CFLAGS=['-Wall', '-pipe', '-std=c99', '-fno-strict-aliasing', '-Wno-long-long']) env.Append(CXXFLAGS=['-Wall', '-Werror=non-virtual-dtor', '-pipe', '-fno-exceptions', '-fno-strict-aliasing', '-Wno-deprecated']) # Debug/Release Variants if env['VARIANT'] == 'debug': env.Append(CFLAGS='-g') env.Append(CXXFLAGS='-g') env.Append(JAVACFLAGS='-g -Xlint -Xlint:-serial') print 'Using debug settings for darwin build...' else: env.Append(CFLAGS='-O3') env.Append(CXXFLAGS='-O3') env.Append(LINKFLAGS='') env.Append(JAVACFLAGS='-Xlint -Xlint:-serial') print 'Using release settings for darwin build...' env.SConscript('${CPU}/SConscript') env.Append(CPPDEFINES=['MECHANISM_PIPE']) env.AppendUnique(LIBS =['stdc++', 'pthread']) if env['CRYPTO'] == 'openssl': env.AppendUnique(LIBS =['crypto', 'ssl']) if env['CPU'] in ['arm', 'armv7', 'armv7s', 'arm64']: vars = Variables() vars.Add(PathVariable('OPENSSL_ROOT', 'Base OpenSSL directory (darwin only)', os.environ.get('OPENSSL_ROOT'))) vars.Update(env) Help(vars.GenerateHelpText(env)) if '' == env.subst('$OPENSSL_ROOT'): # Must specify OPENSSL_ROOT for darwin, arm print 'Must specify OPENSSL_ROOT when building for OS=darwin, CPU=arm' if not GetOption('help'): Exit(1) env.Append(CPPPATH = ['$OPENSSL_ROOT/include']) env.Append(LIBPATH = ['$OPENSSL_ROOT/build/' + os.environ.get('CONFIGURATION') + '-' + os.environ.get('PLATFORM_NAME')]) print 'Using OpenSSL crypto' else: print 'Using builtin crypto' base-16.04/build_core/conf/darwin/arm/000077500000000000000000000000001272147170000175365ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/arm/SConscript000066400000000000000000000101571272147170000215540ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os vars = Variables() vars.Add(PathVariable('SDKROOT', ' Base directory of Mac/iOS SDK for target', os.environ.get('SDKROOT'))) vars.Add(PathVariable('SYSTEM_DEVELOPER_DIR', ' Base directory for developer tools', os.environ.get('SYSTEM_DEVELOPER_DIR'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if '' == env.subst('$SDKROOT'): print 'SDKROOT variable is required' if not GetOption('help'): Exit(1) if '' == env.subst('$SYSTEM_DEVELOPER_DIR'): env['SYSTEM_DEVELOPER_DIR'] = '/Developer' # Darwin on ARM (aka. iOS) specific defines env.Append(CPPDEFINES=['QCC_OS_IPHONE']) s = os.environ.get('CONFIGURATION') s = s.lower() env['OBJDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/obj' env['DISTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/dist' env['TESTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/test' env['IPHONEOS_PLATFORM_DIR'] = '$SYSTEM_DEVELOPER_DIR/Platforms/iPhoneOS.platform' env['PATH'] = '$DT_TOOLCHAIN_DIR/usr/bin:$IPHONE_OS_PLATFORM_DIR/Developer/usr/bin:$SYSTEM_DEVELOPER_DIR/usr/bin:$PATH' env['CC'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang' env['CXX'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang++' env.Append(CFLAGS=[ '-fdiagnostics-show-category=id', '-fdiagnostics-parseable-fixits', '-fpascal-strings', '-Wreturn-type', '-Wparentheses', '-Wswitch', '-Wno-unused-parameter', '-Wunused-variable', '-Wunused-value']) env.Append(CXXFLAGS=[ '-fno-rtti', '-fno-exceptions', '-Wc++11-extensions']) if os.environ.get('PLATFORM_NAME') == 'iphonesimulator': print 'Using flags for iOS simulator...' env.Append(CPPDEFINES=['QCC_OS_IPHONE_SIMULATOR']) print env['VARIANT'] if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' else: print 'Using flags for iOS devices (arm - defaulting to armv7)...' if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'armv7', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'armv7', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' ld = [ '-framework', 'SystemConfiguration', '-framework', 'Foundation' ] env.Append(CXXFLAGS=ccld) env.Append(CFLAGS=ccld) env.Append(LINKFLAGS=ccld) env.Append(LINKFLAGS=ld) base-16.04/build_core/conf/darwin/arm64/000077500000000000000000000000001272147170000177105ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/arm64/SConscript000066400000000000000000000100501272147170000217160ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os vars = Variables() vars.Add(PathVariable('SDKROOT', ' Base directory of Mac/iOS SDK for target', os.environ.get('SDKROOT'))) vars.Add(PathVariable('SYSTEM_DEVELOPER_DIR', ' Base directory for developer tools', os.environ.get('SYSTEM_DEVELOPER_DIR'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if '' == env.subst('$SDKROOT'): print 'SDKROOT variable is required' if not GetOption('help'): Exit(1) if '' == env.subst('$SYSTEM_DEVELOPER_DIR'): env['SYSTEM_DEVELOPER_DIR'] = '/Developer' # Darwin on ARM (aka. iOS) specific defines env.Append(CPPDEFINES=['QCC_OS_IPHONE']) s = os.environ.get('CONFIGURATION') s = s.lower() env['OBJDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/obj' env['DISTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/dist' env['TESTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/test' env['IPHONEOS_PLATFORM_DIR'] = '$SYSTEM_DEVELOPER_DIR/Platforms/iPhoneOS.platform' env['PATH'] = '$DT_TOOLCHAIN_DIR/usr/bin:$IPHONE_OS_PLATFORM_DIR/Developer/usr/bin:$SYSTEM_DEVELOPER_DIR/usr/bin:$PATH' env['CC'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang' env['CXX'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang++' env.Append(CFLAGS=[ '-fdiagnostics-show-category=id', '-fdiagnostics-parseable-fixits', '-fpascal-strings', '-Wreturn-type', '-Wparentheses', '-Wswitch', '-Wno-unused-parameter', '-Wunused-variable', '-Wunused-value']) env.Append(CXXFLAGS=[ '-fno-rtti', '-fno-exceptions', '-Wc++11-extensions']) if os.environ.get('PLATFORM_NAME') == 'iphonesimulator': print 'Using flags for iOS simulator...' env.Append(CPPDEFINES=['QCC_OS_IPHONE_SIMULATOR']) print env['VARIANT'] if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' else: print 'Using flags for iOS devices (arm64)...' if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'arm64', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'arm64', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' ld = [ '-framework', 'SystemConfiguration', '-framework', 'Foundation' ] env.Append(CXXFLAGS=ccld) env.Append(CFLAGS=ccld) env.Append(LINKFLAGS=ccld) env.Append(LINKFLAGS=ld) base-16.04/build_core/conf/darwin/armv7/000077500000000000000000000000001272147170000200135ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/armv7/SConscript000066400000000000000000000101331272147170000220230ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os vars = Variables() vars.Add(PathVariable('SDKROOT', ' Base directory of Mac/iOS SDK for target', os.environ.get('SDKROOT'))) vars.Add(PathVariable('SYSTEM_DEVELOPER_DIR', ' Base directory for developer tools', os.environ.get('SYSTEM_DEVELOPER_DIR'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if '' == env.subst('$SDKROOT'): print 'SDKROOT variable is required' if not GetOption('help'): Exit(1) if '' == env.subst('$SYSTEM_DEVELOPER_DIR'): env['SYSTEM_DEVELOPER_DIR'] = '/Developer' # Darwin on ARM (aka. iOS) specific defines env.Append(CPPDEFINES=['QCC_OS_IPHONE']) s = os.environ.get('CONFIGURATION') s = s.lower() env['OBJDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/obj' env['DISTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/dist' env['TESTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/test' env['IPHONEOS_PLATFORM_DIR'] = '$SYSTEM_DEVELOPER_DIR/Platforms/iPhoneOS.platform' env['PATH'] = '$DT_TOOLCHAIN_DIR/usr/bin:$IPHONE_OS_PLATFORM_DIR/Developer/usr/bin:$SYSTEM_DEVELOPER_DIR/usr/bin:$PATH' env['CC'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang' env['CXX'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang++' env.Append(CFLAGS=[ '-fdiagnostics-show-category=id', '-fdiagnostics-parseable-fixits', '-fpascal-strings', '-Wreturn-type', '-Wparentheses', '-Wswitch', '-Wno-unused-parameter', '-Wunused-variable', '-Wunused-value']) env.Append(CXXFLAGS=[ '-fno-rtti', '-fno-exceptions', '-Wc++11-extensions']) if os.environ.get('PLATFORM_NAME') == 'iphonesimulator': print 'Using flags for iOS simulator...' env.Append(CPPDEFINES=['QCC_OS_IPHONE_SIMULATOR']) print env['VARIANT'] if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'i686', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' else: print 'Using flags for iOS devices (armv7)...' if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'armv7', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'armv7', '-miphoneos-version-min=9.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=90000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' ld = [ '-framework', 'SystemConfiguration', '-framework', 'Foundation' ] env.Append(CXXFLAGS=ccld) env.Append(CFLAGS=ccld) env.Append(LINKFLAGS=ccld) env.Append(LINKFLAGS=ld) base-16.04/build_core/conf/darwin/armv7s/000077500000000000000000000000001272147170000201765ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/armv7s/SConscript000066400000000000000000000101341272147170000222070ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os vars = Variables() vars.Add(PathVariable('SDKROOT', ' Base directory of Mac/iOS SDK for target', os.environ.get('SDKROOT'))) vars.Add(PathVariable('SYSTEM_DEVELOPER_DIR', ' Base directory for developer tools', os.environ.get('SYSTEM_DEVELOPER_DIR'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if '' == env.subst('$SDKROOT'): print 'SDKROOT variable is required' if not GetOption('help'): Exit(1) if '' == env.subst('$SYSTEM_DEVELOPER_DIR'): env['SYSTEM_DEVELOPER_DIR'] = '/Developer' # Darwin on ARM (aka. iOS) specific defines env.Append(CPPDEFINES=['QCC_OS_IPHONE']) s = os.environ.get('CONFIGURATION') s = s.lower() env['OBJDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/obj' env['DISTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/dist' env['TESTDIR'] = '#build/${OS}/${CPU}/' + os.environ.get('PLATFORM_NAME') + '/' + s + '/test' env['IPHONEOS_PLATFORM_DIR'] = '$SYSTEM_DEVELOPER_DIR/Platforms/iPhoneOS.platform' env['PATH'] = '$DT_TOOLCHAIN_DIR/usr/bin:$IPHONE_OS_PLATFORM_DIR/Developer/usr/bin:$SYSTEM_DEVELOPER_DIR/usr/bin:$PATH' env['CC'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang' env['CXX'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang++' env.Append(CFLAGS=[ '-fdiagnostics-show-category=id', '-fdiagnostics-parseable-fixits', '-fpascal-strings', '-Wreturn-type', '-Wparentheses', '-Wswitch', '-Wno-unused-parameter', '-Wunused-variable', '-Wunused-value']) env.Append(CXXFLAGS=[ '-fno-rtti', '-fno-exceptions', '-Wc++11-extensions']) if os.environ.get('PLATFORM_NAME') == 'iphonesimulator': print 'Using flags for iOS simulator...' env.Append(CPPDEFINES=['QCC_OS_IPHONE_SIMULATOR']) print env['VARIANT'] if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'i686', '-miphoneos-version-min=6.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=60000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'i686', '-miphoneos-version-min=6.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=60000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' else: print 'Using flags for iOS devices (armv7s)...' if env['VARIANT'] == 'debug': ccld = [ '-g', '-arch', 'arm64', '-miphoneos-version-min=8.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=60000', '-isysroot', '$SDKROOT' ] print 'Using iOS debug configuration' else: ccld = [ '-arch', 'arm64', '-miphoneos-version-min=8.0', '-D__IPHONE_OS_VERSION_MIN_REQUIRED=60000', '-isysroot', '$SDKROOT' ] print 'Using iOS release configuration' ld = [ '-framework', 'SystemConfiguration', '-framework', 'Foundation' ] env.Append(CXXFLAGS=ccld) env.Append(CFLAGS=ccld) env.Append(LINKFLAGS=ccld) env.Append(LINKFLAGS=ld) base-16.04/build_core/conf/darwin/x86/000077500000000000000000000000001272147170000174045ustar00rootroot00000000000000base-16.04/build_core/conf/darwin/x86/SConscript000066400000000000000000000052231272147170000214200ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os s = os.environ.get('CONFIGURATION') #Command line does not pass CONFIGURATION variable to SConscript,this uses the #VARIANT which will be either debug or release. Left 'CONFIGURATION' in place to #avoid breaking anything if None is s: s = env['VARIANT'] s = s.lower() env['OBJDIR'] = '#build/${OS}/${CPU}/' + s + '/obj' env['DISTDIR'] = '#build/${OS}/${CPU}/' + s + '/dist' env['TESTDIR'] = '#build/${OS}/${CPU}/' + s + '/test' vars = Variables() vars.Add(PathVariable('SDKROOT', ' Base directory of Mac/iOS SDK for target', os.environ.get('SDKROOT'))) vars.Add(PathVariable('SYSTEM_DEVELOPER_DIR', ' Base directory for developer tools', os.environ.get('SYSTEM_DEVELOPER_DIR'))) vars.Update(env) Help(vars.GenerateHelpText(env)) # Verify dependencies if '' == env.subst('$SDKROOT'): print 'SDKROOT variable is required' if not GetOption('help'): Exit(1) if '' == env.subst('$SYSTEM_DEVELOPER_DIR'): env['SYSTEM_DEVELOPER_DIR'] = '/Developer' # Darwing specific flags env['IPHONEOS_PLATFORM_DIR'] = '$SYSTEM_DEVELOPER_DIR/Platforms/iPhoneOS.platform' env['PATH'] = '$IPHONE_OS_PLATFORM_DIR/Developer/usr/bin:$SYSTEM_DEVELOPER_DIR/usr/bin:$PATH' env['CC'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang' env['CXX'] = '$DT_TOOLCHAIN_DIR/usr/bin/clang++' env.Append(CFLAGS=[ '-fdiagnostics-show-category=id', '-fdiagnostics-parseable-fixits', '-fpascal-strings', '-Wreturn-type', '-Wparentheses', '-Wswitch', '-Wno-unused-parameter', '-Wunused-variable', '-Wunused-value']) env.Append(CXXFLAGS=[ '-fno-rtti', '-fno-exceptions', '-Wc++11-extensions']) ccld = ['-arch', 'i386', '-arch', 'x86_64', '-mmacosx-version-min=10.9'] env.Append(CXXFLAGS=ccld) env.Append(CFLAGS=ccld) env.Append(LINKFLAGS=ccld) base-16.04/build_core/conf/linux/000077500000000000000000000000001272147170000166325ustar00rootroot00000000000000base-16.04/build_core/conf/linux/SConscript000066400000000000000000000066451272147170000206570ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env', 'CheckCXXFlag') import os # Linux specific vars vars = Variables() vars.Add(BoolVariable('GCOV', 'Compile with gcov support', 'no')) vars.Add(BoolVariable('ASAN', 'Enable Address Sanitizer runtime checks', 'no')) vars.Update(env) Help(vars.GenerateHelpText(env)) config = Configure(env, custom_tests = { 'CheckCXXFlag' : CheckCXXFlag }) if not config.CheckCXXFlag('-std=c++11'): if not config.CheckCXXFlag('-std=c++0x'): print '*** Compiler too old to build AllJoyn. Aborting.' Exit(1) env = config.Finish() # Linux specific flags env.Append(CPPDEFINES = ['QCC_OS_LINUX']) env.Append(CPPDEFINES = ['_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC']) env.Append(CFLAGS = ['-Wall', '-Werror', '-pipe', '-std=c99', '-fno-strict-aliasing', '-fno-asynchronous-unwind-tables', '-fno-unwind-tables', '-ffunction-sections', '-fdata-sections', '-Wno-long-long', '-Wunused-parameter']) env.Append(CXXFLAGS = ['-Wall', '-Werror', '-pipe', '-fno-exceptions', '-fno-strict-aliasing', '-fno-asynchronous-unwind-tables', '-fno-unwind-tables', '-ffunction-sections', '-fdata-sections', '-Wno-long-long', '-Wno-deprecated', '-Wno-unknown-pragmas', '-Wunused-parameter']) env.Append(JAVACFLAGS = ['-Xlint', '-Xlint:-serial']) # Debug/Release Variants if env['VARIANT'] == 'debug': env.Append(CFLAGS = '-g') env.Append(CXXFLAGS = '-g') env.Append(JAVACFLAGS = '-g') env.Append(CPPDEFINES = ['_GLIBCXX_DEBUG', '_GLIBCXX_DEBUG_PEDANTIC']) else: env.Append(CFLAGS = '-Os') env.Append(CXXFLAGS = '-Os') env.Append(LINKFLAGS = ['-s', '-Wl,--gc-sections']) # Code coverage control if env['GCOV']: env.Append(CCFLAGS = ['-fprofile-arcs', '-ftest-coverage']) env.Append(LIBS = ['gcov']) # Address sanitizer control if env['ASAN']: env.Append(CFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=address']) env.Append(CXXFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=address']) env.Append(LINKFLAGS = '-fsanitize=address') env.SConscript('${CPU}/SConscript') env.AppendUnique(LIBS =['rt', 'stdc++', 'pthread', 'm']) if env['CRYPTO'] == 'openssl': env.AppendUnique(LIBS =['crypto', 'ssl']) print 'Using OpenSSL crypto' else: print 'Using builtin crypto' base-16.04/build_core/conf/linux/arm/000077500000000000000000000000001272147170000174115ustar00rootroot00000000000000base-16.04/build_core/conf/linux/arm/SConscript000066400000000000000000000026721272147170000214320ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') import os # Linux specific flags env.Append(CPPFLAGS=['-march=armv6', '-mthumb-interwork']) # Use the OpenEmbedded cross-compilation environment vars = Variables() vars.Add('CROSS_COMPILE', 'Cross compile toolchain prefix', os.environ.get('CROSS_COMPILE')) vars.Update(env) Help(vars.GenerateHelpText(env)) # Use common CROSS_COMPILE prefix if '' == env.subst('$CROSS_COMPILE'): print 'CROSS_COMPILE variable is required for Linux/ARM builds' if not GetOption('help'): Exit(1) env['CC'] = env['CROSS_COMPILE'] + 'gcc' env['CXX'] = env['CROSS_COMPILE'] + 'g++' env['LINK'] = env['CROSS_COMPILE'] + 'gcc' base-16.04/build_core/conf/linux/x86/000077500000000000000000000000001272147170000172575ustar00rootroot00000000000000base-16.04/build_core/conf/linux/x86/SConscript000066400000000000000000000016761272147170000213030ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') # Linux specific flags # Force 32-bit builds env.Append(CXXFLAGS=['-m32']) env.Append(CFLAGS=['-m32']) env.Append(LINKFLAGS=['-m32']) base-16.04/build_core/conf/linux/x86_64/000077500000000000000000000000001272147170000175705ustar00rootroot00000000000000base-16.04/build_core/conf/linux/x86_64/SConscript000066400000000000000000000026211272147170000216030ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Import('env') vars = Variables() vars.Add(BoolVariable('TSAN', 'Enable Thread Sanitizer runtime checks', 'no')) vars.Update(env) # Linux specific flags # Force 64-bit builds env.Append(CXXFLAGS=['-m64', '-fPIC']) env.Append(CFLAGS=['-m64', '-fPIC']) env.Append(LINKFLAGS=['-m64']) # Thread sanitizer control if env['TSAN']: env.Append(CFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=thread', '-fPIE']) env.Append(CXXFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=thread', '-fPIE']) env.Append(LINKFLAGS = ['-fsanitize=thread', '-pie']) if env['CXX'] != 'clang': env.AppendUnique(LIBS = ['tsan']) base-16.04/build_core/conf/openwrt/000077500000000000000000000000001272147170000171715ustar00rootroot00000000000000base-16.04/build_core/conf/openwrt/SConscript000066400000000000000000000071641272147170000212130ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os import platform Import('env', 'CheckCXXFlag') if platform.system() == 'Darwin': # De-Mac-ify a couple of the envrionment variables. env.Replace(SHLIBSUFFIX='.so') env.Replace(SHLINKFLAGS=['$LINKFLAGS', '-shared']) # OpenWRT specific vars vars = Variables() vars.Add('TARGET_PATH', 'Paths to toolchain for cross compiling AllJoyn for OpenWRT', os.environ.get('TARGET_PATH')) vars.Add('TARGET_CC', 'OpenWRT C compiler', os.environ.get('TARGET_CC')) vars.Add('TARGET_CFLAGS', 'OpenWRT C compiler flags', os.environ.get('TARGET_CFLAGS')) vars.Add('TARGET_CPPFLAGS', 'OpenWRT C pre-processor compiler flags', os.environ.get('TARGET_CPPFLAGS')) vars.Add('TARGET_CXX', 'OpenWRT C++ compiler', os.environ.get('TARGET_CXX')) vars.Add('TARGET_LINK', 'OpenWRT Linker', os.environ.get('TARGET_CC')) # Normally use the C compiler for linking. vars.Add('TARGET_LINKFLAGS', 'OpenWRT Linker flags', os.environ.get('TARGET_LDFLAGS')) vars.Add('TARGET_AR', 'OpenWRT Archiver', os.environ.get('TARGET_AR')) vars.Add('TARGET_RANLIB', 'OpenWRT Archive Indexer', os.environ.get('TARGET_RANLIB')) vars.Add('STAGING_DIR', 'OpenWRT staging dir', os.environ.get('STAGING_DIR')) vars.Update(env) Help(vars.GenerateHelpText(env)) # Get the compiler flags OpenWrt requires. flags = env.ParseFlags(' '.join([env['TARGET_CFLAGS'], env['TARGET_CPPFLAGS'], env['TARGET_LINKFLAGS']])) # Put OpenWrt build paths in environment varaibles so GCC will search those # paths after paths specified with -I and -L. env['ENV']['CPATH']=':'.join(flags['CPPPATH']) env['ENV']['LIBRARY_PATH']=':'.join(flags['LIBPATH']) # Clear out the CPPPATH and LIBPATH values so that we can merge the rest of # the flags with the SCons build environment. flags['CPPPATH'] = [] flags['LIBPATH'] = [] # Merge the rest of the compiler flags env.MergeFlags(flags) # Set compiler and linker commands. env.Replace(CC = env['TARGET_CC']) env.Replace(CXX = env['TARGET_CXX']) env.Replace(LINK = env['TARGET_LINK']) env.Replace(AR = env['TARGET_AR']) env.Replace(RANLIB = env['TARGET_RANLIB']) env['ENV']['PATH'] = env['TARGET_PATH'] env['ENV']['STAGING_DIR'] = env['STAGING_DIR'] config = Configure(env, custom_tests = { 'CheckCXXFlag' : CheckCXXFlag }) if not config.CheckCXXFlag('-std=c++11'): if not config.CheckCXXFlag('-std=c++0x'): print '*** Compiler too old to build AllJoyn. Aborting.' Exit(1) env = config.Finish() # Set Project and platform flags. env.Append(CPPFLAGS=['-Wno-deprecated']) # AllJoyn uses various deprecated template classes (i.e., hash_map) env.Append(CXXFLAGS=['-fno-exceptions']) env.Append(CPPDEFINES=['QCC_OS_LINUX']) env.Append(LIBS=['m']) # STL needs libm on OpenWrt env.AppendUnique(LIBS =['rt', 'stdc++', 'pthread', 'm']) if env['CRYPTO'] == 'openssl': env.AppendUnique(LIBS =['crypto', 'ssl']) print 'Using OpenSSL crypto' else: print 'Using builtin crypto' base-16.04/build_core/conf/windows/000077500000000000000000000000001272147170000171655ustar00rootroot00000000000000base-16.04/build_core/conf/windows/SConscript000066400000000000000000000231071272147170000212020ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os Import('env') # Set up TMP env['ENV']['TMP'] = os.environ['TMP'] # MSVC version 8 and higher require a manifest if env['MSVC_VERSION'] >= '8.0': # Add a post-build step to embed the manifest using mt.exe # The number at the end of the line indicates the file type (1: EXE; 2:DLL). env.Append(LINKCOM=[env['LINKCOM'], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']) env.Append(SHLINKCOM=[env['SHLINKCOM'], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2']) # Windows specific compiler flags env.Append(CPPDEFINES=['UNICODE', '_UNICODE', 'WIN32_LEAN_AND_MEAN', ('_VARIADIC_MAX','10')]) # Visual Studio compiler complains that functions like strncpy are unsafe. We # are aware that its possible to create a non-nul terminated string using the # strncpy function. However, we cannot use the strncpy_s functions as VC++ # suggests. Our code must work with a lot of different compilers so we cannot # use compiler specific code like strncpy_s. This will prevent visual studio # from giving errors we cannot do anything about. env.Append(CPPDEFINES=['_CRT_SECURE_NO_WARNINGS']) # Set the OS version number. The compiler would complain if the SDK public header # values were different from the values defined below. env.Append(CPPDEFINES=[('_WIN32_WINNT_WIN7', '0x0601')]) env.Append(CPPDEFINES=[('_WIN32_WINNT_WIN8', '0x0602')]) env.Append(CPPDEFINES=[('_WIN32_WINNT_WINBLUE', '0x0603')]) env.Append(CPPDEFINES=[('_WIN32_WINNT_WIN10', '0x0A00')]) if env['OS'] == 'win10': # Scons versions older than 2.4 are trying to use Windows SDK 8.1, but SDK 10 is required for Win10 targets EnsureSConsVersion(2, 4) env.Append(CPPDEFINES=[('_WIN32_WINNT', '_WIN32_WINNT_WIN10')]) elif env['OS'] == 'win7': env.Append(CPPDEFINES=[('_WIN32_WINNT', '_WIN32_WINNT_WIN7')]) else: print 'Error: Unknown Windows OS type: ' + env['OS'] Exit(1) #Suppress specific warnings # C4244 'conversion' conversion from one type to another type results in a possible # loss of data. In AllJoyn code this occures most often when we convert a # socket file descriptor to an int. It may be worth while to investigate # warnings of this type but for now we are going to suppress them. # C4267 Conversion from size_t to another type. We get this because we often change # size_t to another value when we iterate though arrays. Although its possible # to cause issues we are going to suppress these warnings. # C4345 warning specifying that the later versions of MSVC initialize POD types # (Plan Old Data) This warning is designed to inform users that the behavior # changed from older compilers. This warning is only encountered by # common/src/String.cc and does not effect AllJoyn. # see http://msdn.microsoft.com/en-us/library/wewb47ee.aspx # C4355 "'this' used in base member initializer list"' Depending on the version of # the MSVC compiler this warning may or may not be shut off by default. # http://msdn.microsoft.com/en-us/library/3c594ae3.aspx # C4800 warning forcing value to 'true' or 'false'. This warning is produced when # a value is changed from an int or a pointer to a bool. Usage of code that # does it is common in AllJoyn. We often check to see if a pointer is NULL # by checking if( ptr) This also is a common problem in the language bindings # with things like QCC_BOOL and jboolean being defined as integers. For this # reason we are choosing to suppress this particular warning. # C4351 "new behavior: elements of array 'array' will be default initialized" # This warning is triggered when we initialize the guid array in the GUID128() # constructor. We intentionally want to initialize this array, so this behavior # change warning can safely be disabled. # C4146 "unary minus operator applied to unsigned type, result still unsigned" # The warning is triggered by the monty_rho() function in BigNum.cc when it # negates an unsigned value before truncating it to uint32_t. This is an # intentional part of the algorithm so the warning can be suppressed. # C4456 "declaration of 'foo' hides previous local declaration" # This warning (treated as an error) is produced when a local variable # is redefined multiple times under the same parent scope. # C4457 "declaration of 'foo' hides function parameter" # This warning (treated as an error) is produced when a function parameter # name is duplicated in the function body by a local variable named the same. # C4458 "declaration of 'foo' hides class member" # This warning (treated as an error) is produced when a class data member # name is duplicated in a class member method via an argument with the # same type and name and/or a local variable of the same. To avoid this # warning it is best to prefix data member names with "m_". env.Append(CXXFLAGS=['/wd4244', '/wd4267','/wd4345', '/wd4355', '/wd4800', '/wd4351', '/wd4146', '/wd4456', '/wd4457', '/wd4458']) env.Append(CFLAGS=['/nologo']) env.Append(CXXFLAGS=['/nologo']) env.Append(CFLAGS=['/EHsc']) env.Append(CXXFLAGS=['/EHsc']) # Enabling __stdcall calling convention on x86 results in smaller output EXE # files. This calling convention is also used by typical Windows APIs. if env['CPU'] == 'x86': env.Append(CFLAGS=['/Gz']) env.Append(CXXFLAGS=['/Gz']) # Lib setup env.Append(LFLAGS=['/NODEFAULTLIB:libcmt.lib']) env.Append(LINKFLAGS=['/NODEFAULTLIB:libcmt.lib']) # With a modern Microsoft compiler it is typical to use a pdb file i.e. the /Zi # or/ZI CCPDBFLAGS. However in SCons a pdb file is created for each .obj file. # To be able to use the debug information we would have to copy all of the # pdb files (one for each C++ file) into the dist. SCons documentation recommends # using the /Z7 option to solve this problem. Since another more acceptable # solution has not yet been found we are going with the recommendation from the # SCons documentation. env['CCPDBFLAGS'] = '/Z7' env['PDB'] = '${TARGET.base}.pdb' env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb']) # Debug/Release variants if env['VARIANT'] == 'debug': # MSVC 2010 an newer require _ITERATOR_DEBUG_LEVEL specified to specify # _ITERATOR_DEBUG_LEVEL _DEBUG must also be specified. If _DEBUG is also # specified then the debug version of the multithread and run-time routines # (/MDd') to prevent build errors. env.Append(CPPDEFINES=['_DEBUG', ('_ITERATOR_DEBUG_LEVEL', 2)]) env.Append(CFLAGS=['/MDd', '/Od']) env.Append(CXXFLAGS=['/MDd', '/Od', '/Ob1', '/W4', '/WX']) env.Append(LINKFLAGS=['/debug']) env.Append(JAVACFLAGS='-g -Xlint -Xlint:-serial') else: # MSVC 2010 and newer require _ITERATOR_DEBUG_LEVEL specified env.Append(CPPDEFINES=[('_ITERATOR_DEBUG_LEVEL', 0)]) env.Append(CFLAGS=['/MD', '/Gy', '/O1', '/Ob2']) env.Append(CXXFLAGS=['/MD', '/Gy', '/O1', '/Ob2', '/W4', '/WX']) env.Append(LINKFLAGS=['/opt:ref']) env.Append(JAVACFLAGS='-Xlint -Xlint:-serial') vars = Variables() vars.Add(PathVariable('OPENSSL_BASE', 'Base OpenSSL directory (windows only)', os.environ.get('OPENSSL_BASE'))) vars.Update(env) Help(vars.GenerateHelpText(env)) env.AppendUnique(LIBS = ['setupapi', 'user32', 'winmm', 'ws2_32', 'iphlpapi', 'secur32', 'Advapi32']) if env['OS'] == 'win10': env.AppendUnique(LIBS = ['msajapi']) if env['CRYPTO'] == 'cng': env.AppendUnique(LIBS = ['bcrypt', 'ncrypt', 'crypt32']) env.Append(CPPDEFINES=['CRYPTO_CNG']) print 'Using CNG crypto libraries' elif env['CRYPTO'] == 'openssl': env.Append(CPPPATH = ['$OPENSSL_BASE/include']) env.Append(LIBPATH = ['$OPENSSL_BASE/lib']) env.AppendUnique(LIBS = ['libeay32']) print 'Using OpenSSL crypto libraries' else: print 'Only CRYPTO=cng or CRYPTO=openssl are supported for Windows.' Exit(1) # Archive expander def archive_expand(target, source, env): # Copy sources to targets outdir = env.subst(os.path.dirname(str(target[0]))) for archive in source: Copy(outdir, str(archive)) return None def archive_expand_emitter(target, source, env): # target starts out as phony file in the desired output directory # target ends up being the list of copied libraries outdir = env.subst(os.path.dirname(str(target[0]))) modTargets = [] for archive in source: modTargets.append(File(outdir+os.path.sep+os.path.basename(str(archive)))) return modTargets, source # Override _LocalEndpoint::Dispatcher's 'maxAlarms' values (setting it to unlimited). # See ASACORE-2810 (reason) and ASACORE-2650 (future improvement). env.Append(CPPDEFINES=[('LOCAL_ENDPOINT_MAXALARMS', '0')]) expand_bld = Builder(action=archive_expand, emitter=archive_expand_emitter) env.Append(BUILDERS={'ArchiveExpand' : expand_bld}) base-16.04/build_core/tools/000077500000000000000000000000001272147170000157065ustar00rootroot00000000000000base-16.04/build_core/tools/bin/000077500000000000000000000000001272147170000164565ustar00rootroot00000000000000base-16.04/build_core/tools/bin/.gitignore000066400000000000000000000000061272147170000204420ustar00rootroot00000000000000*.pyc base-16.04/build_core/tools/bin/make_status.py000077500000000000000000000240251272147170000213560ustar00rootroot00000000000000#!/usr/bin/python # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import os import getopt import copy from xml.dom import minidom if sys.version_info[:3] < (2,4,0): from sets import Set as set includeSet = set() def openFile(name, type): try: return open(name, type) except IOError, e: errno, errStr = e print "I/O Operation on %s failed" % name print "I/O Error(%d): %s" % (errno, errStr) raise e def main(argv=None): """ make_status --header --code --prefix --base [--commenCode] [--deps ] [--help] Where: - Output "C" header file - Output "C" code - Output code that maps status to comment - Prefix which is unique across all projects (see Makefile XXX_DIR) - Root directory for xi:include directives - Ouput makefile dependency file """ global headerOut global codeOut global depOut global isFirst global fileArgs global baseDir global prefix global CommentCodeOut headerOut = None codeOut = None depOut = None baseDir = "" prefix = "" CommentCodeOut = None if argv is None: argv = sys.argv[1:] try: opts, fileArgs = getopt.getopt(argv, "h", ["help", "header=", "code=", "dep=", "base=", "prefix=", "commentCode="]) for o, a in opts: if o in ("-h", "--help"): print __doc__ return 0 if o in ("--header"): headerOut = openFile(a, 'w') if o in ("--code"): codeOut = openFile(a, 'w') if o in ("--dep"): depOut = openFile(a, 'w') if o in ("--base"): baseDir = a if o in ("--prefix"): prefix = a if o in ("--commentCode"): CommentCodeOut = openFile(a, 'w') if None == headerOut or None == codeOut: raise Error("Must specify both --header and --code") isFirst = True includeSet.clear() writeHeaders() for arg in fileArgs: ret = parseAndWriteDocument(arg) writeFooters() if None != headerOut: headerOut.close() if None != codeOut: codeOut.close() if None != CommentCodeOut: CommentCodeOut.close() if None != depOut: depOut.close() except getopt.error, msg: print msg print "for help use --help" return 1 except Exception, e: print "ERROR: %s" % e if None != headerOut: os.unlink(headerOut.name) if None != codeOut: os.unlink(codeOut.name) if None != CommentCodeOut: os.unlink(CommentCodeOut.name) if None != depOut: os.unlink(depOut.name) return 1 return 0 def writeHeaders(): global headerOut global codeOut global depOut global fileArgs if None != depOut: depOut.write("%s %s %s:" % (depOut.name, codeOut.name, headerOut.name)) for arg in fileArgs: depOut.write(" \\\n %s" % arg) if None != headerOut: headerOut.write(""" /** * @file * This file contains an enumerated list values that QStatus can return * * Note: This file is generated during the make process. */ /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef _STATUS_H #define _STATUS_H /** * This @#define allows for setting of visibility support on relevant platforms */ #ifndef AJ_API # if defined(QCC_OS_GROUP_POSIX) # define AJ_API __attribute__((visibility("default"))) # else # define AJ_API # endif #endif /** This @#define allows for calling convention redefinition on relevant platforms */ #ifndef AJ_CALL # if defined(QCC_OS_GROUP_WINDOWS) # define AJ_CALL __stdcall # else # define AJ_CALL # endif #endif /** This @#define allows for calling convention redefinition on relevant platforms */ #ifndef CDECL_CALL # if defined(QCC_OS_GROUP_WINDOWS) # define CDECL_CALL __cdecl # else # define CDECL_CALL # endif #endif #ifdef __cplusplus extern "C" { #endif /** * Enumerated list of values QStatus can return */ typedef enum {""") if None != codeOut: codeOut.write(""" /** * @file * This file contains an enumerated list values that QStatus can return * * Note: This file is generated during the make process. */ /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #define CASE(_status) case _status: return #_status """) codeOut.write("AJ_API const char* AJ_CALL QCC_%sStatusText(QStatus status)" % prefix) codeOut.write(""" { switch (status) { """) def writeFooters(): global headerOut global codeOut global depOut if None != depOut: depOut.write("\n") if None != headerOut: headerOut.write(""" } QStatus; /** * Convert a status code to a C string. * * @c %QCC_StatusText(ER_OK) returns the C string @c "ER_OK" * * @param status Status code to be converted. * * @return C string representation of the status code. */ """) headerOut.write("extern AJ_API const char* AJ_CALL QCC_%sStatusText(QStatus status);" % prefix) headerOut.write(""" #ifdef __cplusplus } /* extern "C" */ #endif #endif """) if None != codeOut: codeOut.write(""" default: static char code[22]; #ifdef _WIN32 _snprintf(code, sizeof(code), ": 0x%04x", status); #else snprintf(code, sizeof(code), ": 0x%04x", status); #endif return code; } } """) def parseAndWriteDocument(fileName): dom = minidom.parse(fileName) for child in dom.childNodes: if child.localName == 'status_block': parseAndWriteStatusBlock(child) elif child.localName == 'include' and child.namespaceURI == 'http://www.w3.org/2001/XInclude': parseAndWriteInclude(child) dom.unlink() def parseAndWriteStatusBlock(blockNode): global headerOut global codeOut global isFirst offset = 0 for node in blockNode.childNodes: if node.localName == 'offset': offset = int(node.firstChild.data, 0) elif node.localName == 'status': if isFirst: if None != headerOut: headerOut.write("\n %s = %s /**< %s */" % (node.getAttribute('name'), node.getAttribute('value'), node.getAttribute('comment'))) isFirst = False else: if None != headerOut: headerOut.write(",\n %s = %s /**< %s */" % (node.getAttribute('name'), node.getAttribute('value'), node.getAttribute('comment'))) if None != codeOut: codeOut.write(" CASE(%s);\n" % (node.getAttribute('name'))) offset += 1 elif node.localName == 'include' and node.namespaceURI == 'http://www.w3.org/2001/XInclude': parseAndWriteInclude(node) def parseAndWriteInclude(includeNode): global baseDir global includeSet href = os.path.join(baseDir, includeNode.attributes['href'].nodeValue) if href not in includeSet: includeSet.add(href) if None != depOut: depOut.write(" \\\n %s" % href) parseAndWriteDocument(href) if __name__ == "__main__": sys.exit(main()) #end base-16.04/build_core/tools/bin/whitespace.py000077500000000000000000000417701272147170000212000ustar00rootroot00000000000000#!/usr/bin/python # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # Another copy of this whitespace.py file exists in ajtcl to support Thin Client builds. # That copy is located in 'ajtcl/tools' # Changes to this file must be done here (build_core) and in ajtcl import sys, os, fnmatch, re, filecmp, difflib, textwrap import hashlib, pickle, time from subprocess import Popen, STDOUT, PIPE def main(argv=None): start_time = time.clock() dir_ignore = ["stlport", "build", ".git", ".repo", "alljoyn_objc", "ios", "external", ".sconf_temp" ] file_ignore_patterns = ['\.#.*', 'alljoyn_java\.h', 'Status\.h', 'Internal\.h', 'ManagedObj.h', #uncrustify has a problem with its private constructor 'org_alljoyn_jni_AllJoynAndroidExt\.h', 'org_alljoyn_bus_samples_chat_Chat\.h', 'org_allseen_sample_event_tester_BusHandler\.h', 'org_allseen_sample_action_tester_BusHandler\.h', 'org_alljoyn_bus_samples_simpleclient_Client\.h', 'org_alljoyn_bus_samples_simpleservice_Service\.h'] file_patterns = ['*.c', '*.h', '*.cpp', '*.cc'] valid_commands = ["check", "detail", "fix", "off"] uncrustify_config = None supported_uncrustify_versions = ["0.57", "0.61"] recommended_uncrustify_version = "0.61" unc_suffix = ".uncrustify" wscfg = None xit=0 sha_hash = hashlib.sha1() whitespace_db = {} whitespace_db_updated = False run_ws_check = True uncfile = None '''Verify uncrustify install and version''' version = get_uncrustify_version() if not version in supported_uncrustify_versions: print ("******************************************************************************") print ("* NOTICE ** NOTICE ** NOTICE *") print ("******************************************************************************") print ("You are using uncrustify v" + version + ".") print ("You must be using one of the following versions of uncrustify v" + (", v".join(supported_uncrustify_versions)) + "." ) print ("Please use the recommended version of uncrustify v" + recommended_uncrustify_version + "."); print "(Or, run SCons with 'WS=off' to bypass the whitespace check)" print ("******************************************************************************") sys.exit(2) if version != recommended_uncrustify_version: print ("******************************************************************************") print ("* NOTICE ** NOTICE ** NOTICE *") print ("******************************************************************************") print ("You are using uncrustify v" + version + ".") print ("Using an older version of uncrustify may result in inaccurate white space scans.") print ("Please use the recommended version of uncrustify v" + recommended_uncrustify_version + "."); print ("******************************************************************************") # if an legacy version of uncrustify does not correctly work for a specific file # and we can not find another way around the issues we can selectively ignore # files only for the legacy version of uncrustify. if version == "0.57": # v0.57 does not process #if and correctly file_ignore_patterns.append("atomic.cc") # v0.57 does not process the case statements correctly for the json_value.cc file file_ignore_patterns.append("json_value\.cc") # v0.57 does not process the case statements correctly file_ignore_patterns.append("BusAttachment\.cc") file_ignore_patterns.append("FileStream\.cc") # v0.57 does not process the case statements and goto labels correctly file_ignore_patterns.append("alljoyn_java\.cc") file_ignore_patterns.append("ProxyBusObject\.cc") # v0.57 of has a problem with multi-line strings and lines that start with # the '<<' stream operator most of these issues only exist in unit-test code file_ignore_patterns.append("SessionListenerTest\.cc") file_ignore_patterns.append("ProxyBusObjectTest\.cc") file_ignore_patterns.append("InterfaceDescriptionTest\.cc") file_ignore_patterns.append("MarshalTest\.cc") file_ignore_patterns.append("SRPTest\.cc") file_ignore_patterns.append("SessionTest\.cc") file_ignore_patterns.append("IPAddressTest\.cc") file_ignore_patterns.append("ASN1Test\.cc") file_ignore_patterns.append("bigNumTest\.cc") file_ignore_patterns.append("SocketTest\.cc") file_ignore_patterns.append("UtilTest\.cc") # v0.57 CruptoECC.cc has a return statement with a buch of ifdefs that # confuse the whitespace checker. file_ignore_patterns.append("CryptoECC\.cc") # v0.57 the use of QCC_DEPRECATED confuses the parser. file_ignore_patterns.append("AboutClient\.h") file_ignore_patterns.append("AboutIconClient\.h") # try an load the whitespace.db file. The file is dictionary of key:value pairs # where the key is the name of a file that has been checked by the WS checker # and the value is a sha1 blob calculated for the file. specified for the key # if the key is not found (i.e. a new file or first time this script has been # run) then the key will be added. If the file fails the WS check it will be # removed from the dictionary. If the file is new or the calculated hash has # changed the WS checker will check the file to see if it complies with the WS # rules. try: f = open('whitespace.db', 'r') try: whitespace_db = pickle.load(f) except pickle.UnpicklingError: os.remove('whitespace.db') finally: f.close() except IOError: print 'whitespace.db not found a new one will be created.' if argv is None: argv=[] if len(argv) > 0: wscmd = argv[0] else: wscmd = valid_commands[0] if len(argv) > 1: wscfg = os.path.normpath(argv[1]) if wscmd not in valid_commands: print "\'" + wscmd + "\'" + " is not a valid command" print_help() sys.exit(2) '''If config specified in CL then use that, otherwise search for it''' if wscfg: uncrustify_config = wscfg else: uncrustify_config = find_config() '''Cannot find config file''' if not uncrustify_config: print "Unable to find a config file" print_help() sys.exit(2) '''Specified config file is invalid''' if not os.path.isfile(uncrustify_config): print uncrustify_config + " does not exist or is not a file" print_help() sys.exit(2) print "whitespace %s %s" % (wscmd,uncrustify_config) print "cwd=%s" % (os.getcwd()) if wscmd == 'off': return 0 '''Get a list of source files and apply uncrustify to them''' for srcfile in locate(file_patterns, file_ignore_patterns, dir_ignore): f = open(srcfile, 'rb') uncfile = None filesize = os.path.getsize(srcfile) sha_digest = None try: # Compute the sha tag for the file the same way as git computes sha # tags this prevents whitespace changes being ignored. sha_hash.update("blob %u\0" % filesize) sha_hash.update(f.read()) sha_digest = sha_hash.hexdigest() finally: f.close() if sha_digest != None: try: if whitespace_db[srcfile] == sha_digest: run_ws_check = False else: whitespace_db[srcfile] = sha_digest run_ws_check = True whitespace_db_updated = True except KeyError: whitespace_db[srcfile] = sha_digest run_ws_check = True whitespace_db_updated = True if run_ws_check: uncfile = srcfile + unc_suffix '''Run uncrustify and generate uncrustify output file''' p = Popen( [ "uncrustify", "-c", uncrustify_config, srcfile, ], stdout=PIPE, stderr=STDOUT ) output = p.communicate()[0] if p.returncode: print "error exit, uncrustify -c %s %s" % ( uncrustify_config, srcfile ) print output print "whitespace check is not complete" del whitespace_db[srcfile] xit=2 break '''check command''' if wscmd == valid_commands[0]: '''If the src file and the uncrustify file are different then print the filename''' if not filecmp.cmp(srcfile, uncfile, False): print srcfile del whitespace_db[srcfile] xit=1 '''detail command''' if wscmd == valid_commands[1]: '''If the src file and the uncrustify file are different then diff the files''' if not filecmp.cmp(srcfile, uncfile, False): print '' print '******** FILE: ' + srcfile print '' print '******** BEGIN DIFF ********' fromlines = open(srcfile, 'U').readlines() tolines = open(uncfile, 'U').readlines() diff = difflib.unified_diff(fromlines, tolines, n=0) sys.stdout.writelines(diff) print '' print '********* END DIFF *********' print '' del whitespace_db[srcfile] xit=1 '''fix command''' if wscmd == valid_commands[2]: '''If the src file and the uncrustify file are different then print the filename so that the user can see what will be fixed''' if not filecmp.cmp(srcfile, uncfile, False): print srcfile del whitespace_db[srcfile] '''run uncrustify again and overwrite the non-compliant file with the uncrustify output''' p = Popen( [ "uncrustify", "-c", uncrustify_config, "--no-backup", srcfile, ], stdout=PIPE, stderr=STDOUT ) output = p.communicate()[0] if p.returncode: print "error exit, uncrustify -c %s --no-backup %s" % ( uncrustify_config, srcfile ) print output print "whitespace check is not complete" del whitespace_db[srcfile] xit=2 break '''remove the uncrustify output file''' if os.path.exists(uncfile): try: os.remove(uncfile) except OSError: print "Unable to remove uncrustify output file: " + uncfile # end srcfile loop if uncfile and os.path.exists(uncfile): try: os.remove(uncfile) except OSError: print "Unable to remove uncrustify output file: " + uncfile # write the whitespace_db to a file so it is avalible next time the whitespace # checker is run. if whitespace_db_updated: try: f = open('whitespace.db', 'w') try: pickle.dump(whitespace_db, f) finally: f.close() except IOError: print 'Unable to create whitespace.db file.' print 'WS total run time: {0:.2f} seconds'.format(time.clock() - start_time) return xit '''Return the uncrustify version number''' def get_uncrustify_version( ): version = None try: '''run the uncrustify version command''' output = Popen(["uncrustify", "-v"], stdout=PIPE).communicate()[0] except OSError: '''OSError probably indicates that uncrustify is not installed, so bail after printing helpful message''' print ("It appears that \'uncrustify\' is not installed or is not " + "on your PATH. Please check your system and try again.") print "(Or, run SCons with 'WS=off' to bypass the whitespace check)" sys.exit(2) else: '''extract version from output string''' p = re.compile('^uncrustify (\d.\d{2})') m = re.search(p, output) version = m.group(1) return version '''Command line argument help''' def print_help( ): prog = 'whitespace.py' print textwrap.dedent('''\ usage: %(prog)s [-h] [command] [uncrustify config] Apply uncrustify to C++ source files (.c, .h, .cc, .cpp), recursively, from the present working directory. Skips 'stlport', 'build', 'alljoyn_objc', 'ios', 'external', '.git', and '.repo' directories. Note: present working directory is presumed to be within, or the parent of, one of the AllJoyn archives. Script will automatically locate the uncrustify config file in build_core, or alternatively, the user may specify one. Enables users to see which source files are not in compliance with the AllJoyn whitespace policy and fix them as follows: check - prints list of non-compliant files (default) detail - prints diff of non-compliant files fix - modifies (fixes) non-compliant files Note that all files generated by uncrustify are removed. positional arguments: command options: check(default) | detail | fix uncrustify config specify an alternative uncrustify config (default=none) optional arguments: -h, --help show this help message and exit Examples: Get a list of non-compliant files using the alljoyn uncrustify config: >python %(prog)s --OR-- >python %(prog)s check Get a list of non-compliant files using your own uncrustify config: >python %(prog)s check r'myconfig.cfg' (note: use raw string) Get a diff of non-compliant files using the alljoyn uncrustify config: >python %(prog)s detail Fix non-compliant files using the alljoyn uncrustify config: >python %(prog)s fix''' % { 'prog': prog } ) '''Search for the uncrustify config file''' def find_config( ): tgtdir = "build_core" cfgname = "ajuncrustify.cfg" ajcfgrelpath = os.path.join(tgtdir, "tools", "conf", cfgname) ajcfgpath = None foundit = 0 DIRDEPTHMAX = 6 '''Limit directory search to depth DIRDEPTHMAX''' curdir = os.path.abspath(os.curdir) for i in range(DIRDEPTHMAX): if tgtdir in os.listdir(curdir): foundit = 1 break else: curdir = os.path.abspath(os.path.join(curdir, "..")) if foundit == 1 and os.path.exists(os.path.join(curdir, ajcfgrelpath)): ajcfgpath = os.path.join(curdir, ajcfgrelpath) return ajcfgpath '''Recurse through directories and locate files that match a given pattern''' def locate(file_patterns, file_ignore_patterns, dir_ignore_patterns, root=os.curdir): for path, dirs, files in os.walk(os.path.abspath(root)): '''Remove unwanted dirs''' for dip in dir_ignore_patterns: for dyr in dirs: if dyr == dip: dirs.remove(dyr) '''Remove unwanted files''' files_dict = {} for filename in files: files_dict[filename] = True for filename in files: for fip in file_ignore_patterns: if re.search(fip, filename) != None: del files_dict[filename] '''Collect the filtered list''' filtered_files = [] for filename in files_dict.keys(): filtered_files.append(filename) '''Filter the remainder using our wanted file pattern list''' for pattern in file_patterns: for filename in fnmatch.filter(filtered_files, pattern): yield os.path.join(path, filename) if __name__ == "__main__": if len(sys.argv) > 1: sys.exit(main(sys.argv[1:])) else: sys.exit(main()) #end base-16.04/build_core/tools/conf/000077500000000000000000000000001272147170000166335ustar00rootroot00000000000000base-16.04/build_core/tools/conf/ajuncrustify.0.57.cfg000066400000000000000000002055101272147170000224350ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # Uncrustify 0.57 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. # DJM # indent_columns = 8 # number indent_columns = 4 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop # DJM # indent_with_tabs = 1 # number indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented # DJM # indent_class = false # false/true indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 4 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent # DJM # indent_label = 1 # number indent_label = -4 # number # Same as indent_label, but for access specifiers that are followed by a colon # DJM # indent_access_spec = 1 # number indent_access_spec = -2 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc # ASACORE-1026 we want to add space for arithmetic operators due to # a issue with uncrustify v0.57 not being able to always know the difference # between a pointer '*' and arithmetic '*' we are ignoring this rule # if uncrustify v0.57 is used. sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc # DJM # sp_assign = ignore # ignore/add/remove/force sp_assign = add # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype # DJM # sp_assign_default = ignore # ignore/add/remove/force sp_assign_default = add # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum # DJM # sp_enum_assign = ignore # ignore/add/remove/force sp_enum_assign = add # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' # DJM # sp_bool = ignore # ignore/add/remove/force sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc # DJM # sp_compare = ignore # ignore/add/remove/force sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' # DJM # sp_inside_paren = ignore # ignore/add/remove/force sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens # DJM # sp_paren_paren = ignore # ignore/add/remove/force sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' # DJM # sp_paren_brace = ignore # ignore/add/remove/force sp_paren_brace = add # ignore/add/remove/force # Add or remove space before pointer star '*' # DJM # sp_before_ptr_star = ignore # ignore/add/remove/force sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. # DJM # sp_before_ptr_star_func = ignore # ignore/add/remove/force sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' # DJM # sp_before_byref = ignore # ignore/add/remove/force sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. # DJM # sp_after_byref = ignore # ignore/add/remove/force sp_after_byref = add # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. # DJM # sp_after_byref_func = ignore # ignore/add/remove/force sp_after_byref_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. # DJM # sp_before_byref_func = ignore # ignore/add/remove/force sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. # DJM # sp_template_angle = ignore # ignore/add/remove/force sp_template_angle = add # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' # DJM # sp_inside_angle = ignore # ignore/add/remove/force sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' # DJM # sp_angle_word = ignore # ignore/add/remove/force sp_angle_word = add # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' # DJM # sp_before_sparen = ignore # ignore/add/remove/force sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' # DJM # sp_inside_sparen = ignore # ignore/add/remove/force sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' # DJM # sp_after_sparen = ignore # ignore/add/remove/force sp_after_sparen = add # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' # DJM # sp_sparen_brace = ignore # ignore/add/remove/force sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). # DJM # sp_after_semi_for_empty = ignore # ignore/add/remove/force sp_after_semi_for_empty = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' # DJM # sp_after_comma = ignore # ignore/add/remove/force sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' # DJM # sp_after_class_colon = ignore # ignore/add/remove/force sp_after_class_colon = add # ignore/add/remove/force # Add or remove space before class ':' # DJM # sp_before_class_colon = ignore # ignore/add/remove/force sp_before_class_colon = add # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' # DJM # sp_inside_braces = ignore # ignore/add/remove/force sp_inside_braces = add # ignore/add/remove/force # Add or remove space inside '{}' # DJM # sp_inside_braces_empty = ignore # ignore/add/remove/force sp_inside_braces_empty = add # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration # DJM # sp_func_proto_paren = ignore # ignore/add/remove/force sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition # DJM # sp_func_def_paren = ignore # ignore/add/remove/force sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' # DJM # sp_inside_fparens = ignore # ignore/add/remove/force sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' # DJM # sp_inside_fparen = ignore # ignore/add/remove/force sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function # DJM # sp_fparen_brace = ignore # ignore/add/remove/force sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls # DJM # sp_func_call_paren = ignore # ignore/add/remove/force sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren # DJM # sp_func_class_paren = ignore # ignore/add/remove/force sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line # DJM # sp_else_brace = ignore # ignore/add/remove/force sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line # DJM # sp_brace_else = ignore # ignore/add/remove/force sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator # DJM # sp_before_dc = ignore # ignore/add/remove/force sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator # DJM # sp_after_dc = ignore # ignore/add/remove/force sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' # DJM # sp_cond_colon = ignore # ignore/add/remove/force sp_cond_colon = add # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' # DJM # sp_cond_question = ignore # ignore/add/remove/force sp_cond_question = add # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body # DJM # nl_class_leave_one_liners = false # false/true nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' # DJM # nl_enum_brace = ignore # ignore/add/remove/force nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' # DJM # nl_struct_brace = ignore # ignore/add/remove/force nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' # DJM # nl_union_brace = ignore # ignore/add/remove/force nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' # DJM # nl_if_brace = ignore # ignore/add/remove/force nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' # DJM # nl_brace_else = ignore # ignore/add/remove/force nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' # DJM # nl_else_brace = ignore # ignore/add/remove/force nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' # DJM # nl_brace_finally = ignore # ignore/add/remove/force nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' # DJM # nl_finally_brace = ignore # ignore/add/remove/force nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' # DJM # nl_try_brace = ignore # ignore/add/remove/force nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' # DJM # nl_getset_brace = ignore # ignore/add/remove/force nl_getset_brace = remove # ignore/add/remove/force # Add or remove newline between 'for' and '{' # DJM # nl_for_brace = ignore # ignore/add/remove/force nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' # DJM # nl_catch_brace = ignore # ignore/add/remove/force nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' # DJM # nl_brace_catch = ignore # ignore/add/remove/force nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' # DJM # nl_while_brace = ignore # ignore/add/remove/force nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' # DJM # nl_do_brace = ignore # ignore/add/remove/force nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement # DJM # nl_brace_while = ignore # ignore/add/remove/force nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' # DJM # nl_switch_brace = ignore # ignore/add/remove/force nl_switch_brace = remove # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement # DJM # nl_before_case = false # false/true nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { # DJM # nl_namespace_brace = ignore # ignore/add/remove/force nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' # DJM # nl_class_brace = ignore # ignore/add/remove/force nl_class_brace = remove # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition # DJM nl_func_type_name = ignore # ignore/add/remove/force # nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. # DJM nl_func_type_name_class = ignore # ignore/add/remove/force # nl_func_type_name_class = remove # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype # DJM # nl_func_proto_type_name = ignore # ignore/add/remove/force nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' # DJM # nl_func_paren = ignore # ignore/add/remove/force nl_func_paren = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition # DJM # nl_func_def_paren = ignore # ignore/add/remove/force nl_func_def_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = ignore # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines # DJM # cmt_sp_after_star_cont = 0 # number cmt_sp_after_star_cont = 1 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True # DJM # cmt_multi_check_last = true # false/true cmt_multi_check_last = false # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # base-16.04/build_core/tools/conf/ajuncrustify.0.61.cfg000066400000000000000000002453651272147170000224440ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Uncrustify 0.61 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # Control what to do with the UTF-8 BOM (recommend 'remove') utf8_bom = remove # ignore/add/remove/force # If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8 utf8_byte = false # false/true # Force the output encoding to UTF-8 utf8_force = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. # DJM # indent_columns = 8 # number indent_columns = 4 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. Negative value is absolute and not increased for each ( level indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop # DJM # indent_with_tabs = 1 # number indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Indent based on the paren open instead of the brace open in '({\n', default is to indent by brace. indent_paren_open_brace = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Only indent one namespace and no sub-namepaces. # Requires indent_namespace=true. indent_namespace_single_indent = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented # DJM # indent_class = false # false/true indent_class = true # false/true # Whether to indent the stuff after a leading base class colon indent_class_colon = false # false/true # Whether to indent the stuff after a leading class initializer colon indent_constr_colon = false # false/true # Virtual indent from the ':' for member initializers. Default is 2 indent_ctor_init_leading = 2 # number # Additional indenting for constructor initializer list indent_ctor_init = 0 # number # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: force indentation of function definition to start in column 1 # False: use the default behavior indent_func_def_force_col1 = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 4 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent # DJM # indent_label = 1 # number indent_label = -4 # number # Same as indent_label, but for access specifiers that are followed by a colon # DJM # indent_access_spec = 1 # number indent_access_spec = -2 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # Indent OC blocks at brace level instead of usual rules. indent_oc_block = false # false/true # Indent OC blocks in a message relative to the parameter name. # 0=use indent_oc_block rules, 1+=spaces to indent indent_oc_block_msg = 0 # number # Minimum indent for subsequent parameters indent_oc_msg_colon = 0 # number # If true, prioritize aligning with initial colon (and stripping spaces from lines, if necessary). # Default is true. indent_oc_msg_prioritize_first_colon = true # false/true # If indent_oc_block_msg and this option are on, blocks will be indented the way that Xcode does by default (from keyword if the parameter is on its own line; otherwise, from the previous indentation level). indent_oc_block_msg_xcode_style = false # false/true # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg keyword. indent_oc_block_msg_from_keyword = false # false/true # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg colon. indent_oc_block_msg_from_colon = false # false/true # If indent_oc_block_msg and this option are on, blocks will be indented from where the block caret is. indent_oc_block_msg_from_caret = false # false/true # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is. indent_oc_block_msg_from_brace = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc # DJM # sp_arith = ignore # ignore/add/remove/force sp_arith = add # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc # DJM # sp_assign = ignore # ignore/add/remove/force sp_assign = add # ignore/add/remove/force # Add or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign sp_cpp_lambda_assign = ignore # ignore/add/remove/force # Add or remove space after the capture specification in C++11 lambda. sp_cpp_lambda_paren = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype # DJM # sp_assign_default = ignore # ignore/add/remove/force sp_assign_default = add # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space in 'NS_ENUM (' sp_enum_paren = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum # DJM # sp_enum_assign = ignore # ignore/add/remove/force sp_enum_assign = add # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. sp_pp_stringify = add # ignore/add/remove/force # Add or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. sp_before_pp_stringify = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' # DJM # sp_bool = ignore # ignore/add/remove/force sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc # DJM # sp_compare = ignore # ignore/add/remove/force sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' # DJM # sp_inside_paren = ignore # ignore/add/remove/force sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens: '((' vs ') )' # DJM # sp_paren_paren = ignore # ignore/add/remove/force sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between back-to-back parens: ')(' vs ') (' sp_cparen_oparen = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' # DJM # sp_paren_brace = ignore # ignore/add/remove/force sp_paren_brace = add # ignore/add/remove/force # Add or remove space before pointer star '*' # DJM # sp_before_ptr_star = ignore # ignore/add/remove/force sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a qualifier. sp_after_ptr_star_qualifier = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by an open paren (function types). sp_ptr_star_paren = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. # DJM # sp_before_ptr_star_func = ignore # ignore/add/remove/force sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' # DJM # sp_before_byref = ignore # ignore/add/remove/force sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. # DJM # sp_after_byref = ignore # ignore/add/remove/force sp_after_byref = add # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. # DJM # sp_after_byref_func = ignore # ignore/add/remove/force sp_after_byref_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. # DJM # sp_before_byref_func = ignore # ignore/add/remove/force sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. sp_before_template_paren = ignore # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. # DJM # sp_template_angle = ignore # ignore/add/remove/force sp_template_angle = add # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' # DJM # sp_inside_angle = ignore # ignore/add/remove/force sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' # DJM # sp_angle_word = ignore # ignore/add/remove/force sp_angle_word = add # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False # sp_angle_shift cannot remove the space without this option. sp_permit_cpp11_shift = false # false/true # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' # DJM # sp_before_sparen = ignore # ignore/add/remove/force sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' # DJM # sp_inside_sparen = ignore # ignore/add/remove/force sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space before if-condition '('. Overrides sp_inside_sparen. sp_inside_sparen_open = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' # DJM # sp_after_sparen = ignore # ignore/add/remove/force sp_after_sparen = add # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' # DJM # sp_sparen_brace = ignore # ignore/add/remove/force sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). # DJM # sp_after_semi_for_empty = ignore # ignore/add/remove/force sp_after_semi_for_empty = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside a non-empty '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' # DJM # sp_after_comma = ignore # ignore/add/remove/force sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' # DJM # sp_after_class_colon = ignore # ignore/add/remove/force sp_after_class_colon = add # ignore/add/remove/force # Add or remove space before class ':' # DJM # sp_before_class_colon = ignore # ignore/add/remove/force sp_before_class_colon = add # ignore/add/remove/force # Add or remove space after class constructor ':' sp_after_constr_colon = ignore # ignore/add/remove/force # Add or remove space before class constructor ':' sp_before_constr_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' # DJM # sp_inside_braces = ignore # ignore/add/remove/force sp_inside_braces = add # ignore/add/remove/force # Add or remove space inside '{}' # sp_inside_braces_empty = ignore # ignore/add/remove/force sp_inside_braces_empty = add # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration # DJM # sp_func_proto_paren = ignore # ignore/add/remove/force sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition # DJM # sp_func_def_paren = ignore # ignore/add/remove/force sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' # DJM # sp_inside_fparens = ignore # ignore/add/remove/force sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' # DJM # sp_inside_fparen = ignore # ignore/add/remove/force sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space inside the first parens in the function type: 'void (*x)(...)' sp_inside_tparen = ignore # ignore/add/remove/force # Add or remove between the parens in the function type: 'void (*x)(...)' sp_after_tparen_close = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function # DJM # sp_fparen_brace = ignore # ignore/add/remove/force sp_fparen_brace = add # ignore/add/remove/force # Java: Add or remove space between ')' and '{{' of double brace initializer. sp_fparen_dbrace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls # DJM # sp_func_call_paren = ignore # ignore/add/remove/force sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren # DJM # sp_func_class_paren = ignore # ignore/add/remove/force sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and anything other than '(' as in '@throw [...];' sp_after_throw = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between 'version' and '(' in 'version (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_version_paren = ignore # ignore/add/remove/force # Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_scope_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line # DJM # sp_else_brace = ignore # ignore/add/remove/force sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line # DJM # sp_brace_else = ignore # ignore/add/remove/force sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space between a variable and '{' for C++ uniform initialization sp_word_brace = add # ignore/add/remove/force # Add or remove space between a variable and '{' for a namespace sp_word_brace_ns = add # ignore/add/remove/force # Add or remove space before the '::' operator # DJM # sp_before_dc = ignore # ignore/add/remove/force sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator # DJM # sp_after_dc = ignore # ignore/add/remove/force sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in immutable dictionary expression # 'NSDictionary *test = @{@"foo" :@"bar"};' sp_after_oc_dict_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in immutable dictionary expression # 'NSDictionary *test = @{@"foo" :@"bar"};' sp_before_oc_dict_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space between the receiver and selector in a message. # '[receiver selector ...]' sp_after_oc_msg_receiver = ignore # ignore/add/remove/force # Add or remove space after @property. sp_after_oc_property = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' #DJM # sp_cond_colon = ignore # ignore/add/remove/force sp_cond_colon = add # ignore/add/remove/force # Add or remove space before the ':' in 'b ? t : f'. Overrides sp_cond_colon. sp_cond_colon_before = ignore # ignore/add/remove/force # Add or remove space after the ':' in 'b ? t : f'. Overrides sp_cond_colon. sp_cond_colon_after = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' # DJM # sp_cond_question = ignore # ignore/add/remove/force sp_cond_question = add # ignore/add/remove/force # Add or remove space before the '?' in 'b ? t : f'. Overrides sp_cond_question. sp_cond_question_before = ignore # ignore/add/remove/force # Add or remove space after the '?' in 'b ? t : f'. Overrides sp_cond_question. sp_cond_question_after = ignore # ignore/add/remove/force # In the abbreviated ternary form (a ?: b), add/remove space between ? and :.'. Overrides all other sp_cond_* options. sp_cond_ternary_short = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the spacing after ':' in 'for (TYPE VAR : EXPR)' (Java) sp_after_for_colon = ignore # ignore/add/remove/force # Control the spacing before ':' in 'for (TYPE VAR : EXPR)' (Java) sp_before_for_colon = ignore # ignore/add/remove/force # Control the spacing in 'extern (C)' (D) sp_extern_paren = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # Controls the spaces after 'new', 'delete', and 'delete[]' sp_after_new = ignore # ignore/add/remove/force # Controls the spaces before a trailing or embedded comment sp_before_tr_emb_cmt = ignore # ignore/add/remove/force # Number of spaces before a trailing or embedded comment sp_num_before_tr_emb_cmt = 0 # number # Control space between a Java annotation and the open paren. sp_annotation_paren = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Whether to keep whitespace not required for alignment. align_keep_extra_space = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # # Align macro functions and variables together align_pp_define_together = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align, other=number of lines including comments between blocks) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # If true, always align with the first parameter, even if it is too short. align_oc_msg_colon_first = false # false/true # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body # DJM # nl_class_leave_one_liners = false # false/true nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line C++11 lambdas - '[]() { return 0; }' nl_cpp_lambda_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Don't split one-line OC messages nl_oc_msg_leave_one_liner = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions at the top of a function body # 0 = No change (default) nl_func_var_def_blk = 0 # number # The number of newlines before a block of typedefs # 0 = No change (default) nl_typedef_blk_start = 0 # number # The number of newlines after a block of typedefs # 0 = No change (default) nl_typedef_blk_end = 0 # number # The maximum consecutive newlines within a block of typedefs # 0 = No change (default) nl_typedef_blk_in = 0 # number # The number of newlines before a block of variable definitions not at the top of a function body # 0 = No change (default) nl_var_def_blk_start = 0 # number # The number of newlines after a block of variable definitions not at the top of a function body # 0 = No change (default) nl_var_def_blk_end = 0 # number # The maximum consecutive newlines within a block of variable definitions # 0 = No change (default) nl_var_def_blk_in = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' # DJM # nl_enum_brace = ignore # ignore/add/remove/force nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' # DJM # nl_struct_brace = ignore # ignore/add/remove/force nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' # DJM # nl_union_brace = ignore # ignore/add/remove/force nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' # DJM # nl_if_brace = ignore # ignore/add/remove/force nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' # DJM # nl_brace_else = ignore # ignore/add/remove/force nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' # DJM # nl_else_brace = ignore # ignore/add/remove/force nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' # DJM # nl_brace_finally = ignore # ignore/add/remove/force nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' # DJM # nl_finally_brace = ignore # ignore/add/remove/force nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' # DJM # nl_try_brace = ignore # ignore/add/remove/force nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' # DJM # nl_getset_brace = ignore # ignore/add/remove/force nl_getset_brace = remove # ignore/add/remove/force # Add or remove newline between 'for' and '{' # DJM # nl_for_brace = ignore # ignore/add/remove/force nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' # DJM # nl_catch_brace = ignore # ignore/add/remove/force nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' # DJM # nl_brace_catch = ignore # ignore/add/remove/force nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between '}' and ']' nl_brace_square = ignore # ignore/add/remove/force # Add or remove newline between '}' and ')' in a function invocation nl_brace_fparen = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' # DJM # nl_while_brace = ignore # ignore/add/remove/force nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'scope (x)' and '{' (D) nl_scope_brace = ignore # ignore/add/remove/force # Add or remove newline between 'unittest' and '{' (D) nl_unittest_brace = ignore # ignore/add/remove/force # Add or remove newline between 'version (x)' and '{' (D) nl_version_brace = ignore # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' # DJM # nl_do_brace = ignore # ignore/add/remove/force nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement # DJM # nl_brace_while = ignore # ignore/add/remove/force nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' # DJM # nl_switch_brace = ignore # ignore/add/remove/force nl_switch_brace = remove # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement # DJM # nl_before_case = false # false/true nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Add or remove a newline between a case ':' and '{'. Overrides nl_after_case. nl_case_colon_brace = ignore # ignore/add/remove/force # Newline between namespace and { # DJM # nl_namespace_brace = ignore # ignore/add/remove/force nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' # DJM # nl_class_brace = ignore # ignore/add/remove/force nl_class_brace = remove # ignore/add/remove/force # Add or remove newline after each ',' in the class base list nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_constr_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition # DJM # nl_func_type_name = ignore # ignore/add/remove/force nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. # DJM # nl_func_type_name_class = ignore # ignore/add/remove/force nl_func_type_name_class = remove # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype # DJM # nl_func_proto_type_name = ignore # ignore/add/remove/force nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' # DJM # nl_func_paren = ignore # ignore/add/remove/force nl_func_paren = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition # DJM # nl_func_def_paren = ignore # ignore/add/remove/force nl_func_def_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Whether to put each OC message parameter on a separate line # See nl_oc_msg_leave_one_liner nl_oc_msg_args = false # false/true # Add or remove newline between function signature and '{' nl_fdef_brace = ignore # ignore/add/remove/force # Add or remove newline between C++11 lambda signature and '{' nl_cpp_ldef_brace = ignore # ignore/add/remove/force # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Java: Control the newline between the ')' and '{{' of the double brace initializer. nl_paren_dbrace_open = ignore # ignore/add/remove/force # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Control the newline between the close brace and 'b' in: 'struct { int a; } b;' # Affects enums, unions, and structures. If set to ignore, uses nl_after_brace_close nl_brace_struct_var = ignore # ignore/add/remove/force # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_class_comma. nl_class_colon = ignore # ignore/add/remove/force # Add or remove a newline around a class constructor colon. # Related to pos_constr_colon, nl_constr_init_args, and pos_constr_comma. nl_constr_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the class base list pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_constr_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between class and base class list pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_constr_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # Whether to split lines as close to code_width as possible and ignore some groupings ls_code_width = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a multi-line function body in a class declaration nl_after_func_body_class = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines after '}' or ';' of a struct/enum/union definition nl_after_struct = 0 # number # The number of newlines after '}' or ';' of a class definition nl_after_class = 0 # number # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Add or remove newline between C# property and the '{' nl_property_brace = ignore # ignore/add/remove/force # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # How aggressively to remove extra newlines not in preproc. # 0: No change # 1: Remove most newlines not handled by other config # 2: Remove all newlines and reformat completely by config nl_remove_extra_newlines = 0 # number # Whether to put a blank line before 'return' statements, unless after an open brace. nl_before_return = false # false/true # Whether to put a blank line after 'return' statements, unless followed by a close brace. nl_after_return = false # false/true # Whether to put a newline after a Java annotation statement. # Only affects annotations that are after a newline. nl_after_annotation = ignore # ignore/add/remove/force # Controls the newline between two annotations. nl_between_annotation = ignore # ignore/add/remove/force # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. # GLN # mod_full_brace_if = ignore # ignore/add/remove/force mod_full_brace_if = add # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a namespace body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_namespace_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # Whether to convert all tabs to spaces in comments. Default is to leave tabs inside comments alone, unless used for indenting. cmt_convert_tab_to_spaces = false # false/true # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines # DJM # cmt_sp_after_star_cont = 0 # number cmt_sp_after_star_cont = 1 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True # DJM # cmt_multi_check_last = true # false/true cmt_multi_check_last = false # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. # Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. cmt_insert_oc_msg_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 (file-level) pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # Specifies the number of columns to indent preprocessors per level at brace level 0 (file-level). # If pp_indent_at_level=false, specifies the number of columns to indent preprocessors per level at brace level > 0 (function-level). # Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level. # 0: indent preprocessors using output_tab_size. # >0: column at which all preprocessors will be indented. pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif. pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # # You can add support for other file extensions using the 'file_ext' command. # The first arg is the language name used with the '-l' option. # The remaining args are file extensions, matched with 'endswith'. # file_ext CPP .ch .cxx .cpp.in # base-16.04/build_core/tools/scons/000077500000000000000000000000001272147170000170335ustar00rootroot00000000000000base-16.04/build_core/tools/scons/.gitignore000066400000000000000000000000061272147170000210170ustar00rootroot00000000000000*.pyc base-16.04/build_core/tools/scons/Csharp.py000066400000000000000000000055131272147170000206310ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # A simple C# builder with no extra bells or whistles import os.path import SCons.Builder import SCons.Node.FS import SCons.Util cs_action = '$CSC "/target:exe" $_CSC_FLAGS "/out:${TARGET.abspath}" ${SOURCES}' #cs_lib_action = "csc.exe /target:library /out:${TARGET} ${SOURCE.dir}\*.cs $_CSC_FLAGS" cs_lib_action = '$CSC "/target:library" $_CSC_LIB_FLAGS $_CSC_LIB_PATHS $_CSC_REFERENCES "/out:${TARGET.abspath}" ${SOURCES}' cs_suffix = '.exe' cs_lib_suffix = '.dll' # This SCons Builder does not properly calculate the dependencies for the .NET # Framework Assemblies specified when using the CSC_REFERENCES do make sure a # Framework Assembly exist a person should use env.Depends for each Assembly listed # in the CSC_REFERENCES def generate(env): cs_builder = SCons.Builder.Builder(action = '$CSC_ACTION', src_suffix = '.cs', suffix = cs_suffix) cs_lib_builder = SCons.Builder.Builder(action = '$CSC_LIB_ACTION', src_suffix = '.cs', suffix = cs_lib_suffix) env['BUILDERS']['CSharp'] = cs_builder env['BUILDERS']['CSharpLib'] = cs_lib_builder #define the C# compiler env['CSC'] = 'csc.exe' # A list of compiler flags like debug, warn, noconfig, or nologo env['CSC_FLAGS'] = '' env['_CSC_FLAGS'] = "${_stripixes('\"/', CSC_FLAGS, '\"', '\"/', '\"', __env__)}" # A list of compiler flags when building a library file env['CSC_LIB_FLAGS'] = '' env['_CSC_LIB_FLAGS'] = "${_stripixes('\"/', CSC_LIB_FLAGS, '\"', '\"/', '\"', __env__)}" # A list of .NET Framework Assemblies i.e. dlls compiled by a .net language env['CSC_REFERENCES'] = '' env['_CSC_REFERENCES'] = "${_stripixes('\"/reference:', CSC_REFERENCES, '\"', '', '', __env__)}" # A list of paths to search for .NET Framework Assemblies env['CSC_LIB_PATHS'] = '' env['_CSC_LIB_PATHS'] = "${_stripixes('\"/lib:', CSC_LIB_PATHS, '\"', '', '', __env__)}" # Action to build an executable env['CSC_ACTION'] = cs_action # Action to build a library env['CSC_LIB_ACTION'] = cs_lib_action def exists(env): return env['CSC']base-16.04/build_core/tools/scons/configurejni.py000066400000000000000000000027321272147170000220730ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os def ConfigureJNI(env): """Configure the environment for building JNI native code. """ if not env.get('JAVAC'): print "Java compiler not found" return 0 java_home = os.environ.get('JAVA_HOME') if not java_home: print "JAVA_HOME not set" return 0 java_include = [os.path.join(java_home, 'include')] java_lib = [os.path.join(java_home, 'lib')] java_include.append(os.path.join(java_include[0], 'win32')) java_include.append(os.path.join(java_include[0], 'linux')) java_include.append(os.path.join(java_include[0], 'darwin')) env.Append(CPPPATH = java_include) env.Append(LIBPATH = java_lib) return 1 base-16.04/build_core/tools/scons/doxygen.py000066400000000000000000000612721272147170000210720ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # This doxygen builder does not parse the input file and populate the file list # using an emmitter for this reason to use this builder it is best to specify # env.Doxygen(source='', target=Dir('tmp')) # Where the tmp directory is never created meaning that doxygen is run every # time the SCons is run # env.Clean('Doxygen_html', Dir('html')) # Where 'html' is the output directory if building latex the output directory # would be latex import SCons.Builder import os import ConfigParser import fnmatch import re # this class will allow us to use Pythons built in config parser. # The Config parser is designed to understand ini files with headers Doxygen's # Config file is in the form of an ini file without an headers. this will add # a fake section header to the file when it is being read. class FakeSecHead(object): def __init__(self, fp): self.fp = fp self.sechead = '[doxy_config]\n' # when calling readline on the self.fp return the sechead then assign 'None' # all following calls to readline will then call self.fd.readline def readline(self): if self.sechead: try: return self.sechead finally: self.sechead = None else: return self.fp.readline() # doxygen can read in environment varibles if they have the form '$(VAR) # scons only understands environment vars of form $VAR. This will find # the doxygen expresion change is to an expression SCons understands and # will do the environment variable substitution def _doxygen_expand_environment_vars(str, env): env_var = re.match('(\$\()(\S*)(\))', str) if env_var != None: return re.sub('\$\(\S*\)', env.subst('${' + env_var.group(2) + '}'), str) else: return str # if the path to the file of directory starts with '#' character this # can only be interperated by scons. We will change it to an object path # so we can then walk the object path. def _doxygen_replace_start_hash_if_found(str, env): if str and str[0] == '#': return os.path.join(env.Dir('#').abspath, str[1:]) else: return str def _doxygen_scanner(node, env, path): source = [] #Default file pattern from doxygen 1.8 file_patterns = ['*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx', '*.ipp', '*.i++', '*.inl', '*.idl', '*.ddl', '*.odl', '*.h', '*.hh', '*.hxx', '*.hpp', '*.h++', '*.cs', '*.d','*.php', '*.php4', '*.php5', '*.phtml', '*.inc', '*.m', '*.markdown', '*.md', '*.mm', '*.dox', '*.py', '*.f90', '*.f', '*.for', '*.tcl', '*.vhd', '*.vhdl', '*.ucf', '*.qsf', '*.as', '*.js'] # TODO figure out a way to change the default file pattern depending on the version # of doxygen being used. #Default file pattern from doxygen 1.6 #file_patterns = ['*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.d', # '*.java', '*.ii', '*.ixx', '*.ipp', '*.i++', '*.inl', # '*.h', '*.hh', '*.hxx', '*.hpp', '*.h++', '*.idl', # '*.odl', '*.cs', '*.php', '*.php3', '*.inc', '*.m', # '*.mm', '*.dox', '*.py', '*.f90', '*.f', '*.for', # '*.vhd', '*.vhdl'] # all paths listed in the config file are relative to the config file config_file_path = '.' config = ConfigParser.SafeConfigParser() try: fp = open(str(node), 'r') config.readfp(FakeSecHead(fp)) finally: fp.close() config_file_path = os.path.abspath(os.path.dirname(str(node))) recursive = False input = [] generate_html = True generate_latex = True example_path = [] example_patterns = [] example_recursive = False ############################################################################ # PROCESS INPUT FILES ############################################################################ if config.has_option('doxy_config', 'file_patterns'): file_patterns_from_config = config.get('doxy_config', 'file_patterns').replace('\\', '').split() if file_patterns_from_config: file_patterns = file_patterns_from_config if config.has_option('doxy_config', 'recursive'): if config.get('doxy_config', 'recursive') == 'YES': recursive = True if config.has_option('doxy_config', 'input'): input = config.get('doxy_config', 'input').replace('\\', '').split() # if no input is found in the config file the current directory is search # otherwise it will check to see if the input file found is a file or a # directory. If it is a directory is will search the directory. If recursive # search was specified in the config file a recursive directory search will # be done. Only files that match the FILE_PATTERNS option will be added to # the source list # TODO when processing the input take into account the following tags # EXCLUDE # EXLUDE_SYMLINKS # EXLUDE_PATTERNS if not input: for filename in os.listdir(os.path.abspath(config_file_path)): for f_pattern in file_patterns: if fnmatch.fnmatchcase(filename, f_pattern): source.append(os.path.abspath(os.path.join(config_file_path, filename))) else: for i in input: i = _doxygen_expand_environment_vars(i, env) i = _doxygen_replace_start_hash_if_found(i, env) # relative paths are relative to the location of the config file if not os.path.isabs(i): i = os.path.join(config_file_path, i) if os.path.isfile(i): source.append(os.path.abspath(i)) elif os.path.isdir(i): if recursive: for root, dir, filenames in os.walk(i): for f_pattern in file_patterns: for pmatch in fnmatch.filter(filenames, f_pattern): source.append(os.path.abspath(os.path.join(root, pmatch))) else: for filename in os.listdir(os.path.abspath(i)): for f_pattern in file_patterns: if fnmatch.fnmatchcase(filename, f_pattern): source.append(os.path.abspath(os.path.join(i, filename))) ############################################################################ # PROCESS EXAMPLE TAGS ############################################################################ if config.has_option('doxy_config', 'example_patterns'): example_patterns = config.get('doxy_config', 'example_patterns').replace('\\', '').split() if example_patterns == []: example_patterns = None if config.has_option('doxy_config', 'example_recursive'): if config.get('doxy_config', 'example_recursive') == 'YES': example_recursive = True if config.has_option('doxy_config', 'example_path'): example_path = config.get('doxy_config', 'example_path').replace('\\', '').split() # if the example_path don't add any files to the source list # if the example_path is not blank but example_patterns is blank then add all # files found in the path to the source list. Use the example_recursive to # determine if the example_path should be recursivly searched. if example_path: for e in example_path: e = _doxygen_expand_environment_vars(e, env) e = _doxygen_replace_start_hash_if_found(e, env) # relative paths are relative to the location of the config file if not os.path.isabs(e): e = os.path.normpath(os.path.join(config_file_path, e)) if os.path.isdir(e): if example_recursive: for root, dir, filenames in os.walk(e): if example_patterns: for e_pattern in example_patterns: for pmatch in fnmatch.filter(filenames, e_pattern): source.append(os.path.abspath(os.path.join(root, pmatch))) else: source.append(os.path.abspath(os.path.join(root, filenames))) else: for filename in os.listdir(os.path.abspath(e)): if example_patterns: for e_pattern in example_patterns: if fnmatch.fnmatchcase(filename, e_pattern): source.append(os.path.abspath(os.path.join(e, filename))) else: if os.path.isfile(os.path.join(e, filename)): source.append(os.path.abspath(os.path.join(e, filename))) ############################################################################ # PROCESS HTML TAGS ############################################################################ if config.has_option('doxy_config', 'generate_html'): if config.get('doxy_config', 'generate_html') == 'NO': generate_html = False if generate_html: if config.has_option('doxy_config', 'html_header'): html_header = config.get('doxy_config', 'html_header') html_header = _doxygen_expand_environment_vars(html_header, env) html_header = _doxygen_replace_start_hash_if_found(html_header, env) # relative paths are relative to the location of the config file if not os.path.isabs(html_header): html_header = os.path.join(config_file_path, html_header) if os.path.isfile(html_header): source.append(os.path.abspath(html_header)) if config.has_option('doxy_config', 'html_footer'): html_footer = config.get('doxy_config', 'html_footer') html_footer = _doxygen_expand_environment_vars(html_footer, env) html_footer = _doxygen_replace_start_hash_if_found(html_footer, env) # relative paths are relative to the location of the config file if not os.path.isabs(html_footer): html_footer = os.path.join(config_file_path, html_footer) if os.path.isfile(html_footer): source.append(os.path.abspath(html_footer)) if config.has_option('doxy_config', 'html_stylesheet'): html_stylesheet = config.get('doxy_config', 'html_stylesheet') html_stylesheet = _doxygen_expand_environment_vars(html_stylesheet, env) html_stylesheet = _doxygen_replace_start_hash_if_found(html_stylesheet, env) # relative paths are relative to the location of the config file if not os.path.isabs(html_stylesheet): html_stylesheet = os.path.join(config_file_path, html_stylesheet) if os.path.isfile(html_stylesheet): source.append(os.path.abspath(html_stylesheet)) if config.has_option('doxy_config', 'html_extra_stylesheet'): html_extra_stylesheet = config.get('doxy_config', 'html_extra_stylesheet') html_extra_stylesheet = _doxygen_expand_environment_vars(html_extra_stylesheet, env) html_extra_stylesheet = _doxygen_replace_start_hash_if_found(html_extra_stylesheet, env) # relative paths are relative to the location of the config file if not os.path.isabs(html_extra_stylesheet): html_extra_stylesheet = os.path.join(config_file_path, html_extra_stylesheet) if os.path.isfile(html_extra_stylesheet): source.append(os.path.abspath(html_extra_stylesheet)) if config.has_option('doxy_config', 'html_extra_files'): html_extra_files = config.get('doxy_config', 'html_extra_files').replace('\\', '').split() for hef in html_extra_files: hef = _doxygen_expand_environment_vars(hef, env) hef = _doxygen_replace_start_hash_if_found(hef, env) # relative paths are relative to the location of the config file if not os.path.isabs(hef): hef = os.path.join(config_file_path, hef) if os.path.isfile(hef): source.append(os.path.abspath(hef)) ############################################################################ # PROCESS IMAGE_PATH TAG ############################################################################ # since doxygen's only limit on image formats is that it must be supported by # based on the document type being produced. We simply look at every file in # the folder specified in the image_path and add them to the source list. if config.has_option('doxy_config', 'image_path'): image_path = config.get('doxy_config','image_path') image_path = _doxygen_expand_environment_vars(image_path, env) image_path = _doxygen_replace_start_hash_if_found(image_path, env) if image_path: # relative paths are relative to the location of the config file if not os.path.isabs(image_path): image_path = os.path.join(config_file_path, image_path) for filename in os.listdir(os.path.abspath(image_path)): if os.path.isfile(os.path.join(image_path, filename)): source.append(os.path.abspath(os.path.join(image_path, filename))) ############################################################################ # PROCESS LAYOUT_FILE TAG ############################################################################ # if layout file found add is to the source list. If not found see if the # default layout file is present 'DoxygenLayout.xml' if it is present add it # to the source files list. if config.has_option('doxy_config', 'layout_file'): layout_file = config.get('doxy_config', 'layout_file') if os.path.isfile(layout_file): source.append(os.path.abspath(layout_file)) else: if os.path.isfile('DoxygenLayout.xml'): source.append(os.path.abspath('DoxygenLayout.xml')) ############################################################################ # PROCESS LATEX / PDF input ############################################################################ if config.has_option('doxy_config', 'generate_latex'): if config.get('doxy_config', 'generate_latex') == 'NO': generate_latex = False if generate_latex: if config.has_option('doxy_config', 'latex_header'): latex_header = config.get('doxy_config', 'latex_header') latex_header = _doxygen_expand_environment_vars(latex_header, env) latex_header = _doxygen_replace_start_hash_if_found(latex_header, env) # relative paths are relative to the location of the config file if not os.path.isabs(latex_header): latex_header = os.path.join(config_file_path, latex_header) if os.path.isfile(latex_header): source.append(os.path.abspath(latex_header)) if config.has_option('doxy_config', 'latex_footer'): latex_footer = config.get('doxy_config', 'latex_footer') latex_footer = _doxygen_expand_environment_vars(latex_footer, env) latex_footer = _doxygen_replace_start_hash_if_found(latex_footer, env) # relative paths are relative to the location of the config file if not os.path.isabs(latex_footer): latex_footer = os.path.join(config_file_path, latex_footer) if os.path.isfile(latex_footer): source.append(os.path.abspath(latex_footer)) if config.has_option('doxy_config', 'latex_extra_files'): latex_extra_files = config.get('doxy_config', 'latex_extra_files').replace('\\', '').split() for lef in latex_extra_files: lef = _doxygen_expand_environment_vars(lef, env) lef = _doxygen_replace_start_hash_if_found(lef, env) # relative paths are relative to the location of the config file if not os.path.isabs(lef): lef = os.path.join(config_file_path, lef) if os.path.isfile(lef): source.append(os.path.abspath(lef)) # TODO list of tags that effect the source and target list that are not # processed. Since none of our config files currently use these tags not # processing them should not affect the output. If any of these tags are # used then this emitter may need to be expanded. # EXCLUDE # EXLUDE_SYMLINKS # EXLUDE_PATTERNS # INPUT_FILTER # FILTER_PATTERNS # FILTER_SOURCE_FILES # FILTER_SOURCE_PATTERNS # CITE_BIB_FILES # GENERATE_HTMLHELP # CHM_FILE # HHC_LOCATION # GENERATE_CHI # GENERATE_QHP # QCH_FILE # QHC_LOCATION # QHC_NAMESPACE # QHP_VIRTUAL_FOLDER # QHP_CUST_FILTER_NAME # GENERATE_ECLIPSEHELP # USE_MATHJAX # MATHJAX_RELPATH # MATHJAX_CODEFILE # GENERATE_RTF # RTF_OUTPUT # RTF_STYLESHEET_FILE # RTF_EXTENSIONS_FILE # GENERATE_MAN # MAN_OUPUT # MAN_EXTENSION # GENERATE_XML # XML_OUTPUT # XML_SCHEMA # XML_DTD # GENERATE_DOCBOOK # DOCBOOK_OUTPUT # GENERATE_AUTOGEN_DEF # GENERATE_PERLMOD # TAGFILES # GENERATE_TAGFILE # Debug print statments used while developing #print "*** Doxygen Scanner ***" #print "*** list of source files ***" #for s in source: # print str(s) #print "\n\n"any return source def _doxygen_emitter(target, source, env): # work around its Safe to use the Doxygen Builder by only specifying the # config file as the source however SCons auto generates what it thinks is # the proper target. The auto generated target is wrong if the config # file is specified as the source and no target is specified. This will # remove the source config file as a target. And prevents circular # dependencies for t in target: for s in source: if s == t: target.remove(s) config_file_path = '.' config = ConfigParser.SafeConfigParser() try: fp = open(str(source[0]), 'r') config.readfp(FakeSecHead(fp)) finally: fp.close() config_file_path = os.path.abspath(os.path.dirname(str(source[0]))) generate_html = True generate_latex = True output_directory = config_file_path html_output = 'html' latex_output = 'latex' if config.has_option('doxy_config', 'output_directory'): output_directory_from_config = config.get('doxy_config', 'output_directory') output_directory_from_config = _doxygen_expand_environment_vars(output_directory_from_config, env) output_directory_from_config = _doxygen_replace_start_hash_if_found(output_directory_from_config, env) # relative paths are relative to the location of the config file if not os.path.isabs(output_directory_from_config): output_directory_from_config = os.path.join(config_file_path, output_directory_from_config) if os.path.isdir(output_directory_from_config): output_directory = output_directory_from_config # Some versions of doxygen will fail to create the output directory if it does # not already exist. And will report that the directory does not exist and # cannot be created. This will by pass this error by creating the dictionary # for doxygen if not os.path.exists(output_directory): output_directory_from_config = config.get('doxy_config', 'output_directory') output_directory_from_config = _doxygen_expand_environment_vars(output_directory_from_config, env) env.Mkdir(output_directory_from_config) ############################################################################ # PROCESS HTML TAGS ############################################################################ if config.has_option('doxy_config', 'generate_html'): if config.get('doxy_config', 'generate_html') == 'NO': generate_html = False if generate_html: if config.has_option('doxy_config', 'html_output'): html_output_from_config = config.get('doxy_config', 'html_output') html_output_from_config = _doxygen_expand_environment_vars(html_output_from_config, env) html_output_from_config = _doxygen_replace_start_hash_if_found(html_output_from_config, env) if html_output_from_config: html_output = html_output_from_config # SCons considers directory nodes upto date if they exist. Past the # fist run of the script the directory exist preventing it from # generating a dependency graph on subsiquent runs. By adding a file # to the targets we are able to workaround this issue. Since index.html # is always updated with the build date it was chosen. target.append(env.File(os.path.abspath(os.path.join(output_directory, html_output + '/index.html')))) env.Clean(source, env.Dir(os.path.abspath(os.path.join(output_directory, html_output)))) ############################################################################ # PROCESS LATEX / PDF input ############################################################################ if config.has_option('doxy_config', 'generate_latex'): if config.get('doxy_config', 'generate_latex') == 'NO': generate_latex = False if generate_latex: if config.has_option('doxy_config', 'latex_output'): latex_output_from_config = config.get('doxy_config', 'latex_output') latex_output_from_config = _doxygen_expand_environment_vars(latex_output_from_config, env) latex_output_from_config = _doxygen_replace_start_hash_if_found(latex_output_from_config, env) if latex_output_from_config: latex_output = latex_output_from_config # SCons considers directory nodes upto date if they exist. Past the # fist run of the script the directory exist preventing it from # generating a dependency graph on subsiquent runs. By adding a file # to the targets we are able to workaround this issue. Since refman.tex # is always updated with the build date it was chosen. target.append(env.File(os.path.abspath(os.path.join(output_directory, latex_output + '/refman.tex')))) env.Clean(source, env.Dir(os.path.abspath(os.path.join(output_directory, latex_output)))) # Debug print statments used while developing #print "*** Doxygen Emiter***" #print "*** list of source files ***" #for s in source: # print str(s) #print "\n\n" #print "*** list of target files ***" #for t in target: # print str(t) #print "\n\n" return target, source def generate(env): # Add Builders for the Doxygen documentation tool import SCons.Builder doxygen_scanner = env.Scanner(name = 'doxygen_scanner', function = _doxygen_scanner) doxygen_builder = SCons.Builder.Builder( action = '${DOXYGENCOM}', emitter = _doxygen_emitter, source_scanner = doxygen_scanner, single_source = 1 ) env.Append(BUILDERS = { 'Doxygen': doxygen_builder, }) env.AppendUnique( DOXYGEN = 'doxygen', DOXYGENFLAGS = '', DOXYGENCOM = 'cd ${SOURCE.dir} && ${DOXYGEN} ${DOXYGENFLAGS} ${SOURCE.file}' ) # SystemDrive environment variable is used by doxygen on some systems to write # cach files. If the OS defines the enviroment variable 'SystemDrive' make # sure it is imported into the scons environment. if os.environ.has_key('SystemDrive'): env.PrependENVPath('SystemDrive', os.path.normpath(os.environ['SystemDrive'])) def exists(env): """ Make sure doxygen exists. """ return env.Detect("doxygen") base-16.04/build_core/tools/scons/genversion.py000066400000000000000000000150751272147170000215740ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import getpass import platform import os import re import sys from subprocess import * ver_re = re.compile('int\s+(?Pyear|month|feature|bugfix)\s*=\s*\'?(?P\w+)\'?\s*;') def GetBuildInfo(env, source, stderr=PIPE ): branches = [] tags = [] remotes = [] if env.has_key('GIT'): try: remotes = Popen([env['GIT'], 'remote', '-v'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() branches = Popen([env['GIT'], 'branch'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() tags = Popen([env['GIT'], 'describe', '--always', '--long', '--abbrev=40'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() except WindowsError as e: if e[0] == 2: try: project = Popen([env['GIT'], 'remote', '-v'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() branches = Popen([env['GIT'] + '.cmd', 'branch'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() tags = Popen([env['GIT'] + '.cmd', 'describe', '--always', '--long', '--abbrev=40'], stdout = PIPE, stderr = stderr, cwd = source).communicate()[0].splitlines() except: pass except: pass branch = None for b in branches: if b[0] == '*': branch = b[2:] break tag = None commit_delta = None commit_hash = None gitname = 'Git' if remotes: for l in remotes: m = re.search( r'^origin\s(?P.*)\s\(fetch\)$', l ) if m: n = re.search( r'^.*/(?P.+)$', m.group('url').strip() ) if n: gitname = 'Git: %s' % ( n.group('gitname').strip() ) break if tags: if tags[0].find('-') >= 0: tag, commit_delta, commit_hash = tuple(tags[0].rsplit('-',2)) commit_hash = commit_hash[1:] # lop off the "g" else: tag = '' commit_delta = 0; commit_hash = tags[0] if branch or commit_hash: bld_string = gitname else: bld_string = '' if branch: bld_string += " branch: '%s'" % branch if commit_hash: bld_string += " tag: '%s'" % tag if commit_delta: bld_string += ' (+%s changes)' % commit_delta if commit_delta or tag == '': bld_string += ' commit ref: %s' % commit_hash return bld_string def ParseSource(source): year = 0 month = 0 feature = 0 bugfix = '' f = open(source, 'r') lines = f.readlines() f.close(); for l in lines: m = ver_re.search(l) if m: d = m.groupdict() if d['REL'] == 'year': year = int(d['VAL']) elif d['REL'] == 'month': month = int(d['VAL']) elif d['REL'] == 'feature': feature = int(d['VAL']) elif d['REL'] == 'bugfix': if ord(d['VAL']) == ord('0'): bugfix = '' else: bugfix = '%c' % ord(d['VAL']) return (year, month, feature, bugfix, lines) def GenVersionAction(source, target, env): import time year, month, feature, bugfix, lines = ParseSource(str(source[0])) fpath = os.path.abspath(os.path.dirname(str(source[0]))) bld_info = GetBuildInfo(env, fpath) date = time.strftime('%a %b %d %H:%M:%S UTC %Y', time.gmtime()) version_str = 'v%(year)d.%(month)02d.%(feature)02d%(bugfix)s' % ({ 'year': year, 'month': month, 'feature': feature, 'bugfix': bugfix }) build_str = '%(ver)s (Built %(date)s by %(user)s%(bld)s)' % ({ 'ver': version_str, 'date': date, 'user': getpass.getuser(), 'bld': (bld_info and ' - ' + bld_info) or '' }) f = open(str(target[0]), 'w') f.write('/* This file is auto-generated. Do not modify. */\n') for l in lines: if l.find('##VERSION_STRING##') >= 0: f.write(l.replace('##VERSION_STRING##', version_str)) elif l.find('##BUILD_STRING##') >= 0: f.write(l.replace('##BUILD_STRING##', build_str)) else: f.write(l) f.close() def generate(env): import SCons.Builder builders = [ SCons.Builder.Builder(action = GenVersionAction, suffix = '.cc', src_suffix = '.cc.in'), SCons.Builder.Builder(action = GenVersionAction, suffix = '.c', src_suffix = '.c.in') ] env.Append(BUILDERS = { 'GenVersion' : builders[0] }) if env.Detect('git'): env.AppendUnique(GIT = 'git') def exists(env): return true # "main" calls GetBuildInfo() and prints bld_string on stdout # "main" takes one argument: path to git workspace (optional) # "git" executable is expected to be found in PATH def main( argv=None ): env = dict() env['GIT'] = 'git' source = '' if argv and argv[0]: source = argv[0].strip() if source == '': source = '.' bld_string = GetBuildInfo( env, source, stderr=None ) if bld_string and bld_string != '': print '%s' % ( bld_string ) return 0 else: sys.stderr.write( 'error, unable to get Git version info\n' ) sys.stderr.flush() return 1 if __name__ == '__main__': if len(sys.argv) > 1: sys.exit(main(sys.argv[1:])) else: sys.exit(main()) base-16.04/build_core/tools/scons/javadoc.py000066400000000000000000000127451272147170000210250ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import os import os.path import re import string from datetime import datetime import SCons.Builder from SCons.Node.FS import _my_normcase from SCons.Tool.JavaCommon import parse_java_file _re_package = re.compile(r'^\s*package\s+([A-Za-z\.]+)', re.M) _re_public = re.compile(r'^public', re.M) def parse_javadoc_file(fn): """ Return the package name of Java files with a public class. As configured here, javadoc only generates documentation for public classes. """ contents = open(fn, 'r').read() pkg = _re_package.search(contents).group(1) if _re_public.search(contents): return pkg def javadoc_emitter(source, target, env): """ Look in the source directory for all .java and .html files. Only those .java files with public classes will be listed as a source dependency. The target is a single file: DOCS/index.html (always generated by javadoc). I could not figure out how to get SCons to use a directory as a target, therefore the use of the pseudo-builder JavaDoc (and also to handle clean correctly). """ slist = [] for entry in source: def visit(sl, dirname, names): d = env.Dir(dirname) for fn in names: if os.path.splitext(fn)[1] in ['.java']: f = d.File(fn) f.attributes.javadoc_src = source f.attributes.javadoc_sourcepath = entry.abspath pkg = parse_javadoc_file(str(f)) if pkg: f.attributes.javadoc_pkg = pkg slist.append(f) elif os.path.splitext(fn)[1] in ['.html']: f = d.File(fn) f.attributes.javadoc_src = source f.attributes.javadoc_sourcepath = entry.abspath if os.path.basename(str(f)) == 'overview.html': f.attributes.javadoc_overview = '"' + env.File(str(f)).abspath + '"' slist.append(f) os.path.walk(entry.abspath, visit, slist) slist = env.Flatten(slist) tlist = [target[0].File('index.html')] return tlist, slist def javadoc_generator(source, target, env, for_signature): javadoc_classpath = '-classpath \"%s\"' % (env['JAVACLASSPATH']) javadoc_windowtitle = '-windowtitle \"%s\"' % (env['PROJECT_LONG_NAME']) javadoc_doctitle = '-doctitle \"%s

%s

\"' % (env['PROJECT_LONG_NAME'], env['PROJECT_NUMBER']) javadoc_header = '-header \"%s\"' % (env['PROJECT_SHORT_NAME']) try: copyright = env['PROJECT_COPYRIGHT'] except KeyError: copyright = "Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN \"AS-IS\" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION" javadoc_bottom = '-bottom \"' + "%s %s ($(%s$))
%s
" % (env['PROJECT_LONG_NAME'], env['PROJECT_NUMBER'], datetime.now().strftime('%a %b %d %H:%M:%S %Y'), copyright) + '\"' javadoc_overview = '' for s in source: try: javadoc_overview = '-overview ' + s.attributes.javadoc_overview except AttributeError: pass javadoc_sourcepath = [] for s in source: try: javadoc_sourcepath.append(s.attributes.javadoc_sourcepath) except AttributeError: pass javadoc_sourcepath = os.pathsep.join(set(javadoc_sourcepath)) javadoc_packages = [] for s in source: try: javadoc_packages.append(s.attributes.javadoc_pkg) except AttributeError: pass javadoc_packages = ' '.join(set(javadoc_packages)) com = 'javadoc %s -use %s %s -quiet -public -noqualifier all %s %s %s -sourcepath "%s" -d ${TARGET.dir} %s' % (javadoc_classpath, javadoc_windowtitle, javadoc_doctitle, javadoc_header, javadoc_bottom, javadoc_overview, javadoc_sourcepath, javadoc_packages) return com def JavaDoc(env, target, source, *args, **kw): """ JavaDoc('docs', 'src') will call javadoc on all public .java files under the 'src' directory. Package and private .java files are ignored. """ apply(env.JavaDocBuilder, (target, source) + args, kw) env.Clean(target, target) return [env.Dir(target)] def generate(env): fs = SCons.Node.FS.get_default_fs() javadoc_builder = SCons.Builder.Builder( generator = javadoc_generator, emitter = javadoc_emitter, target_factory = fs.Dir, source_factory = fs.Dir) env.Append(BUILDERS = { 'JavaDocBuilder': javadoc_builder }) env.AddMethod(JavaDoc, 'JavaDoc') def exists(env): """ Make sure javadoc exists. """ return env.Detect("javadoc") base-16.04/build_core/tools/scons/javastatus.py000066400000000000000000000151171272147170000215770ustar00rootroot00000000000000#!/usr/bin/python # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import os import getopt from xml.dom import minidom from xml.sax.saxutils import escape if sys.version_info[:3] < (2,4,0): from sets import Set as set includeSet = set() def openFile(name, type): try: return open(name, type) except IOError, e: errno, errStr = e print "I/O Operation on %s failed" % name print "I/O Error(%d): %s" % (errno, errStr) raise e def main(argv=None): """ make_status --code --base [--deps ] [--help] Where: - Output "Java" code - Root directory for xi:include directives - Ouput makefile dependency file """ global codeOut global depOut global isFirst global fileArgs global baseDir codeOut = None depOut = None isFirst = True baseDir = "" if argv is None: argv = sys.argv[1:] try: opts, fileArgs = getopt.getopt(argv, "h", ["help", "code=", "dep=", "base="]) for o, a in opts: if o in ("-h", "--help"): print __doc__ return 0 if o in ("--code"): codeOut = openFile(a, 'w') if o in ("--dep"): depOut = openFile(a, 'w') if o in ("--base"): baseDir = a if None == codeOut: raise Error("Must specify --code") writeHeaders() for arg in fileArgs: ret = parseDocument(arg) writeFooters() if None != codeOut: codeOut.close() if None != depOut: depOut.close() except getopt.error, msg: print msg print "for help use --help" return 1 except Exception, e: print "ERROR: %s" % e if None != codeOut: os.unlink(codeOut.name) if None != depOut: os.unlink(depOut.name) return 1 return 0 def writeHeaders(): global codeOut global depOut global fileArgs if None != depOut: depOut.write("%s %s %s:" % (depOut.name, codeOut.name)) for arg in fileArgs: depOut.write(" \\\n %s" % arg) if None != codeOut: codeOut.write("""/* This file is auto-generated. Do not modify. */ /* * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package org.alljoyn.bus; /** * Standard function return codes for this package. */ public enum Status { """) def writeFooters(): global codeOut global depOut if None != depOut: depOut.write("\n") if None != codeOut: codeOut.write("""; /** Error Code */ private int errorCode; /** Constructor */ private Status(int errorCode) { this.errorCode = errorCode; } /** Static constructor */ private static Status create(int errorCode) { for (Status s : Status.values()) { if (s.getErrorCode() == errorCode) { return s; } } return NONE; } /** * Gets the numeric error code. * * @return the numeric error code */ public int getErrorCode() { return errorCode; } } """) def parseDocument(fileName): dom = minidom.parse(fileName) for child in dom.childNodes: if child.localName == 'status_block': parseStatusBlock(child) elif child.localName == 'include' and child.namespaceURI == 'http://www.w3.org/2001/XInclude': parseInclude(child) dom.unlink() def parseStatusBlock(blockNode): global codeOut global isFirst offset = 0 for node in blockNode.childNodes: if node.localName == 'offset': offset = int(node.firstChild.data, 0) elif node.localName == 'status': if isFirst: if None != codeOut: codeOut.write("\n /** %s %s. */" % (escape(node.getAttribute('value')), escape(node.getAttribute('comment')))) codeOut.write("\n %s(%s)" % (node.getAttribute('name')[3:], node.getAttribute('value'))) isFirst = False else: if None != codeOut: codeOut.write(",\n /** %s %s. */" % (escape(node.getAttribute('value')), escape(node.getAttribute('comment')))) codeOut.write("\n %s(%s)" % (node.getAttribute('name')[3:], node.getAttribute('value'))) offset += 1 elif node.localName == 'include' and node.namespaceURI == 'http://www.w3.org/2001/XInclude': parseInclude(node) def parseInclude(includeNode): global baseDir global includeSet href = os.path.join(baseDir, includeNode.attributes['href'].nodeValue) if href not in includeSet: includeSet.add(href) if None != depOut: depOut.write(" \\\n %s" % href) parseDocument(href) def JavaStatus(source): return main(['--base=%s' % os.path.abspath('..'), '--code=%s.java' % source, '%s.xml' % source]) if __name__ == "__main__": sys.exit(main()) base-16.04/build_core/tools/scons/jsdoc3.py000066400000000000000000000062261272147170000206000ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import SCons.Builder import SCons.Action import os def _jsdoc3_scanner(node, env, path): source = [] # walk the JSDOC_TEMPLATE dir and add the files in the demplate dir to the # source list. This way documentation will be rebuilt if a template file is # modified template_dir = env.Dir('$JSDOC_TEMPLATE') for root, dir, filenames in os.walk(str(template_dir)): for f in filenames: source.append(os.path.abspath(os.path.join(root, f))) return source def _jsdoc3_emitter(target, source, env): if len(target) > 1: print('scons: *** Only one target may be specified for the jsdoc3 Builder.') exit(1) if type(target[0]) != SCons.Node.FS.Dir: print('scons: *** Target MUST be a Dir node.') exit(1); outputDir = target[0]; # SCons considers directory nodes upto date if they exist. Past the # fist run of the script the directory exist preventing it from # generating a dependency graph on subsiquent runs. By adding a file # to the targets we are able to workaround this issue. Since index.html # is always updated with the build date it was chosen. target[0] = env.File(str(target[0]) + '/index.html') # make sure the output directory is cleaned. env.Clean(env.File(source), outputDir) return target, source def generate(env): jsdoc3_scanner = env.Scanner(name = 'jsdoc3_scanner', function = _jsdoc3_scanner) _jsdoc3_action = SCons.Action.Action('${JSDOCCOM}', '${JSDOCCOMSTR}') _jsdoc3_builder = SCons.Builder.Builder( action ='jsdoc ${JSDOC_FLAGS} -t ${JSDOC_TEMPLATE} -d ${TARGET.dir} ${SOURCES}', src_suffix = '$JSDOC_SUFFIX', emitter = _jsdoc3_emitter, source_scanner = jsdoc3_scanner ) env.Append(BUILDERS = { 'jsdoc3': _jsdoc3_builder, }) env.AppendUnique( JSDOCCOM = 'jsdoc ${JSDOC_FLAGS} -t ${JSDOC_TEMPLATE} -d ${TARGET.dir} ${SOURCES}', JSDOCCOMSTR = '${JSDOCCOM}', # Suffixes/prefixes JSDOC_SUFFIX = '.js', # JSDoc 2 build flags JSDOC_FLAGS = '', # directory containing the publish.js and other template files. JSDOC_TEMPLATE = env.Dir('templates') ) def exists(env): """ Make sure jsDoc exists. """ run_exists = env.Detect('jsdoc') return (java_exists and jsrun_exists and run_exists) base-16.04/build_core/tools/scons/jsstatus.py000066400000000000000000000151441272147170000212720ustar00rootroot00000000000000#!/usr/bin/python # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import os import getopt from xml.dom import minidom if sys.version_info[:3] < (2,4,0): from sets import Set as set includeSet = set() def openFile(name, type): try: return open(name, type) except IOError, e: errno, errStr = e print "I/O Operation on %s failed" % name print "I/O Error(%d): %s" % (errno, errStr) raise e def main(argv=None): """ make_status --code --base [--deps ] [--help] Where: - Output "C++" code - Root directory for xi:include directives - Ouput makefile dependency file """ global codeOut global depOut global isFirst global fileArgs global baseDir codeOut = None depOut = None isFirst = True baseDir = "" if argv is None: argv = sys.argv[1:] try: opts, fileArgs = getopt.getopt(argv, "h", ["help", "code=", "dep=", "base="]) for o, a in opts: if o in ("-h", "--help"): print __doc__ return 0 if o in ("--code"): codeOut = openFile(a, 'w') if o in ("--dep"): depOut = openFile(a, 'w') if o in ("--base"): baseDir = a if None == codeOut: raise Error("Must specify --code") writeHeaders() for arg in fileArgs: ret = parseDocument(arg) writeFooters() if None != codeOut: codeOut.close() if None != depOut: depOut.close() except getopt.error, msg: print msg print "for help use --help" return 1 except Exception, e: print "ERROR: %s" % e if None != codeOut: os.unlink(codeOut.name) if None != depOut: os.unlink(depOut.name) return 1 return 0 def writeHeaders(): global codeOut global depOut global fileArgs if None != depOut: depOut.write("%s %s %s:" % (depOut.name, codeOut.name)) for arg in fileArgs: depOut.write(" \\\n %s" % arg) if None != codeOut: codeOut.write("""/* This file is auto-generated. Do not modify. */ /* * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "BusErrorInterface.h" #include "TypeMapping.h" #include #define QCC_MODULE "ALLJOYN_JS" std::map _BusErrorInterface::constants; std::map& _BusErrorInterface::Constants() { if (constants.empty()) { """) def writeFooters(): global codeOut global depOut if None != depOut: depOut.write("\n") if None != codeOut: codeOut.write(""" } return constants; } _BusErrorInterface::_BusErrorInterface(Plugin& plugin) : ScriptableObject(plugin, Constants()) { QCC_DbgTrace(("%s", __FUNCTION__)); ATTRIBUTE("name", &_BusErrorInterface::getName, 0); ATTRIBUTE("message", &_BusErrorInterface::getMessage, 0); ATTRIBUTE("code", &_BusErrorInterface::getCode, 0); } _BusErrorInterface::~_BusErrorInterface() { QCC_DbgTrace(("%s", __FUNCTION__)); } bool _BusErrorInterface::getName(NPVariant* result) { ToDOMString(plugin, plugin->error.name, *result, TreatEmptyStringAsUndefined); return true; } bool _BusErrorInterface::getMessage(NPVariant* result) { ToDOMString(plugin, plugin->error.message, *result, TreatEmptyStringAsUndefined); return true; } bool _BusErrorInterface::getCode(NPVariant* result) { if (ER_NONE == plugin->error.code) { VOID_TO_NPVARIANT(*result); } else { ToUnsignedShort(plugin, plugin->error.code, *result); } return true; } """) def parseDocument(fileName): dom = minidom.parse(fileName) for child in dom.childNodes: if child.localName == 'status_block': parseStatusBlock(child) elif child.localName == 'include' and child.namespaceURI == 'http://www.w3.org/2001/XInclude': parseInclude(child) dom.unlink() def parseStatusBlock(blockNode): global codeOut offset = 0 for node in blockNode.childNodes: if node.localName == 'offset': offset = int(node.firstChild.data, 0) elif node.localName == 'status': if None != codeOut: codeOut.write(" CONSTANT(\"%s\", %s);\n" % (node.getAttribute('name')[3:], node.getAttribute('value'))) offset += 1 elif node.localName == 'include' and node.namespaceURI == 'http://www.w3.org/2001/XInclude': parseInclude(node) def parseInclude(includeNode): global baseDir global includeSet href = os.path.join(baseDir, includeNode.attributes['href'].nodeValue) if href not in includeSet: includeSet.add(href) if None != depOut: depOut.write(" \\\n %s" % href) parseDocument(href) def JavaScriptStatus(source, dest): return main(['--base=%s' % os.path.abspath('.'), '--code=%s' % dest, '%s' % source]) if __name__ == "__main__": sys.exit(main()) base-16.04/build_core/tools/scons/patches/000077500000000000000000000000001272147170000204625ustar00rootroot00000000000000base-16.04/build_core/tools/scons/patches/SConsWin8.txt000066400000000000000000000267201272147170000230250ustar00rootroot00000000000000diff --recursive -u --exclude=*.pyc --exclude=*.pyo ../../scons-2.2.0/engine/scons/Tool/MSCommon/common.py ./Tool/MSCommon/common.py --- ../../scons-2.2.0/engine/scons/Tool/MSCommon/common.py Fri Sep 14 10:15:31 2012 +++ ./Tool/MSCommon/common.py Fri Sep 14 09:56:01 2012 @@ -135,7 +135,11 @@ # controlled by vc.py, or else derived from the common_tools_var # settings in vs.py. vars = [ + 'ProgramFiles', + 'ProgramFiles(x86)', 'COMSPEC', + 'VS110COMNTOOLS', + 'VS100COMNTOOLS', 'VS90COMNTOOLS', 'VS80COMNTOOLS', 'VS71COMNTOOLS', diff --recursive -u --exclude=*.pyc --exclude=*.pyo ../../scons-2.2.0/engine/scons/Tool/MSCommon/sdk.py ./Tool/MSCommon/sdk.py --- ../../scons-2.2.0/engine/scons/Tool/MSCommon/sdk.py Fri Sep 14 10:15:31 2012 +++ ./Tool/MSCommon/sdk.py Fri Sep 14 09:55:06 2012 @@ -125,6 +125,30 @@ debug("sdk.py: get_sdk_vc_script():file:%s"%file) return file + def get_sdk_appx_subdir(self): + """ Return the script to initialize the VC compiler installed by SDK + """ + + if self.__dict__.has_key('vc_appx_subdir') == False: + return None + + appx_subdir = self.vc_appx_subdir; + if not appx_subdir: + debug("sdk.py: get_sdk_appx_subdir():sdk doesn't support appx"); + return None + + file=os.path.join(self.find_sdk_dir(), appx_subdir) + if not file: + debug("sdk.py: get_sdk_appx_subdir():no file") + else: + debug("sdk.py: get_sdk_appx_subdir():file:%s"%file) + + if not os.path.exists(file): + debug("sdk.py: get_sdk_appx_subdir(): sanity check %s not found" % ftc) + return None + + return file + class WindowsSDK(SDKDefinition): """ A subclass for trying to find installed Windows SDK directories. @@ -164,6 +188,21 @@ 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', 'ia64' : r'bin\vcvarsia64.bat'} +SDK71VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', + 'amd64' : r'bin\vcvars64.bat', + 'x86_amd64': r'bin\vcvarsx86_amd64.bat', + 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', + 'ia64' : r'bin\vcvarsia64.bat'} + +SDK80VCSetupScripts = { 'x86' : r'bin\vcvars32.bat', + 'amd64' : r'bin\vcvars64.bat', + 'x86_amd64' : r'bin\vcvarsx86_amd64.bat', + 'x86_ia64' : r'bin\vcvarsx86_ia64.bat', + 'ia64' : r'bin\vcvarsia64.bat', + 'amd64_arm' : r'bin\vcvarsarm.bat', + 'x86_arm' : r'bin\vcvarsarm.bat'} + + # The list of support SDKs which we know how to detect. # # The first SDK found in the list is the one used by default if there @@ -172,6 +211,27 @@ # # If you update this list, update the documentation in Tool/mssdk.xml. SupportedSDKList = [ + WindowsSDK('8.0', + sanity_check_file=r'bin\x86\makeappx.exe', + include_subdir='include', + lib_subdir={ + 'x86' : ['lib'], + 'x86_64' : [r'lib\x64'], + 'ia64' : [r'lib\ia64'], + }, + vc_setup_scripts = SDK80VCSetupScripts, + vc_appx_subdir = 'References\\CommonConfiguration\\Neutral', + ), + WindowsSDK('7.1', + sanity_check_file=r'bin\SetEnv.Cmd', + include_subdir='include', + lib_subdir={ + 'x86' : ['lib'], + 'x86_64' : [r'lib\x64'], + 'ia64' : [r'lib\ia64'], + }, + vc_setup_scripts = SDK71VCSetupScripts, + ), WindowsSDK('7.0', sanity_check_file=r'bin\SetEnv.Cmd', include_subdir='include', diff --recursive -u --exclude=*.pyc --exclude=*.pyo ../../scons-2.2.0/engine/scons/Tool/MSCommon/vc.py ./Tool/MSCommon/vc.py --- ../../scons-2.2.0/engine/scons/Tool/MSCommon/vc.py Fri Sep 14 10:15:31 2012 +++ ./Tool/MSCommon/vc.py Fri Sep 14 10:06:05 2012 @@ -81,6 +81,7 @@ "itanium" : "ia64", "x86" : "x86", "x86_64" : "amd64", + "arm" : "arm", } # Given a (host, target) tuple, return the argument for the bat file. Both host @@ -90,7 +91,9 @@ ("x86", "amd64"): "x86_amd64", ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", - ("x86", "ia64"): "x86_ia64" + ("x86", "ia64"): "x86_ia64", + ("amd64", "arm"): "x86_arm", + ("x86", "arm"): "x86_arm", } def get_host_target(env): @@ -155,6 +158,12 @@ '6.0': [ r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir'] } + +_VCVER_APPX_PLATFORM_DIR = { + '11.0Exp' : [r'vcpackages'], + '11.0' : [r'vcpackages'], +} + def msvc_version_to_maj_min(msvc_version): msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) @@ -227,6 +236,23 @@ raise MissingConfiguration("registry dir %s not found on the filesystem" % comps) return None +def find_vc_appx_dir(env,msvc_version): + pdir = find_vc_pdir(msvc_version) + if pdir is None: + return None + + debug('vc.py: find_vc_appx_dir(): found directory for VC version %s' % repr(msvc_version)) + + if _VCVER_APPX_PLATFORM_DIR.has_key(msvc_version) == False: + debug('vc.py: find_vc_appx_dir(): no appx directory specified for VC version %s' % repr(msvc_version)) + return None + + subdir = _VCVER_APPX_PLATFORM_DIR[msvc_version][0] + + pdir = os.path.join(pdir, subdir) + debug('vc.py: find_vc_appx_dir(): found platform directory %s' % pdir) + return pdir + def find_batch_file(env,msvc_version,host_arch,target_arch): """ Find the location of the batch script which should set up the compiler @@ -417,6 +443,48 @@ return d +def msvc_appx_metadata_to_flags(env,appx_sdk_directory): + debug('msvc_appx_metadata_to_flags()') + + dirList = os.listdir(appx_sdk_directory) + for fname in dirList: + if fname.endswith(".winmd"): + env.Append(_APPX_CXXFLAGS=['/FU%s\\%s' % (appx_sdk_directory, fname)]) + return + +def msvc_setup_appx_env(env, version): + debug('msvc_setup_appx_env()') + + # detect if appx sdk is installed + appx_sdk_version = os.environ.get('APPX_MSSDK_VERSION') + if appx_sdk_version: + debug('msvc_setup_appx_env: using specified APPX_MSSDK_VERSION version %s\n' % repr(appx_sdk_version)) + appx_sdk = sdk.get_sdk_by_version(appx_sdk_version) + if appx_sdk is None: + debug('msvc_setup_appx_env: APPX_MSSDK_VERSION %s was not found installed\n' % repr(appx_sdk_version)) + return + + appx_sdk_directory = appx_sdk.get_sdk_appx_subdir() + if appx_sdk_directory is None: + debug('msvc_setup_appx_env: APPX_MSSDK_VERSION %s is missing its metadata directory\n' % repr(appx_sdk_version)) + return + + env.Append(_APPX_CXXFLAGS=['/AI%s' % appx_sdk_directory]) + cxxflags = env['_APPX_CXXFLAGS'] + + msvc_appx_metadata_to_flags(env,appx_sdk_directory) + + # now, add the platform specific metadata file on to the flags + vc_appx_directory = find_vc_appx_dir(env,version) + if vc_appx_directory is None: + debug('msvc_setup_appx_env: no platform appx directory for VC version: %s' % repr(version)) + return + + msvc_appx_metadata_to_flags(env,vc_appx_directory) + else: + debug('msvc_setup_appx_env(): APPX_MSSDK_VERSION not found in env') + + return def msvc_setup_env(env): debug('msvc_setup_env()') @@ -455,6 +523,10 @@ for k, v in d.items(): debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) env.PrependENVPath(k, v, delete_existing=True) + + if env.has_key('APPX_CXXFLAGS') and env['APPX_CXXFLAGS'] == 'true': + msvc_setup_appx_env(env, version) + def msvc_exists(version=None): vcs = cached_get_installed_vcs() diff --recursive -u --exclude=*.pyc --exclude=*.pyo ../../scons-2.2.0/engine/scons/Tool/MSCommon/vs.py ./Tool/MSCommon/vs.py --- ../../scons-2.2.0/engine/scons/Tool/MSCommon/vs.py Fri Sep 14 10:15:31 2012 +++ ./Tool/MSCommon/vs.py Fri Sep 14 10:02:34 2012 @@ -211,28 +211,29 @@ # default_dirname='TBD', #), - # Visual Studio 11 + # Visual Studio 2012 # The batch file we look for is in the VC directory, # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('11.0', - sdk_version='6.1', + vc_version='11.0', + sdk_version='8.0', hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86', 'amd64'], + supported_arch=['x86', 'amd64', "arm"], ), # Visual C++ 11 Express Edition # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + # so the VSWinExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('11.0Exp', vc_version='11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], + sdk_version='8.0', + hkeys=[r'Microsoft\VSWinExpress\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', + executable_path=r'Common7\IDE\VSWinExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', default_dirname='Microsoft Visual Studio 11', supported_arch=['x86'], diff --recursive -u --exclude=*.pyc --exclude=*.pyo ../../scons-2.2.0/engine/scons/Tool/msvc.py ./Tool/msvc.py --- ../../scons-2.2.0/engine/scons/Tool/msvc.py Fri Sep 14 10:15:30 2012 +++ ./Tool/msvc.py Fri Sep 14 09:46:37 2012 @@ -220,7 +220,7 @@ env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}']) env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s \\\"/Fp%s\\\""%(PCHSTOP or "",File(PCH))) or ""}']) env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag - env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS' + env['_CCCOMCOM'] = '$CPPFLAGS $_APPX_CXXFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS' env['CC'] = 'cl' env['CCFLAGS'] = SCons.Util.CLVar('/nologo') env['CFLAGS'] = SCons.Util.CLVar('') @@ -260,7 +260,7 @@ env['CXXFILESUFFIX'] = '.cc' env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) - env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' + env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $_APPX_CXXFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' env['BUILDERS']['PCH'] = pch_builder if 'ENV' not in env: base-16.04/build_scripts/000077500000000000000000000000001272147170000153055ustar00rootroot00000000000000base-16.04/build_scripts/build_darwin_android.sh000077500000000000000000000145721272147170000220200ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # exit_status=0 BASE_SERVICE=$1 VARIANT=$2 WORKSPACE=${WORKSPACE:-$ALLJOYN_ROOT_DIR} case $BASE_SERVICE in controlpanel) SERVICES=(ControlPanel) ;; notification) SERVICES=(ControlPanel Notification) ;; onboarding) SERVICES=(Onboarding) ;; esac SERVICES=( Common_Utils ${SERVICES[@]} ) VRNT=$(echo $VARIANT | tr [A-Z] [a-z]) JAR_DIR=${JAR_DIR:-$WORKSPACE/artifacts/$VRNT/jar} LIB_DIR=${LIB_DIR:-$WORKSPACE/artifacts/$VRNT/lib} CopyAndroidJars () { cp $JAR_DIR/{alljoyn,alljoyn_about}.jar $1 || { echo "Copy of android jars failed!" exit 10 } } CopyAndroidLib () { cp $LIB_DIR/liballjoyn_java.so $1 || { echo "Copy of alljoyn lib failed" exit 10 } } CopyCommonUtils () { cp $WORKSPACE/services/base/sample_apps/android/common_utils/build/deploy/alljoyn_apps_android_utils.jar $1 || { echo "Copy of Common Utils failed" exit 10 } } # TODO make document more DRY: use functions with arguments for other repeated patterns for SERVICE in ${SERVICES[@]}; do SERVICE_NAME=${SERVICE}Service SRVC=$(echo $SERVICE | tr [A-Z] [a-z]) if [ "$SERVICE" = "Common_Utils" ] then PROJ_DIR=$WORKSPACE/services/base/sample_apps/android/common_utils/ elif [ "$SERVICE" = "Notification" ] then PROJ_DIR=$WORKSPACE/services/base/$SRVC/java/native_platform/NotificationServiceNativePlatformAndroid/ else PROJ_DIR=$WORKSPACE/services/base/$SRVC/java/$SERVICE_NAME/ fi pushd $PROJ_DIR mkdir -p libs/ CopyAndroidJars libs/ if [ "$SERVICE" = "Notification" ] then CopyCommonUtils libs/ fi ant -Dsdk.dir=$ANDROID_SDK || { echo "Building $SERVICE failed!" exit 20 } popd case $SERVICE in Common_Utils) continue ;; ControlPanel) PROJ_DIR=$WORKSPACE/services/base/$SRVC/java/${SERVICE}Adapter/ ;; Onboarding) PROJ_DIR=$WORKSPACE/services/base/$SRVC/java/${SERVICE}Manager/android/ ;; esac if [ "$SERVICE" != "Notification" ] then pushd $PROJ_DIR mkdir -p libs/ fi if [ "$SERVICE" = "ControlPanel" ] then cp ../$SERVICE_NAME/build/deploy/${SERVICE_NAME}.jar libs/ || { echo "Copy of $SERVICE_NAME failed!" exit 30 } ant -Dsdk.dir=$ANDROID_SDK $VARIANT || { echo "Building $PROJ_DIR failed" exit 20 } popd fi if [ "$SERVICE" = "Onboarding" ] then cp ../../$SERVICE_NAME/build/deploy/alljoyn_onboarding.jar libs/ || { echo "Copy of $SERVICE_NAME failed!" exit 30 } CopyAndroidJars libs/ CopyCommonUtils libs/ ant -Dsdk.dir=$ANDROID_SDK || { echo "Building $PROJ_DIR failed" exit 20 } popd fi # compile Android .apk case $SERVICE in ControlPanel) APP_DIR=$WORKSPACE/services/base/$SRVC/java/sample_applications/android/${SERVICE}Browser/ ;; Onboarding) APP_DIR=$WORKSPACE/services/base/$SRVC/java/sample_applications/android/${SERVICE}SampleClient/ ;; Notification) APP_DIR=$WORKSPACE/services/base/$SRVC/java/sample_applications/android/${SERVICE}ServiceUISample/ ;; esac pushd $APP_DIR mkdir -p libs/armeabi CopyAndroidJars libs/ CopyAndroidLib libs/armeabi/ CopyCommonUtils libs/ case $SERVICE in ControlPanel|Notification) cp ../../../../../controlpanel/java/ControlPanelService/build/deploy/ControlPanelService.jar ../../../../../controlpanel/java/ControlPanelAdapter/bin/ControlPanelAdapter.jar libs/ || { echo "Copy of ControlPanel libs failed" exit 10 } if [ "$SERVICE" = "ControlPanel" ] then cp $ANDROID_SDK/extras/android/support/v4/android-support-v4.jar libs/ || { echo "Copy of android-support-v4.jar failed" exit 10 } fi if [ "$SERVICE" = "Notification" ] then cp ../../../native_platform/NotificationServiceNativePlatformAndroid/build/deploy/{NotificationService,NSCommons,NSNativePlatformAndr}.jar libs/ || { echo "Copy of notification jars failed" exit 10 } fi ;; Onboarding) cp ../../../$SERVICE_NAME/build/deploy/alljoyn_onboarding.jar libs/ || { echo "Copy of alljoyn_onboarding.jar failed" exit 10 } cp ../../../OnboardingManager/android/build/deploy/alljoyn_onboarding_manager.jar libs/ || { echo "Copy of alljoyn_onboarding_manager.jar failed" exit 10 } ;; esac ant -Dsdk.dir=$ANDROID_SDK $VARIANT || { echo "Building $SERVICE Android .apk failed" exit 20 } # compile 2nd Onboarding sample app and Onboardee server sample if [ "$SERVICE" = "Onboarding" ] then cd ../OnboardingManagerSampleClient/ mkdir -p libs/armeabi CopyAndroidJars libs/ CopyAndroidLib libs/armeabi/ CopyCommonUtils libs/ cp ../../../$SERVICE_NAME/build/deploy/alljoyn_onboarding.jar libs/ || { echo "Copy of alljoyn_onboarding.jar failed" exit 10 } cp ../../../OnboardingManager/android/build/deploy/alljoyn_onboarding_manager.jar libs/ || { echo "Copy of alljoyn_onboarding_manager.jar failed" exit 10 } ant -Dsdk.dir=$ANDROID_SDK $VARIANT || { echo "Building $SERVICE Android .apk failed" exit 20 } cd $WORKSPACE/services/base/simulators/android/about_conf_onb_server/ mkdir -p libs/armeabi CopyAndroidJars libs/ CopyAndroidLib libs/armeabi/ CopyCommonUtils libs/ cp ../../../$SERVICE/java/OnboardingService/build/deploy/alljoyn_onboarding.jar libs/ || { echo "Copy of alljoyn_onboarding.jar failed" exit 10 } cp $JAR_DIR/alljoyn_config.jar libs/ || { echo "Copy of alljoyn_config.jar failed" exit 10 } ant -Dsdk.dir=$ANDROID_SDK $VARIANT || { echo "Building About Conf server failed" exit 20 } fi popd done #SERVICE echo "exit_status = $exit_status" exit $exit_status base-16.04/build_scripts/build_darwin_android_core.sh000077500000000000000000000016311272147170000230200ustar00rootroot00000000000000#!/bin/bash -ex # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # VARIANT=$1 cd core/alljoyn/ scons BINDINGS=java OS=android CPU=arm CRYPTO=builtin VARIANT=$VARIANT base-16.04/build_scripts/build_darwin_ios.sh000077500000000000000000000056351272147170000211720ustar00rootroot00000000000000#!/bin/bash -ex # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ## ## Build services ## #CONFIGURATION_BUILD_DIR=core/alljoyn/build exit_status=0 BASE_SERVICE=$1 VARIANT=$2 WORKSPACE=${WORKSPACE:-$ALLJOYN_ROOT_DIR} case $BASE_SERVICE in controlpanel) SERVICES=(ControlPanel) ;; notification) SERVICES=(ControlPanel Notification) ;; onboarding) SERVICES=(Onboarding) ;; esac SERVICES=( Services_Common ${SERVICES[@]} ) LANGUAGES=(objc cpp) for SERVICE in ${SERVICES[@]}; do SERVICE_NAME=${SERVICE}Service SRVC=$(echo $SERVICE | tr [A-Z] [a-z]) for LANGUAGE in ${LANGUAGES[@]}; do # build product directory PROJ_DIR=$WORKSPACE/services/base/$SRVC/ios/samples/alljoyn_services_$LANGUAGE chmod -R 777 $PROJ_DIR for SDK in "iphonesimulator" "iphoneos"; do echo -e "===========" echo -e "$SERVICE/$LANGUAGE/$SDK - Running 'xcodebuild' ($VARIANT)" echo -e "===========\n" # compile code ( xcodebuild -project $PROJ_DIR/alljoyn_${SRVC}_${LANGUAGE}.xcodeproj -sdk $SDK -configuration $VARIANT ALLJOYN_SDK_ROOT=$3 ALLSEEN_BASE_SERVICES_ROOT=$WORKSPACE/services/base clean build ) if [ $? != 0 ] then echo "failed to run xcodebuild $SERVICE/$LANGUAGE/$SDK ($VARIANT)" exit_status=45 continue fi done # SDK done #LANGUAGE if [ "$SERVICE" = "Services_Common" ] then continue fi # sample app directory if [ "$SERVICE" = "Notification" ] then APP_DIR=$WORKSPACE/services/base/$SRVC/ios/samples/$SERVICE_NAME else APP_DIR=$WORKSPACE/services/base/$SRVC/ios/samples/sampleApp fi for SDK in "iphonesimulator" "iphoneos"; do echo -e "==========" echo -e "$SERVICE/$SDK - Running 'xcodebuild' ($VARIANT)" echo -e "==========\n" # compile sample app ( xcodebuild -project $APP_DIR/$SERVICE_NAME.xcodeproj CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk $SDK -configuration $VARIANT ALLJOYN_SDK_ROOT=$3 ALLSEEN_BASE_SERVICES_ROOT=$WORKSPACE/services/base ENABLE_BITCODE=NO clean build ) if [ $? != 0 ] then echo "failed to run xcodebuild $SERVICE_NAME/$SDK ($VARIANT)" exit_status=45 continue fi done #SDK done #SERVICE echo "exit_status = $exit_status" exit $exit_status base-16.04/build_scripts/build_darwin_ios_core.sh000077500000000000000000000065371272147170000222040ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # VARIANT=$1 # scons call from xcodebuild hangs locally and must be built manually (i.e. open the alljoyn_darwin.xcodeproj and build each of the targets) if [ -z $ALLJOYN_DEV ]; then cd core/alljoyn/alljoyn_objc xcodebuild -project alljoyn_darwin.xcodeproj -scheme alljoyn_core_ios -sdk iphoneos -configuration $VARIANT PLATFORM_NAME=iphoneos xcodebuild -project alljoyn_darwin.xcodeproj -scheme alljoyn_core_ios -sdk iphonesimulator -configuration $VARIANT PLATFORM_NAME=iphonesimulator xcodebuild -project alljoyn_darwin.xcodeproj -scheme alljoyn_core_ios_armv7 -sdk iphoneos -configuration $VARIANT PLATFORM_NAME=iphoneos xcodebuild -project alljoyn_darwin.xcodeproj -scheme alljoyn_core_ios_armv7s -sdk iphoneos -configuration $VARIANT PLATFORM_NAME=iphoneos xcodebuild -project alljoyn_darwin.xcodeproj -scheme alljoyn_core_arm64 -sdk iphoneos -configuration $VARIANT PLATFORM_NAME=iphoneos cd ../services/about/ios/samples/alljoyn_services_cpp else cd $ALLJOYN_ROOT_DIR/core/alljoyn/services/about/ios/samples/alljoyn_services_cpp fi #$VARIANT version of alljoyn about cpp for iphoneos xcodebuild -project alljoyn_about_cpp.xcodeproj -scheme alljoyn_about_cpp ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphoneos #$VARIANT version of alljoyn about cpp for iphonesimulator xcodebuild -project alljoyn_about_cpp.xcodeproj -scheme alljoyn_about_cpp ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphonesimulator VALID_ARCHS="i386 x86_64" PLATFORM_NAME=iphonesimulator cd ../alljoyn_services_objc #$VARIANT version of alljoyn about objc for iphoneos xcodebuild -project alljoyn_about_objc.xcodeproj -scheme alljoyn_about_objc ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphoneos #$VARIANT version of alljoyn about objc for iphonesimulator xcodebuild -project alljoyn_about_objc.xcodeproj -scheme alljoyn_about_objc ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphonesimulator VALID_ARCHS="i386 x86_64" PLATFORM_NAME=iphonesimulator #Library 3 = AllJoynFramework_iOS cd ../../../../../alljoyn_objc/AllJoynFramework_iOS #$VARIANT version of AllJoynFramework_iOS for iphoneos xcodebuild -project AllJoynFramework_iOS.xcodeproj -scheme AllJoynFramework_iOS ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphoneos #$VARIANT version of AllJoynFramework_iOS for iphonesimulator xcodebuild -project AllJoynFramework_iOS.xcodeproj -scheme AllJoynFramework_iOS ONLY_ACTIVE_ARCHS=NO -configuration $VARIANT -sdk iphonesimulator VALID_ARCHS="i386 x86_64" PLATFORM_NAME=iphonesimulator base-16.04/build_scripts/build_linux.sh000077500000000000000000000044131272147170000201640ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # export SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}" ) . $SCRIPT_DIR/build_linux_getopts.sh # cache core - used by build system if [ "$SERVICE" == "core" ]; then if [ -z "$ALLJOYN_DIST_DIR" ]; then echo "Distribution directory needs to be specified to build a cached core build" exit 1 fi ALLJOYN_DEST_DIST_DIR=$ALLJOYN_DIST_DIR . $SCRIPT_DIR/build_linux_core_internal.sh mkdir -p $ALLJOYN_DEST_DIST_DIR rm -rf $ALLJOYN_DEST_DIST_DIR cp -r $ALLJOYN_DISTDIR $ALLJOYN_DEST_DIST_DIR exit 0 fi # build core if [ -z "$ALLJOYN_DIST_DIR" ]; then if [ -z "$ALLJOYN_CORE_DIR" ]; then echo "Provide a path for either -C for source build or -D for an unzipped distribution" exit 1 fi . $SCRIPT_DIR/build_linux_core_internal.sh else echo "Distribution argument provided, not building from source." if [ ! -z "$ALLJOYN_DIST_UNZIP" ]; then ZIP_PATH=$ALLJOYN_DIST_DIR/$ALLJOYN_DIST_UNZIP NEW_DIST_PATH=$ALLJOYN_DIST_DIR/dist echo "Unzipping: $ZIP_PATH" unzip $ZIP_PATH $NEW_DIST_PATH export ALLJOYN_DIST_UNZIP=$NEW_DIST_PATH fi fi # build service pushd $BUILD_ROOT/$SERVICE scons --jobs $JOBS VARIANT=$VARIANT CPU=$CPU BINDINGS=$BINDINGS WS=$WS ALLJOYN_DISTDIR=$ALLJOYN_DIST_DIR CRYPTO=builtin popd # packaging export HAS_CPP=$(echo $BINDINGS | grep -iq cpp)$? if [ $HAS_CPP -eq 0 ]; then . $SCRIPT_DIR/build_linux_package_cpp.sh fi base-16.04/build_scripts/build_linux_core.sh000066400000000000000000000016661272147170000212000ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # export SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}" ) . $SCRIPT_DIR/build_linux_getopts.sh . $SCRIPT_DIR/build_linux_core_internal.sh base-16.04/build_scripts/build_linux_core_internal.sh000066400000000000000000000022431272147170000230640ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # pushd $ALLJOYN_CORE_DIR scons --jobs $JOBS VARIANT=$VARIANT CPU=$CPU BINDINGS=$BINDINGS WS=$WS CRYPTO=builtin popd export ALLJOYN_DISTDIR=$ALLJOYN_CORE_DIR/build/linux/$CPU/$VARIANT/dist # hack - core/alljoyn/common/SConscript isn't installing all the qcc headers into the distributable that it should cp -r $ALLJOYN_CORE_DIR/common/inc/qcc $ALLJOYN_DISTDIR/cpp/inc/ base-16.04/build_scripts/build_linux_getopts.sh000066400000000000000000000033501272147170000217250ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # while getopts 'A:V:C:B:W:S:D:R:U:J:' opt; do echo "${opt} ${OPTARG}" case ${opt} in A) export ALLJOYN_CORE_DIR=${OPTARG} ;; D) export ALLJOYN_DIST_DIR=${OPTARG} ;; V) export VARIANT=${OPTARG} ;; C) export CPU=${OPTARG} ;; B) export BINDINGS=${OPTARG} ;; W) export WS=${OPTARG} ;; S) export SERVICE=${OPTARG} ;; R) export BUILD_ROOT=${OPTARG:-"."} ;; U) export ALLJOYN_DIST_UNZIP=${OPTARG} ;; J) export JOBS=${OPTARG} ;; *) echo "Invalid argument: ${OPTARG}"; #exit 1 # illegal option esac done export BUILD_ROOT=${BUILD_ROOT:-"."} export JOBS=${JOBS:-1} echo "Service: $SERVICE" echo "Variant: $VARIANT" echo "CPU: $CPU" echo "Bindings: $BINDINGS" echo "Whitespace: $WS" echo "AllJoyn Core Dir: $ALLJOYN_CORE_DIR" echo "AllJoyn Dist Dir: $ALLJOYN_DIST_DIR" echo "AllJoyn Dist Unzip File: $ALLJOYN_DIST_UNZIP" echo "Build Root Dir: $BUILD_ROOT" base-16.04/build_scripts/build_linux_package_cpp.sh000077500000000000000000000057501272147170000225060ustar00rootroot00000000000000#!/bin/bash -xe # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # This script collects all the pieces to make the SDK for the cpp builds # Based on the equivalent Windows Batch Script # Then further based on https://build.allseenalliance.org/baseservices/job/CoreMaster_linux-base-services_Master/configure SDK_TOP_DIR=alljoyn-$SERVICE-service-framework-${BUILD_VERSION}-linux-$CPU-sdk-$VARIANT ZIP_FILE=$SDK_TOP_DIR.zip SDK_DIR=$SDK_TOP_DIR/alljoyn-linux-$CPU/alljoyn-$SERVICE-${BUILD_VERSION}-$VARIANT/cpp ALLJOYN_DIST_DIR=${ALLJOYN_DIST_DIR=-core/alljoyn/build/linux/$CPU/$VARIANT/dist} echo "PACKAGING" echo "------------------------------------------------------" echo "ALLJOYN_DIST_DIR (for packaging): $ALLJOYN_DIST_DIR" ## Generate Doxygen docs DOXYFILE=Doxygen_html # where to run the doxygen command pushd $BUILD_ROOT/$SERVICE/cpp/docs rm -f doxy.out doxygen $DOXYFILE 2> doxy.out >> /dev/null popd rm -rf artifacts mkdir -p artifacts cp -r $BUILD_ROOT/$SERVICE/build/linux/$CPU/$VARIANT/dist/* artifacts rm -rf $SDK_TOP_DIR mkdir -p $SDK_DIR/inc/alljoyn/$SERVICE mkdir -p $SDK_DIR/inc/alljoyn/services_common for a in lib bin docs samples; do mkdir -p $SDK_DIR/$a done ## Preparing the ZIP cp -r $BUILD_ROOT/$SERVICE/cpp/samples/* $SDK_DIR/samples cp -r $BUILD_ROOT/$SERVICE/cpp/docs/* $SDK_DIR/docs cp -r artifacts/$SERVICE/bin/* $SDK_DIR/bin cp -r artifacts/services_common/lib/* $SDK_DIR/lib cp -r artifacts/services_common/inc/alljoyn/services_common/* $SDK_DIR/inc/alljoyn/services_common cp -r $ALLJOYN_DIST_DIR/cpp/lib/* $SDK_DIR/lib if [ "$SERVICE" == "sample_apps" ]; then #cp -r artifacts/controlpanel/lib/* $SDK_DIR/lib cp -r artifacts/notification/lib/* $SDK_DIR/lib #cp -r artifacts/onboarding/lib/* $SDK_DIR/lib else cp -r artifacts/$SERVICE/lib/* $SDK_DIR/lib cp -r artifacts/$SERVICE/inc/alljoyn/$SERVICE/* $SDK_DIR/inc/alljoyn/$SERVICE fi rm -rf $ZIP_FILE zip -r $ZIP_FILE $SDK_TOP_DIR md5sum $ZIP_FILE > md5-$SDK_TOP_DIR.txt base-16.04/build_scripts/build_openwrt.sh000077500000000000000000000135451272147170000205310ustar00rootroot00000000000000#!/usr/bin/env bash if [ -z "$WORKSPACE" ]; then echo "Environment variable WORKSPACE is not set. Aborting." exit 1 fi OPENWRT_PROJECT_DIR=$WORKSPACE/openwrt OPENWRT_FEEDS_CONF=$OPENWRT_PROJECT_DIR/feeds.conf OPENWRT_CONFIG=$OPENWRT_PROJECT_DIR/.config #---------------------------- # Local AJ repo and src locations #---------------------------- ALLJOYN_PROJECT_DIR=$WORKSPACE/alljoyn_source ALLJOYN_CORE_PROJECT_DIR=$ALLJOYN_PROJECT_DIR/core/alljoyn ALLJOYN_BASE_PROJECT_DIR=$ALLJOYN_PROJECT_DIR/services/base ALLJOYN_TARBALL_DIR=$WORKSPACE/alljoyn_tarball AJ_CORE_TARBALL_ROOT_DIRNAME=alljoyn-16.04.00-src AJ_BASE_TARBALL_ROOT_DIRNAME=alljoyn-services-16.04.00-src AJ_CORE_TARBALL=$AJ_CORE_TARBALL_ROOT_DIRNAME.tar.gz AJ_BASE_TARBALL=$AJ_BASE_TARBALL_ROOT_DIRNAME.tar.gz if [ -d $OPENWRT_PROJECT_DIR/feeds/alljoyn ]; then cd $OPENWRT_PROJECT_DIR make defconfig make V=s package/feeds/alljoyn/alljoyn/clean make V=s package/feeds/alljoyn/alljoyn-services_common/clean make V=s package/feeds/alljoyn/alljoyn-controlpanel/clean make V=s package/feeds/alljoyn/alljoyn-notification/clean make V=s package/feeds/alljoyn/alljoyn-onboarding/clean make V=s package/feeds/alljoyn/alljoyn-sample_apps/clean rm -rf $ALLJOYN_TARBALL_DIR rm -rf $OPENWRT_PROJECT_DIR/dl/alljoyn* rm -rf $OPENWRT_PROJECT_DIR/feeds/alljoyn* fi echo "Making config" echo CONFIG_TARGET_x86=y > $OPENWRT_CONFIG # # Initialize feeds.conf # cd $OPENWRT_PROJECT_DIR # Basic feeds grep "src-git packages" $OPENWRT_FEEDS_CONF.default > $OPENWRT_FEEDS_CONF grep "src-git luci" $OPENWRT_FEEDS_CONF.default >> $OPENWRT_FEEDS_CONF # AllJoyn feed AJ_OPENWRT_FEED=https://bitbucket.org/twobulls/alljoyn-openwrt-feed.git AJ_OPENWRT_FEED_BRANCH=16.04-baseservices-2b echo "src-git alljoyn $AJ_OPENWRT_FEED;$AJ_OPENWRT_FEED_BRANCH" >> $OPENWRT_FEEDS_CONF ./scripts/feeds update -a ./scripts/feeds install -a # # Select AllJoyn Packages # # AJ package identifiers AJ_CORE_PKG="CONFIG_PACKAGE_alljoyn" AJ_ABOUT_PKG="CONFIG_PACKAGE_alljoyn-about" AJ_C_PKG="CONFIG_PACKAGE_alljoyn-c" AJ_CONFIG_PKG="CONFIG_PACKAGE_alljoyn-config" AJ_CONTROLPANEL_PKG="CONFIG_PACKAGE_alljoyn-controlpanel" AJ_NON_GW_CONFIG_PKG="CONFIG_PACKAGE_alljoyn-non-gw-config" AJ_NOTIFICATION_PKG="CONFIG_PACKAGE_alljoyn-notification" AJ_SAMPLES_PKG="CONFIG_PACKAGE_alljoyn-samples" AJ_SERVICES_SAMPLE_APPS_PKG="CONFIG_PACKAGE_alljoyn-services_common" AJ_SERVICES_COMMON_PKG="CONFIG_PACKAGE_alljoyn-sample_apps" AJ_CONFIG_SAMPLES_PKG="CONFIG_PACKAGE_alljoyn-config-samples" AJ_CONTROLPANEL_SAMPLES_PKG="CONFIG_PACKAGE_alljoyn-controlpanel-samples" AJ_NOTIFICATION_SAMPLES_PKG="CONFIG_PACKAGE_alljoyn-notification-samples" AJ_ONBOARDING_SAMPLES_PKG="CONFIG_PACKAGE_alljoyn-onboarding" # Prerequisite pacakges for onboarding WPADMINI_DEFAULT=CONFIG_DEFAULT_wpad-mini WPADMINI_PKG=CONFIG_PACKAGE_wpad-mini WPACLI_PKG=CONFIG_PACKAGE_wpa-cli WPASUPPLICANT_PKG=CONFIG_PACKAGE_wpa-supplicant HOSTAPD_PKG=CONFIG_PACKAGE_hostapd # Enable AllJoyn Core make defconfig sed -i "s/.*$AJ_CORE_PKG.*$/$AJ_CORE_PKG\=y/g" $OPENWRT_CONFIG # Enable some services make defconfig sed -i "s/.*$AJ_ABOUT_PKG.*$/$AJ_ABOUT_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_C_PKG.*$/$AJ_C_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_CONFIG_PKG.*$/$AJ_CONFIG_PKG\=n/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_CONTROLPANEL_PKG.*$/$AJ_CONTROLPANEL_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_NON_GW_CONFIG_PKG.*$/$AJ_NON_GW_CONFIG_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_NOTIFICATION_PKG.*$/$AJ_NOTIFICATION_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_SAMPLES_PKG.*$/$AJ_SAMPLES_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_SERVICES_SAMPLE_APPS_PKG.*$/$AJ_SERVICES_SAMPLE_APPS_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_SERVICES_COMMON_PKG.*$/$AJ_SERVICES_COMMON_PKG\=y/g" $OPENWRT_CONFIG # ...more services make defconfig sed -i "s/.*$AJ_CONFIG_SAMPLES_PKG.*$/$AJ_CONFIG_SAMPLES_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_CONTROLPANEL_SAMPLES_PKG.*$/$AJ_CONTROLPANEL_SAMPLES_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$AJ_NOTIFICATION_SAMPLES_PKG.*$/$AJ_NOTIFICATION_SAMPLES_PKG\=y/g" $OPENWRT_CONFIG # Enable dependencies for onboarding sed -i "s/.*$WPADMINI_DEFAULT.*$/$WPADMINI_DEFAULT\=n/g" $OPENWRT_CONFIG sed -i "s/.*$WPADMINI_PKG.*$/$WPADMINI_PKG\=n/g" $OPENWRT_CONFIG sed -i "s/.*$WPACLI_PKG.*$/$WPACLI_PKG\=y/g" $OPENWRT_CONFIG sed -i "s/.*$WPASUPPLICANT_PKG.*$/$WPASUPPLICANT_PKG\=y/g" $OPENWRT_CONFIG # ...finally enable aj-onboarding make defconfig sed -i "s/.*$AJ_ONBOARDING_SAMPLES_PKG.*$/$AJ_ONBOARDING_SAMPLES_PKG\=y/g" $OPENWRT_CONFIG # # AllJoyn tarball # echo "Creating Tarballs..." mkdir $ALLJOYN_TARBALL_DIR # AllJoyn core tarball cd $ALLJOYN_CORE_PROJECT_DIR/.. AJ_CORE_DIR_NAME=$(basename $ALLJOYN_CORE_PROJECT_DIR) mv $AJ_CORE_DIR_NAME $AJ_CORE_TARBALL_ROOT_DIRNAME tar czf $ALLJOYN_TARBALL_DIR/$AJ_CORE_TARBALL $AJ_CORE_TARBALL_ROOT_DIRNAME/ mv $AJ_CORE_TARBALL_ROOT_DIRNAME $AJ_CORE_DIR_NAME BASE_SERVICES_TARBALL_DIR=$WORKSPACE/$AJ_BASE_TARBALL_ROOT_DIRNAME # Base services tarball cd $ALLJOYN_PROJECT_DIR/.. AJ_DIR_NAME=$(basename $ALLJOYN_PROJECT_DIR) mkdir -p $BASE_SERVICES_TARBALL_DIR mkdir -p $BASE_SERVICES_TARBALL_DIR/core/alljoyn mv $ALLJOYN_PROJECT_DIR/services $BASE_SERVICES_TARBALL_DIR/ cp -R $ALLJOYN_CORE_PROJECT_DIR/build_core $BASE_SERVICES_TARBALL_DIR/core/alljoyn tar czf $ALLJOYN_TARBALL_DIR/$AJ_BASE_TARBALL $AJ_BASE_TARBALL_ROOT_DIRNAME/ mv $BASE_SERVICES_TARBALL_DIR/services $ALLJOYN_PROJECT_DIR rm -rf $BASE_SERVICES_TARBALL_DIR/ # Copy tarball to dl directory mkdir -p $OPENWRT_PROJECT_DIR/dl cp $ALLJOYN_TARBALL_DIR/$AJ_CORE_TARBALL $OPENWRT_PROJECT_DIR/dl/ cp $ALLJOYN_TARBALL_DIR/$AJ_BASE_TARBALL $OPENWRT_PROJECT_DIR/dl/ # Clean up AJ source rm -rf $ALLJOYN_TARBALL_DIR CONFIG_CCACHE="CONFIG_CCACHE" CONFIG_LIBCAP="CONFIG_PACKAGE_libcap" sed -i "s/.*$CONFIG_CCACHE.*$/$CONFIG_CCACHE\=y/g" $OPENWRT_CONFIG sed -i "s/.*$CONFIG_LIBCAP.*$/$CONFIG_LIBCAP\=y/g" $OPENWRT_CONFIG cd $OPENWRT_PROJECT_DIR make defconfig make -j1 V=s base-16.04/build_scripts/build_windows.bat000066400000000000000000000037041272147170000206520ustar00rootroot00000000000000rem Copyright AllSeen Alliance. All rights reserved. rem rem Permission to use, copy, modify, and/or distribute this software for any rem purpose with or without fee is hereby granted, provided that the above rem copyright notice and this permission notice appear in all copies. rem rem THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES rem WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF rem MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR rem ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES rem WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN rem ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF rem OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. rem set GTEST_DIR= set SCRIPT_FOLDER=%~dp0 rem Defaults rem ----------------- set ALLJOYN_SRC_DIST_DIR=%ALLJOYN_CORE_DIR%\build\%OS%\%CPU%\%VARIANT%\dist if "%ALLJOYN_DIST_DIR%"=="" set ALLJOYN_DIST_DIR=%ALLJOYN_SRC_DIST_DIR% if "%JOBS%"=="" set JOBS=1 echo Current directory: %CD% echo OS: %OS% echo CPU: %CPU% echo VARIANT: %VARIANT% echo BINDINGS: %BINDINGS% echo SERVICE: %SERVICE% echo ALLJOYN_DIST_DIR: %ALLJOYN_DIST_DIR% rem For build server to cache core rem -------------------------------------- rem TODO Move this to an upstream build process IF "%SERVICE%"=="core" %SCRIPT_FOLDER%\build_windows_core.bat rem Build service rem ---------------- pushd %BASE_ROOT%\%SERVICE% set ALLJOYN_DISTDIR=%ALLJOYN_DIST_DIR% set MSVC_VERSION=%MSVC_VER% if "%VERBOSE%"=="" set VERBOSE=1 set BUILD_SERVICES_SAMPLES=on set BR=on set DOCS=html cmd /c %SCONS% "-c" "--jobs=%JOBS%" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" cmd /c %SCONS% "--jobs=%JOBS%" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" "V=%VERBOSE%" IF %ERRORLEVEL% GTR 0 exit %ERRORLEVEL% popd base-16.04/build_scripts/build_windows_android_core.bat000066400000000000000000000031011272147170000233510ustar00rootroot00000000000000rem Copyright AllSeen Alliance. All rights reserved. rem rem Permission to use, copy, modify, and/or distribute this software for any rem purpose with or without fee is hereby granted, provided that the above rem copyright notice and this permission notice appear in all copies. rem rem THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES rem WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF rem MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR rem ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES rem WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN rem ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF rem OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. rem pushd %ALLJOYN_CORE_DIR% set MSVC_VERSION=%MSVC_VER%" set BR=off set WS=off cmd /c %SCONS% "-c" "--jobs=%JOBS%" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" "ANDROID_SDK=%ANDROID_SDK%" "ANDROID_NDK=%ANDROID_NDK%" cmd /c %SCONS% "--jobs=%JOBS%" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" "ANDROID_SDK=%ANDROID_SDK%" "ANDROID_NDK=%ANDROID_NDK%" echo Build completed IF %ERRORLEVEL% GTR 0 exit %ERRORLEVEL% popd setlocal enableextensions rd /s /q %ALLJOYN_DIST_DIR% md %ALLJOYN_DIST_DIR% xcopy /e /i %ALLJOYN_SRC_DIST_DIR%\java\jar %ALLJOYN_DIST_DIR%\java\jar xcopy /e /i %ALLJOYN_SRC_DIST_DIR%\java\lib %ALLJOYN_DIST_DIR%\java\lib echo Core cached!!! endlocal exit 0 base-16.04/build_scripts/build_windows_android_samples.cmd000066400000000000000000000245521272147170000240770ustar00rootroot00000000000000rem Copyright AllSeen Alliance. All rights reserved. rem rem Permission to use, copy, modify, and/or distribute this software for any rem purpose with or without fee is hereby granted, provided that the above rem copyright notice and this permission notice appear in all copies. rem rem THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES rem WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF rem MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR rem ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES rem WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN rem ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF rem OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. rem @echo off :: This snippet is included in order to exit the batch file from the subroutine. :: See http://superuser.com/questions/80485/exit-batch-file-from-subroutine for more details. IF "%selfWrapped%"=="%~0" ( REM this is necessary so that we can use "exit" to terminate the batch file, REM and all subroutines, but not the original cmd.exe SET selfWrapped=%~0 %ComSpec% /s /c ""%~0" %*" GOTO :EOF ) set OK=0 set ERROR=1 set ALLJOYN_BASE_BUILD_DIR=%BASE_ROOT% set ALLJOYN_CORE_BUILD_DIR=%ALLJOYN_CORE_DIR% set ALLJOYN_ANDROID_JAR_DIR=%ALLJOYN_CORE_BUILD_DIR%\arm\java\jar set ALLJOYN_ANDROID_LIB_DIR=%ALLJOYN_CORE_BUILD_DIR%\arm\java\lib set ANDROID_HOME=%ANDROID_SDK% set CONTROL_PANEL_SAMPLES_ROOT=%ALLJOYN_BASE_BUILD_DIR%\controlpanel\java set NOTIFICATION_SAMPLES_ROOT=%ALLJOYN_BASE_BUILD_DIR%\notification\java set ONBOARDING_SAMPLES_ROOT=%ALLJOYN_BASE_BUILD_DIR%\onboarding\java set CPU=arm echo Building Control Panel Sample Apps call:buildControlPanelSamples echo Building Notification Sample Apps call:buildNotificationSamples echo Building Onboarding Sample Apps call:buildOnboardingSamples exit %OK% :::::::::::::::::::::::::::::::::::::: :: Generic build functions :::::::::::::::::::::::::::::::::::::: :executeFuncInDir set func=%~1 set dir=%~2 pushd %dir% call:%func% popd exit /B %OK% :copyToDir set file=%~1 set dir=%~2 set errorMessage=%~3 set errorCode=%~4 xcopy /Y %file% %dir% || ( echo %errorMesage% exit %errorCode% ) exit /B %OK% :createLibsDir if not exist libs mkdir libs exit /B %OK% :createLibsARMDir if not exist libs\armeabi mkdir libs\armeabi exit /B %OK% :copyAlljoynJars for %%f in (%ALLJOYN_ANDROID_JAR_DIR%\alljoyn.jar, %ALLJOYN_ANDROID_JAR_DIR%\alljoyn_about.jar) do ( call:copyToDir %%f .\libs\ "failed to get alljoyn jars" %ERROR% ) exit /B %OK% :copyAndroidV4SupportJar call:copyToDir %ANDROID_HOME%\extras\android\support\v4\android-support-v4.jar .\libs\ "failed to copy android-support-v4.jar" %ERROR% exit /B %OK% :copyControlPanelServiceJar call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\controlpanel\java\ControlPanelService\build\deploy\ControlPanelService.jar .\libs\ "failed to copy ControlPanelService.jar to libs directory" %ERROR% exit /B %OK% :copyAlljoynAndroidUtilsJar call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\sample_apps\android\common_utils\build\deploy\alljoyn_apps_android_utils.jar .\libs\ "failed to copy alljoyn_apps_android_utils.jar" %ERROR% exit /B %OK% :copyAlljoynSharedObject call:copyToDir %ALLJOYN_ANDROID_LIB_DIR%\liballjoyn_java.so .\libs\armeabi\ "failed to copy liballjoyn_java.so" %ERROR% exit /B %OK% :copyAlljoynOnboardingJar call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\onboarding\java\OnboardingService\build\deploy\alljoyn_onboarding.jar .\libs\ "failed to copy alljoyn_onboarding.jar" %ERROR% exit /B %OK% :copyControlPanelAdapterJar call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\controlpanel\java\ControlPanelAdapter\bin\ControlPanelAdapter.jar .\libs\ "failed to copy ControlPanelAdapter.jar" %ERROR% exit /B %OK% :::::::::::::::::::::::::::::::::::::::: :: Control Panel build functions :::::::::::::::::::::::::::::::::::::::: :buildControlPanelSamples echo Building ControlPanelService call:executeFuncInDir buildControlPanelService %CONTROL_PANEL_SAMPLES_ROOT%\ControlPanelService echo Building ControlPanelAdapter call:executeFuncInDir buildControlPanelAdapter %CONTROL_PANEL_SAMPLES_ROOT%\ControlPanelAdapter echo Building common android utils call:executeFuncInDir buildAndroidUtilsJar %ALLJOYN_BASE_BUILD_DIR%\sample_apps\android\common_utils echo Building ControlPanelBrowser call:executeFuncInDir buildControlPanelBrowser %CONTROL_PANEL_SAMPLES_ROOT%\sample_applications\android\ControlPanelBrowser exit /B %OK% :buildControlPanelService call:createLibsDir call:copyAlljoynJars ant || ( echo "failed to build controlpanelservice" exit %ERROR% ) exit /B %OK% :buildControlPanelAdapter call:createLibsDir call:copyControlPanelServiceJar ant || ( echo "failed to buld controlpaneladapter" exit %ERROR% ) exit /B %OK% :buildAndroidUtilsJar call:createLibsDir call:copyAlljoynJars ant || ( echo "failed to build android utils jar" exit %ERROR% ) exit /B %OK% :buildControlPanelBrowser call:createLibsARMDir call:copyAlljoynJars call:copyControlPanelServiceJar call:copyAlljoynAndroidUtilsJar call:copyAlljoynSharedObject call:copyControlPanelAdapterJar call:copyAndroidV4SupportJar ant || ( echo "failed to build controlpanelbrowser" exit %ERROR% ) exit /B %OK% ::::::::::::::::::::::::::::::::::::::::: :: Notification build functions ::::::::::::::::::::::::::::::::::::::::: :buildNotificationSamples echo Building native notification service call:executeFuncInDir buildNativeNotificationService %NOTIFICATION_SAMPLES_ROOT%\native_platform\NotificationServiceNativePlatformAndroid echo Building notification ui sample app call:executeFuncInDir buildNotificationServiceUISample %NOTIFICATION_SAMPLES_ROOT%\sample_applications\android\NotificationServiceUISample exit /B %OK% :copyNotificationJars call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\notification\java\native_platform\NotificationServiceNativePlatformAndroid\build\deploy\NSCommons.jar .\libs\ "failed to copy NSCommons.jar" %ERROR% call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\notification\java\native_platform\NotificationServiceNativePlatformAndroid\build\deploy\NSNativePlatformAndr.jar .\libs\ "failed to copy NSNativePlatformAndr.jar" %ERROR% call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\notification\java\native_platform\NotificationServiceNativePlatformAndroid\build\deploy\NotificationService.jar .\libs\ "failed to copy NotificationService.jar" %ERROR% exit /B %OK% :buildNativeNotificationService call:createLibsARMDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyConytolPanelServiceJar call:copyConytolPanelAdapterJar call:copyAlljoynSharedObject ant || ( echo "failed to build nativeNotificationService" exit %ERROR% ) exit /B %OK% :buildNotificationServiceUISample call:createLibsARMDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyControlPanelServiceJar call:copyControlPanelAdapterJar call:copyAlljoynSharedObject call:copyNotificationJars ant %VARIANT% || ( echo "failed to build notificationServiceUISample" exit %ERROR% ) exit /B %OK% ::::::::::::::::::::::::::::::::::::::::: :: Onboarding build functions ::::::::::::::::::::::::::::::::::::::::: :buildOnboardingSamples echo Building OnboardingService sample call:executeFuncInDir buildOnboardingService %ONBOARDING_SAMPLES_ROOT%\OnboardingService echo Building OnboardingManager sample call:executeFuncInDir buildOnboardingManager %ONBOARDING_SAMPLES_ROOT%\OnboardingManager\android echo Building Dependency Onboarding About Configuration Server call:executeFuncInDir buildOnboardingAboutConfServer %ALLJOYN_BASE_BUILD_DIR%\simulators\android\about_conf_onb_server echo Building OnboardingSampleClient call:executeFuncInDir buildOnboardingSampleClient %ONBOARDING_SAMPLES_ROOT%\sample_applications\android\OnboardingSampleClient echo Building OnboardingManagerSampleClient call:executeFuncInDir buildOnboardingManagerSampleClient %ONBOARDING_SAMPLES_ROOT%\sample_applications\android\OnboardingManagerSampleClient exit /B %OK% :buildOnboardingService call:createLibsDir call:copyAlljoynJars ant || ( echo "failed to build onboarding service" exit %ERROR% ) exit /B %OK% :buildOnboardingManager call:createLibsDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyAlljoynOnboardingJar ant || ( echo "failed to build onboarding manager" exit %ERROR% ) exit /B %OK% :buildOnboardingAboutConfServer call:createLibsARMDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyAlljoynOnboardingJar call:copyAlljoynSharedObject call:copyToDir %ALLJOYN_ANDROID_JAR_DIR%\alljoyn_config.jar .\libs\ "Failed to copy android config jars" %ERROR% ant || ( echo "failed to build onboarding about conf server" exit %ERROR% ) exit /B %OK% :buildOnboardingSampleClient call:createLibsARMDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyAlljoynOnboardingJar call:copyAlljoynSharedObject call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\onboarding\java\OnboardingManager\android\build\deploy\alljoyn_onboarding_manager.jar .\libs\ "Failed to copy alljoyn_onboarding_manager.jar" %ERROR% ant || ( echo "failed to build onboarding sample client" exit %ERROR% ) exit /B %OK% :buildOnboardingManagerSampleClient call:createLibsARMDir call:copyAlljoynJars call:copyAlljoynAndroidUtilsJar call:copyAlljoynOnboardingJar call:copyAlljoynSharedObject call:copyToDir %ALLJOYN_BASE_BUILD_DIR%\onboarding\java\OnboardingManager\android\build\deploy\alljoyn_onboarding_manager.jar .\libs\ "Failed to copy alljoyn_onboarding_manager.jar" %ERROR% ant || ( echo "failed to build onboarding manager sample client" exit %ERROR% ) exit /B %OK% base-16.04/build_scripts/build_windows_core.bat000066400000000000000000000032351272147170000216610ustar00rootroot00000000000000rem Copyright AllSeen Alliance. All rights reserved. rem rem Permission to use, copy, modify, and/or distribute this software for any rem purpose with or without fee is hereby granted, provided that the above rem copyright notice and this permission notice appear in all copies. rem rem THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES rem WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF rem MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR rem ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES rem WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN rem ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF rem OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. rem pushd %ALLJOYN_CORE_DIR% set MSVC_VERSION=%MSVC_VER% set OS=%OS% set BINDINGS=%BINDINGS% set BR=off set WS=off set CPU=%CPU% set VARIANT=%VARIANT% cmd /c %SCONS% "-c" "--jobs=%JOBS%" "V=1" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" cmd /c %SCONS% "--jobs=%JOBS%" "V=1" "OS=%OS%" "BINDINGS=%BINDINGS%" "VARIANT=%VARIANT%" "CPU=%CPU%" "MSVC_VERSION=%MSVC_VER%" echo Build completed IF %ERRORLEVEL% GTR 0 exit %ERRORLEVEL% popd setlocal enableextensions rem TODO rename ALLJOYN_DIST_DIR (batch script argument) such that it isn't confused with ALLJOYN_DISTDIR (SCons argument) rd /s /q %ALLJOYN_DIST_DIR% md %ALLJOYN_DIST_DIR%\cpp\inc\qcc xcopy /e %ALLJOYN_SRC_DIST_DIR% %ALLJOYN_DIST_DIR%\ xcopy /e /y %ALLJOYN_CORE_DIR%\common\inc\qcc %ALLJOYN_DIST_DIR%\cpp\inc\qcc\ echo Core cached!!! endlocal exit 0 base-16.04/build_scripts/sconscript_windows_minimal.patch000066400000000000000000000075451272147170000240100ustar00rootroot00000000000000diff --git a/alljoyn_core/SConscript b/alljoyn_core/SConscript index 40462e8..8823577 100644 --- a/alljoyn_core/SConscript +++ b/alljoyn_core/SConscript @@ -100,7 +100,7 @@ config_env.SConscript('$OBJDIR_CONFIG/cpp/SConscript', exports = ['config_env']) # building for iOS. No support on iOS for command line applications. if env['OS'] == 'darwin' and env['CPU'] in ['arm', 'armv7', 'armv7s', 'arm64',]: progs = [] -else: +elif env['OS_CONF'] != 'windows': # Test programs progs = env.SConscript('$OBJDIR_ALLJOYN_CORE/test/SConscript') ajenv.Install('$CPP_DISTDIR/bin', progs[0]) diff --git a/alljoyn_core/router/SConscript b/alljoyn_core/router/SConscript index 234d972..f20597f 100644 --- a/alljoyn_core/router/SConscript +++ b/alljoyn_core/router/SConscript @@ -75,6 +75,8 @@ if router_env['OS'] == 'darwin': else: print 'Building unit tests for darwin...' tests = router_env.SConscript('test/SConscript', exports = ['router_env', 'router_objs', 'srobj']) +elif router_env['OS_CONF'] == 'windows': + tests = [] else: tests = router_env.SConscript('test/SConscript', exports = ['router_env', 'router_objs', 'srobj']) diff --git a/build_core/conf/windows/SConscript b/build_core/conf/windows/SConscript index f6905cf..9ad8a62 100644 --- a/build_core/conf/windows/SConscript +++ b/build_core/conf/windows/SConscript @@ -123,9 +123,6 @@ env.Append(LINKFLAGS=['/NODEFAULTLIB:libcmt.lib']) # using the /Z7 option to solve this problem. Since another more acceptable # solution has not yet been found we are going with the recommendation from the # SCons documentation. -env['CCPDBFLAGS'] = '/Z7' -env['PDB'] = '${TARGET.base}.pdb' -env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb']) # Debug/Release variants if env['VARIANT'] == 'debug': diff --git a/services/about/cpp/SConscript b/services/about/cpp/SConscript index 241d69f..778ac05 100644 --- a/services/about/cpp/SConscript +++ b/services/about/cpp/SConscript @@ -30,10 +30,12 @@ about_env.Install('$ABOUT_DISTDIR/inc/alljoyn/about', about_env.Glob('inc/alljoy about_env.Install('$ABOUT_DISTDIR/lib', about_env.SConscript('src/SConscript', exports = ['about_env'])) # Sample programs -about_env.Install('$ABOUT_DISTDIR/bin/samples', about_env.SConscript('samples/SConscript', exports = ['about_env'])) +if about_env['OS_CONF'] != 'windows': + about_env.Install('$ABOUT_DISTDIR/bin/samples', about_env.SConscript('samples/SConscript', exports = ['about_env'])) # only include command line samples, unit test, test programs if we are not # building for iOS. No support on iOS for command line applications. if not (about_env['OS'] == 'darwin' and about_env['CPU'] in ['arm', 'armv7', 'armv7s', 'arm64',]): - # Build unit Tests - about_env.SConscript('unit_test/SConscript', exports = ['about_env'], variant_dir='$OBJDIR_ABOUT/unittest', duplicate = 0) + if about_env['OS_CONF'] != 'windows': + # Build unit Tests + about_env.SConscript('unit_test/SConscript', exports = ['about_env'], variant_dir='$OBJDIR_ABOUT/unittest', duplicate = 0) diff --git a/services/config/cpp/SConscript b/services/config/cpp/SConscript index 0e196b1..bc89bdc 100644 --- a/services/config/cpp/SConscript +++ b/services/config/cpp/SConscript @@ -30,7 +30,8 @@ config_env.Install('$CONFIG_DISTDIR/inc/alljoyn/config', config_env.Glob('inc/al config_env.Install('$CONFIG_DISTDIR/lib', config_env.SConscript('src/SConscript', exports = ['config_env'])) # Sample programs -config_env.Install('$CONFIG_DISTDIR/bin/samples', config_env.SConscript('samples/SConscript', exports = ['config_env'])) +if config_env['OS_CONF'] != 'windows': + config_env.Install('$CONFIG_DISTDIR/bin/samples', config_env.SConscript('samples/SConscript', exports = ['config_env'])) # only include command line samples, unit test, test programs if we are not # building for iOS. No support on iOS for command line applications. base-16.04/controlpanel/000077500000000000000000000000001272147170000151375ustar00rootroot00000000000000base-16.04/controlpanel/.gitignore000066400000000000000000000003431272147170000171270ustar00rootroot00000000000000*.a *.class *.jar *.o *.so *~ .cproject .project .sconsign.dblite */.settings/* libs QA ajlite.nvram alljoyn-daemon bin build deploy docs/*.html docs/html/*.html gen lib local.properties obj* *.DS_Store xcuserdata xcshareddata base-16.04/controlpanel/SConscript000066400000000000000000000042531272147170000171550ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os Import('env') env['_ALLJOYN_CONTROLPANEL_'] = True env['OBJDIR_SERVICES_CONTROLPANEL'] = env['OBJDIR'] + '/services/controlpanel' # Make config library and header file paths available to the global environment env.Append(LIBPATH = '$DISTDIR/controlpanel/lib'); env.Append(CPPPATH = '$DISTDIR/controlpanel/inc'); if not env.has_key('_ALLJOYN_SERVICES_COMMON_') and os.path.exists('../services_common/SConscript'): env.SConscript('../services_common/SConscript') if not env.has_key('_ALLJOYN_NOTIFICATION_') and os.path.exists('../notification/SConscript'): env.SConscript('../notification/SConscript') cpsenv = env.Clone() # ASABASE-452, ASACORE-1419 # Even though we have deprecated the About Service code the controlpanel service # is designed so a developer can use the deprecated AboutService or the new # About Feature code. So the controlpanel service can continue to support the # deprecated methods we must turn off the deprecated-declarations warning. if cpsenv['OS_GROUP'] == 'posix': cpsenv.Append(CXXFLAGS = ['-Wno-deprecated-declarations']) for b in cpsenv['bindings']: if os.path.exists('%s/SConscript' % b): cpsenv.VariantDir('$OBJDIR_SERVICES_CONTROLPANEL/%s' % b, b, duplicate = 0) cpsenv.SConscript(['$OBJDIR_SERVICES_CONTROLPANEL/%s/SConscript' % b for b in env['bindings'] if os.path.exists('%s/SConscript' % b) ], exports = ['cpsenv']) base-16.04/controlpanel/SConstruct000066400000000000000000000043221272147170000171720ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os env = SConscript('../build_core/SConscript') vars = Variables() vars.Add('BINDINGS', 'Bindings to build (comma separated list): cpp, java', 'cpp,java') vars.Add(EnumVariable('BUILD_SERVICES_SAMPLES', 'Build the services samples.', 'on', allowed_values = ['on', 'off'])) vars.Add(PathVariable('ALLJOYN_DISTDIR', 'Directory containing a built AllJoyn Core dist directory.', os.environ.get('ALLJOYN_DISTDIR'))) vars.Add(PathVariable('APP_COMMON_DIR', 'Directory containing common sample application sources.', os.environ.get('APP_COMMON_DIR','../sample_apps'))) vars.Update(env) Help(vars.GenerateHelpText(env)) if '' == env.subst('$ALLJOYN_DISTDIR'): print 'ALLJOYN_DISTDIR variable is required' if not GetOption('help'): Exit(1) else: # normalize ALLJOYN_DISTDIR first env['ALLJOYN_DISTDIR'] = env.Dir('$ALLJOYN_DISTDIR') env.Append(CPPPATH = [ env.Dir('$ALLJOYN_DISTDIR/cpp/inc'), env.Dir('$ALLJOYN_DISTDIR/cpp/inc/alljoyn') ]) env.Append(LIBPATH = [ env.Dir('$ALLJOYN_DISTDIR/cpp/lib') ]) if env.get('APP_COMMON_DIR'): # normalize APP_COMMON_DIR env['APP_COMMON_DIR'] = env.Dir('$APP_COMMON_DIR') env['bindings'] = set([ b.strip() for b in env['BINDINGS'].split(',') ]) env.SConscript('SConscript') base-16.04/controlpanel/cpp/000077500000000000000000000000001272147170000157215ustar00rootroot00000000000000base-16.04/controlpanel/cpp/SConscript000066400000000000000000000031461272147170000177370ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('cpsenv') if not cpsenv.has_key('_ALLJOYNCORE_'): cpsenv.Append(LIBS = ['alljoyn']) if cpsenv['BR'] == 'on' : cpsenv['ajrlib'] = 'ajrouter' if cpsenv['OS'] == 'openwrt': cpsenv.AppendUnique(LIBS = [ 'stdc++', 'pthread' ]) cpsenv['CPS_DISTDIR'] = cpsenv['DISTDIR'] + '/controlpanel' cpsenv.Install('$CPS_DISTDIR/inc/alljoyn/controlpanel', cpsenv.Glob('inc/alljoyn/controlpanel/*.h')) cpsenv.Install('$CPS_DISTDIR/lib', cpsenv.SConscript('src/SConscript', exports = ['cpsenv'])) if cpsenv['BUILD_SERVICES_SAMPLES'] == 'on': cpsenv.Install('$CPS_DISTDIR/bin', cpsenv.SConscript('samples/SConscript', exports = ['cpsenv'])) # Build docs installDocs = cpsenv.SConscript('docs/SConscript', exports = ['cpsenv']) cpsenv.Depends(installDocs, cpsenv.Glob('$CPS_DISTDIR/inc/alljoyn/controlpanel/*.h')); base-16.04/controlpanel/cpp/docs/000077500000000000000000000000001272147170000166515ustar00rootroot00000000000000base-16.04/controlpanel/cpp/docs/Doxygen_html000066400000000000000000001673541272147170000212550ustar00rootroot00000000000000# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "AllJoyn™ ControlPanel API Reference Manual" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = "Version 00.00.01" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = YES # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../inc/alljoyn/controlpanel # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. # 20120131: header.html should no longer be used in production builds [MBUS-463] # doxygen 1.7.4 and later will generate buggy html if header.html is included HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = "QCC_DEPRECATED(func)=func" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 3 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES base-16.04/controlpanel/cpp/docs/SConscript000066400000000000000000000024231272147170000206640ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os Import('env') returnValue = [] docenv = env.Clone() # Build docs if docenv['DOCS'] == 'html': # the target directory 'docs/tmp' is never built this will cause doxygen # to run every time DOCS == 'html' generateDocs = docenv.Doxygen(source='Doxygen_html', target=[Dir('tmp'), Dir('html')]) returnValue = docenv.Install('$CPS_DISTDIR/docs', Dir('html')) docenv.Clean('Doxygen_html', Dir('html')) docenv.Depends(returnValue, generateDocs) Return('returnValue') base-16.04/controlpanel/cpp/docs/footer.html000066400000000000000000000025051272147170000210370ustar00rootroot00000000000000
$projectname $projectnumber ($datetime)
Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
base-16.04/controlpanel/cpp/inc/000077500000000000000000000000001272147170000164725ustar00rootroot00000000000000base-16.04/controlpanel/cpp/inc/alljoyn/000077500000000000000000000000001272147170000201425ustar00rootroot00000000000000base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/000077500000000000000000000000001272147170000226425ustar00rootroot00000000000000base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Action.h000066400000000000000000000052651272147170000242400ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef ACTION_H_ #define ACTION_H_ #include namespace ajn { namespace services { /** * Action Class. Used to display a Button. * This is an abstract class. The executeCallback function needs to be overridden. */ class Action : public Widget { public: /** * Constructor for Action class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget */ Action(qcc::String const& name, Widget* rootWidget); /** * Constructor for Action class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - the Device that contains this Action */ Action(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor for Action Class */ virtual ~Action(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Call to execute this Action remotely * @return status - success/failure */ QStatus executeAction(); /** * Callback for when Action is executed. * Virtual function that needs to be implemented. * @return success/failure */ virtual bool executeCallBack(); }; } //namespace services } //namespace ajn #endif /* ACTION_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ActionWithDialog.h000066400000000000000000000103471272147170000262110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef ACTIONWITHDIALOG_H_ #define ACTIONWITHDIALOG_H_ #include #include namespace ajn { namespace services { /** * ActionWithDialog Class. Used to display a Button. * Upon pressing the button a Dialog is displayed on the Controller side */ class ActionWithDialog : public Widget { public: /** * Constructor for Action with Dialog class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget */ ActionWithDialog(qcc::String const& name, Widget* rootWidget); /** * Constructor for Action with Dialog class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - device that contains this Action */ ActionWithDialog(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor for Action with Dialog Class */ virtual ~ActionWithDialog(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * add the ChildDialog for the Action With Dialog * @param childDialog - dialog to add as child * @return Status - success/failure */ QStatus addChildDialog(Dialog* childDialog); /** * Get the ChildDialog of the Action * @return dialog */ Dialog* getChildDialog() const; /** * Register the BusObjects for this and children Widgets * @param bus - bus used to register the busObjects * @param languageSet - languageSet objects need to be registered for * @param objectPathPrefix - Prefix for the ObjectPath * @param objectPathSuffix - Suffix for the ObjectPath * @param isRoot - is this a Root Widget * @return Status - success/failure */ virtual QStatus registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot = false); /** * Unregister the BusObjects for this and children Widgets * @param bus - the bus used to unregister the busObjects * @return status - success/failure */ virtual QStatus unregisterObjects(BusAttachment* bus); private: /** * The Child Dialog of the Action */ Dialog* m_Dialog; /** * Add ChildDialog for Action * @param bus - busAttachment to use * @return status - success/failure */ QStatus addChildren(BusAttachment* bus); /** * Override default refreshChildren Implementation to refresh Action's child dialog * @param bus - bus used to create and register children * @return status - success/failure */ QStatus refreshChildren(BusAttachment* bus); }; } //namespace services } //namespace ajn #endif /* ACTIONWITHDIALOG_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/CPSDate.h000066400000000000000000000045531272147170000242450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CPSDATE_H_ #define CPSDATE_H_ #include namespace ajn { namespace services { /** * A class to allow sending of a Date as a Property */ class CPSDate { public: /** * Constructor of a CPSDate. * @param day - day of date * @param month - month of date * @param year - year of date */ CPSDate(uint16_t day, uint16_t month, uint16_t year); /** * Destructor of CPSDate */ virtual ~CPSDate(); /** * Get the day value of the date * @return day value */ uint16_t getDay() const; /** * Set the day Value of the date * @param day value */ void setDay(uint16_t day); /** * Get the Month value of the date * @return month value */ uint16_t getMonth() const; /** * Set the Month value of the date * @param month value */ void setMonth(uint16_t month); /** * Get the Year value of the date * @return year value */ uint16_t getYear() const; /** * Set the Year value of the date * @param year value */ void setYear(uint16_t year); private: /** * Day value of the Date */ uint16_t m_Day; /** * Month value of the Date */ uint16_t m_Month; /** * Year value of the Date */ uint16_t m_Year; }; } /* namespace services */ } /* namespace ajn */ #endif /* CPSDATE_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/CPSTime.h000066400000000000000000000046341272147170000242660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CPSTIME_H_ #define CPSTIME_H_ #include namespace ajn { namespace services { /** * A class to allow sending of a Time as a Property */ class CPSTime { public: /** * Constructor of a CPSTime. * @param hour - hour of date * @param minute - minute of date * @param second - second of date */ CPSTime(uint16_t hour, uint16_t minute, uint16_t second); /** * Destructor of CPSTime */ virtual ~CPSTime(); /** * Get the hour value of the date * @return hour value */ uint16_t getHour() const; /** * Set the hour Value of the date * @param hour value */ void setHour(uint16_t hour); /** * Get the Minute value of the date * @return minute value */ uint16_t getMinute() const; /** * Set the Minute value of the date * @param minute value */ void setMinute(uint16_t minute); /** * Get the Second value of the date * @return second value */ uint16_t getSecond() const; /** * Set the Second value of the date * @param second value */ void setSecond(uint16_t second); private: /** * Hour value of the Time */ uint16_t m_Hour; /** * Minute value of the Time */ uint16_t m_Minute; /** * Second value of the Time */ uint16_t m_Second; }; } /* namespace services */ } /* namespace ajn */ #endif /* CPSTIME_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ConstraintList.h000066400000000000000000000132211272147170000257720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONSTRAINTLIST_H_ #define CONSTRAINTLIST_H_ #include #include #include namespace ajn { namespace services { /** * ConstraintValue - a union combining all possible values * that can make up a constraint */ typedef union { /** * Value for uint16_t */ uint16_t uint16Value; /** * Value for int16_t */ int16_t int16Value; /** * Value for uint32_t */ uint32_t uint32Value; /** * Value for int32_t */ int32_t int32Value; /** * Value for uint64_t */ uint64_t uint64Value; /** * Value for int64_t */ int64_t int64Value; /** * Value for double */ double doubleValue; /** * Value for const char* */ const char* charValue; } ConstraintValue; /** * Constraint List class to define a list of * Values and constrain a property to those values * The Constraint is applied on the controller side. * No validations are done in the Controllee */ class ConstraintList { public: /** * Constructor for ConstraintList */ ConstraintList(); /** * Destructor for ConstraintList */ virtual ~ConstraintList(); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(uint16_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(int16_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(uint32_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(int32_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(uint64_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(int64_t value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(double value); /** * Set the value for the Constraint * @param value - value to be Constrained to */ void setConstraintValue(qcc::String const& value); /** * Get the Constraint Value * @return the Constraint Value */ ConstraintValue getConstraintValue() const; /** * Get the Property Type of the Constraint * @return propertyType of the Constraint */ PropertyType getPropertyType() const; /** * Get the Display * @return Display Value */ const qcc::String& getDisplay() const; /** * Get the Display vector * @return vector of the Display Values */ const std::vector& getDisplays() const; /** * Set the Display vector * @param displays - vector of the display values */ void setDisplays(const std::vector& displays); /** * Get the function pointer to get the display values * @return the GetDisplay function pointer */ GetStringFptr getGetDisplays() const; /** * Set the GetDisplay function pointer * @param getDisplays - the function pointer to get the display values */ void setGetDisplays(GetStringFptr getDisplays); /** * fill the MsgArg passed in with the Constraint * @param val - msgArg to fill * @param languageIndx - the languageIndx for the Display value * @param propertyType - the property Type expected * @return status - success/failure */ QStatus fillConstraintArg(MsgArg& val, uint16_t languageIndx, PropertyType propertyType); /** * Read the MsgArg passed in to fill the Constraint * @param val - MsgArg passed in * @return status - success/failure */ QStatus readConstraintArg(MsgArg& val); private: /** * Property Type of Constraint */ PropertyType m_PropertyType; /** * The Constraint Value of the Constraint */ ConstraintValue m_ConstraintValue; /** * The Display value of the Constraint */ qcc::String m_Display; /** * The Display value of the Constraint */ std::vector m_Displays; /** * The GetDisplay function pointer of the Constraint */ GetStringFptr m_GetDisplays; /** * A local string to store the Constraint if the property Type is a string */ qcc::String m_ConstraintValueString; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONSTRAINTLIST_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ConstraintRange.h000066400000000000000000000167341272147170000261270ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONSTRAINTRANGE_H_ #define CONSTRAINTRANGE_H_ #include namespace ajn { namespace services { /** * ConstraintRangeValue - a union combining all possible values * that can make up a constraint Range */ typedef union { /** * Value of type uint16_t */ uint16_t uint16Value; /** * Value of type int16_t */ int16_t int16Value; /** * Value of type uint32_t */ uint32_t uint32Value; /** * Value of type int32_t */ int32_t int32Value; /** * Value of type uint64_t */ uint64_t uint64Value; /** * Value of type int64_t */ int64_t int64Value; /** * Value of type double */ double doubleValue; } ConstraintRangeVal; /** * Constraint Range class to define a range of * Values and constrain a property to those values * The Constraint is applied on the controller side. * No validations are done in the Controlee */ class ConstraintRange { public: /** * Constructor for ConstraintRange */ ConstraintRange(); /** * Destructor for ConstraintRange */ virtual ~ConstraintRange(); /** * get the IncrementValue of the Constraint Range * @return IncrementValue */ const ConstraintRangeVal& getIncrementValue() const; /** * Get the MaxValue of the Constraint Range * @return MaxValue */ const ConstraintRangeVal& getMaxValue() const; /** * Get the MinValue of the Constraint Range * @return MinValue */ const ConstraintRangeVal& getMinValue() const; /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(uint16_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(int16_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(uint32_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(int32_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(uint64_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(int64_t minValue); /** * Set the Min Value for the Constraint * @param minValue * @return status - success/failure */ QStatus setConstraintMin(double minValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(uint16_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(int16_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(uint32_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(int32_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(uint64_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(int64_t maxValue); /** * Set the Max Value for the Constraint * @param maxValue * @return status - success/failure */ QStatus setConstraintMax(double maxValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(uint16_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(int16_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(uint32_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(int32_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(uint64_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(int64_t incrementValue); /** * Set the Increment Value for the Constraint * @param incrementValue * @return status - success/failure */ QStatus setConstraintIncrement(double incrementValue); /** * Fill the MsgArg passed in with the Constraint * @param val - msgArg to fill * @param languageIndx - the languageIndx for the Display value * @param propertyType - the property Type expected * @return status - success/failure */ QStatus fillConstraintArg(MsgArg& val, uint16_t languageIndx, PropertyType propertyType); /** * Read the MsgArg passed in and fill the Constraint * @param val - MsgArg passed in * @return status - success/failure */ QStatus readConstraintArg(MsgArg* val); private: /** * Validate that the constraint value matches the correct propertyType * @param propertyType - propertyType to validate for * @return pass/fail */ bool validateConstraintValue(PropertyType propertyType); /** * The MinValue of the Constraint */ ConstraintRangeVal m_MinValue; /** * The MaxValue of the Constraint */ ConstraintRangeVal m_MaxValue; /** * The IncrementValue of the Constraint */ ConstraintRangeVal m_IncrementValue; /** * The PropertyType of the Constraint */ PropertyType m_PropertyType; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONSTRAINTRANGE_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Container.h000066400000000000000000000133651272147170000247450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTAINER_H_ #define CONTAINER_H_ #include #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4100. Function doesnt use all passed in parameters */ #pragma warning(push) #pragma warning(disable: 4100) #endif namespace ajn { namespace services { /** * Container class. Used to represent a container widget. * Container widgets container children widgets and group them together */ class Container : public RootWidget { public: /** * Constructor for container Class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget */ Container(qcc::String const& name, Widget* rootWidget); /** * Constructor for container Class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param objectPath - the objectPath of the Container * @param device - the Device that contains this Container */ Container(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device); /** * Constructor for container Class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - the Device that contains this Container */ Container(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor for Container Class */ virtual ~Container(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObjects * @param m_LanguageSet - the languageSet to register the busObjects for * @param objectPathPrefix - the objectPathPrefix of the busObject * @param objectPathSuffix - the objectPathSuffix of the busObject * @param isRoot - is this a rootWidget * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus, LanguageSet const& m_LanguageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot = false); /** * Register the BusObjects for this Widget * @param bus - the bus to be used * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * Unregister the BusObjects for this widget * @param bus * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * add a Child Widget to the Container * @param childWidget - Widget to add * @return status - success/failure */ QStatus addChildWidget(Widget* childWidget); /** * Get the ChildWidget Vector * @return children widgets */ const std::vector& getChildWidgets() const; /** * Get IsDismissable * @return isDismissable */ bool getIsDismissable() const; /** * Set IsDismissable * @param isDismissable */ void setIsDismissable(bool isDismissable); /** * Send a Dismiss Signal * @return status - success/failure */ QStatus SendDismissSignal(); private: /** * Children Widgets of the Container */ std::vector m_ChildWidgets; /** * Is this Container dismissable (in a Notification with Action) */ bool m_IsDismissable; /** * Override default addChildren Implementation to add container's child widgets * @param bus - bus used to create and register children * @return status - success/failure */ QStatus addChildren(BusAttachment* bus); /** * Override default refreshChildren Implementation to refresh container's child widgets * @param bus - bus used to create and register children * @return status - success/failure */ QStatus refreshChildren(BusAttachment* bus); /** * Create Widget based on WidgetType passed in * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - device that contains Widget * @param widgetType - type of widget to create * @return newly created widget or NULL if error */ Widget* createWidget(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device, WidgetType widgetType); }; } //namespace services } //namespace ajn #endif /* CONTAINER_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanel.h000066400000000000000000000123521272147170000254160ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANEL_H_ #define CONTROLPANEL_H_ #include #include #include namespace ajn { namespace services { class ControlPanelBusObject; /** * ControlPanel Class. Class used to create a ControlPanel * ControlPanels are made up of a LanguageSet and a RootContainer */ class ControlPanel { public: /** * Function used to create a ControlPanel * @param languageSet - languageSet of the ControlPanel * @return newly created ControlPanel instance */ static ControlPanel* createControlPanel(LanguageSet* languageSet); /** * ControlPanel constructor * @param languageSet - languageSet of controlPanel * @param objectPath - objectPath of controlPanel * @param device - device that contains this controlPanel */ ControlPanel(LanguageSet const& languageSet, qcc::String objectPath, ControlPanelDevice* device); /** * Destructor of ControlPanel */ virtual ~ControlPanel(); /** * Set the RootWidget of the ControlPanel * @param rootWidget - rootWidget of the ControlPanel * @return status - success/failure */ QStatus setRootWidget(Container* rootWidget); /** * Get the name of the Panel - the name of the rootWidget * @return name of the Panel */ qcc::String getPanelName() const; /** * Get the RootWidget of the ControlPanel * @return rootWidget */ Container* getRootWidget() const; /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @param unitName - the unitName of this ControlPanel * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus, qcc::String const& unitName); /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * Unregister the BusObjects for this Widget * @param bus - bus used to unregister the busObjects * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * Get the LanguageSet of the ControlPanel * @return */ const LanguageSet& getLanguageSet() const; /** * Get the Device of the ControlPanel * @return controlPanelDevice */ ControlPanelDevice* getDevice() const; /** * Get the objectPath * @return */ const qcc::String& getObjectPath() const; /** * Get the RootWidget of the ControlPanel * @param Language * @return pointer to rootWidget */ Container* getRootWidget(qcc::String const& Language) const; private: /** * Private Constructor for ControlPanel. * To construct instance of ControlPanel used createControlPanel * @param languageSet */ ControlPanel(LanguageSet const& languageSet); /** * LanguageSet of this ControlPanel */ LanguageSet m_LanguageSet; /** * RootWidget of this ControlPanel */ Container* m_RootWidget; /** * RootWidgetMap of this ControlPanel */ std::map m_RootWidgetMap; /** * The BusObject for this ControlPanel */ ControlPanelBusObject* m_ControlPanelBusObject; /** * ObjectPath of the ControlPanel */ qcc::String m_ObjectPath; /** * Device containing the ControlPanel */ ControlPanelDevice* m_Device; /** * Copy constructor of ControlPanel - private. ControlPanel is not copy-able * @param controlPanel - ControlPanel to copy */ ControlPanel(const ControlPanel& controlPanel); /** * Assignment operator of ControlPanel - private. ControlPanel is not assignable * @param controlPanel * @return */ ControlPanel& operator=(const ControlPanel& controlPanel); /** * Check the compatibility of the versions with remote controlpanel * @return status - success/failure */ QStatus checkVersions(); /** * Add the Child Widgets * @return status - success/failure */ QStatus addChildren(); }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANEL_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelBusListener.h000066400000000000000000000064221272147170000275770ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELBUSLISTENER_H_ #define CONTROLPANELBUSLISTENER_H_ #include #include #include namespace ajn { namespace services { /** * Class that implements BusListener, SessionPortListener and SessionListener */ class ControlPanelBusListener : public BusListener, public SessionPortListener, public SessionListener { public: /** * Constructor of ControlPanelBusListener */ ControlPanelBusListener(); /** * Destructor of ControlPanelBusListener */ ~ControlPanelBusListener(); /** * Set the Value of the SessionPort associated with this SessionPortListener * @param sessionPort */ void setSessionPort(SessionPort sessionPort); /** * Get the SessionPort of the listener * @return */ SessionPort getSessionPort(); /** * AcceptSessionJoiner - Receive request to join session and decide whether to accept it or not * @param sessionPort - the port of the request * @param joiner - the name of the joiner * @param opts - the session options * @return true/false */ bool AcceptSessionJoiner(SessionPort sessionPort, const char* joiner, const SessionOpts& opts); /** * SessionJoined * @param sessionPort * @param sessionId * @param joiner */ void SessionJoined(SessionPort sessionPort, SessionId sessionId, const char* joiner); /** * SessionMemberAdded * @param sessionId * @param uniqueName */ void SessionMemberAdded(SessionId sessionId, const char* uniqueName); /** * SessionMemberRemoved * @param sessionId * @param uniqueName */ void SessionMemberRemoved(SessionId sessionId, const char* uniqueName); /** * SessionLost * @param sessionId * @param reason */ void SessionLost(SessionId sessionId, SessionLostReason reason); /** * Get the SessionIds associated with this Listener * @return vector of sessionIds */ const std::vector& getSessionIds() const; private: /** * The port used as part of the join session request */ SessionPort m_SessionPort; /** * The sessionIds for the port */ std::vector m_SessionIds; }; } } #endif /* CONTROLPANELBUSLISTENER_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelControllee.h000066400000000000000000000051151272147170000274440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELCONTROLLEE_H_ #define CONTROLPANELCONTROLLEE_H_ #include namespace ajn { namespace services { /** * ControlPanelControllee Class. * Allows creation of a controllee to be controller by a controller * Made up of ControlPanels and/or NotificationWithActions and possibly * a HTTPControl */ class ControlPanelControllee { public: /** * Constructor of ControlPanelControllee */ ControlPanelControllee(); /** * Destructor of ControlPanelControllee */ virtual ~ControlPanelControllee(); /** * Add a ControlPanelUnit to the ControlPanelControllee * @param unit - unit to add * @return status - success/failure */ QStatus addControlPanelUnit(ControlPanelControlleeUnit* unit); /** * Register the busObjects of the ControlPanelControllee * @param bus - the bus to register the Objects with * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * Unregister the busObjects of the ControlPanelControllee * @param bus - the bus to unregister the Objects with * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * Get the Units of the Controllee * @return the Controllee Units */ const std::vector& getControlleeUnits() const; private: /** * Vector containing the Devices Units */ std::vector m_Units; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELCONTROLLEE_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelControlleeUnit.h000066400000000000000000000075201272147170000303060ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELCONTROLLEEUNIT_H_ #define CONTROLPANELCONTROLLEEUNIT_H_ #include #include #include namespace ajn { namespace services { /** * Class that represents a ControlPanel Unit. */ class ControlPanelControlleeUnit { public: /** * Constructor of ControlPanelControlleeUnit * @param unitName - name of ControlPanelControllee Unit */ ControlPanelControlleeUnit(qcc::String const& unitName); /** * Destructor of ControlPanelControlleeUnit */ virtual ~ControlPanelControlleeUnit(); /** * Get the UnitName of the ControlPanelControlleeUnit * @return unitName */ const qcc::String& getUnitName() const; /** * Add a ControlPanel to the ControlPanelControlleeUnit * @param controlPanel * @return status - success/failure */ QStatus addControlPanel(ControlPanel* controlPanel); /** * Get the ControlPanels of the ControlPanelControlleeUnit * @return ControlPanels */ const std::vector& getControlPanels() const; /** * Add a NotificationAction to the ControlPanelControlleeUnit * @param notificationAction * @return status - success/failure */ QStatus addNotificationAction(NotificationAction* notificationAction); /** * Get the NotificationActions of the ControlPanelControlleeUnit * @return the NotificationActions */ const std::vector& getNotificationActions() const; /** * Set the HTTPControl of the ControlPanelControlleeUnit * @param httpControl * @return status - success/failure */ QStatus setHttpControl(HttpControl* httpControl); /** * Get the HttpControl of the ControlPanelControlleeUnit * @return HttpControl */ const HttpControl* getHttpControl() const; /** * Register the busObjects of the ControlPanelControlleeUnit * @param bus - the bus to register the Objects with * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * UnRegister the busObjects of the ControlPanelControlleeUnit * @param bus - the bus to unregister the Objects with * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); private: /** * Name of Unit */ qcc::String m_UnitName; /** * Vector of ControlPanels implemented by the Controllee */ std::vector m_ControlPanels; /** * Vector of NotificationActions implemented by the Controllee */ std::vector m_NotificationActions; /** * The HTTPControl of the Unit */ HttpControl* m_HttpControl; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELCONTROLLEEUNIT_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelController.h000066400000000000000000000070071272147170000274630ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELCONTROLLER_H_ #define CONTROLPANELCONTROLLER_H_ #include #include #include namespace ajn { namespace services { /** * Class to facilitate controlling of remote ControlPanels */ class ControlPanelController { public: /** * ControlPanelController() */ ControlPanelController(); /** * ~ControlPanelController() */ virtual ~ControlPanelController(); /** * create a controllable device by parsing announce descriptions. * @param sender * @param objectDescs - ObjectDescriptions received in announce * @return a ControlPanelDevice */ ControlPanelDevice* createControllableDevice(qcc::String const& sender, const AboutObjectDescription& objectDescs); /** * create a controllable device by parsing announce descriptions. * @param deviceBusName - BusName of device received in announce * @param objectDescs - ObjectDescriptions received in announce * * @deprecated see createControllableDevice(qcc::String const&, const AboutObjectDescription&) * * @return a ControlPanelDevice */ QCC_DEPRECATED(ControlPanelDevice* createControllableDevice(qcc::String const& deviceBusName, const AnnounceHandler::ObjectDescriptions& objectDescs)); /** * GetControllableDevice - get a device using the busName - creates it if it doesn't exist * @param deviceBusName - deviceName to get * @return ControlPanelDevice* - returns the Device */ ControlPanelDevice* getControllableDevice(qcc::String const& deviceBusName); /** * deleteControllableDevice - shutdown a controllable device and delete it from the Controller * @param deviceBusName - deviceName to delete * @return status - success-failure */ QStatus deleteControllableDevice(qcc::String const& deviceBusName); /** * deleteAllControllableDevices - shutdown and delete all controllable devices from the controller * @return status - success-failure */ QStatus deleteAllControllableDevices(); /** * Get map of All Controllable Devices * @return controllable Devices map */ const std::map& getControllableDevices() const; private: /** * Map of ControllableDevices added to Controller */ std::map m_ControllableDevices; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELCONTROLLER_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelControllerUnit.h000066400000000000000000000107331272147170000303230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELCONTROLLERUNIT_H_ #define CONTROLPANELCONTROLLERUNIT_H_ #include #include #include #include namespace ajn { namespace services { class ControlPanelDevice; class ControlPanel; class NotificationAction; /** * Class that represents a ControlPanel Unit. */ class ControlPanelControllerUnit { public: /** * ControlPanelUnit() * @param unitName * @param device */ ControlPanelControllerUnit(qcc::String const& unitName, ControlPanelDevice* device); /** * ~ControlPanelUnit() */ virtual ~ControlPanelControllerUnit(); /** * add a HttpControl * @param objectPath of HTTPControl * @return status - success/failure */ QStatus addHttpControl(qcc::String const& objectPath); /** * addControlPanel * @param objectPath * @param panelName * @return status - success/failure */ QStatus addControlPanel(qcc::String const& objectPath, qcc::String const& panelName); /** * addNotificationAction to controlpanel unit * @param objectPath the objectpath of the notification action * @param actionName - the actionName parsed from the objectpath * @return status - success/failure */ QStatus addNotificationAction(qcc::String const& objectPath, qcc::String const& actionName); /** * remove a Notification Action * @param actionName * @return status - success/failure */ QStatus removeNotificationAction(qcc::String const& actionName); /** * Fill control panels and the HTTPControl */ QStatus registerObjects(); /** * Called when shutting down device * @return status - success/failure */ QStatus shutdownUnit(); /** * getDevice() * @return ControlPanelDevice* */ ControlPanelDevice* getDevice() const; /** * getUnitName() * @return string */ const qcc::String& getUnitName() const; /** * Get the ControlPanels of the Unit * @return controlPanels map */ const std::map& getControlPanels() const; /** * Get the NotificationActions of the Unit * @return NotificationActions map */ const std::map& getNotificationActions() const; /** * Get a ControlPanel of the Unit * @param panelName - name of the Panel to get * @return ControlPanel or NULL if it doesn't' exist */ ControlPanel* getControlPanel(qcc::String const& panelName) const; /** * Get a NotificationAction of the Unit * @param actionName - name of the NotificaitonAction to get * @return NotificationAction or NULL if it doesn't exist */ NotificationAction* getNotificationAction(qcc::String const& actionName) const; /** * Get the HttpControl of the Unit * @return httpControl */ HttpControl* getHttpControl() const; private: /** * Name of Unit */ qcc::String m_UnitName; /** * Device Unit belongs to */ ControlPanelDevice* m_Device; /** * The ControlPanels of this Unit */ std::map m_ControlPanels; /** * The NotificationActions of this Unit */ std::map m_NotificationActions; /** * The HTTPControl of the Unit */ HttpControl* m_HttpControl; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELCONTROLLERUNIT_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelDevice.h000066400000000000000000000132561272147170000265420ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELDEVICE2_H_ #define CONTROLPANELDEVICE2_H_ #include #include #include #include namespace ajn { namespace services { class ControlPanelListener; /** * ControlPanelDevice */ class ControlPanelDevice { public: friend class ControlPanelSessionHandler; /** * Constructor for ControlPanelDevice * @param deviceBusName */ ControlPanelDevice(qcc::String const& deviceBusName); /** * Destructor for ControlPanelDevice */ virtual ~ControlPanelDevice(); /** * startSessionAsync - start a session with Device Asynchronously * @return status - success/failure */ QStatus startSessionAsync(); /** * startSession - start session with device synchronously * @return status - success/failure */ QStatus startSession(); /** * endSession - endSession with device * @return status - success/failure */ QStatus endSession(); /** * ShutDown device - end Session and release units * @return status - success/failure */ QStatus shutdownDevice(); /** * getDeviceBusName - get the busName of the device * @return deviceBusName - busName of device */ const qcc::String& getDeviceBusName() const; /** * getSessionId - get the SessionId of the remote Session with device * @return const ajn::SessionId */ const ajn::SessionId getSessionId() const; /** * getDeviceUnits * @return the ControlPanelUnits of this Device */ const std::map& getDeviceUnits() const; /** * getAllControlPanels - fills the passed in vector with all controlPanels contained by this device * @param controlPanelsVec - a vector with all the controlPanel defined as children of this DeviceUnit */ void getAllControlPanels(std::vector& controlPanelsVec); /** * Get an existing unit using the objectPath * @param objectPath - objectPath of unit * @return ControlPanelUnit pointer */ ControlPanelControllerUnit* getControlPanelUnit(qcc::String const& objectPath); /** * addControlPanelUnit - add a ControlPanel unit using the objectPath and interfaces passed in * @param objectPath - objectPath received in the announce * @param interfaces - interfaces received in the announce * @return ControlPanelUnit pointer */ ControlPanelControllerUnit* addControlPanelUnit(qcc::String const& objectPath, std::vector const& interfaces); /** * addNotificationAction - add a Notification using an objectPath received in a notification * @param objectPath - objectPath used to create the NotificationAction * @return NotificationAction pointer */ NotificationAction* addNotificationAction(qcc::String const& objectPath); /** * Delete and shutdown the NotificationAction * @param notificationAction - notificationAction to remove * @return status - success/failure */ QStatus removeNotificationAction(NotificationAction* notificationAction); /** * Get the Listener defined for this SessionHandler * @return */ ControlPanelListener* getListener() const; /** * Set the Listener defined for this SessionHandler * @param listener * @return status - success/failure */ QStatus setListener(ControlPanelListener* listener); private: /** * Private function to handle a Session being joined with this Device */ void handleSessionJoined(); /** * Parse ObjectPath and create a Control Panel unit using the unitName and panel * @param objectPath - objectPath to parse * @param unitName - unitname will be filled based on the objectPath * @param panel - panel will be filled based on the objectPath * @param createIfNotFound - create Unit if it is not found in map * @return a ControlPanelUnit */ ControlPanelControllerUnit* getControlPanelUnit(qcc::String const& objectPath, qcc::String& unitName, qcc::String& panel, bool createIfNotFound = true); /** * The Device's BusName */ qcc::String m_DeviceBusName; /** * SessionHandler for Device */ ControlPanelSessionHandler m_SessionHandler; /** * Map containing the Devices Units */ std::map m_DeviceUnits; /** * Listener - can be used to override the default ControlPanelListener of the Device */ ControlPanelListener* m_Listener; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELDEVICE2_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelEnums.h000066400000000000000000000077411272147170000264340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELENUMS_H_ #define CONTROLPANELENUMS_H_ namespace ajn { namespace services { #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4706. assignment within conditional expression */ #pragma warning(push) #pragma warning(disable: 4706) #endif /** * Typedefs for functionPointers used */ typedef bool (*GetBoolFptr)(); typedef uint32_t (*GetUint32Fptr)(); typedef const char* (*GetStringFptr)(uint16_t); /** * Mode ControlPanel is in */ typedef enum { CONTROLLEE_MODE, //!< CONTROLLEE_MODE CONTROLLER_MODE //!< CONTROLLER_MODE } ControlPanelMode; /** * WidgetType */ typedef enum { WIDGET_TYPE_CONTAINER = 0, //!< CONTAINER WIDGET_TYPE_ACTION = 1, //!< ACTION WIDGET_TYPE_ACTION_WITH_DIALOG = 2, //!< ACTION_WITH_DIALOG WIDGET_TYPE_LABEL = 3, //!< LABEL WIDGET_TYPE_PROPERTY = 4, //!< PROPERTY WIDGET_TYPE_DIALOG = 5, //!< DIALOG WIDGET_TYPE_ERROR = 6 //!< ERROR } WidgetType; /** * Enum to define the type of Property */ typedef enum { BOOL_PROPERTY = 0, //!< BOOL_PROPERTY UINT16_PROPERTY = 1, //!< UINT16_PROPERTY INT16_PROPERTY = 2, //!< INT16_PROPERTY UINT32_PROPERTY = 3, //!< UINT32_PROPERTY INT32_PROPERTY = 4, //!< INT32_PROPERTY UINT64_PROPERTY = 5, //!< UINT64_PROPERTY INT64_PROPERTY = 6, //!< INT64_PROPERTY DOUBLE_PROPERTY = 7, //!< DOUBLE_PROPERTY STRING_PROPERTY = 8, //!< STRING_PROPERTY DATE_PROPERTY = 9, //!< DATE_PROPERTY TIME_PROPERTY = 10, //!< TIME_PROPERTY UNDEFINED = 11 //!< UNDEFINED } PropertyType; /** * Transactions that could go wrong resulting in an Error Occurred event being fired */ typedef enum { SESSION_JOIN = 0, //!< SESSION_JOIN REGISTER_OBJECTS = 1, //!< REGISTER_OBJECTS REFRESH_VALUE = 2, //!< REFRESH_VALUE REFRESH_PROPERTIES = 3 //!< REFRESH_PROPERTIES } ControlPanelTransaction; /** * Hints for Containers Widgets * determining the layout */ enum LAYOUT_HINTS { VERTICAL_LINEAR = 1, //!< VERTICAL_LINEAR HORIZONTAL_LINEAR = 2 //!< HORIZONTAL_LINEAR }; /** * Hints for Dialog Widgets */ enum DIALOG_HINTS { ALERTDIALOG = 1 //!< ALERTDIALOG }; /** * Hints for Property Widgets */ enum PROPERTY_HINTS { SWITCH = 1, //!< SWITCH CHECKBOX = 2, //!< CHECKBOX SPINNER = 3, //!< SPINNER RADIOBUTTON = 4, //!< RADIOBUTTON SLIDER = 5, //!< SLIDER TIMEPICKER = 6, //!< TIMEPICKER DATEPICKER = 7, //!< DATEPICKER NUMBERPICKER = 8, //!< NUMBERPICKER KEYPAD = 9, //!< KEYPAD ROTARYKNOB = 10, //!< ROTARYKNOB TEXTVIEW = 11, //!< TEXTVIEW NUMERICVIEW = 12, //!< NUMERICVIEW EDITTEXT = 13 //!< EDITTEXT }; /** * Hints for Label Widgets */ enum LABEL_HINTS { TEXTLABEL = 1 //!< TEXTLABEL }; /** * Hints for Action Widgets */ enum ACTION_HINTS { ACTIONBUTTON = 1 //!< ACTIONBUTTON }; } //namespace services } //namespace ajn #endif /* CONTROLPANELENUMS_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelListener.h000066400000000000000000000067631272147170000271350ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELLISTENER_H_ #define CONTROLPANELLISTENER_H_ #include #include namespace ajn { namespace services { /** * An Abstract class with function receive. The implementation of this class * can be passed in to the initReceive function and will be the callback for * when notifications are received */ class ControlPanelListener { public: /** * Constructor for ControlPanelListener */ ControlPanelListener() { }; /** * Destructor for ControlPanelListener */ virtual ~ControlPanelListener() { }; /** * sessionEstablished - callback when a session is established with a device * @param device - the device that the session was established with */ virtual void sessionEstablished(ControlPanelDevice* device) = 0; /** * sessionLost - callback when a session is lost with a device * @param device - device that the session was lost with */ virtual void sessionLost(ControlPanelDevice* device) = 0; /** * signalPropertiesChanged - callback when a property Changed signal is received * @param device - device signal was received from * @param widget - widget signal was received for */ virtual void signalPropertiesChanged(ControlPanelDevice* device, Widget* widget) = 0; /** * signalPropertyValueChanged - callback when a property Value Changed signal is received * @param device - device signal was received from * @param property - Property signal was received for */ virtual void signalPropertyValueChanged(ControlPanelDevice* device, Property* property) = 0; /** * signalDismiss - callback when a Dismiss signal is received * @param device - device signal was received from * @param notificationAction - notificationAction signal was received for */ virtual void signalDismiss(ControlPanelDevice* device, NotificationAction* notificationAction) = 0; /** * ErrorOccured - callback to tell application when something goes wrong * @param device - device that had the error * @param status - status associated with error if applicable * @param transaction - the type of transaction that resulted in the error * @param errorMessage - a log-able error Message */ virtual void errorOccured(ControlPanelDevice* device, QStatus status, ControlPanelTransaction transaction, qcc::String const& errorMessage) = 0; }; } //namespace services } //namespace ajn #endif /* CONTROLPANELLISTENER_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelService.h000066400000000000000000000121301272147170000267310ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELSERVICE_H_ #define CONTROLPANELSERVICE_H_ #include #include #include #include #include namespace ajn { namespace services { /** * ControlPanel Service class. Used to initialize and shutdown the service */ class ControlPanelService { public: /** * Get Instance of ControlPanelServiceImpl - singleton implementation * @return instance */ static ControlPanelService* getInstance(); /** * Destructor for ControlPanelServiceImpl */ ~ControlPanelService(); /** * Initialize the controllee to be used * @param bus - bus used for Controllee * @param controlPanelControllee - controllee to initialize * @return status - success/failure */ QStatus initControllee(BusAttachment* bus, ControlPanelControllee* controlPanelControllee); /** * Remove locally stored controllee. Allows a new call to initControllee to be made * @return status - success/failure */ QStatus shutdownControllee(); /** * Initialize the controller to be used * @param bus - bus used for Controller * @param controlPanelController - controller to initialize * @param controlPanelListener * @return status - success/failure */ QStatus initController(BusAttachment* bus, ControlPanelController* controlPanelController, ControlPanelListener* controlPanelListener); /** * Remove locally stored controller. Allows a new call to initController to be made * @return status - success/failure */ QStatus shutdownController(); /** * Full shutdown - includes removing the current BusAttachment * @return status - success/failure */ QStatus shutdown(); /** * Method to get the busAttachment used in the service. * @return BusAttachment */ ajn::BusAttachment* getBusAttachment(); /** * Get the BusListener * @return ControlPanelBusListener */ ControlPanelBusListener* getBusListener() const; /** * Get the ControlPanelListener * @return ControlPanelListener */ ControlPanelListener* getControlPanelListener() const; /** * Utility function to split an objectPath based on the / delimeter * @param objectPath * @return vector of objectPath parts */ static std::vector SplitObjectPath(qcc::String const& objectPath); /** * Get the Version of the ControlPanelService * @return the ControlPanelService version */ static uint16_t getVersion(); private: /** * Default constructor for ControlPanelServiceImpl * Private to allow for singleton implementation */ ControlPanelService(); /** * Copy constructor of ControlPanelService - private. ControlPanelService is not copy-able * @param handler - ControlPanelService to copy */ ControlPanelService(const ControlPanelService& handler); /** * Assignment operator of ControlPanelService - private. ControlPanelService is not assignable * @param handler * @return ControlPanelService */ ControlPanelService& operator=(const ControlPanelService& handler); /** * Version of the API */ static uint16_t const CONTROLPANEL_SERVICE_VERSION; /** * Instance variable - ControlPanelServiceImpl is a singleton */ static ControlPanelService* s_Instance; /** * BusAttachement used in Service */ BusAttachment* m_Bus; /** * BusListener used in service */ ControlPanelBusListener* m_BusListener; /** * ControlPanelControllee of service */ ControlPanelControllee* m_ControlPanelControllee; /** * ControlPanelController of service */ ControlPanelController* m_ControlPanelController; /** * ControlPanelListener of service */ ControlPanelListener* m_ControlPanelListener; }; } //namespace services } //namespace ajn #endif /* CONTROLPANELSERVICE_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ControlPanelSessionHandler.h000066400000000000000000000045131272147170000302600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELSESSIONHANDLER_H_ #define CONTROLPANELSESSIONHANDLER_H_ #include #include namespace ajn { namespace services { class ControlPanelDevice; /** * class ControlPanelSessionHandler */ class ControlPanelSessionHandler : public ajn::BusAttachment::JoinSessionAsyncCB, public ajn::SessionListener { public: /** * Constructor for ControlPanelSessionHandler */ ControlPanelSessionHandler(ControlPanelDevice* device); /** * Destructor for ControlPanelSessionHandler */ virtual ~ControlPanelSessionHandler(); /** * SessionLost * @param sessionId * @param reason */ void SessionLost(ajn::SessionId sessionId, ajn::SessionListener::SessionLostReason reason); /** * JoinSessionCB * @param status * @param id * @param opts * @param context */ void JoinSessionCB(QStatus status, ajn::SessionId id, const ajn::SessionOpts& opts, void* context); /** * getSessionId * @return SessionId */ ajn::SessionId getSessionId() const; private: /** * SessionId for this Device */ ajn::SessionId m_SessionId; /** * The device of this Session Handler */ ControlPanelDevice* m_Device; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELSESSIONHANDLER_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Dialog.h000066400000000000000000000235171272147170000242220ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef DIALOG_H_ #define DIALOG_H_ #include namespace ajn { namespace services { /** * Action Class. Used to display a Dialog. * This is an abstract class. The executeActionCallBack functions need to be overridden. */ class Dialog : public RootWidget { public: /** * Constructor for Dialog Widget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget */ Dialog(qcc::String const& name, Widget* rootWidget); /** * Constructor for Dialog Widget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param objectPath - objectPath of Widget * @param device - device that contains this Widget */ Dialog(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device); /** * Constructor for Dialog Widget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - device that contains this Widget */ Dialog(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor for Dialog Widget */ virtual ~Dialog(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Get the Number of Actions in the Dialog * @return Number of Actions */ const uint16_t getNumActions() const; /** * Set the number of Actions in the Dialog * @param numActions - number of Actions */ void setNumActions(const uint16_t numActions); /** * Get the Message of the Dialog * @return the message */ const qcc::String& getMessage() const; /** * Get the Message Vector of the Dialog * @return the Messages */ const std::vector& getMessages() const; /** * Set the Message vector of the Dialog * @param messages - the messages */ void setMessages(const std::vector& messages); /** * Get the GetMessage Function Pointer for the Dialog * @return GetMessage function pointer */ GetStringFptr getGetMessages() const; /** * Set the GetMessage Function Pointer for the Dialog * @param getMessages - the GetMessage function pointer */ void setGetMessages(GetStringFptr getMessages); /** * Get the LabelAction1 of the Dialog * @return the message */ const qcc::String& getLabelAction1() const; /** * Get the LabelAction2 of the Dialog * @return the message */ const qcc::String& getLabelAction2() const; /** * Get the LabelAction3 of the Dialog * @return the message */ const qcc::String& getLabelAction3() const; /** * Get the Vector of Labels for Action 1 * @return label for Action 1 */ const std::vector& getLabelsAction1() const; /** * Set the Vector of Labels for Action 1 * @param labelsAction1 */ void setLabelsAction1(const std::vector& labelsAction1); /** * Get the GetLabel Function Pointer for Action 1 * @return GetLabel Function Pointer for Action 1 */ GetStringFptr getGetLabelsAction1() const; /** * Set the GetLabel function Pointer for Action 1 * @param getLabelsAction1 */ void setGetLabelsAction1(GetStringFptr getLabelsAction1); /** * Get the Vector of Labels for Action 2 * @return label for Action 3 */ const std::vector& getLabelsAction2() const; /** * Set the Vector of Labels for Action 2 * @param labelsAction2 */ void setLabelsAction2(const std::vector& labelsAction2); /** * Set the GetLabel function Pointer for Action 2 * @return getLabelAction2 */ GetStringFptr getGetLabelsAction2() const; /** * Set the GetLabel function Pointer for Action 2 * @param getLabelsAction2 */ void setGetLabelsAction2(GetStringFptr getLabelsAction2); /** * Get the Vector of Labels for Action 3 * @return label for Action 3 */ const std::vector& getLabelsAction3() const; /** * Set the Vector of Labels for Action 3 * @param labelsAction3 */ void setLabelsAction3(const std::vector& labelsAction3); /** * Set the GetLabel function Pointer for Action 3 * @return getLabelAction3 */ GetStringFptr getGetLabelsAction3() const; /** * Set the GetLabel function Pointer for Action 3 * @param getLabelsAction3 */ void setGetLabelsAction3(GetStringFptr getLabelsAction3); /** * Fill the MsgArg passed in with the OptionalParams * @param val - msgArg to fill * @param languageIndx - the languageIndx used for the Labels * @return status - success/failure */ QStatus fillOptParamsArg(MsgArg& val, uint16_t languageIndx); /** * Fill the MsgArg passed in with the Message Param * @param val - msgArg to fill * @param languageIndx - the languageIndx used for the Message * @return status - success/failure */ QStatus fillMessageArg(MsgArg& val, uint16_t languageIndx); /** * Fill the MsgArg passed in with the NumActions * @param val - msgArg to fill * @param languageIndx - the languageIndx * @return status - success/failure */ QStatus fillNumActionArg(MsgArg& val, uint16_t languageIndx); /** * Read the MsgArg passed in to fill the Message property * @param val - MsgArg passed in * @return status - success/failure */ QStatus readMessageArg(MsgArg* val); /** * Read the MsgArg passed in to fill the NumActions property * @param val - MsgArg passed in * @return status - success/failure */ QStatus readNumActionsArg(MsgArg* val); /** * Call to execute this Dialog's Action 1 remotely * @return status - success/failure */ QStatus executeAction1(); /** * Call to execute this Dialog's Action 2 remotely * @return status - success/failure */ QStatus executeAction2(); /** * Call to execute this Dialog's Action 3 remotely * @return status - success/failure */ QStatus executeAction3(); /** * Pure Virtual Method to be overridden * Callback for execute of Action1 * @return success/failure */ virtual bool executeAction1CallBack(); /** * Pure Virtual Method to be overridden * Callback for execute of Action2 * @return success/failure */ virtual bool executeAction2CallBack(); /** * Pure Virtual Method to be overridden * Callback for execute of Action3 * @return success/failure */ virtual bool executeAction3CallBack(); protected: /** * Number of Actions in Dialog */ uint16_t m_NumActions; /** * The message of the dialog */ qcc::String m_Message; /** * The message vector of the dialog */ std::vector m_Messages; /** * The GetMessage Function Pointer of the Dialog */ GetStringFptr m_GetMessages; /** * The Label of the dialog for Action 1 */ qcc::String m_LabelAction1; /** * The Label vector for Action1 */ std::vector m_LabelsAction1; /** * The GetLabel function pointer for Action 1 */ GetStringFptr m_GetLabelsAction1; /** * The Label of the dialog for Action 2 */ qcc::String m_LabelAction2; /** * The Label vector for Action2 */ std::vector m_LabelsAction2; /** * The GetLabel function pointer for Action 2 */ GetStringFptr m_GetLabelsAction2; /** * The Label of the dialog for Action 3 */ qcc::String m_LabelAction3; /** * The Label vector for Action3 */ std::vector m_LabelsAction3; /** * The GetLabel function pointer for Action 3 */ GetStringFptr m_GetLabelsAction3; /** * Read the MsgArg passed in and fill the OptParam * @param key - the optParam to fill * @param val - the MsgArg passed in * @return status - success/failure */ virtual QStatus readOptParamsArg(uint16_t key, MsgArg* val); /** * Private method used to log a call to an Action that is Not Defined * @return false - for failure */ bool executeActionNotDefined(); }; } //namespace services } //namespace ajn #endif /* DIALOG_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/ErrorWidget.h000066400000000000000000000056601272147170000252570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef ERRORWIDGET_H_ #define ERRORWIDGET_H_ #include namespace ajn { namespace services { /** * ErrorWidget class - used when there's an in error retrieving widget information */ class ErrorWidget : public Widget { public: /** * Constructor for Error Eisget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param originalWidget - pointer to original widget that received the error * @param device - the device containing this Widget */ ErrorWidget(qcc::String const& name, Widget* rootWidget, Widget* originalWidget, ControlPanelDevice* device); /** * */ virtual ~ErrorWidget(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObject * @param objectPath - the objectPath of the busObject * @return */ QStatus registerObjects(BusAttachment* bus, qcc::String const& objectPath); /** * Unregister the BusObjects for this widget * @param bus * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * Get the Original Widget */ Widget* getOriginalWidget() const; private: /** * the widget that was originally created unsuccessfully resulting in the creation if the ErrorWidget */ Widget* m_OriginalWidget; }; } //namespace services } //namespace ajn #endif /* ERRORWIDGET_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/HttpControl.h000066400000000000000000000111561272147170000252770ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef HTTPCONTROL_H_ #define HTTPCONTROL_H_ #include #include namespace ajn { namespace services { class ControlPanelDevice; class HttpControlBusObject; /** * HttpControl class. Allows definition of a url */ class HttpControl { public: /** * Constructor for HttpControl * @param url - url of HttpControl */ HttpControl(qcc::String const& url); /** * Constructor for HttpControl * @param objectPath - objectPath of HttpControl * @param device - the device containing this HttpControl */ HttpControl(qcc::String const& objectPath, ControlPanelDevice* device); /** * Destructor of HttpControl */ virtual ~HttpControl(); /** * Get the Interface Version of the HttpControl * @return interface Version */ const uint16_t getInterfaceVersion() const; /** * Register the HttpControl BusObject * @param bus - bus used for registering the object * @param unitName - name of unit * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus, qcc::String const& unitName); /** * Register the HttpControl BusObject * @param bus - bus used for registering the object * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * Refresh the HttpControl * @param bus - bus used for refreshing the object * @return status - success/failure */ QStatus refreshObjects(BusAttachment* bus); /** * Unregister the HttpControl BusObject * @param bus - bus used to unregister the object * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * Fill MsgArg passed in with Url * @param val - msgArg to fill * @return status - success/failure */ QStatus fillUrlArg(MsgArg& val); /** * Read MsgArg passed in and use it to set the url * @param val - MsgArg passed in * @return status - success/failure */ QStatus readUrlArg(MsgArg const& val); /** * Read MsgArg passed in and use it to set the url * @param val - MsgArg passed in * @return status - success/failure */ QStatus readVersionArg(MsgArg const& val); /** * Get the Device that contains this HttpControl * @return ControlPanelDevice */ ControlPanelDevice* getDevice() const; /** * Get the Url for the HttpControl * @return url */ const qcc::String& getUrl() const; /** * Get the ControlPanelMode of this HttpControl * @return ControlPanelMode */ ControlPanelMode getControlPanelMode() const; private: /** * Url of HttpControl */ qcc::String m_Url; /** * ObjectPath of HttpControl */ qcc::String m_ObjectPath; /** * BusObject of HttpControl */ HttpControlBusObject* m_HttpControlBusObject; /** * The Device containing the HttpControl */ ControlPanelDevice* m_Device; /** * The mode of the HttpControl */ ControlPanelMode m_ControlPanelMode; /** * Version of the Widget */ uint16_t m_Version; /** * Copy constructor of HttpControl - private. HttpControl is not copy-able * @param httpControl - HttpControl to copy */ HttpControl(const HttpControl& httpControl); /** * Assignment operator of HttpControl - private. HttpControl is not assignable * @param httpControl * @return */ HttpControl& operator=(const HttpControl& httpControl); }; } //namespace services } //namespace ajn #endif /* HTTPCONTROL_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Label.h000066400000000000000000000070231272147170000240340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LABEL_H_ #define LABEL_H_ #include #include namespace ajn { namespace services { /** * Label class used to display a Label */ class Label : public Widget { public: /** * Constructor for Label class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget */ Label(qcc::String const& name, Widget* rootWidget); /** * Constructor for Label class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - the device that contains this Widget */ Label(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor for Label class */ virtual ~Label(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Get the Labels vector of the widget * @return - label */ const std::vector& getLabels() const; /** * Set the labels vector of the widget * @param labels - vector of labels */ void setLabels(const std::vector& labels); /** * Get the GetLabel function pointer * @return GetLabel function pointer */ GetStringFptr getGetLabels() const; /** * Set the GetLabel function pointer * @param getLabel - getLabel function pointer */ void setGetLabels(GetStringFptr getLabel); /** * Fill MsgArg passed in with the Label * @param val - msgArg to fill * @param languageIndx - language of the label * @return status - success/failure */ QStatus fillLabelArg(MsgArg& val, uint16_t languageIndx); /** * Read MsgArg passed in to fill the Label property * @param val - MsgArg passed in * @return status - success/failure */ QStatus readLabelArg(MsgArg* val); private: /** * Vector of Labels of Label Widget */ std::vector m_LabelWidgetLabels; /** * GetLabel functionPointer of Label Widget */ GetStringFptr m_LabelWidgetGetLabels; }; } //namespace services } //namespace ajn #endif /* LABEL_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/LanguageSet.h000066400000000000000000000043631272147170000252200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LANGUAGESET_H_ #define LANGUAGESET_H_ #include #include namespace ajn { namespace services { /** * Class used to define a LanguageSet */ class LanguageSet { public: /** * Constructor for LanguageSet class * @param languageSetName - name of LanguageSet */ LanguageSet(qcc::String const& languageSetName); /** * Destructor for LanguageSet class */ virtual ~LanguageSet(); /** * Get the LanguageSetName * @return LanguageSetName */ const qcc::String& getLanguageSetName() const; /** * Get the number of Languages defined * @return number of Languages */ const size_t getNumLanguages() const; /** * Add a language to the LanguageSet * @param language - language to Add */ void addLanguage(qcc::String const& language); /** * * Get the Languages defined in the LanguageSet * @return languages vector */ const std::vector& getLanguages() const; private: /** * Name of LanguageSet */ qcc::String m_LanguageSetName; /** * vector to store Languages of LanguageSet */ std::vector m_Languages; }; } /* namespace services */ } /* namespace ajn */ #endif /* LANGUAGESET_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/LanguageSets.h000066400000000000000000000040141272147170000253740ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LANGUAGESETS_H_ #define LANGUAGESETS_H_ #include #include namespace ajn { namespace services { /** * Class to store the LanguageSets defined */ class LanguageSets { public: /** * Constructor for LanguageSets */ LanguageSets(); /** * Destructor for LanguageSets */ virtual ~LanguageSets(); /** * Add a LanguageSet * @param languageSetName - name of LanguageSet * @param languageSet - languageSet */ static void add(qcc::String const& languageSetName, LanguageSet const& languageSet); /** * Get a LanguageSet * @param languageSetName - the name of the languageSet to get * @return the languageSet requested or NULL if it does not exist */ static LanguageSet* get(qcc::String const& languageSetName); private: /** * The LanguageSets map storing the LanguageSets defined */ static std::map languageSets; }; } /* namespace services */ } /* namespace ajn */ #endif /* LANGUAGESETS_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/LogModule.h000066400000000000000000000023671272147170000247120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LOGMODULE_H_ #define LOGMODULE_H_ #include #include #include namespace ajn { namespace services { static char const* const QCC_MODULE = logModules::CONTROLPANEL_MODULE_LOG_NAME; } } #endif /* LOGMODULE_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/NotificationAction.h000066400000000000000000000127051272147170000266040ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONACTION_H_ #define NOTIFICATIONACTION_H_ #include #include #include namespace ajn { namespace services { class NotificationActionBusObject; /** * NotificationAction class. */ class NotificationAction { public: /** * Function used to create a NotificationAction * @param languageSet - languageSet of NotificationAction * @return A newly created NotificationAction object or NULL */ static NotificationAction* createNotificationAction(LanguageSet* languageSet); /** * NotificationAction constructor * @param languageSet - languageSet of NotificationAction * @param objectPath - objectPath of NotificationAction * @param device - device that contains this NotificationAction */ NotificationAction(LanguageSet const& languageSet, qcc::String objectPath, ControlPanelDevice* device); /** * Destructor of NotificationAction class */ virtual ~NotificationAction(); /** * Set the rootWidget of the NotificationAction * @param rootWidget - widget to set as RootWidget * @return status - success/failure */ QStatus setRootWidget(RootWidget* rootWidget); /** * Get the name of the NotificationAction - the name of the rootWidget * @return name of the NotificationAction */ qcc::String getNotificationActionName() const; /** * Register the BusObjects of the Notification Action * @param bus - bus to register the objects on * @param unitName - unitName to use in ObjectPath * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus, qcc::String const& unitName); /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @return status - success/failure */ QStatus registerObjects(BusAttachment* bus); /** * Unregister the BusObjects of the NotificationAction class * @param bus - bus used to unregister the objects * @return status - success/failure */ QStatus unregisterObjects(BusAttachment* bus); /** * Get the LanguageSet of the NotificationAction * @return */ const LanguageSet& getLanguageSet() const; /** * Get the Device of the NotificationAction * @return controlPanelDevice */ ControlPanelDevice* getDevice() const; /** * Get the objectPath * @return */ const qcc::String& getObjectPath() const; /** * Get the RootWidget of the NotificationAction * @param Language - languageSet of RootWidget to retrieve * @return rootWidget */ RootWidget* getRootWidget(qcc::String const& Language) const; /** * Callback when DismissSignal is received by the BusObject */ void DismissSignal(); private: /** * Private constructor of NotificationAction class * @param languageSet - languageSet of NotificationAction */ NotificationAction(LanguageSet const& languageSet); /** * The LanguageSet of the NotificationAction */ LanguageSet m_LanguageSet; /** * The RootWidget of the NotificationAction */ RootWidget* m_RootWidget; /** * RootWidgetMap of this NotificationAction */ std::map m_RootWidgetMap; /** * The BusObject of the NotificationAction */ NotificationActionBusObject* m_NotificationActionBusObject; /** * ObjectPath of the NotificationAction */ qcc::String m_ObjectPath; /** * Device containing the NotificationAction */ ControlPanelDevice* m_Device; /** * Copy constructor of NotificationAction - private. NotificationAction is not copy-able * @param notificationAction - notificationAction to copy */ NotificationAction(const NotificationAction& notificationAction); /** * Assignment operator of NotificationAction - private. NotificationAction is not assignable * @param notificationAction * @return */ NotificationAction& operator=(const NotificationAction& notificationAction); /** * Check the compatibility of the versions with remote controlpanel * @return status - success/failure */ QStatus checkVersions(); /** * Add the Child Widgets * @return status - success/failure */ QStatus addChildren(); }; } /* namespace services */ } /* namespace ajn */ #endif /* NOTIFICATIONACTION_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Property.h000066400000000000000000000345531272147170000246510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef PROPERTY_H_ #define PROPERTY_H_ #include #include #include #include #include #include namespace ajn { namespace services { /** * Union that allows the definition of a function pointer * to get the Properties value */ typedef union { /** * Get Value for type uint16t * @return value of Property */ uint16_t (*getUint16Value)(); /** * Get Value for type int16_t * @return value of Property */ int16_t (*getInt16Value)(); /** * Get Value for type uint32_t * @return value of Property */ uint32_t (*getUint32Value)(); /** * Get Value for type int32_t * @return value of Property */ int32_t (*getInt32Value)(); /** * Get Value for type uint64_t * @return value of Property */ uint64_t (*getUint64Value)(); /** * Get Value for type int64_t * @return value of Property */ int64_t (*getInt64Value)(); /** * Get Value for type double * @return value of Property */ double (*getDoubleValue)(); /** * Get Value for type const char* * @return value of Property */ const char* (*getCharValue)(); /** * Get Value for type bool * @return value of Property */ bool (*getBoolValue)(); /** * Get Value for type CPSDate * @return value of Property */ const CPSDate& (*getDateValue)(); /** * Get Value for type CPSTime * @return value of Property */ const CPSTime& (*getTimeValue)(); } PropertyValueFptr; /** * Union that allows the definition of a function pointer * to get the Properties value */ typedef union { /** * Get Value for type uint16t * @return value of Property */ uint16_t uint16Value; /** * Get Value for type int16_t * @return value of Property */ int16_t int16Value; /** * Get Value for type uint32_t * @return value of Property */ uint32_t uint32Value; /** * Get Value for type int32_t * @return value of Property */ int32_t int32Value; /** * Get Value for type uint64_t * @return value of Property */ uint64_t uint64Value; /** * Get Value for type int64_t * @return value of Property */ int64_t int64Value; /** * Get Value for type double * @return value of Property */ double doubleValue; /** * Get Value for type const char* * @return value of Property */ const char* charValue; /** * Get Value for type bool * @return value of Property */ bool boolValue; /** * Get Value for type CPSDate * @return value of Property */ CPSDate* dateValue; /** * Get Value for type CPSTime * @return value of Property */ CPSTime* timeValue; } PropertyValue; /** * Property Class. Used to display a property Widget. * This is an abstract class. The setValue function should be overwritten * in the implementation to allow setting of the property. */ class Property : public Widget { public: /** * Constructor for Property Class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param propertyType - type of Property Value */ Property(qcc::String name, Widget* rootWidget, PropertyType propertyType); /** * Constructor for Property Class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - the device that contains this Property */ Property(qcc::String name, Widget* rootWidget, ControlPanelDevice* device); /** * Destructor of Property class */ virtual ~Property(); /** * creates and returns the appropriate BusObject for this Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status); /** * Get the PropertyType * @return PropertyType */ PropertyType getPropertyType() const; /** * Get the PropertyValue of the property * @return the value of the property */ PropertyValue getPropertyValue() const; /** * Get the Unit of Measure * @return Unit of Measure Values */ const qcc::String& getUnitOfMeasure() const; /** * Get the Unit of Measure vector * @return vector of the Unit of Measure Values */ const std::vector& getUnitOfMeasures() const; /** * Set the Unit of Measure vector * @param unitOfMeasures - vector of Unit of Measure values */ void setUnitOfMeasures(const std::vector& unitOfMeasures); /** * Get the GetUnitOfMeasure Function pointer * @return unitOfMeasure Function pointer */ GetStringFptr getGetUnitOfMeasures() const; /** * Set the GetUnitOfMeasure Function pointer * @param getUnitOfMeasures - the GetUnitOfMeasure function Pointer */ void setGetUnitOfMeasures(GetStringFptr getUnitOfMeasures); /** * Get the Constraint List vector * @return the Constraint List vector */ const std::vector& getConstraintList() const; /** * Set the Constraint List vector * @param constraintList - constraintList vector */ void setConstraintList(const std::vector& constraintList); /** * Get the Constraint Range * @return the Constraint Range */ ConstraintRange* getConstraintRange() const; /** * Set the Constraint Range * @param constraintRange */ void setConstraintRange(ConstraintRange* constraintRange); /** * Set the GetValue Function Pointer * @param getUint16Value - functionPointer to get a uint16 Value * @return status - success/failure */ QStatus setGetValue(uint16_t (*getUint16Value)()); /** * Set the GetValue Function Pointer * @param getInt16Value - functionPointer to get a int16 Value * @return status - success/failure */ QStatus setGetValue(int16_t (*getInt16Value)()); /** * Set the GetValue Function Pointer * @param getUint32Value - functionPointer to get a uint32 Value * @return status - success/failure */ QStatus setGetValue(uint32_t (*getUint32Value)()); /** * Set the GetValue Function Pointer * @param getInt32Value - functionPointer to get a int32 Value * @return status - success/failure */ QStatus setGetValue(int32_t (*getInt32Value)()); /** * Set the GetValue Function Pointer * @param getUint64Value - functionPointer to get a uint64 Value * @return status - success/failure */ QStatus setGetValue(uint64_t (*getUint64Value)()); /** * Set the GetValue Function Pointer * @param getInt64Value - functionPointer to get a int64 Value * @return status - success/failure */ QStatus setGetValue(int64_t (*getInt64Value)()); /** * Set the GetValue Function Pointer * @param getDoubleValue - functionPointer to get a double Value * @return status - success/failure */ QStatus setGetValue(double (*getDoubleValue)()); /** * Set the GetValue Function Pointer * @param getCharValue - functionPointer to get a Char* Value * @return status - success/failure */ QStatus setGetValue(const char* (*getCharValue)()); /** * Set the GetValue Function Pointer * @param getBoolValue - functionPointer to get a bool Value * @return status - success/failure */ QStatus setGetValue(bool (*getBoolValue)()); /** * Set the GetValue Function Pointer * @param getDateValue - functionPointer to get a date Value * @return status - success/failure */ QStatus setGetValue(const CPSDate& (*getDateValue)()); /** * Set the GetValue Function Pointer * @param getTimeValue - functionPointer to get a time Value * @return status - success/failure */ QStatus setGetValue(const CPSTime& (*getTimeValue)()); /** * Fill the MsgArg passed in with the Property Value * @param val - msgArg to fill * @param languageIndx - language requested * @return status - success/failure */ QStatus fillPropertyValueArg(MsgArg& val, uint16_t languageIndx); /** * Fill the MsgArg passed in with the OptParams * @param val - msgArg to fill * @param languageIndx - language requested * @return status - success/failure */ QStatus fillOptParamsArg(MsgArg& val, uint16_t languageIndx); /** * Read the MsgArg passed in to fill the Value property * @param val - MsgArg passed in * @return status - success/failure */ QStatus readValueArg(const MsgArg* val); /** * Set the Property Value * @param val - msgArg that includes the new Value * @param languageIndx - languageIndx setValue was called for * @return status - success/failure */ QStatus setPropertyValue(MsgArg& val, uint16_t languageIndx); /** * Send a signal that the Property's Value has changed * @return status - success/failure */ QStatus SendValueChangedSignal(); /** * Callback when value is changed * @param msg */ void ValueChanged(Message& msg); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(bool value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(uint16_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(int16_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(uint32_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(int32_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(uint64_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(int64_t value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(double value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(const char* value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(const CPSDate& value); /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ virtual QStatus setValue(const CPSTime& value); private: /** * The Property Type of the Property */ PropertyType m_PropertyType; /** * The Value of the Property */ PropertyValue m_Value; /** * The string placeholder for the value if it is a string propertyType */ qcc::String m_ValueString; /** * The GetValue functionPointers of the Property */ PropertyValueFptr m_GetValue; /** * The Unit of Measure of the Property */ qcc::String m_UnitOfMeasure; /** * The Unit of Measure of the Property */ std::vector m_UnitOfMeasures; /** * The GetUnitOfMeasure function Pointer of the Property */ GetStringFptr m_GetUnitOfMeasures; /** * The ConstraintList of the Property */ std::vector m_ConstraintList; /** * The ConstraintRange of the Property */ ConstraintRange* m_ConstraintRange; /** * Read the MsgArg passed in and fill the OptParam * @param key - the optParam to fill * @param val - the MsgArg passed in * @return status - success/failure */ QStatus readOptParamsArg(uint16_t key, MsgArg* val); /** * Validate that the GetValue passed in fits the Property's property Type * @param propertyType - the property Type passed in * @return true/false */ bool validateGetValue(PropertyType propertyType); /** * Validate that the GetValue passed in fits the Property's property Type * @param propertyType - the property Type passed in * @return status - success/failure */ QStatus validateValue(PropertyType propertyType); /** * Error Message if the correct SetValue function * is not defined in the implementation * @return status - success/failure */ QStatus defaultErrorSetValue(); }; } //namespace services } //namespace ajn #endif /* PROPERTY_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/RootWidget.h000066400000000000000000000077721272147170000251170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef ROOTWIDGET_H_ #define ROOTWIDGET_H_ #include namespace ajn { namespace services { /** * RootWidget class. Used as base for widgets that function as a * rootContainer or rootDialog */ class RootWidget : public Widget { public: /** * Constructor for RootWidget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param widgetType - the type of the widget */ RootWidget(qcc::String const& name, Widget* rootWidget, WidgetType widgetType); /** * Constructor for RootWidget * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param objectPath the objectPath of the widget * @param device - the device that contains the widget * @param widgetType - the type of Widget created */ RootWidget(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device, WidgetType widgetType); /** * Destructor of RootWidget */ virtual ~RootWidget(); /** * Send a Signal to Dismiss the widget * @return stats - success/failure */ QStatus SendDismissSignal(); /** * Set the BusObject if RootWidget is a NotificationAction * @param notificationActionBusObject - the busObject to store * @return status - success/failure */ QStatus setNotificationActionBusObject(BusObject* notificationActionBusObject); /** * Unregister the BusObjects * @param bus - bus used to unregister * @return status - success/failure */ virtual QStatus unregisterObjects(BusAttachment* bus); /** * Register the BusObjects for this Widget * @param bus - the bus to be used * @return status - success/failure */ virtual QStatus registerObjects(BusAttachment* bus); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObject * @param objectPath - the objectPath of the busObject * @return */ virtual QStatus registerObjects(BusAttachment* bus, qcc::String const& objectPath); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObjects * @param languageSet - the languageSet to register the busObjects for * @param objectPathPrefix - the objectPathPrefix of the busObject * @param objectPathSuffix - the objectPathSuffix of the busObject * @param isRoot - is this a rootWidget * @return status - success/failure */ virtual QStatus registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot = false); protected: /** * The BusObject if this Widget is a NotificationAction */ BusObject* m_NotificationActionBusObject; /** * The ObjectPath of the Widget */ qcc::String m_ObjectPath; }; } //namespace services } //namespace ajn #endif /* ROOTWIDGET_H_ */ base-16.04/controlpanel/cpp/inc/alljoyn/controlpanel/Widget.h000066400000000000000000000301471272147170000242430ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef WIDGET_H_ #define WIDGET_H_ #include #include #include #include #include namespace ajn { namespace services { /* * Forward Declaration */ class WidgetBusObject; class ControlPanelDevice; /** * Base Class for all Widgets */ class Widget { public: /** * Constructor for Widget class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param widgetType - the type of the widget */ Widget(qcc::String const& name, Widget* rootWidget, WidgetType widgetType); /** * Constructor for Widget class * @param name - name of Widget * @param rootWidget - the RootWidget of the widget * @param device - the device containing this widget * @param widgetType - the type of the widget */ Widget(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device, WidgetType widgetType); /** * Destructor for Widget */ virtual ~Widget() = 0; /** * Pure virtual function. Needs to be implemented by a function that will * create and return the appropriate BusObject for the Widget * @param bus - the bus used to create the widget * @param objectPath - the objectPath of the widget * @param langIndx - the language Indx * @param status - the status indicating success or failure * @return a newly created WidgetBusObject */ virtual WidgetBusObject* createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) = 0; /** * Get the widgetType of the Widget * @return widgetType */ WidgetType getWidgetType() const; /** * Get the name of the Widget * @return widgetName */ qcc::String const& getWidgetName() const; /** * Get the mode of the Widget * @return controlPanelMode */ ControlPanelMode getControlPanelMode() const; /** * Get this widget's RootWidget * @return rootWidget */ Widget* getRootWidget() const; /** * Get the Device of the widget * @return device */ ControlPanelDevice* getDevice() const; /** * Get the Interface Version of the Widget * @return interface Version */ const uint16_t getInterfaceVersion() const; /** * Set the isSecured boolean * @param secured */ void setIsSecured(bool secured); /** * Get the isSecured boolean * @return true/false */ bool getIsSecured() const; /** * Get IsEnabled boolean * @return true/false */ bool getIsEnabled() const; /** * Get IsWritable boolean * @return true/false */ bool getIsWritable() const; /** * Set the Enabled flag of the Widget * @param enabled */ void setEnabled(bool enabled); /** * Get the GetEnabled function Pointer * @return getEnabled function Pointer of the widget */ GetBoolFptr getGetEnabled() const; /** * Set the GetEnabled function Pointer * @param getEnabled - function pointer to get the enabled boolean */ void setGetEnabled(GetBoolFptr getEnabled); /** * Set the Writable flag of the widget * @param writable */ void setWritable(bool writable); /** * Get the GetWritable function Pointer * @return getWritable function Pointer of the widget */ GetBoolFptr getGetWritable() const; /** * Set the GetWritable function Pointer * @param getWritable - function pointer to get the writable boolean */ void setGetWritable(GetBoolFptr getWritable); /** * Get the States of the Widget * @return states */ uint32_t getStates() const; /** * Set the States of the widget * @param enabled - is widget enabled * @param writable - is widget writable */ void setStates(uint8_t enabled, uint8_t writable); /** * Get the BgColor of the Widget * @return bgColor */ uint32_t getBgColor() const; /** * Set the BgColor of the Widget * @param bgColor */ void setBgColor(uint32_t bgColor); /** * Get the GetBgColor function pointer of the Widget * @return GetBgColor function pointer */ GetUint32Fptr getGetBgColor() const; /** * Set the GetBgColor function pointer of the Widget * @param getBgColor */ void setGetBgColor(GetUint32Fptr getBgColor); /** * Get the Label of the Widget * @return label */ virtual const qcc::String& getLabel() const; /** * Get the Labels vector of the widget * @return - label */ virtual const std::vector& getLabels() const; /** * Set the labels vector of the widget * @param labels - vector of labels */ virtual void setLabels(const std::vector& labels); /** * Get the GetLabel function pointer * @return GetLabel function pointer */ virtual GetStringFptr getGetLabels() const; /** * Set the GetLabel function pointer * @param getLabels - getLabel function pointer */ virtual void setGetLabels(GetStringFptr getLabels); /** * Get the vector of Hints for the Widget * @return hints Vector */ const std::vector& getHints() const; /** * Set the vector of Hints for the Widget * @param hints - hints vector */ void setHints(const std::vector& hints); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObject * @param objectPath - the objectPath of the busObject * @return */ virtual QStatus registerObjects(BusAttachment* bus, qcc::String const& objectPath); /** * Register the BusObjects for this Widget * @param bus - the bus used to register the busObjects * @param languageSet - the languageSet to register the busObjects for * @param objectPathPrefix - the objectPathPrefix of the busObject * @param objectPathSuffix - the objectPathSuffix of the busObject * @param isRoot - is this a rootWidget * @return status - success/failure */ virtual QStatus registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot = false); /** * Refresh the Widget * @param bus - bus used for refreshing the object * @return status - success/failure */ QStatus refreshObjects(BusAttachment* bus); /** * Unregister the BusObjects for this widget * @param bus * @return status - success/failure */ virtual QStatus unregisterObjects(BusAttachment* bus); /** * Fill MsgArg passed in with the States * @param val - msgArg to fill * @param languageIndx - language requested * @return status - success/failure */ QStatus fillStatesArg(MsgArg& val, uint16_t languageIndx); /** * Fill MsgArg passed in with the OptParams * @param val - msgArg to fill * @param languageIndx - language requested * @return status - success/failure */ virtual QStatus fillOptParamsArg(MsgArg& val, uint16_t languageIndx); /** * Read the MsgArg passed in and fill the Version property * @param val - MsgArg passed in * @return status - success/failure */ virtual QStatus readVersionArg(MsgArg* val); /** * Read the MsgArg passed in and fill the States property * @param val - MsgArg passed in * @return status - success/failure */ virtual QStatus readStatesArg(MsgArg* val); /** * Read the MsgArg passed in and fill the OptParams * @param val - MsgArg passed in * @return status - success/failure */ virtual QStatus readOptParamsArg(MsgArg* val); /** * Set a Property Changed Signal * @return status - success/failure */ QStatus SendPropertyChangedSignal(); /** * Callback when PropertyChanged signal is received */ void PropertyChanged(); protected: /** * The Name of the Widget */ qcc::String m_Name; /** * The WidgetType of the Widget */ WidgetType m_WidgetType; /** * The RootWidget of this Widget */ Widget* m_RootWidget; /** * Is the Widget Secured */ bool m_IsSecured; /** * Version of the Widget */ uint16_t m_Version; /** * States of the Widget */ uint32_t m_States; /** * GetEnabled function Pointer */ GetBoolFptr m_GetEnabled; /** * Get Writable Function Pointer */ GetBoolFptr m_GetWritable; /** * BgColor of the Widget */ uint32_t m_BgColor; /** * GetBgColor function Pointer of the Widget */ GetUint32Fptr m_GetBgColor; /** * Label */ qcc::String m_Label; /** * Vector of Labels */ std::vector m_Labels; /** * GetLabel functionPointer */ GetStringFptr m_GetLabels; /** * Vector of Hints */ std::vector m_Hints; /** * The BusObjects of the Widget */ std::vector m_BusObjects; /** * Mode widget is in */ ControlPanelMode m_ControlPanelMode; /** * The Device that contains this widget */ ControlPanelDevice* m_Device; /** * Function to fill the OptParams of the Widget Base class * @param optParams - msgArg Array to fill * @param languageIndx - the language requested * @param optParamIndx - the index of the optParams array to start from * @return status - success/failure */ QStatus fillOptParamsArg(MsgArg* optParams, uint16_t languageIndx, size_t& optParamIndx); /** * Read the MsgArg passed in and fill the OptParam * @param key - the optParam to fill * @param val - the MsgArg passed in * @return status - success/failure */ virtual QStatus readOptParamsArg(uint16_t key, MsgArg* val); /** * Check Versions of Remote Widget * @return status - success/failure */ virtual QStatus checkVersions(); /** * Add Children for Widget * @param bus - bus to use * @return status - success/failure */ virtual QStatus addChildren(BusAttachment* bus); /** * Refresh the Children of this Widget * @param bus - bus to use * @return status - success/failure */ virtual QStatus refreshChildren(BusAttachment* bus); /** * FillProperties for Widget * @return status - success/failure */ virtual QStatus fillProperties(); private: /** * Copy constructor of widget - private. widget is not copy-able * @param widget - widget to copy */ Widget(const Widget& widget); /** * Assignment operator of widget - private. widget is not assignable * @param widget * @return */ Widget& operator=(const Widget& widget); }; } //namespace services } //namespace ajn #endif /* WIDGET_H_ */ base-16.04/controlpanel/cpp/samples/000077500000000000000000000000001272147170000173655ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/ControlPanelController/000077500000000000000000000000001272147170000240315ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/ControlPanelController/ControlPanelControllerSample.cc000066400000000000000000000136301272147170000321510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "ControlPanelListenerImpl.h" #include "ControllerNotificationReceiver.h" #include #include #include #include #include #define SERVICE_PORT 900 using namespace ajn; using namespace services; using namespace qcc; BusAttachment* bus = 0; ControlPanelService* controlPanelService = 0; ControlPanelController* controlPanelController = 0; ControlPanelListenerImpl* controlPanelListener = 0; DefaultECDHEAuthListener* authListener = 0; AnnounceHandlerImpl* announceHandler = 0; NotificationService* conService = 0; ControllerNotificationReceiver* receiver = 0; qcc::String ControlPanelPrefix = "/ControlPanel/"; static volatile sig_atomic_t s_interrupt = false; static void CDECL_CALL SigIntHandler(int sig) { QCC_UNUSED(sig); s_interrupt = true; } void cleanup() { if (bus && announceHandler) { const char* interfaces[] = { "*" }; bus->CancelWhoImplements(interfaces, sizeof(interfaces) / sizeof(interfaces[0])); bus->UnregisterAboutListener(*announceHandler); } if (controlPanelService) { controlPanelService->shutdownController(); delete controlPanelService; controlPanelService = NULL; } if (controlPanelController) { delete controlPanelController; controlPanelController = NULL; } if (controlPanelListener) { delete controlPanelListener; controlPanelListener = NULL; } if (announceHandler) { delete announceHandler; announceHandler = NULL; } if (authListener) { delete authListener; authListener = NULL; } if (conService) { conService->shutdown(); conService = NULL; } if (receiver) { delete receiver; receiver = NULL; } if (bus) { delete bus; bus = NULL; } } static void announceHandlerCallback(qcc::String const& busName, unsigned short version, unsigned short port, const ajn::AboutObjectDescription& objectDescription, const ajn::AboutData& aboutData) { QCC_UNUSED(version); QCC_UNUSED(port); QCC_UNUSED(aboutData); std::cout << "Got announceHandlerCallback" << std::endl; controlPanelController->createControllableDevice(busName, objectDescription); } void WaitForSigInt(void) { while (s_interrupt == false) { #ifdef _WIN32 Sleep(100); #else usleep(100 * 1000); #endif } } int main() { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } QStatus status; // Allow CTRL+C to end application signal(SIGINT, SigIntHandler); std::cout << "Beginning ControlPanel Application. (Press CTRL+C to end application)" << std::endl; // Initialize Service objects controlPanelService = ControlPanelService::getInstance(); QCC_SetDebugLevel(logModules::CONTROLPANEL_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); authListener = new DefaultECDHEAuthListener(); const char *password = "000000"; authListener->SetPassword((const uint8_t*)password, strlen(password)); bus = CommonSampleUtil::prepareBusAttachment(authListener); if (bus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; cleanup(); return 1; } controlPanelController = new ControlPanelController(); controlPanelListener = new ControlPanelListenerImpl(controlPanelController); status = controlPanelService->initController(bus, controlPanelController, controlPanelListener); if (status != ER_OK) { std::cout << "Could not initialize Controllee." << std::endl; cleanup(); return 1; } announceHandler = new AnnounceHandlerImpl(NULL, announceHandlerCallback); bus->RegisterAboutListener(*announceHandler); const char* interfaces[] = { "*" }; status = bus->WhoImplements(interfaces, sizeof(interfaces) / sizeof(interfaces[0])); if (ER_OK == status) { std::cout << "WhoImplements called." << std::endl; } else { std::cout << "ERROR - WhoImplements failed." << std::endl; } conService = NotificationService::getInstance(); receiver = new ControllerNotificationReceiver(controlPanelController); status = conService->initReceive(bus, receiver); if (status != ER_OK) { std::cout << "Could not initialize receiver." << std::endl; cleanup(); return 1; } std::cout << "Finished setup. Waiting for Contollees" << std::endl; WaitForSigInt(); cleanup(); return 0; } base-16.04/controlpanel/cpp/samples/ControlPanelController/ControlPanelListenerImpl.cc000066400000000000000000000127351272147170000313000ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "ControlPanelListenerImpl.h" #include "ControllerUtil.h" #include #include #include using namespace ajn; using namespace services; ControlPanelListenerImpl::ControlPanelListenerImpl(ControlPanelController* controller) : m_Controller(controller) { } ControlPanelListenerImpl::~ControlPanelListenerImpl() { } void ControlPanelListenerImpl::sessionEstablished(ControlPanelDevice* device) { if (find(m_ConnectedDevices.begin(), m_ConnectedDevices.end(), device->getDeviceBusName()) != m_ConnectedDevices.end()) { std::cout << "Received session established for device which was already parsed - ignoring: " << device->getDeviceBusName().c_str() << std::endl; return; } std::map units = device->getDeviceUnits(); std::map::iterator iter; std::map::iterator it; std::cout << "Session has been established with device: " << device->getDeviceBusName().c_str() << std::endl; m_ConnectedDevices.push_back(device->getDeviceBusName()); for (iter = units.begin(); iter != units.end(); iter++) { std::cout << "Now parsing unit: " << iter->first.c_str() << std::endl; HttpControl* httpControl = iter->second->getHttpControl(); if (httpControl) { std::cout << "Unit has a HttpControl: " << std::endl; std::cout << " HttpControl version: " << httpControl->getInterfaceVersion() << std::endl; std::cout << " HttpControl url: " << httpControl->getUrl().c_str() << std::endl; } std::map controlPanels = iter->second->getControlPanels(); for (it = controlPanels.begin(); it != controlPanels.end(); it++) { std::cout << "Now parsing panelName: " << it->first.c_str() << std::endl; std::vector languages = it->second->getLanguageSet().getLanguages(); for (size_t i = 0; i < languages.size(); i++) { std::cout << "Now parsing language: " << languages[i].c_str() << std::endl; Container* rootContainer = it->second->getRootWidget(languages[i]); std::cout << "Finished loading widget: " << rootContainer->getWidgetName().c_str() << std::endl; ControllerUtil::printRootWidget(rootContainer); } } } } void ControlPanelListenerImpl::sessionLost(ControlPanelDevice* device) { std::cout << "Received sessionLost for device " << device->getDeviceBusName().c_str() << std::endl; std::cout << "Sleeping 5 seconds before cleaning up device" << std::endl; #ifdef _WIN32 Sleep(5000); #else sleep(5); #endif std::vector::iterator iter; iter = find(m_ConnectedDevices.begin(), m_ConnectedDevices.end(), device->getDeviceBusName()); if (iter != m_ConnectedDevices.end()) { m_ConnectedDevices.erase(iter); } if (m_Controller) { QStatus status = m_Controller->deleteControllableDevice(device->getDeviceBusName()); std::cout << " Deleting Controllable Device " << (status == ER_OK ? "succeeded" : "failed") << std::endl; } } void ControlPanelListenerImpl::errorOccured(ControlPanelDevice* device, QStatus status, ControlPanelTransaction transaction, qcc::String const& error) { QCC_UNUSED(status); QCC_UNUSED(transaction); std::cout << "Received an error from service for device " << device->getDeviceBusName().c_str() << std::endl; std::cout << " Error Message: " << error.c_str() << std::endl; } void ControlPanelListenerImpl::signalPropertiesChanged(ControlPanelDevice* device, Widget* widget) { QCC_UNUSED(device); std::cout << "Received PropertiesChanged Signal for Widget " << widget->getWidgetName().c_str() << std::endl; } void ControlPanelListenerImpl::signalPropertyValueChanged(ControlPanelDevice* device, Property* property) { QCC_UNUSED(device); std::cout << "Received ValueChanged Signal for Widget " << property->getWidgetName().c_str() << std::endl; ControllerUtil::printPropertyValue(property->getPropertyValue(), property->getPropertyType()); } void ControlPanelListenerImpl::signalDismiss(ControlPanelDevice* device, NotificationAction* notificationAction) { QCC_UNUSED(device); QCC_UNUSED(notificationAction); std::cout << "Received Dismiss Signal for NotificationAction" << std::endl; } base-16.04/controlpanel/cpp/samples/ControlPanelController/ControlPanelListenerImpl.h000066400000000000000000000042441272147170000311360ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELLISTENERIMPL_H_ #define CONTROLPANELLISTENERIMPL_H_ #include #include /* * */ class ControlPanelListenerImpl : public ajn::services::ControlPanelListener { public: ControlPanelListenerImpl(ajn::services::ControlPanelController* controller); ~ControlPanelListenerImpl(); void sessionEstablished(ajn::services::ControlPanelDevice* device); void sessionLost(ajn::services::ControlPanelDevice* device); void errorOccured(ajn::services::ControlPanelDevice* device, QStatus status, ajn::services::ControlPanelTransaction transaction, qcc::String const& error); void signalPropertiesChanged(ajn::services::ControlPanelDevice* device, ajn::services::Widget* widget); void signalPropertyValueChanged(ajn::services::ControlPanelDevice* device, ajn::services::Property* property); void signalDismiss(ajn::services::ControlPanelDevice* device, ajn::services::NotificationAction* notificationAction); private: ajn::services::ControlPanelController* m_Controller; std::vector m_ConnectedDevices; }; #endif /* CONTROLPANELLISTENERIMPL_H_ */ base-16.04/controlpanel/cpp/samples/ControlPanelController/ControllerNotificationReceiver.cc000066400000000000000000000071601272147170000325230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "ControllerNotificationReceiver.h" #include "ControllerUtil.h" #include using namespace ajn; using namespace services; using namespace qcc; ControllerNotificationReceiver::ControllerNotificationReceiver(ControlPanelController* controlPanelController) : m_Controller(controlPanelController) { } ControllerNotificationReceiver::~ControllerNotificationReceiver() { } void ControllerNotificationReceiver::Receive(Notification const& notification) { if (m_Controller && notification.getControlPanelServiceObjectPath()) { std::cout << "Received ControlPanelService object path: " << notification.getControlPanelServiceObjectPath() << std::endl; ControlPanelDevice* device = m_Controller->getControllableDevice(notification.getSenderBusName()); if (!device) { std::cout << "Could not get a Controllable Device" << std::endl; return; } QStatus status = device->startSession(); if (status != ER_OK) { std::cout << "Could not start a session with the device" << std::endl; return; } NotificationAction* notficationAction = device->addNotificationAction(notification.getControlPanelServiceObjectPath()); if (!notficationAction) { std::cout << "Could not add the notificationAction" << std::endl; return; } std::cout << "Parsing the notificationAction received" << std::endl; std::vector languages = notficationAction->getLanguageSet().getLanguages(); for (size_t i = 0; i < languages.size(); i++) { std::vector actionsToExecute; std::vector propertiesToChange; std::vector dialogsToExecute; std::cout << "Now parsing language: " << languages[i].c_str() << std::endl; RootWidget* rootWidget = notficationAction->getRootWidget(languages[i]); std::cout << "Finished loading widget: " << rootWidget->getWidgetName().c_str() << std::endl; ControllerUtil::printRootWidget(rootWidget); } std::cout << "Removing the notificationAction from the device" << std::endl; status = device->removeNotificationAction(notficationAction); std::cout << " Removing NotificationAction " << (status == ER_OK ? "succeeded" : "failed") << std::endl; } } void ControllerNotificationReceiver::Dismiss(const int32_t msgId, const qcc::String appId) { std::cout << "Got ControllerNotificationReceiver::DismissHandler with msgId=" << msgId << " appId=" << appId.c_str() << std::endl; } base-16.04/controlpanel/cpp/samples/ControlPanelController/ControllerNotificationReceiver.h000066400000000000000000000042111272147170000323570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLLERNOTIFICATIONRECEIVER_H_ #define CONTROLLERNOTIFICATIONRECEIVER_H_ #include #include #include #include /** * Class that will receive Notifications. Implements NotificationReceiver * Receives list of applications to filter by and will only display notifications * from those applications */ class ControllerNotificationReceiver : public ajn::services::NotificationReceiver { public: /** * Constructor */ ControllerNotificationReceiver(ajn::services::ControlPanelController* controlPanelController); /** * Destructor */ ~ControllerNotificationReceiver(); /** * Receive - function that receives a notification * @param notification */ void Receive(ajn::services::Notification const& notification); /** * receive Dismiss signal * @param message id * @param application id */ void Dismiss(const int32_t msgId, const qcc::String appId); private: ajn::services::ControlPanelController* m_Controller; }; #endif /* CONTROLLERNOTIFICATIONRECEIVER_H_ */ base-16.04/controlpanel/cpp/samples/ControlPanelController/ControllerUtil.cc000066400000000000000000000541461272147170000273330ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "ControllerUtil.h" #include #include #include using namespace ajn; using namespace services; qcc::String ControllerUtil::PROPERTY_HINTS_STRINGS[PROPERTY_HINTS_SIZE] = { "", "SWITCH", "CHECKBOX", "SPINNER", "RADIOBUTTON", "SLIDER", "TIMEPICKER", "DATEPICKER", "NUMBERPICKER", "KEYPAD", "ROTARYKNOB", "TEXTVIEW", "NUMERICVIEW", "EDITTEXT" }; ControllerUtil::ControllerUtil() { } ControllerUtil::~ControllerUtil() { } void ControllerUtil::printRootWidget(RootWidget* rootWidget) { if (!rootWidget) { return; } std::vector actionsToExecute; std::vector propertiesToChange; std::vector dialogsToExecute; if (rootWidget->getWidgetType() == WIDGET_TYPE_CONTAINER) { printContainer((Container*)rootWidget, actionsToExecute, dialogsToExecute, propertiesToChange); std::cout << "Going to execute all Actions now" << std::endl; executeActions(actionsToExecute); std::cout << std::endl; std::cout << "Going to execute all Dialog Actions now" << std::endl; executeDialogActions(dialogsToExecute); std::cout << std::endl; std::cout << "Going to call setValue for all Properties now" << std::endl; setPropertyValues(propertiesToChange); std::cout << std::endl; } else if (rootWidget->getWidgetType() == WIDGET_TYPE_DIALOG) { printDialog((Dialog*)rootWidget, ""); dialogsToExecute.push_back((Dialog*)rootWidget); std::cout << "Going to execute all Dialog Actions now" << std::endl; executeDialogActions(dialogsToExecute); std::cout << std::endl; } else { std::cout << "RootWidget is of unknown type." << std::endl; } } void ControllerUtil::printContainer(Container* container, std::vector& actionsToExecute, std::vector& dialogsToExecute, std::vector& propertiesToChange, qcc::String const& indent) { printBasicWidget(container, "Container", indent); std::vector childWidgets = container->getChildWidgets(); std::cout << indent.c_str() << "Print ChildWidgets: " << std::endl; for (size_t i = 0; i < childWidgets.size(); i++) { WidgetType widgetType = childWidgets[i]->getWidgetType(); switch (widgetType) { case WIDGET_TYPE_ACTION: printBasicWidget(childWidgets[i], "Action", indent + " "); actionsToExecute.push_back((Action*)childWidgets[i]); break; case WIDGET_TYPE_ACTION_WITH_DIALOG: printBasicWidget(childWidgets[i], "Action", indent + " "); std::cout << indent.c_str() << " Printing ChildDialog: " << std::endl; printDialog(((ActionWithDialog*)childWidgets[i])->getChildDialog(), indent + " "); dialogsToExecute.push_back(((ActionWithDialog*)childWidgets[i])->getChildDialog()); break; case WIDGET_TYPE_LABEL: printBasicWidget(childWidgets[i], "Label", indent + " "); break; case WIDGET_TYPE_PROPERTY: printProperty(((Property*)childWidgets[i]), indent + " "); propertiesToChange.push_back((Property*)childWidgets[i]); break; case WIDGET_TYPE_CONTAINER: printContainer(((Container*)childWidgets[i]), actionsToExecute, dialogsToExecute, propertiesToChange, indent + " "); break; case WIDGET_TYPE_DIALOG: printDialog(((Dialog*)childWidgets[i]), indent + " "); break; case WIDGET_TYPE_ERROR: printErrorWidget(childWidgets[i], indent + " "); break; } std::cout << std::endl; } } void ControllerUtil::printProperty(Property* property, qcc::String const& indent) { printBasicWidget(property, "Property", indent); printPropertyValue(property->getPropertyValue(), property->getPropertyType(), indent); std::cout << indent.c_str() << "Property is " << (property->getIsWritable() ? "writable" : "not writable") << std::endl; if (property->getUnitOfMeasure().size()) { std::cout << indent.c_str() << "Property unitOfMeasure: " << property->getUnitOfMeasure().c_str() << std::endl; } if (property->getConstraintRange()) { std::cout << indent.c_str() << "Property has ConstraintRange: " << std::endl; printConstraintRange(property->getConstraintRange(), property->getPropertyType(), indent + " "); } if (property->getConstraintList().size()) { std::cout << indent.c_str() << "Property has ConstraintList: " << std::endl; printConstraintList(property->getConstraintList(), property->getPropertyType(), indent + " "); } } void ControllerUtil::printDialog(Dialog* dialog, qcc::String const& indent) { printBasicWidget(dialog, "Dialog", indent); std::cout << indent.c_str() << "Dialog message: " << dialog->getMessage().c_str() << std::endl; std::cout << indent.c_str() << "Dialog numActions: " << dialog->getNumActions() << std::endl; if (dialog->getLabelAction1().size()) { std::cout << indent.c_str() << "Dialog Label for Action1: " << dialog->getLabelAction1().c_str() << std::endl; } if (dialog->getLabelAction2().size()) { std::cout << indent.c_str() << "Dialog Label for Action2: " << dialog->getLabelAction2().c_str() << std::endl; } if (dialog->getLabelAction3().size()) { std::cout << indent.c_str() << "Dialog Label for Action3: " << dialog->getLabelAction3().c_str() << std::endl; } } void ControllerUtil::printBasicWidget(Widget* widget, qcc::String const& widgetType, qcc::String const& indent) { std::cout << indent.c_str() << widgetType.c_str() << " name: " << widget->getWidgetName().c_str() << std::endl; std::cout << indent.c_str() << widgetType.c_str() << " version: " << widget->getInterfaceVersion() << std::endl; std::cout << indent.c_str() << widgetType.c_str() << " is " << (widget->getIsSecured() ? "secured" : "not secured") << std::endl; std::cout << indent.c_str() << widgetType.c_str() << " is " << (widget->getIsEnabled() ? "enabled" : "not enabled") << std::endl; if (widget->getLabel().size()) { std::cout << indent.c_str() << widgetType.c_str() << " label: " << widget->getLabel().c_str() << std::endl; } if (widget->getBgColor() != UINT32_MAX) { std::cout << indent.c_str() << widgetType.c_str() << " bgColor: " << widget->getBgColor() << std::endl; } printHints(widget, widgetType, indent); } void ControllerUtil::printErrorWidget(Widget* widget, qcc::String const& indent) { std::cout << indent.c_str() << "Received error widget with name: " << widget->getWidgetName().c_str() << std::endl; if (widget->getLabel().size()) { std::cout << indent.c_str() << "ErrorWidget label: " << widget->getLabel().c_str() << std::endl; } } void ControllerUtil::printConstraintList(const std::vector& constraintList, PropertyType propertyType, qcc::String const& indent) { for (size_t i = 0; i < constraintList.size(); i++) { std::cout << indent.c_str() << "ConstraintList " << i << " Display: " << constraintList[i].getDisplay().c_str() << std::endl; switch (propertyType) { case UINT16_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().uint16Value << std::endl; break; case INT16_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().int16Value << std::endl; break; case UINT32_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().uint32Value << std::endl; break; case INT32_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().int32Value << std::endl; break; case UINT64_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().uint64Value << std::endl; break; case INT64_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().int64Value << std::endl; break; case DOUBLE_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().doubleValue << std::endl; break; case STRING_PROPERTY: std::cout << indent.c_str() << "ConstraintList " << i << " Value: " << constraintList[i].getConstraintValue().charValue << std::endl; break; default: std::cout << indent.c_str() << "ConstraintList is unknown property type" << std::endl; break; } } } void ControllerUtil::printConstraintRange(ConstraintRange* constraintRange, PropertyType propertyType, qcc::String const& indent) { switch (propertyType) { case UINT16_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().uint16Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().uint16Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().uint16Value << std::endl; break; case INT16_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().int16Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().int16Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().int16Value << std::endl; break; case UINT32_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().uint32Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().uint32Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().uint32Value << std::endl; break; case INT32_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().int32Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().int32Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().int32Value << std::endl; break; case UINT64_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().uint64Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().uint64Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().uint64Value << std::endl; break; case INT64_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().int64Value << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().int64Value << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().int64Value << std::endl; break; case DOUBLE_PROPERTY: std::cout << indent.c_str() << "ConstraintRange MinValue: " << constraintRange->getMinValue().doubleValue << std::endl; std::cout << indent.c_str() << "ConstraintRange MaxValue: " << constraintRange->getMaxValue().doubleValue << std::endl; std::cout << indent.c_str() << "ConstraintRange IncrementValue: " << constraintRange->getIncrementValue().doubleValue << std::endl; break; default: std::cout << indent.c_str() << "ConstraintRange is unknown property type" << std::endl; break; } } void ControllerUtil::printPropertyValue(PropertyValue propertyValue, PropertyType propertyType, qcc::String const& indent) { switch (propertyType) { case UINT16_PROPERTY: std::cout << indent.c_str() << "Property is a UINT16 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.uint16Value << std::endl; break; case INT16_PROPERTY: std::cout << indent.c_str() << "Property is a INT16 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.int16Value << std::endl; break; case UINT32_PROPERTY: std::cout << indent.c_str() << "Property is a UINT32 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.uint32Value << std::endl; break; case INT32_PROPERTY: std::cout << indent.c_str() << "Property is a INT32 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.int32Value << std::endl; break; case UINT64_PROPERTY: std::cout << indent.c_str() << "Property is a UINT64 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.uint64Value << std::endl; break; case INT64_PROPERTY: std::cout << indent.c_str() << "Property is a INT64 Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.int64Value << std::endl; break; case DOUBLE_PROPERTY: std::cout << indent.c_str() << "Property is a DOUBLE Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.doubleValue << std::endl; break; case STRING_PROPERTY: std::cout << indent.c_str() << "Property is a STRING Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.charValue << std::endl; break; case BOOL_PROPERTY: std::cout << indent.c_str() << "Property is a BOOL Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << (propertyValue.boolValue ? "true" : "false") << std::endl; break; case DATE_PROPERTY: std::cout << indent.c_str() << "Property is a Date Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.dateValue->getDay() << "/" << propertyValue.dateValue->getMonth() << "/" << propertyValue.dateValue->getYear() << std::endl; break; case TIME_PROPERTY: std::cout << indent.c_str() << "Property is a Time Property." << std::endl; std::cout << indent.c_str() << "Property Value: " << propertyValue.timeValue->getHour() << ":" << propertyValue.timeValue->getMinute() << ":" << propertyValue.timeValue->getSecond() << std::endl; break; default: std::cout << indent.c_str() << "Property is unknown property type" << std::endl; break; } } void ControllerUtil::executeActions(std::vector& actionsToExecute) { for (size_t i = 0; i < actionsToExecute.size(); i++) { std::cout << "Execute Action for " << actionsToExecute[i]->getWidgetName().c_str() << std::endl; QStatus status = actionsToExecute[i]->executeAction(); std::cout << " Action execution " << (status == ER_OK ? "succeeded" : "failed") << std::endl; } } void ControllerUtil::executeDialogActions(std::vector& dialogsToExecute) { for (size_t i = 0; i < dialogsToExecute.size(); i++) { std::cout << "Execute Actions for " << dialogsToExecute[i]->getWidgetName().c_str() << " which has " << dialogsToExecute[i]->getNumActions() << " actions: " << std::endl; QStatus status = dialogsToExecute[i]->executeAction1(); std::cout << " Action 1 execution " << (status == ER_OK ? "succeeded" : "failed") << std::endl; status = dialogsToExecute[i]->executeAction2(); std::cout << " Action 2 execution " << (status == ER_OK ? "succeeded" : "failed") << std::endl; status = dialogsToExecute[i]->executeAction3(); std::cout << " Action 3 execution " << (status == ER_OK ? "succeeded" : "failed") << std::endl; } } void ControllerUtil::setPropertyValues(std::vector& propertiesToChange) { for (size_t i = 0; i < propertiesToChange.size(); i++) { std::cout << "Setting Value for Property " << propertiesToChange[i]->getWidgetName().c_str() << std::endl; QStatus status = ER_OK; switch (propertiesToChange[i]->getPropertyType()) { case UINT16_PROPERTY: std::cout << " Setting Value to " << 130 << std::endl; status = propertiesToChange[i]->setValue((uint16_t)130); break; case INT16_PROPERTY: std::cout << " Setting Value to " << 140 << std::endl; status = propertiesToChange[i]->setValue((int16_t)140); break; case UINT32_PROPERTY: std::cout << " Setting Value to " << 150 << std::endl; status = propertiesToChange[i]->setValue((uint32_t)150); break; case INT32_PROPERTY: std::cout << " Setting Value to " << 160 << std::endl; status = propertiesToChange[i]->setValue((int32_t)160); break; case UINT64_PROPERTY: std::cout << " Setting Value to " << 170 << std::endl; status = propertiesToChange[i]->setValue((uint64_t)170); break; case INT64_PROPERTY: std::cout << " Setting Value to " << 180 << std::endl; status = propertiesToChange[i]->setValue((int64_t)180); break; case DOUBLE_PROPERTY: std::cout << " Setting Value to " << 190 << std::endl; status = propertiesToChange[i]->setValue((double)190); break; case STRING_PROPERTY: std::cout << " Setting Value to 'TestingValue'" << std::endl; status = propertiesToChange[i]->setValue("TestingValue"); break; case BOOL_PROPERTY: std::cout << " Setting Value to true" << std::endl; status = propertiesToChange[i]->setValue(true); break; case DATE_PROPERTY: { std::cout << " Setting Value to 22/6/1892" << std::endl; CPSDate date(22, 6, 1892); status = propertiesToChange[i]->setValue(date); break; } case TIME_PROPERTY: { std::cout << " Setting Value to 12:10:30" << std::endl; CPSTime time(12, 10, 30); status = propertiesToChange[i]->setValue(time); break; } case UNDEFINED: { status = ER_NOT_IMPLEMENTED; break; } } std::cout << " Set Value " << (status == ER_OK ? "succeeded" : "failed") << std::endl; } } void ControllerUtil::printHints(ajn::services::Widget* widget, qcc::String const& widgetType, qcc::String const& indent) { std::vector hints = widget->getHints(); if (hints.size()) { std::cout << indent.c_str() << widgetType.c_str() << " hints: "; for (size_t i = 0; i < hints.size(); i++) { switch (widget->getWidgetType()) { case WIDGET_TYPE_ACTION: case WIDGET_TYPE_ACTION_WITH_DIALOG: if (hints[i] == ACTIONBUTTON) { std::cout << "ACTIONBUTTON"; } else { std::cout << "UNKNOWN"; } break; case WIDGET_TYPE_LABEL: if (hints[i] == TEXTLABEL) { std::cout << "TEXTLABEL"; } else { std::cout << "UNKNOWN"; } break; case WIDGET_TYPE_PROPERTY: if (hints[i] > 0 && hints[i] < PROPERTY_HINTS_SIZE) { std::cout << PROPERTY_HINTS_STRINGS[hints[i]].c_str(); } else { std::cout << "UNKNOWN"; } break; case WIDGET_TYPE_CONTAINER: if (hints[i] == VERTICAL_LINEAR) { std::cout << "VERTICAL_LINEAR"; } else if (hints[i] == HORIZONTAL_LINEAR) { std::cout << "HORIZONTAL_LINEAR"; } else { std::cout << "UNKNOWN"; } break; case WIDGET_TYPE_DIALOG: if (hints[i] == ALERTDIALOG) { std::cout << "ALERTDIALOG"; } else { std::cout << "UNKNOWN"; } break; case WIDGET_TYPE_ERROR: std::cout << "UNKNOWN"; break; } std::cout << (i == hints.size() - 1 ? "\n" : ", "); } } } base-16.04/controlpanel/cpp/samples/ControlPanelController/ControllerUtil.h000066400000000000000000000063421272147170000271700ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLLERUTIL_H_ #define CONTROLLERUTIL_H_ #include #include #include #include #define PROPERTY_HINTS_SIZE 14 /** * Class used to simulate accessing of widgets, executing actions setting properties etc */ class ControllerUtil { public: ControllerUtil(); virtual ~ControllerUtil(); static void printRootWidget(ajn::services::RootWidget* rootWidget); static void printPropertyValue(ajn::services::PropertyValue propertyValue, ajn::services::PropertyType propertyType, qcc::String const& indent = " "); private: static void printErrorWidget(ajn::services::Widget* widget, qcc::String const& indent); static void printBasicWidget(ajn::services::Widget* widget, qcc::String const& widgetType, qcc::String const& indent); static void printContainer(ajn::services::Container* rootContainer, std::vector& actionsToExecute, std::vector& dialogsToExecute, std::vector& propertiesToChange, qcc::String const& indent = ""); static void printProperty(ajn::services::Property* property, qcc::String const& indent); static void printDialog(ajn::services::Dialog* dialog, qcc::String const& indent); static void printConstraintRange(ajn::services::ConstraintRange* constraintRange, ajn::services::PropertyType propertyType, qcc::String const& indent); static void printConstraintList(const std::vector& constraintList, ajn::services::PropertyType propertyType, qcc::String const& indent); static void executeActions(std::vector& actionsToExecute); static void executeDialogActions(std::vector& dialogsToExecute); static void setPropertyValues(std::vector& propertiesToChange); static void printHints(ajn::services::Widget* widget, qcc::String const& widgetType, qcc::String const& indent); static qcc::String PROPERTY_HINTS_STRINGS[PROPERTY_HINTS_SIZE]; }; #endif /* CONTROLLERUTIL_H_ */ base-16.04/controlpanel/cpp/samples/ControlPanelController/SConscript000066400000000000000000000017011272147170000260420ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) prog = env.Program('ControlPanelController', objs) Return('prog') base-16.04/controlpanel/cpp/samples/ControlPanelProducer/000077500000000000000000000000001272147170000234715ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/ControlPanelProducer/ControlPanelProducer.cc000066400000000000000000000177401272147170000301150ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include #include #include #include #include #include #include #define SERVICE_PORT 900 using namespace ajn; using namespace services; using namespace qcc; AboutData* aboutData = NULL; AboutObj* aboutObj = NULL; CommonBusListener* controlpanelBusListener = 0; BusAttachment* bus = 0; ControlPanelService* controlPanelService = 0; ControlPanelControllee* controlPanelControllee = 0; DefaultECDHEAuthListener* authListener = 0; NotificationService* prodService = 0; NotificationSender* sender = 0; static volatile sig_atomic_t s_interrupt = false; static volatile sig_atomic_t s_restart = false; static void CDECL_CALL SigIntHandler(int sig) { QCC_UNUSED(sig); s_interrupt = true; } static void daemonDisconnectCB() { s_restart = true; } void cleanup() { CommonSampleUtil::aboutServiceDestroy(bus, controlpanelBusListener); if (controlPanelService) { controlPanelService->shutdownControllee(); } if (prodService) { prodService->shutdown(); prodService = NULL; } ControlPanelGenerated::Shutdown(); if (sender) { delete sender; sender = NULL; } if (controlPanelControllee) { delete controlPanelControllee; controlPanelControllee = NULL; } if (controlpanelBusListener) { delete controlpanelBusListener; controlpanelBusListener = NULL; } if (aboutData) { delete aboutData; aboutData = NULL; } if (aboutObj) { delete aboutObj; aboutObj = NULL; } if (controlPanelService) { delete controlPanelService; controlPanelService = NULL; } if (authListener) { delete authListener; authListener = NULL; } if (bus) { delete bus; bus = NULL; } } int main() { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } QStatus status; // Allow CTRL+C to end application signal(SIGINT, SigIntHandler); std::cout << "Beginning ControlPanel Application. (Press CTRL+C and enter or CTRL+D to end application)" << std::endl; // Initialize Service objects start: controlPanelService = ControlPanelService::getInstance(); QCC_SetDebugLevel(logModules::CONTROLPANEL_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); // Initialize Service object and Sender Object prodService = NotificationService::getInstance(); authListener = new DefaultECDHEAuthListener(); const char *password = "000000"; authListener->SetPassword((const uint8_t*)password, strlen(password)); /* Connect to the daemon */ uint16_t retry = 0; do { bus = CommonSampleUtil::prepareBusAttachment(authListener); if (bus == NULL) { std::cout << "Could not initialize BusAttachment. Retrying" << std::endl; #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif retry++; } } while (bus == NULL && retry != 180 && !s_interrupt); if (bus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; cleanup(); return 1; } controlpanelBusListener = new CommonBusListener(bus, daemonDisconnectCB); qcc::String device_id, app_id; qcc::String app_name = "testappName"; DeviceNamesType deviceNames; deviceNames.insert(std::pair("en", "testDeviceName")); GuidUtil::GetInstance()->GetDeviceIdString(&device_id); GuidUtil::GetInstance()->GenerateGUID(&app_id); aboutData = new AboutData("en"); status = CommonSampleUtil::fillAboutData(aboutData, app_id, app_name, device_id, deviceNames); if (status != ER_OK) { std::cout << "Could not fill About Data." << std::endl; cleanup(); return 1; } aboutObj = new AboutObj(*bus, BusObject::ANNOUNCED); status = CommonSampleUtil::prepareAboutService(bus, aboutData, aboutObj, controlpanelBusListener, SERVICE_PORT); if (status != ER_OK) { std::cout << "Could not register bus object." << std::endl; cleanup(); return 1; } status = ControlPanelGenerated::PrepareWidgets(controlPanelControllee); if (status != ER_OK) { std::cout << "Could not prepare Widgets." << std::endl; cleanup(); return 1; } status = controlPanelService->initControllee(bus, controlPanelControllee); if (status != ER_OK) { std::cout << "Could not initialize Controllee." << std::endl; cleanup(); return 1; } sender = prodService->initSend(bus, aboutData); if (!sender) { std::cout << "Could not initialize Sender - exiting application" << std::endl; cleanup(); return 1; } status = CommonSampleUtil::aboutServiceAnnounce(); if (status != ER_OK) { std::cout << "Could not announce." << std::endl; cleanup(); return 1; } std::cout << "Sent announce, waiting for Contollers" << std::endl; std::cout << "Enter in the ControlPanelService object path or press 'enter' to use default:" << std::endl; std::string input; qcc::String controlPanelServiceObjectPath; qcc::String defaultControlPanelServiceObjectPath = "/ControlPanel/MyDevice/areYouSure"; getline(std::cin, input); while (s_interrupt == false && s_restart == false && !std::cin.eof()) { controlPanelServiceObjectPath = input.length() ? input.c_str() : defaultControlPanelServiceObjectPath; NotificationMessageType messageType = INFO; NotificationText textToSend("en", "Sending CPS ObjectPath"); std::vector vecMessages; vecMessages.push_back(textToSend); Notification notification(messageType, vecMessages); notification.setControlPanelServiceObjectPath(controlPanelServiceObjectPath.c_str()); status = sender->send(notification, 7200); if (status != ER_OK) { std::cout << "Notification was not sent successfully" << std::endl; } else { std::cout << "Notification sent successfully" << std::endl; } std::cout << "Enter in the ControlPanelService object path or press 'enter' to use default:" << std::endl; getline(std::cin, input); } std::cout << "Cleaning up in 10 seconds" << std::endl; #ifdef _WIN32 Sleep(10 * 1000); #else sleep(10); #endif if (s_restart) { s_restart = false; goto start; } return 0; } base-16.04/controlpanel/cpp/samples/ControlPanelProducer/SConscript000066400000000000000000000020111272147170000254750ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs', 'genobjs', 'providedobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) objs.extend(genobjs) objs.extend(providedobjs) prog = env.Program('ControlPanelProducer', objs) Return('prog') base-16.04/controlpanel/cpp/samples/ControlPanelSample/000077500000000000000000000000001272147170000231275ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/ControlPanelSample/ControlPanelSample.cc000066400000000000000000000141111272147170000271760ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include #include #include #define SERVICE_PORT 900 using namespace ajn; using namespace services; using namespace qcc; AboutData* aboutData = NULL; AboutObj* aboutObj = NULL; CommonBusListener* controlpanelBusListener = 0; BusAttachment* bus = 0; ControlPanelService* controlPanelService = 0; ControlPanelControllee* controlPanelControllee = 0; DefaultECDHEAuthListener* authListener = 0; static volatile sig_atomic_t s_interrupt = false; static volatile sig_atomic_t s_restart = false; static void CDECL_CALL SigIntHandler(int sig) { QCC_UNUSED(sig); s_interrupt = true; } static void daemonDisconnectCB() { s_restart = true; } void cleanup() { CommonSampleUtil::aboutServiceDestroy(bus, controlpanelBusListener); if (controlPanelService) { controlPanelService->shutdownControllee(); } ControlPanelGenerated::Shutdown(); if (controlPanelControllee) { delete controlPanelControllee; controlPanelControllee = NULL; } if (controlpanelBusListener) { delete controlpanelBusListener; controlpanelBusListener = NULL; } if (controlPanelService) { delete controlPanelService; controlPanelService = NULL; } if (authListener) { delete authListener; authListener = NULL; } if (aboutData) { delete aboutData; aboutData = NULL; } if (aboutObj) { delete aboutObj; aboutObj = NULL; } if (bus) { delete bus; bus = NULL; } } void WaitForSigInt(void) { while (s_interrupt == false && s_restart == false) { #ifdef _WIN32 Sleep(100); #else usleep(100 * 1000); #endif } } int main() { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } QStatus status; // Allow CTRL+C to end application signal(SIGINT, SigIntHandler); std::cout << "Beginning ControlPanel Application. (Press CTRL+C to end application)" << std::endl; // Initialize Service objects start: controlPanelService = ControlPanelService::getInstance(); QCC_SetDebugLevel(logModules::CONTROLPANEL_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); authListener = new DefaultECDHEAuthListener(); const char *password = "000000"; authListener->SetPassword((const uint8_t*)password, strlen(password)); /* Connect to the daemon */ uint16_t retry = 0; do { bus = CommonSampleUtil::prepareBusAttachment(authListener); if (bus == NULL) { std::cout << "Could not initialize BusAttachment. Retrying" << std::endl; #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif retry++; } } while (bus == NULL && retry != 180 && !s_interrupt); if (bus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; cleanup(); return 1; } controlpanelBusListener = new CommonBusListener(bus, daemonDisconnectCB); qcc::String device_id, app_id; qcc::String app_name = "testappName"; DeviceNamesType deviceNames; deviceNames.insert(std::pair("en", "testDeviceName")); GuidUtil::GetInstance()->GetDeviceIdString(&device_id); GuidUtil::GetInstance()->GenerateGUID(&app_id); aboutData = new AboutData("en"); status = CommonSampleUtil::fillAboutData(aboutData, app_id, app_name, device_id, deviceNames); if (status != ER_OK) { std::cout << "Could not fill About Data." << std::endl; cleanup(); return 1; } aboutObj = new AboutObj(*bus, BusObject::ANNOUNCED); status = CommonSampleUtil::prepareAboutService(bus, aboutData, aboutObj, controlpanelBusListener, SERVICE_PORT); if (status != ER_OK) { std::cout << "Could not register bus object." << std::endl; cleanup(); return 1; } status = ControlPanelGenerated::PrepareWidgets(controlPanelControllee); if (status != ER_OK) { std::cout << "Could not prepare Widgets." << std::endl; cleanup(); return 1; } status = controlPanelService->initControllee(bus, controlPanelControllee); if (status != ER_OK) { std::cout << "Could not initialize Controllee." << std::endl; cleanup(); return 1; } status = CommonSampleUtil::aboutServiceAnnounce(); if (status != ER_OK) { std::cout << "Could not announce." << std::endl; cleanup(); return 1; } std::cout << "Sent announce, waiting for Contollers" << std::endl; WaitForSigInt(); cleanup(); if (s_restart) { s_restart = false; goto start; } return 0; } base-16.04/controlpanel/cpp/samples/ControlPanelSample/SConscript000066400000000000000000000020071272147170000251400ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs', 'genobjs', 'providedobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) objs.extend(genobjs) objs.extend(providedobjs) prog = env.Program('ControlPanelSample', objs) Return('prog') base-16.04/controlpanel/cpp/samples/SConscript000066400000000000000000000050101272147170000213730ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('cpsenv') samples_env = cpsenv.Clone() samples_env.Append(CPPPATH = samples_env.Dir('generated').srcnode()) samples_env.Append(CPPPATH = samples_env.Dir('provided').srcnode()) samples_env.Append(CPPPATH = samples_env.Dir('$APP_COMMON_DIR/cpp/samples_common').srcnode()) #samples_env.Append(CPPDEFINES = 'USE_SAMPLE_LOGGER') samples_env.Prepend(LIBS = ['alljoyn_controlpanel', 'alljoyn_about', 'alljoyn_services_common']) if samples_env['BR'] == 'on' and samples_env.has_key('ajrlib'): # Build apps with bundled daemon support samples_env.Prepend(LIBS = [samples_env['ajrlib']]) samples_env.VariantDir('AppCommon', '$APP_COMMON_DIR/cpp/samples_common/', duplicate = 0) cobjs = samples_env.SConscript('AppCommon/SConscript', {'env': samples_env}) genobjs = samples_env.SConscript('generated/SConscript', {'env': samples_env}) providedobjs = samples_env.SConscript('provided/SConscript', {'env': samples_env}) ############ Samples without Notification ############ # Sample programs sample_dirs = [ 'ControlPanelSample' ] exports = { 'env': samples_env, 'cobjs': cobjs, 'genobjs' : genobjs, 'providedobjs' : providedobjs } progs = [ samples_env.SConscript('%s/SConscript' % sampleapp, exports = exports) for sampleapp in sample_dirs ] ############ Samples with Notification ############ samples_env2 = samples_env.Clone() sample_dirs_with_notification = [ 'ControlPanelProducer', 'ControlPanelController' ] samples_env2.Prepend(LIBS = ['alljoyn_notification']) exports = { 'env': samples_env2, 'cobjs': cobjs, 'genobjs' : genobjs, 'providedobjs' : providedobjs } progs.append([ samples_env2.SConscript('%s/SConscript' % sampleapp, exports = exports) for sampleapp in sample_dirs_with_notification ]) Return('progs') base-16.04/controlpanel/cpp/samples/generated/000077500000000000000000000000001272147170000213235ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/generated/ControlPanelGenerated.cc000066400000000000000000000332001272147170000260470ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "ControlPanelGenerated.h" #include #include #include "ControlPanelProvided.h" using namespace ajn; using namespace services; bool ControlPanelGenerated::languageSetsDone = false; ControlPanelControlleeUnit* ControlPanelGenerated::myDeviceUnit = 0; ControlPanel* ControlPanelGenerated::myDeviceRootContainerControlPanel = 0; Container* ControlPanelGenerated::myDeviceRootContainer = 0; Label* ControlPanelGenerated::myDeviceCurrentTemp = 0; MyDeviceHeatProperty* ControlPanelGenerated::myDeviceHeatProperty = 0; MyDeviceOvenAction* ControlPanelGenerated::myDeviceOvenAction = 0; ActionWithDialog* ControlPanelGenerated::myDeviceLightAction = 0; MyDeviceLightConfirm* ControlPanelGenerated::myDeviceLightConfirm = 0; NotificationAction* ControlPanelGenerated::myDeviceAreYouSureNotificationAction = 0; MyDeviceAreYouSure* ControlPanelGenerated::myDeviceAreYouSure = 0; #define CHECK(x) if ((status = x) != ER_OK) { return status; } void ControlPanelGenerated::PrepareLanguageSets() { if (languageSetsDone) { return; } LanguageSet myDeviceMyLanguages("myDeviceMyLanguages"); myDeviceMyLanguages.addLanguage("en"); myDeviceMyLanguages.addLanguage("de_AT"); myDeviceMyLanguages.addLanguage("zh_Hans_CN"); LanguageSets::add(myDeviceMyLanguages.getLanguageSetName(), myDeviceMyLanguages); languageSetsDone = true; } QStatus ControlPanelGenerated::PrepareWidgets(ControlPanelControllee*& controlPanelControllee) { if (controlPanelControllee) { return ER_BAD_ARG_1; } PrepareLanguageSets(); QStatus status = ER_OK; controlPanelControllee = new ControlPanelControllee(); myDeviceUnit = new ControlPanelControlleeUnit("MyDevice"); CHECK(controlPanelControllee->addControlPanelUnit(myDeviceUnit)); myDeviceRootContainerControlPanel = ControlPanel::createControlPanel(LanguageSets::get("myDeviceMyLanguages")); if (!myDeviceRootContainerControlPanel) { return ER_FAIL; } CHECK(myDeviceUnit->addControlPanel(myDeviceRootContainerControlPanel)); myDeviceRootContainer = new Container("rootContainer", NULL); CHECK(myDeviceRootContainerControlPanel->setRootWidget(myDeviceRootContainer)); myDeviceRootContainer->setEnabled(true); myDeviceRootContainer->setIsSecured(false); myDeviceRootContainer->setBgColor(0x200); std::vector myDeviceRootContainerlabelVec; myDeviceRootContainerlabelVec.push_back("My Label of my container"); myDeviceRootContainerlabelVec.push_back("Container Etikett"); myDeviceRootContainerlabelVec.push_back(UNICODE_MY_LABEL_CONTAINER); myDeviceRootContainer->setLabels(myDeviceRootContainerlabelVec); std::vector myDeviceRootContainerHintsVec; myDeviceRootContainerHintsVec.push_back(VERTICAL_LINEAR); myDeviceRootContainerHintsVec.push_back(HORIZONTAL_LINEAR); myDeviceRootContainer->setHints(myDeviceRootContainerHintsVec); myDeviceCurrentTemp = new Label("CurrentTemp", myDeviceRootContainer); CHECK(myDeviceRootContainer->addChildWidget(myDeviceCurrentTemp)); myDeviceCurrentTemp->setEnabled(true); myDeviceCurrentTemp->setBgColor(0x98765); std::vector myDeviceCurrentTemplabelVec; myDeviceCurrentTemplabelVec.push_back("Current Temperature:"); myDeviceCurrentTemplabelVec.push_back("Aktuelle Temperatur:"); myDeviceCurrentTemplabelVec.push_back(UNICODE_CURENT_TEMPERATURE); myDeviceCurrentTemp->setLabels(myDeviceCurrentTemplabelVec); std::vector myDeviceCurrentTempHintsVec; myDeviceCurrentTempHintsVec.push_back(TEXTLABEL); myDeviceCurrentTemp->setHints(myDeviceCurrentTempHintsVec); myDeviceHeatProperty = new MyDeviceHeatProperty("heatProperty", myDeviceRootContainer, UINT16_PROPERTY); CHECK(myDeviceRootContainer->addChildWidget(myDeviceHeatProperty)); myDeviceHeatProperty->setEnabled(true); myDeviceHeatProperty->setIsSecured(false); myDeviceHeatProperty->setWritable(true); CHECK(myDeviceHeatProperty->setGetValue(getuint16Var)); myDeviceHeatProperty->setBgColor(0x500); std::vector myDeviceHeatPropertylabelVec; myDeviceHeatPropertylabelVec.push_back("Oven Temperature"); myDeviceHeatPropertylabelVec.push_back("Ofentemperatur"); myDeviceHeatPropertylabelVec.push_back(UNICODE_OVEN_TEMPERATURE); myDeviceHeatProperty->setLabels(myDeviceHeatPropertylabelVec); std::vector myDeviceHeatPropertyHintsVec; myDeviceHeatPropertyHintsVec.push_back(SPINNER); myDeviceHeatProperty->setHints(myDeviceHeatPropertyHintsVec); std::vector myDeviceHeatPropertyunitMeasureVec; myDeviceHeatPropertyunitMeasureVec.push_back("Degrees"); myDeviceHeatPropertyunitMeasureVec.push_back("Grad"); myDeviceHeatPropertyunitMeasureVec.push_back(UNICODE_DEGREES); myDeviceHeatProperty->setUnitOfMeasures(myDeviceHeatPropertyunitMeasureVec); std::vector myDeviceHeatPropertyConstraintListVec(3); std::vector myDeviceHeatPropertyDisplay1Vec; myDeviceHeatPropertyDisplay1Vec.push_back("Regular"); myDeviceHeatPropertyDisplay1Vec.push_back("Normal"); myDeviceHeatPropertyDisplay1Vec.push_back(UNICODE_REGULAR); myDeviceHeatPropertyConstraintListVec[0].setDisplays(myDeviceHeatPropertyDisplay1Vec); myDeviceHeatPropertyConstraintListVec[0].setConstraintValue((uint16_t)175); std::vector myDeviceHeatPropertyDisplay2Vec; myDeviceHeatPropertyDisplay2Vec.push_back("Hot"); myDeviceHeatPropertyDisplay2Vec.push_back("Heiss"); myDeviceHeatPropertyDisplay2Vec.push_back(UNICODE_HOT); myDeviceHeatPropertyConstraintListVec[1].setDisplays(myDeviceHeatPropertyDisplay2Vec); myDeviceHeatPropertyConstraintListVec[1].setConstraintValue((uint16_t)200); std::vector myDeviceHeatPropertyDisplay3Vec; myDeviceHeatPropertyDisplay3Vec.push_back("Very Hot"); myDeviceHeatPropertyDisplay3Vec.push_back("Sehr Heiss"); myDeviceHeatPropertyDisplay3Vec.push_back(UNICODE_VERY_HOT); myDeviceHeatPropertyConstraintListVec[2].setDisplays(myDeviceHeatPropertyDisplay3Vec); myDeviceHeatPropertyConstraintListVec[2].setConstraintValue((uint16_t)225); myDeviceHeatProperty->setConstraintList(myDeviceHeatPropertyConstraintListVec); myDeviceOvenAction = new MyDeviceOvenAction("ovenAction", myDeviceRootContainer); CHECK(myDeviceRootContainer->addChildWidget(myDeviceOvenAction)); myDeviceOvenAction->setEnabled(true); myDeviceOvenAction->setIsSecured(false); myDeviceOvenAction->setBgColor(0x400); std::vector myDeviceOvenActionlabelVec; myDeviceOvenActionlabelVec.push_back("Start Oven"); myDeviceOvenActionlabelVec.push_back("Ofen started"); myDeviceOvenActionlabelVec.push_back(UNICODE_START_OVEN); myDeviceOvenAction->setLabels(myDeviceOvenActionlabelVec); std::vector myDeviceOvenActionHintsVec; myDeviceOvenActionHintsVec.push_back(ACTIONBUTTON); myDeviceOvenAction->setHints(myDeviceOvenActionHintsVec); myDeviceLightAction = new ActionWithDialog("lightAction", myDeviceRootContainer); CHECK(myDeviceRootContainer->addChildWidget(myDeviceLightAction)); myDeviceLightAction->setEnabled(true); myDeviceLightAction->setIsSecured(false); myDeviceLightAction->setBgColor(0x400); std::vector myDeviceLightActionlabelVec; myDeviceLightActionlabelVec.push_back("Turn on oven light"); myDeviceLightActionlabelVec.push_back("Ofenlicht anschalten"); myDeviceLightActionlabelVec.push_back(UNICODE_TURN_ON_OVEN_LIGHT); myDeviceLightAction->setLabels(myDeviceLightActionlabelVec); std::vector myDeviceLightActionHintsVec; myDeviceLightActionHintsVec.push_back(ACTIONBUTTON); myDeviceLightAction->setHints(myDeviceLightActionHintsVec); myDeviceLightConfirm = new MyDeviceLightConfirm("LightConfirm", NULL); CHECK(myDeviceLightAction->addChildDialog(myDeviceLightConfirm)); myDeviceLightConfirm->setEnabled(true); myDeviceLightConfirm->setIsSecured(false); std::vector myDeviceLightConfirmmessageVec; myDeviceLightConfirmmessageVec.push_back("Are you sure you want to turn on the light"); myDeviceLightConfirmmessageVec.push_back("Are you sure you want to turn on the light"); myDeviceLightConfirmmessageVec.push_back(UNICODE_ARE_YOU_SURE_YOU_WANT_TO_TURN_OFF_THE_LIGHT); myDeviceLightConfirm->setMessages(myDeviceLightConfirmmessageVec); myDeviceLightConfirm->setNumActions(3); myDeviceLightConfirm->setBgColor(0x789); std::vector myDeviceLightConfirmlabelVec; myDeviceLightConfirmlabelVec.push_back("Are you sure?"); myDeviceLightConfirmlabelVec.push_back("Sind sie sicher?"); myDeviceLightConfirmlabelVec.push_back(UNICODE_ARE_YOU_SURE); myDeviceLightConfirm->setLabels(myDeviceLightConfirmlabelVec); std::vector myDeviceLightConfirmHintsVec; myDeviceLightConfirmHintsVec.push_back(ALERTDIALOG); myDeviceLightConfirm->setHints(myDeviceLightConfirmHintsVec); std::vector myDeviceLightConfirmLabelAction1Vec; myDeviceLightConfirmLabelAction1Vec.push_back("Yes"); myDeviceLightConfirmLabelAction1Vec.push_back("Ja"); myDeviceLightConfirmLabelAction1Vec.push_back(UNICODE_YES); myDeviceLightConfirm->setLabelsAction1(myDeviceLightConfirmLabelAction1Vec); std::vector myDeviceLightConfirmLabelAction2Vec; myDeviceLightConfirmLabelAction2Vec.push_back("No"); myDeviceLightConfirmLabelAction2Vec.push_back("Nein"); myDeviceLightConfirmLabelAction2Vec.push_back(UNICODE_NO); myDeviceLightConfirm->setLabelsAction2(myDeviceLightConfirmLabelAction2Vec); std::vector myDeviceLightConfirmLabelAction3Vec; myDeviceLightConfirmLabelAction3Vec.push_back("Cancel"); myDeviceLightConfirmLabelAction3Vec.push_back("Abrechen"); myDeviceLightConfirmLabelAction3Vec.push_back(UNICODE_CANCEL); myDeviceLightConfirm->setLabelsAction3(myDeviceLightConfirmLabelAction3Vec); myDeviceAreYouSureNotificationAction = NotificationAction::createNotificationAction(LanguageSets::get("myDeviceMyLanguages")); if (!myDeviceAreYouSureNotificationAction) { return ER_FAIL; } CHECK(myDeviceUnit->addNotificationAction(myDeviceAreYouSureNotificationAction)); myDeviceAreYouSure = new MyDeviceAreYouSure("areYouSure", NULL); CHECK(myDeviceAreYouSureNotificationAction->setRootWidget(myDeviceAreYouSure)); myDeviceAreYouSure->setEnabled(true); myDeviceAreYouSure->setIsSecured(false); std::vector myDeviceAreYouSuremessageVec; myDeviceAreYouSuremessageVec.push_back("Are you sure?"); myDeviceAreYouSuremessageVec.push_back("Sind sie sicher?"); myDeviceAreYouSuremessageVec.push_back(UNICODE_ARE_YOU_SURE); myDeviceAreYouSure->setMessages(myDeviceAreYouSuremessageVec); myDeviceAreYouSure->setNumActions(1); myDeviceAreYouSure->setBgColor(0x789); std::vector myDeviceAreYouSurelabelVec; myDeviceAreYouSurelabelVec.push_back("Are you sure?"); myDeviceAreYouSurelabelVec.push_back("Sind sie sicher?"); myDeviceAreYouSurelabelVec.push_back(UNICODE_ARE_YOU_SURE); myDeviceAreYouSure->setLabels(myDeviceAreYouSurelabelVec); std::vector myDeviceAreYouSureLabelAction1Vec; myDeviceAreYouSureLabelAction1Vec.push_back("Yes"); myDeviceAreYouSureLabelAction1Vec.push_back("Ja"); myDeviceAreYouSureLabelAction1Vec.push_back(UNICODE_YES); myDeviceAreYouSure->setLabelsAction1(myDeviceAreYouSureLabelAction1Vec); return status; } void ControlPanelGenerated::Shutdown() { if (myDeviceUnit) { delete (myDeviceUnit); myDeviceUnit = 0; } if (myDeviceRootContainerControlPanel) { delete (myDeviceRootContainerControlPanel); myDeviceRootContainerControlPanel = 0; } if (myDeviceRootContainer) { delete (myDeviceRootContainer); myDeviceRootContainer = 0; } if (myDeviceCurrentTemp) { delete (myDeviceCurrentTemp); myDeviceCurrentTemp = 0; } if (myDeviceHeatProperty) { delete (myDeviceHeatProperty); myDeviceHeatProperty = 0; } if (myDeviceOvenAction) { delete (myDeviceOvenAction); myDeviceOvenAction = 0; } if (myDeviceLightAction) { delete (myDeviceLightAction); myDeviceLightAction = 0; } if (myDeviceLightConfirm) { delete (myDeviceLightConfirm); myDeviceLightConfirm = 0; } if (myDeviceAreYouSureNotificationAction) { delete (myDeviceAreYouSureNotificationAction); myDeviceAreYouSureNotificationAction = 0; } if (myDeviceAreYouSure) { delete (myDeviceAreYouSure); myDeviceAreYouSure = 0; } } base-16.04/controlpanel/cpp/samples/generated/ControlPanelGenerated.h000066400000000000000000000046151272147170000257210ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELGENERATED_H_ #define CONTROLPANELGENERATED_H_ #include #include #include #include #include "../generated/MyDeviceHeatProperty.h" #include "../generated/MyDeviceOvenAction.h" #include "../generated/MyDeviceLightConfirm.h" #include "../generated/MyDeviceAreYouSure.h" /** * Generated Class - do not change code */ class ControlPanelGenerated { public: static QStatus PrepareWidgets(ajn::services::ControlPanelControllee*& controlPanelControllee); static void PrepareLanguageSets(); static void Shutdown(); static bool languageSetsDone; static ajn::services::ControlPanelControlleeUnit* myDeviceUnit; static ajn::services::ControlPanel* myDeviceRootContainerControlPanel; static ajn::services::Container* myDeviceRootContainer; static ajn::services::Label* myDeviceCurrentTemp; static ajn::services::MyDeviceHeatProperty* myDeviceHeatProperty; static ajn::services::MyDeviceOvenAction* myDeviceOvenAction; static ajn::services::ActionWithDialog* myDeviceLightAction; static ajn::services::MyDeviceLightConfirm* myDeviceLightConfirm; static ajn::services::NotificationAction* myDeviceAreYouSureNotificationAction; static ajn::services::MyDeviceAreYouSure* myDeviceAreYouSure; }; #endif /* CONTROLPANELGENERATED_H_ */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceAreYouSure.cc000066400000000000000000000032771272147170000253340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "MyDeviceAreYouSure.h" #include "ControlPanelProvided.h" namespace ajn { namespace services { MyDeviceAreYouSure::MyDeviceAreYouSure(qcc::String name, Widget* rootWidget) : Dialog(name, rootWidget) { } MyDeviceAreYouSure::~MyDeviceAreYouSure() { } bool MyDeviceAreYouSure::executeAction1CallBack() { AJ_Printf("Execute Action1 was called\n"); //by default return success return true; } bool MyDeviceAreYouSure::executeAction2CallBack() { return executeActionNotDefined(); //by default return success return true; } bool MyDeviceAreYouSure::executeAction3CallBack() { return executeActionNotDefined(); //by default return success return true; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceAreYouSure.h000066400000000000000000000031471272147170000251720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef MYDEVICEAREYOUSURE_H_ #define MYDEVICEAREYOUSURE_H_ #include #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4702. unreachable code */ #pragma warning(push) #pragma warning(disable: 4702) #endif namespace ajn { namespace services { /** * Generated class */ class MyDeviceAreYouSure : public ajn::services::Dialog { public: MyDeviceAreYouSure(qcc::String name, Widget* rootWidget); virtual ~MyDeviceAreYouSure(); bool executeAction1CallBack(); bool executeAction2CallBack(); bool executeAction3CallBack(); }; } //namespace services } //namespace ajn #endif /* MYDEVICEAREYOUSURE_H_ */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceHeatProperty.cc000066400000000000000000000026511272147170000257120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "MyDeviceHeatProperty.h" #include "ControlPanelProvided.h" namespace ajn { namespace services { MyDeviceHeatProperty::MyDeviceHeatProperty(qcc::String name, Widget* rootWidget, PropertyType propertyType) : Property(name, rootWidget, propertyType) { } MyDeviceHeatProperty::~MyDeviceHeatProperty() { } QStatus MyDeviceHeatProperty::setValue(uint16_t value) { setuint16Var(value); return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceHeatProperty.h000066400000000000000000000026771272147170000255640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef MYDEVICEHEATPROPERTY_H_ #define MYDEVICEHEATPROPERTY_H_ #include namespace ajn { namespace services { /** * Generated class */ class MyDeviceHeatProperty : public ajn::services::Property { public: MyDeviceHeatProperty(qcc::String name, Widget* rootWidget, PropertyType propertyType); virtual ~MyDeviceHeatProperty(); QStatus setValue(uint16_t value); }; } //namespace services } //namespace ajn #endif /* MYDEVICEHEATPROPERTY_H_ */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceLightConfirm.cc000066400000000000000000000033411272147170000256460ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "MyDeviceLightConfirm.h" #include "ControlPanelProvided.h" namespace ajn { namespace services { MyDeviceLightConfirm::MyDeviceLightConfirm(qcc::String name, Widget* rootWidget) : Dialog(name, rootWidget) { } MyDeviceLightConfirm::~MyDeviceLightConfirm() { } bool MyDeviceLightConfirm::executeAction1CallBack() { AJ_Printf("Execute Action1 was called\n"); //by default return success return true; } bool MyDeviceLightConfirm::executeAction2CallBack() { AJ_Printf("Execute Action2 was called\n"); //by default return success return true; } bool MyDeviceLightConfirm::executeAction3CallBack() { AJ_Printf("Execute Action3 was called\n"); //by default return success return true; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceLightConfirm.h000066400000000000000000000027431272147170000255150ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef MYDEVICELIGHTCONFIRM_H_ #define MYDEVICELIGHTCONFIRM_H_ #include namespace ajn { namespace services { /** * Generated class */ class MyDeviceLightConfirm : public ajn::services::Dialog { public: MyDeviceLightConfirm(qcc::String name, Widget* rootWidget); virtual ~MyDeviceLightConfirm(); bool executeAction1CallBack(); bool executeAction2CallBack(); bool executeAction3CallBack(); }; } //namespace services } //namespace ajn #endif /* MYDEVICELIGHTCONFIRM_H_ */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceOvenAction.cc000066400000000000000000000026451272147170000253340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "MyDeviceOvenAction.h" #include "ControlPanelProvided.h" namespace ajn { namespace services { MyDeviceOvenAction::MyDeviceOvenAction(qcc::String name, Widget* rootWidget) : Action(name, rootWidget) { } MyDeviceOvenAction::~MyDeviceOvenAction() { } bool MyDeviceOvenAction::executeCallBack() { AJ_Printf("Starting the Oven. Execute was called\n"); //by default return success return true; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/samples/generated/MyDeviceOvenAction.h000066400000000000000000000026451272147170000251760ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef MYDEVICEOVENACTION_H_ #define MYDEVICEOVENACTION_H_ #include namespace ajn { namespace services { /** * Generated class - implements Action Widget */ class MyDeviceOvenAction : public ajn::services::Action { public: MyDeviceOvenAction(qcc::String name, Widget* rootWidget); virtual ~MyDeviceOvenAction(); bool executeCallBack(); }; } //namespace services } //namespace ajn #endif /* MYDEVICEOVENACTION_H_ */ base-16.04/controlpanel/cpp/samples/generated/SConscript000066400000000000000000000015611272147170000233400ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env') srcs = env.Glob('*.cc') objs = env.Object(srcs) Return('objs') base-16.04/controlpanel/cpp/samples/provided/000077500000000000000000000000001272147170000212015ustar00rootroot00000000000000base-16.04/controlpanel/cpp/samples/provided/ControlPanelProvided.cc000066400000000000000000000077651272147170000256240ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "ControlPanelProvided.h" #include static bool boolVar = false; static uint16_t uint16Var = 0; static int16_t int16Var = 0; static uint32_t uint32Var = 0; static int32_t int32Var = 0; static uint64_t uint64Var = 0; static int64_t int64Var = 0; static double doubleVar = 0; static qcc::String StringVar = "Initial String"; static qcc::String sampleString = "This is a test"; static qcc::String sampleUrlString = "www.ControlPanelTest.com"; static ajn::services::CPSDate dateVar(13, 6, 2006); static ajn::services::CPSTime timeVar(18, 30, 25); bool getboolVar() { return boolVar; } void setboolVar(bool value) { boolVar = value; } double getdoubleVar() { return doubleVar; } void setdoubleVar(double value) { doubleVar = value; } const char* getStringVar() { return StringVar.c_str(); } void setStringVar(const char* value) { StringVar = value; } uint16_t getuint16Var() { return uint16Var; } void setuint16Var(uint16_t value) { uint16Var = value; } int16_t getint16Var() { return int16Var; } void setint16Var(int16_t value) { int16Var = value; } uint32_t getuint32Var() { return uint32Var; } void setuint32Var(uint32_t value) { uint32Var = value; } int32_t getint32Var() { return int32Var; } void setint32Var(int32_t value) { int32Var = value; } uint64_t getuint64Var() { return uint64Var; } void setuint64Var(uint64_t value) { uint64Var = value; } int64_t getint64Var() { return int64Var; } void setint64Var(int64_t value) { int64Var = value; } bool getEnabledFunc() { return true; } bool getWriteableFunc() { return true; } const char* getTestString(uint16_t language) { QCC_UNUSED(language); return sampleString.c_str(); } const char* getUrlString() { return sampleUrlString.c_str(); } const ajn::services::CPSDate& getDateProperty() { return dateVar; } void setDateProperty(const ajn::services::CPSDate& datePropertyValue) { dateVar.setDay(datePropertyValue.getDay()); dateVar.setMonth(datePropertyValue.getMonth()); dateVar.setYear(datePropertyValue.getYear()); } const ajn::services::CPSTime& getTimeProperty() { return timeVar; } void setTimeProperty(const ajn::services::CPSTime& timePropertyValue) { timeVar.setHour(timePropertyValue.getHour()); timeVar.setMinute(timePropertyValue.getMinute()); timeVar.setSecond(timePropertyValue.getSecond()); } /** * Functions for Oven.xml */ static uint16_t temperatureVar = 0; static uint16_t programVar = 0; static qcc::String programString = "Program: "; void startOven() { printf("********* Starting the Oven *********\n"); } void stopOven() { printf("********* Stopping the Oven *********\n"); } uint16_t getTemperature() { return temperatureVar; } void setTemperature(uint16_t temperature) { temperatureVar = temperature; } uint16_t getProgram() { return programVar; } void setProgram(uint16_t program) { programVar = program; } const char* getProgramString(uint16_t language) { QCC_UNUSED(language); return programString.c_str(); } base-16.04/controlpanel/cpp/samples/provided/ControlPanelProvided.h000066400000000000000000000072141272147170000254530ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4100. unreferenced formal parameter */ #pragma warning(push) #pragma warning(disable: 4100) #endif #define AJ_Printf(fmat, ...) \ do { printf(fmat, ## __VA_ARGS__); } while (0) #define UNICODE_HI_IN_HEBREW "\xd7\xa9\xd7\x9c\xd7\x95\xd7\x9d\x00" #define UNICODE_HI_IN_CHINESE "\xe5\x97\xa8" #define UNICODE_TESTING_CHINESE "\xE6\xB5\x8B\xE8\xAF\x95\xE4\xB8\xAD\xE5\x9B\xBD" #define UNICODE_MY_LABEL_CONTAINER "\xE6\x88\x91\xE7\x9A\x84\xE6\xA0\x87\xE7\xAD\xBE\xE6\x88\x91\xE7\x9A\x84\xE5\xAE\xB9\xE5\x99\xA8" #define UNICODE_CURENT_TEMPERATURE "\xE5\xBD\x93\xE5\x89\x8D\xE6\xB8\xA9\xE5\xBA\xA6\xEF\xBC\x9A" #define UNICODE_OVEN_TEMPERATURE "\xE7\x83\xA4\xE7\xAE\xB1\xE6\xB8\xA9\xE5\xBA\xA6" #define UNICODE_REGULAR "\xE5\xAE\x9A\xE6\x9C\x9F" #define UNICODE_HOT "\xE7\x83\xAD" #define UNICODE_VERY_HOT "\xE9\x9D\x9E\xE5\xB8\xB8\xE7\x83\xAD" #define UNICODE_DEGREES "\xE5\xBA\xA6" #define UNICODE_START_OVEN "\xE5\x90\xAF\xE5\x8A\xA8\xE7\x83\xA4\xE7\xAE\xB1" #define UNICODE_ARE_YOU_SURE_YOU_WANT_TO_TURN_OFF_THE_LIGHT "\xE4\xBD\xA0\xE7\xA1\xAE\xE5\xAE\x9A\xE4\xBD\xA0\xE8\xA6\x81\xE5\xBC\x80\xE7\x81\xAF" #define UNICODE_ARE_YOU_SURE "\xE4\xBD\xA0\xE7\xA1\xAE\xE5\xAE\x9A\xE5\x90\x97\xEF\xBC\x9F" #define UNICODE_NO "\xE4\xB8\x8D" #define UNICODE_CANCEL "\xE5\x8F\x96\xE6\xB6\x88" #define UNICODE_TURN_ON_OVEN_LIGHT "\xE6\x89\x93\xE5\xBC\x80\xE7\x83\xA4\xE7\xAE\xB1\xE7\x81\xAF" #define UNICODE_YES "\xE6\x98\xAF" bool getboolVar(); void setboolVar(bool value); double getdoubleVar(); void setdoubleVar(double value); const char* getStringVar(); void setStringVar(const char* value); uint16_t getuint16Var(); void setuint16Var(uint16_t value); int16_t getint16Var(); void setint16Var(int16_t value); uint32_t getuint32Var(); void setuint32Var(uint32_t value); int32_t getint32Var(); void setint32Var(int32_t value); uint64_t getuint64Var(); void setuint64Var(uint64_t value); int64_t getint64Var(); void setint64Var(int64_t value); bool getEnabledFunc(); bool getWriteableFunc(); const char* getTestString(uint16_t language); const char* getUrlString(); const ajn::services::CPSDate& getDateProperty(); void setDateProperty(const ajn::services::CPSDate& datePropertyValue); const ajn::services::CPSTime& getTimeProperty(); void setTimeProperty(const ajn::services::CPSTime& timePropertyValue); /** * Functions for Oven.xml */ void startOven(); void stopOven(); uint16_t getTemperature(); void setTemperature(uint16_t temperature); uint16_t getProgram(); void setProgram(uint16_t program); const char* getProgramString(uint16_t language); base-16.04/controlpanel/cpp/samples/provided/SConscript000066400000000000000000000015611272147170000232160ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env') srcs = env.Glob('*.cc') objs = env.Object(srcs) Return('objs') base-16.04/controlpanel/cpp/src/000077500000000000000000000000001272147170000165105ustar00rootroot00000000000000base-16.04/controlpanel/cpp/src/BusObjects/000077500000000000000000000000001272147170000205535ustar00rootroot00000000000000base-16.04/controlpanel/cpp/src/BusObjects/ActionBusObject.cc000066400000000000000000000164751272147170000241150ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "ActionBusObject.h" #include "../ControlPanelConstants.h" #include #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; ActionBusObject::ActionBusObject(BusAttachment* bus, String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : WidgetBusObject(objectPath, langIndx, status, widget) { if (status != ER_OK) { QCC_LogError(status, ("Could not create the BusObject")); return; } String interfaceName = widget->getIsSecured() ? AJ_SECURED_ACTION_INTERFACE : AJ_ACTION_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription, widget->getIsSecured())); CHECK_AND_BREAK(addDefaultInterfaceVariables(m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddMethod(AJ_METHOD_EXECUTE.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_METHOD_EXECUTE.c_str(), "org.alljoyn.Bus.DocString.En", AJ_METHOD_EXECUTE_DESC.c_str())); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalPropertyChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_PROPERTIES_CHANGED.c_str()); if (widget->getControlPanelMode() == CONTROLLER_MODE) { status = addSignalHandler(bus); } else if (widget->getWidgetType() == WIDGET_TYPE_ACTION) { const ajn::InterfaceDescription::Member* execMember = m_InterfaceDescription->GetMember(AJ_METHOD_EXECUTE.c_str()); status = AddMethodHandler(execMember, static_cast(&ActionBusObject::ActionExecute)); if (status != ER_OK) { QCC_LogError(status, ("Could not register the MethodHandler")); return; } } QCC_DbgPrintf(("Created ActionBusObject successfully")); } ActionBusObject::~ActionBusObject() { } void ActionBusObject::ActionExecute(const ajn::InterfaceDescription::Member* member, ajn::Message& msg) { QCC_UNUSED(member); QStatus status = ER_OK; QCC_DbgPrintf(("Execute was called")); if (((Action*)m_Widget)->executeCallBack()) { MsgArg replyArg; status = MethodReply(msg, &replyArg, 0); QCC_DbgPrintf(("Execute completed successfully")); } else { status = MethodReply(msg, AJ_ERROR_UNKNOWN.c_str(), AJ_ERROR_UNKNOWN_MESSAGE.c_str()); QCC_DbgPrintf(("Execute did not complete successfully")); } if (ER_OK != status) { QCC_LogError(status, ("Execute did not complete successfully")); } } QStatus ActionBusObject::ExecuteAction() { if (!m_Proxy) { QCC_LogError(ER_BUS_PROPERTY_VALUE_NOT_SET, ("Execute did not complete successfully")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } const ajn::InterfaceDescription::Member* execMember = m_InterfaceDescription->GetMember(AJ_METHOD_EXECUTE.c_str()); if (!execMember) { QCC_LogError(ER_BUS_PROPERTY_VALUE_NOT_SET, ("Execute did not complete successfully")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } Message replyMsg(*bus); QStatus status = m_Proxy->MethodCall(*execMember, NULL, 0, replyMsg); if (status != ER_OK) { QCC_LogError(status, ("Call to execute the Action failed")); } return status; } QStatus ActionBusObject::Introspect(std::vector& childNodes) { if (!m_Proxy) { QCC_LogError(ER_BUS_PROPERTY_VALUE_NOT_SET, ("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status = m_Proxy->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObject")); return status; } size_t numChildren = m_Proxy->GetChildren(); if (numChildren == 0) { QCC_LogError(ER_FAIL, ("ActionWithDialog does not have children")); return ER_FAIL; } ProxyBusObject** proxyBusObjectChildren = new ProxyBusObject *[numChildren]; numChildren = m_Proxy->GetChildren(proxyBusObjectChildren, numChildren); for (size_t i = 0; i < numChildren; i++) { String const& objectPath = proxyBusObjectChildren[i]->GetPath(); QCC_DbgPrintf(("ObjectPath is: %s", objectPath.c_str())); status = proxyBusObjectChildren[i]->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObjectChild")); delete[] proxyBusObjectChildren; return status; } size_t numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(); if (numInterfaces == 0) { continue; } const InterfaceDescription** ifaces = new const InterfaceDescription *[numInterfaces]; numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(ifaces, numInterfaces); for (size_t j = 0; j < numInterfaces; j++) { QCC_DbgPrintf(("InterfaceName is %s", ifaces[j]->GetName())); if (strcmp(ifaces[j]->GetName(), AJ_DIALOG_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_DIALOG, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_DIALOG_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_DIALOG, true); childNodes.push_back(node); } else { QCC_DbgPrintf(("Ignoring interfaceName: %s", ifaces[j]->GetName())); } } delete[] ifaces; } delete[] proxyBusObjectChildren; return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/ActionBusObject.h000066400000000000000000000054151272147170000237470ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef ACTIONBUSOBJECT_H_ #define ACTIONBUSOBJECT_H_ #include "WidgetBusObject.h" namespace ajn { namespace services { /** * ActionBusObject - BusObject for Actions */ class ActionBusObject : public WidgetBusObject { public: /** * Constructor for ActionBusObject class * @param bus - the bus to create the interface * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ ActionBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor for the BusObject */ virtual ~ActionBusObject(); /** * Callback when Execute is called * @param member - the member (method) of the interface that was executed * @param msg - the Message of the method */ void ActionExecute(const ajn::InterfaceDescription::Member* member, ajn::Message& msg); /** * Execute this Action's remoteAction * @return status - success/failure */ QStatus ExecuteAction(); /** * PropertyChanged - callback when a propertyChanged signal comes in * @param member - the member (signal) of the interface that was fired * @param srcPath - path of signal * @param msg - the arguments */ void PropertyChanged(const InterfaceDescription::Member* member, const char* srcPath, Message& msg); /** * Introspect to receive childNodes * @param childNodes - childNodes found during introspection * @return status - success/failure */ QStatus Introspect(std::vector& childNodes); }; } /* namespace services */ } /* namespace ajn */ #endif /* ACTIONBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/ContainerBusObject.cc000066400000000000000000000152651272147170000246160ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "ContainerBusObject.h" #include "../ControlPanelConstants.h" #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; ContainerBusObject::ContainerBusObject(BusAttachment* bus, String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : WidgetBusObject(objectPath, langIndx, status, widget) { if (status != ER_OK) { QCC_LogError(status, ("Could not create the BusObject")); return; } String interfaceName = widget->getIsSecured() ? AJ_SECURED_CONTAINER_INTERFACE : AJ_CONTAINER_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription, widget->getIsSecured())); CHECK_AND_BREAK(addDefaultInterfaceVariables(m_InterfaceDescription)); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalPropertyChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_PROPERTIES_CHANGED.c_str()); if (widget->getControlPanelMode() == CONTROLLER_MODE) { status = addSignalHandler(bus); } QCC_DbgPrintf(("Created ContainerBusObject successfully")); } ContainerBusObject::~ContainerBusObject() { } QStatus ContainerBusObject::Introspect(std::vector& childNodes) { if (!m_Proxy) { QCC_LogError(ER_BUS_PROPERTY_VALUE_NOT_SET, ("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status = m_Proxy->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObject")); return status; } size_t numChildren = m_Proxy->GetChildren(); if (numChildren == 0) { QCC_LogError(ER_FAIL, ("Container does not have children")); return ER_FAIL; } ProxyBusObject** proxyBusObjectChildren = new ProxyBusObject *[numChildren]; numChildren = m_Proxy->GetChildren(proxyBusObjectChildren, numChildren); for (size_t i = 0; i < numChildren; i++) { String const& objectPath = proxyBusObjectChildren[i]->GetPath(); QCC_DbgPrintf(("ObjectPath is: %s", objectPath.c_str())); status = proxyBusObjectChildren[i]->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObjectChild")); delete[] proxyBusObjectChildren; return status; } size_t numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(); if (numInterfaces == 0) { continue; } const InterfaceDescription** ifaces = new const InterfaceDescription *[numInterfaces]; numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(ifaces, numInterfaces); for (size_t j = 0; j < numInterfaces; j++) { QCC_DbgPrintf(("InterfaceName is : %s", ifaces[j]->GetName())); if (strcmp(ifaces[j]->GetName(), AJ_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, true); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_PROPERTY_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_PROPERTY, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_PROPERTY_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_PROPERTY, true); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_LABEL_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_LABEL, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_ACTION_INTERFACE.c_str()) == 0) { if (proxyBusObjectChildren[i]->GetChildren()) { IntrospectionNode node(objectPath, WIDGET_TYPE_ACTION_WITH_DIALOG, false); childNodes.push_back(node); } else { IntrospectionNode node(objectPath, WIDGET_TYPE_ACTION, false); childNodes.push_back(node); } } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_ACTION_INTERFACE.c_str()) == 0) { if (proxyBusObjectChildren[i]->GetChildren()) { IntrospectionNode node(objectPath, WIDGET_TYPE_ACTION_WITH_DIALOG, true); childNodes.push_back(node); } else { IntrospectionNode node(objectPath, WIDGET_TYPE_ACTION, true); childNodes.push_back(node); } } else { QCC_DbgPrintf(("Ignoring interfaceName: %s", ifaces[j]->GetName())); } } delete[] ifaces; } delete[] proxyBusObjectChildren; return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/ContainerBusObject.h000066400000000000000000000041171272147170000244520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTAINERBUSOBJECT_H_ #define CONTAINERBUSOBJECT_H_ #include "WidgetBusObject.h" namespace ajn { namespace services { /** * ContainerBusObject - BusObject for Containers */ class ContainerBusObject : public WidgetBusObject { public: /** * Constructor for ContainerBusObject class * @param bus - the bus to create the interface * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ ContainerBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor for ContainerBusObject class */ virtual ~ContainerBusObject(); /** * Introspect to receive childNodes * @param childNodes - childNodes found during introspection * @return status - success/failure */ QStatus Introspect(std::vector& childNodes); }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTAINERBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/ControlPanelBusObject.cc000066400000000000000000000231521272147170000252660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "ControlPanelBusObject.h" #include "../ControlPanelConstants.h" #include #include using namespace qcc; namespace ajn { namespace services { using namespace cpsConsts; #define CONTROLPANEL_INTERFACE_VERSION 1 ControlPanelBusObject::ControlPanelBusObject(BusAttachment* bus, String const& objectPath, QStatus& status) : BusObject(objectPath.c_str()), m_Proxy(0), m_ObjectPath(objectPath), m_InterfaceDescription(0), m_IsNotificationAction(false), m_SignalDismiss(0) { status = ER_OK; String interfaceName = AJ_CONTROLPANEL_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription, ANNOUNCED); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } QCC_DbgPrintf(("Created ControlPanelBusObject successfully")); } ControlPanelBusObject::~ControlPanelBusObject() { if (m_Proxy) { delete m_Proxy; } } QStatus ControlPanelBusObject::setIsNotificationAction(BusAttachment* bus) { QStatus status = ER_OK; String interfaceName = AJ_NOTIFICATIONACTION_INTERFACE; InterfaceDescription* interfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!interfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), interfaceDescription)); CHECK_AND_BREAK(interfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); CHECK_AND_BREAK(interfaceDescription->AddSignal(AJ_SIGNAL_DISMISS.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(interfaceDescription->AddMemberAnnotation(AJ_SIGNAL_DISMISS.c_str(), "org.alljoyn.Bus.DocString.En", AJ_SIGNAL_DISMISS_DESC.c_str())); interfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return status; } status = AddInterface(*interfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return status; } //Get the signal methods for future use m_SignalDismiss = interfaceDescription->GetMember(AJ_SIGNAL_DISMISS.c_str()); QCC_DbgPrintf(("Created NotificationAction interface successfully")); m_IsNotificationAction = true; return status; } QStatus ControlPanelBusObject::SendDismissSignal() { QStatus status = ER_BUS_PROPERTY_VALUE_NOT_SET; if (!m_IsNotificationAction) { QCC_LogError(status, ("ControlPanel is not set as a Notification with Action")); return status; } ControlPanelBusListener* busListener = ControlPanelService::getInstance()->getBusListener(); if (!m_SignalDismiss) { QCC_DbgHLPrintf(("Can't send Dismiss signal. Signal not set")); return status; } if (!busListener) { QCC_DbgHLPrintf(("Can't send valueChanged signal. SessionIds are unknown")); return status; } QCC_DbgPrintf(("Sending dismiss Signal to all connected sessions")); const std::vector& sessionIds = busListener->getSessionIds(); for (size_t indx = 0; indx < sessionIds.size(); indx++) { status = Signal(NULL, sessionIds[indx], *m_SignalDismiss, NULL, 0); if (status != ER_OK) { QCC_LogError(status, ("Could not send Dismiss Signal for sessionId: %s", sessionIds[indx])); } } return status; } QStatus ControlPanelBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_DbgPrintf(("Get property was called - in ControlPanelBusObject class.")); if (0 == strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { return val.Set(AJPARAM_UINT16.c_str(), CONTROLPANEL_INTERFACE_VERSION); } return ER_BUS_NO_SUCH_PROPERTY; } QStatus ControlPanelBusObject::Set(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } QStatus ControlPanelBusObject::setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId) { if (m_Proxy && m_Proxy->GetSessionId() == sessionId) { QCC_DbgPrintf(("ProxyBusObject already set - ignoring")); return ER_OK; } if (!m_InterfaceDescription) { QCC_DbgHLPrintf(("InterfaceDescription is not set. Cannot set RemoteController")); return ER_FAIL; } if (m_Proxy) { // delete existing ProxyBusObject and create new one with correct sessionId delete m_Proxy; } m_Proxy = new ProxyBusObject(*bus, deviceBusName.c_str(), m_ObjectPath.c_str(), sessionId); QStatus status = m_Proxy->AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add Interface to ProxyBusobject")); } return status; } QStatus ControlPanelBusObject::checkVersions() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set.")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } MsgArg value; QStatus status = m_Proxy->GetProperty(AJ_CONTROLPANEL_INTERFACE.c_str(), AJ_PROPERTY_VERSION.c_str(), value); if (status != ER_OK) { QCC_LogError(status, ("Call to get Version Property failed")); return status; } uint16_t version = 1; status = value.Get(AJPARAM_UINT16.c_str(), &version); if (status != ER_OK) { QCC_LogError(status, ("Could not unmarshal version property")); return status; } if (CONTROLPANEL_INTERFACE_VERSION < version) { QCC_DbgHLPrintf(("The versions of the interface are not compatible")); return ER_BUS_INTERFACE_MISMATCH; } return ER_OK; } QStatus ControlPanelBusObject::Introspect(std::vector& childNodes) { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status = m_Proxy->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObject")); return status; } size_t numChildren = m_Proxy->GetChildren(); if (numChildren == 0) { return ER_OK; } ProxyBusObject** proxyBusObjectChildren = new ProxyBusObject *[numChildren]; numChildren = m_Proxy->GetChildren(proxyBusObjectChildren, numChildren); for (size_t i = 0; i < numChildren; i++) { String const& objectPath = proxyBusObjectChildren[i]->GetPath(); QCC_DbgPrintf(("ObjectPath is: %s", objectPath.c_str())); status = proxyBusObjectChildren[i]->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObjectChild")); delete[] proxyBusObjectChildren; return status; } size_t numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(); if (numInterfaces == 0) { continue; } const InterfaceDescription** ifaces = new const InterfaceDescription *[numInterfaces]; numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(ifaces, numInterfaces); for (size_t j = 0; j < numInterfaces; j++) { QCC_DbgPrintf(("InterfaceName is : %s", ifaces[j]->GetName())); if (strcmp(ifaces[j]->GetName(), AJ_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, true); childNodes.push_back(node); } else { QCC_DbgPrintf(("Ignoring interface - not a container interface")); } } delete[] ifaces; } delete[] proxyBusObjectChildren; return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/ControlPanelBusObject.h000066400000000000000000000103671272147170000251340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELBUSOBJECT_H_ #define CONTROLPANELBUSOBJECT_H_ #include #include #include #include #include "IntrospectionNode.h" namespace ajn { namespace services { /** * ControlPanelBusObject class. BusObject for a ControlPanel */ class ControlPanelBusObject : public BusObject { public: /** * Constructor for ControlPanelBusObject * @param bus - bus used to create the interface * @param objectPath - objectPath of BusObject * @param status - success/failure */ ControlPanelBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, QStatus& status); /** * Destructor of ControlPanelBusObject class */ virtual ~ControlPanelBusObject(); /** * Set ControlPanel to also be a NotificationAction * @param bus - bus used to create the interface * @return status - success/failure */ QStatus setIsNotificationAction(BusAttachment* bus); /** * if ControlPanel is a NotificationAction send a dismiss signal * @return status - success/failure */ QStatus SendDismissSignal(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback for Alljoyn when SetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg that contains the new Value * @return status - success/failure */ QStatus Set(const char* ifcName, const char* propName, MsgArg& val); /** * Set RemoteController * @param bus - busAttachment * @param deviceBusName * @param sessionId * @return */ QStatus setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId); /** * Check compatibility of the versions * @return status - success/failure */ QStatus checkVersions(); /** * Introspect to receive childNodes * @param childNodes - childNodes found during introspection * @return status - success/failure */ QStatus Introspect(std::vector& childNodes); /** * @internal Explicitly provide implementation for virtual method. */ void Introspect(const InterfaceDescription::Member* member, Message& msg) { BusObject::Introspect(member, msg); } private: /** * Pointer to ProxybusObject for this widget */ ProxyBusObject* m_Proxy; /** * ObjectPath of the BusObject */ qcc::String m_ObjectPath; /** * InterfaceDescription of the BusObject */ InterfaceDescription* m_InterfaceDescription; /** * Is this ControlPanel also a NotificationAction */ bool m_IsNotificationAction; /** * The pointer used to send the dismiss signal */ const ajn::InterfaceDescription::Member* m_SignalDismiss; }; } /* namespace services */ } /* namespace ajn */ #endif /* CONTROLPANELBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/DialogBusObject.cc000066400000000000000000000231511272147170000240640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "DialogBusObject.h" #include "../ControlPanelConstants.h" #include #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; DialogBusObject::DialogBusObject(BusAttachment* bus, String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : WidgetBusObject(objectPath, langIndx, status, widget) { if (status != ER_OK) { QCC_DbgHLPrintf(("Could not create the BusObject")); return; } String interfaceName = widget->getIsSecured() ? AJ_SECURED_DIALOG_INTERFACE : AJ_DIALOG_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription, widget->getIsSecured())); CHECK_AND_BREAK(addDefaultInterfaceVariables(m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_MESSAGE.c_str(), AJPARAM_STR.c_str(), PROP_ACCESS_READ)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_NUMACTIONS.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); CHECK_AND_BREAK(m_InterfaceDescription->AddMethod(AJ_METHOD_ACTION1.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_METHOD_ACTION1.c_str(), "org.alljoyn.Bus.DocString.En", AJ_METHOD_ACTION1.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMethod(AJ_METHOD_ACTION2.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_METHOD_ACTION2.c_str(), "org.alljoyn.Bus.DocString.En", AJ_METHOD_ACTION2.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMethod(AJ_METHOD_ACTION3.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_METHOD_ACTION3.c_str(), "org.alljoyn.Bus.DocString.En", AJ_METHOD_ACTION3.c_str())); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalPropertyChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_PROPERTIES_CHANGED.c_str()); if (widget->getControlPanelMode() == CONTROLLER_MODE) { status = addSignalHandler(bus); } else { const ajn::InterfaceDescription::Member* execMember1 = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION1.c_str()); const ajn::InterfaceDescription::Member* execMember2 = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION2.c_str()); const ajn::InterfaceDescription::Member* execMember3 = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION3.c_str()); status = AddMethodHandler(execMember1, static_cast(&DialogBusObject::DialogExecute)); if (status != ER_OK) { QCC_LogError(status, ("Could not register the MethodHandler")); return; } status = AddMethodHandler(execMember2, static_cast(&DialogBusObject::DialogExecute)); if (status != ER_OK) { QCC_LogError(status, ("Could not register the MethodHandler")); return; } status = AddMethodHandler(execMember3, static_cast(&DialogBusObject::DialogExecute)); if (status != ER_OK) { QCC_LogError(status, ("Could not register the MethodHandler")); return; } } QCC_DbgPrintf(("Created DialogBusObject successfully")); } DialogBusObject::~DialogBusObject() { } QStatus DialogBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_DbgTrace(("Get property was called - in DialogBusObject class.")); if (0 == strcmp(AJ_PROPERTY_NUMACTIONS.c_str(), propName)) { return ((Dialog*)m_Widget)->fillNumActionArg(val, m_LanguageIndx); } if (0 == strcmp(AJ_PROPERTY_MESSAGE.c_str(), propName)) { return ((Dialog*)m_Widget)->fillMessageArg(val, m_LanguageIndx); } return WidgetBusObject::Get(interfaceName, propName, val); } void DialogBusObject::DialogExecute(const ajn::InterfaceDescription::Member* member, ajn::Message& msg) { QStatus status = ER_OK; QCC_DbgTrace(("Execute was called")); if (member->name.compare(AJ_METHOD_ACTION1) == 0 && ((Dialog*)m_Widget)->executeAction1CallBack()) { MsgArg replyArg; status = MethodReply(msg, &replyArg, 0); QCC_DbgPrintf(("Execute Action 1 completed successfully")); } else if (member->name.compare(AJ_METHOD_ACTION2) == 0 && ((Dialog*)m_Widget)->executeAction2CallBack()) { MsgArg replyArg; status = MethodReply(msg, &replyArg, 0); QCC_DbgPrintf(("Execute Action 2 completed successfully")); } else if (member->name.compare(AJ_METHOD_ACTION3) == 0 && ((Dialog*)m_Widget)->executeAction3CallBack()) { MsgArg replyArg; status = MethodReply(msg, &replyArg, 0); QCC_DbgPrintf(("Execute Action 3 completed successfully")); } else { QCC_DbgHLPrintf(("Unknown Execute Action was called, or action did not complete successfully")); status = MethodReply(msg, AJ_ERROR_UNKNOWN.c_str(), AJ_ERROR_UNKNOWN_MESSAGE.c_str()); } if (ER_OK != status) { QCC_LogError(status, ("Did not reply successfully")); } } QStatus DialogBusObject::ExecuteAction1() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot execute the Action 1. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } const ajn::InterfaceDescription::Member* execMember = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION1.c_str()); if (!execMember) { QCC_DbgHLPrintf(("Cannot execute the Action 1. ExecMember is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } Message replyMsg(*bus); QStatus status = m_Proxy->MethodCall(*execMember, NULL, 0, replyMsg); if (status != ER_OK) { QCC_DbgHLPrintf(("Call to execute the Action 1 failed")); } return status; } QStatus DialogBusObject::ExecuteAction2() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot execute the Action 2. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } const ajn::InterfaceDescription::Member* execMember = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION2.c_str()); if (!execMember) { QCC_DbgHLPrintf(("Cannot execute the Action 2. ExecMember is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } Message replyMsg(*bus); QStatus status = m_Proxy->MethodCall(*execMember, NULL, 0, replyMsg); if (status != ER_OK) { QCC_DbgHLPrintf(("Call to execute the Action 2 failed")); } return status; } QStatus DialogBusObject::ExecuteAction3() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot execute the Action 3. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } const ajn::InterfaceDescription::Member* execMember = m_InterfaceDescription->GetMember(AJ_METHOD_ACTION3.c_str()); if (!execMember) { QCC_DbgHLPrintf(("Cannot execute the Action 3. ExecMember is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } Message replyMsg(*bus); QStatus status = m_Proxy->MethodCall(*execMember, NULL, 0, replyMsg); if (status != ER_OK) { QCC_DbgHLPrintf(("Call to execute the Action 3 failed")); } return status; } QStatus DialogBusObject::fillProperty(char* key, MsgArg* variant) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; if (strcmp(key, AJ_PROPERTY_MESSAGE.c_str()) == 0) { CHECK_AND_RETURN(((Dialog*)m_Widget)->readMessageArg(variant)) } else if (strcmp(key, AJ_PROPERTY_NUMACTIONS.c_str()) == 0) { CHECK_AND_RETURN(((Dialog*)m_Widget)->readNumActionsArg(variant)) } return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/DialogBusObject.h000066400000000000000000000056001272147170000237250ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef DIALOGBUSOBJECT_H_ #define DIALOGBUSOBJECT_H_ #include "WidgetBusObject.h" namespace ajn { namespace services { /** * DialogBusObject - BusObject for Dialogs */ class DialogBusObject : public WidgetBusObject { public: /** * Constructor for DialogBusObject class * @param bus - the bus to create the interface * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ DialogBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor for DialogBusObject */ virtual ~DialogBusObject(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback when Execute is called * @param member - the member (method) of the interface that was executed * @param msg - the Message of the method */ void DialogExecute(const ajn::InterfaceDescription::Member* member, ajn::Message& msg); /** * Execute this Dialog's remoteAction 1 * @return status - success/failure */ QStatus ExecuteAction1(); /** * Execute this Dialog's remoteAction 2 * @return status - success/failure */ QStatus ExecuteAction2(); /** * Execute this Dialog's remoteAction 3 * @return status - success/failure */ QStatus ExecuteAction3(); private: QStatus fillProperty(char* key, MsgArg* variant); }; } /* namespace services */ } /* namespace ajn */ #endif /* DIALOGBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/HttpControlBusObject.cc000066400000000000000000000175071272147170000251550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "HttpControlBusObject.h" #include "../ControlPanelConstants.h" #include #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; #define HTTP_INTERFACE_VERSION 1 HttpControlBusObject::HttpControlBusObject(BusAttachment* bus, String const& objectPath, QStatus& status, HttpControl* httpControl) : BusObject(objectPath.c_str()), m_HttpControl(httpControl), m_Proxy(0), m_ObjectPath(objectPath), m_InterfaceDescription(0) { if (!httpControl) { QCC_DbgHLPrintf(("HttpControl cannot be NULL")); status = ER_BAD_ARG_4; return; } m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(AJ_HTTPCONTROL_INTERFACE.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(AJ_HTTPCONTROL_INTERFACE.c_str(), m_InterfaceDescription, false)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); CHECK_AND_BREAK(m_InterfaceDescription->AddMethod(AJ_METHOD_GETROOTURL.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_STR.c_str(), AJ_PROPERTY_URL.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_METHOD_GETROOTURL.c_str(), "org.alljoyn.Bus.DocString.En", AJ_METHOD_GETROOTURL_DESC.c_str())); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription, ANNOUNCED); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } if (m_HttpControl->getControlPanelMode() == CONTROLLEE_MODE) { //Get the signal methods for future use const ajn::InterfaceDescription::Member* getRootUrlMember = m_InterfaceDescription->GetMember(AJ_METHOD_GETROOTURL.c_str()); status = AddMethodHandler(getRootUrlMember, static_cast(&HttpControlBusObject::HttpControlGetUrl)); if (status != ER_OK) { QCC_LogError(status, ("Could not register the MethodHandler")); return; } } QCC_DbgPrintf(("Created HttpControlBusObject successfully")); } HttpControlBusObject::~HttpControlBusObject() { } uint16_t HttpControlBusObject::getInterfaceVersion() { return HTTP_INTERFACE_VERSION; } QStatus HttpControlBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_DbgTrace(("Get property was called - in HttpControlBusObject class.")); if (0 == strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { return val.Set(AJPARAM_UINT16.c_str(), getInterfaceVersion()); } return ER_BUS_NO_SUCH_PROPERTY; } QStatus HttpControlBusObject::Set(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } void HttpControlBusObject::HttpControlGetUrl(const ajn::InterfaceDescription::Member* member, ajn::Message& msg) { QCC_UNUSED(member); QCC_DbgTrace(("Get Url was called")); MsgArg url; QStatus status = m_HttpControl->fillUrlArg(url); if (status != ER_OK) { QCC_LogError(status, ("Could not set Url")); MethodReply(msg, AJ_ERROR_UNKNOWN.c_str(), AJ_ERROR_UNKNOWN_MESSAGE.c_str()); return; } status = MethodReply(msg, &url, 1); if (ER_OK != status) { QCC_LogError(status, ("Did not reply successfully")); } else { QCC_DbgPrintf(("Replied to GetUrl successfully")); } } QStatus HttpControlBusObject::setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId) { if (m_Proxy && m_Proxy->GetSessionId() == sessionId) { QCC_DbgPrintf(("ProxyBusObject already set - ignoring")); return ER_OK; } if (!m_InterfaceDescription) { QCC_DbgHLPrintf(("InterfaceDescription is not set. Cannot set RemoteController")); return ER_FAIL; } if (m_Proxy) { // delete ProxyBusObject before creating a new one with correct sessionId delete m_Proxy; } m_Proxy = new ProxyBusObject(*bus, deviceBusName.c_str(), m_ObjectPath.c_str(), sessionId); QStatus status = m_Proxy->AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add Interface to ProxyBusobject")); } return status; } QStatus HttpControlBusObject::checkVersions() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } MsgArg value; QStatus status = m_Proxy->GetProperty(m_InterfaceDescription->GetName(), AJ_PROPERTY_VERSION.c_str(), value); if (status != ER_OK) { QCC_LogError(status, ("Call to get Version Property failed")); return status; } uint16_t version = 1; status = value.Get(AJPARAM_UINT16.c_str(), &version); if (status != ER_OK) { QCC_LogError(status, ("Could not unmarshal version property")); return status; } if (getInterfaceVersion() < version) { QCC_DbgHLPrintf(("The versions of the interface are not compatible")); return ER_BUS_INTERFACE_MISMATCH; } QStatus setVersionStatus = m_HttpControl->readVersionArg(value); if (setVersionStatus != ER_OK) { QCC_LogError(status, ("Could not set version property")); } return status; } QStatus HttpControlBusObject::GetUrl(BusAttachment* bus) { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot get the Url. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } const ajn::InterfaceDescription::Member* getRootUrlMember = m_InterfaceDescription->GetMember(AJ_METHOD_GETROOTURL.c_str()); if (!getRootUrlMember) { QCC_DbgHLPrintf(("Cannot get the Url. RootUrlMember is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } Message replyMsg(*bus); QStatus status = m_Proxy->MethodCall(*getRootUrlMember, NULL, 0, replyMsg); if (status != ER_OK) { QCC_LogError(status, ("Call to getUrl failed")); return status; } const ajn::MsgArg* returnArgs; size_t numArgs; replyMsg->GetArgs(numArgs, returnArgs); if (numArgs != 1) { QCC_DbgHLPrintf(("Received unexpected amount of returnArgs")); return ER_BUS_UNEXPECTED_SIGNATURE; } status = m_HttpControl->readUrlArg(returnArgs[0]); return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/HttpControlBusObject.h000066400000000000000000000101741272147170000250100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef HTTPCONTROLBUSOBJECT_H_ #define HTTPCONTROLBUSOBJECT_H_ #include #include #include #include namespace ajn { namespace services { /** * HttpControlBusObject - BusObject for HttpControls */ class HttpControlBusObject : public BusObject { public: /** * Constructor for HttpControlBusObject * @param bus - bus used to create the interface * @param objectPath - objectPath of BusObject * @param status - success/failure * @param httpControl - httpControl Widget */ HttpControlBusObject(BusAttachment* bus, qcc::String const& objectPath, QStatus& status, HttpControl* httpControl); /** * Destructor for HttpControlBusObject */ virtual ~HttpControlBusObject(); /** * Get the Version of the Interface represented by this BusObject * @return - interfaceVersion */ virtual uint16_t getInterfaceVersion(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ virtual QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback for Alljoyn when SetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg that contains the new Value * @return status - success/failure */ virtual QStatus Set(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback when GetUrl is called * @param member - the member (method) of the interface that was executed * @param msg - the Message of the method */ void HttpControlGetUrl(const ajn::InterfaceDescription::Member* member, ajn::Message& msg); /** * Set the RemoteController to allow remote calls * @param bus - bus used to create the proxyBusObject * @param deviceBusName - busName of the device * @param sessionId - sessionId of Remote device * @return status - success/failure */ QStatus setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId); /** * Check compatibility of the versions * @return status - success/failure */ QStatus checkVersions(); /** * Get the url of the remote HttpControl * @param bus - bus used for method call * @return status - success/failure */ QStatus GetUrl(BusAttachment* bus); private: /** * HttpControl widget of this BusObject */ HttpControl* m_HttpControl; /** * Pointer to ProxybusObject for this HttpControl */ ProxyBusObject* m_Proxy; /** * ObjectPath of this BusObject */ qcc::String m_ObjectPath; /** * InterfaceDecription of this BusObject */ InterfaceDescription* m_InterfaceDescription; }; } /* namespace services */ } /* namespace ajn */ #endif /* HTTPCONTROLBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/IntrospectionNode.cc000066400000000000000000000034731272147170000245370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "IntrospectionNode.h" namespace ajn { namespace services { IntrospectionNode::IntrospectionNode(qcc::String const& objectPath, WidgetType widgetType, bool secured) : m_ObjectPath(objectPath), m_WidgetType(widgetType), m_Secured(secured) { } IntrospectionNode::~IntrospectionNode() { } const qcc::String& IntrospectionNode::getObjectPath() const { return m_ObjectPath; } void IntrospectionNode::setObjectPath(const qcc::String& objectPath) { m_ObjectPath = objectPath; } bool IntrospectionNode::isSecured() const { return m_Secured; } void IntrospectionNode::setSecured(bool secured) { m_Secured = secured; } WidgetType IntrospectionNode::getWidgetType() const { return m_WidgetType; } void IntrospectionNode::setWidgetType(WidgetType widgetType) { m_WidgetType = widgetType; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/IntrospectionNode.h000066400000000000000000000033511272147170000243740ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef INTROSPECTIONNODE_H_ #define INTROSPECTIONNODE_H_ #include #include namespace ajn { namespace services { /* * */ class IntrospectionNode { public: IntrospectionNode(qcc::String const& objectPath, WidgetType widgetType, bool secured = false); virtual ~IntrospectionNode(); const qcc::String& getObjectPath() const; void setObjectPath(const qcc::String& objectPath); bool isSecured() const; void setSecured(bool secured); WidgetType getWidgetType() const; void setWidgetType(WidgetType widgetType); private: qcc::String m_ObjectPath; WidgetType m_WidgetType; bool m_Secured; }; } /* namespace services */ } /* namespace ajn */ #endif /* INTROSPECTIONNODE_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/LabelBusObject.cc000066400000000000000000000067251272147170000237140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "LabelBusObject.h" #include "../ControlPanelConstants.h" #include #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; LabelBusObject::LabelBusObject(BusAttachment* bus, String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : WidgetBusObject(objectPath, langIndx, status, widget) { if (status != ER_OK) { QCC_DbgHLPrintf(("Could not create the BusObject")); return; } m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(AJ_LABEL_INTERFACE.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(AJ_LABEL_INTERFACE.c_str(), m_InterfaceDescription)); CHECK_AND_BREAK(addDefaultInterfaceVariables(m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_LABEL.c_str(), AJPARAM_STR.c_str(), PROP_ACCESS_READ)); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalPropertyChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_PROPERTIES_CHANGED.c_str()); if (widget->getControlPanelMode() == CONTROLLER_MODE) { status = addSignalHandler(bus); } QCC_DbgPrintf(("Created LabelBusObject successfully")); } LabelBusObject::~LabelBusObject() { } QStatus LabelBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_DbgTrace(("Get property was called - in LabelBusObject class.")); if (0 == strcmp(AJ_PROPERTY_LABEL.c_str(), propName)) { return ((Label*)m_Widget)->fillLabelArg(val, m_LanguageIndx); } return WidgetBusObject::Get(interfaceName, propName, val); } QStatus LabelBusObject::fillProperty(char* key, MsgArg* variant) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; if (strcmp(key, AJ_PROPERTY_LABEL.c_str()) == 0) { CHECK_AND_RETURN(((Label*)m_Widget)->readLabelArg(variant)) } return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/LabelBusObject.h000066400000000000000000000043331272147170000235470ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LABELBUSOBJECT_H_ #define LABELBUSOBJECT_H_ #include "WidgetBusObject.h" namespace ajn { namespace services { /** * LabelBusObject - BusObject for Labels */ class LabelBusObject : public WidgetBusObject { public: /** * Constructor for LabelBusObject class * @param bus - the bus to create the interface * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ LabelBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor for the BusObject */ virtual ~LabelBusObject(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); private: QStatus fillProperty(char* key, MsgArg* variant); }; } /* namespace services */ } /* namespace ajn */ #endif /* LABELBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/NotificationActionBusObject.cc000066400000000000000000000244501272147170000264540ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "NotificationActionBusObject.h" #include "../ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; #define NOTIFICATIONACTION_INTERFACE_VERSION 1 NotificationActionBusObject::NotificationActionBusObject(BusAttachment* bus, String const& objectPath, QStatus& status, NotificationAction* notificationAction) : BusObject(objectPath.c_str()), m_SignalDismiss(0), m_NotificationAction(notificationAction), m_Proxy(0), m_ObjectPath(objectPath), m_InterfaceDescription(0) { status = ER_OK; String interfaceName = AJ_NOTIFICATIONACTION_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); CHECK_AND_BREAK(m_InterfaceDescription->AddSignal(AJ_SIGNAL_DISMISS.c_str(), AJPARAM_EMPTY.c_str(), AJPARAM_EMPTY.c_str())); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_SIGNAL_DISMISS.c_str(), "org.alljoyn.Bus.DocString.En", AJ_SIGNAL_DISMISS_DESC.c_str())); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalDismiss = m_InterfaceDescription->GetMember(AJ_SIGNAL_DISMISS.c_str()); if (m_NotificationAction) { status = bus->RegisterSignalHandler(this, static_cast(&NotificationActionBusObject::DismissSignal), m_SignalDismiss, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); return; } } QCC_DbgPrintf(("Created NotificationActionBusObject successfully")); } QStatus NotificationActionBusObject::UnregisterSignalHandler(BusAttachment* bus) { QStatus status = bus->UnregisterSignalHandler(this, static_cast(&NotificationActionBusObject::DismissSignal), m_SignalDismiss, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister the SignalHandler")); } return status; } NotificationActionBusObject::~NotificationActionBusObject() { if (m_Proxy) { delete m_Proxy; } } QStatus NotificationActionBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_DbgTrace(("Get property was called - in NotificationActionBusObject class.")); if (0 == strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { return val.Set(AJPARAM_UINT16.c_str(), NOTIFICATIONACTION_INTERFACE_VERSION); } return ER_BUS_NO_SUCH_PROPERTY; } QStatus NotificationActionBusObject::Set(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } QStatus NotificationActionBusObject::SendDismissSignal() { ControlPanelBusListener* busListener = ControlPanelService::getInstance()->getBusListener(); QStatus status = ER_BUS_PROPERTY_VALUE_NOT_SET; if (!m_SignalDismiss) { QCC_DbgHLPrintf(("Can't send Dismiss signal. Signal to set")); return status; } if (!busListener) { QCC_DbgHLPrintf(("Can't send valueChanged signal. SessionIds are unknown")); return status; } QCC_DbgPrintf(("Sending dismiss Signal to all connected sessions")); const std::vector& sessionIds = busListener->getSessionIds(); for (size_t indx = 0; indx < sessionIds.size(); indx++) { status = Signal(NULL, sessionIds[indx], *m_SignalDismiss, NULL, 0); if (status != ER_OK) { QCC_LogError(status, ("Could not send Dismiss Signal for sessionId: %s", sessionIds[indx])); } } return status; } void NotificationActionBusObject::DismissSignal(const InterfaceDescription::Member* member, const char* srcPath, Message& msg) { QCC_UNUSED(member); QCC_UNUSED(srcPath); QCC_UNUSED(msg); QCC_DbgTrace(("Received DismissSignal signal")); return m_NotificationAction->DismissSignal(); } QStatus NotificationActionBusObject::setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId) { if (m_Proxy && m_Proxy->GetSessionId() == sessionId) { QCC_DbgPrintf(("ProxyBusObject already set - ignoring")); return ER_OK; } if (!m_InterfaceDescription) { QCC_DbgHLPrintf(("InterfaceDescription is not set. Cannot set RemoteController")); return ER_FAIL; } if (m_Proxy) { delete m_Proxy; // delete existing proxyBusObject. create new one with new sessionId } m_Proxy = new ProxyBusObject(*bus, deviceBusName.c_str(), m_ObjectPath.c_str(), sessionId); QStatus status = m_Proxy->AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add Interface to ProxyBusobject")); } return status; } QStatus NotificationActionBusObject::checkVersions() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } MsgArg value; QStatus status = m_Proxy->GetProperty(AJ_NOTIFICATIONACTION_INTERFACE.c_str(), AJ_PROPERTY_VERSION.c_str(), value); if (status != ER_OK) { QCC_LogError(status, ("Call to get Version Property failed")); return status; } uint16_t version = 1; status = value.Get(AJPARAM_UINT16.c_str(), &version); if (status != ER_OK) { QCC_LogError(status, ("Could not unmarshal version property")); return status; } if (NOTIFICATIONACTION_INTERFACE_VERSION < version) { QCC_DbgHLPrintf(("The versions of the interface are not compatible")); return ER_BUS_INTERFACE_MISMATCH; } return ER_OK; } QStatus NotificationActionBusObject::Introspect(std::vector& childNodes) { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status = m_Proxy->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObject")); return status; } size_t numChildren = m_Proxy->GetChildren(); if (numChildren == 0) { return ER_OK; } ProxyBusObject** proxyBusObjectChildren = new ProxyBusObject *[numChildren]; numChildren = m_Proxy->GetChildren(proxyBusObjectChildren, numChildren); for (size_t i = 0; i < numChildren; i++) { String const& objectPath = proxyBusObjectChildren[i]->GetPath(); QCC_DbgPrintf(("ObjectPath is: %s", objectPath.c_str())); status = proxyBusObjectChildren[i]->IntrospectRemoteObject(); if (status != ER_OK) { QCC_LogError(status, ("Could not introspect RemoteObjectChild")); delete[] proxyBusObjectChildren; return status; } size_t numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(); if (numInterfaces == 0) { continue; } const InterfaceDescription** ifaces = new const InterfaceDescription *[numInterfaces]; numInterfaces = proxyBusObjectChildren[i]->GetInterfaces(ifaces, numInterfaces); for (size_t j = 0; j < numInterfaces; j++) { QCC_DbgPrintf(("InterfaceName is : %s", ifaces[j]->GetName())); if (strcmp(ifaces[j]->GetName(), AJ_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_CONTAINER_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_CONTAINER, true); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_DIALOG_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_DIALOG, false); childNodes.push_back(node); } else if (strcmp(ifaces[j]->GetName(), AJ_SECURED_DIALOG_INTERFACE.c_str()) == 0) { IntrospectionNode node(objectPath, WIDGET_TYPE_DIALOG, true); childNodes.push_back(node); } else { QCC_DbgHLPrintf(("Ignoring interface - not a container or dialog interface")); } } delete[] ifaces; } delete[] proxyBusObjectChildren; return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/NotificationActionBusObject.h000066400000000000000000000113071272147170000263130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONACTIONBUSOBJECT_H_ #define NOTIFICATIONACTIONBUSOBJECT_H_ #include #include #include #include #include #include "IntrospectionNode.h" namespace ajn { namespace services { /** * NotificationActionBusObject class. BusObject for a NotificationAction */ class NotificationActionBusObject : public BusObject { public: /** * Constructor for NotificationActionBusObject * @param bus - bus used to create the interface * @param objectPath - objectPath of BusObject * @param status - success/failure */ NotificationActionBusObject(BusAttachment* bus, qcc::String const& objectPath, QStatus& status, NotificationAction* notificationAction = 0); /** * Destructor of NotificationActionBusObject class */ virtual ~NotificationActionBusObject(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback for Alljoyn when SetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg that contains the new Value * @return status - success/failure */ QStatus Set(const char* ifcName, const char* propName, MsgArg& val); /** * Send a Dismiss Signal for This Notification Action * @return */ QStatus SendDismissSignal(); /** * Callback for DismissSignal signal * @param member - signal received * @param srcPath - objectPath of signal * @param msg - Message received */ void DismissSignal(const InterfaceDescription::Member* member, const char* srcPath, Message& msg); /** * Set RemoteController * @param bus - busAttachment * @param deviceBusName * @param sessionId * @return */ QStatus setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId); /** * Check compatibility of the versions * @return status - success/failure */ QStatus checkVersions(); /** * Introspect to receive childNodes * @param childNodes - childNodes found during introspection * @return status - success/failure */ QStatus Introspect(std::vector& childNodes); /** * @internal Explicitly provide implementation for virtual method. */ void Introspect(const InterfaceDescription::Member* member, Message& msg) { BusObject::Introspect(member, msg); } /** * remove the SignalHandler of the BusObject * @param bus - busAttachment used to remove the signalHandlers * @return status - success/failure */ virtual QStatus UnregisterSignalHandler(BusAttachment* bus); private: /** * The pointer used to send signal/register Signal Handler */ const ajn::InterfaceDescription::Member* m_SignalDismiss; /** * The NotificationAction of this BusObject */ NotificationAction* m_NotificationAction; /** * Pointer to ProxybusObject for this widget */ ProxyBusObject* m_Proxy; /** * ObjectPath of the BusObject */ qcc::String m_ObjectPath; /** * InterfaceDescription of the BusObject */ InterfaceDescription* m_InterfaceDescription; }; } /* namespace services */ } /* namespace ajn */ #endif /* NOTIFICATIONACTIONBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/PropertyBusObject.cc000066400000000000000000000171121272147170000245110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "PropertyBusObject.h" #include "../ControlPanelConstants.h" #include #include #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; PropertyBusObject::PropertyBusObject(BusAttachment* bus, String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : WidgetBusObject(objectPath, langIndx, status, widget), m_SignalValueChanged(0) { if (status != ER_OK) { QCC_DbgHLPrintf(("Could not create the BusObject")); return; } String interfaceName = widget->getIsSecured() ? AJ_SECURED_PROPERTY_INTERFACE : AJ_PROPERTY_INTERFACE; m_InterfaceDescription = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!m_InterfaceDescription) { do { CHECK_AND_BREAK(bus->CreateInterface(interfaceName.c_str(), m_InterfaceDescription, widget->getIsSecured())); CHECK_AND_BREAK(addDefaultInterfaceVariables(m_InterfaceDescription)); CHECK_AND_BREAK(m_InterfaceDescription->AddProperty(AJ_PROPERTY_VALUE.c_str(), AJPARAM_VAR.c_str(), PROP_ACCESS_RW)); CHECK_AND_BREAK(m_InterfaceDescription->AddSignal(AJ_SIGNAL_VALUE_CHANGED.c_str(), AJPARAM_VAR.c_str(), AJ_PROPERTY_VALUE.c_str(), 0)); CHECK_AND_BREAK(m_InterfaceDescription->AddMemberAnnotation(AJ_SIGNAL_VALUE_CHANGED.c_str(), "org.alljoyn.Bus.DocString.En", AJ_SIGNAL_VALUE_CHANGED_DESC.c_str())); m_InterfaceDescription->Activate(); } while (0); } if (status != ER_OK) { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } //Get the signal methods for future use m_SignalPropertyChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_PROPERTIES_CHANGED.c_str()); m_SignalValueChanged = m_InterfaceDescription->GetMember(AJ_SIGNAL_VALUE_CHANGED.c_str()); if (widget->getControlPanelMode() == CONTROLLER_MODE) { status = addSignalHandler(bus); } QCC_DbgPrintf(("Created PropertyBusObject successfully")); } PropertyBusObject::~PropertyBusObject() { } QStatus PropertyBusObject::addSignalHandler(BusAttachment* bus) { QStatus status; CHECK_AND_RETURN(WidgetBusObject::addSignalHandler(bus)) status = bus->RegisterSignalHandler(this, static_cast(&PropertyBusObject::ValueChanged), m_SignalValueChanged, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } return status; } QStatus PropertyBusObject::UnregisterSignalHandler(BusAttachment* bus) { WidgetBusObject::UnregisterSignalHandler(bus); QStatus status = bus->UnregisterSignalHandler(this, static_cast(&PropertyBusObject::ValueChanged), m_SignalValueChanged, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister the SignalHandler")); } return status; } QStatus PropertyBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_DbgTrace(("Get property was called - in PropertyBusObject class.")); if (0 == strcmp(AJ_PROPERTY_VALUE.c_str(), propName)) { return ((Property*)m_Widget)->fillPropertyValueArg(val, m_LanguageIndx); } return WidgetBusObject::Get(interfaceName, propName, val); } QStatus PropertyBusObject::Set(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_DbgTrace(("Set property was called - in PropertyBusObject class.")); if (0 != strcmp(AJ_PROPERTY_VALUE.c_str(), propName)) { return ER_BUS_PROPERTY_ACCESS_DENIED; } return ((Property*)m_Widget)->setPropertyValue(val, m_LanguageIndx); } QStatus PropertyBusObject::SetValue(MsgArg& value) { QCC_DbgTrace(("Set Value was called")); if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot set the Value. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } if (!m_InterfaceDescription) { QCC_DbgHLPrintf(("Cannot set the Value. InterfaceDescription is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status = m_Proxy->SetProperty(m_InterfaceDescription->GetName(), AJ_PROPERTY_VALUE.c_str(), value); if (status != ER_OK) { QCC_LogError(status, ("Call to set Property failed")); } return status; } QStatus PropertyBusObject::SendValueChangedSignal() { ControlPanelBusListener* busListener = ControlPanelService::getInstance()->getBusListener(); if (!m_SignalValueChanged) { QCC_DbgHLPrintf(("Can't send valueChanged signal. Signal not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } if (!busListener) { QCC_DbgHLPrintf(("Can't send valueChanged signal. SessionIds are unknown")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } QStatus status; MsgArg value; CHECK_AND_RETURN(((Property*)m_Widget)->fillPropertyValueArg(value, m_LanguageIndx)); const std::vector& sessionIds = busListener->getSessionIds(); for (size_t indx = 0; indx < sessionIds.size(); indx++) { status = Signal(NULL, sessionIds[indx], *m_SignalValueChanged, &value, 1); if (status != ER_OK) { QCC_LogError(status, ("Could not send ValueChanged Signal for sessionId: %u", sessionIds[indx])); } } return status; } void PropertyBusObject::ValueChanged(const InterfaceDescription::Member* member, const char* srcPath, Message& msg) { QCC_UNUSED(member); QCC_UNUSED(srcPath); if (msg.unwrap()->GetSender() && strcmp(msg.unwrap()->GetSender(), m_Widget->getDevice()->getDeviceBusName().c_str()) != 0) { QCC_DbgPrintf(("Received ValueChanged signal for someone else")); return; } QCC_DbgPrintf(("Received ValueChanged signal")); return ((Property*)m_Widget)->ValueChanged(msg); } QStatus PropertyBusObject::fillProperty(char* key, MsgArg* variant) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; if (strcmp(key, AJ_PROPERTY_VALUE.c_str()) == 0) { CHECK_AND_RETURN(((Property*)m_Widget)->readValueArg(variant)) return status; } return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/PropertyBusObject.h000066400000000000000000000076711272147170000243640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef PROPERTYBUSOBJECT_H_ #define PROPERTYBUSOBJECT_H_ #include "WidgetBusObject.h" namespace ajn { namespace services { /** * PropertyBusObject - BusObject for Property */ class PropertyBusObject : public WidgetBusObject { public: /** * Constructor for PropertyBusObject class * @param bus - the bus to create the interface * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ PropertyBusObject(ajn::BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor for the BusObject */ virtual ~PropertyBusObject(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback for Alljoyn when SetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg that contains the new Value * @return status - success/failure */ QStatus Set(const char* interfaceName, const char* propName, MsgArg& val); /** * Send a signal when the property's value has changed * @return status - success/failure */ QStatus SendValueChangedSignal(); /** * Value Change Signal Callback * @param member - signal sent * @param srcPath - objectPath it was sent for * @param msg - the Message sent */ void ValueChanged(const InterfaceDescription::Member* member, const char* srcPath, Message& msg); /** * Set the value of the remote property * @param value - value to be set * @return status - success/failure */ QStatus SetValue(MsgArg& value); /** * remove the SignalHandler of the BusObject * @param bus - busAttachment used to remove the signalHandlers * @return status - success/failure */ QStatus UnregisterSignalHandler(BusAttachment* bus); private: /** * Store member to send Value Changed signal */ const ajn::InterfaceDescription::Member* m_SignalValueChanged; /** * Fill Property in Widget * @param key - keyName of Property * @param variant - the value of the Property * @return status - success/failure */ QStatus fillProperty(char* key, MsgArg* variant); /** * Add the SignalHandler for propertyChanged signal * @param bus - bus used to add signal * @return status - success/failure */ QStatus addSignalHandler(BusAttachment* bus); }; } /* namespace services */ } /* namespace ajn */ #endif /* PROPERTYBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/WidgetBusObject.cc000066400000000000000000000244741272147170000241210ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "WidgetBusObject.h" #include "../ControlPanelConstants.h" #include "WidgetProxyBusObjectListener.h" #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; #define DEFAULT_WIDGET_INTERFACE_VERSION 1 WidgetBusObject::WidgetBusObject(String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget) : BusObject(objectPath.c_str()), m_Widget(widget), m_Proxy(0), m_LanguageIndx(langIndx), m_ObjectPath(objectPath), m_InterfaceDescription(0), m_SignalPropertyChanged(0) { status = ER_OK; if (!widget) { QCC_DbgHLPrintf(("Can't send in a NULL widget")); status = ER_BAD_ARG_5; } } WidgetBusObject::~WidgetBusObject() { if (m_Proxy) { delete m_Proxy; } } uint16_t WidgetBusObject::getInterfaceVersion() { return DEFAULT_WIDGET_INTERFACE_VERSION; } QStatus WidgetBusObject::addDefaultInterfaceVariables(InterfaceDescription* intf) { if (!intf) { return ER_BAD_ARG_1; } QStatus status; CHECK_AND_RETURN(intf->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ)); CHECK_AND_RETURN(intf->AddProperty(AJ_PROPERTY_STATES.c_str(), AJPARAM_UINT32.c_str(), PROP_ACCESS_READ)); CHECK_AND_RETURN(intf->AddProperty(AJ_PROPERTY_OPTPARAMS.c_str(), AJPARAM_ARRAY_DICT_UINT16_VAR.c_str(), PROP_ACCESS_READ)); status = intf->AddSignal(AJ_SIGNAL_PROPERTIES_CHANGED.c_str(), "", "", 0); if (ER_OK == status) { status = intf->AddMemberAnnotation(AJ_SIGNAL_PROPERTIES_CHANGED.c_str(), "org.alljoyn.Bus.DocString.En", AJ_SIGNAL_PROPERTIES_CHANGED_DESC.c_str()); } return status; } QStatus WidgetBusObject::addSignalHandler(BusAttachment* bus) { QStatus status = bus->RegisterSignalHandler(this, static_cast(&WidgetBusObject::PropertyChanged), m_SignalPropertyChanged, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } return status; } QStatus WidgetBusObject::UnregisterSignalHandler(BusAttachment* bus) { QStatus status = bus->UnregisterSignalHandler(this, static_cast(&WidgetBusObject::PropertyChanged), m_SignalPropertyChanged, m_ObjectPath.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister the SignalHandler")); } return status; } QStatus WidgetBusObject::Get(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_DbgTrace(("Get property was called - in WidgetBusObject class:")); if (0 == strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { return val.Set(AJPARAM_UINT16.c_str(), getInterfaceVersion()); } else if (0 == strcmp(AJ_PROPERTY_STATES.c_str(), propName)) { return m_Widget->fillStatesArg(val, m_LanguageIndx); } else if (0 == strcmp(AJ_PROPERTY_OPTPARAMS.c_str(), propName)) { return m_Widget->fillOptParamsArg(val, m_LanguageIndx); } return ER_BUS_NO_SUCH_PROPERTY; } QStatus WidgetBusObject::Set(const char* interfaceName, const char* propName, MsgArg& val) { QCC_UNUSED(interfaceName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } void WidgetBusObject::PropertyChanged(const InterfaceDescription::Member* member, const char* srcPath, Message& msg) { QCC_UNUSED(member); QCC_UNUSED(srcPath); if (msg.unwrap()->GetSender() && strcmp(msg.unwrap()->GetSender(), m_Widget->getDevice()->getDeviceBusName().c_str()) != 0) { QCC_DbgPrintf(("Received PropertyChanged signal for someone else")); return; } QCC_DbgPrintf(("Received PropertyChanged signal - reloading properties")); return m_Widget->PropertyChanged(); } QStatus WidgetBusObject::SendPropertyChangedSignal() { ControlPanelBusListener* busListener = ControlPanelService::getInstance()->getBusListener(); QStatus status = ER_OK; if (!m_SignalPropertyChanged) { QCC_DbgHLPrintf(("Can't send propertyChanged signal. Signal to set")); return ER_FAIL; } if (busListener) { const std::vector& sessionIds = busListener->getSessionIds(); for (size_t indx = 0; indx < sessionIds.size(); indx++) { status = Signal(NULL, sessionIds[indx], *m_SignalPropertyChanged, NULL, 0); if (status != ER_OK) { QCC_LogError(status, ("Could not send PropertyChanged Signal for sessionId: %s", sessionIds[indx])); } } } else { QCC_DbgHLPrintf(("No BusListener registered")); } return status; } QStatus WidgetBusObject::setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId) { if (m_Proxy && m_Proxy->GetSessionId() == sessionId) { QCC_DbgPrintf(("ProxyBusObject already set - ignoring")); return ER_OK; } if (!m_InterfaceDescription) { QCC_DbgHLPrintf(("InterfaceDescription is not set. Cannot set RemoteController")); return ER_FAIL; } if (m_Proxy) { delete m_Proxy; // delete existing proxyBusObject. create new one with new sessionId } m_Proxy = new ProxyBusObject(*bus, deviceBusName.c_str(), m_ObjectPath.c_str(), sessionId); QStatus status = m_Proxy->AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("Could not add Interface to ProxyBusobject")); } return status; } QStatus WidgetBusObject::checkVersions() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot Check Versions. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } MsgArg value; QStatus status = m_Proxy->GetProperty(m_InterfaceDescription->GetName(), AJ_PROPERTY_VERSION.c_str(), value); if (status != ER_OK) { QCC_LogError(status, ("Call to get Version Property failed")); return status; } uint16_t version = 1; status = value.Get(AJPARAM_UINT16.c_str(), &version); if (status != ER_OK) { QCC_LogError(status, ("Could not unmarshal version property")); return status; } if (getInterfaceVersion() < version) { QCC_DbgHLPrintf(("The versions of the interface are not compatible")); return ER_BUS_INTERFACE_MISMATCH; } return ER_OK; } QStatus WidgetBusObject::fillProperties() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot fill Properties. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } MsgArg allPropValues; QStatus status = m_Proxy->GetAllProperties(m_InterfaceDescription->GetName(), allPropValues); if (status != ER_OK) { QCC_LogError(status, ("Call to getAllProperties failed")); return status; } return fillAllProperties(allPropValues); } QStatus WidgetBusObject::refreshProperties() { if (!m_Proxy) { QCC_DbgHLPrintf(("Cannot refresh Properties. ProxyBusObject is not set")); return ER_BUS_PROPERTY_VALUE_NOT_SET; } WidgetProxyBusObjectListener* listener = new WidgetProxyBusObjectListener(m_Widget, this); QStatus status = m_Proxy->GetAllPropertiesAsync(m_InterfaceDescription->GetName(), listener, static_cast(&WidgetProxyBusObjectListener::GetAllPropertiesCallBack), NULL); if (status != ER_OK) { QCC_LogError(status, ("Call to getAllProperties failed")); } return status; } QStatus WidgetBusObject::fillAllProperties(MsgArg const& allPropValues) { QStatus status; do { MsgArg* allPropEntries; size_t allPropNum; CHECK_AND_BREAK(allPropValues.Get(AJPARAM_ARRAY_DICT_STR_VAR.c_str(), &allPropNum, &allPropEntries)); for (size_t i = 0; i < allPropNum; i++) { char* key; MsgArg* variant; CHECK_AND_BREAK(allPropEntries[i].Get(AJPARAM_DICT_STR_VAR.c_str(), &key, &variant)); if (strcmp(key, AJ_PROPERTY_VERSION.c_str()) == 0) { CHECK_AND_BREAK(m_Widget->readVersionArg(variant)) } else if (strcmp(key, AJ_PROPERTY_STATES.c_str()) == 0) { CHECK_AND_BREAK(m_Widget->readStatesArg(variant)) } else if (strcmp(key, AJ_PROPERTY_OPTPARAMS.c_str()) == 0) { CHECK_AND_BREAK(m_Widget->readOptParamsArg(variant)) } else { CHECK_AND_BREAK(fillProperty(key, variant)) } } } while (0); return status; } QStatus WidgetBusObject::fillProperty(char* key, MsgArg* variant) { QCC_UNUSED(key); QCC_UNUSED(variant); return ER_BUS_NO_SUCH_PROPERTY; } QStatus WidgetBusObject::Introspect(std::vector& childNodes) { QCC_UNUSED(childNodes); return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/WidgetBusObject.h000066400000000000000000000143701272147170000237550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef WIDGETBUSOBJECT_H_ #define WIDGETBUSOBJECT_H_ #include #include #include #include #include "IntrospectionNode.h" namespace ajn { namespace services { /** * WidgetBusObject class. Base class to create a BusObject for a Widget */ class WidgetBusObject : public ajn::BusObject { friend class WidgetProxyBusObjectListener; public: /** * Constructor for WidgetBusObject class * @param objectPath - objectPath of BusObject * @param langIndx - the languageIndex of the BusObject * @param status - success/failure * @param widget - the widget associated with the BusObject */ WidgetBusObject(qcc::String const& objectPath, uint16_t langIndx, QStatus& status, Widget* widget); /** * Destructor of the WidgetBusObject class */ virtual ~WidgetBusObject() = 0; /** * Get the Version of the Interface represented by this BusObject * @return - interfaceVersion */ virtual uint16_t getInterfaceVersion(); /** * Callback for Alljoyn when GetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg to fill * @return status - success/failure */ virtual QStatus Get(const char* interfaceName, const char* propName, MsgArg& val); /** * Callback for Alljoyn when SetProperty is called on this BusObject * @param interfaceName - the name of the Interface * @param propName - the name of the Property * @param val - the MsgArg that contains the new Value * @return status - success/failure */ virtual QStatus Set(const char* interfaceName, const char* propName, MsgArg& val); /** * Send a signal when a property has changed * @return status - success/failure */ virtual QStatus SendPropertyChangedSignal(); /** * Callback for PropertyChanged signal * @param member - signal received * @param srcPath - objectPath of signal * @param msg - Message received */ void PropertyChanged(const InterfaceDescription::Member* member, const char* srcPath, Message& msg); /** * Set the RemoteController to allow remote calls * @param bus - bus used to create the proxyBusObject * @param deviceBusName - busName of the device * @param sessionId - sessionId of Remote device * @return status - success/failure */ virtual QStatus setRemoteController(BusAttachment* bus, qcc::String const& deviceBusName, SessionId sessionId); /** * Check compatibility of the versions * @return status - success/failure */ virtual QStatus checkVersions(); /** * Fill the properties of the widget * @return status - success/failure */ virtual QStatus fillProperties(); /** * Refresh the properties of the widget with async call * @return status - success/failure */ virtual QStatus refreshProperties(); /** * Introspect to receive childNodes * @param childNodes - childNodes found during introspection * @return status - success/failure */ virtual QStatus Introspect(std::vector& childNodes); /** * @internal Explicitly provide implementation for virtual method. */ void Introspect(const InterfaceDescription::Member* member, Message& msg) { BusObject::Introspect(member, msg); } /** * remove the SignalHandler of the BusObject * @param bus - busAttachment used to remove the signalHandlers * @return status - success/failure */ virtual QStatus UnregisterSignalHandler(BusAttachment* bus); protected: /** * Unmarshal and parse the result for a GetAllProperties request * @param allPropValues - msrgArg with all property values * @return status - success/failure */ QStatus fillAllProperties(MsgArg const& allPropValues); /** * add the Default Interface Variables * @param intf * @return status - success/failure */ QStatus addDefaultInterfaceVariables(InterfaceDescription* intf); /** * Add the SignalHandler for propertyChanged signal * @param bus - bus used to add signal * @return status - success/failure */ virtual QStatus addSignalHandler(BusAttachment* bus); /** * Fill Property in Widget * @param key - keyName of Property * @param variant - the value of the Property * @return status - success/failure */ virtual QStatus fillProperty(char* key, MsgArg* variant); /** * Pointer to Widget represented by this BusObject */ Widget* m_Widget; /** * Pointer to ProxybusObject for this widget */ ProxyBusObject* m_Proxy; /** * The language Index of this BusObject */ uint16_t m_LanguageIndx; /** * ObjectPath of this BusObject */ qcc::String m_ObjectPath; /** * InterfaceDecription of this BusObject */ InterfaceDescription* m_InterfaceDescription; /** * The pointer used to send signal/register Signal Handler */ const ajn::InterfaceDescription::Member* m_SignalPropertyChanged; }; } //namespace services } //namespace ajn #endif /* WIDGETBUSOBJECT_H_ */ base-16.04/controlpanel/cpp/src/BusObjects/WidgetProxyBusObjectListener.cc000066400000000000000000000057711272147170000266700ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "WidgetProxyBusObjectListener.h" #include "../ControlPanelConstants.h" #include "WidgetBusObject.h" #include #include namespace ajn { namespace services { using namespace cpsConsts; WidgetProxyBusObjectListener::WidgetProxyBusObjectListener(Widget* widget, WidgetBusObject* busObject) : m_Widget(widget), m_BusObject(busObject) { } WidgetProxyBusObjectListener::~WidgetProxyBusObjectListener() { } void WidgetProxyBusObjectListener::GetAllPropertiesCallBack(QStatus status, ProxyBusObject* obj, const MsgArg& values, void* context) { QCC_UNUSED(obj); QCC_UNUSED(context); if (!m_Widget || !m_BusObject) { QCC_DbgHLPrintf(("WidgetProxyBusObjectListener does not have widget or BusObject set")); delete this; //Finished using listener - needs to be deleted return; } ControlPanelDevice* device = m_Widget->getDevice(); ControlPanelListener* listener = device ? device->getListener() : NULL; if (status != ER_OK) { QCC_DbgHLPrintf(("Something went wrong reloading properties")); if (listener) { listener->errorOccured(device, status, REFRESH_PROPERTIES, "Something went wrong reloading properties"); } delete this; //Finished using listener - needs to be deleted return; } status = m_BusObject->fillAllProperties(values); if (status != ER_OK) { QCC_LogError(status, ("Something went wrong reloading properties")); if (listener) { listener->errorOccured(device, status, REFRESH_PROPERTIES, "Something went wrong reloading properties"); } delete this; //Finished using listener - needs to be deleted return; } if (listener) { listener->signalPropertiesChanged(device, m_Widget); } delete this; //Finished using listener - needs to be deleted } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/BusObjects/WidgetProxyBusObjectListener.h000066400000000000000000000046201272147170000265220ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef WIDGETPROXYBUSOBJECTLISTENER_H_ #define WIDGETPROXYBUSOBJECTLISTENER_H_ #include #include "WidgetBusObject.h" #include namespace ajn { namespace services { /** * WidgetProxyBusObjectListener class - used as listener for GetAllProperties Async Call */ class WidgetProxyBusObjectListener : public ProxyBusObject::Listener { public: /** * Constructor of WidgetProxyBusObjectListener class * @param widget - widget getallproperties is being executed for * @param busObject - busObject being used for call */ WidgetProxyBusObjectListener(Widget* widget, WidgetBusObject* busObject); /** * Destructor of WidgetProxyBusObjectListener class */ virtual ~WidgetProxyBusObjectListener(); /** * GetAllProperties callback * @param status - status of call: success/failure * @param obj - proxybusobject used for call * @param values - response MsgArg * @param context - context passed in to call */ void GetAllPropertiesCallBack(QStatus status, ProxyBusObject* obj, const MsgArg& values, void* context); private: /** * The widget getAllProperties was being executed for */ Widget* m_Widget; /** * The BusObject getAllProperties was being executed from */ WidgetBusObject* m_BusObject; }; } /* namespace services */ } /* namespace ajn */ #endif /* WIDGETPROXYBUSOBJECTLISTENER_H_ */ base-16.04/controlpanel/cpp/src/ControlPanel.cc000066400000000000000000000233601272147170000214230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "ControlPanelConstants.h" #include "BusObjects/ControlPanelBusObject.h" #include "BusObjects/NotificationActionBusObject.h" #include "BusObjects/IntrospectionNode.h" #include #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanel* ControlPanel::createControlPanel(LanguageSet* languageSet) { if (!languageSet) { QCC_DbgHLPrintf(("Could not create ControlPanel. LanguageSet is NULL")); return NULL; } return new ControlPanel(*languageSet); } ControlPanel::ControlPanel(LanguageSet const& languageSet) : m_LanguageSet(languageSet), m_RootWidget(0), m_ControlPanelBusObject(0), m_ObjectPath(""), m_Device(0) { } ControlPanel::ControlPanel(LanguageSet const& languageSet, qcc::String objectPath, ControlPanelDevice* device) : m_LanguageSet(languageSet), m_RootWidget(0), m_ControlPanelBusObject(0), m_ObjectPath(objectPath), m_Device(device) { } ControlPanel::ControlPanel(const ControlPanel& controlPanel) : m_LanguageSet(controlPanel.m_LanguageSet) { } ControlPanel& ControlPanel::operator=(const ControlPanel& controlPanel) { QCC_UNUSED(controlPanel); return *this; } ControlPanel::~ControlPanel() { std::map::const_iterator it; for (it = m_RootWidgetMap.begin(); it != m_RootWidgetMap.end(); it++) { delete it->second; } } QStatus ControlPanel::setRootWidget(Container* rootWidget) { if (!rootWidget) { QCC_DbgHLPrintf(("Could not add a NULL rootWidget")); return ER_BAD_ARG_1; } if (m_RootWidget) { QCC_DbgHLPrintf(("Could not set the RootWidget. RootWidget already set")); return ER_BUS_PROPERTY_ALREADY_EXISTS; } m_RootWidget = rootWidget; return ER_OK; } qcc::String ControlPanel::getPanelName() const { if (m_RootWidget) { return m_RootWidget->getWidgetName(); } if (m_RootWidgetMap.size()) { return m_RootWidgetMap.begin()->second->getWidgetName(); } return ""; } Container* ControlPanel::getRootWidget() const { return m_RootWidget; } QStatus ControlPanel::registerObjects(BusAttachment* bus, qcc::String const& unitName) { if (m_ControlPanelBusObject) { QCC_DbgHLPrintf(("Could not register Object. BusObject already exists")); return ER_BUS_OBJ_ALREADY_EXISTS; } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } if (!m_RootWidget) { QCC_DbgHLPrintf(("RootWidget has not been initialized. Can't continue")); return ER_BUS_TRANSPORT_NOT_STARTED; } QStatus status = ER_OK; qcc::String objectPath = AJ_OBJECTPATH_PREFIX + unitName + "/" + m_RootWidget->getWidgetName(); m_ControlPanelBusObject = new ControlPanelBusObject(bus, objectPath.c_str(), status); if (status != ER_OK) { QCC_LogError(status, ("Could not create ControlPanelBusObject")); return status; } if (m_RootWidget->getIsDismissable()) { status = m_ControlPanelBusObject->setIsNotificationAction(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not set ControlPanel as NotificationActionBusObjects")); return status; } status = m_RootWidget->setNotificationActionBusObject(m_ControlPanelBusObject); if (status != ER_OK) { QCC_LogError(status, ("Could not set NotificationActionBusObjects")); return status; } } status = bus->RegisterBusObject(*m_ControlPanelBusObject); if (status != ER_OK) { QCC_LogError(status, ("Could not register ControlPanelBusObject.")); return status; } status = m_RootWidget->registerObjects(bus, m_LanguageSet, objectPath + "/", "", true); return status; } QStatus ControlPanel::unregisterObjects(BusAttachment* bus) { QStatus status = ER_OK; if (!m_ControlPanelBusObject && !m_RootWidget) { QCC_DbgHLPrintf(("Can not unregister. BusObjects do not exist")); return status; //this does not need to fail } if (!bus) { QCC_DbgHLPrintf(("Could not unregister Object. Bus is NULL")); return ER_BAD_ARG_1; } if (m_ControlPanelBusObject) { bus->UnregisterBusObject(*m_ControlPanelBusObject); delete m_ControlPanelBusObject; m_ControlPanelBusObject = 0; } if (m_RootWidget) { QStatus status = m_RootWidget->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister RootContainer.")); } } std::map::const_iterator it; for (it = m_RootWidgetMap.begin(); it != m_RootWidgetMap.end(); it++) { it->second->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister RootContainer for language %s", it->first.c_str())); } } return status; } QStatus ControlPanel::registerObjects(BusAttachment* bus) { if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } if (m_ControlPanelBusObject) { QCC_DbgHLPrintf(("BusObject already exists, just refreshing remote controller")); return m_ControlPanelBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); } QStatus status = ER_OK; m_ControlPanelBusObject = new ControlPanelBusObject(bus, m_ObjectPath, status); if (status != ER_OK) { QCC_LogError(status, ("Could not create ControlPanelBusObject")); return status; } status = m_ControlPanelBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = addChildren(); if (status != ER_OK) { QCC_LogError(status, ("Call to AddChildren failed")); return status; } return status; } QStatus ControlPanel::checkVersions() { if (!m_ControlPanelBusObject) { QCC_DbgHLPrintf(("ControlPanelBusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } return m_ControlPanelBusObject->checkVersions(); } QStatus ControlPanel::addChildren() { if (!m_ControlPanelBusObject) { QCC_DbgHLPrintf(("ControlPanelBusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } std::vector childNodes; QStatus status = m_ControlPanelBusObject->Introspect(childNodes); if (status != ER_OK) { QCC_LogError(status, ("Introspection failed")); return status; } for (size_t i = 0; i < childNodes.size(); i++) { qcc::String const& objectPath = childNodes[i].getObjectPath(); std::vector splitPath = ControlPanelService::SplitObjectPath(objectPath); if (splitPath.size() < 4) { return ER_FAIL; } qcc::String const& containerName = splitPath[2]; qcc::String language = splitPath[3]; std::replace(language.begin(), language.end(), '_', '-'); //languages that have '_' should be replaced with '-' m_LanguageSet.addLanguage(language); Container* container = new Container(containerName, NULL, childNodes[i].getObjectPath(), m_Device); container->setIsSecured(childNodes[i].isSecured()); m_RootWidgetMap[language] = container; } return ER_OK; } const LanguageSet& ControlPanel::getLanguageSet() const { return m_LanguageSet; } ControlPanelDevice* ControlPanel::getDevice() const { return m_Device; } const qcc::String& ControlPanel::getObjectPath() const { return m_ObjectPath; } Container* ControlPanel::getRootWidget(qcc::String const& language) const { std::map::const_iterator it; it = m_RootWidgetMap.find(language); if (it != m_RootWidgetMap.end()) { BusAttachment* bus = ControlPanelService::getInstance()->getBusAttachment(); it->second->registerObjects(bus); return it->second; } return NULL; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelBusListener.cc000066400000000000000000000062511272147170000236030ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include namespace ajn { namespace services { ControlPanelBusListener::ControlPanelBusListener() : BusListener(), SessionPortListener(), SessionListener(), m_SessionPort(0) { } ControlPanelBusListener::~ControlPanelBusListener() { } void ControlPanelBusListener::setSessionPort(ajn::SessionPort sessionPort) { m_SessionPort = sessionPort; } SessionPort ControlPanelBusListener::getSessionPort() { return m_SessionPort; } bool ControlPanelBusListener::AcceptSessionJoiner(ajn::SessionPort sessionPort, const char* joiner, const ajn::SessionOpts& opts) { QCC_UNUSED(joiner); QCC_UNUSED(opts); if (sessionPort != m_SessionPort) { return false; } QCC_DbgPrintf(("Accepting JoinSessionRequest")); return true; } void ControlPanelBusListener::SessionJoined(SessionPort sessionPort, SessionId sessionId, const char* joiner) { QCC_UNUSED(sessionPort); QCC_UNUSED(joiner); if (std::find(m_SessionIds.begin(), m_SessionIds.end(), sessionId) != m_SessionIds.end()) { return; } m_SessionIds.push_back(sessionId); } void ControlPanelBusListener::SessionMemberAdded(SessionId sessionId, const char* uniqueName) { QCC_UNUSED(uniqueName); if (std::find(m_SessionIds.begin(), m_SessionIds.end(), sessionId) != m_SessionIds.end()) { return; } m_SessionIds.push_back(sessionId); } void ControlPanelBusListener::SessionMemberRemoved(SessionId sessionId, const char* uniqueName) { QCC_UNUSED(uniqueName); std::vector::iterator it = std::find(m_SessionIds.begin(), m_SessionIds.end(), sessionId); if (it != m_SessionIds.end()) { m_SessionIds.erase(it); } } void ControlPanelBusListener::SessionLost(SessionId sessionId, SessionLostReason reason) { QCC_UNUSED(reason); std::vector::iterator it = std::find(m_SessionIds.begin(), m_SessionIds.end(), sessionId); if (it != m_SessionIds.end()) { m_SessionIds.erase(it); } } const std::vector& ControlPanelBusListener::getSessionIds() const { return m_SessionIds; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelConstants.h000066400000000000000000000130021272147170000231520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELCONSTANTS_H_ #define CONTROLPANELCONSTANTS_H_ #include #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4100. unreferenced formal parameter */ #pragma warning(push) #pragma warning(disable: 4100) #endif /* * Common Macros */ #define CHECK_AND_BREAK(x) if ((status = x)) { break; } #define CHECK_AND_RETURN(x) if ((status = x)) { return status; } namespace ajn { namespace services { namespace cpsConsts { static const uint16_t CONTROLPANELSERVICE_PORT = 1000; static const uint16_t DATE_PROPERTY_TYPE = 0; static const uint16_t TIME_PROPERTY_TYPE = 1; static const qcc::String AJ_OBJECTPATH_PREFIX = "/ControlPanel/"; static const qcc::String AJ_HTTP_OBJECTPATH_SUFFIX = "/HTTPControl"; static const qcc::String AJ_CONTROLPANEL_INTERFACE = "org.alljoyn.ControlPanel.ControlPanel"; static const qcc::String AJ_NOTIFICATIONACTION_INTERFACE = "org.alljoyn.ControlPanel.NotificationAction"; static const qcc::String AJ_HTTPCONTROL_INTERFACE = "org.alljoyn.ControlPanel.HTTPControl"; static const qcc::String AJ_SECURED_CONTAINER_INTERFACE = "org.alljoyn.ControlPanel.SecuredContainer"; static const qcc::String AJ_CONTAINER_INTERFACE = "org.alljoyn.ControlPanel.Container"; static const qcc::String AJ_SECURED_PROPERTY_INTERFACE = "org.alljoyn.ControlPanel.SecuredProperty"; static const qcc::String AJ_PROPERTY_INTERFACE = "org.alljoyn.ControlPanel.Property"; static const qcc::String AJ_SECURED_ACTION_INTERFACE = "org.alljoyn.ControlPanel.SecuredAction"; static const qcc::String AJ_ACTION_INTERFACE = "org.alljoyn.ControlPanel.Action"; static const qcc::String AJ_SECURED_DIALOG_INTERFACE = "org.alljoyn.ControlPanel.SecuredDialog"; static const qcc::String AJ_DIALOG_INTERFACE = "org.alljoyn.ControlPanel.Dialog"; static const qcc::String AJ_LABEL_INTERFACE = "org.alljoyn.ControlPanel.LabelProperty"; static const qcc::String AJ_PROPERTY_VERSION = "Version"; static const qcc::String AJ_PROPERTY_STATES = "States"; static const qcc::String AJ_PROPERTY_OPTPARAMS = "OptParams"; static const qcc::String AJ_PROPERTY_LABEL = "Label"; static const qcc::String AJ_PROPERTY_VALUE = "Value"; static const qcc::String AJ_PROPERTY_MESSAGE = "Message"; static const qcc::String AJ_PROPERTY_NUMACTIONS = "NumActions"; static const qcc::String AJ_PROPERTY_URL = "Url"; static const qcc::String AJ_SIGNAL_PROPERTIES_CHANGED = "MetadataChanged"; static const qcc::String AJ_SIGNAL_PROPERTIES_CHANGED_DESC = "Metadata Changed"; static const qcc::String AJ_SIGNAL_VALUE_CHANGED = "ValueChanged"; static const qcc::String AJ_SIGNAL_VALUE_CHANGED_DESC = "Value Changed"; static const qcc::String AJ_SIGNAL_DISMISS = "Dismiss"; static const qcc::String AJ_SIGNAL_DISMISS_DESC = "Dismiss"; static const qcc::String AJ_METHOD_EXECUTE = "Exec"; static const qcc::String AJ_METHOD_EXECUTE_DESC = "Execute"; static const qcc::String AJ_METHOD_ACTION1 = "Action1"; static const qcc::String AJ_METHOD_ACTION2 = "Action2"; static const qcc::String AJ_METHOD_ACTION3 = "Action3"; static const qcc::String AJ_METHOD_GETROOTURL = "GetRootURL"; static const qcc::String AJ_METHOD_GETROOTURL_DESC = "Get Root URL"; static const qcc::String AJPARAM_EMPTY = ""; static const qcc::String AJPARAM_VAR = "v"; static const qcc::String AJPARAM_STR = "s"; static const qcc::String AJPARAM_BOOL = "b"; static const qcc::String AJPARAM_UINT16 = "q"; static const qcc::String AJPARAM_INT16 = "n"; static const qcc::String AJPARAM_UINT32 = "u"; static const qcc::String AJPARAM_INT32 = "i"; static const qcc::String AJPARAM_UINT64 = "t"; static const qcc::String AJPARAM_INT64 = "x"; static const qcc::String AJPARAM_DOUBLE = "d"; static const qcc::String AJPARAM_DICT_UINT16_VAR = "{qv}"; static const qcc::String AJPARAM_DICT_STR_VAR = "{sv}"; static const qcc::String AJPARAM_ARRAY_DICT_UINT16_VAR = "a{qv}"; static const qcc::String AJPARAM_ARRAY_DICT_STR_VAR = "a{sv}"; static const qcc::String AJPARAM_ARRAY_UINT16 = "aq"; static const qcc::String AJPARAM_STRUCT_VAR_STR = "(vs)"; static const qcc::String AJPARAM_ARRAY_STRUCT_VAR_STR = "a(vs)"; static const qcc::String AJPARAM_STRUCT_VAR_VAR_VAR = "(vvv)"; static const qcc::String AJPARAM_DATE_OR_TIME = "(q(qqq))"; static const qcc::String AJ_ERROR_UNKNOWN = "Unknown Error"; static const qcc::String AJ_ERROR_UNKNOWN_MESSAGE = "An Unknown Error occured"; enum OPT_PARAM_KEYS { LABEL_KEY = 0, BGCOLOR_KEY = 1, HINT_KEY = 2, UNIT_MEASURE = 3, CONSTRAINT_LIST = 4, CONSTRAINT_RANGE = 5, LABEL_ACTION1 = 6, LABEL_ACTION2 = 7, LABEL_ACTION3 = 8, NUM_OPT_PARAMS = 9 }; } //namespace cpsConsts } //namespace services } //namespace ajn #endif base-16.04/controlpanel/cpp/src/ControlPanelControllee.cc000066400000000000000000000051431272147170000234510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelControllee::ControlPanelControllee() { } ControlPanelControllee::~ControlPanelControllee() { } QStatus ControlPanelControllee::registerObjects(BusAttachment* bus) { QStatus status = ER_OK; for (size_t indx = 0; indx < m_Units.size(); indx++) { status = m_Units[indx]->registerObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the Units")); return status; } } return status; } QStatus ControlPanelControllee::unregisterObjects(BusAttachment* bus) { QStatus returnStatus = ER_OK; for (size_t indx = 0; indx < m_Units.size(); indx++) { QStatus status = m_Units[indx]->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the Units")); returnStatus = status; } } return returnStatus; } QStatus ControlPanelControllee::addControlPanelUnit(ControlPanelControlleeUnit* unit) { if (!unit) { QCC_DbgHLPrintf(("Could not add a NULL unit")); return ER_BAD_ARG_1; } m_Units.push_back(unit); return ER_OK; } const std::vector& ControlPanelControllee::getControlleeUnits() const { return m_Units; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelControlleeUnit.cc000066400000000000000000000121601272147170000243060ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include #include "ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelControlleeUnit::ControlPanelControlleeUnit(qcc::String const& unitName) : m_UnitName(unitName), m_HttpControl(0) { } ControlPanelControlleeUnit::~ControlPanelControlleeUnit() { } const qcc::String& ControlPanelControlleeUnit::getUnitName() const { return m_UnitName; } QStatus ControlPanelControlleeUnit::addControlPanel(ControlPanel* controlPanel) { if (!controlPanel) { QCC_DbgHLPrintf(("Could not add a NULL controlPanel")); return ER_BAD_ARG_1; } m_ControlPanels.push_back(controlPanel); return ER_OK; } const std::vector& ControlPanelControlleeUnit::getControlPanels() const { return m_ControlPanels; } QStatus ControlPanelControlleeUnit::addNotificationAction(NotificationAction* notificationAction) { if (!notificationAction) { QCC_DbgHLPrintf(("Could not add a NULL notificationAction")); return ER_BAD_ARG_1; } m_NotificationActions.push_back(notificationAction); return ER_OK; } const std::vector& ControlPanelControlleeUnit::getNotificationActions() const { return m_NotificationActions; } QStatus ControlPanelControlleeUnit::setHttpControl(HttpControl* httpControl) { if (!httpControl) { QCC_DbgHLPrintf(("Could not add a NULL httpControl")); return ER_BAD_ARG_1; } if (m_HttpControl) { QCC_DbgHLPrintf(("Could not set httpControl. HttpControl already set")); return ER_BUS_PROPERTY_ALREADY_EXISTS; } m_HttpControl = httpControl; return ER_OK; } const HttpControl* ControlPanelControlleeUnit::getHttpControl() const { return m_HttpControl; } QStatus ControlPanelControlleeUnit::registerObjects(BusAttachment* bus) { QStatus status = ER_OK; if (m_HttpControl) { status = m_HttpControl->registerObjects(bus, m_UnitName); if (status != ER_OK) { QCC_LogError(status, ("Could not register the HttpControl")); return status; } } for (size_t indx = 0; indx < m_ControlPanels.size(); indx++) { status = m_ControlPanels[indx]->registerObjects(bus, m_UnitName); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the ControlPanels")); return status; } } for (size_t indx = 0; indx < m_NotificationActions.size(); indx++) { status = m_NotificationActions[indx]->registerObjects(bus, m_UnitName); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the ControlPanels")); return status; } } return status; } QStatus ControlPanelControlleeUnit::unregisterObjects(BusAttachment* bus) { QStatus returnStatus = ER_OK; if (m_HttpControl) { QStatus status = m_HttpControl->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister the HttpControl")); returnStatus = status; } } for (size_t indx = 0; indx < m_ControlPanels.size(); indx++) { QStatus status = m_ControlPanels[indx]->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the ControlPanels")); returnStatus = status; } } for (size_t indx = 0; indx < m_NotificationActions.size(); indx++) { QStatus status = m_NotificationActions[indx]->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not register Objects for the ControlPanels")); returnStatus = status; } } return returnStatus; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelController.cc000066400000000000000000000170211272147170000234640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include "ControlPanelConstants.h" #include #include #include #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelController::ControlPanelController() { } ControlPanelController::~ControlPanelController() { } ControlPanelDevice* ControlPanelController::createControllableDevice(qcc::String const& sender, const AboutObjectDescription& objectDescs) { QCC_DbgTrace(("ControlPanelController::createControllableDevice")); if (sender.length() == 0) { QCC_DbgHLPrintf(("Sender cannot be empty")); return NULL; } ControlPanelDevice* device = 0; std::map::iterator iter; if ((iter = m_ControllableDevices.find(sender)) != m_ControllableDevices.end()) { QCC_DbgPrintf(("ControlPanelDevice for this sender already exists")); device = iter->second; } //AboutClient::ObjectDescriptions::const_iterator it; qcc::String ControlPanelPrefix = "/ControlPanel/"; bool hasControlPanel = false; size_t numPaths = objectDescs.GetPaths(NULL, 0); const char** paths = new const char*[numPaths]; numPaths = objectDescs.GetPaths(paths, numPaths); QCC_DbgPrintf(("numPaths=%d", numPaths)); for (size_t i = 0; i < numPaths; i++) { QCC_DbgPrintf(("paths[%d]=%s", i, paths[i])); qcc::String key = qcc::String(paths[i]); if (key.compare_std(0, ControlPanelPrefix.size(), ControlPanelPrefix) == 0) { if (!device) { device = getControllableDevice(sender); } size_t numInterfaces = objectDescs.GetInterfaces(paths[i], NULL, 0); const char** interfaces = new const char*[numInterfaces]; numInterfaces = objectDescs.GetInterfaces(paths[i], interfaces, numInterfaces); QCC_DbgPrintf(("numInterfaces=%d", numInterfaces)); std::vector vecInterfaces; for (size_t j = 0; j < numInterfaces; j++) { QCC_DbgPrintf(("interfaces[%d]=%s", j, interfaces[j])); vecInterfaces.push_back(qcc::String(interfaces[j])); } if (device->addControlPanelUnit(key, vecInterfaces)) { QCC_DbgPrintf(("Adding ControlPanelUnit for objectPath: %s", key.c_str())); hasControlPanel = true; } delete [] interfaces; } } delete [] paths; if (hasControlPanel) { QCC_DbgPrintf(("Calling startSession for device %s", sender.c_str())); device->startSessionAsync(); } return device; } ControlPanelDevice* ControlPanelController::createControllableDevice(qcc::String const& sender, const AnnounceHandler::ObjectDescriptions& objectDescs) { if (sender.length() == 0) { QCC_DbgHLPrintf(("Sender cannot be empty")); return NULL; } ControlPanelDevice* device = 0; std::map::iterator iter; if ((iter = m_ControllableDevices.find(sender)) != m_ControllableDevices.end()) { QCC_DbgPrintf(("ControlPanelDevice for this sender already exists")); device = iter->second; } AboutClient::ObjectDescriptions::const_iterator it; qcc::String ControlPanelPrefix = "/ControlPanel/"; bool hasControlPanel = false; for (it = objectDescs.begin(); it != objectDescs.end(); ++it) { qcc::String key = it->first; if (key.compare_std(0, ControlPanelPrefix.size(), ControlPanelPrefix) == 0) { if (!device) { device = getControllableDevice(sender); } if (device->addControlPanelUnit(key, it->second)) { QCC_DbgPrintf(("Adding ControlPanelUnit for objectPath: %s", key.c_str())); hasControlPanel = true; } } } if (hasControlPanel) { QCC_DbgPrintf(("Calling startSession for device %s", sender.c_str())); device->startSessionAsync(); } return device; } ControlPanelDevice* ControlPanelController::getControllableDevice(qcc::String const& sender) { if (sender.length() == 0) { QCC_DbgHLPrintf(("Sender cannot be empty")); return NULL; } std::map::iterator iter; if ((iter = m_ControllableDevices.find(sender)) != m_ControllableDevices.end()) { QCC_DbgPrintf(("ControlPanelDevice for this sender already exists")); return iter->second; } ControlPanelDevice* newDevice = new ControlPanelDevice(sender); m_ControllableDevices[sender] = newDevice; return newDevice; } QStatus ControlPanelController::deleteControllableDevice(qcc::String const& sender) { QCC_DbgTrace(("ControlPanelController::deleteControllableDevice")); if (sender.length() == 0) { QCC_DbgHLPrintf(("Sender cannot be empty")); return ER_BAD_ARG_1; } std::map::iterator iter; if ((iter = m_ControllableDevices.find(sender)) == m_ControllableDevices.end()) { QCC_DbgHLPrintf(("Sender does not exist")); return ER_BAD_ARG_1; } ControlPanelDevice* device = iter->second; QStatus status = device->shutdownDevice(); if (status != ER_OK) { QCC_LogError(status, ("Could not end Session successfully")); } m_ControllableDevices.erase(iter); delete device; return status; } QStatus ControlPanelController::deleteAllControllableDevices() { QCC_DbgTrace(("ControlPanelController::deleteAllControllableDevices")); QStatus returnStatus = ER_OK; std::map::iterator iter; std::map::iterator deliter; for (iter = m_ControllableDevices.begin(); iter != m_ControllableDevices.end();) { ControlPanelDevice* device = iter->second; deliter = iter++; QStatus status = device->shutdownDevice(); if (status != ER_OK) { QCC_LogError(status, ("Could not shutdown Device successfully")); returnStatus = status; } m_ControllableDevices.erase(deliter); delete device; } return returnStatus; } const std::map& ControlPanelController::getControllableDevices() const { return m_ControllableDevices; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelControllerUnit.cc000066400000000000000000000210461272147170000243260ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include #include "ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelControllerUnit::ControlPanelControllerUnit(qcc::String const& unitName, ControlPanelDevice* device) : m_UnitName(unitName), m_Device(device), m_HttpControl(0) { } ControlPanelControllerUnit::~ControlPanelControllerUnit() { } QStatus ControlPanelControllerUnit::addHttpControl(qcc::String const& objectPath) { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } if (m_HttpControl) { QCC_DbgPrintf(("HttpControl for this unit already exists")); return ER_OK; } m_HttpControl = new HttpControl(objectPath, m_Device); QStatus status = ER_OK; if (m_Device->getSessionId() != 0) { status = m_HttpControl->registerObjects(busAttachment); } return status; } QStatus ControlPanelControllerUnit::addControlPanel(qcc::String const& objectPath, qcc::String const& panelName) { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } std::map::iterator it; ControlPanel* controlPanel = 0; if ((it = m_ControlPanels.find(panelName)) == m_ControlPanels.end()) { LanguageSet myLanguages(m_UnitName + "-CP-" + panelName); LanguageSets::add(myLanguages.getLanguageSetName(), myLanguages); controlPanel = new ControlPanel(*LanguageSets::get(myLanguages.getLanguageSetName()), objectPath, m_Device); m_ControlPanels[panelName] = controlPanel; } else { QCC_DbgPrintf(("ControlPanel for %s already exists", panelName.c_str())); controlPanel = it->second; } if (m_Device->getSessionId() != 0) { controlPanel->registerObjects(busAttachment); } return ER_OK; } QStatus ControlPanelControllerUnit::addNotificationAction(qcc::String const& objectPath, qcc::String const& actionName) { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } std::map::iterator it; NotificationAction* notificationAction = 0; if ((it = m_NotificationActions.find(actionName)) == m_NotificationActions.end()) { LanguageSet myLanguages(m_UnitName + "-NA-" + actionName); LanguageSets::add(myLanguages.getLanguageSetName(), myLanguages); notificationAction = new NotificationAction(*LanguageSets::get(myLanguages.getLanguageSetName()), objectPath, m_Device); m_NotificationActions[actionName] = notificationAction; } else { QCC_DbgPrintf(("NotificationAction for %s already exists", actionName.c_str())); notificationAction = it->second; } QStatus status = ER_OK; if (m_Device->getSessionId() != 0) { status = notificationAction->registerObjects(busAttachment); if (status != ER_OK) { QCC_LogError(status, ("Registering NotificationAction Objects failed")); } } return status; } QStatus ControlPanelControllerUnit::removeNotificationAction(qcc::String const& actionName) { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); QStatus status = ER_OK; std::map::iterator it; if ((it = m_NotificationActions.find(actionName)) != m_NotificationActions.end()) { NotificationAction* notificationAction = it->second; m_NotificationActions.erase(it); status = notificationAction->unregisterObjects(busAttachment); delete notificationAction; } return status; } QStatus ControlPanelControllerUnit::registerObjects() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } busAttachment->EnableConcurrentCallbacks(); QStatus status; QStatus returnStatus = ER_OK; if (m_HttpControl) { returnStatus = m_HttpControl->registerObjects(busAttachment); } std::map::iterator it; for (it = m_ControlPanels.begin(); it != m_ControlPanels.end(); it++) { if ((status = it->second->registerObjects(busAttachment)) != ER_OK) { QCC_LogError(status, ("Registering ControlPanel Objects failed")); returnStatus = status; } } return returnStatus; } QStatus ControlPanelControllerUnit::shutdownUnit() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (busAttachment) { busAttachment->EnableConcurrentCallbacks(); } std::map::iterator cpIter; std::map::iterator cpDeliter; for (cpIter = m_ControlPanels.begin(); cpIter != m_ControlPanels.end();) { ControlPanel* controlpanel = cpIter->second; cpDeliter = cpIter++; m_ControlPanels.erase(cpDeliter); controlpanel->unregisterObjects(busAttachment); delete controlpanel; } std::map::iterator naIter; std::map::iterator naDeliter; for (naIter = m_NotificationActions.begin(); naIter != m_NotificationActions.end();) { NotificationAction* notificationAction = naIter->second; naDeliter = naIter++; m_NotificationActions.erase(naDeliter); notificationAction->unregisterObjects(busAttachment); delete notificationAction; } if (m_HttpControl) { m_HttpControl->unregisterObjects(busAttachment); delete m_HttpControl; m_HttpControl = 0; } return ER_OK; } ControlPanelDevice* ControlPanelControllerUnit::getDevice() const { return m_Device; } const qcc::String& ControlPanelControllerUnit::getUnitName() const { return m_UnitName; } const std::map& ControlPanelControllerUnit::getControlPanels() const { return m_ControlPanels; } const std::map& ControlPanelControllerUnit::getNotificationActions() const { return m_NotificationActions; } ControlPanel* ControlPanelControllerUnit::getControlPanel(qcc::String const& panelName) const { std::map::const_iterator it; if ((it = m_ControlPanels.find(panelName)) != m_ControlPanels.end()) { return it->second; } return NULL; } NotificationAction* ControlPanelControllerUnit::getNotificationAction(qcc::String const& actionName) const { std::map::const_iterator it; if ((it = m_NotificationActions.find(actionName)) != m_NotificationActions.end()) { return it->second; } return NULL; } HttpControl* ControlPanelControllerUnit::getHttpControl() const { return m_HttpControl; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelDevice.cc000066400000000000000000000263541272147170000225510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelDevice::ControlPanelDevice(qcc::String const& deviceBusName) : m_DeviceBusName(deviceBusName), m_SessionHandler(this), m_Listener(0) { } ControlPanelDevice::~ControlPanelDevice() { } QStatus ControlPanelDevice::startSessionAsync() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } busAttachment->EnableConcurrentCallbacks(); if (m_SessionHandler.getSessionId() != 0) { QCC_DbgPrintf(("Session already started, firing Listener")); ControlPanelListener* listener = getListener(); if (listener) { listener->sessionEstablished(this); } return ER_OK; } SessionOpts opts(SessionOpts::TRAFFIC_MESSAGES, false, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY); QStatus status = busAttachment->JoinSessionAsync(m_DeviceBusName.c_str(), (ajn::SessionPort)CONTROLPANELSERVICE_PORT, &m_SessionHandler, opts, &m_SessionHandler, NULL); if (status != ER_OK) { QCC_LogError(status, ("Unable to JoinSession with %s", m_DeviceBusName.c_str())); } return status; } QStatus ControlPanelDevice::startSession() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } busAttachment->EnableConcurrentCallbacks(); if (m_SessionHandler.getSessionId() != 0) { QCC_DbgPrintf(("Session already started, firing Listener")); ControlPanelListener* listener = getListener(); if (listener) { listener->sessionEstablished(this); } return ER_OK; } SessionOpts opts(SessionOpts::TRAFFIC_MESSAGES, false, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY); SessionId sessionId; ajn::SessionPort port = CONTROLPANELSERVICE_PORT; QStatus status = busAttachment->JoinSession(m_DeviceBusName.c_str(), port, &m_SessionHandler, sessionId, opts); if (status != ER_OK) { QCC_LogError(status, ("Unable to JoinSession with %s", m_DeviceBusName.c_str())); } m_SessionHandler.JoinSessionCB(status, sessionId, opts, this); return status; } QStatus ControlPanelDevice::endSession() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (!busAttachment) { QCC_DbgHLPrintf(("BusAttachment is not set")); return ER_BUS_BUS_NOT_STARTED; } SessionId sessionId = m_SessionHandler.getSessionId(); if (sessionId == 0) { QCC_DbgPrintf(("Session not started. Can't end Session")); return ER_OK; } QStatus status = busAttachment->LeaveSession(sessionId); if (status != ER_OK) { QCC_LogError(status, ("Unable to LeaveSession with %s", m_DeviceBusName.c_str())); } return status; } QStatus ControlPanelDevice::shutdownDevice() { QStatus status = endSession(); if (status != ER_OK) { QCC_LogError(status, ("Call to endSession failed")); } std::map::iterator iter; std::map::iterator deliter; for (iter = m_DeviceUnits.begin(); iter != m_DeviceUnits.end();) { ControlPanelControllerUnit* unit = iter->second; deliter = iter++; m_DeviceUnits.erase(deliter); unit->shutdownUnit(); delete unit; } return status; } void ControlPanelDevice::handleSessionJoined() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (busAttachment) { busAttachment->EnableConcurrentCallbacks(); } ControlPanelListener* listener = getListener(); std::map::iterator iter; for (iter = m_DeviceUnits.begin(); iter != m_DeviceUnits.end(); iter++) { QStatus status = iter->second->registerObjects(); if (status != ER_OK) { if (listener) { listener->errorOccured(this, status, REGISTER_OBJECTS, "Could not register Objects for this Device's Units"); } } } if (listener) { listener->sessionEstablished(this); } } ControlPanelControllerUnit* ControlPanelDevice::getControlPanelUnit(qcc::String const& objectPath) { qcc::String unitName = ""; qcc::String panelName = ""; ControlPanelControllerUnit* unit = getControlPanelUnit(objectPath, unitName, panelName, false); if (!unit) { QCC_DbgHLPrintf(("Could not retrieve ControlPanelUnit")); } return unit; } ControlPanelControllerUnit* ControlPanelDevice::addControlPanelUnit(qcc::String const& objectPath, std::vector const& interfaces) { bool hasControlPanel = false; bool hasHttpControl = false; for (size_t i = 0; i < interfaces.size(); i++) { if (interfaces[i].compare(AJ_CONTROLPANEL_INTERFACE) == 0) { hasControlPanel = true; QCC_DbgPrintf(("ObjectPath contains ControlPanel")); } if (interfaces[i].compare(AJ_HTTPCONTROL_INTERFACE) == 0) { hasHttpControl = true; QCC_DbgPrintf(("ObjectPath contains HttpControl")); } } if (!hasControlPanel && !hasHttpControl) { QCC_DbgHLPrintf(("ObjectPath does not contain a ControlPanel or HttpControl")); return NULL; } qcc::String unitName = ""; qcc::String panelName = ""; ControlPanelControllerUnit* unit = getControlPanelUnit(objectPath, unitName, panelName); if (!unit) { QCC_DbgHLPrintf(("Could not add ControlPanelUnit")); return NULL; } if (hasHttpControl) { unit->addHttpControl(objectPath); } if (hasControlPanel) { unit->addControlPanel(objectPath, panelName); } return unit; } ControlPanelListener* ControlPanelDevice::getListener() const { if (m_Listener) { return m_Listener; } return ControlPanelService::getInstance()->getControlPanelListener(); } QStatus ControlPanelDevice::setListener(ControlPanelListener* listener) { if (!listener) { QCC_DbgHLPrintf(("Listener cannot be NULL")); return ER_BAD_ARG_1; } m_Listener = listener; return ER_OK; } ControlPanelControllerUnit* ControlPanelDevice::getControlPanelUnit(qcc::String const& objectPath, qcc::String& unitName, qcc::String& panel, bool createIfNotFound) { std::vector splitObjectPath = ControlPanelService::SplitObjectPath(objectPath); if (splitObjectPath.size() < 3) { QCC_DbgHLPrintf(("ObjectPath is unexpected size")); return NULL; } unitName = splitObjectPath[1]; panel = splitObjectPath[2]; std::map::iterator it; if ((it = m_DeviceUnits.find(unitName)) != m_DeviceUnits.end()) { return it->second; } else if (createIfNotFound) { QCC_DbgPrintf(("Creating new unit %s", unitName.c_str())); ControlPanelControllerUnit* unit = new ControlPanelControllerUnit(unitName, this); m_DeviceUnits[unitName] = unit; return unit; } //Unit not found in map and createIfNotFound is false return NULL; } NotificationAction* ControlPanelDevice::addNotificationAction(qcc::String const& objectPath) { if (!objectPath.size()) { QCC_DbgHLPrintf(("Cannot add a Notification Action. ObjectPath is empty")); return NULL; } if (m_SessionHandler.getSessionId() == 0) { QCC_DbgHLPrintf(("Cannot add a Notification Action. Device not in session")); return NULL; } qcc::String unitName = ""; qcc::String actionName = ""; ControlPanelControllerUnit* unit = getControlPanelUnit(objectPath, unitName, actionName); if (!unit) { QCC_DbgHLPrintf(("Could not add ControlPanelUnit")); return NULL; } QStatus status = unit->addNotificationAction(objectPath, actionName); if (status != ER_OK) { QCC_LogError(status, ("Could not add NotificationAction")); return NULL; } return unit->getNotificationAction(actionName); } QStatus ControlPanelDevice::removeNotificationAction(NotificationAction* notificationAction) { if (!notificationAction) { QCC_DbgHLPrintf(("Cannot remove the NotificationAction. NotificationAction is NULL")); return ER_BAD_ARG_1; } qcc::String objectPath = notificationAction->getObjectPath(); if (!objectPath.size()) { QCC_DbgHLPrintf(("Cannot remove the NotificationAction. The ObjectPath is empty")); return ER_BAD_ARG_1; } qcc::String unitName = ""; qcc::String actionName = ""; ControlPanelControllerUnit* unit = getControlPanelUnit(objectPath, unitName, actionName, false); if (!unit) { QCC_DbgHLPrintf(("Unit for NotificationAction does not exist")); return ER_BAD_ARG_1; } return unit->removeNotificationAction(actionName); } const qcc::String& ControlPanelDevice::getDeviceBusName() const { return m_DeviceBusName; } const ajn::SessionId ControlPanelDevice::getSessionId() const { return m_SessionHandler.getSessionId(); } const std::map& ControlPanelDevice::getDeviceUnits() const { return m_DeviceUnits; } void ControlPanelDevice::getAllControlPanels(std::vector& controlPanelsVec) { controlPanelsVec.clear(); std::map::iterator iter; for (iter = m_DeviceUnits.begin(); iter != m_DeviceUnits.end(); iter++) { std::map controlPanels = iter->second->getControlPanels(); std::map::iterator it; for (it = controlPanels.begin(); it != controlPanels.end(); it++) { controlPanelsVec.push_back(it->second); } } } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelService.cc000066400000000000000000000212041272147170000227370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace qcc; using namespace cpsConsts; ControlPanelService* ControlPanelService::s_Instance(0); uint16_t const ControlPanelService::CONTROLPANEL_SERVICE_VERSION = 1; ControlPanelService* ControlPanelService::getInstance() { if (!s_Instance) { s_Instance = new ControlPanelService(); } return s_Instance; } ControlPanelService::ControlPanelService() : m_Bus(0), m_BusListener(0), m_ControlPanelControllee(0), m_ControlPanelController(0), m_ControlPanelListener(0) { } ControlPanelService::~ControlPanelService() { QCC_DbgPrintf(("Shutting down")); if (m_BusListener) { if (m_Bus) { m_Bus->UnregisterBusListener(*m_BusListener); } delete m_BusListener; m_BusListener = 0; } if (this == s_Instance) { s_Instance = 0; } } uint16_t ControlPanelService::getVersion() { return CONTROLPANEL_SERVICE_VERSION; } QStatus ControlPanelService::initControllee(BusAttachment* bus, ControlPanelControllee* controlPanelControllee) { QCC_DbgPrintf(("Initializing Controllee")); if (!bus) { QCC_DbgHLPrintf(("Bus cannot be NULL")); return ER_BAD_ARG_1; } if (!bus->IsStarted()) { QCC_DbgHLPrintf(("Bus is not started")); return ER_BAD_ARG_1; } if (!bus->IsConnected()) { QCC_DbgHLPrintf(("Bus is not connected")); return ER_BAD_ARG_1; } if (m_Bus && m_Bus->GetUniqueName().compare(bus->GetUniqueName()) != 0) { QCC_DbgHLPrintf(("Bus is already set to different BusAttachment")); return ER_BAD_ARG_1; } if (!controlPanelControllee) { QCC_DbgHLPrintf(("ControlPanelControllee cannot be null")); return ER_BAD_ARG_2; } if (m_ControlPanelControllee) { QCC_DbgHLPrintf(("ControlPanelControllee already initialized")); return ER_BUS_OBJ_ALREADY_EXISTS; } if (m_BusListener) { QCC_DbgHLPrintf(("BusListener already initialized")); return ER_BUS_OBJ_ALREADY_EXISTS; } m_Bus = bus; m_ControlPanelControllee = controlPanelControllee; QStatus status = controlPanelControllee->registerObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not register the BusObjects")); return status; } m_BusListener = new ControlPanelBusListener(); m_BusListener->setSessionPort(CONTROLPANELSERVICE_PORT); m_Bus->RegisterBusListener(*m_BusListener); SessionPort servicePort = CONTROLPANELSERVICE_PORT; SessionOpts sessionOpts(SessionOpts::TRAFFIC_MESSAGES, false, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY); status = m_Bus->BindSessionPort(servicePort, sessionOpts, *m_BusListener); if (status != ER_OK) { QCC_LogError(status, ("Could not bind Session Port successfully")); return status; } QCC_DbgPrintf(("Initialized Controllee successfully")); return status; } QStatus ControlPanelService::shutdownControllee() { if (!m_ControlPanelControllee) { QCC_DbgHLPrintf(("ControlPanelControllee not initialized. Returning")); return ER_OK; } if (!m_Bus) { QCC_DbgHLPrintf(("Bus not set.")); return ER_BUS_BUS_NOT_STARTED; } if (m_BusListener) { m_Bus->UnregisterBusListener(*m_BusListener); delete m_BusListener; m_BusListener = 0; } TransportMask transportMask = TRANSPORT_ANY; SessionPort sp = CONTROLPANELSERVICE_PORT; SessionOpts opts(SessionOpts::TRAFFIC_MESSAGES, false, SessionOpts::PROXIMITY_ANY, transportMask); QStatus returnStatus = ER_OK; QStatus status = m_Bus->UnbindSessionPort(sp); if (status != ER_OK) { QCC_LogError(status, ("Could not unbind the SessionPort")); returnStatus = status; } status = m_ControlPanelControllee->unregisterObjects(m_Bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister the BusObjects")); returnStatus = status; } m_ControlPanelControllee = 0; return returnStatus; } QStatus ControlPanelService::initController(BusAttachment* bus, ControlPanelController* controlPanelController, ControlPanelListener* controlPanelListener) { QCC_DbgTrace(("Initializing Controller")); if (!bus) { QCC_DbgHLPrintf(("Bus cannot be NULL")); return ER_BAD_ARG_1; } if (!bus->IsStarted()) { QCC_DbgHLPrintf(("Bus is not started")); return ER_BAD_ARG_1; } if (!bus->IsConnected()) { QCC_DbgHLPrintf(("Bus is not connected")); return ER_BAD_ARG_1; } if (m_Bus && m_Bus->GetUniqueName().compare(bus->GetUniqueName()) != 0) { QCC_DbgHLPrintf(("Bus is already set to different BusAttachment")); return ER_BAD_ARG_1; } if (!controlPanelController) { QCC_DbgHLPrintf(("ControlPanelController cannot be null")); return ER_BAD_ARG_2; } if (m_ControlPanelController) { QCC_DbgHLPrintf(("ControlPanelController already initialized")); return ER_BUS_OBJ_ALREADY_EXISTS; } if (!controlPanelListener) { QCC_DbgHLPrintf(("ControlPanelListener cannot be null")); return ER_BAD_ARG_3; } if (m_ControlPanelListener) { QCC_DbgHLPrintf(("m_ControlPanelListener already initialized")); return ER_BUS_OBJ_ALREADY_EXISTS; } m_Bus = bus; m_ControlPanelController = controlPanelController; m_ControlPanelListener = controlPanelListener; QCC_DbgPrintf(("Initialized Controller successfully")); return ER_OK; } QStatus ControlPanelService::shutdownController() { if (!m_ControlPanelController) { QCC_DbgHLPrintf(("ControlPanelControllee not initialized. Returning")); return ER_OK; } if (!m_Bus) { QCC_DbgHLPrintf(("Bus not set.")); return ER_BUS_BUS_NOT_STARTED; } QStatus status = m_ControlPanelController->deleteAllControllableDevices(); if (status != ER_OK) { QCC_DbgHLPrintf(("Could not stop all Controllable Devices")); } m_ControlPanelController = 0; m_ControlPanelListener = 0; return status; } QStatus ControlPanelService::shutdown() { QStatus returnStatus = ER_OK; QStatus status = shutdownController(); if (status != ER_OK) { returnStatus = status; QCC_DbgHLPrintf(("Could not shutdown Controller successfully")); } status = shutdownControllee(); if (status != ER_OK) { returnStatus = status; QCC_DbgHLPrintf(("Could not shutdown Controllee successfully")); } m_Bus = 0; return returnStatus; } BusAttachment* ControlPanelService::getBusAttachment() { return m_Bus; } ControlPanelBusListener* ControlPanelService::getBusListener() const { return m_BusListener; } ControlPanelListener* ControlPanelService::getControlPanelListener() const { return m_ControlPanelListener; } std::vector ControlPanelService::SplitObjectPath(qcc::String const& objectPath) { std::vector results; size_t prev = 0; size_t next = 0; while ((next = objectPath.find_first_of("/", prev)) != qcc::String::npos) { if (next - prev != 0) { results.push_back(objectPath.substr(prev, next - prev)); } prev = next + 1; } if (prev < objectPath.size()) { results.push_back(objectPath.substr(prev)); } return results; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/ControlPanelSessionHandler.cc000066400000000000000000000053201272147170000242610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "ControlPanelConstants.h" #include #include namespace ajn { namespace services { using namespace cpsConsts; ControlPanelSessionHandler::ControlPanelSessionHandler(ControlPanelDevice* device) : m_SessionId(0), m_Device(device) { } ControlPanelSessionHandler::~ControlPanelSessionHandler() { } void ControlPanelSessionHandler::SessionLost(ajn::SessionId sessionId, ajn::SessionListener::SessionLostReason reason) { QCC_UNUSED(sessionId); //session id only used in debug build QCC_UNUSED(reason); QCC_DbgPrintf(("Session lost for sessionId: %u", sessionId)); m_SessionId = 0; ControlPanelListener* listener = m_Device->getListener(); if (listener) { listener->sessionLost(m_Device); } } void ControlPanelSessionHandler::JoinSessionCB(QStatus status, ajn::SessionId id, const ajn::SessionOpts& opts, void* context) { QCC_UNUSED(opts); QCC_UNUSED(context); if (status != ER_OK) { QCC_LogError(status, ("Joining session failed.")); ControlPanelListener* listener = m_Device->getListener(); if (listener) { listener->errorOccured(m_Device, status, SESSION_JOIN, "Could not join session"); } return; } QCC_DbgPrintf(("Joining session succeeded. SessionId: %u", id)); m_SessionId = id; m_Device->handleSessionJoined(); } ajn::SessionId ControlPanelSessionHandler::getSessionId() const { return m_SessionId; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/LanguageSet.cc000066400000000000000000000033241272147170000212200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include namespace ajn { namespace services { LanguageSet::LanguageSet(qcc::String const& languageSetName) : m_LanguageSetName(languageSetName) { } LanguageSet::~LanguageSet() { } const qcc::String& LanguageSet::getLanguageSetName() const { return m_LanguageSetName; } const size_t LanguageSet::getNumLanguages() const { return m_Languages.size(); } void LanguageSet::addLanguage(qcc::String const& language) { if (std::find(m_Languages.begin(), m_Languages.end(), language) == m_Languages.end()) { m_Languages.push_back(language); } } const std::vector& LanguageSet::getLanguages() const { return m_Languages; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/LanguageSets.cc000066400000000000000000000032141272147170000214010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include namespace ajn { namespace services { using namespace qcc; std::map LanguageSets::languageSets; LanguageSets::LanguageSets() { } LanguageSets::~LanguageSets() { } void LanguageSets::add(String const& languageSetName, LanguageSet const& languageSet) { languageSets.insert(std::pair(languageSetName, languageSet)); } LanguageSet* LanguageSets::get(String const& languageSetName) { std::map::iterator it; if ((it = languageSets.find(languageSetName)) != languageSets.end()) { return &it->second; } return 0; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/NotificationAction.cc000066400000000000000000000237651272147170000226200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "ControlPanelConstants.h" #include "BusObjects/NotificationActionBusObject.h" #include namespace ajn { namespace services { using namespace cpsConsts; NotificationAction* NotificationAction::createNotificationAction(LanguageSet* languageSet) { if (!languageSet) { QCC_DbgHLPrintf(("Could not create NotificationAction. LanguageSet is NULL")); return NULL; } return new NotificationAction(*languageSet); } NotificationAction::NotificationAction(LanguageSet const& languageSet) : m_LanguageSet(languageSet), m_RootWidget(0), m_NotificationActionBusObject(0), m_ObjectPath(""), m_Device(0) { } NotificationAction::NotificationAction(LanguageSet const& languageSet, qcc::String objectPath, ControlPanelDevice* device) : m_LanguageSet(languageSet), m_RootWidget(0), m_NotificationActionBusObject(0), m_ObjectPath(objectPath), m_Device(device) { } NotificationAction::NotificationAction(const NotificationAction& notificationAction) : m_LanguageSet(notificationAction.m_LanguageSet) { } NotificationAction& NotificationAction::operator=(const NotificationAction& notificationAction) { QCC_UNUSED(notificationAction); return *this; } NotificationAction::~NotificationAction() { std::map::const_iterator it; for (it = m_RootWidgetMap.begin(); it != m_RootWidgetMap.end(); it++) { delete it->second; } } QStatus NotificationAction::setRootWidget(RootWidget* rootWidget) { if (!rootWidget) { QCC_DbgHLPrintf(("Could not add a NULL rootWidget")); return ER_BAD_ARG_1; } if (m_RootWidget) { QCC_DbgHLPrintf(("Could not set RootWidget. RootWidget already set")); return ER_BUS_PROPERTY_ALREADY_EXISTS; } m_RootWidget = rootWidget; return ER_OK; } qcc::String NotificationAction::getNotificationActionName() const { if (m_RootWidget) { return m_RootWidget->getWidgetName(); } if (m_RootWidgetMap.size()) { return m_RootWidgetMap.begin()->second->getWidgetName(); } return ""; } QStatus NotificationAction::registerObjects(BusAttachment* bus, qcc::String const& unitName) { if (m_NotificationActionBusObject) { QCC_DbgHLPrintf(("Could not register Object. BusObject already exists")); return ER_BUS_OBJ_ALREADY_EXISTS; } QStatus status = ER_OK; qcc::String objectPath = AJ_OBJECTPATH_PREFIX + unitName + "/" + m_RootWidget->getWidgetName(); m_NotificationActionBusObject = new NotificationActionBusObject(bus, objectPath.c_str(), status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationActionBusObject")); return status; } status = bus->RegisterBusObject(*m_NotificationActionBusObject); if (status != ER_OK) { QCC_LogError(status, ("Could not register NotificationActionBusObject.")); return status; } if (!m_RootWidget) { QCC_DbgHLPrintf(("Root Widget not set")); return ER_BUS_OBJECT_NOT_REGISTERED; } status = m_RootWidget->setNotificationActionBusObject(m_NotificationActionBusObject); if (status != ER_OK) { QCC_LogError(status, ("Could not set NotificationActionBusObject.")); return status; } return m_RootWidget->registerObjects(bus, m_LanguageSet, objectPath + "/", "", true); } QStatus NotificationAction::unregisterObjects(BusAttachment* bus) { QStatus status = ER_OK; if (!m_NotificationActionBusObject && !m_RootWidget) { QCC_DbgHLPrintf(("Can not unregister. BusObjects do not exist")); return status; //this does not need to fail } if (!bus) { QCC_DbgHLPrintf(("Could not unregister Object. Bus is NULL")); return ER_BAD_ARG_1; } if (m_RootWidget) { m_NotificationActionBusObject = 0; // Gets unregistered in rootWidget status = m_RootWidget->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister RootWidget.")); return status; } } else if (m_NotificationActionBusObject) { // no rootWidget so need to unregister here if (m_Device) { m_NotificationActionBusObject->UnregisterSignalHandler(bus); } else { bus->UnregisterBusObject(*m_NotificationActionBusObject); } delete m_NotificationActionBusObject; m_NotificationActionBusObject = 0; } std::map::const_iterator it; for (it = m_RootWidgetMap.begin(); it != m_RootWidgetMap.end(); it++) { it->second->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister RootContainer for language ", it->first.c_str())); } } return status; } QStatus NotificationAction::registerObjects(BusAttachment* bus) { if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } if (m_NotificationActionBusObject) { QCC_DbgPrintf(("BusObject already exists, just refreshing remote controller")); return m_NotificationActionBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); } QStatus status = ER_OK; m_NotificationActionBusObject = new NotificationActionBusObject(bus, m_ObjectPath, status, this); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationActionBusObject")); return status; } status = m_NotificationActionBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = addChildren(); if (status != ER_OK) { QCC_LogError(status, ("Call to AddChildren failed")); return status; } return status; } QStatus NotificationAction::checkVersions() { if (!m_NotificationActionBusObject) { QCC_DbgHLPrintf(("NotificationActionBusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } return m_NotificationActionBusObject->checkVersions(); } QStatus NotificationAction::addChildren() { if (!m_NotificationActionBusObject) { QCC_DbgHLPrintf(("NotificationActionBusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } std::vector childNodes; QStatus status = m_NotificationActionBusObject->Introspect(childNodes); if (status != ER_OK) { QCC_LogError(status, ("Introspection failed")); return status; } for (size_t i = 0; i < childNodes.size(); i++) { qcc::String const& objectPath = childNodes[i].getObjectPath(); std::vector splitPath = ControlPanelService::SplitObjectPath(objectPath); if (splitPath.size() < 4) { return ER_FAIL; } qcc::String const& containerName = splitPath[2]; qcc::String const& language = splitPath[3]; m_LanguageSet.addLanguage(language); RootWidget* rootWidget = 0; if (childNodes[i].getWidgetType() == WIDGET_TYPE_CONTAINER) { rootWidget = new Container(containerName, NULL, childNodes[i].getObjectPath(), m_Device); } else { rootWidget = new Dialog(containerName, NULL, childNodes[i].getObjectPath(), m_Device); } rootWidget->setIsSecured(childNodes[i].isSecured()); m_RootWidgetMap[language] = rootWidget; } return ER_OK; } const LanguageSet& NotificationAction::getLanguageSet() const { return m_LanguageSet; } ControlPanelDevice* NotificationAction::getDevice() const { return m_Device; } const qcc::String& NotificationAction::getObjectPath() const { return m_ObjectPath; } RootWidget* NotificationAction::getRootWidget(qcc::String const& language) const { std::map::const_iterator it; it = m_RootWidgetMap.find(language); if (it != m_RootWidgetMap.end()) { BusAttachment* bus = ControlPanelService::getInstance()->getBusAttachment(); it->second->registerObjects(bus); return it->second; } return NULL; } void NotificationAction::DismissSignal() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (busAttachment) { busAttachment->EnableConcurrentCallbacks(); } ControlPanelListener* listener = m_Device->getListener(); if (listener) { listener->signalDismiss(m_Device, this); } } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/SConscript000066400000000000000000000025601272147170000205250ustar00rootroot00000000000000#****************************************************************************** # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #***************************************************************************** Import('cpsenv') srcs = cpsenv.Glob('*.cc') srcs += cpsenv.Glob('Widgets/*.cc') srcs += cpsenv.Glob('BusObjects/*.cc') libs = [] # Static library objs = cpsenv.Object(srcs) libs.append(cpsenv.StaticLibrary('alljoyn_controlpanel', objs)) # Shared library if cpsenv.get('LIBTYPE', 'static') != 'static': shobjs = cpsenv.SharedObject(srcs) libs.append(cpsenv.SharedLibrary('alljoyn_controlpanel', shobjs)) Return('libs') base-16.04/controlpanel/cpp/src/Widgets/000077500000000000000000000000001272147170000201165ustar00rootroot00000000000000base-16.04/controlpanel/cpp/src/Widgets/Action.cc000066400000000000000000000045741272147170000216540ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../BusObjects/ActionBusObject.h" #include "../ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; Action::Action(qcc::String const& name, Widget* rootWidget) : Widget(name, rootWidget, WIDGET_TYPE_ACTION) { } Action::Action(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device) : Widget(name, rootWidget, device, WIDGET_TYPE_ACTION) { } Action::~Action() { } WidgetBusObject* Action::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new ActionBusObject(bus, objectPath, langIndx, status, this); } QStatus Action::executeAction() { if (m_ControlPanelMode == CONTROLLEE_MODE) { QCC_DbgHLPrintf(("Cannot execute Action. Widget is a Controllee widget")); return ER_NOT_IMPLEMENTED; } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot execute Action. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } return ((ActionBusObject*)m_BusObjects[0])->ExecuteAction(); } bool Action::executeCallBack() { return false; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/ActionWithDialog.cc000066400000000000000000000123651272147170000236250ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../BusObjects/ActionBusObject.h" #include "../ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ActionWithDialog::ActionWithDialog(qcc::String const& name, Widget* rootWidget) : Widget(name, rootWidget, WIDGET_TYPE_ACTION_WITH_DIALOG), m_Dialog(0) { } ActionWithDialog::ActionWithDialog(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device) : Widget(name, rootWidget, device, WIDGET_TYPE_ACTION_WITH_DIALOG), m_Dialog(0) { } ActionWithDialog::~ActionWithDialog() { if (m_ControlPanelMode == CONTROLLER_MODE && m_Dialog) { delete m_Dialog; } } WidgetBusObject* ActionWithDialog::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new ActionBusObject(bus, objectPath, langIndx, status, this); } Dialog* ActionWithDialog::getChildDialog() const { return m_Dialog; } QStatus ActionWithDialog::addChildDialog(Dialog* childDialog) { if (!childDialog) { QCC_DbgHLPrintf(("Cannot add a childDialog that is NULL")); return ER_BAD_ARG_1; } m_Dialog = childDialog; QCC_DbgPrintf(("Adding childDialog named: %s", childDialog->getWidgetName().c_str())); return ER_OK; } QStatus ActionWithDialog::registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot) { QStatus status = Widget::registerObjects(bus, languageSet, objectPathPrefix, objectPathSuffix, isRoot); if (status != ER_OK) { return status; } qcc::String newObjectPathSuffix = isRoot ? objectPathSuffix : objectPathSuffix + "/" + m_Name; if (!m_Dialog) { QCC_DbgHLPrintf(("Could not register. ActionWithDialog is missing the child Dialog")); return ER_FAIL; } status = m_Dialog->registerObjects(bus, languageSet, objectPathPrefix, newObjectPathSuffix); if (status != ER_OK) { QCC_LogError(status, ("Could not register childDialog objects")); return status; } return status; } QStatus ActionWithDialog::unregisterObjects(BusAttachment* bus) { QStatus returnStatus = ER_OK; QStatus status = Widget::unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister BusObjects")); returnStatus = status; } if (m_Dialog) { status = m_Dialog->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister Objects for the childDialog")); returnStatus = status; } } return returnStatus; } QStatus ActionWithDialog::addChildren(BusAttachment* bus) { if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } std::vector childNodes; QStatus status = m_BusObjects[0]->Introspect(childNodes); if (status != ER_OK) { QCC_LogError(status, ("Introspection failed")); return status; } for (size_t i = 0; i < childNodes.size(); i++) { qcc::String const& objectPath = childNodes[i].getObjectPath(); std::vector splitObjectPath = ControlPanelService::SplitObjectPath(objectPath.c_str()); qcc::String name = splitObjectPath.back(); Dialog* dialog = new Dialog(name, this, m_Device); dialog->setIsSecured(childNodes[i].isSecured()); addChildDialog(dialog); dialog->registerObjects(bus, objectPath); } return ER_OK; } QStatus ActionWithDialog::refreshChildren(BusAttachment* bus) { if (!m_Dialog) { QCC_DbgHLPrintf(("Could not refresh. ActionWithDialog is missing the child Dialog")); return ER_FAIL; } QStatus status = m_Dialog->refreshObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Error refreshing Child: %s", m_Dialog->getWidgetName().c_str())); } return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/CPSDate.cc000066400000000000000000000031021272147170000216440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include namespace ajn { namespace services { CPSDate::CPSDate(uint16_t day, uint16_t month, uint16_t year) : m_Day(day), m_Month(month), m_Year(year) { } CPSDate::~CPSDate() { } uint16_t CPSDate::getDay() const { return m_Day; } void CPSDate::setDay(uint16_t day) { m_Day = day; } uint16_t CPSDate::getMonth() const { return m_Month; } void CPSDate::setMonth(uint16_t month) { m_Month = month; } uint16_t CPSDate::getYear() const { return m_Year; } void CPSDate::setYear(uint16_t year) { m_Year = year; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/CPSTime.cc000066400000000000000000000031461272147170000216750ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include namespace ajn { namespace services { CPSTime::CPSTime(uint16_t hour, uint16_t minute, uint16_t second) : m_Hour(hour), m_Minute(minute), m_Second(second) { } CPSTime::~CPSTime() { } uint16_t CPSTime::getHour() const { return m_Hour; } void CPSTime::setHour(uint16_t hour) { m_Hour = hour; } uint16_t CPSTime::getMinute() const { return m_Minute; } void CPSTime::setMinute(uint16_t minute) { m_Minute = minute; } uint16_t CPSTime::getSecond() const { return m_Second; } void CPSTime::setSecond(uint16_t second) { m_Second = second; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/ConstraintList.cc000066400000000000000000000170541272147170000234140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ConstraintList::ConstraintList() : m_PropertyType(UNDEFINED), m_Display(""), m_GetDisplays(0) { } ConstraintList::~ConstraintList() { } void ConstraintList::setConstraintValue(uint16_t value) { m_ConstraintValue.uint16Value = value; m_PropertyType = UINT16_PROPERTY; } void ConstraintList::setConstraintValue(int16_t value) { m_ConstraintValue.int16Value = value; m_PropertyType = INT16_PROPERTY; } void ConstraintList::setConstraintValue(uint32_t value) { m_ConstraintValue.uint32Value = value; m_PropertyType = UINT32_PROPERTY; } void ConstraintList::setConstraintValue(int32_t value) { m_ConstraintValue.int32Value = value; m_PropertyType = INT32_PROPERTY; } void ConstraintList::setConstraintValue(uint64_t value) { m_ConstraintValue.uint64Value = value; m_PropertyType = UINT64_PROPERTY; } void ConstraintList::setConstraintValue(int64_t value) { m_ConstraintValue.int64Value = value; m_PropertyType = INT64_PROPERTY; } void ConstraintList::setConstraintValue(double value) { m_ConstraintValue.doubleValue = value; m_PropertyType = DOUBLE_PROPERTY; } void ConstraintList::setConstraintValue(qcc::String const& value) { m_ConstraintValueString = value; m_ConstraintValue.charValue = m_ConstraintValueString.c_str(); m_PropertyType = STRING_PROPERTY; } ConstraintValue ConstraintList::getConstraintValue() const { return m_ConstraintValue; } PropertyType ConstraintList::getPropertyType() const { return m_PropertyType; } const qcc::String& ConstraintList::getDisplay() const { return m_Display; } const std::vector& ConstraintList::getDisplays() const { return m_Displays; } void ConstraintList::setDisplays(const std::vector& displays) { m_Displays = displays; } GetStringFptr ConstraintList::getGetDisplays() const { return m_GetDisplays; } void ConstraintList::setGetDisplays(GetStringFptr getDisplays) { m_GetDisplays = getDisplays; } QStatus ConstraintList::fillConstraintArg(MsgArg& val, uint16_t languageIndx, PropertyType propertyType) { if (m_PropertyType != propertyType) { QCC_DbgHLPrintf(("Could not fill the Constraint Arg. PropertyTypes do not match")); return ER_FAIL; } if (!(m_Displays.size() > languageIndx) && !m_GetDisplays) { QCC_DbgHLPrintf(("Could not fill the Constraint Arg. Display is not set")); return ER_FAIL; } QStatus status; MsgArg* valueArg = new MsgArg(); switch (propertyType) { case UINT16_PROPERTY: status = valueArg->Set(AJPARAM_UINT16.c_str(), m_ConstraintValue.uint16Value); break; case INT16_PROPERTY: status = valueArg->Set(AJPARAM_INT16.c_str(), m_ConstraintValue.int16Value); break; case UINT32_PROPERTY: status = valueArg->Set(AJPARAM_UINT32.c_str(), m_ConstraintValue.uint32Value); break; case INT32_PROPERTY: status = valueArg->Set(AJPARAM_INT32.c_str(), m_ConstraintValue.int32Value); break; case UINT64_PROPERTY: status = valueArg->Set(AJPARAM_UINT64.c_str(), m_ConstraintValue.uint64Value); break; case INT64_PROPERTY: status = valueArg->Set(AJPARAM_INT64.c_str(), m_ConstraintValue.int64Value); break; case DOUBLE_PROPERTY: status = valueArg->Set(AJPARAM_DOUBLE.c_str(), m_ConstraintValue.doubleValue); break; case STRING_PROPERTY: status = valueArg->Set(AJPARAM_STR.c_str(), m_ConstraintValue.charValue); break; default: status = ER_BUS_BAD_SIGNATURE; break; } if (status != ER_OK) { QCC_LogError(status, ("Could not marshal Constraint Value")); delete valueArg; return status; } const char* display = m_GetDisplays ? m_GetDisplays(languageIndx) : m_Displays[languageIndx].c_str(); status = val.Set(AJPARAM_STRUCT_VAR_STR.c_str(), valueArg, display); if (status != ER_OK) { QCC_LogError(status, ("Could not marshal Constraint Value")); delete valueArg; return status; } val.SetOwnershipFlags(MsgArg::OwnsArgs, true); return status; } QStatus ConstraintList::readConstraintArg(MsgArg& val) { QStatus status = ER_OK; MsgArg* valueArg; char* display; CHECK_AND_RETURN(val.Get(AJPARAM_STRUCT_VAR_STR.c_str(), &valueArg, &display)) m_Display = display; switch (valueArg->typeId) { case ALLJOYN_UINT16: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_UINT16.c_str(), &m_ConstraintValue.uint16Value)) m_PropertyType = UINT16_PROPERTY; break; } case ALLJOYN_INT16: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_INT16.c_str(), &m_ConstraintValue.int16Value)) m_PropertyType = INT16_PROPERTY; break; } case ALLJOYN_UINT32: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_UINT32.c_str(), &m_ConstraintValue.uint32Value)) m_PropertyType = UINT32_PROPERTY; break; } case ALLJOYN_INT32: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_INT32.c_str(), &m_ConstraintValue.int32Value)) m_PropertyType = INT32_PROPERTY; break; } case ALLJOYN_UINT64: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_UINT64.c_str(), &m_ConstraintValue.uint64Value)) m_PropertyType = UINT64_PROPERTY; break; } case ALLJOYN_INT64: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_INT64.c_str(), &m_ConstraintValue.int64Value)) m_PropertyType = INT64_PROPERTY; break; } case ALLJOYN_DOUBLE: { CHECK_AND_RETURN(valueArg->Get(AJPARAM_DOUBLE.c_str(), &m_ConstraintValue.doubleValue)) m_PropertyType = DOUBLE_PROPERTY; break; } case ALLJOYN_STRING: { char* constraintValue; CHECK_AND_RETURN(valueArg->Get(AJPARAM_STR.c_str(), &constraintValue)) m_ConstraintValueString = constraintValue; m_ConstraintValue.charValue = m_ConstraintValueString.c_str(); m_PropertyType = STRING_PROPERTY; break; } default: status = ER_BUS_SIGNATURE_MISMATCH; break; } return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/ConstraintRange.cc000066400000000000000000000325201272147170000235300ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../ControlPanelConstants.h" #include namespace ajn { namespace services { using namespace cpsConsts; ConstraintRange::ConstraintRange() : m_PropertyType(UNDEFINED) { m_MinValue.uint16Value = 0; m_MaxValue.uint16Value = 0; m_IncrementValue.uint16Value = 0; } ConstraintRange::~ConstraintRange() { } const ConstraintRangeVal& ConstraintRange::getIncrementValue() const { return m_IncrementValue; } const ConstraintRangeVal& ConstraintRange::getMaxValue() const { return m_MaxValue; } const ConstraintRangeVal& ConstraintRange::getMinValue() const { return m_MinValue; } bool ConstraintRange::validateConstraintValue(PropertyType propertyType) { if (m_PropertyType != propertyType && m_PropertyType != UNDEFINED) { QCC_DbgHLPrintf(("Could not set Constraint Value. Value Type is wrong")); return false; } m_PropertyType = propertyType; return true; } QStatus ConstraintRange::setConstraintMin(uint16_t minValue) { if (!validateConstraintValue(UINT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.uint16Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(int16_t minValue) { if (!validateConstraintValue(INT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.int16Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(uint32_t minValue) { if (!validateConstraintValue(UINT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.uint32Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(int32_t minValue) { if (!validateConstraintValue(INT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.int32Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(uint64_t minValue) { if (!validateConstraintValue(UINT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.uint64Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(int64_t minValue) { if (!validateConstraintValue(INT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.int64Value = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMin(double minValue) { if (!validateConstraintValue(DOUBLE_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MinValue.doubleValue = minValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(uint16_t maxValue) { if (!validateConstraintValue(UINT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.uint16Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(int16_t maxValue) { if (!validateConstraintValue(INT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.int16Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(uint32_t maxValue) { if (!validateConstraintValue(UINT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.uint32Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(int32_t maxValue) { if (!validateConstraintValue(INT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.int32Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(uint64_t maxValue) { if (!validateConstraintValue(UINT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.uint64Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(int64_t maxValue) { if (!validateConstraintValue(INT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.int64Value = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintMax(double maxValue) { if (!validateConstraintValue(DOUBLE_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_MaxValue.doubleValue = maxValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(uint16_t incrementValue) { if (!validateConstraintValue(UINT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.uint16Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(int16_t incrementValue) { if (!validateConstraintValue(INT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.int16Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(uint32_t incrementValue) { if (!validateConstraintValue(UINT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.uint32Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(int32_t incrementValue) { if (!validateConstraintValue(INT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.int32Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(uint64_t incrementValue) { if (!validateConstraintValue(UINT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.uint64Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(int64_t incrementValue) { if (!validateConstraintValue(INT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.int64Value = incrementValue; return ER_OK; } QStatus ConstraintRange::setConstraintIncrement(double incrementValue) { if (!validateConstraintValue(DOUBLE_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_IncrementValue.doubleValue = incrementValue; return ER_OK; } QStatus ConstraintRange::fillConstraintArg(MsgArg& val, uint16_t languageIndx, PropertyType propertyType) { QCC_UNUSED(languageIndx); if (m_PropertyType != propertyType) { return ER_BUS_SIGNATURE_MISMATCH; } QStatus status; MsgArg* minValue = new MsgArg(); MsgArg* maxValue = new MsgArg(); MsgArg* incrementValue = new MsgArg(); switch (m_PropertyType) { case UINT16_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_UINT16.c_str(), m_MinValue.uint16Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_UINT16.c_str(), m_MaxValue.uint16Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_UINT16.c_str(), m_IncrementValue.uint16Value)); break; case INT16_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_INT16.c_str(), m_MinValue.int16Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_INT16.c_str(), m_MaxValue.int16Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_INT16.c_str(), m_IncrementValue.int16Value)); break; case UINT32_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_UINT32.c_str(), m_MinValue.uint32Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_UINT32.c_str(), m_MaxValue.uint32Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_UINT32.c_str(), m_IncrementValue.uint32Value)); break; case INT32_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_INT32.c_str(), m_MinValue.int32Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_INT32.c_str(), m_MaxValue.int32Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_INT32.c_str(), m_IncrementValue.int32Value)); break; case UINT64_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_UINT64.c_str(), m_MinValue.uint64Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_UINT64.c_str(), m_MaxValue.uint64Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_UINT64.c_str(), m_IncrementValue.uint64Value)); break; case INT64_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_INT64.c_str(), m_MinValue.int64Value)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_INT64.c_str(), m_MaxValue.int64Value)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_INT64.c_str(), m_IncrementValue.int64Value)); break; case DOUBLE_PROPERTY: CHECK_AND_BREAK(minValue->Set(AJPARAM_DOUBLE.c_str(), m_MinValue.doubleValue)); CHECK_AND_BREAK(maxValue->Set(AJPARAM_DOUBLE.c_str(), m_MaxValue.doubleValue)); CHECK_AND_BREAK(incrementValue->Set(AJPARAM_DOUBLE.c_str(), m_IncrementValue.doubleValue)); break; default: status = ER_BUS_BAD_SIGNATURE; break; } if (status != ER_OK) { QCC_LogError(status, ("Could not marshal Constraint Range")); delete minValue; delete maxValue; delete incrementValue; return status; } status = val.Set(AJPARAM_STRUCT_VAR_VAR_VAR.c_str(), minValue, maxValue, incrementValue); if (status != ER_OK) { QCC_LogError(status, ("Could not marshal Constraint Range")); delete minValue; delete maxValue; delete incrementValue; return status; } val.SetOwnershipFlags(MsgArg::OwnsArgs, true); return status; } QStatus ConstraintRange::readConstraintArg(MsgArg* val) { QStatus status = ER_OK; MsgArg* minValue; MsgArg* maxValue; MsgArg* incrementValue; CHECK_AND_RETURN(val->Get(AJPARAM_STRUCT_VAR_VAR_VAR.c_str(), &minValue, &maxValue, &incrementValue)) if (minValue->typeId != maxValue->typeId || minValue->typeId != incrementValue->typeId) { return ER_BUS_SIGNATURE_MISMATCH; } switch (minValue->typeId) { case ALLJOYN_UINT16: { CHECK_AND_RETURN(minValue->Get(AJPARAM_UINT16.c_str(), &m_MinValue.uint16Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_UINT16.c_str(), &m_MaxValue.uint16Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_UINT16.c_str(), &m_IncrementValue.uint16Value)) m_PropertyType = UINT16_PROPERTY; break; } case ALLJOYN_INT16: { CHECK_AND_RETURN(minValue->Get(AJPARAM_INT16.c_str(), &m_MinValue.int16Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_INT16.c_str(), &m_MaxValue.int16Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_INT16.c_str(), &m_IncrementValue.int16Value)) m_PropertyType = INT16_PROPERTY; break; } case ALLJOYN_UINT32: { CHECK_AND_RETURN(minValue->Get(AJPARAM_UINT32.c_str(), &m_MinValue.uint32Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_UINT32.c_str(), &m_MaxValue.uint32Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_UINT32.c_str(), &m_IncrementValue.uint32Value)) m_PropertyType = UINT32_PROPERTY; break; } case ALLJOYN_INT32: { CHECK_AND_RETURN(minValue->Get(AJPARAM_INT32.c_str(), &m_MinValue.int32Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_INT32.c_str(), &m_MaxValue.int32Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_INT32.c_str(), &m_IncrementValue.int32Value)) m_PropertyType = INT32_PROPERTY; break; } case ALLJOYN_UINT64: { CHECK_AND_RETURN(minValue->Get(AJPARAM_UINT64.c_str(), &m_MinValue.uint64Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_UINT64.c_str(), &m_MaxValue.uint64Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_UINT64.c_str(), &m_IncrementValue.uint64Value)) m_PropertyType = UINT64_PROPERTY; break; } case ALLJOYN_INT64: { CHECK_AND_RETURN(minValue->Get(AJPARAM_INT64.c_str(), &m_MinValue.int64Value)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_INT64.c_str(), &m_MaxValue.int64Value)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_INT64.c_str(), &m_IncrementValue.int64Value)) m_PropertyType = INT64_PROPERTY; break; } case ALLJOYN_DOUBLE: { CHECK_AND_RETURN(minValue->Get(AJPARAM_DOUBLE.c_str(), &m_MinValue.doubleValue)) CHECK_AND_RETURN(maxValue->Get(AJPARAM_DOUBLE.c_str(), &m_MaxValue.doubleValue)) CHECK_AND_RETURN(incrementValue->Get(AJPARAM_DOUBLE.c_str(), &m_IncrementValue.doubleValue)) m_PropertyType = DOUBLE_PROPERTY; break; } default: status = ER_BUS_SIGNATURE_MISMATCH; break; } return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/Container.cc000066400000000000000000000175721272147170000223630ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include #include #include "../ControlPanelConstants.h" #include "../BusObjects/ContainerBusObject.h" #include "../BusObjects/ControlPanelBusObject.h" #include namespace ajn { namespace services { using namespace cpsConsts; Container::Container(qcc::String const& name, Widget* rootWidget) : RootWidget(name, rootWidget, WIDGET_TYPE_CONTAINER), m_IsDismissable(false) { } Container::Container(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device) : RootWidget(name, rootWidget, objectPath, device, WIDGET_TYPE_CONTAINER), m_IsDismissable(false) { } Container::Container(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device) : RootWidget(name, rootWidget, "", device, WIDGET_TYPE_CONTAINER), m_IsDismissable(false) { } Container::~Container() { if (m_ControlPanelMode == CONTROLLER_MODE) { for (size_t i = 0; i < m_ChildWidgets.size(); i++) { delete m_ChildWidgets[i]; } } } WidgetBusObject* Container::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new ContainerBusObject(bus, objectPath, langIndx, status, this); } QStatus Container::registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot) { QStatus status = Widget::registerObjects(bus, languageSet, objectPathPrefix, objectPathSuffix, isRoot); if (status != ER_OK) { return status; } qcc::String newObjectPathSuffix = isRoot ? objectPathSuffix : objectPathSuffix + "/" + m_Name; for (size_t indx = 0; indx < m_ChildWidgets.size(); indx++) { status = m_ChildWidgets[indx]->registerObjects(bus, languageSet, objectPathPrefix, newObjectPathSuffix); if (status != ER_OK) { QCC_LogError(status, ("Could not register childWidgets objects")); return status; } } return status; } QStatus Container::unregisterObjects(BusAttachment* bus) { QStatus returnStatus = ER_OK; if (m_IsDismissable) { // notificationAction unregistered as part of controlPanel m_NotificationActionBusObject = 0; } QStatus status = RootWidget::unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister BusObjects")); returnStatus = status; } for (size_t indx = 0; indx < m_ChildWidgets.size(); indx++) { status = m_ChildWidgets[indx]->unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister Objects for the childWidget")); returnStatus = status; } } return returnStatus; } QStatus Container::registerObjects(BusAttachment* bus) { return Widget::registerObjects(bus, m_ObjectPath); } QStatus Container::addChildren(BusAttachment* bus) { if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } std::vector childNodes; QStatus status = m_BusObjects[0]->Introspect(childNodes); if (status != ER_OK) { QCC_LogError(status, ("Introspection failed")); return status; } for (size_t i = 0; i < childNodes.size(); i++) { qcc::String const& objectPath = childNodes[i].getObjectPath(); std::vector splitObjectPath = ControlPanelService::SplitObjectPath(objectPath.c_str()); qcc::String name = splitObjectPath.back(); Widget* widget = createWidget(name, this, m_Device, childNodes[i].getWidgetType()); if (widget == NULL) { continue; } widget->setIsSecured(childNodes[i].isSecured()); QStatus childStatus = widget->registerObjects(bus, objectPath); if (childStatus == ER_OK) { addChildWidget(widget); } else { QCC_DbgHLPrintf(("Failed creating childWidget %s", name.c_str())); ControlPanelListener* listener = m_Device->getListener(); if (listener) { listener->errorOccured(m_Device, status, REGISTER_OBJECTS, "Could not register Objects for Widget: " + name); } Widget* errorWidget = new ErrorWidget(name, this, widget, m_Device); addChildWidget(errorWidget); } } return ER_OK; } QStatus Container::refreshChildren(BusAttachment* bus) { QStatus status = ER_OK; for (size_t i = 0; i < m_ChildWidgets.size(); i++) { status = m_ChildWidgets[i]->refreshObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Error refreshing Child: %s", m_ChildWidgets[i]->getWidgetName().c_str())); return status; } } return status; } QStatus Container::addChildWidget(Widget* childWidget) { if (!childWidget) { return ER_BAD_ARG_1; } QCC_DbgPrintf(("Adding childWidget named: %s", childWidget->getWidgetName().c_str())); m_ChildWidgets.push_back(childWidget); return ER_OK; } const std::vector& Container::getChildWidgets() const { return m_ChildWidgets; } bool Container::getIsDismissable() const { return m_IsDismissable; } void Container::setIsDismissable(bool isDismissable) { m_IsDismissable = isDismissable; } QStatus Container::SendDismissSignal() { if (!m_IsDismissable) { return RootWidget::SendDismissSignal(); } if (!m_NotificationActionBusObject) { return ER_BUS_OBJECT_NOT_REGISTERED; } return ((ControlPanelBusObject*)m_NotificationActionBusObject)->SendDismissSignal(); } Widget* Container::createWidget(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device, WidgetType widgetType) { switch (widgetType) { case WIDGET_TYPE_ACTION: return new Action(name, rootWidget, device); break; case WIDGET_TYPE_ACTION_WITH_DIALOG: return new ActionWithDialog(name, rootWidget, device); break; case WIDGET_TYPE_CONTAINER: return new Container(name, rootWidget, device); break; case WIDGET_TYPE_DIALOG: return new Dialog(name, rootWidget, device); break; case WIDGET_TYPE_LABEL: return new Label(name, rootWidget, device); break; case WIDGET_TYPE_PROPERTY: return new Property(name, rootWidget, device); break; case WIDGET_TYPE_ERROR: return NULL; break; } return NULL; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/Dialog.cc000066400000000000000000000255071272147170000216350ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../ControlPanelConstants.h" #include "../BusObjects/DialogBusObject.h" #include namespace ajn { namespace services { using namespace cpsConsts; Dialog::Dialog(qcc::String const& name, Widget* rootWidget) : RootWidget(name, rootWidget, WIDGET_TYPE_DIALOG), m_NumActions(0), m_GetMessages(0), m_LabelAction1(""), m_GetLabelsAction1(0), m_LabelAction2(""), m_GetLabelsAction2(0), m_LabelAction3(""), m_GetLabelsAction3(0) { } Dialog::Dialog(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device) : RootWidget(name, rootWidget, objectPath, device, WIDGET_TYPE_DIALOG), m_NumActions(0), m_GetMessages(0), m_LabelAction1(""), m_GetLabelsAction1(0), m_LabelAction2(""), m_GetLabelsAction2(0), m_LabelAction3(""), m_GetLabelsAction3(0) { } Dialog::Dialog(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device) : RootWidget(name, rootWidget, "", device, WIDGET_TYPE_DIALOG), m_NumActions(0), m_GetMessages(0), m_LabelAction1(""), m_GetLabelsAction1(0), m_LabelAction2(""), m_GetLabelsAction2(0), m_LabelAction3(""), m_GetLabelsAction3(0) { } Dialog::~Dialog() { } WidgetBusObject* Dialog::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new DialogBusObject(bus, objectPath, langIndx, status, this); } const uint16_t Dialog::getNumActions() const { return m_NumActions; } void Dialog::setNumActions(const uint16_t numActions) { m_NumActions = numActions; } const qcc::String& Dialog::getMessage() const { return m_Message; } const std::vector& Dialog::getMessages() const { return m_Messages; } void Dialog::setMessages(const std::vector& messages) { m_Messages = messages; } GetStringFptr Dialog::getGetMessages() const { return m_GetMessages; } void Dialog::setGetMessages(GetStringFptr getMessages) { m_GetMessages = getMessages; } const qcc::String& Dialog::getLabelAction1() const { return m_LabelAction1; } const qcc::String& Dialog::getLabelAction2() const { return m_LabelAction2; } const qcc::String& Dialog::getLabelAction3() const { return m_LabelAction3; } const std::vector& Dialog::getLabelsAction1() const { return m_LabelsAction1; } void Dialog::setLabelsAction1(const std::vector& labelsAction1) { m_LabelsAction1 = labelsAction1; } GetStringFptr Dialog::getGetLabelsAction1() const { return m_GetLabelsAction1; } void Dialog::setGetLabelsAction1(GetStringFptr getLabelsAction1) { m_GetLabelsAction1 = getLabelsAction1; } const std::vector& Dialog::getLabelsAction2() const { return m_LabelsAction2; } void Dialog::setLabelsAction2(const std::vector& labelsAction2) { m_LabelsAction2 = labelsAction2; } GetStringFptr Dialog::getGetLabelsAction2() const { return m_GetLabelsAction2; } void Dialog::setGetLabelsAction2(GetStringFptr getLabelsAction2) { m_GetLabelsAction2 = getLabelsAction2; } const std::vector& Dialog::getLabelsAction3() const { return m_LabelsAction3; } void Dialog::setLabelsAction3(const std::vector& labelsAction3) { m_LabelsAction3 = labelsAction3; } QStatus Dialog::fillMessageArg(MsgArg& val, uint16_t languageIndx) { if (!(m_Messages.size() > languageIndx) && !m_GetMessages) { return ER_BUS_PROPERTY_VALUE_NOT_SET; } return val.Set(AJPARAM_STR.c_str(), m_GetMessages ? m_GetMessages(languageIndx) : m_Messages[languageIndx].c_str()); } QStatus Dialog::fillNumActionArg(MsgArg& val, uint16_t languageIndx) { QCC_UNUSED(languageIndx); if (!m_NumActions) { return ER_BUS_PROPERTY_VALUE_NOT_SET; } return val.Set(AJPARAM_UINT16.c_str(), m_NumActions); } GetStringFptr Dialog::getGetLabelsAction3() const { return m_GetLabelsAction3; } void Dialog::setGetLabelsAction3(GetStringFptr getLabelAction3) { m_GetLabelsAction3 = getLabelAction3; } QStatus Dialog::fillOptParamsArg(MsgArg& val, uint16_t languageIndx) { QStatus status; MsgArg* optParams = new MsgArg[OPT_PARAM_KEYS::NUM_OPT_PARAMS]; size_t optParamIndx = 0; status = Widget::fillOptParamsArg(optParams, languageIndx, optParamIndx); if (status != ER_OK) { QCC_LogError(status, ("Could not marshal optParams")); delete[] optParams; return status; } if (m_LabelsAction1.size() > languageIndx || m_GetLabelsAction1) { MsgArg* labelArg = new MsgArg(AJPARAM_STR.c_str(), m_GetLabelsAction1 ? m_GetLabelsAction1(languageIndx) : m_LabelsAction1[languageIndx].c_str()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), OPT_PARAM_KEYS::LABEL_ACTION1, labelArg)) != ER_OK) { delete labelArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_LabelsAction2.size() > languageIndx || m_GetLabelsAction2) { MsgArg* labelArg = new MsgArg(AJPARAM_STR.c_str(), m_GetLabelsAction2 ? m_GetLabelsAction2(languageIndx) : m_LabelsAction2[languageIndx].c_str()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), OPT_PARAM_KEYS::LABEL_ACTION2, labelArg)) != ER_OK) { delete labelArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_LabelsAction3.size() > languageIndx || m_GetLabelsAction3) { MsgArg* labelArg = new MsgArg(AJPARAM_STR.c_str(), m_GetLabelsAction3 ? m_GetLabelsAction3(languageIndx) : m_LabelsAction3[languageIndx].c_str()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), OPT_PARAM_KEYS::LABEL_ACTION3, labelArg)) != ER_OK) { delete labelArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } return val.Set(AJPARAM_ARRAY_DICT_UINT16_VAR.c_str(), optParamIndx, optParams); } QStatus Dialog::readMessageArg(MsgArg* val) { QStatus status = ER_OK; char* message; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &message)) m_Message = message; return status; } QStatus Dialog::readNumActionsArg(MsgArg* val) { QStatus status = ER_OK; uint16_t numActions; CHECK_AND_RETURN(val->Get(AJPARAM_UINT16.c_str(), &numActions)) m_NumActions = numActions; return status; } QStatus Dialog::readOptParamsArg(uint16_t key, MsgArg* val) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; switch (key) { case OPT_PARAM_KEYS::LABEL_ACTION1: { char* label; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &label)) m_LabelAction1 = label; break; } case OPT_PARAM_KEYS::LABEL_ACTION2: { char* label; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &label)) m_LabelAction2 = label; break; } case OPT_PARAM_KEYS::LABEL_ACTION3: { char* label; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &label)) m_LabelAction3 = label; break; } default: status = Widget::readOptParamsArg(key, val); } return status; } bool Dialog::executeActionNotDefined() { QCC_DbgHLPrintf(("Could not execute this Action. It is not defined.")); return false; } QStatus Dialog::executeAction1() { if (m_ControlPanelMode == CONTROLLEE_MODE) { QCC_DbgHLPrintf(("Cannot execute Action 1. Widget is a Controllee widget")); return ER_NOT_IMPLEMENTED; } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot execute Action 1. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } if (m_NumActions < 1) { QCC_DbgHLPrintf(("Cannot execute Action 1 - numActions is less than 1")); return ER_NOT_IMPLEMENTED; } return ((DialogBusObject*)m_BusObjects[0])->ExecuteAction1(); } QStatus Dialog::executeAction2() { if (m_ControlPanelMode == CONTROLLEE_MODE) { QCC_DbgHLPrintf(("Cannot execute Action 2. Widget is a Controllee widget")); return ER_NOT_IMPLEMENTED; } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot execute Action 2. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } if (m_NumActions < 2) { QCC_DbgHLPrintf(("Cannot execute Action2 - numActions is less than 2")); return ER_NOT_IMPLEMENTED; } return ((DialogBusObject*)m_BusObjects[0])->ExecuteAction2(); } QStatus Dialog::executeAction3() { if (m_ControlPanelMode == CONTROLLEE_MODE) { QCC_DbgHLPrintf(("Cannot execute Action 3. Widget is a Controllee widget")); return ER_NOT_IMPLEMENTED; } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot execute Action 3. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } if (m_NumActions < 3) { QCC_DbgHLPrintf(("Cannot execute Action3 - numActions is less than 3")); return ER_NOT_IMPLEMENTED; } return ((DialogBusObject*)m_BusObjects[0])->ExecuteAction3(); } bool Dialog::executeAction1CallBack() { return false; } bool Dialog::executeAction2CallBack() { return false; } bool Dialog::executeAction3CallBack() { return false; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/ErrorWidget.cc000066400000000000000000000044001272147170000226600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "alljoyn/controlpanel/ErrorWidget.h" #include "../ControlPanelConstants.h" #define ERROR_WIDGET_LABEL "NOT AVAILABLE" namespace ajn { namespace services { using namespace cpsConsts; ErrorWidget::ErrorWidget(qcc::String const& name, Widget* rootWidget, Widget* originalWidget, ControlPanelDevice* device) : Widget(name, rootWidget, device, WIDGET_TYPE_ERROR), m_OriginalWidget(originalWidget) { m_Label.assign(ERROR_WIDGET_LABEL); } ErrorWidget::~ErrorWidget() { if (m_OriginalWidget) { delete m_OriginalWidget; } } WidgetBusObject* ErrorWidget::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { QCC_UNUSED(bus); QCC_UNUSED(objectPath); QCC_UNUSED(langIndx); QCC_UNUSED(status); return NULL; } QStatus ErrorWidget::registerObjects(BusAttachment* bus, qcc::String const& objectPath) { QCC_UNUSED(bus); QCC_UNUSED(objectPath); return ER_OK; } QStatus ErrorWidget::unregisterObjects(BusAttachment* bus) { if (m_OriginalWidget) { return m_OriginalWidget->unregisterObjects(bus); } return ER_OK; } Widget* ErrorWidget::getOriginalWidget() const { return m_OriginalWidget; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/HttpControl.cc000066400000000000000000000157341272147170000227170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "../ControlPanelConstants.h" #include "../BusObjects/HttpControlBusObject.h" #include namespace ajn { namespace services { using namespace cpsConsts; HttpControl::HttpControl(qcc::String const& url) : m_Url(url), m_ObjectPath(""), m_HttpControlBusObject(0), m_Device(0), m_ControlPanelMode(CONTROLLEE_MODE), m_Version(0) { } HttpControl::HttpControl(qcc::String const& objectPath, ControlPanelDevice* device) : m_Url(""), m_ObjectPath(objectPath), m_HttpControlBusObject(0), m_Device(device), m_ControlPanelMode(CONTROLLER_MODE), m_Version(0) { } HttpControl::HttpControl(const HttpControl& httpControl) { QCC_UNUSED(httpControl); } HttpControl& HttpControl::operator=(const HttpControl& httpControl) { QCC_UNUSED(httpControl); return *this; } HttpControl::~HttpControl() { } const uint16_t HttpControl::getInterfaceVersion() const { if (!m_HttpControlBusObject) { return 1; } return m_ControlPanelMode == CONTROLLEE_MODE ? m_HttpControlBusObject->getInterfaceVersion() : m_Version; } QStatus HttpControl::registerObjects(BusAttachment* bus, qcc::String const& unitName) { if (m_HttpControlBusObject) { QCC_DbgHLPrintf(("Could not register Object. BusObject already exists")); return ER_BUS_OBJ_ALREADY_EXISTS; } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status = ER_OK; qcc::String objectPath = AJ_OBJECTPATH_PREFIX + unitName + AJ_HTTP_OBJECTPATH_SUFFIX; m_HttpControlBusObject = new HttpControlBusObject(bus, objectPath.c_str(), status, this); if (status != ER_OK) { QCC_LogError(status, ("Could not create HttpControlBusObject")); return status; } status = bus->RegisterBusObject(*m_HttpControlBusObject); if (status != ER_OK) { QCC_LogError(status, ("Could not register HttpControlBusObject.")); return status; } return status; } QStatus HttpControl::registerObjects(BusAttachment* bus) { if (m_HttpControlBusObject) { QCC_DbgPrintf(("BusObject already exists - refreshing widget")); return refreshObjects(bus); } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status = ER_OK; m_HttpControlBusObject = new HttpControlBusObject(bus, m_ObjectPath.c_str(), status, this); if (status != ER_OK) { QCC_LogError(status, ("Could not create HttpControlBusObject")); return status; } status = m_HttpControlBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = m_HttpControlBusObject->checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = m_HttpControlBusObject->GetUrl(bus); if (status != ER_OK) { QCC_LogError(status, ("Call to GetUrl failed")); return status; } return status; } QStatus HttpControl::refreshObjects(BusAttachment* bus) { if (!m_HttpControlBusObject) { QCC_DbgHLPrintf(("BusObject does not exist - exiting")); return ER_BUS_OBJECT_NOT_REGISTERED; } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status; status = m_HttpControlBusObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = m_HttpControlBusObject->checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = m_HttpControlBusObject->GetUrl(bus); if (status != ER_OK) { QCC_LogError(status, ("Call to GetUrl failed")); return status; } return status; } QStatus HttpControl::unregisterObjects(BusAttachment* bus) { if (!m_HttpControlBusObject) { QCC_DbgHLPrintf(("Can not unregister. HttpControlBusObject does not exist")); return ER_OK; //this does not need to fail } if (!bus) { QCC_DbgHLPrintf(("Could not unregister Object. Bus is NULL")); return ER_BAD_ARG_1; } bus->UnregisterBusObject(*m_HttpControlBusObject); delete m_HttpControlBusObject; m_HttpControlBusObject = 0; return ER_OK; } QStatus HttpControl::fillUrlArg(MsgArg& val) { return val.Set(AJPARAM_STR.c_str(), m_Url.c_str()); } QStatus HttpControl::readUrlArg(MsgArg const& val) { char* url; QStatus status = val.Get(AJPARAM_STR.c_str(), &url); if (status == ER_OK) { m_Url = url; } return status; } QStatus HttpControl::readVersionArg(MsgArg const& val) { return val.Get(AJPARAM_UINT16.c_str(), &m_Version); } ControlPanelDevice* HttpControl::getDevice() const { return m_Device; } const qcc::String& HttpControl::getUrl() const { return m_Url; } ControlPanelMode HttpControl::getControlPanelMode() const { return m_ControlPanelMode; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/Label.cc000066400000000000000000000052631272147170000214520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include "../ControlPanelConstants.h" #include "../BusObjects/LabelBusObject.h" namespace ajn { namespace services { using namespace cpsConsts; Label::Label(qcc::String const& name, Widget* rootWidget) : Widget(name, rootWidget, WIDGET_TYPE_LABEL), m_LabelWidgetGetLabels(0) { } Label::Label(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device) : Widget(name, rootWidget, device, WIDGET_TYPE_LABEL), m_LabelWidgetGetLabels(0) { } Label::~Label() { } WidgetBusObject* Label::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new LabelBusObject(bus, objectPath, langIndx, status, this); } const std::vector& Label::getLabels() const { return m_LabelWidgetLabels; } void Label::setLabels(const std::vector& labels) { m_LabelWidgetLabels = labels; } GetStringFptr Label::getGetLabels() const { return m_LabelWidgetGetLabels; } void Label::setGetLabels(GetStringFptr getLabels) { m_LabelWidgetGetLabels = getLabels; } QStatus Label::fillLabelArg(MsgArg& val, uint16_t languageIndx) { if (!(m_LabelWidgetLabels.size() > languageIndx) && !m_LabelWidgetGetLabels) { return ER_BUS_PROPERTY_VALUE_NOT_SET; } return val.Set(AJPARAM_STR.c_str(), m_LabelWidgetGetLabels ? m_LabelWidgetGetLabels(languageIndx) : m_LabelWidgetLabels[languageIndx].c_str()); } QStatus Label::readLabelArg(MsgArg* val) { QStatus status = ER_OK; char* label; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &label)) m_Label = label; return status; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/Property.cc000066400000000000000000000735601272147170000222640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../ControlPanelConstants.h" #include "../BusObjects/PropertyBusObject.h" #include namespace ajn { namespace services { using namespace cpsConsts; Property::Property(qcc::String name, Widget* rootWidget, PropertyType propertyType) : Widget(name, rootWidget, WIDGET_TYPE_PROPERTY), m_PropertyType(propertyType), m_ValueString(""), m_UnitOfMeasure(""), m_GetUnitOfMeasures(0), m_ConstraintRange(0) { m_GetValue.getBoolValue = 0; // initialize to null m_Value.dateValue = 0; // initialize to null } Property::Property(qcc::String name, Widget* rootWidget, ControlPanelDevice* device) : Widget(name, rootWidget, device, WIDGET_TYPE_PROPERTY), m_PropertyType(UNDEFINED), m_ValueString(""), m_UnitOfMeasure(""), m_GetUnitOfMeasures(0), m_ConstraintRange(0) { m_GetValue.getBoolValue = 0; // initialize to null m_Value.dateValue = 0; // initialize to null } Property::~Property() { if (m_ConstraintRange) { delete m_ConstraintRange; } if (m_ControlPanelMode == CONTROLLER_MODE && m_PropertyType == DATE_PROPERTY && m_Value.dateValue != 0) { delete m_Value.dateValue; } else if (m_ControlPanelMode == CONTROLLER_MODE && m_PropertyType == TIME_PROPERTY && m_Value.timeValue != 0) { delete m_Value.timeValue; } } WidgetBusObject* Property::createWidgetBusObject(BusAttachment* bus, qcc::String const& objectPath, uint16_t langIndx, QStatus& status) { return new PropertyBusObject(bus, objectPath, langIndx, status, this); } PropertyType Property::getPropertyType() const { return m_PropertyType; } PropertyValue Property::getPropertyValue() const { return m_Value; } const qcc::String& Property::getUnitOfMeasure() const { return m_UnitOfMeasure; } const std::vector& Property::getUnitOfMeasures() const { return m_UnitOfMeasures; } void Property::setUnitOfMeasures(const std::vector& unitOfMeasures) { m_UnitOfMeasures = unitOfMeasures; } GetStringFptr Property::getGetUnitOfMeasures() const { return m_GetUnitOfMeasures; } void Property::setGetUnitOfMeasures(GetStringFptr getUnitOfMeasures) { m_GetUnitOfMeasures = getUnitOfMeasures; } const std::vector& Property::getConstraintList() const { return m_ConstraintList; } void Property::setConstraintList(const std::vector& constraintList) { m_ConstraintList = constraintList; } ConstraintRange* Property::getConstraintRange() const { return m_ConstraintRange; } void Property::setConstraintRange(ConstraintRange* constraintRange) { m_ConstraintRange = constraintRange; } bool Property::validateGetValue(PropertyType propertyType) { if (m_PropertyType != propertyType) { QCC_DbgHLPrintf(("Could not set GetValue. Value Type is wrong.")); return false; } return true; } QStatus Property::validateValue(PropertyType propertyType) { if (m_PropertyType != UNDEFINED && m_PropertyType != propertyType) { QCC_DbgHLPrintf(("Could not set Value. Value Type is wrong.")); return ER_BUS_SIGNATURE_MISMATCH; } m_PropertyType = propertyType; return ER_OK; } QStatus Property::setGetValue(uint16_t (*getUint16Value)()) { if (!validateGetValue(UINT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getUint16Value = getUint16Value; return ER_OK; } QStatus Property::setGetValue(int16_t (*getInt16Value)()) { if (!validateGetValue(INT16_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getInt16Value = getInt16Value; return ER_OK; } QStatus Property::setGetValue(uint32_t (*getUint32Value)()) { if (!validateGetValue(UINT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getUint32Value = getUint32Value; return ER_OK; } QStatus Property::setGetValue(int32_t (*getInt32Value)()) { if (!validateGetValue(INT32_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getInt32Value = getInt32Value; return ER_OK; } QStatus Property::setGetValue(uint64_t (*getUint64Value)()) { if (!validateGetValue(UINT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getUint64Value = getUint64Value; return ER_OK; } QStatus Property::setGetValue(int64_t (*getInt64Value)()) { if (!validateGetValue(INT64_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getInt64Value = getInt64Value; return ER_OK; } QStatus Property::setGetValue(double (*getDoubleValue)()) { if (!validateGetValue(DOUBLE_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getDoubleValue = getDoubleValue; return ER_OK; } QStatus Property::setGetValue(const char* (*getCharValue)()) { if (!validateGetValue(STRING_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getCharValue = getCharValue; return ER_OK; } QStatus Property::setGetValue(bool (*getBoolValue)()) { if (!validateGetValue(BOOL_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getBoolValue = getBoolValue; return ER_OK; } QStatus Property::setGetValue(const CPSDate& (*getDateValue)()) { if (!validateGetValue(DATE_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getDateValue = getDateValue; return ER_OK; } QStatus Property::setGetValue(const CPSTime& (*getTimeValue)()) { if (!validateGetValue(TIME_PROPERTY)) { return ER_BUS_SET_WRONG_SIGNATURE; } m_GetValue.getTimeValue = getTimeValue; return ER_OK; } QStatus Property::fillPropertyValueArg(MsgArg& val, uint16_t languageIndx) { QCC_UNUSED(languageIndx); QStatus status = ER_BUS_NO_SUCH_PROPERTY; if (!m_GetValue.getBoolValue) { QCC_DbgHLPrintf(("GetValue is not defined")); return status; } MsgArg* variantArg = new MsgArg(); switch (m_PropertyType) { case UINT16_PROPERTY: status = variantArg->Set(AJPARAM_UINT16.c_str(), m_GetValue.getUint16Value()); break; case INT16_PROPERTY: status = variantArg->Set(AJPARAM_INT16.c_str(), m_GetValue.getInt16Value()); break; case UINT32_PROPERTY: status = variantArg->Set(AJPARAM_UINT32.c_str(), m_GetValue.getUint32Value()); break; case INT32_PROPERTY: status = variantArg->Set(AJPARAM_INT32.c_str(), m_GetValue.getInt32Value()); break; case UINT64_PROPERTY: status = variantArg->Set(AJPARAM_UINT64.c_str(), m_GetValue.getUint64Value()); break; case INT64_PROPERTY: status = variantArg->Set(AJPARAM_INT64.c_str(), m_GetValue.getInt64Value()); break; case DOUBLE_PROPERTY: status = variantArg->Set(AJPARAM_DOUBLE.c_str(), m_GetValue.getDoubleValue()); break; case STRING_PROPERTY: status = variantArg->Set(AJPARAM_STR.c_str(), m_GetValue.getCharValue()); break; case BOOL_PROPERTY: status = variantArg->Set(AJPARAM_BOOL.c_str(), m_GetValue.getBoolValue()); break; case DATE_PROPERTY: { CPSDate date = m_GetValue.getDateValue(); status = variantArg->Set(AJPARAM_DATE_OR_TIME.c_str(), DATE_PROPERTY_TYPE, date.getDay(), date.getMonth(), date.getYear()); break; } case TIME_PROPERTY: { CPSTime time = m_GetValue.getTimeValue(); status = variantArg->Set(AJPARAM_DATE_OR_TIME.c_str(), TIME_PROPERTY_TYPE, time.getHour(), time.getMinute(), time.getSecond()); break; } case UNDEFINED: QCC_DbgHLPrintf(("Property type is not defined")); break; } if (status != ER_OK) { QCC_DbgHLPrintf(("Could not marshal VariantArg")); delete variantArg; return status; } status = val.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_DbgHLPrintf(("Could not marshal ValueArg")); delete variantArg; return status; } val.SetOwnershipFlags(MsgArg::OwnsArgs, true); return status; } QStatus Property::fillOptParamsArg(MsgArg& val, uint16_t languageIndx) { QStatus status; MsgArg* optParams = new MsgArg[NUM_OPT_PARAMS]; size_t optParamIndx = 0; status = Widget::fillOptParamsArg(optParams, languageIndx, optParamIndx); if (status != ER_OK) { QCC_LogError(status, ("Could not marshal optParams")); delete[] optParams; return status; } if (m_UnitOfMeasures.size() > languageIndx || m_GetUnitOfMeasures) { MsgArg* unitMeasureArg = new MsgArg(AJPARAM_STR.c_str(), m_GetUnitOfMeasures ? m_GetUnitOfMeasures(languageIndx) : m_UnitOfMeasures[languageIndx].c_str()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), UNIT_MEASURE, unitMeasureArg)) != ER_OK) { delete unitMeasureArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_ConstraintList.size()) { MsgArg* constraintListArrayArg = new MsgArg[m_ConstraintList.size()]; for (uint16_t indx = 0; indx < m_ConstraintList.size(); indx++) { status = m_ConstraintList[indx].fillConstraintArg(constraintListArrayArg[indx], languageIndx, m_PropertyType); if (status != ER_OK) { break; } } if (status != ER_OK) { delete[] constraintListArrayArg; delete[] optParams; return status; } MsgArg* constraintListArg = new MsgArg(AJPARAM_ARRAY_STRUCT_VAR_STR.c_str(), m_ConstraintList.size(), constraintListArrayArg); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), CONSTRAINT_LIST, constraintListArg)) != ER_OK) { delete constraintListArg; delete[] constraintListArrayArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_ConstraintRange) { MsgArg* constraintRangeArg = new MsgArg(); status = m_ConstraintRange->fillConstraintArg(*constraintRangeArg, languageIndx, m_PropertyType); if (status != ER_OK) { delete constraintRangeArg; delete[] optParams; return status; } if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), CONSTRAINT_RANGE, constraintRangeArg)) != ER_OK) { delete constraintRangeArg; delete[] optParams; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } return val.Set(AJPARAM_ARRAY_DICT_UINT16_VAR.c_str(), optParamIndx, optParams); } QStatus Property::setPropertyValue(MsgArg& val, uint16_t languageIndx) { QCC_UNUSED(languageIndx); QStatus status; switch (m_PropertyType) { case UINT16_PROPERTY: { uint16_t value; CHECK_AND_RETURN(val.Get(AJPARAM_UINT16.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case INT16_PROPERTY: { int16_t value; CHECK_AND_RETURN(val.Get(AJPARAM_INT16.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case UINT32_PROPERTY: { uint32_t value; CHECK_AND_RETURN(val.Get(AJPARAM_UINT32.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case INT32_PROPERTY: { int32_t value; CHECK_AND_RETURN(val.Get(AJPARAM_INT32.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case UINT64_PROPERTY: { uint64_t value; CHECK_AND_RETURN(val.Get(AJPARAM_UINT64.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case INT64_PROPERTY: { int64_t value; CHECK_AND_RETURN(val.Get(AJPARAM_INT64.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case DOUBLE_PROPERTY: { double value; CHECK_AND_RETURN(val.Get(AJPARAM_DOUBLE.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case STRING_PROPERTY: { char* value; CHECK_AND_RETURN(val.Get(AJPARAM_STR.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case BOOL_PROPERTY: { bool value; CHECK_AND_RETURN(val.Get(AJPARAM_BOOL.c_str(), &value)); CHECK_AND_RETURN(setValue(value)); break; } case DATE_PROPERTY: { uint16_t type; uint16_t day; uint16_t month; uint16_t year; CHECK_AND_RETURN(val.Get(AJPARAM_DATE_OR_TIME.c_str(), &type, &day, &month, &year)); if (type != DATE_PROPERTY_TYPE) { QCC_DbgHLPrintf(("Did not receive the DateProperty type as expected")); return ER_BUS_SIGNATURE_MISMATCH; } CPSDate value(day, month, year); CHECK_AND_RETURN(setValue(value)); break; } case TIME_PROPERTY: { uint16_t type; uint16_t hour; uint16_t minute; uint16_t second; CHECK_AND_RETURN(val.Get(AJPARAM_DATE_OR_TIME.c_str(), &type, &hour, &minute, &second)); if (type != TIME_PROPERTY_TYPE) { QCC_DbgHLPrintf(("Did not receive the TimeProperty type as expected")); return ER_BUS_SIGNATURE_MISMATCH; } CPSTime value(hour, minute, second); CHECK_AND_RETURN(setValue(value)); break; } default: status = ER_BUS_NO_SUCH_PROPERTY; break; } if (status == ER_OK) { QCC_DbgPrintf(("Set property succeeded - sending ValueChanged signal.")); status = SendValueChangedSignal(); } return status; } QStatus Property::readOptParamsArg(uint16_t key, MsgArg* val) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; switch (key) { case UNIT_MEASURE: { char* unitOfMeasure; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &unitOfMeasure)) m_UnitOfMeasure = unitOfMeasure; break; } case CONSTRAINT_LIST: { m_ConstraintList.clear(); MsgArg* constraintEntries; size_t constraintNum; CHECK_AND_RETURN(val->Get(AJPARAM_ARRAY_STRUCT_VAR_STR.c_str(), &constraintNum, &constraintEntries)); for (size_t i = 0; i < constraintNum; i++) { ConstraintList constraint; CHECK_AND_RETURN(constraint.readConstraintArg(constraintEntries[i])) m_ConstraintList.push_back(constraint); } break; } case CONSTRAINT_RANGE: { if (!m_ConstraintRange) { m_ConstraintRange = new ConstraintRange(); } CHECK_AND_RETURN(m_ConstraintRange->readConstraintArg(val)) break; } default: status = Widget::readOptParamsArg(key, val); } return status; } QStatus Property::readValueArg(const MsgArg* val) { QStatus status = ER_OK; switch (val->typeId) { case ALLJOYN_UINT16: { CHECK_AND_RETURN(validateValue(UINT16_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_UINT16.c_str(), &m_Value.uint16Value)) break; } case ALLJOYN_INT16: { CHECK_AND_RETURN(validateValue(INT16_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_INT16.c_str(), &m_Value.int16Value)) break; } case ALLJOYN_UINT32: { CHECK_AND_RETURN(validateValue(UINT32_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_UINT32.c_str(), &m_Value.uint32Value)) break; } case ALLJOYN_INT32: { CHECK_AND_RETURN(validateValue(INT32_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_INT32.c_str(), &m_Value.int32Value)) break; } case ALLJOYN_UINT64: { CHECK_AND_RETURN(validateValue(UINT64_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_UINT64.c_str(), &m_Value.uint64Value)) break; } case ALLJOYN_INT64: { CHECK_AND_RETURN(validateValue(INT64_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_INT64.c_str(), &m_Value.int64Value)) break; } case ALLJOYN_DOUBLE: { CHECK_AND_RETURN(validateValue(DOUBLE_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_DOUBLE.c_str(), &m_Value.doubleValue)) break; } case ALLJOYN_STRING: { char* value; CHECK_AND_RETURN(validateValue(STRING_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &value)) m_ValueString = value; m_Value.charValue = m_ValueString.c_str(); break; } case ALLJOYN_BOOLEAN: { CHECK_AND_RETURN(validateValue(BOOL_PROPERTY)) CHECK_AND_RETURN(val->Get(AJPARAM_BOOL.c_str(), &m_Value.boolValue)) break; } case ALLJOYN_STRUCT: { uint16_t dateOrTime; uint16_t dateOrTimeVal1; uint16_t dateOrTimeVal2; uint16_t dateOrTimeVal3; CHECK_AND_RETURN(val->Get(AJPARAM_DATE_OR_TIME.c_str(), &dateOrTime, &dateOrTimeVal1, &dateOrTimeVal2, &dateOrTimeVal3)) if (dateOrTime == DATE_PROPERTY_TYPE) { CHECK_AND_RETURN(validateValue(DATE_PROPERTY)) if (m_Value.dateValue == 0) { m_Value.dateValue = new CPSDate(dateOrTimeVal1, dateOrTimeVal2, dateOrTimeVal3); } else { m_Value.dateValue->setDay(dateOrTimeVal1); m_Value.dateValue->setMonth(dateOrTimeVal2); m_Value.dateValue->setYear(dateOrTimeVal3); } } else if (dateOrTime == TIME_PROPERTY_TYPE) { CHECK_AND_RETURN(validateValue(TIME_PROPERTY)) if (m_Value.timeValue == 0) { m_Value.timeValue = new CPSTime(dateOrTimeVal1, dateOrTimeVal2, dateOrTimeVal3); } else { m_Value.timeValue->setHour(dateOrTimeVal1); m_Value.timeValue->setMinute(dateOrTimeVal2); m_Value.timeValue->setSecond(dateOrTimeVal3); } } else { status = ER_BUS_SIGNATURE_MISMATCH; } break; } default: status = ER_BUS_SIGNATURE_MISMATCH; break; } return status; } QStatus Property::SendValueChangedSignal() { QStatus status = ER_OK; for (size_t indx = 0; indx < m_BusObjects.size(); indx++) { status = ((PropertyBusObject*)m_BusObjects[indx])->SendValueChangedSignal(); if (status != ER_OK) { QCC_LogError(status, ("Could not send Value Changed Signal")); return status; } } return status; } void Property::ValueChanged(Message& msg) { ControlPanelListener* listener = m_Device->getListener(); BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (busAttachment) { busAttachment->EnableConcurrentCallbacks(); } const ajn::MsgArg* returnArgs; size_t numArgs; msg->GetArgs(numArgs, returnArgs); if (numArgs != 1) { QCC_DbgHLPrintf(("Received unexpected amount of returnArgs")); if (listener) { listener->errorOccured(m_Device, ER_BUS_UNEXPECTED_SIGNATURE, REFRESH_VALUE, "Received unexpected amount of returnArgs"); } return; } QStatus status = ER_OK; if (returnArgs[0].typeId == ALLJOYN_VARIANT) { status = readValueArg(returnArgs[0].v_variant.val); } else { status = readValueArg(&returnArgs[0]); } if (status != ER_OK) { QCC_LogError(status, ("Something went wrong reading the Value Argument")); if (listener) { listener->errorOccured(m_Device, status, REFRESH_VALUE, "Could not read Value Argument"); } return; } if (listener) { listener->signalPropertyValueChanged(m_Device, this); } } QStatus Property::defaultErrorSetValue() { QCC_DbgHLPrintf(("setValue function not defined")); return ER_NOT_IMPLEMENTED; } QStatus Property::setValue(bool value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_BOOL.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(uint16_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_UINT16.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(int16_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_INT16.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(uint32_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_UINT32.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(int32_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_INT32.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(uint64_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_UINT64.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(int64_t value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_INT64.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(double value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_DOUBLE.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(const char* value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_STR.c_str(), value); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(const CPSDate& value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_DATE_OR_TIME.c_str(), DATE_PROPERTY_TYPE, value.getDay(), value.getMonth(), value.getYear()); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } QStatus Property::setValue(const CPSTime& value) { if (m_ControlPanelMode == CONTROLLEE_MODE) { return defaultErrorSetValue(); } if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("Cannot SetValue. BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } MsgArg valueArg; MsgArg* variantArg = new MsgArg(AJPARAM_DATE_OR_TIME.c_str(), TIME_PROPERTY_TYPE, value.getHour(), value.getMinute(), value.getSecond()); QStatus status = valueArg.Set(AJPARAM_VAR.c_str(), variantArg); if (status != ER_OK) { QCC_LogError(status, ("Could not SetValue of property")); delete variantArg; return status; } valueArg.SetOwnershipFlags(MsgArg::OwnsArgs, true); return ((PropertyBusObject*)m_BusObjects[0])->SetValue(valueArg); } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/RootWidget.cc000066400000000000000000000071021272147170000225140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../BusObjects/NotificationActionBusObject.h" #include namespace ajn { namespace services { RootWidget::RootWidget(qcc::String const& name, Widget* rootWidget, WidgetType widgetType) : Widget(name, rootWidget, widgetType), m_NotificationActionBusObject(0), m_ObjectPath("") { } RootWidget::RootWidget(qcc::String const& name, Widget* rootWidget, qcc::String const& objectPath, ControlPanelDevice* device, WidgetType widgetType) : Widget(name, rootWidget, device, widgetType), m_NotificationActionBusObject(0), m_ObjectPath(objectPath) { } RootWidget::~RootWidget() { } QStatus RootWidget::SendDismissSignal() { if (!m_NotificationActionBusObject) { return ER_BUS_OBJECT_NOT_REGISTERED; } return ((NotificationActionBusObject*)m_NotificationActionBusObject)->SendDismissSignal(); } QStatus RootWidget::setNotificationActionBusObject(BusObject* notificationActionBusObject) { if (!notificationActionBusObject) { QCC_DbgHLPrintf(("Could not add a NULL notificationActionBusObject")); return ER_BAD_ARG_1; } if (m_NotificationActionBusObject) { QCC_DbgHLPrintf(("Could not set notificationActionBusObject. NotificationActionBusObject already set")); return ER_BUS_PROPERTY_ALREADY_EXISTS; } m_NotificationActionBusObject = notificationActionBusObject; return ER_OK; } QStatus RootWidget::unregisterObjects(BusAttachment* bus) { QStatus status = Widget::unregisterObjects(bus); if (status != ER_OK) { QCC_LogError(status, ("Could not unregister BusObjects")); } if (m_NotificationActionBusObject) { bus->UnregisterBusObject(*m_NotificationActionBusObject); delete m_NotificationActionBusObject; m_NotificationActionBusObject = 0; } return status; } QStatus RootWidget::registerObjects(BusAttachment* bus) { return Widget::registerObjects(bus, m_ObjectPath); } QStatus RootWidget::registerObjects(BusAttachment* bus, qcc::String const& objectPath) { return Widget::registerObjects(bus, objectPath); } QStatus RootWidget::registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot) { return Widget::registerObjects(bus, languageSet, objectPathPrefix, objectPathSuffix, isRoot); } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/src/Widgets/Widget.cc000066400000000000000000000374101272147170000216550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "../ControlPanelConstants.h" #include "../BusObjects/WidgetBusObject.h" #include #define STATE_ENABLED 0x01 #define STATE_WRITABLE 0x02 namespace ajn { namespace services { using namespace cpsConsts; Widget::Widget(qcc::String const& name, Widget* rootWidget, WidgetType widgetType) : m_Name(name), m_WidgetType(widgetType), m_RootWidget(rootWidget), m_IsSecured(false), m_Version(1), m_States(0), m_GetEnabled(0), m_GetWritable(0), m_BgColor(UINT32_MAX), m_GetBgColor(0), m_Label(""), m_GetLabels(0), m_ControlPanelMode(CONTROLLEE_MODE), m_Device(0) { } Widget::Widget(qcc::String const& name, Widget* rootWidget, ControlPanelDevice* device, WidgetType widgetType) : m_Name(name), m_WidgetType(widgetType), m_RootWidget(rootWidget), m_IsSecured(false), m_Version(1), m_States(0), m_GetEnabled(0), m_GetWritable(0), m_BgColor(UINT32_MAX), m_GetBgColor(0), m_Label(""), m_GetLabels(0), m_ControlPanelMode(CONTROLLER_MODE), m_Device(device) { } Widget::Widget(const Widget& widget) { QCC_UNUSED(widget); } Widget& Widget::operator=(const Widget& widget) { QCC_UNUSED(widget); return *this; } Widget::~Widget() { } WidgetType Widget::getWidgetType() const { return m_WidgetType; } qcc::String const& Widget::getWidgetName() const { return m_Name; } ControlPanelMode Widget::getControlPanelMode() const { return m_ControlPanelMode; } Widget* Widget::getRootWidget() const { return m_RootWidget; } ControlPanelDevice* Widget::getDevice() const { return m_Device; } const uint16_t Widget::getInterfaceVersion() const { if (!m_BusObjects.size()) { return 1; } return m_ControlPanelMode == CONTROLLEE_MODE ? m_BusObjects[0]->getInterfaceVersion() : m_Version; } void Widget::setIsSecured(bool secured) { m_IsSecured = secured; } bool Widget::getIsSecured() const { return m_IsSecured; } bool Widget::getIsEnabled() const { return (m_States & STATE_ENABLED) == STATE_ENABLED; } bool Widget::getIsWritable() const { return (m_States & STATE_WRITABLE) == STATE_WRITABLE; } void Widget::setEnabled(bool enabled) { if (enabled) { m_States = m_States | STATE_ENABLED; } else { m_States = m_States & ~STATE_ENABLED; } } GetBoolFptr Widget::getGetEnabled() const { return m_GetEnabled; } void Widget::setGetEnabled(GetBoolFptr getEnabled) { m_GetEnabled = getEnabled; } void Widget::setWritable(bool writable) { if (writable) { m_States = m_States | STATE_WRITABLE; } else { m_States = m_States & ~STATE_WRITABLE; } } void Widget::setGetWritable(GetBoolFptr getWritable) { m_GetWritable = getWritable; } GetBoolFptr Widget::getGetWritable() const { return m_GetWritable; } uint32_t Widget::getStates() const { return m_States; } void Widget::setStates(uint8_t enabled, uint8_t writable) { setEnabled(enabled); setWritable(writable); } uint32_t Widget::getBgColor() const { return m_BgColor; } void Widget::setBgColor(uint32_t bgColor) { this->m_BgColor = bgColor; } GetUint32Fptr Widget::getGetBgColor() const { return m_GetBgColor; } void Widget::setGetBgColor(GetUint32Fptr getBgColor) { m_GetBgColor = getBgColor; } const qcc::String& Widget::getLabel() const { return m_Label; } const std::vector& Widget::getLabels() const { return m_Labels; } void Widget::setLabels(const std::vector& labels) { m_Labels = labels; } GetStringFptr Widget::getGetLabels() const { return m_GetLabels; } void Widget::setGetLabels(GetStringFptr getLabels) { m_GetLabels = getLabels; } const std::vector& Widget::getHints() const { return m_Hints; } void Widget::setHints(const std::vector& hints) { m_Hints = hints; } QStatus Widget::registerObjects(BusAttachment* bus, LanguageSet const& languageSet, qcc::String const& objectPathPrefix, qcc::String const& objectPathSuffix, bool isRoot) { if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status = ER_OK; const std::vector& languages = languageSet.getLanguages(); qcc::String newObjectPathSuffix = isRoot ? objectPathSuffix : objectPathSuffix + "/" + m_Name; for (size_t indx = 0; indx < languages.size(); indx++) { qcc::String objectPath = objectPathPrefix + languages[indx] + newObjectPathSuffix; WidgetBusObject* busObject = createWidgetBusObject(bus, objectPath, indx, status); if (status != ER_OK) { QCC_LogError(status, ("Could not Create BusObject")); delete busObject; return status; } status = bus->RegisterBusObject(*busObject); if (status != ER_OK) { QCC_LogError(status, ("Could not register BusObject")); delete busObject; return status; } m_BusObjects.push_back(busObject); } return status; } QStatus Widget::registerObjects(BusAttachment* bus, qcc::String const& objectPath) { if (m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject already exists - refreshing widget")); return refreshObjects(bus); } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status; WidgetBusObject* busObject = createWidgetBusObject(bus, objectPath, 0, status); if (status != ER_OK) { QCC_LogError(status, ("Could not Create BusObject")); delete busObject; return status; } m_BusObjects.push_back(busObject); status = busObject->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = fillProperties(); if (status != ER_OK) { QCC_LogError(status, ("Call to FillProperties failed")); return status; } status = addChildren(bus); if (status != ER_OK) { QCC_LogError(status, ("Call to addChildren failed")); return status; } return status; } QStatus Widget::refreshObjects(BusAttachment* bus) { if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject does not exist - exiting")); return ER_BUS_OBJECT_NOT_REGISTERED; } if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } QStatus status = m_BusObjects[0]->setRemoteController(bus, m_Device->getDeviceBusName(), m_Device->getSessionId()); if (status != ER_OK) { QCC_LogError(status, ("Call to SetRemoteController failed")); return status; } status = checkVersions(); if (status != ER_OK) { QCC_LogError(status, ("Call to CheckVersions failed")); return status; } status = fillProperties(); if (status != ER_OK) { QCC_LogError(status, ("Call to FillProperties failed")); return status; } status = refreshChildren(bus); if (status != ER_OK) { QCC_LogError(status, ("Call to refreshChildren failed")); return status; } return status; } QStatus Widget::unregisterObjects(BusAttachment* bus) { if (!bus) { QCC_DbgHLPrintf(("Could not register Object. Bus is NULL")); return ER_BAD_ARG_1; } if (!(bus->IsStarted() && bus->IsConnected())) { QCC_DbgHLPrintf(("Could not register Object. Bus is not started or not connected")); return ER_BAD_ARG_1; } std::vector::iterator it; for (it = m_BusObjects.begin(); it != m_BusObjects.end();) { if (m_ControlPanelMode == CONTROLLEE_MODE) { bus->UnregisterBusObject(*(*it)); } else { (*it)->UnregisterSignalHandler(bus); } delete *it; it = m_BusObjects.erase(it); } return ER_OK; } QStatus Widget::fillStatesArg(MsgArg& val, uint16_t languageIndx) { QCC_UNUSED(languageIndx); if (m_GetEnabled) { setEnabled(m_GetEnabled()); } if (m_GetWritable) { setWritable(m_GetWritable()); } return val.Set(AJPARAM_UINT32.c_str(), m_States); } QStatus Widget::fillOptParamsArg(MsgArg& val, uint16_t languageIndx) { QStatus status; MsgArg* optParams = new MsgArg[NUM_OPT_PARAMS]; size_t optParamIndx = 0; status = fillOptParamsArg(optParams, languageIndx, optParamIndx); if (status != ER_OK) { QCC_LogError(status, ("Could not marshal optParams")); delete[] optParams; return status; } return val.Set(AJPARAM_ARRAY_DICT_UINT16_VAR.c_str(), optParamIndx, optParams); } QStatus Widget::fillOptParamsArg(MsgArg* optParams, uint16_t languageIndx, size_t& optParamIndx) { QStatus status = ER_OK; if (m_Labels.size() > languageIndx || m_GetLabels) { MsgArg* labelArg = new MsgArg(AJPARAM_STR.c_str(), m_GetLabels ? m_GetLabels(languageIndx) : m_Labels[languageIndx].c_str()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), LABEL_KEY, labelArg)) != ER_OK) { delete labelArg; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_BgColor != UINT32_MAX || m_GetBgColor) { MsgArg* bgColorArg = new MsgArg(AJPARAM_UINT32.c_str(), m_GetBgColor ? m_GetBgColor() : m_BgColor); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), BGCOLOR_KEY, bgColorArg)) != ER_OK) { delete bgColorArg; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } if (m_Hints.size()) { MsgArg* hintsArg = new MsgArg(AJPARAM_ARRAY_UINT16.c_str(), m_Hints.size(), m_Hints.data()); if ((status = optParams[optParamIndx].Set(AJPARAM_DICT_UINT16_VAR.c_str(), HINT_KEY, hintsArg)) != ER_OK) { delete hintsArg; return status; } optParams[optParamIndx++].SetOwnershipFlags(MsgArg::OwnsArgs, true); } return status; } QStatus Widget::readVersionArg(MsgArg* val) { uint16_t version = 0; QStatus status; CHECK_AND_RETURN(val->Get(AJPARAM_UINT16.c_str(), &version)) m_Version = version; return status; } QStatus Widget::readStatesArg(MsgArg* val) { uint32_t states = 0; QStatus status; CHECK_AND_RETURN(val->Get(AJPARAM_UINT32.c_str(), &states)) m_States = states; return status; } QStatus Widget::readOptParamsArg(MsgArg* val) { MsgArg* optParamsEntries; size_t optParamsNum; QStatus status; CHECK_AND_RETURN(val->Get(AJPARAM_ARRAY_DICT_UINT16_VAR.c_str(), &optParamsNum, &optParamsEntries)); for (size_t i = 0; i < optParamsNum; i++) { uint16_t key; MsgArg* variant; CHECK_AND_BREAK(optParamsEntries[i].Get(AJPARAM_DICT_UINT16_VAR.c_str(), &key, &variant)); CHECK_AND_BREAK(readOptParamsArg(key, variant)) } return status; } QStatus Widget::readOptParamsArg(uint16_t key, MsgArg* val) { QStatus status = ER_BUS_NO_SUCH_PROPERTY; switch (key) { case LABEL_KEY: { char* label; CHECK_AND_RETURN(val->Get(AJPARAM_STR.c_str(), &label)) m_Label = label; break; } case BGCOLOR_KEY: { uint32_t bgColor; CHECK_AND_RETURN(val->Get(AJPARAM_UINT32.c_str(), &bgColor)) m_BgColor = bgColor; break; } case HINT_KEY: { std::vector hints; uint16_t* hintEntries; size_t hintNum; CHECK_AND_RETURN(val->Get(AJPARAM_ARRAY_UINT16.c_str(), &hintNum, &hintEntries)); for (size_t i = 0; i < hintNum; i++) { hints.push_back(hintEntries[i]); } m_Hints = hints; break; } } return status; } QStatus Widget::SendPropertyChangedSignal() { QStatus status = ER_OK; for (size_t indx = 0; indx < m_BusObjects.size(); indx++) { status = m_BusObjects[indx]->SendPropertyChangedSignal(); if (status != ER_OK) { QCC_LogError(status, ("Could not send Property Changed Signal")); return status; } } return status; } QStatus Widget::checkVersions() { if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } return m_BusObjects[0]->checkVersions(); } QStatus Widget::addChildren(BusAttachment* bus) { QCC_UNUSED(bus); return ER_OK; } QStatus Widget::refreshChildren(BusAttachment* bus) { QCC_UNUSED(bus); return ER_OK; } QStatus Widget::fillProperties() { if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject is not set")); return ER_BUS_BUS_NOT_STARTED; } return m_BusObjects[0]->fillProperties(); } void Widget::PropertyChanged() { BusAttachment* busAttachment = ControlPanelService::getInstance()->getBusAttachment(); if (busAttachment) { busAttachment->EnableConcurrentCallbacks(); } ControlPanelListener* listener = m_Device->getListener(); if (!m_BusObjects.size()) { QCC_DbgHLPrintf(("BusObject is not set")); if (listener) { listener->errorOccured(m_Device, ER_BUS_NO_SUCH_OBJECT, REFRESH_PROPERTIES, "BusObjects are not set. Can't reload properties"); } return; } QStatus status = m_BusObjects[0]->refreshProperties(); if (status != ER_OK) { QCC_LogError(status, ("Something went wrong reloading properties")); if (listener) { listener->errorOccured(m_Device, status, REFRESH_PROPERTIES, "Something went wrong reloading properties"); } return; } } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/tools/000077500000000000000000000000001272147170000170615ustar00rootroot00000000000000base-16.04/controlpanel/cpp/tools/CPSAppGenerator/000077500000000000000000000000001272147170000220165ustar00rootroot00000000000000base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/000077500000000000000000000000001272147170000247655ustar00rootroot00000000000000base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/.gitignore000066400000000000000000000002651272147170000267600ustar00rootroot00000000000000/actionWidget.pyc /commonWidget.pyc /containerWidget.pyc /cpvalidate.pyc /dialogWidget.pyc /generatedCode.pyc /labelWidget.pyc /propertyWidget.pyc /xml2objects.pyc /httpControl.pyc base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/actionWidget.py000066400000000000000000000053751272147170000277720ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import xml.etree.ElementTree as xml import commonWidget as common import dialogWidget as dw class Action (common.Widget): def __init__(self, generated, actionElement, parentObjectPath, languageSetName) : common.Widget.__init__(self, generated, actionElement, parentObjectPath, languageSetName) if hasattr(self.element.onAction, "executeCode") : self.widgetName = self.name[:1].upper() + self.name [1:] else : self.widgetName = "ActionWithDialog" def generate(self) : common.Widget.generate(self) self.generateOnAction() def generateOnAction (self) : onAction = self.element.onAction if hasattr(onAction, "executeCode") : actionHeaderFile = self.generated.actionHeaderFile actionSrcFile = self.generated.actionSrcFile regularName = self.widgetName capitalName = self.name.upper() actionHeaderFile = actionHeaderFile.replace("CAPITAL_NAME_HERE", capitalName) actionHeaderFile = actionHeaderFile.replace("REGULAR_NAME_HERE", regularName) actionSrcFile = actionSrcFile.replace("CAPITAL_NAME_HERE", capitalName) actionSrcFile = actionSrcFile.replace("REGULAR_NAME_HERE", regularName) actionSrcFile = actionSrcFile.replace("ADDITIONAL_INCLUDES_HERE", self.generated.srcIncludes) actionSrcFile = actionSrcFile.replace("EXECUTE_ACTION_HERE", onAction.executeCode) self.generated.headerIncludes += self.generateHeaderInclude() genH = open(self.generated.path + "/" + regularName + ".h", 'w') genH.write(actionHeaderFile) genH.close() genC = open(self.generated.path + "/" + regularName + ".cc", 'w') genC.write(actionSrcFile) genC.close() elif hasattr(onAction, "dialog") : dialog = dw.Dialog(self.generated, onAction.dialog, self.name, self.languageSetName) dialog.generate() base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/commonWidget.py000066400000000000000000000155071272147170000300030ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys def as_list(s): if isinstance(s, list): return s return [s] class Widget: def __init__(self, generated, element, parentName, languageSetName) : self.generated = generated self.element = element self.parentName = parentName self.name = self.generated.unitName + self.element.name[:1].upper() + self.element.name[1:] self.languageSetName = languageSetName self.languageSet = self.generated.languageSets[languageSetName] self.parentAddFunc = "addChildWidget" self.additionalParams = "" self.isRoot = 0 def generate(self) : self.generateBasics() self.generateMandatoryVariables() self.generateOptionalVariables() def generateBasics(self) : self.generated.varDecl += """ static ajn::services::{0}* {1};\n\n""".format(self.widgetName, self.name) self.generated.varDef += """{0}* ControlPanelGenerated::{1} = 0;\n""".format(self.widgetName, self.name) rootWidget = self.parentName if self.isRoot : rootWidget = "NULL" self.generated.initCode += """\n {0} = new {1}("{2}", {3}{4});\n""".format(self.name, self.widgetName, self.element.name, rootWidget, self.additionalParams) self.generated.initCode += """ CHECK({0}->{1}({2}));\n\n""".format(self.parentName, self.parentAddFunc, self.name) self.generated.shutdown += """ if ({0}) {1}\n delete ({0});\n {0} = 0;\n {2}\n""".format(self.name, "{", "}") def generateMandatoryVariables (self) : self.setEnabled() self.setSecured() def generateOptionalVariables (self) : self.setBgColor() self.setLabel() self.setHints() def setSecured (self) : if not hasattr(self.element, "secured") : return self.generated.initCode += " {0}->setIsSecured({1});\n".format(self.name, self.element.secured) def setEnabled (self) : enabled = self.element.enabled if hasattr(enabled, "attr") and "code" in enabled.attr and enabled.attr["code"] == "true" : self.generated.initCode += " {0}->setGetEnabled({1});\n".format(self.name, enabled) else : if enabled != "true" and enabled != "false" : print >> sys.stderr, "ERROR - The value {0} is not supported for enabled in {1}. Exiting".format(enabled, self.name) sys.exit(3) self.generated.initCode += " {0}->setEnabled({1});\n".format(self.name, enabled) def setBgColor (self) : if hasattr(self.element, "bgcolor") : bgColor = self.element.bgcolor if hasattr(bgColor, "attr") and "code" in bgColor.attr and bgColor.attr["code"] == "true" : self.generated.initCode += " {0}->setGetBgColor({1});\n".format(self.name, bgColor) else : self.generated.initCode += " {0}->setBgColor({1});\n".format(self.name, bgColor) def setHints (self) : if not hasattr(self.element, "hints") : return; hints = as_list(self.element.hints.hint) vectorName = self.name + "HintsVec" self.generated.initCode += "\n std::vector {0};\n".format(vectorName) for hint in hints: self.generated.initCode += " {0}.push_back({1});\n".format(vectorName, hint.upper()) self.generated.initCode += " {0}->setHints({1});\n".format(self.name, vectorName) def setLabel (self) : self.setCodeOrValueString ("label", "setLabels", "setGetLabels") def setCodeOrValueString (self, fieldName, variableName, codeVariableName, vectorName = "", elementToUse = 0, elementName = "") : if elementToUse == 0 : element = self.element else : element = elementToUse if not hasattr(element, fieldName) : return; root = getattr(element, fieldName) if root._has("code") : if len(elementName) : self.generated.initCode += " {0}.{1}({2});\n".format(elementName, codeVariableName, root.code) else : self.generated.initCode += " {0}->{1}({2});\n".format(self.name, codeVariableName, root.code) return if root._has("value"): values = as_list(root.value) if len(values) != len(self.languageSet) : print >> sys.stderr, "ERROR - Missing a {1} or too many {1}s defined for {0}. Exiting".format(self.name, fieldName) sys.exit(3) if len(vectorName) : vectorName = self.name + vectorName + "Vec" else : vectorName = self.name + fieldName + "Vec" self.generated.initCode += "\n std::vector {0};\n".format(vectorName) for lang in self.languageSet : value = filter(lambda x: x.attr["language"] == lang, values) if len(value) != 1: print >> sys.stderr, "ERROR - No {0} is defined or multiple {0}s are defined for language: {1} in {2}. Exiting".format(fieldName, lang, self.name) sys.exit(3) if value[0].attr['type'] == 'constant': self.generated.initCode += """ {0}.push_back({1});\n""".format(vectorName, value[0]) else: self.generated.initCode += """ {0}.push_back("{1}");\n""".format(vectorName, value[0]) if len(elementName) : self.generated.initCode += " {0}.{1}({2});\n".format(elementName, variableName, vectorName) else : self.generated.initCode += " {0}->{1}({2});\n".format(self.name, variableName, vectorName) def generateHeaderInclude(self): # On Windows replace backslash with slash basePath = self.generated.path.replace("\\", "/") # Remove all trailing / from the path while basePath.endswith("/"): basePath = basePath[:-1] return """#include "{0}/{1}.h"\n""".format(basePath, self.widgetName) base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/containerWidget.py000066400000000000000000000056051272147170000304730ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import propertyWidget as pw import actionWidget as aw import labelWidget as lw import commonWidget as common class Container (common.Widget): def __init__(self, generated, element, parentName, languageSetName, isRoot = 0) : common.Widget.__init__(self, generated, element, parentName, languageSetName) self.isRoot = isRoot self.widgetName = "Container" if isRoot : self.parentAddFunc = "setRootWidget" def generate(self) : common.Widget.generate(self) if self.isRoot: self.setDismissable() self.generateChildElements() def setDismissable(self) : if not hasattr(self.element, "dismissable") : return self.generated.initCode += " {0}->setIsDismissable({1});\n".format(self.name, self.element.dismissable) def generateChildElements (self) : elements = self.element.elements.sub_nodes for element in elements: elementType = element._name if elementType == "action" : action = aw.Action(self.generated, element, self.name, self.languageSetName) action.generate() elif elementType == "container" : container = Container(self.generated, element, self.name, self.languageSetName) container.generate() elif elementType == "scalarProperty" or elementType == "stringProperty" or elementType == "booleanProperty" : propertyW = pw.Property(self.generated, element, self.name, self.languageSetName) propertyW.generate() elif elementType == "dateProperty" or elementType == "timeProperty" : propertyW = pw.Property(self.generated, element, self.name, self.languageSetName) propertyW.generate() elif elementType == "labelProperty" : label = lw.Label(self.generated, element, self.name, self.languageSetName) label.generate() else : print >> sys.stderr, "ERROR - This type is not supported. Exiting " + elementType sys.exit(2)base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/cpvalidate.py000066400000000000000000000120641272147170000274560ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import xml2objects from sys import stderr class Validator(): def validate(self, root): ret = True for obj in root._find_field(self.__class__.__name__): self.root = obj for rule in filter(lambda x: x.startswith('rule_'), dir(self)): rule_func = getattr(self, rule) if not rule_func(): stderr.write('Error validating "%s": %s\n' % (self.__class__.__name__, rule_func.__doc__)) ret = False return ret def check_hints(self, valid_hints): for hint in self.root._find_field('hint'): if hint not in valid_hints: return False return True def has_hint(self, hint): return hint in self.root._find_field('hint') def has_constraintVals(self): return self.root._find_field('constraintVals') def has_constraintRange(self): return self.root._find_field('constraintRange') class scalarProperty(Validator): def rule_hints(self): 'hints must be one of ["spinner", "radiobutton", "slider", "numberpicker", "keypad", "numericview"]' return self.check_hints(valid_hints = ["spinner", "radiobutton", "slider", "numberpicker", "keypad", "numericview"]) def rule_slider_only_range(self): 'hint of type "slider" must have a contraintRange' if not self.has_hint('slider'): return True return self.has_constraintRange() def rule_numberpicker_has_range(self): 'a "numberpicker" must have a constraint Range' if not self.has_hint('numberpicker'): return True return self.has_constraintRange() def rule_keypad_no_constraints(self): 'keypad must have no constraints' if not self.has_hint('keypad'): return True return not (self.has_constraintVals() or self.has_constraintRange()) def rule_numericview_no_constraints(self): 'numericview must have no constraints' if not self.has_hint('numericview'): return True return not (self.has_constraintVals() or self.has_constraintRange()) def rule_spinner_requires_constraint(self): 'a spinner requires a constraintRange or connstraintVals' if not self.has_hint('spinner'): return True return (self.has_constraintVals() or self.has_constraintRange()) def rule_radiobutton_requires_constraint(self): 'a radiobutton requires a constraintRange or connstraintVals' if not self.has_hint('radiobutton'): return True return (self.has_constraintVals() or self.has_constraintRange()) class stringProperty(Validator): def rule_hints(self): 'hints must be one of ["switch", "spinner", "radiobutton", "textview", "edittext"]' return self.check_hints(valid_hints = ["switch", "spinner", "radiobutton", "textview", "edittext"]) def rule_no_ranges(self): 'a string property can not have a constraintRange' return not self.has_constraintRange() def rule_switch_has_2_hints(self): 'a switch must have exactly two constraintVals' if not self.has_hint('switch'): return True constraints = self.root._find_field('constraint') return 2 == len(constraints) def rule_spinner_requires_constraint(self): 'a spinner requires connstraintVals' if not self.has_hint('spinner'): return True return self.has_constraintVals() def rule_radiobutton_requires_constraint(self): 'a radiobutton requires connstraintVals' if not self.has_hint('radiobutton'): return True return self.has_constraintVals() def rule_textview_no_constraints(self): 'textview must have no constraints' if not self.has_hint('textview'): return True return not (self.has_constraintVals() or self.has_constraintRange()) def rule_edittext_no_constraints(self): 'edittext must have no constraints' if not self.has_hint('edittext'): return True return not (self.has_constraintVals() or self.has_constraintRange()) class dateProperty(Validator): def rule_hints(self): 'hints must be one of ["datepicker"]' return self.check_hints(valid_hints = ["datepicker"]) class timeProperty(Validator): def rule_hints(self): 'hints must be one of ["timepicker"]' return self.check_hints(valid_hints = ["timepicker"]) class booleanProperty(Validator): def rule_hints(self): 'hints must be one of ["checkbox"]' return self.check_hints(valid_hints = ["checkbox"]) def validate_all(root): ret = True ret = scalarProperty().validate(root) and ret ret = stringProperty().validate(root) and ret ret = dateProperty().validate(root) and ret ret = timeProperty().validate(root) and ret ret = booleanProperty().validate(root) and ret return ret base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/dialogWidget.py000066400000000000000000000066011272147170000277450ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import xml.etree.ElementTree as xml import commonWidget as common class Dialog (common.Widget): def __init__(self, generated, dialogElement, parentName, languageSetName, isRoot = 0) : common.Widget.__init__(self, generated, dialogElement, parentName, languageSetName) self.isRoot = 1 self.widgetName = self.name[:1].upper() + self.name[1:] if not isRoot : self.parentAddFunc = "addChildDialog" else : self.parentAddFunc = "setRootWidget" def generate(self) : common.Widget.generate(self) self.generateOnAction() def generateMandatoryVariables (self) : common.Widget.generateMandatoryVariables(self) self.setMessage() self.setNumActions() def setMessage (self) : self.setCodeOrValueString ("message", "setMessages", "setGetMessages") def setNumActions (self) : self.generated.initCode += " {0}->setNumActions({1});\n".format(self.name, len(self.element.button)) def setLabelAction (self, i) : self.setCodeOrValueString ('label', "setLabelsAction%i" % (i+1), "setGetLabelsAction%i" % (i+1), "LabelAction%i" % (i+1), self.element.button[i]) def generateOnAction (self) : dialogHeaderFile = self.generated.dialogHeaderFile dialogSrcFile = self.generated.dialogSrcFile regularName = self.widgetName capitalName = self.name.upper() dialogHeaderFile = dialogHeaderFile.replace("CAPITAL_NAME_HERE", capitalName) dialogHeaderFile = dialogHeaderFile.replace("REGULAR_NAME_HERE", regularName) dialogSrcFile = dialogSrcFile.replace("CAPITAL_NAME_HERE", capitalName) dialogSrcFile = dialogSrcFile.replace("REGULAR_NAME_HERE", regularName) dialogSrcFile = dialogSrcFile.replace("ADDITIONAL_INCLUDES_HERE", self.generated.srcIncludes) self.generated.headerIncludes += self.generateHeaderInclude() notDefined = "return executeActionNotDefined();" for i in range(0, len(self.element.button)): self.setLabelAction(i) dialogSrcFile = dialogSrcFile.replace("CODE_OF_EXECUTE_ACTION%i_HERE" % (i+1), self.element.button[i].executeCode) for i in range(len(self.element.button), 3): dialogSrcFile = dialogSrcFile.replace("CODE_OF_EXECUTE_ACTION%i_HERE" % (i+1), notDefined) genH = open(self.generated.path + "/" + regularName + ".h", 'w') genH.write(dialogHeaderFile) genH.close() genC = open(self.generated.path + "/" + regularName + ".cc", 'w') genC.write(dialogSrcFile) genC.close() base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/generatedCode.py000066400000000000000000000207331272147170000300750ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import sys import subprocess import glob import os.path def as_list(s): if isinstance(s, list): return s return [s] class Generator: def __init__(self, scriptDir, path): self.scriptDir = scriptDir self.path = path self.languageSetsCode = "" self.headerIncludes = "" self.initCode = "" self.varDecl = "" self.varDef = "" self.shutdown = "" self.srcIncludes = "" self.units = {} def setControlDeviceData(self, unitName, headerCode) : self.unitName = unitName[:1].lower() + unitName[1:] self.unitObject = self.unitName + "Unit" if unitName in self.units : print >> sys.stderr, "\nERROR - an xml with unit name " + unitName + " has already been generated. When generating multiple xmls the unit names must be unique\n" sys.exit(3) self.units[unitName] = [] self.ObjectPathPrefix = "/ControlPanel/" + unitName + "/" self.srcIncludes += headerCode + "\n" self.varDecl += """ static ajn::services::ControlPanelControlleeUnit* {0};\n\n""".format(self.unitObject) self.varDef += """ControlPanelControlleeUnit* ControlPanelGenerated::{0} = 0;\n""".format(self.unitObject) self.initCode += """\n {0} = new ControlPanelControlleeUnit("{1}");\n""".format(self.unitObject, unitName) self.initCode += """ CHECK(controlPanelControllee->addControlPanelUnit({0}));\n""".format(self.unitObject) self.shutdown += """ if ({0}) {1}\n delete ({0});\n {0} = 0;\n {2}\n""".format(self.unitObject, "{", "}") def setLanguageSets(self, languageSet) : self.languageSets = {} for langElement in languageSet: name = langElement.attr["name"] deviceLangName = self.unitName + langElement.attr["name"][:1].upper() + langElement.attr["name"][1:] self.languageSets[name] = [] self.languageSetsCode += """ LanguageSet {0}("{0}");\n""".format(deviceLangName) languages = as_list(langElement.language) for language in languages : self.languageSets[name].append(language) self.languageSetsCode += """ {0}.addLanguage("{1}");\n""".format(deviceLangName, language.replace("-", "_")) self.languageSetsCode += """ LanguageSets::add({0}.getLanguageSetName(), {0});\n\n""".format(deviceLangName) def addControlPanel(self, rootElement, languageSet) : name = self.unitName + rootElement.name[:1].upper() + rootElement.name[1:] + "ControlPanel" self.varDecl += """ static ajn::services::ControlPanel* {0};\n\n""".format(name) self.varDef += """ControlPanel* ControlPanelGenerated::{0} = 0;\n""".format(name) self.initCode += """\n {0} = ControlPanel::createControlPanel(LanguageSets::get("{1}"));\n""".format(name, self.unitName + languageSet[:1].upper() + languageSet[1:]) self.initCode += """ if (!{0})\n return ER_FAIL;\n""".format(name) self.initCode += """ CHECK({0}->addControlPanel({1}));\n""".format(self.unitObject, name) self.shutdown += """ if ({0}) {1}\n delete ({0});\n {0} = 0;\n {2}\n""".format(name, "{", "}") def addNotificationAction(self, rootElement, languageSet) : name = self.unitName + rootElement.name[:1].upper() + rootElement.name[1:] + "NotificationAction" self.varDecl += """ static ajn::services::NotificationAction* {0};\n\n""".format(name) self.varDef += """NotificationAction* ControlPanelGenerated::{0} = 0;\n""".format(name) self.initCode += """\n {0} = NotificationAction::createNotificationAction(LanguageSets::get("{1}"));\n""".format(name, self.unitName + languageSet[:1].upper() + languageSet[1:]) self.initCode += """ if (!{0})\n return ER_FAIL;\n""".format(name) self.initCode += """ CHECK({0}->addNotificationAction({1}));\n""".format(self.unitObject, name) self.shutdown += """ if ({0}) {1}\n delete ({0});\n {0} = 0;\n {2}\n""".format(name, "{", "}") def initializeFiles(self) : inputFile = open(self.scriptDir + '/PreGenFiles/PreGenControlPanelGenerated.h', 'r') self.genHeaderFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenControlPanelGenerated.cc', 'r') self.genSrcFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenActionImpl.h', 'r') self.actionHeaderFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenActionImpl.cc', 'r') self.actionSrcFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenDialogImpl.h', 'r') self.dialogHeaderFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenDialogImpl.cc', 'r') self.dialogSrcFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenPropertyImpl.h', 'r') self.propertyHeaderFile = inputFile.read() inputFile.close() inputFile = open(self.scriptDir + '/PreGenFiles/PreGenPropertyImpl.cc', 'r') self.propertySrcFile = inputFile.read() inputFile.close() def writeFiles(self) : genH = open(self.path + "/ControlPanelGenerated.h", 'w') genH.write(self.genHeaderFile) genH.close() genC = open(self.path + "/ControlPanelGenerated.cc", 'w') genC.write(self.genSrcFile) genC.close() def replaceInFiles(self) : self.genHeaderFile = self.genHeaderFile.replace("//VARIABLE_DECLARATIONS_GO_HERE", self.varDecl) self.genHeaderFile = self.genHeaderFile.replace("//NEW_WIDGET_CLASSES_HERE", self.headerIncludes) self.genSrcFile = self.genSrcFile.replace("//INCLUDES_GO_HERE", self.srcIncludes) self.genSrcFile = self.genSrcFile.replace("//STATIC_DECLARATION_HERE", self.varDef) self.genSrcFile = self.genSrcFile.replace("//LANGUAGESET_CODE_HERE", self.languageSetsCode) self.genSrcFile = self.genSrcFile.replace("//INITCODE_GO_HERE", self.initCode) self.genSrcFile = self.genSrcFile.replace("//SHUTDOWN_GO_HERE", self.shutdown) def confirmGenerate(self) : confirm = self.confirm() if confirm : if not os.path.exists(self.path): # The directory does not exist, so create and it and return # as there is nothing to remove os.makedirs(self.path) return filesToRemove = glob.glob(os.path.join(self.path, "*.h")) filesToRemove += glob.glob(os.path.join(self.path, "*.cc")) for f in filesToRemove: try: os.remove(f) except OSError as detail: print >> sys.stderr, "\nERROR - Could not delete the current generated files:", detail sys.exit(4) else : print "\nStopping the generating process" sys.exit(0) def confirm(self): default = False prompt = "\nGenerating this xml will cause previously generated files to be deleted. Do you wish to continue? (y/n) (Default is n): " while True: response = raw_input(prompt) if not response: return default if response not in ['y', 'Y', 'n', 'N']: print 'Please enter y or n.' continue if response.upper() == 'Y': return True if response.upper() == 'N': return False base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/httpControl.py000066400000000000000000000031041272147170000276550ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys class HttpControl: def __init__(self, generated, url) : self.generated = generated self.url = url self.name = generated.unitName + "HttpControl" def generate(self) : self.generated.varDecl += """ static ajn::services::HttpControl* {0};\n""".format(self.name) self.generated.varDef += """HttpControl* ControlPanelGenerated::{0} = 0;\n""".format(self.name) self.generated.initCode += """\n {0} = new HttpControl("{1}");\n""".format(self.name, self.url) self.generated.initCode += """ CHECK({0}->setHttpControl({1}));\n""".format(self.generated.unitObject, self.name) self.generated.shutdown += """ if ({0}) {1}\n delete ({0});\n {0} = 0;\n {2}\n""".format(self.name, "{", "}") base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/labelWidget.py000066400000000000000000000021351272147170000275630ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import xml.etree.ElementTree as xml import commonWidget as common class Label (common.Widget): def __init__(self, generated, labelElement, parentObjectPath, languageSetName) : common.Widget.__init__(self, generated, labelElement, parentObjectPath, languageSetName) self.widgetName = "Label" base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/propertyWidget.py000066400000000000000000000210571272147170000303740ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import xml.etree.ElementTree as xml import commonWidget as common class Property (common.Widget): def __init__(self, generated, propertyElement, parentObjectPath, languageSetName) : common.Widget.__init__(self, generated, propertyElement, parentObjectPath, languageSetName) self.widgetName = self.name[:1].upper() + self.name [1:] self.getSignatureAndVarType() self.additionalParams = ", " + self.propType def generateMandatoryVariables (self) : common.Widget.generateMandatoryVariables(self) self.setWritable() self.generateSetAndGetCode() def setWritable (self) : if not hasattr(self.element, "writable") : return writable = self.element.writable if hasattr(writable, "attr") and "code" in writable.attr and writable.attr["code"] == "true" : self.generated.initCode += " {0}->setGetWritable({1});\n".format(self.name, writable) else : if writable != "true" and writable != "false" : print >> sys.stderr, "ERROR - The value {0} is not supported for writable in {1}. Exiting".format(writable, self.name) sys.exit(3) self.generated.initCode += " {0}->setWritable({1});\n".format(self.name, writable) def generateSetAndGetCode (self) : self.generated.initCode += " CHECK({0}->setGetValue({1}));\n".format(self.name, self.element.getCode) propertyHeaderFile = self.generated.propertyHeaderFile propertySrcFile = self.generated.propertySrcFile regularName = self.widgetName capitalName = self.name.upper() propertyHeaderFile = propertyHeaderFile.replace("CAPITAL_NAME_HERE", capitalName) propertyHeaderFile = propertyHeaderFile.replace("REGULAR_NAME_HERE", regularName) propertyHeaderFile = propertyHeaderFile.replace("VALUE_TYPE_HERE", self.varType) propertySrcFile = propertySrcFile.replace("CAPITAL_NAME_HERE", capitalName) propertySrcFile = propertySrcFile.replace("REGULAR_NAME_HERE", regularName) propertySrcFile = propertySrcFile.replace("ADDITIONAL_INCLUDES_HERE", self.generated.srcIncludes) propertySrcFile = propertySrcFile.replace("VALUE_TYPE_HERE", self.varType) propertySrcFile = propertySrcFile.replace("CODE_OF_SET_VALUE_HERE", self.element.setCode.replace("%s", "value")) self.generated.headerIncludes += self.generateHeaderInclude() genH = open(self.generated.path + "/" + regularName + ".h", 'w') genH.write(propertyHeaderFile) genH.close() genC = open(self.generated.path + "/" + regularName + ".cc", 'w') genC.write(propertySrcFile) genC.close() def generateOptionalVariables (self) : common.Widget.generateOptionalVariables(self) self.setUnitMeasure() self.setConstraintList() self.setConstraintRange() def setUnitMeasure (self) : self.setCodeOrValueString ("unitMeasure", "setUnitOfMeasures", "setGetUnitOfMeasures") def setConstraintRange (self) : if not self.element._has('constraintDefs'): return if not self.element.constraintDefs._has('constraintRange'): return constraintRange = self.element.constraintDefs.constraintRange constraintRangeName = self.name + "ConstraintRange" self.generated.initCode += "\n ConstraintRange* {0} = new ConstraintRange();\n".format(constraintRangeName) self.generated.initCode += " {0}->setConstraintRange({1});\n".format(self.name, constraintRangeName) self.generated.initCode += " CHECK({0}->setConstraintMin(({1}){2}));\n".format(constraintRangeName, self.varType, constraintRange.min) self.generated.initCode += " CHECK({0}->setConstraintMax(({1}){2}));\n".format(constraintRangeName, self.varType, constraintRange.max) self.generated.initCode += " CHECK({0}->setConstraintIncrement(({1}){2}));\n".format(constraintRangeName, self.varType, constraintRange.increment) def setConstraintList (self) : if self.element._name == "stringProperty" : if not self.element._has('constraintVals'): return constraintList = self.element.constraintVals else : if not self.element._has('constraintDefs'): return if not self.element.constraintDefs._has('constraintVals'): return constraintList = self.element.constraintDefs.constraintVals if isinstance(constraintList.constraint, list) : constraints = constraintList.constraint else : constraints = [constraintList.constraint]; if len(constraints) > 0: vectorName = self.name + "ConstraintListVec" numConstraints = len(constraints) self.generated.initCode += "\n std::vector {0}({1});\n".format(vectorName, str(numConstraints)) indx = 0 for constraint in constraints: self.setCodeOrValueString ("display", "setDisplays", "setGetDisplays", "Display%i" % (indx+1), constraint, "{0}[{1}]".format(vectorName, str(indx))) if self.element._name == "stringProperty" : self.generated.initCode += """ {0}[{1}].setConstraintValue("{2}");\n""".format(vectorName, str(indx), constraint.value) else : self.generated.initCode += """ {0}[{1}].setConstraintValue(({2}){3});\n""".format(vectorName, str(indx), self.varType, constraint.value) indx = indx + 1 self.generated.initCode += "\n {0}->setConstraintList({1});\n".format(self.name, vectorName) def getSignatureAndVarType(self) : self.signature = "" self.varType = "" self.propType = "" propertyType = self.element._name if propertyType == "stringProperty" : self.varType = "const char*" self.propType = "STRING_PROPERTY" elif propertyType == "recordName" : self.signature = "s" self.varType = "const char*" self.propType = "SINGLE_VALUE_PROPERTY" elif propertyType == "booleanProperty" : self.varType = "bool" self.propType = "BOOL_PROPERTY" elif propertyType == "dateProperty" : self.varType = "const CPSDate&" self.propType = "DATE_PROPERTY" elif propertyType == "timeProperty" : self.varType = "const CPSTime&" self.propType = "TIME_PROPERTY" elif propertyType == "scalarProperty" : dataType = self.element.attr["dataType"] if dataType == "INT16": self.propType = "INT16_PROPERTY" self.varType = "int16_t" elif dataType == "UINT16": self.propType = "UINT16_PROPERTY" self.varType = "uint16_t" elif dataType == "INT32": self.propType = "INT32_PROPERTY" self.varType = "int32_t" elif dataType == "UINT32": self.propType = "UINT32_PROPERTY" self.varType = "uint32_t" elif dataType == "INT64": self.propType = "INT64_PROPERTY" self.varType = "int64_t" elif dataType == "UINT64": self.propType = "UINT64_PROPERTY" self.varType = "uint64_t" elif dataType == "DOUBLE": self.propType = "DOUBLE_PROPERTY" self.varType = "double" else : print >> sys.stderr, "ERROR - dataType(%s) of property Unknown. Exiting" % dataType sys.exit(3) else : print >> sys.stderr, "ERROR - propertyType(%s) of property Unknown. Exiting" % propertyType sys.exit(3) base-16.04/controlpanel/cpp/tools/CPSAppGenerator/GeneratorUtils/xml2objects.py000066400000000000000000000133031272147170000275730ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # from xml.sax.handler import ContentHandler import xml.sax import sys DEBUG = False class Node: def __init__(self, name, stack=None): self._name = name self.wow = '' self.nxt = 'wow' self.stack = stack self.parked_attrs = dict() self.attr = dict() self.sub_nodes = [] if self.stack == None: self.stack = [self] def _get_next(self): a = getattr(self, self.nxt) if isinstance(a, list): if len(a): return a[-1] else: return 'wow' else: return a def _set_next(self, val): if hasattr(self, self.nxt): a = getattr(self, self.nxt) if isinstance(a, list): if len(a) and a[-1] == 'in limbo': a[-1] = val else: a.append(val) return setattr(self, self.nxt, val) def _clear_next(self): self.nxt = 'wow' def _park_attrs(self, attrs): if not attrs.getLength(): return for n in attrs.getNames(): self.parked_attrs[n] = attrs.getValue(n) self.debug('>Parking attrs ' + str(self.parked_attrs)) def _unpark_attrs(self, onto): if not len(self.parked_attrs): return onto.attr = self.parked_attrs self.parked_attrs = dict() self.debug('>Unparking attrs onto ' + str(onto)) def __str__(self): return '%s:%s' % (type(self), self._name) def debug(self, s): if not DEBUG: return print '%s%s [%s]' % (' ' * len(self.stack), s, self._name) def element(self, name, attrs): self.debug('Starting element ' + name) if hasattr(self, name): a = getattr(self, name) if isinstance(a, list): pass elif isinstance(a, (basestring, Node)) and str(self._get_next()) != 'in limbo': self.debug('> moving %s to list' % name) l = list() l.append(a) setattr(self, name, l) if self._get_next() == 'in limbo': n = Node(self.nxt, self.stack) self.sub_nodes.append(n) self.debug('>Moving out of limbo ' + str(n)) self._unpark_attrs(n) self._set_next(n) self.stack.pop() self.stack.append(n) self._clear_next() n._park_attrs(attrs) n.add_member(name, attrs) else: self._park_attrs(attrs) self.add_member(name, attrs) def add_member(self, name, attrs): self.debug('> %s in limbo' % name) self.nxt = name self._set_next('in limbo') self.stack.append(self) def characters(self, content): c = content.strip() if '' == c: return s = self._get_next() if s == 'in limbo': self.debug('> moving %s to string' % self.nxt) s = type('attredstr', (type(content),), {})() s = type(s)(s + c) self.debug('> setting value to %s' % str(s)) self._unpark_attrs(s) self._set_next(s) def end_element(self): self.stack.pop() self._clear_next() def _fields(self): blank = Node('') return filter(lambda x: x not in dir(blank), dir(self)) def __len__(self): return 1 def __getitem__(self, index): if index != 0: raise IndexError() else: return self def _dump_text_field(self, field, val, tab): print '%s%s=%s' % (tab, field, val) if not hasattr(val, 'attr'): return for k,v in val.attr.items(): print ' %s%s.%s=%s' % (tab, field, k, v) def _dump(self, indent=0): tab = ' ' * indent for k, v in self.attr.items(): print '%s%s.%s=%s' % (tab, self._name, k, v) for field in filter(lambda x: isinstance(getattr(self, x), basestring), self._fields()): fieldval = getattr(self, field) self._dump_text_field(field, fieldval, tab) for field in filter(lambda x: isinstance(getattr(self, x), Node), self._fields()): print '%s%s' % (tab, field) getattr(self, field)._dump(indent + 1) for field in filter(lambda x: isinstance(getattr(self, x), list), self._fields()): counter = 0 for entry in getattr(self, field): if isinstance(entry, basestring): self._dump_text_field('%s[%i]' % (field, counter), entry, tab) else: print '%s%s' % (tab, field) entry._dump(indent + 1) counter += 1 def _find_field(self, field_name, res = None): if res == None: res = list() if hasattr(self, field_name): o = getattr(self, field_name) if isinstance(o, list): res.extend(o) else: res.append(o) for field in self._fields(): o = getattr(self, field) if isinstance(o, Node): o._find_field(field_name, res) elif isinstance(o, list) and len(o) and isinstance(o[0], Node): for i in o: i._find_field(field_name, res) return res def _has(self, field_name): return hasattr(self, field_name) def _kids(self): return map(lambda x: getattr(self, x), self._fields()) class ObjectBuilder(ContentHandler): class Root(Node): pass def __init__(self, path): parser = xml.sax.make_parser() parser.setContentHandler(self) self.root = ObjectBuilder.Root('magic root') parser.parse(open(path,'r')) def top(self): return self.root.stack[-1] def startElement(self, name, attrs): self.top().element(name, attrs) def characters(self, content): self.top().characters(content) def endElement(self, name): self.top().end_element() if __name__ == '__main__': o = ObjectBuilder('../SampleXMLs/testOneOfEachWidget.xml') o.root._dump() base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/000077500000000000000000000000001272147170000241615ustar00rootroot00000000000000base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenActionImpl.cc000066400000000000000000000025631272147170000276360ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "REGULAR_NAME_HERE.h" ADDITIONAL_INCLUDES_HERE namespace ajn { namespace services { REGULAR_NAME_HERE::REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget) : Action(name, rootWidget) { } REGULAR_NAME_HERE::~REGULAR_NAME_HERE() { } bool REGULAR_NAME_HERE::executeCallBack() { EXECUTE_ACTION_HERE //by default return success return true; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenActionImpl.h000066400000000000000000000026371272147170000275020ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CAPITAL_NAME_HERE_H_ #define CAPITAL_NAME_HERE_H_ #include namespace ajn { namespace services { /** * Generated class - implements Action Widget */ class REGULAR_NAME_HERE : public ajn::services::Action { public: REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget); virtual ~REGULAR_NAME_HERE(); bool executeCallBack(); }; } //namespace services } //namespace ajn #endif /* CAPITAL_NAME_HERE_H_ */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenControlPanelGenerated.cc000066400000000000000000000034771272147170000320230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "ControlPanelGenerated.h" #include #include //INCLUDES_GO_HERE using namespace ajn; using namespace services; bool ControlPanelGenerated::languageSetsDone = false; //STATIC_DECLARATION_HERE #define CHECK(x) if ((status = x) != ER_OK) { return status; } void ControlPanelGenerated::PrepareLanguageSets() { if (languageSetsDone) { return; } //LANGUAGESET_CODE_HERE languageSetsDone = true; } QStatus ControlPanelGenerated::PrepareWidgets(ControlPanelControllee*& controlPanelControllee) { if (controlPanelControllee) { return ER_BAD_ARG_1; } PrepareLanguageSets(); QStatus status = ER_OK; controlPanelControllee = new ControlPanelControllee(); //INITCODE_GO_HERE return status; } void ControlPanelGenerated::Shutdown() { //SHUTDOWN_GO_HERE } base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenControlPanelGenerated.h000066400000000000000000000031351272147170000316540ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CONTROLPANELGENERATED_H_ #define CONTROLPANELGENERATED_H_ #include #include #include #include //NEW_WIDGET_CLASSES_HERE /** * Generated Class - do not change code */ class ControlPanelGenerated { public: static QStatus PrepareWidgets(ajn::services::ControlPanelControllee*& controlPanelControllee); static void PrepareLanguageSets(); static void Shutdown(); static bool languageSetsDone; //VARIABLE_DECLARATIONS_GO_HERE }; #endif /* CONTROLPANELGENERATED_H_ */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenDialogImpl.cc000066400000000000000000000032251272147170000276140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "REGULAR_NAME_HERE.h" ADDITIONAL_INCLUDES_HERE namespace ajn { namespace services { REGULAR_NAME_HERE::REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget) : Dialog(name, rootWidget) { } REGULAR_NAME_HERE::~REGULAR_NAME_HERE() { } bool REGULAR_NAME_HERE::executeAction1CallBack() { CODE_OF_EXECUTE_ACTION1_HERE //by default return success return true; } bool REGULAR_NAME_HERE::executeAction2CallBack() { CODE_OF_EXECUTE_ACTION2_HERE //by default return success return true; } bool REGULAR_NAME_HERE::executeAction3CallBack() { CODE_OF_EXECUTE_ACTION3_HERE //by default return success return true; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenDialogImpl.h000066400000000000000000000027211272147170000274560ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CAPITAL_NAME_HERE_H_ #define CAPITAL_NAME_HERE_H_ #include namespace ajn { namespace services { /** * Generated class */ class REGULAR_NAME_HERE : public ajn::services::Dialog { public: REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget); virtual ~REGULAR_NAME_HERE(); bool executeAction1CallBack(); bool executeAction2CallBack(); bool executeAction3CallBack(); }; } //namespace services } //namespace ajn #endif /* CAPITAL_NAME_HERE_H_ */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenPropertyImpl.cc000066400000000000000000000026271272147170000302460ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "REGULAR_NAME_HERE.h" ADDITIONAL_INCLUDES_HERE namespace ajn { namespace services { REGULAR_NAME_HERE::REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget, PropertyType propertyType) : Property(name, rootWidget, propertyType) { } REGULAR_NAME_HERE::~REGULAR_NAME_HERE() { } QStatus REGULAR_NAME_HERE::setValue(VALUE_TYPE_HERE value) { CODE_OF_SET_VALUE_HERE; return ER_OK; } } /* namespace services */ } /* namespace ajn */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/PreGenFiles/PreGenPropertyImpl.h000066400000000000000000000026641272147170000301110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef CAPITAL_NAME_HERE_H_ #define CAPITAL_NAME_HERE_H_ #include namespace ajn { namespace services { /** * Generated class */ class REGULAR_NAME_HERE : public ajn::services::Property { public: REGULAR_NAME_HERE(qcc::String name, Widget* rootWidget, PropertyType propertyType); virtual ~REGULAR_NAME_HERE(); QStatus setValue(VALUE_TYPE_HERE value); }; } //namespace services } //namespace ajn #endif /* CAPITAL_NAME_HERE_H_ */ base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/000077500000000000000000000000001272147170000240035ustar00rootroot00000000000000base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/aj_on_airconditioner.xml000066400000000000000000000176421272147170000307160ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" en rootContainer false true 0x1e90ff vertical_linear horizontal_linear tempAndHumidityContainer false true 0x200 vertical_linear CurrentTempStringProperty getCurrentTemperatureString setCurrentTemperatureString(%s) false true false 0x500 textview CurrentHumidityStringProperty getCurrentHumidityString setCurrentHumidityString(%s) false true false 0x500 textview controlsContainer false true 0x200 horizontal_linear ac_mode getCurrentMode setCurrentMode(%s) false true true 0xffd700 spinner Auto 0 Cool 1 Heat 2 Fan 3 Off 4 statusStringProperty getStatusString setStatusString(%s) false true false 0x500 textview set_temperature getTargetTemperature setTargetTemperature(%s) false false true 0x008000 slider 50 90 1 Degrees fan_speed getFanSpeed setFanSpeed(%s) false false true 0xff69b4 spinner Low 0 Medium 1 High 2 TurnFanOn false true Turn fan on ? 0x789 TurnFanOff false true Turn fan off ? 0x789 base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testContainerInContainer.xml000066400000000000000000000127531272147170000315110ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" en rootContainer false true 0x200 vertical_linear fanSpeedProperty getint32Var setint32Var(%s) false false false 0x350 RPM childContainer false true 0x200 horizontal_linear heatProperty getuint16Var setuint16Var(%s) false true true 0x500 spinner Regular 175 Hot 200 Very Hot 225 Degrees base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testDateTimeProperties.xml000066400000000000000000000051121272147170000311750ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" http://MyControlPanelUrl.com en rootContainer false true 0x200 horizontal_linear myDateProperty getDateProperty setDateProperty(%s) false true true myTimeProperty getTimeProperty setTimeProperty(%s) false true true base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testNotificationActions.xml000066400000000000000000000114361272147170000314010ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" en areYouSure false true Are you sure? 0x789 rootContainer false true 0x200 vertical_linear heatProperty getuint16Var setuint16Var(%s) false true true 0x500 spinner Regular 175 Hot 200 Very Hot 225 Degrees ovenAction AJ_Printf("Starting the Oven. Execute was called\n"); false true 0x400 actionButton base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testOneActionSecured.xml000066400000000000000000000047601272147170000306260ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" http://MyControlPanelUrl.com en rootContainer true true 0x200 horizontal_linear ovenAction AJ_Printf("Starting the Oven. Execute was called\n"); true true 0x400 actionButton base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testOneOfEachWidget.xml000066400000000000000000000270121272147170000303620ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" en de-AT zh-Hans-CN rootContainer false true 0x200 vertical_linear horizontal_linear CurrentTemp true 0x98765 textlabel heatProperty getuint16Var setuint16Var(%s) false true true 0x500 spinner Regular Normal UNICODE_REGULAR 175 Hot Heiss UNICODE_HOT 200 Very Hot Sehr Heiss UNICODE_VERY_HOT 225 Degrees Grad UNICODE_DEGREES ovenAction AJ_Printf("Starting the Oven. Execute was called\n"); false true 0x400 actionButton lightAction LightConfirm false true Are you sure you want to turn on the light Are you sure you want to turn on the light UNICODE_ARE_YOU_SURE_YOU_WANT_TO_TURN_OFF_THE_LIGHT 0x789 alertdialog false true 0x400 actionButton areYouSure false true Are you sure? Sind sie sicher? UNICODE_ARE_YOU_SURE 0x789 base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testOnePropertyOneAction.xml000066400000000000000000000107161272147170000315200ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" http://MyControlPanelUrl.com en rootContainer false true 0x200 vertical_linear heatProperty getuint16Var setuint16Var(%s) false true true 0x500 spinner Regular 175 Hot 200 Very Hot 225 Degrees ovenAction AJ_Printf("Starting the Oven. Execute was called\n"); false true 0x400 actionButton base-16.04/controlpanel/cpp/tools/CPSAppGenerator/SampleXMLs/testStringAndUnicodeProperty.xml000066400000000000000000000047331272147170000324010ustar00rootroot00000000000000 MyDevice #include "ControlPanelProvided.h" heb chi rootContainer false true 0x200 vertical_linear unicodeStringProperty getStringVar setStringVar(%s) false true true 0x500 edittext base-16.04/controlpanel/cpp/tools/CPSAppGenerator/cp.xsd000066400000000000000000000440031272147170000231410ustar00rootroot00000000000000 base-16.04/controlpanel/cpp/tools/CPSAppGenerator/generateCPSApp.py000066400000000000000000000116361272147170000252000ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import os import os.path import subprocess import xml.etree.ElementTree as xml scriptDir = os.path.dirname(os.path.realpath(__file__)) sys.path.append( scriptDir + "/GeneratorUtils" ) import xml2objects import generatedCode as gen import containerWidget as cw import dialogWidget as dw import commonWidget as common import httpControl as http import cpvalidate from optparse import OptionParser ## ERROR CODES ## ## 1 : missing command line arguments ## 2 : Did not pass xsd validation ## 3 : Did not pass logical validation ## 4 : Other error ### Start by validating the input and the xml ### parser = OptionParser() parser.add_option("-p", "--path", dest="path", default=scriptDir + "/../../samples/generated/", help="destination path for generated files") (options, args) = parser.parse_args() path = options.path generated = gen.Generator(scriptDir, path) generated.confirmGenerate() generated.initializeFiles() if len(args) < 1 : print >> sys.stderr, "ERROR - Please provide the xml file as input" sys.exit(1) for i in range(0, len(args)) : xmlfile = args[i] print "\nProcessing xmlfile: " + xmlfile + "\n" if sys.platform != 'win32': cpFile = os.path.join(scriptDir, "cp.xsd") subprocArgs = "xmllint --noout --schema {0} {1}".format(cpFile, xmlfile) rc = subprocess.call(subprocArgs, shell=True) if rc != 0 : print >> sys.stderr, "\nERROR - xml xsd validation did not pass" sys.exit(2) print "\nxml xsd validation passed" else: # There is no pure python way to easily do this print "\nWARNING - skipping xml validation as xmllint is not available on this platform" ### Initialize the generated structure ### o = xml2objects.ObjectBuilder(xmlfile) if not cpvalidate.validate_all(o.root): print >> sys.stderr, "\nERROR - logic xml validation did not pass" sys.exit(3) print "\nxml logic validation passed" generated.setControlDeviceData(o.root.controlPanelDevice.name, o.root.controlPanelDevice.headerCode) generated.setLanguageSets(o.root.controlPanelDevice.languageSet) ### Get and process HttpControlElements if hasattr(o.root.controlPanelDevice, "url") : httpControl = http.HttpControl(generated, o.root.controlPanelDevice.url) httpControl.generate() ### Get and process all ControlPanels if hasattr(o.root.controlPanelDevice, "controlPanels") : for cp in o.root.controlPanelDevice.controlPanels.controlPanel : generated.addControlPanel(cp.rootContainer, cp.attr["languageSet"]) parentName = generated.unitName + cp.rootContainer.name[:1].upper() + cp.rootContainer.name[1:] + "ControlPanel" container = cw.Container(generated, cp.rootContainer, parentName, cp.attr["languageSet"], 1) container.generate() ### Get and process all NotificationAction if hasattr(o.root.controlPanelDevice, "notificationActions") : if hasattr(o.root.controlPanelDevice.notificationActions, "dialog") : for notDialog in o.root.controlPanelDevice.notificationActions.dialog : generated.addNotificationAction(notDialog, notDialog.attr["languageSet"]) parentName = generated.unitName + notDialog.name[:1].upper() + notDialog.name[1:] + "NotificationAction" dialog = dw.Dialog(generated, notDialog, parentName, notDialog.attr["languageSet"], 1) dialog.generate() if hasattr(o.root.controlPanelDevice.notificationActions, "container") : for notContainer in o.root.controlPanelDevice.notificationActions.container : generated.addNotificationAction(notContainer, notContainer.attr["languageSet"]) parentName = generated.unitName + notContainer.name[:1].upper() + notContainer.name[1:] + "NotificationAction" container = cw.Container(generated, notContainer, parentName, notContainer.attr["languageSet"], 1) container.generate() ### Finish up merging all the different components ### generated.replaceInFiles() generated.writeFiles() sys.exit(0) base-16.04/controlpanel/cpp/tools/CPSAppGenerator/integratedXmlToCode.sh000077500000000000000000000020501272147170000262570ustar00rootroot00000000000000#!/bin/bash # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # echo "Generating code for" "$@" INITIAL_DIR=`pwd` # Save current dir cd `dirname $0` # Go to script dir python generateCPSApp.py "$@" -p ../../../../sample_apps/cpp/samples/ServerSample/generated/ retval=$? cd ${INITIAL_DIR} exit $retval base-16.04/controlpanel/cpp/tools/CPSAppGenerator/sampleGenerate.sh000077500000000000000000000020401272147170000253050ustar00rootroot00000000000000#!/bin/bash # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # echo "Generating code for testOneOfEachWidget.xml" INITIAL_DIR=`pwd` # Save current dir cd `dirname $0` # Go to script dir python generateCPSApp.py SampleXMLs/testOneOfEachWidget.xml -p ../../samples/generated/ cd ${INITIAL_DIR} base-16.04/controlpanel/cpp/tools/CPSAppGenerator/xmlToCode.sh000077500000000000000000000020061272147170000242510ustar00rootroot00000000000000#!/bin/bash # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # echo "Generating code for" "$@" INITIAL_DIR=`pwd` # Save current dir cd `dirname $0` # Go to script dir python generateCPSApp.py "$@" -p ../../samples/generated/ retval=$? cd ${INITIAL_DIR} exit $retval base-16.04/controlpanel/ios/000077500000000000000000000000001272147170000157315ustar00rootroot00000000000000base-16.04/controlpanel/ios/inc/000077500000000000000000000000001272147170000165025ustar00rootroot00000000000000base-16.04/controlpanel/ios/inc/alljoyn/000077500000000000000000000000001272147170000201525ustar00rootroot00000000000000base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/000077500000000000000000000000001272147170000226525ustar00rootroot00000000000000base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSAction.h000066400000000000000000000024741272147170000250300ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/Action.h" #import "AJCPSWidget.h" /** * AJCPSAction Class is used to display a Button. */ @interface AJCPSAction : AJCPSWidget - (id)initWithHandle:(ajn ::services ::Action *)handle; /** * Call to execute this Action remotely * @return ER_OK if successful. */ - (QStatus)executeAction; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSActionDialogCell.h000066400000000000000000000026421272147170000267450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSActionWithDialog.h" #import "AJCPSGetControlPanelViewController.h" @interface AJCPSActionDialogCell : UITableViewCell @property (strong, nonatomic) UIButton *cpsButton; //TOD strong @property (weak, nonatomic) AJCPSActionWithDialog *actionDialogWidget; @property (weak, nonatomic) AJCPSGetControlPanelViewController *viewController; @property (strong, nonatomic) NSMutableDictionary *alertActionDict; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSActionWithDialog.h000066400000000000000000000032161272147170000267770ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/ActionWithDialog.h" #import "AJCPSWidget.h" #import "AJCPSDialog.h" /** * AJCPSActionWithDialog is used to display a Button. * Upon pressing the button a Dialog is displayed on the Controller side. */ @interface AJCPSActionWithDialog : AJCPSWidget - (id)initWithHandle:(ajn ::services ::ActionWithDialog *)handle; /** * Get the ChildDialog of the Action * @return dialog */ - (AJCPSDialog *)getChildDialog; /** * Unregister the BusObjects for this and children Widgets * @param bus - the bus used to unregister the busObjects * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSButtonCell.h000066400000000000000000000022521272147170000256600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSAction.h" @interface AJCPSButtonCell : UITableViewCell @property (strong, nonatomic) UIButton *cpsButton; //TOD strong @property (weak, nonatomic) AJCPSAction *actionWidget; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSConstraintList.h000066400000000000000000000050161272147170000265660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/ConstraintList.h" #import "AJCPSControlPanelEnums.h" /** * ConstraintValue - a union combining all possible values * that can make up a constraint */ typedef union { /** * Value for uint16_t */ uint16_t uint16Value; /** * Value for int16_t */ int16_t int16Value; /** * Value for uint32_t */ uint32_t uint32Value; /** * Value for int32_t */ int32_t int32Value; /** * Value for uint64_t */ uint64_t uint64Value; /** * Value for int64_t */ int64_t int64Value; /** * Value for double */ double doubleValue; /** * Value for const char* */ const char* charValue; } AJCPSConstraintValue; /** * AJCPSConstraintList defines a list of * Values and constrain a property to those values. * The Constraint is applied on the controller side. * No validations are done in the Controllee */ @interface AJCPSConstraintList : NSObject - (id)initWithHandle:(ajn ::services ::ConstraintList *)handle; /** * Get the Constraint Value * @return the Constraint Value */ - (AJCPSConstraintValue)getConstraintValue; /** * Get the Property Type of the Constraint * @return propertyType of the Constraint */ - (AJCPSPropertyType)getPropertyType; /** * Get the Display * @return Display Value */ - (NSString *)getDisplay; /** * Convert property value to string representation */ - (NSString *)propertyToNSString:(AJCPSPropertyType)property withValue:(AJCPSConstraintValue) propertyValue; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSConstraintRange.h000066400000000000000000000041751272147170000267140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/ConstraintRange.h" #import "AJCPSControlPanelEnums.h" typedef union { /** * Value of type uint16_t */ uint16_t uint16Value; /** * Value of type int16_t */ int16_t int16Value; /** * Value of type uint32_t */ uint32_t uint32Value; /** * Value of type int32_t */ int32_t int32Value; /** * Value of type uint64_t */ uint64_t uint64Value; /** * Value of type int64_t */ int64_t int64Value; /** * Value of type double */ double doubleValue; } AJCPSConstraintRangeVal; /** * AJCPSConstraintRange defines a range of * Values and constrain a property to those values. * The Constraint is applied on the controller side. * No validations are done in the Controlee. */ @interface AJCPSConstraintRange : NSObject - (id)initWithHandle:(ajn ::services ::ConstraintRange *)handle; /** * get the IncrementValue of the Constraint Range * @return IncrementValue */ - (uint16_t)getIncrementValue; /** * Get the MaxValue of the Constraint Range * @return MaxValue */ - (uint16_t)getMaxValue; /** * Get the MinValue of the Constraint Range * @return MinValue */ - (uint16_t)getMinValue; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSContainer.h000066400000000000000000000036501272147170000255320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSRootWidget.h" #import "alljoyn/controlpanel/Container.h" /** * AJCPSContainer class is used to represent a container widget, * container widgets container children widgets and group them together. */ @interface AJCPSContainer : AJCPSRootWidget - (id)initWithHandle:(ajn::services::Container *)handle; /** * Register the BusObjects for this Widget * @param bus A reference to the AJNBusAttachment. * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus; /** * Unregister the BusObjects for this widget * @param bus A reference to the AJNBusAttachment. * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; /** * Get the ChildWidget Vector * @return children widgets */ //const std : : vector & getChildWidgets() const; - (NSArray *)getChildWidgets; /** * Get IsDismissable * @return isDismissable */ - (bool)getIsDismissable; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanel.h000066400000000000000000000046471272147170000262170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/Status.h" #import "AJNBusAttachment.h" #import "alljoyn/controlpanel/ControlPanel.h" #import "AJCPSLanguageSet.h" #import "AJCPSControlPanelDevice.h" #import "AJCPSContainer.h" /** * AJCPSControlPanel Class used to create a ControlPanel. * ControlPanels are made up of a LanguageSet and a RootContainer */ @interface AJCPSControlPanel : NSObject - (id)initWithHandle:(ajn ::services ::ControlPanel *)handle; /** * Get the name of the Panel - the name of the rootWidget * @return name of the Panel */ - (NSString *)getPanelName; /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus; /** * Unregister the BusObjects for this Widget * @param bus - bus used to unregister the busObjects * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; /** * Get the LanguageSet of the ControlPanel * @return */ - (AJCPSLanguageSet *)getLanguageSet; /** * Get the Device of the ControlPanel * @return controlPanelDevice */ - (AJCPSControlPanelDevice *)getDevice; /** * Get the objectPath * @return */ - (NSString *)getObjectPath; /** * Get the RootWidget of the ControlPanel * @param Language the language to use for the action can be NULL meaning default. * @return pointer to rootWidget */ - (AJCPSContainer *)getRootWidget:(NSString *)Language; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelController.h000066400000000000000000000051331272147170000302520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/ControlPanelController.h" #import "AJCPSControlPanelDevice.h" /** * AJCPSControlPanelController facilitated controlling of remote ControlPanels */ @interface AJCPSControlPanelController : NSObject - (id)init; - (id)initWithHandle:(ajn::services::ControlPanelController *)handle; /** * create a controllable device by parsing announce descriptions. * @param deviceBusName - BusName of device received in announce * @param objectDescs - ObjectDescriptions received in announce * @return a ControlPanelDevice */ - (AJCPSControlPanelDevice *)createControllableDevice:(NSString *)deviceBusName ObjectDescs:(NSDictionary *)objectDescs; /** * GetControllableDevice - get a device using the busName - creates it if it doesn't exist * @param deviceBusName - deviceName to get * @return ControlPanelDevice* - returns the Device */ - (AJCPSControlPanelDevice *)getControllableDevice:(NSString *)deviceBusName; /** * deleteControllableDevice - shutdown a controllable device and delete it from the Controller * @param deviceBusName - deviceName to delete * @return status - success-failure */ - (QStatus)deleteControllableDevice:(NSString *)deviceBusName; /** * deleteAllControllableDevices - shutdown and delete all controllable devices from the controller * @return status - success-failure */ - (QStatus)deleteAllControllableDevices; /** * Get map of All Controllable Devices * @return controllable Devices map const std::map& */ - (NSDictionary *)getControllableDevices; @property (nonatomic, readonly)ajn::services::ControlPanelController * handle; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelControllerUnit.h000066400000000000000000000075111272147170000311140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/Status.h" #import "alljoyn/controlpanel/ControlPanelControllerUnit.h" #import "AJCPSHttpControl.h" @class AJCPSControlPanelDevice; @class AJCPSControlPanel; @class AJCPSNotificationAction; /** * AJCPSControlPanelControllerUnit class represents a ControlPanel Unit. */ @interface AJCPSControlPanelControllerUnit : NSObject - (id)initWithHandle:(ajn ::services ::ControlPanelControllerUnit *)handle; /** * ControlPanelUnit * @param unitName the unit name. * @param device the control panel device object. */ - (id)initControlPanelControllerUnit:(NSString *)unitName device:(AJCPSControlPanelDevice *)device; /** * add a HttpControl * @param objectPath of HTTPControl. * @return ER_OK if successful. */ - (QStatus)addHttpControl:(NSString *)objectPath; /** * addControlPanel * @param objectPath the control panel object path. * @param panelName the control panel name. * @return ER_OK if successful. */ - (QStatus)addControlPanel:(NSString *)objectPath panelName:(NSString *)panelName; /** * addNotificationAction to controlpanel unit * @param objectPath the objectpath of the notification action * @param actionName the actionName parsed from the objectpath * @return ER_OK if successful. */ - (QStatus)addNotificationAction:(NSString *)objectPath actionName:(NSString *)actionName; /** * remove a Notification Action * @param actionName the action name. * @return ER_OK if successful. */ - (QStatus)removeNotificationAction:(NSString *)actionName; /** * Fill control panels and the HTTPControl * @return ER_OK if successful. */ - (QStatus)registerObjects; /** * Called when shutting down device * @return ER_OK if successful. */ - (QStatus)shutdownUnit; /** * getDevice * @return ControlPanelDevice* */ - (AJCPSControlPanelDevice *)getDevice; /** * getUnitName * @return string */ - (NSString *)getUnitName; /** * Get the ControlPanels of the Unit * @return controlPanels map */ // const std::map& getControlPanels; - (NSDictionary *)getControlPanels; /** * Get the NotificationActions of the Unit * @return NotificationActions map */ // const std::map& getNotificationActions; - (NSDictionary *)getNotificationActions; /** * Get a ControlPanel of the Unit * @param panelName - name of the Panel to get * @return ControlPanel or NULL if it doesn't' exist */ - (AJCPSControlPanel *)getControlPanel:(NSString *)panelName; /** * Get a NotificationAction of the Unit * @param actionName - name of the NotificaitonAction to get * @return NotificationAction or NULL if it doesn't exist */ - (AJCPSNotificationAction *)getNotificationAction:(NSString *)actionName; /** * Get the HttpControl of the Unit * @return httpControl */ - (AJCPSHttpControl *)getHttpControl; @property (nonatomic, readonly)ajn::services::ControlPanelControllerUnit * handle; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelDevice.h000066400000000000000000000102051272147170000273220ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/Status.h" #import "AJNSessionOptions.h" #import "alljoyn/controlpanel/ControlPanelDevice.h" #import "AJCPSControlPanelControllerUnit.h" #import "AJCPSNotificationAction.h" #import "AJCPSControlPanelListener.h" /** * AJCPSControlPanelDevice */ @interface AJCPSControlPanelDevice : NSObject /** * Constructor for ControlPanelDevice * @param handle handle to the instance */ - (id)initWithHandle:(ajn ::services ::ControlPanelDevice *)handle; /** * startSessionAsync - start a session with Device Asynchronously * @return status - success/failure */ - (QStatus)startSessionAsync; /** * startSession - start session with device synchronously * @return status - success/failure */ - (QStatus)startSession; /** * endSession - endSession with device * @return status - success/failure */ - (QStatus)endSession; /** * ShutDown device - end Session and release units * @return status - success/failure */ - (QStatus)shutdownDevice; /** * getDeviceBusName - get the busName of the device * @return deviceBusName - busName of device */ - (NSString *)getDeviceBusName; /** * getSessionId - get the SessionId of the remote Session with device * @return const ajn::SessionId */ - (AJNSessionId)getSessionId; /** * getDeviceUnits * @return the ControlPanelUnits of this Device */ // const std::map& getDeviceUnits const; - (NSDictionary *)getDeviceUnits; /** * getAllControlPanels - returns an array with all controlPanels contained by this device * @return an array with all the controlPanel defined as children of this device */ - (NSArray *)getAllControlPanels; /** * Get an existing unit using the objectPath * @param objectPath - objectPath of unit * @return ControlPanelUnit pointer */ - (AJCPSControlPanelControllerUnit *)getControlPanelUnit:(NSString *)objectPath; /** * addControlPanelUnit - add a ControlPanel unit using the objectPath and interfaces passed in * @param objectPath - objectPath received in the announce * @param interfaces - interfaces received in the announce * @return ControlPanelUnit pointer */ - (AJCPSControlPanelControllerUnit *)addControlPanelUnit:(NSString *)objectPath interfaces:(NSArray *)interfaces; /** * addNotificationAction - add a Notification using an objectPath received in a notification * @param objectPath - objectPath used to create the NotificationAction * @return NotificationAction pointer */ - (AJCPSNotificationAction *)addNotificationAction:(NSString *)objectPath; /** * Delete and shutdown the NotificationAction * @param notificationAction - notificationAction to remove * @return status - success/failure */ - (QStatus)removeNotificationAction:(AJCPSNotificationAction *)notificationAction; /** * Get the Listener defined for this SessionHandler * @return */ - (id )getListener; /** * Set the Listener defined for this SessionHandler * @param listener AJCPSControlPanelListener that will receive session/signal events notifications. * @return status - success/failure */ - (QStatus)setListener:(id )listener; @property (nonatomic, readonly)ajn::services::ControlPanelDevice * handle; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelEnums.h000066400000000000000000000111161272147170000272140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import /** * AJCPSControlPanelEnums */ @interface AJCPSControlPanelEnums : NSObject @end /** * Mode ControlPanel is in */ typedef NS_ENUM (NSInteger, AJCPSControlPanelMode) { /*** * CONTROLLEE_MODE */ AJCPS_CONTROLLEE_MODE, /*** * CONTROLLER_MODE */ AJCPS_CONTROLLER_MODE }; /** * WidgetType */ typedef NS_ENUM (NSInteger, AJCPSWidgetType) { /** * AJCPS_CONTAINER */ AJCPS_CONTAINER = 0, /** * AJCPS_ACTION */ AJCPS_ACTION = 1, /** * AJCPS_ACTION_WITH_DIALOG */ AJCPS_ACTION_WITH_DIALOG = 2, /** * AJCPS_LABEL */ AJCPS_LABEL = 3, /** * AJCPS_PROPERTY */ AJCPS_PROPERTY = 4, /** * AJCPS_DIALOG */ AJCPS_DIALOG = 5, /** * AJCPS_ERROR */ AJCPS_ERROR = 6 }; /** * Enum to define the type of Property */ typedef NS_ENUM (NSInteger, AJCPSPropertyType) { /** * bool property */ AJCPS_BOOL_PROPERTY = 0, /** * uint16 property */ AJCPS_UINT16_PROPERTY = 1, /** * int16 property */ AJCPS_INT16_PROPERTY = 2, /** * uint32 property */ AJCPS_UINT32_PROPERTY = 3, /** * int32 property */ AJCPS_INT32_PROPERTY = 4, /** * uint64 property */ AJCPS_UINT64_PROPERTY = 5, /** * int64 property */ AJCPS_INT64_PROPERTY = 6, /** * double property */ AJCPS_DOUBLE_PROPERTY = 7, /** * String property */ AJCPS_STRING_PROPERTY = 8, /** * Date property */ AJCPS_DATE_PROPERTY = 9, /** * Time property */ AJCPS_TIME_PROPERTY = 10, /** * Undefined */ AJCPS_UNDEFINED = 11 }; /** * Transactions that could go wrong resulting in an Error Occurred event being fired */ typedef NS_ENUM (NSInteger, AJCPSControlPanelTransaction) { /** * Session join */ AJCPS_SESSION_JOIN = 0, /** * Register objects */ AJCPS_REGISTER_OBJECTS = 1, /** * refresh value */ AJCPS_REFRESH_VALUE = 2, /** * Refresh properties */ AJCPS_REFRESH_PROPERTIES = 3 }; /** * Hints for Containers Widgets * determining the layout */ typedef NS_ENUM (NSInteger, AJCPS_LAYOUT_HINTS) { /** * Vertical linear */ AJCPS_VERTICAL_LINEAR = 1, /** * Horizontal linear */ AJCPS_HORIZONTAL_LINEAR = 2 }; /** * Hints for Dialog Widgets */ typedef NS_ENUM (NSInteger, AJCPS_DIALOG_HINTS) { /** * Alert dialog */ AJCPS_ALERTDIALOG = 1 }; /** * Hints for Property Widgets */ typedef NS_ENUM (NSInteger, AJCPS_PROPERTY_HINTS) { /** * Switch */ AJCPS_SWITCH = 1, /** * Checkbox */ AJCPS_CHECKBOX = 2, /** * Spinner */ AJCPS_SPINNER = 3, /** * Radio button */ AJCPS_RADIOBUTTON = 4, /** * slider */ AJCPS_SLIDER = 5, /** * Time picker */ AJCPS_TIMEPICKER = 6, /** * Date picker */ AJCPS_DATEPICKER = 7, /** * Number picker */ AJCPS_NUMBERPICKER = 8, /** * Keypad */ AJCPS_KEYPAD = 9, /** * Rotaryk nob */ AJCPS_ROTARYKNOB = 10, /** * text view */ AJCPS_TEXTVIEW = 11, /** * Numeric view */ AJCPS_NUMERICVIEW = 12, /** * Edit text */ AJCPS_EDITTEXT = 13 }; /** * Hints for Label Widgets */ typedef NS_ENUM (NSInteger, AJCPS_LABEL_HINTS) { /** * Text label */ AJCPS_TEXTLABEL = 1 }; /** * Hints for Action Widgets */ typedef NS_ENUM (NSInteger, ACTION_HINTS) { /** * Action button */ AJCPS_ACTIONBUTTON = 1 }; base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelListener.h000066400000000000000000000056701272147170000277220ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSProperty.h" @class AJCPSControlPanelDevice; @class AJCPSNotificationAction; /** * AJCPSControlPanelListener protocol */ @protocol AJCPSControlPanelListener /** * sessionEstablished - callback when a session is established with a device * @param device - the device that the session was established with */ - (void)sessionEstablished:(AJCPSControlPanelDevice *)device; /** * sessionLost - callback when a session is lost with a device * @param device - device that the session was lost with */ - (void)sessionLost:(AJCPSControlPanelDevice *)device; /** * signalPropertiesChanged - callback when a property Changed signal is received * @param device - device signal was received from * @param widget - widget signal was received for */ - (void)signalPropertiesChanged:(AJCPSControlPanelDevice *)device widget:(AJCPSWidget *)widget; /** * signalPropertyValueChanged - callback when a property Value Changed signal is received * @param device - device signal was received from * @param property - Property signal was received for */ - (void)signalPropertyValueChanged:(AJCPSControlPanelDevice *)device property:(AJCPSProperty *)property; /** * signalDismiss - callback when a Dismiss signal is received * @param device - device signal was received from * @param notificationAction - notificationAction signal was received for */ - (void)signalDismiss:(AJCPSControlPanelDevice *)device notificationAction:(AJCPSNotificationAction *)notificationAction; /** * ErrorOccured - callback to tell application when something goes wrong * @param device - device that had the error * @param status - status associated with error if applicable * @param transaction - the type of transaction that resulted in the error * @param errorMessage - a log-able error Message */ - (void)errorOccured:(AJCPSControlPanelDevice *)device status:(QStatus)status transaction:(AJCPSControlPanelTransaction)transaction errorMessage:(NSString *)errorMessage; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelListenerAdapter.h000066400000000000000000000120251272147170000312130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "alljoyn/controlpanel/ControlPanelListener.h" #import "AJCPSControlPanelListener.h" #import "alljoyn/about/AJNConvertUtil.h" #ifndef ALLJOYN_CONTROLPANEL_OBJC_AJCPSCONTROLPANELLISTENERADAPTER_H #define ALLJOYN_CONTROLPANEL_OBJC_AJCPSCONTROLPANELLISTENERADAPTER_H using namespace ajn::services; class AJCPSControlPanelListenerAdapter : public ajn::services::ControlPanelListener { public: id listener; AJCPSControlPanelListenerAdapter(id listener) { this->listener = listener;} id getListener() {return this->listener;} /** * sessionEstablished - callback when a session is established with a device * @param device - the device that the session was established with */ virtual void sessionEstablished(ControlPanelDevice* device) { [listener sessionEstablished:[[AJCPSControlPanelDevice alloc]initWithHandle:device]];} /** * sessionLost - callback when a session is lost with a device * @param device - device that the session was lost with */ virtual void sessionLost(ControlPanelDevice* device) { [listener sessionLost:[[AJCPSControlPanelDevice alloc]initWithHandle:device]];} /** * signalPropertiesChanged - callback when a property Changed signal is received * @param device - device signal was received from * @param widget - widget signal was received for */ virtual void signalPropertiesChanged(ControlPanelDevice* device, Widget* widget) { AJCPSWidget *new_widget = [[AJCPSWidget alloc]initWithHandle:widget]; [listener signalPropertiesChanged:[[AJCPSControlPanelDevice alloc]initWithHandle:device] widget:new_widget]; } /** * signalPropertyValueChanged - callback when a property Value Changed signal is received * @param device - device signal was received from * @param property - Property signal was received for */ virtual void signalPropertyValueChanged(ControlPanelDevice* device, Property* property) { AJCPSControlPanelDevice *qcp_device = [[AJCPSControlPanelDevice alloc]initWithHandle:device]; AJCPSProperty *qcp_property = [[AJCPSProperty alloc]initWithHandle:property]; [listener signalPropertyValueChanged:qcp_device property:qcp_property]; } /** * signalDismiss - callback when a Dismiss signal is received * @param device - device signal was received from * @param notificationAction - notificationAction signal was received for */ virtual void signalDismiss(ControlPanelDevice* device, NotificationAction* notificationAction) { AJCPSControlPanelDevice *qcp_device = [[AJCPSControlPanelDevice alloc]initWithHandle:device]; AJCPSNotificationAction *qcp_notification_action = [[AJCPSNotificationAction alloc]initWithHandle:notificationAction]; [listener signalDismiss:qcp_device notificationAction:qcp_notification_action]; } /** * ErrorOccured - callback to tell application when something goes wrong * @param device - device that had the error * @param status - status associated with error if applicable * @param transaction - the type of transaction that resulted in the error * @param errorMessage - a log-able error Message */ virtual void errorOccured(ControlPanelDevice* device, QStatus status, ControlPanelTransaction transaction, qcc::String const& errorMessage) { AJCPSControlPanelDevice *qcp_device = [[AJCPSControlPanelDevice alloc]initWithHandle:device]; AJCPSControlPanelTransaction qcp_controlpanel_transaction = transaction; NSString *qcp_error_message = [AJNConvertUtil convertQCCStringtoNSString:errorMessage]; [listener errorOccured:qcp_device status:status transaction:qcp_controlpanel_transaction errorMessage:qcp_error_message]; } virtual ~AJCPSControlPanelListenerAdapter() { }; private: }; #endif //ALLJOYN_CONTROLPANEL_OBJC_AJCPSCONTROLPANELLISTENERADAPTER_H base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControlPanelService.h000066400000000000000000000061761272147170000275370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusAttachment.h" #import "alljoyn/controlpanel/ControlPanelService.h" #import "AJCPSControlPanelController.h" #import "AJCPSControlPanelListener.h" #import "AJSVCGenericLogger.h" /** * AJCPSControlPanelService - singleton implementation */ @interface AJCPSControlPanelService : NSObject /** * Get Instance of ControlPanelServiceImpl - singleton implementation * @return instance A AJCPSControlPanelService instance */ + (AJCPSControlPanelService *)getInstance; /** * Initialize the controller to be used * @param bus - bus used for Controller * @param controlPanelController - controller to initialize * @param controlPanelListener AJCPSControlPanelListener that will receive session/signal events notifications. * @return ER_OK if successful. */ - (QStatus)initController:(AJNBusAttachment *)bus controlPanelController:(AJCPSControlPanelController *)controlPanelController controlPanelListener:(id )controlPanelListener; /** * Remove locally stored controller. Allows a new call to initController to be made * @return ER_OK if successful. */ - (QStatus)shutdownController; #pragma mark - Logger methods /** * Receive GenericLogger* to use for logging * @param logger Implementation of GenericLogger */ - (void)setLogger:(id )logger; /** * Get the currently-configured logger implementation * @return logger Implementation of GenericLogger */ - (id )logger; /** * Set log level filter for subsequent logging messages * @param newLogLevel enum value */ - (void)setLogLevel:(QLogLevel)newLogLevel; /** * Get log level filter value currently in effect * @return logLevel enum value currently in effect */ - (QLogLevel)logLevel; /** * Method to get the busAttachment used in the service. * @return AJNBusAttachment */ - (AJNBusAttachment *)getBusAttachment; /** * Get the ControlPanelListener * @return ControlPanelListener */ - (id )getControlPanelListener; /** * Get the Version of the ControlPanelService * @return the ControlPanelService version */ - (uint16_t)getVersion; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControllerModel.h000066400000000000000000000037021272147170000267120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import #import "alljoyn/Status.h" #import "AJCPSContainer.h" #import "AJCPSControlPanelListener.h" #import "AJCPSControllerUpdateEvents.h" #import "AJCPSControlPanel.h" @interface AJCPSControllerModel : NSObject @property (strong, nonatomic) NSString *unit; @property (strong, nonatomic) AJCPSControlPanel *controlPanel; @property (strong, atomic) NSArray *widgetsContainer; @property (strong, nonatomic) id delegate; @property (strong, nonatomic,readonly) NSArray *supportedLanguages; -(void)pushChildContainer:(AJCPSContainer *)containerToMoveTo; -(NSInteger)popChildContainer; -(QStatus)switchLanguage:(NSString *)language; -(QStatus)switchLanguageForNotificationAction:(AJCPSRootWidget *)rootWidget; -(QStatus)loadRootWidget:(AJCPSRootWidget *)rootWidget; -(void)setSupportedLanguagesForNotificationAction:(AJCPSNotificationAction *) notificationAction; -(NSInteger)childContainerPosition; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSControllerUpdateEvents.h000066400000000000000000000021171272147170000302600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import @protocol ControllerUpdateEvents -(void)refreshEntries; -(void)loadEnded; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSDate.h000066400000000000000000000035551272147170000244710ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/CPSDate.h" /** * AJCPSCPSDate allows sending of a Date as a Property */ @interface AJCPSDate : NSObject - (id)initWithDay:(uint16_t) day month:(uint16_t) month year:(uint16_t) year; - (id)initWithHandle:(ajn ::services ::CPSDate *)handle; /** * Get the day value of the date * @return day value */ - (uint16_t)getDay; /** * Set the day Value of the date * @param day value */ - (void)setDay:(uint16_t)day; /** * Get the Month value of the date * @return month value */ - (uint16_t)getMonth; /** * Set the Month value of the date * @param month value */ - (void)setMonth:(uint16_t)month; /** * Get the Year value of the date * @return year value */ - (uint16_t)getYear; /** * Set the Year value of the date * @param year value */ - (void)setYear:(uint16_t)year; @property (nonatomic, readonly)ajn::services::CPSDate * handle; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSDialog.h000066400000000000000000000040751272147170000250110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/Dialog.h" #import "AJCPSRootWidget.h" /** * AJCPSDialog is used to display a Dialog. */ @interface AJCPSDialog : AJCPSRootWidget - (id)initWithHandle:(ajn ::services ::Dialog *)handle; /** * Get the Number of Actions in the Dialog * @return Number of Actions */ - (uint16_t)getNumActions; /** * Get the Message of the Dialog * @return the message */ - (NSString *)getMessage; /** * Get the LabelAction1 of the Dialog * @return the message */ - (NSString *)getLabelAction1; /** * Get the LabelAction2 of the Dialog * @return the message */ - (NSString *)getLabelAction2; /** * Get the LabelAction3 of the Dialog * @return the message */ - (NSString *)getLabelAction3; /** * Call to execute this Dialog's Action 1 remotely * @return status - success/failure */ - (QStatus)executeAction1; /** * Call to execute this Dialog's Action 2 remotely * @return status - success/failure */ - (QStatus)executeAction2; /** * Call to execute this Dialog's Action 3 remotely * @return status - success/failure */ - (QStatus)executeAction3; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSErrorWidget.h000066400000000000000000000025511272147170000260440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/ErrorWidget.h" #import "AJCPSWidget.h" /** * AJCPSErrorWidget class used to display an error widget */ @interface AJCPSErrorWidget : AJCPSWidget /** * Constructor for AJCPSErrorWidget class * @param handle handle to the c++ instance */ - (id)initWithHandle:(ajn ::services ::ErrorWidget *)handle; - (AJCPSWidget*)getOriginalWidget; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSGeneralCell.h000066400000000000000000000024531272147170000257650ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSWidget.h" #import "AJCPSControllerModel.h" @interface AJCPSGeneralCell : UITableViewCell @property (strong, nonatomic) UILabel *widgetNameLabel; @property (strong, nonatomic) UILabel *widgetDetailsLabel; @property (strong, nonatomic) UILabel *hintLabel; @property (weak, nonatomic) AJCPSWidget *widget; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSGetControlPanelViewController.h000066400000000000000000000026451272147170000315520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/about/AJNAnnouncement.h" #import "AJNBusAttachment.h" #import "AJCPSControllerModel.h" @interface AJCPSGetControlPanelViewController : UIViewController - (id)initWithNotificationSenderBusName:(NSString*) senderBusName cpsObjectPath:(NSString*) cpsObjectPath bus:(AJNBusAttachment*) bus; - (id)initWithAnnouncement:(AJNAnnouncement*) announcement bus:(AJNBusAttachment*) bus; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSHttpControl.h000066400000000000000000000044251272147170000260710ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusAttachment.h" #import "alljoyn/controlpanel/HttpControl.h" #import "AJCPSControlPanelEnums.h" @class AJCPSControlPanelDevice; /** * AJCPSHttpControl allows definition of a url. */ @interface AJCPSHttpControl : NSObject - (id)initWithHandle:(ajn ::services ::HttpControl *)handle; /** * Get the Interface Version of the HttpControl * @return interface Version */ - (uint16_t)getInterfaceVersion; /** * Register the HttpControl BusObject * @param bus - bus used for registering the object * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus; /** * Refresh the HttpControl * @param bus - bus used for refreshing the object * @return status - success/failure */ - (QStatus)refreshObjects:(AJNBusAttachment *)bus; /** * Unregister the HttpControl BusObject * @param bus - bus used to unregister the object * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; /** * Get the Device that contains this HttpControl * @return ControlPanelDevice */ - (AJCPSControlPanelDevice *)getDevice; /** * Get the Url for the HttpControl * @return url */ - (NSString *)getUrl; /** * Get the ControlPanelMode of this HttpControl * @return ControlPanelMode */ - (AJCPSControlPanelMode)getControlPanelMode; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSLabel.h000066400000000000000000000024401272147170000246230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/Label.h" #import "AJCPSWidget.h" /** * AJCPSLabel class used to display a Label. */ @interface AJCPSLabel : AJCPSWidget /** * Constructor for AJCPSLabel class * @param handle handle to the c++ instance */ - (id)initWithHandle:(ajn ::services ::Label *)handle; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSLabelCell.h000066400000000000000000000022731272147170000254270ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSWidget.h" #import "AJCPSControllerModel.h" @interface AJCPSLabelCell : UITableViewCell @property (strong, nonatomic) UILabel *widgetNameLabel; @property (weak, nonatomic) AJCPSWidget *widget; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSLanguageSet.h000066400000000000000000000032461272147170000260100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/LanguageSet.h" /** * AJCPSLanguageSet is used to define a LanguageSet */ @interface AJCPSLanguageSet : NSObject - (id)initWithHandle:(ajn ::services ::LanguageSet *)handle; /** * Get the LanguageSetName * @return LanguageSetName */ - (NSString *)getLanguageSetName; /** * Get the number of Languages defined * @return number of Languages */ - (size_t)getNumLanguages; /** * Add a language to the LanguageSet * @param language - language to Add */ - (void)addLanguage:(NSString *)language; /** * * Get the Languages defined in the LanguageSet * @return languages vector */ //const std::vector& - (NSArray *)getLanguages; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSLanguageSets.h000066400000000000000000000027231272147170000261720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/LanguageSets.h" #import "AJCPSLanguageSet.h" /** * AJCPSLanguageSets is used to store the LanguageSets defined. */ @interface AJCPSLanguageSets : NSObject - (id)initWithHandle:(ajn ::services ::LanguageSets *)handle; /** * Get a LanguageSet * @param languageSetName - the name of the languageSet to get * @return the languageSet requested or NULL if it does not exist */ - (AJCPSLanguageSet *)getLanguageSet:(NSString *)languageSetName; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSNotificationAction.h000066400000000000000000000045601272147170000273750ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/NotificationAction.h" #import "AJCPSLanguageSet.h" #import "AJCPSRootWidget.h" /** * AJCPSNotificationAction */ @interface AJCPSNotificationAction : NSObject - (id)initWithHandle:(ajn ::services ::NotificationAction *)handle; /** * Get the name of the NotificationAction - the name of the rootWidget * @return name of the NotificationAction */ - (NSString *)getNotificationActionName; /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus; /** * Unregister the BusObjects of the NotificationAction class * @param bus - bus used to unregister the objects * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; /** * Get the LanguageSet of the NotificationAction * @return */ - (AJCPSLanguageSet *)getLanguageSet; /** * Get the Device of the NotificationAction * @return controlPanelDevice */ - (AJCPSControlPanelDevice *)getDevice; /** * Get the objectPath * @return */ - (NSString *)getObjectPath; /** * Get the RootWidget of the NotificationAction * @param Language - languageSet of RootWidget to retrieve * @return rootWidget */ - (AJCPSRootWidget *)getRootWidget:(NSString *)Language; @property (nonatomic, readonly)ajn::services::NotificationAction * handle; @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSPickerCell.h000066400000000000000000000026471272147170000256320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSWidget.h" #import "AJCPSProperty.h" #import "AJCPSControllerModel.h" @interface AJCPSPickerCell : UITableViewCell @property (strong, nonatomic) UIPickerView *picker; @property (strong, nonatomic) NSMutableArray *pickerOptions; @property (strong, nonatomic) UILabel *label; @property (strong, nonatomic) UITextField *pickerTextField; @property (weak, nonatomic) AJCPSWidget *widget; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSProperty.h000066400000000000000000000125271272147170000254370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSWidget.h" #import "alljoyn/controlpanel/Property.h" #import "AJCPSConstraintRange.h" #import "alljoyn/controlpanel/CPSDate.h" #import "alljoyn/controlpanel/CPSTime.h" #import "AJCPSDate.h" #import "AJCPSTime.h" /** * Union that allows the definition of a function pointer * to get the Properties value. */ typedef union { /** * Get Value for type uint16t * @return value of Property */ uint16_t uint16Value; /** * Get Value for type int16_t * @return value of Property */ int16_t int16Value; /** * Get Value for type uint32_t * @return value of Property */ uint32_t uint32Value; /** * Get Value for type int32_t * @return value of Property */ int32_t int32Value; /** * Get Value for type uint64_t * @return value of Property */ uint64_t uint64Value; /** * Get Value for type int64_t * @return value of Property */ int64_t int64Value; /** * Get Value for type double * @return value of Property */ double doubleValue; /** * Get Value for type const char* * @return value of Property */ const char* charValue; /** * Get Value for type bool * @return value of Property */ bool boolValue; /** * Get Value for type CPSDate * @return value of Property */ // CPSDate* dateValue; TODO: arc forbids objc objects here /** * Get Value for type CPSTime * @return value of Property */ // CPSTime* timeValue; TODO: arc forbids objc objects here /** * Get Value for type CPSDate * @return value of Property */ ajn::services::CPSDate* dateValue; /** * Get Value for type CPSTime * @return value of Property */ ajn::services::CPSTime* timeValue; } AJCPSPropertyValue; /** * AJCPSProperty is used to display a property Widget. */ @interface AJCPSProperty : AJCPSWidget - (id)initWithHandle:(ajn ::services ::Property *)handle; /** * Get the PropertyType * @return PropertyType */ - (AJCPSPropertyType)getPropertyType; /** * Get the PropertyValue of the property * @param propertyValue - the property value according to the property type * @return the value of the property */ - (void)getPropertyValue:(AJCPSPropertyValue &)propertyValue; /** * Get the Unit of Measure * @return Unit of Measure Values */ - (NSString *)getUnitOfMeasure; /** * Get the Constraint List vector * @return the Constraint List vector */ //const std::vector& - (NSArray *)getConstraintList; /** * Get the Constraint Range * @return the Constraint Range */ - (AJCPSConstraintRange *)getConstraintRange; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromBool:(bool)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromUnsignedShort:(uint16_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromShort:(int16_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromUnsignedLong:(uint32_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromLong:(int32_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromUnsignedLongLong:(uint64_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromLongLong:(int64_t)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromDouble:(double)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromCString:(const char *)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromDate:(AJCPSDate *)value; /** * Set the new Value * @param value - new Value to be set to * @return status - success/failure */ - (QStatus)setValueFromTime:(AJCPSTime *)value; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSRootWidget.h000066400000000000000000000022171272147170000256750ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJCPSWidget.h" /** * AJCPSRootWidget is here only to mirror the C++ API, thats why it's empty. */ @interface AJCPSRootWidget : AJCPSWidget @end base-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSTime.h000066400000000000000000000035171272147170000245100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/controlpanel/CPSTime.h" /** * AJCPSCPSTime allows sending of a Time as a Property */ @interface AJCPSTime : NSObject - (id)initWithHour:(uint16_t) hour minute:(uint16_t) minute second:(uint16_t) second; - (id)initWithHandle:(ajn ::services ::CPSTime *)handle; /** * Get the hour value of the date * @return hour value */ - (uint16_t)getHour; /** * Set the hour Value of the date * @param hour value */ - (void)setHour:(uint16_t)hour; /** * Get the Minute value of the date * @return minute value */ - (uint16_t)getMinute; /** * Set the Minute value of the date * @param minute value */ - (void)setMinute:(uint16_t)minute; /** * Get the Second value of the date * @return second value */ - (uint16_t)getSecond; /** * Set the Second value of the date * @param second value */ - (void)setSecond:(uint16_t)second; @endbase-16.04/controlpanel/ios/inc/alljoyn/controlpanel/AJCPSWidget.h000066400000000000000000000063731272147170000250400ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import #import "AJCPSLanguageSet.h" #import "AJCPSControlPanelEnums.h" #import "AJCPSControlPanelEnums.h" #import "alljoyn/controlpanel/Widget.h" @class AJCPSControlPanelDevice; /** * AJCPSWidget is a base class for all Widgets. */ @interface AJCPSWidget : NSObject - (id)initWithHandle:(ajn ::services ::Widget *)handle; /** * Get the widgetType of the Widget * @return widgetType */ - (AJCPSWidgetType)getWidgetType; /** * Get the name of the Widget * @return widgetName */ - (NSString *)getWidgetName; /** * Get the mode of the Widget * @return controlPanelMode */ - (AJCPSControlPanelMode)getControlPanelMode; /** * Get this widget's RootWidget * @return rootWidget */ - (const AJCPSWidget *)getRootWidget; /** * Get the Device of the widget * @return device */ - (const AJCPSControlPanelDevice *)getDevice; /** * Get the Interface Version of the Widget * @return interface Version */ - (const uint16_t)getInterfaceVersion; /** * Get the isSecured boolean * @return true/false */ - (bool)getIsSecured; /** * Get IsEnabled boolean * @return true/false */ - (bool)getIsEnabled; /** * Get IsWritable boolean * @return true/false */ - (bool)getIsWritable; /** * Get the States of the Widget * @return states */ - (uint32_t)getStates; /** * Get the BgColor of the Widget * @return bgColor */ - (uint32_t)getBgColor; /** * Get the Label of the Widget * @return label */ - (NSString *)getLabel; /** * Get the array of Hints for the Widget * @return Array of hints */ // const std::vector& getHints; - (NSArray *)getHints; /** * Register the BusObjects for this Widget * @param bus The bus used to register the busObject * @param objectPath The objectPath of the busObject * @return ER_OK if successful. */ - (QStatus)registerObjects:(AJNBusAttachment *)bus atObjectPath:(NSString *)objectPath; /** * Refresh the Widget * @param bus bus used for refreshing the object * @return ER_OK if successful. */ - (QStatus)refreshObjects:(AJNBusAttachment *)bus; /** * Unregister the BusObjects for this widget * @param bus A reference to the AJNBusAttachment. * @return ER_OK if successful. */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus; @property (nonatomic, readonly)ajn::services::Widget * handle; @endbase-16.04/controlpanel/ios/samples/000077500000000000000000000000001272147170000173755ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/ControlPanelService.xcworkspace/000077500000000000000000000000001272147170000256465ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/ControlPanelService.xcworkspace/contents.xcworkspacedata000066400000000000000000000012631272147170000326120ustar00rootroot00000000000000 base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/000077500000000000000000000000001272147170000236125ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_controlpanel_cpp.xcodeproj/000077500000000000000000000000001272147170000327005ustar00rootroot00000000000000project.pbxproj000077500000000000000000001317351272147170000357120ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_controlpanel_cpp.xcodeproj// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 19DCFB5F18A79D6C009EC74D /* ErrorWidget.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A23680F189A274C00FC88E8 /* ErrorWidget.h */; }; 19DCFB6018A79D6C009EC74D /* Action.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236F818799E3100940ED4 /* Action.h */; }; 19DCFB6118A79D6C009EC74D /* ActionWithDialog.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236F918799E3100940ED4 /* ActionWithDialog.h */; }; 19DCFB6218A79D6C009EC74D /* ConstraintList.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FA18799E3100940ED4 /* ConstraintList.h */; }; 19DCFB6318A79D6C009EC74D /* ConstraintRange.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FB18799E3100940ED4 /* ConstraintRange.h */; }; 19DCFB6418A79D6C009EC74D /* Container.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FC18799E3100940ED4 /* Container.h */; }; 19DCFB6518A79D6C009EC74D /* ControlPanel.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FD18799E3100940ED4 /* ControlPanel.h */; }; 19DCFB6618A79D6C009EC74D /* ControlPanelBusListener.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FE18799E3100940ED4 /* ControlPanelBusListener.h */; }; 19DCFB6718A79D6C009EC74D /* ControlPanelControllee.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A5236FF18799E3100940ED4 /* ControlPanelControllee.h */; }; 19DCFB6818A79D6C009EC74D /* ControlPanelControlleeUnit.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370018799E3100940ED4 /* ControlPanelControlleeUnit.h */; }; 19DCFB6918A79D6C009EC74D /* ControlPanelController.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370118799E3100940ED4 /* ControlPanelController.h */; }; 19DCFB6A18A79D6C009EC74D /* ControlPanelControllerUnit.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370218799E3100940ED4 /* ControlPanelControllerUnit.h */; }; 19DCFB6B18A79D6C009EC74D /* ControlPanelDevice.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370318799E3100940ED4 /* ControlPanelDevice.h */; }; 19DCFB6C18A79D6C009EC74D /* ControlPanelEnums.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370418799E3100940ED4 /* ControlPanelEnums.h */; }; 19DCFB6D18A79D6C009EC74D /* ControlPanelListener.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370518799E3100940ED4 /* ControlPanelListener.h */; }; 19DCFB6E18A79D6C009EC74D /* ControlPanelService.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370618799E3100940ED4 /* ControlPanelService.h */; }; 19DCFB6F18A79D6C009EC74D /* ControlPanelSessionHandler.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370718799E3100940ED4 /* ControlPanelSessionHandler.h */; }; 19DCFB7018A79D6C009EC74D /* CPSDate.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370818799E3100940ED4 /* CPSDate.h */; }; 19DCFB7118A79D6C009EC74D /* CPSTime.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370918799E3100940ED4 /* CPSTime.h */; }; 19DCFB7218A79D6C009EC74D /* Dialog.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370A18799E3100940ED4 /* Dialog.h */; }; 19DCFB7318A79D6C009EC74D /* HttpControl.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370B18799E3100940ED4 /* HttpControl.h */; }; 19DCFB7418A79D6C009EC74D /* Label.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370C18799E3100940ED4 /* Label.h */; }; 19DCFB7518A79D6C009EC74D /* LanguageSet.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370D18799E3100940ED4 /* LanguageSet.h */; }; 19DCFB7618A79D6C009EC74D /* LanguageSets.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370E18799E3100940ED4 /* LanguageSets.h */; }; 19DCFB7718A79D6C009EC74D /* NotificationAction.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52370F18799E3100940ED4 /* NotificationAction.h */; }; 19DCFB7818A79D6C009EC74D /* Property.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52371018799E3100940ED4 /* Property.h */; }; 19DCFB7918A79D6C009EC74D /* RootWidget.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52371118799E3100940ED4 /* RootWidget.h */; }; 19DCFB7A18A79D6C009EC74D /* Widget.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 9A52371218799E3100940ED4 /* Widget.h */; }; 9A236812189A276700FC88E8 /* WidgetProxyBusObjectListener.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A236811189A276700FC88E8 /* WidgetProxyBusObjectListener.cc */; }; 9A236814189A277000FC88E8 /* ErrorWidget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A236813189A277000FC88E8 /* ErrorWidget.cc */; }; 9A5238E718799E3200940ED4 /* ActionBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52373718799E3100940ED4 /* ActionBusObject.cc */; }; 9A5238E818799E3200940ED4 /* ContainerBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52373918799E3100940ED4 /* ContainerBusObject.cc */; }; 9A5238E918799E3200940ED4 /* ControlPanelBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52373B18799E3100940ED4 /* ControlPanelBusObject.cc */; }; 9A5238EA18799E3200940ED4 /* DialogBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52373D18799E3100940ED4 /* DialogBusObject.cc */; }; 9A5238EB18799E3200940ED4 /* HttpControlBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52373F18799E3100940ED4 /* HttpControlBusObject.cc */; }; 9A5238EC18799E3200940ED4 /* IntrospectionNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374118799E3100940ED4 /* IntrospectionNode.cc */; }; 9A5238ED18799E3200940ED4 /* LabelBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374318799E3100940ED4 /* LabelBusObject.cc */; }; 9A5238EE18799E3200940ED4 /* NotificationActionBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374518799E3100940ED4 /* NotificationActionBusObject.cc */; }; 9A5238EF18799E3200940ED4 /* PropertyBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374718799E3100940ED4 /* PropertyBusObject.cc */; }; 9A5238F018799E3200940ED4 /* WidgetBusObject.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374918799E3100940ED4 /* WidgetBusObject.cc */; }; 9A5238F118799E3200940ED4 /* ControlPanel.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374B18799E3100940ED4 /* ControlPanel.cc */; }; 9A5238F218799E3200940ED4 /* ControlPanelBusListener.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374C18799E3100940ED4 /* ControlPanelBusListener.cc */; }; 9A5238F318799E3200940ED4 /* ControlPanelControllee.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374E18799E3100940ED4 /* ControlPanelControllee.cc */; }; 9A5238F418799E3200940ED4 /* ControlPanelControlleeUnit.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52374F18799E3100940ED4 /* ControlPanelControlleeUnit.cc */; }; 9A5238F518799E3200940ED4 /* ControlPanelController.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375018799E3100940ED4 /* ControlPanelController.cc */; }; 9A5238F618799E3200940ED4 /* ControlPanelControllerUnit.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375118799E3100940ED4 /* ControlPanelControllerUnit.cc */; }; 9A5238F718799E3200940ED4 /* ControlPanelDevice.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375218799E3100940ED4 /* ControlPanelDevice.cc */; }; 9A5238F818799E3200940ED4 /* ControlPanelService.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375318799E3100940ED4 /* ControlPanelService.cc */; }; 9A5238F918799E3200940ED4 /* ControlPanelSessionHandler.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375418799E3100940ED4 /* ControlPanelSessionHandler.cc */; }; 9A5238FA18799E3200940ED4 /* LanguageSet.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375518799E3100940ED4 /* LanguageSet.cc */; }; 9A5238FB18799E3200940ED4 /* LanguageSets.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375618799E3100940ED4 /* LanguageSets.cc */; }; 9A5238FC18799E3200940ED4 /* NotificationAction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375718799E3100940ED4 /* NotificationAction.cc */; }; 9A5238FD18799E3200940ED4 /* Action.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375A18799E3100940ED4 /* Action.cc */; }; 9A5238FE18799E3200940ED4 /* ActionWithDialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375B18799E3100940ED4 /* ActionWithDialog.cc */; }; 9A5238FF18799E3200940ED4 /* ConstraintList.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375C18799E3100940ED4 /* ConstraintList.cc */; }; 9A52390018799E3200940ED4 /* ConstraintRange.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375D18799E3100940ED4 /* ConstraintRange.cc */; }; 9A52390118799E3200940ED4 /* Container.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375E18799E3100940ED4 /* Container.cc */; }; 9A52390218799E3200940ED4 /* CPSDate.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52375F18799E3100940ED4 /* CPSDate.cc */; }; 9A52390318799E3200940ED4 /* CPSTime.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376018799E3100940ED4 /* CPSTime.cc */; }; 9A52390418799E3200940ED4 /* Dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376118799E3100940ED4 /* Dialog.cc */; }; 9A52390518799E3200940ED4 /* HttpControl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376218799E3100940ED4 /* HttpControl.cc */; }; 9A52390618799E3200940ED4 /* Label.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376318799E3100940ED4 /* Label.cc */; }; 9A52390718799E3200940ED4 /* Property.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376418799E3100940ED4 /* Property.cc */; }; 9A52390818799E3200940ED4 /* RootWidget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376518799E3100940ED4 /* RootWidget.cc */; }; 9A52390918799E3200940ED4 /* Widget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9A52376618799E3100940ED4 /* Widget.cc */; }; 9AB9CDD618547B37004660C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AB9CDD518547B37004660C5 /* Foundation.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 9AB9CDD018547B37004660C5 /* Copy Files */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = inc/alljoyn/controlpanel; dstSubfolderSpec = 16; files = ( 19DCFB5F18A79D6C009EC74D /* ErrorWidget.h in Copy Files */, 19DCFB6018A79D6C009EC74D /* Action.h in Copy Files */, 19DCFB6118A79D6C009EC74D /* ActionWithDialog.h in Copy Files */, 19DCFB6218A79D6C009EC74D /* ConstraintList.h in Copy Files */, 19DCFB6318A79D6C009EC74D /* ConstraintRange.h in Copy Files */, 19DCFB6418A79D6C009EC74D /* Container.h in Copy Files */, 19DCFB6518A79D6C009EC74D /* ControlPanel.h in Copy Files */, 19DCFB6618A79D6C009EC74D /* ControlPanelBusListener.h in Copy Files */, 19DCFB6718A79D6C009EC74D /* ControlPanelControllee.h in Copy Files */, 19DCFB6818A79D6C009EC74D /* ControlPanelControlleeUnit.h in Copy Files */, 19DCFB6918A79D6C009EC74D /* ControlPanelController.h in Copy Files */, 19DCFB6A18A79D6C009EC74D /* ControlPanelControllerUnit.h in Copy Files */, 19DCFB6B18A79D6C009EC74D /* ControlPanelDevice.h in Copy Files */, 19DCFB6C18A79D6C009EC74D /* ControlPanelEnums.h in Copy Files */, 19DCFB6D18A79D6C009EC74D /* ControlPanelListener.h in Copy Files */, 19DCFB6E18A79D6C009EC74D /* ControlPanelService.h in Copy Files */, 19DCFB6F18A79D6C009EC74D /* ControlPanelSessionHandler.h in Copy Files */, 19DCFB7018A79D6C009EC74D /* CPSDate.h in Copy Files */, 19DCFB7118A79D6C009EC74D /* CPSTime.h in Copy Files */, 19DCFB7218A79D6C009EC74D /* Dialog.h in Copy Files */, 19DCFB7318A79D6C009EC74D /* HttpControl.h in Copy Files */, 19DCFB7418A79D6C009EC74D /* Label.h in Copy Files */, 19DCFB7518A79D6C009EC74D /* LanguageSet.h in Copy Files */, 19DCFB7618A79D6C009EC74D /* LanguageSets.h in Copy Files */, 19DCFB7718A79D6C009EC74D /* NotificationAction.h in Copy Files */, 19DCFB7818A79D6C009EC74D /* Property.h in Copy Files */, 19DCFB7918A79D6C009EC74D /* RootWidget.h in Copy Files */, 19DCFB7A18A79D6C009EC74D /* Widget.h in Copy Files */, ); name = "Copy Files"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 9A23680F189A274C00FC88E8 /* ErrorWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorWidget.h; sourceTree = ""; }; 9A236810189A276700FC88E8 /* WidgetProxyBusObjectListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WidgetProxyBusObjectListener.h; sourceTree = ""; }; 9A236811189A276700FC88E8 /* WidgetProxyBusObjectListener.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WidgetProxyBusObjectListener.cc; sourceTree = ""; }; 9A236813189A277000FC88E8 /* ErrorWidget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorWidget.cc; sourceTree = ""; }; 9A5236F818799E3100940ED4 /* Action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Action.h; sourceTree = ""; }; 9A5236F918799E3100940ED4 /* ActionWithDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionWithDialog.h; sourceTree = ""; }; 9A5236FA18799E3100940ED4 /* ConstraintList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstraintList.h; sourceTree = ""; }; 9A5236FB18799E3100940ED4 /* ConstraintRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstraintRange.h; sourceTree = ""; }; 9A5236FC18799E3100940ED4 /* Container.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Container.h; sourceTree = ""; }; 9A5236FD18799E3100940ED4 /* ControlPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanel.h; sourceTree = ""; }; 9A5236FE18799E3100940ED4 /* ControlPanelBusListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelBusListener.h; sourceTree = ""; }; 9A5236FF18799E3100940ED4 /* ControlPanelControllee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelControllee.h; sourceTree = ""; }; 9A52370018799E3100940ED4 /* ControlPanelControlleeUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelControlleeUnit.h; sourceTree = ""; }; 9A52370118799E3100940ED4 /* ControlPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelController.h; sourceTree = ""; }; 9A52370218799E3100940ED4 /* ControlPanelControllerUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelControllerUnit.h; sourceTree = ""; }; 9A52370318799E3100940ED4 /* ControlPanelDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelDevice.h; sourceTree = ""; }; 9A52370418799E3100940ED4 /* ControlPanelEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelEnums.h; sourceTree = ""; }; 9A52370518799E3100940ED4 /* ControlPanelListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelListener.h; sourceTree = ""; }; 9A52370618799E3100940ED4 /* ControlPanelService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelService.h; sourceTree = ""; }; 9A52370718799E3100940ED4 /* ControlPanelSessionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelSessionHandler.h; sourceTree = ""; }; 9A52370818799E3100940ED4 /* CPSDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPSDate.h; sourceTree = ""; }; 9A52370918799E3100940ED4 /* CPSTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPSTime.h; sourceTree = ""; }; 9A52370A18799E3100940ED4 /* Dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Dialog.h; sourceTree = ""; }; 9A52370B18799E3100940ED4 /* HttpControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpControl.h; sourceTree = ""; }; 9A52370C18799E3100940ED4 /* Label.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Label.h; sourceTree = ""; }; 9A52370D18799E3100940ED4 /* LanguageSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LanguageSet.h; sourceTree = ""; }; 9A52370E18799E3100940ED4 /* LanguageSets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LanguageSets.h; sourceTree = ""; }; 9A52370F18799E3100940ED4 /* NotificationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationAction.h; sourceTree = ""; }; 9A52371018799E3100940ED4 /* Property.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Property.h; sourceTree = ""; }; 9A52371118799E3100940ED4 /* RootWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootWidget.h; sourceTree = ""; }; 9A52371218799E3100940ED4 /* Widget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Widget.h; sourceTree = ""; }; 9A52373718799E3100940ED4 /* ActionBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionBusObject.cc; sourceTree = ""; }; 9A52373818799E3100940ED4 /* ActionBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionBusObject.h; sourceTree = ""; }; 9A52373918799E3100940ED4 /* ContainerBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerBusObject.cc; sourceTree = ""; }; 9A52373A18799E3100940ED4 /* ContainerBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerBusObject.h; sourceTree = ""; }; 9A52373B18799E3100940ED4 /* ControlPanelBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelBusObject.cc; sourceTree = ""; }; 9A52373C18799E3100940ED4 /* ControlPanelBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelBusObject.h; sourceTree = ""; }; 9A52373D18799E3100940ED4 /* DialogBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DialogBusObject.cc; sourceTree = ""; }; 9A52373E18799E3100940ED4 /* DialogBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DialogBusObject.h; sourceTree = ""; }; 9A52373F18799E3100940ED4 /* HttpControlBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpControlBusObject.cc; sourceTree = ""; }; 9A52374018799E3100940ED4 /* HttpControlBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpControlBusObject.h; sourceTree = ""; }; 9A52374118799E3100940ED4 /* IntrospectionNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntrospectionNode.cc; sourceTree = ""; }; 9A52374218799E3100940ED4 /* IntrospectionNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntrospectionNode.h; sourceTree = ""; }; 9A52374318799E3100940ED4 /* LabelBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelBusObject.cc; sourceTree = ""; }; 9A52374418799E3100940ED4 /* LabelBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelBusObject.h; sourceTree = ""; }; 9A52374518799E3100940ED4 /* NotificationActionBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationActionBusObject.cc; sourceTree = ""; }; 9A52374618799E3100940ED4 /* NotificationActionBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationActionBusObject.h; sourceTree = ""; }; 9A52374718799E3100940ED4 /* PropertyBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyBusObject.cc; sourceTree = ""; }; 9A52374818799E3100940ED4 /* PropertyBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyBusObject.h; sourceTree = ""; }; 9A52374918799E3100940ED4 /* WidgetBusObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WidgetBusObject.cc; sourceTree = ""; }; 9A52374A18799E3100940ED4 /* WidgetBusObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WidgetBusObject.h; sourceTree = ""; }; 9A52374B18799E3100940ED4 /* ControlPanel.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanel.cc; sourceTree = ""; }; 9A52374C18799E3100940ED4 /* ControlPanelBusListener.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelBusListener.cc; sourceTree = ""; }; 9A52374D18799E3100940ED4 /* ControlPanelConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPanelConstants.h; sourceTree = ""; }; 9A52374E18799E3100940ED4 /* ControlPanelControllee.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelControllee.cc; sourceTree = ""; }; 9A52374F18799E3100940ED4 /* ControlPanelControlleeUnit.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelControlleeUnit.cc; sourceTree = ""; }; 9A52375018799E3100940ED4 /* ControlPanelController.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelController.cc; sourceTree = ""; }; 9A52375118799E3100940ED4 /* ControlPanelControllerUnit.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelControllerUnit.cc; sourceTree = ""; }; 9A52375218799E3100940ED4 /* ControlPanelDevice.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelDevice.cc; sourceTree = ""; }; 9A52375318799E3100940ED4 /* ControlPanelService.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelService.cc; sourceTree = ""; }; 9A52375418799E3100940ED4 /* ControlPanelSessionHandler.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlPanelSessionHandler.cc; sourceTree = ""; }; 9A52375518799E3100940ED4 /* LanguageSet.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LanguageSet.cc; sourceTree = ""; }; 9A52375618799E3100940ED4 /* LanguageSets.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LanguageSets.cc; sourceTree = ""; }; 9A52375718799E3100940ED4 /* NotificationAction.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationAction.cc; sourceTree = ""; }; 9A52375A18799E3100940ED4 /* Action.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Action.cc; sourceTree = ""; }; 9A52375B18799E3100940ED4 /* ActionWithDialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionWithDialog.cc; sourceTree = ""; }; 9A52375C18799E3100940ED4 /* ConstraintList.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstraintList.cc; sourceTree = ""; }; 9A52375D18799E3100940ED4 /* ConstraintRange.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstraintRange.cc; sourceTree = ""; }; 9A52375E18799E3100940ED4 /* Container.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Container.cc; sourceTree = ""; }; 9A52375F18799E3100940ED4 /* CPSDate.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPSDate.cc; sourceTree = ""; }; 9A52376018799E3100940ED4 /* CPSTime.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPSTime.cc; sourceTree = ""; }; 9A52376118799E3100940ED4 /* Dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Dialog.cc; sourceTree = ""; }; 9A52376218799E3100940ED4 /* HttpControl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpControl.cc; sourceTree = ""; }; 9A52376318799E3100940ED4 /* Label.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Label.cc; sourceTree = ""; }; 9A52376418799E3100940ED4 /* Property.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Property.cc; sourceTree = ""; }; 9A52376518799E3100940ED4 /* RootWidget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RootWidget.cc; sourceTree = ""; }; 9A52376618799E3100940ED4 /* Widget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Widget.cc; sourceTree = ""; }; 9AB9CDD218547B37004660C5 /* liballjoyn_controlpanel_cpp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liballjoyn_controlpanel_cpp.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9AB9CDD518547B37004660C5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9AB9CDD918547B37004660C5 /* alljoyn_controlpanel_cpp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "alljoyn_controlpanel_cpp-Prefix.pch"; sourceTree = ""; }; 9AB9CDE318547B37004660C5 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 9AB9CDE618547B37004660C5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 9AB9CDCF18547B37004660C5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AB9CDD618547B37004660C5 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 9A5236EE18799E3100940ED4 /* controlpanel */ = { isa = PBXGroup; children = ( 9A5236F018799E3100940ED4 /* cpp */, ); name = controlpanel; path = ../../../..; sourceTree = ""; }; 9A5236F018799E3100940ED4 /* cpp */ = { isa = PBXGroup; children = ( 9A5236F518799E3100940ED4 /* inc */, 9A52373518799E3100940ED4 /* src */, ); path = cpp; sourceTree = ""; }; 9A5236F518799E3100940ED4 /* inc */ = { isa = PBXGroup; children = ( 9A5236F618799E3100940ED4 /* alljoyn */, ); path = inc; sourceTree = ""; }; 9A5236F618799E3100940ED4 /* alljoyn */ = { isa = PBXGroup; children = ( 9A5236F718799E3100940ED4 /* controlpanel */, ); path = alljoyn; sourceTree = ""; }; 9A5236F718799E3100940ED4 /* controlpanel */ = { isa = PBXGroup; children = ( 9A23680F189A274C00FC88E8 /* ErrorWidget.h */, 9A5236F818799E3100940ED4 /* Action.h */, 9A5236F918799E3100940ED4 /* ActionWithDialog.h */, 9A5236FA18799E3100940ED4 /* ConstraintList.h */, 9A5236FB18799E3100940ED4 /* ConstraintRange.h */, 9A5236FC18799E3100940ED4 /* Container.h */, 9A5236FD18799E3100940ED4 /* ControlPanel.h */, 9A5236FE18799E3100940ED4 /* ControlPanelBusListener.h */, 9A5236FF18799E3100940ED4 /* ControlPanelControllee.h */, 9A52370018799E3100940ED4 /* ControlPanelControlleeUnit.h */, 9A52370118799E3100940ED4 /* ControlPanelController.h */, 9A52370218799E3100940ED4 /* ControlPanelControllerUnit.h */, 9A52370318799E3100940ED4 /* ControlPanelDevice.h */, 9A52370418799E3100940ED4 /* ControlPanelEnums.h */, 9A52370518799E3100940ED4 /* ControlPanelListener.h */, 9A52370618799E3100940ED4 /* ControlPanelService.h */, 9A52370718799E3100940ED4 /* ControlPanelSessionHandler.h */, 9A52370818799E3100940ED4 /* CPSDate.h */, 9A52370918799E3100940ED4 /* CPSTime.h */, 9A52370A18799E3100940ED4 /* Dialog.h */, 9A52370B18799E3100940ED4 /* HttpControl.h */, 9A52370C18799E3100940ED4 /* Label.h */, 9A52370D18799E3100940ED4 /* LanguageSet.h */, 9A52370E18799E3100940ED4 /* LanguageSets.h */, 9A52370F18799E3100940ED4 /* NotificationAction.h */, 9A52371018799E3100940ED4 /* Property.h */, 9A52371118799E3100940ED4 /* RootWidget.h */, 9A52371218799E3100940ED4 /* Widget.h */, ); path = controlpanel; sourceTree = ""; }; 9A52373518799E3100940ED4 /* src */ = { isa = PBXGroup; children = ( 9A52373618799E3100940ED4 /* BusObjects */, 9A52374B18799E3100940ED4 /* ControlPanel.cc */, 9A52374C18799E3100940ED4 /* ControlPanelBusListener.cc */, 9A52374D18799E3100940ED4 /* ControlPanelConstants.h */, 9A52374E18799E3100940ED4 /* ControlPanelControllee.cc */, 9A52374F18799E3100940ED4 /* ControlPanelControlleeUnit.cc */, 9A52375018799E3100940ED4 /* ControlPanelController.cc */, 9A52375118799E3100940ED4 /* ControlPanelControllerUnit.cc */, 9A52375218799E3100940ED4 /* ControlPanelDevice.cc */, 9A52375318799E3100940ED4 /* ControlPanelService.cc */, 9A52375418799E3100940ED4 /* ControlPanelSessionHandler.cc */, 9A52375518799E3100940ED4 /* LanguageSet.cc */, 9A52375618799E3100940ED4 /* LanguageSets.cc */, 9A52375718799E3100940ED4 /* NotificationAction.cc */, 9A52375918799E3100940ED4 /* Widgets */, ); path = src; sourceTree = ""; }; 9A52373618799E3100940ED4 /* BusObjects */ = { isa = PBXGroup; children = ( 9A236810189A276700FC88E8 /* WidgetProxyBusObjectListener.h */, 9A236811189A276700FC88E8 /* WidgetProxyBusObjectListener.cc */, 9A52373718799E3100940ED4 /* ActionBusObject.cc */, 9A52373818799E3100940ED4 /* ActionBusObject.h */, 9A52373918799E3100940ED4 /* ContainerBusObject.cc */, 9A52373A18799E3100940ED4 /* ContainerBusObject.h */, 9A52373B18799E3100940ED4 /* ControlPanelBusObject.cc */, 9A52373C18799E3100940ED4 /* ControlPanelBusObject.h */, 9A52373D18799E3100940ED4 /* DialogBusObject.cc */, 9A52373E18799E3100940ED4 /* DialogBusObject.h */, 9A52373F18799E3100940ED4 /* HttpControlBusObject.cc */, 9A52374018799E3100940ED4 /* HttpControlBusObject.h */, 9A52374118799E3100940ED4 /* IntrospectionNode.cc */, 9A52374218799E3100940ED4 /* IntrospectionNode.h */, 9A52374318799E3100940ED4 /* LabelBusObject.cc */, 9A52374418799E3100940ED4 /* LabelBusObject.h */, 9A52374518799E3100940ED4 /* NotificationActionBusObject.cc */, 9A52374618799E3100940ED4 /* NotificationActionBusObject.h */, 9A52374718799E3100940ED4 /* PropertyBusObject.cc */, 9A52374818799E3100940ED4 /* PropertyBusObject.h */, 9A52374918799E3100940ED4 /* WidgetBusObject.cc */, 9A52374A18799E3100940ED4 /* WidgetBusObject.h */, ); path = BusObjects; sourceTree = ""; }; 9A52375918799E3100940ED4 /* Widgets */ = { isa = PBXGroup; children = ( 9A236813189A277000FC88E8 /* ErrorWidget.cc */, 9A52375A18799E3100940ED4 /* Action.cc */, 9A52375B18799E3100940ED4 /* ActionWithDialog.cc */, 9A52375C18799E3100940ED4 /* ConstraintList.cc */, 9A52375D18799E3100940ED4 /* ConstraintRange.cc */, 9A52375E18799E3100940ED4 /* Container.cc */, 9A52375F18799E3100940ED4 /* CPSDate.cc */, 9A52376018799E3100940ED4 /* CPSTime.cc */, 9A52376118799E3100940ED4 /* Dialog.cc */, 9A52376218799E3100940ED4 /* HttpControl.cc */, 9A52376318799E3100940ED4 /* Label.cc */, 9A52376418799E3100940ED4 /* Property.cc */, 9A52376518799E3100940ED4 /* RootWidget.cc */, 9A52376618799E3100940ED4 /* Widget.cc */, ); path = Widgets; sourceTree = ""; }; 9AB9CDC918547B37004660C5 = { isa = PBXGroup; children = ( 9AB9CDD718547B37004660C5 /* alljoyn_services_cpp */, 9AB9CDD418547B37004660C5 /* Frameworks */, 9AB9CDD318547B37004660C5 /* Products */, ); sourceTree = ""; }; 9AB9CDD318547B37004660C5 /* Products */ = { isa = PBXGroup; children = ( 9AB9CDD218547B37004660C5 /* liballjoyn_controlpanel_cpp.a */, ); name = Products; sourceTree = ""; }; 9AB9CDD418547B37004660C5 /* Frameworks */ = { isa = PBXGroup; children = ( 9AB9CDD518547B37004660C5 /* Foundation.framework */, 9AB9CDE318547B37004660C5 /* XCTest.framework */, 9AB9CDE618547B37004660C5 /* UIKit.framework */, ); name = Frameworks; sourceTree = ""; }; 9AB9CDD718547B37004660C5 /* alljoyn_services_cpp */ = { isa = PBXGroup; children = ( 9A5236EE18799E3100940ED4 /* controlpanel */, 9AB9CDD818547B37004660C5 /* Supporting Files */, ); path = alljoyn_services_cpp; sourceTree = ""; }; 9AB9CDD818547B37004660C5 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AB9CDD918547B37004660C5 /* alljoyn_controlpanel_cpp-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 9AB9CDD118547B37004660C5 /* alljoyn_controlpanel_cpp */ = { isa = PBXNativeTarget; buildConfigurationList = 9AB9CDF518547B37004660C5 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_cpp" */; buildPhases = ( 9AB9CDCE18547B37004660C5 /* Sources */, 9AB9CDCF18547B37004660C5 /* Frameworks */, 9AB9CDD018547B37004660C5 /* Copy Files */, ); buildRules = ( ); dependencies = ( ); name = alljoyn_controlpanel_cpp; productName = alljoyn_services_cpp; productReference = 9AB9CDD218547B37004660C5 /* liballjoyn_controlpanel_cpp.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 9AB9CDCA18547B37004660C5 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; ORGANIZATIONNAME = AllJoyn; }; buildConfigurationList = 9AB9CDCD18547B37004660C5 /* Build configuration list for PBXProject "alljoyn_controlpanel_cpp" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 9AB9CDC918547B37004660C5; productRefGroup = 9AB9CDD318547B37004660C5 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 9AB9CDD118547B37004660C5 /* alljoyn_controlpanel_cpp */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 9AB9CDCE18547B37004660C5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A5238FA18799E3200940ED4 /* LanguageSet.cc in Sources */, 9A5238EA18799E3200940ED4 /* DialogBusObject.cc in Sources */, 9A52390518799E3200940ED4 /* HttpControl.cc in Sources */, 9A5238EC18799E3200940ED4 /* IntrospectionNode.cc in Sources */, 9A5238ED18799E3200940ED4 /* LabelBusObject.cc in Sources */, 9A5238EF18799E3200940ED4 /* PropertyBusObject.cc in Sources */, 9A52390818799E3200940ED4 /* RootWidget.cc in Sources */, 9A5238FC18799E3200940ED4 /* NotificationAction.cc in Sources */, 9A52390618799E3200940ED4 /* Label.cc in Sources */, 9A52390118799E3200940ED4 /* Container.cc in Sources */, 9A52390718799E3200940ED4 /* Property.cc in Sources */, 9A5238FF18799E3200940ED4 /* ConstraintList.cc in Sources */, 9A52390318799E3200940ED4 /* CPSTime.cc in Sources */, 9A5238F418799E3200940ED4 /* ControlPanelControlleeUnit.cc in Sources */, 9A5238F918799E3200940ED4 /* ControlPanelSessionHandler.cc in Sources */, 9A52390918799E3200940ED4 /* Widget.cc in Sources */, 9A5238FD18799E3200940ED4 /* Action.cc in Sources */, 9A52390018799E3200940ED4 /* ConstraintRange.cc in Sources */, 9A5238F718799E3200940ED4 /* ControlPanelDevice.cc in Sources */, 9A5238F818799E3200940ED4 /* ControlPanelService.cc in Sources */, 9A52390218799E3200940ED4 /* CPSDate.cc in Sources */, 9A5238F518799E3200940ED4 /* ControlPanelController.cc in Sources */, 9A5238F218799E3200940ED4 /* ControlPanelBusListener.cc in Sources */, 9A5238E918799E3200940ED4 /* ControlPanelBusObject.cc in Sources */, 9A5238FE18799E3200940ED4 /* ActionWithDialog.cc in Sources */, 9A52390418799E3200940ED4 /* Dialog.cc in Sources */, 9A5238EE18799E3200940ED4 /* NotificationActionBusObject.cc in Sources */, 9A236812189A276700FC88E8 /* WidgetProxyBusObjectListener.cc in Sources */, 9A5238FB18799E3200940ED4 /* LanguageSets.cc in Sources */, 9A5238E718799E3200940ED4 /* ActionBusObject.cc in Sources */, 9A5238F118799E3200940ED4 /* ControlPanel.cc in Sources */, 9A5238F018799E3200940ED4 /* WidgetBusObject.cc in Sources */, 9A5238E818799E3200940ED4 /* ContainerBusObject.cc in Sources */, 9A5238F318799E3200940ED4 /* ControlPanelControllee.cc in Sources */, 9A5238EB18799E3200940ED4 /* HttpControlBusObject.cc in Sources */, 9A5238F618799E3200940ED4 /* ControlPanelControllerUnit.cc in Sources */, 9A236814189A277000FC88E8 /* ErrorWidget.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 9AB9CDF318547B37004660C5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = NO; SDKROOT = iphoneos; VALID_ARCHS = "armv7 armv7s i386"; }; name = Debug; }; 9AB9CDF418547B37004660C5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; VALID_ARCHS = "armv7 armv7s i386"; }; name = Release; }; 9AB9CDF618547B37004660C5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; DSTROOT = /tmp/alljoyn_services_cpp.dst; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_cpp/alljoyn_controlpanel_cpp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", ); OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_controlpanel_cpp; SKIP_INSTALL = YES; VALID_ARCHS = "arm64 armv7 armv7s i386"; }; name = Debug; }; 9AB9CDF718547B37004660C5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; DSTROOT = /tmp/alljoyn_services_cpp.dst; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_cpp/alljoyn_controlpanel_cpp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", ); OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_controlpanel_cpp; SKIP_INSTALL = YES; VALID_ARCHS = "arm64 armv7 armv7s i386"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 9AB9CDCD18547B37004660C5 /* Build configuration list for PBXProject "alljoyn_controlpanel_cpp" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AB9CDF318547B37004660C5 /* Debug */, 9AB9CDF418547B37004660C5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AB9CDF518547B37004660C5 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_cpp" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AB9CDF618547B37004660C5 /* Debug */, 9AB9CDF718547B37004660C5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 9AB9CDCA18547B37004660C5 /* Project object */; } project.xcworkspace/000077500000000000000000000000001272147170000366175ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_controlpanel_cpp.xcodeprojcontents.xcworkspacedata000077500000000000000000000002511272147170000435620ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_controlpanel_cpp.xcodeproj/project.xcworkspace base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_services_cpp/000077500000000000000000000000001272147170000300275ustar00rootroot00000000000000alljoyn_controlpanel_cpp-Prefix.pch000077500000000000000000000020151272147170000367720ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_cpp/alljoyn_services_cpp/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef __OBJC__ #import #endif base-16.04/controlpanel/ios/samples/alljoyn_services_objc/000077500000000000000000000000001272147170000237455ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_controlpanel_objc.xcodeproj/000077500000000000000000000000001272147170000331665ustar00rootroot00000000000000project.pbxproj000077500000000000000000001440161272147170000361740ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_controlpanel_objc.xcodeproj// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 9A6A7EC918A90B5500287EF5 /* AJCPSAction.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12718A8DF59007080F6 /* AJCPSAction.h */; }; 9A6A7ECB18A90B5500287EF5 /* AJCPSConstraintList.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12918A8DF59007080F6 /* AJCPSConstraintList.h */; }; 9A6A7ECC18A90B5500287EF5 /* AJCPSConstraintRange.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12A18A8DF59007080F6 /* AJCPSConstraintRange.h */; }; 9A6A7ECD18A90B5500287EF5 /* AJCPSContainer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12B18A8DF59007080F6 /* AJCPSContainer.h */; }; 9A6A7ECE18A90B5500287EF5 /* AJCPSControllerUpdateEvents.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12D18A8DF59007080F6 /* AJCPSControllerUpdateEvents.h */; }; 9A6A7ECF18A90B5500287EF5 /* AJCPSControlPanel.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12E18A8DF59007080F6 /* AJCPSControlPanel.h */; }; 9A6A7ED018A90B5500287EF5 /* AJCPSControlPanelController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12F18A8DF59007080F6 /* AJCPSControlPanelController.h */; }; 9A6A7ED118A90B5500287EF5 /* AJCPSControlPanelControllerUnit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13018A8DF59007080F6 /* AJCPSControlPanelControllerUnit.h */; }; 9A6A7ED218A90B5500287EF5 /* AJCPSControlPanelDevice.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13118A8DF59007080F6 /* AJCPSControlPanelDevice.h */; }; 9A6A7ED318A90B5500287EF5 /* AJCPSControlPanelEnums.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13218A8DF59007080F6 /* AJCPSControlPanelEnums.h */; }; 9A6A7ED418A90B5500287EF5 /* AJCPSControlPanelListener.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13318A8DF59007080F6 /* AJCPSControlPanelListener.h */; }; 9A6A7ED518A90B5500287EF5 /* AJCPSControlPanelListenerAdapter.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13418A8DF59007080F6 /* AJCPSControlPanelListenerAdapter.h */; }; 9A6A7ED618A90B5500287EF5 /* AJCPSControlPanelService.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13518A8DF59007080F6 /* AJCPSControlPanelService.h */; }; 9A6A7ED718A90B5500287EF5 /* AJCPSDate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13718A8DF59007080F6 /* AJCPSDate.h */; }; 9A6A7ED818A90B5500287EF5 /* AJCPSTime.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13918A8DF59007080F6 /* AJCPSTime.h */; }; 9A6A7ED918A90B5500287EF5 /* AJCPSDialog.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13A18A8DF59007080F6 /* AJCPSDialog.h */; }; 9A6A7EDA18A90B5500287EF5 /* AJCPSErrorWidget.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13B18A8DF59007080F6 /* AJCPSErrorWidget.h */; }; 9A6A7EDB18A90B5500287EF5 /* AJCPSHttpControl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13D18A8DF59007080F6 /* AJCPSHttpControl.h */; }; 9A6A7EDC18A90B5500287EF5 /* AJCPSLabel.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13E18A8DF59007080F6 /* AJCPSLabel.h */; }; 9A6A7EDD18A90B5500287EF5 /* AJCPSLanguageSet.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13F18A8DF59007080F6 /* AJCPSLanguageSet.h */; }; 9A6A7EDE18A90B5500287EF5 /* AJCPSLanguageSets.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E14018A8DF59007080F6 /* AJCPSLanguageSets.h */; }; 9A6A7EDF18A90B5500287EF5 /* AJCPSNotificationAction.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E14118A8DF59007080F6 /* AJCPSNotificationAction.h */; }; 9A6A7EE018A90B5500287EF5 /* AJCPSProperty.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E14218A8DF59007080F6 /* AJCPSProperty.h */; }; 9A6A7EE118A90B5500287EF5 /* AJCPSRootWidget.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E14318A8DF59007080F6 /* AJCPSRootWidget.h */; }; 9A6A7EE218A90B5500287EF5 /* AJCPSWidget.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E14418A8DF59007080F6 /* AJCPSWidget.h */; }; 9A6A7EE318A90B5C00287EF5 /* AJCPSGetControlPanelViewController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13C18A8DF59007080F6 /* AJCPSGetControlPanelViewController.h */; }; 9A6A7EE418A90B5C00287EF5 /* AJCPSButtonCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13618A8DF59007080F6 /* AJCPSButtonCell.h */; }; 9A6A7EE518A90B5C00287EF5 /* AJCPSGeneralCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E13818A8DF59007080F6 /* AJCPSGeneralCell.h */; }; 9A6A7EE618A90B5C00287EF5 /* AJCPSControllerModel.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AC4E12C18A8DF59007080F6 /* AJCPSControllerModel.h */; }; 9AA935ED1854BC2B00378361 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935EC1854BC2B00378361 /* Foundation.framework */; }; 9AA935FB1854BC2B00378361 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935FA1854BC2B00378361 /* XCTest.framework */; }; 9AA935FC1854BC2B00378361 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935EC1854BC2B00378361 /* Foundation.framework */; }; 9AA935FE1854BC2B00378361 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935FD1854BC2B00378361 /* UIKit.framework */; }; 9AA936011854BC2B00378361 /* liballjoyn_controlpanel_objc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935E91854BC2B00378361 /* liballjoyn_controlpanel_objc.a */; }; 9AA936071854BC2B00378361 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9AA936051854BC2B00378361 /* InfoPlist.strings */; }; 9AA936091854BC2B00378361 /* alljoyn_services_objcTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */; }; 9AC4E10C18A8DEC7007080F6 /* AJCPSAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F118A8DEC7007080F6 /* AJCPSAction.mm */; }; 9AC4E10E18A8DEC7007080F6 /* AJCPSConstraintList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F318A8DEC7007080F6 /* AJCPSConstraintList.mm */; }; 9AC4E10F18A8DEC7007080F6 /* AJCPSConstraintRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F418A8DEC7007080F6 /* AJCPSConstraintRange.mm */; }; 9AC4E11018A8DEC7007080F6 /* AJCPSContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F518A8DEC7007080F6 /* AJCPSContainer.mm */; }; 9AC4E11118A8DEC7007080F6 /* AJCPSControllerModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F618A8DEC7007080F6 /* AJCPSControllerModel.mm */; }; 9AC4E11218A8DEC7007080F6 /* AJCPSControlPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F718A8DEC7007080F6 /* AJCPSControlPanel.mm */; }; 9AC4E11318A8DEC7007080F6 /* AJCPSControlPanelController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F818A8DEC7007080F6 /* AJCPSControlPanelController.mm */; }; 9AC4E11418A8DEC7007080F6 /* AJCPSControlPanelControllerUnit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0F918A8DEC7007080F6 /* AJCPSControlPanelControllerUnit.mm */; }; 9AC4E11518A8DEC7007080F6 /* AJCPSControlPanelDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FA18A8DEC7007080F6 /* AJCPSControlPanelDevice.mm */; }; 9AC4E11618A8DEC7007080F6 /* AJCPSControlPanelEnums.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FB18A8DEC7007080F6 /* AJCPSControlPanelEnums.mm */; }; 9AC4E11718A8DEC7007080F6 /* AJCPSControlPanelService.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FC18A8DEC7007080F6 /* AJCPSControlPanelService.mm */; }; 9AC4E11818A8DEC7007080F6 /* AJCPSButtonCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FD18A8DEC7007080F6 /* AJCPSButtonCell.mm */; }; 9AC4E11918A8DEC7007080F6 /* AJCPSDate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FE18A8DEC7007080F6 /* AJCPSDate.mm */; }; 9AC4E11A18A8DEC7007080F6 /* AJCPSGeneralCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E0FF18A8DEC7007080F6 /* AJCPSGeneralCell.mm */; }; 9AC4E11B18A8DEC7007080F6 /* AJCPSTime.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10018A8DEC7007080F6 /* AJCPSTime.mm */; }; 9AC4E11C18A8DEC7007080F6 /* AJCPSDialog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10118A8DEC7007080F6 /* AJCPSDialog.mm */; }; 9AC4E11D18A8DEC7007080F6 /* AJCPSErrorWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10218A8DEC7007080F6 /* AJCPSErrorWidget.mm */; }; 9AC4E11E18A8DEC7007080F6 /* AJCPSGetControlPanelViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10318A8DEC7007080F6 /* AJCPSGetControlPanelViewController.mm */; }; 9AC4E11F18A8DEC7007080F6 /* AJCPSHttpControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10418A8DEC7007080F6 /* AJCPSHttpControl.mm */; }; 9AC4E12018A8DEC7007080F6 /* AJCPSLabel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10518A8DEC7007080F6 /* AJCPSLabel.mm */; }; 9AC4E12118A8DEC7007080F6 /* AJCPSLanguageSet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10618A8DEC7007080F6 /* AJCPSLanguageSet.mm */; }; 9AC4E12218A8DEC7007080F6 /* AJCPSLanguageSets.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10718A8DEC7007080F6 /* AJCPSLanguageSets.mm */; }; 9AC4E12318A8DEC7007080F6 /* AJCPSNotificationAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10818A8DEC7007080F6 /* AJCPSNotificationAction.mm */; }; 9AC4E12418A8DEC7007080F6 /* AJCPSProperty.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10918A8DEC7007080F6 /* AJCPSProperty.mm */; }; 9AC4E12518A8DEC7007080F6 /* AJCPSRootWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10A18A8DEC7007080F6 /* AJCPSRootWidget.mm */; }; 9AC4E12618A8DEC7007080F6 /* AJCPSWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AC4E10B18A8DEC7007080F6 /* AJCPSWidget.mm */; }; B07896331CBE197C00E0BA05 /* AJCPSActionWithDialog.mm in Sources */ = {isa = PBXBuildFile; fileRef = B07896321CBE197C00E0BA05 /* AJCPSActionWithDialog.mm */; }; B0987BB21CBDD35300FEAF3B /* AJCPSActionDialogCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = B0987BB11CBDD35300FEAF3B /* AJCPSActionDialogCell.mm */; }; B0987BB41CBDD3B600FEAF3B /* AJCPSActionDialogCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B0987BB31CBDD38E00FEAF3B /* AJCPSActionDialogCell.h */; }; B0D234B01CBB6058005AB2DC /* AJCPSLabelCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B0D234AD1CBB574E005AB2DC /* AJCPSLabelCell.h */; }; B0D234B21CBB67EE005AB2DC /* AJCPSLabelCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = B0D234B11CBB67EE005AB2DC /* AJCPSLabelCell.mm */; }; B0D234B41CBB7884005AB2DC /* AJCPSPickerCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = B0D234B31CBB7884005AB2DC /* AJCPSPickerCell.mm */; }; B0D234B61CBB791E005AB2DC /* AJCPSPickerCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B0D234B51CBB78CE005AB2DC /* AJCPSPickerCell.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 9AA935FF1854BC2B00378361 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9AA935E11854BC2B00378361 /* Project object */; proxyType = 1; remoteGlobalIDString = 9AA935E81854BC2B00378361; remoteInfo = alljoyn_services_objc; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ 9AA935E71854BC2B00378361 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = inc/alljoyn/controlpanel; dstSubfolderSpec = 16; files = ( B0987BB41CBDD3B600FEAF3B /* AJCPSActionDialogCell.h in CopyFiles */, B0D234B61CBB791E005AB2DC /* AJCPSPickerCell.h in CopyFiles */, B0D234B01CBB6058005AB2DC /* AJCPSLabelCell.h in CopyFiles */, 9A6A7EE318A90B5C00287EF5 /* AJCPSGetControlPanelViewController.h in CopyFiles */, 9A6A7EE418A90B5C00287EF5 /* AJCPSButtonCell.h in CopyFiles */, 9A6A7EE518A90B5C00287EF5 /* AJCPSGeneralCell.h in CopyFiles */, 9A6A7EE618A90B5C00287EF5 /* AJCPSControllerModel.h in CopyFiles */, 9A6A7EC918A90B5500287EF5 /* AJCPSAction.h in CopyFiles */, 9A6A7ECB18A90B5500287EF5 /* AJCPSConstraintList.h in CopyFiles */, 9A6A7ECC18A90B5500287EF5 /* AJCPSConstraintRange.h in CopyFiles */, 9A6A7ECD18A90B5500287EF5 /* AJCPSContainer.h in CopyFiles */, 9A6A7ECE18A90B5500287EF5 /* AJCPSControllerUpdateEvents.h in CopyFiles */, 9A6A7ECF18A90B5500287EF5 /* AJCPSControlPanel.h in CopyFiles */, 9A6A7ED018A90B5500287EF5 /* AJCPSControlPanelController.h in CopyFiles */, 9A6A7ED118A90B5500287EF5 /* AJCPSControlPanelControllerUnit.h in CopyFiles */, 9A6A7ED218A90B5500287EF5 /* AJCPSControlPanelDevice.h in CopyFiles */, 9A6A7ED318A90B5500287EF5 /* AJCPSControlPanelEnums.h in CopyFiles */, 9A6A7ED418A90B5500287EF5 /* AJCPSControlPanelListener.h in CopyFiles */, 9A6A7ED518A90B5500287EF5 /* AJCPSControlPanelListenerAdapter.h in CopyFiles */, 9A6A7ED618A90B5500287EF5 /* AJCPSControlPanelService.h in CopyFiles */, 9A6A7ED718A90B5500287EF5 /* AJCPSDate.h in CopyFiles */, 9A6A7ED818A90B5500287EF5 /* AJCPSTime.h in CopyFiles */, 9A6A7ED918A90B5500287EF5 /* AJCPSDialog.h in CopyFiles */, 9A6A7EDA18A90B5500287EF5 /* AJCPSErrorWidget.h in CopyFiles */, 9A6A7EDB18A90B5500287EF5 /* AJCPSHttpControl.h in CopyFiles */, 9A6A7EDC18A90B5500287EF5 /* AJCPSLabel.h in CopyFiles */, 9A6A7EDD18A90B5500287EF5 /* AJCPSLanguageSet.h in CopyFiles */, 9A6A7EDE18A90B5500287EF5 /* AJCPSLanguageSets.h in CopyFiles */, 9A6A7EDF18A90B5500287EF5 /* AJCPSNotificationAction.h in CopyFiles */, 9A6A7EE018A90B5500287EF5 /* AJCPSProperty.h in CopyFiles */, 9A6A7EE118A90B5500287EF5 /* AJCPSRootWidget.h in CopyFiles */, 9A6A7EE218A90B5500287EF5 /* AJCPSWidget.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 9AA935E91854BC2B00378361 /* liballjoyn_controlpanel_objc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liballjoyn_controlpanel_objc.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9AA935EC1854BC2B00378361 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9AA935F01854BC2B00378361 /* alljoyn_controlpanel_objc-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "alljoyn_controlpanel_objc-Prefix.pch"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 9AA935F91854BC2B00378361 /* alljoyn_controlpanel_objcTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = alljoyn_controlpanel_objcTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9AA935FA1854BC2B00378361 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 9AA935FD1854BC2B00378361 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 9AA936041854BC2B00378361 /* alljoyn_controlpanel_objcTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "alljoyn_controlpanel_objcTests-Info.plist"; sourceTree = ""; }; 9AA936061854BC2B00378361 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = alljoyn_services_objcTests.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 9AC4E0F118A8DEC7007080F6 /* AJCPSAction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSAction.mm; sourceTree = ""; }; 9AC4E0F318A8DEC7007080F6 /* AJCPSConstraintList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSConstraintList.mm; sourceTree = ""; }; 9AC4E0F418A8DEC7007080F6 /* AJCPSConstraintRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSConstraintRange.mm; sourceTree = ""; }; 9AC4E0F518A8DEC7007080F6 /* AJCPSContainer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSContainer.mm; sourceTree = ""; }; 9AC4E0F618A8DEC7007080F6 /* AJCPSControllerModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControllerModel.mm; sourceTree = ""; }; 9AC4E0F718A8DEC7007080F6 /* AJCPSControlPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanel.mm; sourceTree = ""; }; 9AC4E0F818A8DEC7007080F6 /* AJCPSControlPanelController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanelController.mm; sourceTree = ""; }; 9AC4E0F918A8DEC7007080F6 /* AJCPSControlPanelControllerUnit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanelControllerUnit.mm; sourceTree = ""; }; 9AC4E0FA18A8DEC7007080F6 /* AJCPSControlPanelDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanelDevice.mm; sourceTree = ""; }; 9AC4E0FB18A8DEC7007080F6 /* AJCPSControlPanelEnums.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanelEnums.mm; sourceTree = ""; }; 9AC4E0FC18A8DEC7007080F6 /* AJCPSControlPanelService.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSControlPanelService.mm; sourceTree = ""; }; 9AC4E0FD18A8DEC7007080F6 /* AJCPSButtonCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSButtonCell.mm; sourceTree = ""; }; 9AC4E0FE18A8DEC7007080F6 /* AJCPSDate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSDate.mm; sourceTree = ""; }; 9AC4E0FF18A8DEC7007080F6 /* AJCPSGeneralCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSGeneralCell.mm; sourceTree = ""; }; 9AC4E10018A8DEC7007080F6 /* AJCPSTime.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSTime.mm; sourceTree = ""; }; 9AC4E10118A8DEC7007080F6 /* AJCPSDialog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSDialog.mm; sourceTree = ""; }; 9AC4E10218A8DEC7007080F6 /* AJCPSErrorWidget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSErrorWidget.mm; sourceTree = ""; }; 9AC4E10318A8DEC7007080F6 /* AJCPSGetControlPanelViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSGetControlPanelViewController.mm; sourceTree = ""; }; 9AC4E10418A8DEC7007080F6 /* AJCPSHttpControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSHttpControl.mm; sourceTree = ""; }; 9AC4E10518A8DEC7007080F6 /* AJCPSLabel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSLabel.mm; sourceTree = ""; }; 9AC4E10618A8DEC7007080F6 /* AJCPSLanguageSet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSLanguageSet.mm; sourceTree = ""; }; 9AC4E10718A8DEC7007080F6 /* AJCPSLanguageSets.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSLanguageSets.mm; sourceTree = ""; }; 9AC4E10818A8DEC7007080F6 /* AJCPSNotificationAction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSNotificationAction.mm; sourceTree = ""; }; 9AC4E10918A8DEC7007080F6 /* AJCPSProperty.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSProperty.mm; sourceTree = ""; }; 9AC4E10A18A8DEC7007080F6 /* AJCPSRootWidget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSRootWidget.mm; sourceTree = ""; }; 9AC4E10B18A8DEC7007080F6 /* AJCPSWidget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSWidget.mm; sourceTree = ""; }; 9AC4E12718A8DF59007080F6 /* AJCPSAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSAction.h; sourceTree = ""; }; 9AC4E12918A8DF59007080F6 /* AJCPSConstraintList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSConstraintList.h; sourceTree = ""; }; 9AC4E12A18A8DF59007080F6 /* AJCPSConstraintRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSConstraintRange.h; sourceTree = ""; }; 9AC4E12B18A8DF59007080F6 /* AJCPSContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSContainer.h; sourceTree = ""; }; 9AC4E12C18A8DF59007080F6 /* AJCPSControllerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControllerModel.h; sourceTree = ""; }; 9AC4E12D18A8DF59007080F6 /* AJCPSControllerUpdateEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControllerUpdateEvents.h; sourceTree = ""; }; 9AC4E12E18A8DF59007080F6 /* AJCPSControlPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanel.h; sourceTree = ""; }; 9AC4E12F18A8DF59007080F6 /* AJCPSControlPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelController.h; sourceTree = ""; }; 9AC4E13018A8DF59007080F6 /* AJCPSControlPanelControllerUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelControllerUnit.h; sourceTree = ""; }; 9AC4E13118A8DF59007080F6 /* AJCPSControlPanelDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelDevice.h; sourceTree = ""; }; 9AC4E13218A8DF59007080F6 /* AJCPSControlPanelEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelEnums.h; sourceTree = ""; }; 9AC4E13318A8DF59007080F6 /* AJCPSControlPanelListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelListener.h; sourceTree = ""; }; 9AC4E13418A8DF59007080F6 /* AJCPSControlPanelListenerAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelListenerAdapter.h; sourceTree = ""; }; 9AC4E13518A8DF59007080F6 /* AJCPSControlPanelService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSControlPanelService.h; sourceTree = ""; }; 9AC4E13618A8DF59007080F6 /* AJCPSButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSButtonCell.h; sourceTree = ""; }; 9AC4E13718A8DF59007080F6 /* AJCPSDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSDate.h; sourceTree = ""; }; 9AC4E13818A8DF59007080F6 /* AJCPSGeneralCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSGeneralCell.h; sourceTree = ""; }; 9AC4E13918A8DF59007080F6 /* AJCPSTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSTime.h; sourceTree = ""; }; 9AC4E13A18A8DF59007080F6 /* AJCPSDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSDialog.h; sourceTree = ""; }; 9AC4E13B18A8DF59007080F6 /* AJCPSErrorWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSErrorWidget.h; sourceTree = ""; }; 9AC4E13C18A8DF59007080F6 /* AJCPSGetControlPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSGetControlPanelViewController.h; sourceTree = ""; }; 9AC4E13D18A8DF59007080F6 /* AJCPSHttpControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSHttpControl.h; sourceTree = ""; }; 9AC4E13E18A8DF59007080F6 /* AJCPSLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSLabel.h; sourceTree = ""; }; 9AC4E13F18A8DF59007080F6 /* AJCPSLanguageSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSLanguageSet.h; sourceTree = ""; }; 9AC4E14018A8DF59007080F6 /* AJCPSLanguageSets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSLanguageSets.h; sourceTree = ""; }; 9AC4E14118A8DF59007080F6 /* AJCPSNotificationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSNotificationAction.h; sourceTree = ""; }; 9AC4E14218A8DF59007080F6 /* AJCPSProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSProperty.h; sourceTree = ""; }; 9AC4E14318A8DF59007080F6 /* AJCPSRootWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSRootWidget.h; sourceTree = ""; }; 9AC4E14418A8DF59007080F6 /* AJCPSWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSWidget.h; sourceTree = ""; }; B07896311CBE197000E0BA05 /* AJCPSActionWithDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJCPSActionWithDialog.h; sourceTree = ""; }; B07896321CBE197C00E0BA05 /* AJCPSActionWithDialog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSActionWithDialog.mm; sourceTree = ""; }; B0987BB11CBDD35300FEAF3B /* AJCPSActionDialogCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSActionDialogCell.mm; sourceTree = ""; }; B0987BB31CBDD38E00FEAF3B /* AJCPSActionDialogCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AJCPSActionDialogCell.h; sourceTree = ""; }; B0D234AD1CBB574E005AB2DC /* AJCPSLabelCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AJCPSLabelCell.h; sourceTree = ""; }; B0D234B11CBB67EE005AB2DC /* AJCPSLabelCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSLabelCell.mm; sourceTree = ""; }; B0D234B31CBB7884005AB2DC /* AJCPSPickerCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJCPSPickerCell.mm; sourceTree = ""; }; B0D234B51CBB78CE005AB2DC /* AJCPSPickerCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AJCPSPickerCell.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 9AA935E61854BC2B00378361 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AA935ED1854BC2B00378361 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; 9AA935F61854BC2B00378361 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AA935FB1854BC2B00378361 /* XCTest.framework in Frameworks */, 9AA936011854BC2B00378361 /* liballjoyn_controlpanel_objc.a in Frameworks */, 9AA935FE1854BC2B00378361 /* UIKit.framework in Frameworks */, 9AA935FC1854BC2B00378361 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 19A86E4C18A245F60000B0FA /* ControlPanelViewController */ = { isa = PBXGroup; children = ( 9AC4E10318A8DEC7007080F6 /* AJCPSGetControlPanelViewController.mm */, 9AC4E0F618A8DEC7007080F6 /* AJCPSControllerModel.mm */, 9AC4E0FD18A8DEC7007080F6 /* AJCPSButtonCell.mm */, 9AC4E0FF18A8DEC7007080F6 /* AJCPSGeneralCell.mm */, B0D234B11CBB67EE005AB2DC /* AJCPSLabelCell.mm */, B0D234B31CBB7884005AB2DC /* AJCPSPickerCell.mm */, B0987BB11CBDD35300FEAF3B /* AJCPSActionDialogCell.mm */, ); name = ControlPanelViewController; sourceTree = ""; }; 19A86E4D18A2463D0000B0FA /* ControlPanelViewController */ = { isa = PBXGroup; children = ( 9AC4E13C18A8DF59007080F6 /* AJCPSGetControlPanelViewController.h */, 9AC4E13618A8DF59007080F6 /* AJCPSButtonCell.h */, 9AC4E13818A8DF59007080F6 /* AJCPSGeneralCell.h */, 9AC4E12C18A8DF59007080F6 /* AJCPSControllerModel.h */, B0D234AD1CBB574E005AB2DC /* AJCPSLabelCell.h */, B0D234B51CBB78CE005AB2DC /* AJCPSPickerCell.h */, B0987BB31CBDD38E00FEAF3B /* AJCPSActionDialogCell.h */, ); name = ControlPanelViewController; sourceTree = ""; }; 9AA935E01854BC2B00378361 = { isa = PBXGroup; children = ( 9ACE618A187998630003645A /* controlpanel */, 9AA935EE1854BC2B00378361 /* alljoyn_services_objc */, 9AA936021854BC2B00378361 /* alljoyn_services_objcTests */, 9AA935EB1854BC2B00378361 /* Frameworks */, 9AA935EA1854BC2B00378361 /* Products */, ); sourceTree = ""; }; 9AA935EA1854BC2B00378361 /* Products */ = { isa = PBXGroup; children = ( 9AA935E91854BC2B00378361 /* liballjoyn_controlpanel_objc.a */, 9AA935F91854BC2B00378361 /* alljoyn_controlpanel_objcTests.xctest */, ); name = Products; sourceTree = ""; }; 9AA935EB1854BC2B00378361 /* Frameworks */ = { isa = PBXGroup; children = ( 9AA935EC1854BC2B00378361 /* Foundation.framework */, 9AA935FA1854BC2B00378361 /* XCTest.framework */, 9AA935FD1854BC2B00378361 /* UIKit.framework */, ); name = Frameworks; sourceTree = ""; }; 9AA935EE1854BC2B00378361 /* alljoyn_services_objc */ = { isa = PBXGroup; children = ( 9AA935EF1854BC2B00378361 /* Supporting Files */, ); path = alljoyn_services_objc; sourceTree = ""; }; 9AA935EF1854BC2B00378361 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AA935F01854BC2B00378361 /* alljoyn_controlpanel_objc-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; 9AA936021854BC2B00378361 /* alljoyn_services_objcTests */ = { isa = PBXGroup; children = ( 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */, 9AA936031854BC2B00378361 /* Supporting Files */, ); path = alljoyn_services_objcTests; sourceTree = ""; }; 9AA936031854BC2B00378361 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AA936041854BC2B00378361 /* alljoyn_controlpanel_objcTests-Info.plist */, 9AA936051854BC2B00378361 /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; 9ACE618A187998630003645A /* controlpanel */ = { isa = PBXGroup; children = ( 9ACE622A187998630003645A /* ios */, ); name = controlpanel; path = ../../..; sourceTree = ""; }; 9ACE622A187998630003645A /* ios */ = { isa = PBXGroup; children = ( 9ACE622B187998630003645A /* inc */, 9ACE62FD187998630003645A /* src */, ); path = ios; sourceTree = ""; }; 9ACE622B187998630003645A /* inc */ = { isa = PBXGroup; children = ( 9ACE622C187998630003645A /* alljoyn */, ); path = inc; sourceTree = ""; }; 9ACE622C187998630003645A /* alljoyn */ = { isa = PBXGroup; children = ( 9ACE622D187998630003645A /* controlpanel */, ); path = alljoyn; sourceTree = ""; }; 9ACE622D187998630003645A /* controlpanel */ = { isa = PBXGroup; children = ( B07896311CBE197000E0BA05 /* AJCPSActionWithDialog.h */, 9AC4E12718A8DF59007080F6 /* AJCPSAction.h */, 9AC4E12918A8DF59007080F6 /* AJCPSConstraintList.h */, 9AC4E12A18A8DF59007080F6 /* AJCPSConstraintRange.h */, 9AC4E12B18A8DF59007080F6 /* AJCPSContainer.h */, 9AC4E12D18A8DF59007080F6 /* AJCPSControllerUpdateEvents.h */, 9AC4E12E18A8DF59007080F6 /* AJCPSControlPanel.h */, 9AC4E12F18A8DF59007080F6 /* AJCPSControlPanelController.h */, 9AC4E13018A8DF59007080F6 /* AJCPSControlPanelControllerUnit.h */, 9AC4E13118A8DF59007080F6 /* AJCPSControlPanelDevice.h */, 9AC4E13218A8DF59007080F6 /* AJCPSControlPanelEnums.h */, 9AC4E13318A8DF59007080F6 /* AJCPSControlPanelListener.h */, 9AC4E13418A8DF59007080F6 /* AJCPSControlPanelListenerAdapter.h */, 9AC4E13518A8DF59007080F6 /* AJCPSControlPanelService.h */, 9AC4E13718A8DF59007080F6 /* AJCPSDate.h */, 9AC4E13918A8DF59007080F6 /* AJCPSTime.h */, 9AC4E13A18A8DF59007080F6 /* AJCPSDialog.h */, 9AC4E13B18A8DF59007080F6 /* AJCPSErrorWidget.h */, 9AC4E13D18A8DF59007080F6 /* AJCPSHttpControl.h */, 9AC4E13E18A8DF59007080F6 /* AJCPSLabel.h */, 9AC4E13F18A8DF59007080F6 /* AJCPSLanguageSet.h */, 9AC4E14018A8DF59007080F6 /* AJCPSLanguageSets.h */, 9AC4E14118A8DF59007080F6 /* AJCPSNotificationAction.h */, 9AC4E14218A8DF59007080F6 /* AJCPSProperty.h */, 9AC4E14318A8DF59007080F6 /* AJCPSRootWidget.h */, 9AC4E14418A8DF59007080F6 /* AJCPSWidget.h */, 19A86E4D18A2463D0000B0FA /* ControlPanelViewController */, ); path = controlpanel; sourceTree = ""; }; 9ACE62FD187998630003645A /* src */ = { isa = PBXGroup; children = ( B07896321CBE197C00E0BA05 /* AJCPSActionWithDialog.mm */, 9AC4E0F118A8DEC7007080F6 /* AJCPSAction.mm */, 9AC4E0F318A8DEC7007080F6 /* AJCPSConstraintList.mm */, 9AC4E0F418A8DEC7007080F6 /* AJCPSConstraintRange.mm */, 9AC4E0F518A8DEC7007080F6 /* AJCPSContainer.mm */, 9AC4E0F718A8DEC7007080F6 /* AJCPSControlPanel.mm */, 9AC4E0F818A8DEC7007080F6 /* AJCPSControlPanelController.mm */, 9AC4E0F918A8DEC7007080F6 /* AJCPSControlPanelControllerUnit.mm */, 9AC4E0FA18A8DEC7007080F6 /* AJCPSControlPanelDevice.mm */, 9AC4E0FB18A8DEC7007080F6 /* AJCPSControlPanelEnums.mm */, 9AC4E0FC18A8DEC7007080F6 /* AJCPSControlPanelService.mm */, 9AC4E0FE18A8DEC7007080F6 /* AJCPSDate.mm */, 9AC4E10018A8DEC7007080F6 /* AJCPSTime.mm */, 9AC4E10118A8DEC7007080F6 /* AJCPSDialog.mm */, 9AC4E10218A8DEC7007080F6 /* AJCPSErrorWidget.mm */, 9AC4E10418A8DEC7007080F6 /* AJCPSHttpControl.mm */, 9AC4E10518A8DEC7007080F6 /* AJCPSLabel.mm */, 9AC4E10618A8DEC7007080F6 /* AJCPSLanguageSet.mm */, 9AC4E10718A8DEC7007080F6 /* AJCPSLanguageSets.mm */, 9AC4E10818A8DEC7007080F6 /* AJCPSNotificationAction.mm */, 9AC4E10918A8DEC7007080F6 /* AJCPSProperty.mm */, 9AC4E10A18A8DEC7007080F6 /* AJCPSRootWidget.mm */, 9AC4E10B18A8DEC7007080F6 /* AJCPSWidget.mm */, 19A86E4C18A245F60000B0FA /* ControlPanelViewController */, ); path = src; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 9AA935E81854BC2B00378361 /* alljoyn_controlpanel_objc */ = { isa = PBXNativeTarget; buildConfigurationList = 9AA9360C1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_objc" */; buildPhases = ( 9AA935E51854BC2B00378361 /* Sources */, 9AA935E61854BC2B00378361 /* Frameworks */, 9AA935E71854BC2B00378361 /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = alljoyn_controlpanel_objc; productName = alljoyn_services_objc; productReference = 9AA935E91854BC2B00378361 /* liballjoyn_controlpanel_objc.a */; productType = "com.apple.product-type.library.static"; }; 9AA935F81854BC2B00378361 /* alljoyn_controlpanel_objcTests */ = { isa = PBXNativeTarget; buildConfigurationList = 9AA9360F1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_objcTests" */; buildPhases = ( 9AA935F51854BC2B00378361 /* Sources */, 9AA935F61854BC2B00378361 /* Frameworks */, 9AA935F71854BC2B00378361 /* Resources */, ); buildRules = ( ); dependencies = ( 9AA936001854BC2B00378361 /* PBXTargetDependency */, ); name = alljoyn_controlpanel_objcTests; productName = alljoyn_services_objcTests; productReference = 9AA935F91854BC2B00378361 /* alljoyn_controlpanel_objcTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 9AA935E11854BC2B00378361 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = AllJoyn; }; buildConfigurationList = 9AA935E41854BC2B00378361 /* Build configuration list for PBXProject "alljoyn_controlpanel_objc" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 9AA935E01854BC2B00378361; productRefGroup = 9AA935EA1854BC2B00378361 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 9AA935E81854BC2B00378361 /* alljoyn_controlpanel_objc */, 9AA935F81854BC2B00378361 /* alljoyn_controlpanel_objcTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 9AA935F71854BC2B00378361 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AA936071854BC2B00378361 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 9AA935E51854BC2B00378361 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AC4E11118A8DEC7007080F6 /* AJCPSControllerModel.mm in Sources */, 9AC4E11018A8DEC7007080F6 /* AJCPSContainer.mm in Sources */, 9AC4E11D18A8DEC7007080F6 /* AJCPSErrorWidget.mm in Sources */, 9AC4E11F18A8DEC7007080F6 /* AJCPSHttpControl.mm in Sources */, 9AC4E11518A8DEC7007080F6 /* AJCPSControlPanelDevice.mm in Sources */, 9AC4E11B18A8DEC7007080F6 /* AJCPSTime.mm in Sources */, 9AC4E11818A8DEC7007080F6 /* AJCPSButtonCell.mm in Sources */, 9AC4E12018A8DEC7007080F6 /* AJCPSLabel.mm in Sources */, 9AC4E11C18A8DEC7007080F6 /* AJCPSDialog.mm in Sources */, 9AC4E12218A8DEC7007080F6 /* AJCPSLanguageSets.mm in Sources */, 9AC4E11318A8DEC7007080F6 /* AJCPSControlPanelController.mm in Sources */, 9AC4E11718A8DEC7007080F6 /* AJCPSControlPanelService.mm in Sources */, 9AC4E12618A8DEC7007080F6 /* AJCPSWidget.mm in Sources */, 9AC4E12418A8DEC7007080F6 /* AJCPSProperty.mm in Sources */, 9AC4E11418A8DEC7007080F6 /* AJCPSControlPanelControllerUnit.mm in Sources */, 9AC4E10F18A8DEC7007080F6 /* AJCPSConstraintRange.mm in Sources */, 9AC4E10C18A8DEC7007080F6 /* AJCPSAction.mm in Sources */, 9AC4E10E18A8DEC7007080F6 /* AJCPSConstraintList.mm in Sources */, B0987BB21CBDD35300FEAF3B /* AJCPSActionDialogCell.mm in Sources */, 9AC4E11918A8DEC7007080F6 /* AJCPSDate.mm in Sources */, 9AC4E12118A8DEC7007080F6 /* AJCPSLanguageSet.mm in Sources */, 9AC4E12318A8DEC7007080F6 /* AJCPSNotificationAction.mm in Sources */, 9AC4E12518A8DEC7007080F6 /* AJCPSRootWidget.mm in Sources */, 9AC4E11E18A8DEC7007080F6 /* AJCPSGetControlPanelViewController.mm in Sources */, 9AC4E11A18A8DEC7007080F6 /* AJCPSGeneralCell.mm in Sources */, B0D234B41CBB7884005AB2DC /* AJCPSPickerCell.mm in Sources */, B0D234B21CBB67EE005AB2DC /* AJCPSLabelCell.mm in Sources */, B07896331CBE197C00E0BA05 /* AJCPSActionWithDialog.mm in Sources */, 9AC4E11218A8DEC7007080F6 /* AJCPSControlPanel.mm in Sources */, 9AC4E11618A8DEC7007080F6 /* AJCPSControlPanelEnums.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 9AA935F51854BC2B00378361 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AA936091854BC2B00378361 /* alljoyn_services_objcTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 9AA936001854BC2B00378361 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9AA935E81854BC2B00378361 /* alljoyn_controlpanel_objc */; targetProxy = 9AA935FF1854BC2B00378361 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 9AA936051854BC2B00378361 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 9AA936061854BC2B00378361 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 9AA9360A1854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 9AA9360B1854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 9AA9360D1854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; DSTROOT = /tmp/alljoyn_services_objc.dst; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_controlpanel_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/ios/inc\"/**", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/ios/inc/alljoyn/controlpanel/\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_controlpanel_objc; SKIP_INSTALL = YES; VALID_ARCHS = "arm64 armv7 armv7s i386"; }; name = Debug; }; 9AA9360E1854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; DSTROOT = /tmp/alljoyn_services_objc.dst; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_controlpanel_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/ios/inc\"/**", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/controlpanel/ios/inc/alljoyn/controlpanel/\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_controlpanel_objc; SKIP_INSTALL = YES; VALID_ARCHS = "arm64 armv7 armv7s i386"; }; name = Release; }; 9AA936101854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_services_objc-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); HEADER_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)\"/**", "\"$(SRCROOT)/../../../../../common/inc\"", "\"$(SRCROOT)/../../../../../alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(SRCROOT)/../../../../../applications\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc/alljoyn/notification/", ); INFOPLIST_FILE = "alljoyn_services_objcTests/alljoyn_controlpanel_objcTests-Info.plist"; PRODUCT_NAME = alljoyn_controlpanel_objcTests; WRAPPER_EXTENSION = xctest; }; name = Debug; }; 9AA936111854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_services_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)\"/**", "\"$(SRCROOT)/../../../../../common/inc\"", "\"$(SRCROOT)/../../../../../alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(SRCROOT)/../../../../../applications\"/**", ); INFOPLIST_FILE = "alljoyn_services_objcTests/alljoyn_controlpanel_objcTests-Info.plist"; PRODUCT_NAME = alljoyn_controlpanel_objcTests; WRAPPER_EXTENSION = xctest; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 9AA935E41854BC2B00378361 /* Build configuration list for PBXProject "alljoyn_controlpanel_objc" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA9360A1854BC2B00378361 /* Debug */, 9AA9360B1854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AA9360C1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_objc" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA9360D1854BC2B00378361 /* Debug */, 9AA9360E1854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AA9360F1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_controlpanel_objcTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA936101854BC2B00378361 /* Debug */, 9AA936111854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 9AA935E11854BC2B00378361 /* Project object */; } project.xcworkspace/000077500000000000000000000000001272147170000371055ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_controlpanel_objc.xcodeprojcontents.xcworkspacedata000077500000000000000000000002521272147170000440510ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_controlpanel_objc.xcodeproj/project.xcworkspace base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objc/000077500000000000000000000000001272147170000303155ustar00rootroot00000000000000alljoyn_controlpanel_objc-Prefix.pch000077500000000000000000000020161272147170000374140ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objc/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef __OBJC__ #import #endif base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/000077500000000000000000000000001272147170000313405ustar00rootroot00000000000000alljoyn_controlpanel_objcTests-Info.plist000077500000000000000000000032731272147170000415070ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier org.alljoyn.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType BNDL CFBundleShortVersionString 00.01 CFBundleSignature ???? CFBundleVersion 1 alljoyn_services_objcTests.m000077500000000000000000000027321272147170000370410ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import @interface alljoyn_services_objcTests : XCTestCase @end @implementation alljoyn_services_objcTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); } @end base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/en.lproj/000077500000000000000000000000001272147170000330675ustar00rootroot00000000000000InfoPlist.strings000077500000000000000000000000551272147170000363350ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/en.lproj/* Localized versions of Info.plist keys */ base-16.04/controlpanel/ios/samples/sampleApp/000077500000000000000000000000001272147170000213175ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/sampleApp/AnnounceTextViewController.h000066400000000000000000000022211272147170000267770ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/about/AJNAnnouncement.h" @interface AnnounceTextViewController : UIViewController @property (strong, nonatomic) AJNAnnouncement *ajnAnnouncement; @end base-16.04/controlpanel/ios/samples/sampleApp/AnnounceTextViewController.m000066400000000000000000000064211272147170000270120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AnnounceTextViewController.h" #import "alljoyn/about/AJNAboutDataConverter.h" @interface AnnounceTextViewController () @property (weak, nonatomic) IBOutlet UITextView *announceInformation; @end @implementation AnnounceTextViewController - (NSString *)objectDescriptionsToString:(NSMutableDictionary *)qnsObjectDesc { NSMutableString *qnsObjectDescContent = [[NSMutableString alloc] init]; for (NSString *key in qnsObjectDesc.allKeys) { // iterate over the NSMutableDictionary // path: [qnsObjectDescContent appendString:[NSString stringWithFormat:@"path: %@ \n", key]]; [qnsObjectDescContent appendString:[NSString stringWithFormat:@"interfaces: "]]; // interfaces: for (NSString *intrf in qnsObjectDesc[key]) { // get NSString from the received object(NSMutableArray) [qnsObjectDescContent appendString:[NSString stringWithFormat:@"%@ ", intrf]]; } [qnsObjectDescContent appendString:[NSString stringWithFormat:@"\n\n"]]; } return (qnsObjectDescContent); } // parseObjectDescriptions - (void)viewDidLoad { [super viewDidLoad]; // retrive AJNAnnouncement by the announcementButtonCurrentTitle unique name NSString *txt = [[NSString alloc] init]; // set title NSString *title = [self.ajnAnnouncement busName]; txt = [txt stringByAppendingFormat:@"%@\n%@\n", title, [@"" stringByPaddingToLength :[title length] + 10 withString : @"-" startingAtIndex : 0]]; // set body txt = [txt stringByAppendingFormat:@"BusName: %@\n", [self.ajnAnnouncement busName]]; txt = [txt stringByAppendingFormat:@"Port: %hu\n", [self.ajnAnnouncement port]]; txt = [txt stringByAppendingFormat:@"Version: %u\n", [self.ajnAnnouncement version]]; txt = [txt stringByAppendingString:@"\n\n"]; // set AboutMap info txt = [txt stringByAppendingFormat:@"About map:\n"]; txt = [txt stringByAppendingString:[AJNAboutDataConverter aboutDataDictionaryToString:([self.ajnAnnouncement aboutData])]]; txt = [txt stringByAppendingString:@"\n\n"]; // set ObjectDesc info txt = [txt stringByAppendingFormat:@"Bus Object Description:\n"]; txt = [txt stringByAppendingString:[self objectDescriptionsToString:[self.ajnAnnouncement objectDescriptions]]]; self.announceInformation.text = txt; } @end base-16.04/controlpanel/ios/samples/sampleApp/AppDelegate.h000066400000000000000000000022611272147170000236440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNStatus.h" @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; + (void)alertAndLog:(NSString *)message status:(QStatus)status; @end base-16.04/controlpanel/ios/samples/sampleApp/AppDelegate.m000066400000000000000000000061541272147170000236560ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AppDelegate.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } + (void)alertAndLog:(NSString *)message status:(QStatus)status { NSString *alertText = [NSString stringWithFormat:@"%@ (%@)",message, [AJNStatus descriptionForStatusCode:status]]; NSLog(@"%@", alertText); [[[UIAlertView alloc] initWithTitle:@"Startup Error" message:alertText delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; } @end base-16.04/controlpanel/ios/samples/sampleApp/AuthenticationListenerImpl.h000066400000000000000000000021541272147170000270010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNAuthenticationListener.h" @interface AuthenticationListenerImpl : NSObject @end base-16.04/controlpanel/ios/samples/sampleApp/AuthenticationListenerImpl.m000066400000000000000000000152371272147170000270140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AuthenticationListenerImpl.h" static NSString * const DEFAULT_PASSCODE = @"121212"; // Security @interface AuthenticationListenerImpl () @property (strong, nonatomic) UIAlertView *setPassCodeAlert; //Security @property (strong, nonatomic) NSString *passCodeText; //Security @property (strong, nonatomic) NSString *peerName; //Security @property (strong, nonatomic) NSMutableDictionary *peersPasscodes; // Security - store the peers passcodes @end @implementation AuthenticationListenerImpl - (id)init { self = [super init]; if (self) { [self prepareAlerts]; // Create NSMutableDictionary dictionary of peers passcodes self.peersPasscodes = [[NSMutableDictionary alloc] init]; } return self; } - (void)prepareAlerts { // setPassCodeAlert.tag = 1 self.setPassCodeAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"Enter device password" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; self.setPassCodeAlert.alertViewStyle = UIAlertViewStylePlainTextInput; self.setPassCodeAlert.tag = 1; } // Get the user's input from the alert dialog - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (alertView == self.setPassCodeAlert) { [self.setPassCodeAlert dismissWithClickedButtonIndex:buttonIndex animated:NO]; if (buttonIndex == 1) { // User pressed OK // get the input pass self.passCodeText = [self.setPassCodeAlert textFieldAtIndex:0].text; // [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Passcode is: %@", self.passCodeText]]; NSLog(@"Passcode is: %@", self.passCodeText); bool foundPeer = false; // Check that peername is not empty if ([self.peerName length]) { if (![self.passCodeText length]) { // set the pass to default if input is empty self.passCodeText = DEFAULT_PASSCODE; } // Iterate over the dictionary and add/update for (NSString *key in self.peersPasscodes.allKeys) { if ([key isEqualToString:self.peerName]) { // Update passcode for key (self.peersPasscodes)[self.peerName] = self.passCodeText; // [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Update peer %@ with passcode %@", self.peerName, self.passCodeText]]; NSLog(@"Update peer %@ with passcode %@", self.peerName, self.passCodeText); // Set flag foundPeer = true; break; } } if (!foundPeer) { // Add new set of key/value [self.peersPasscodes setValue:self.passCodeText forKey:self.peerName]; // [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"add new peers %@ %@", self.peerName, self.passCodeText]]; NSLog(@"add new peers %@ %@", self.peerName, self.passCodeText); } [[NSNotificationCenter defaultCenter] postNotificationName:@"hasPasscodeForBus" object:self.peerName]; } } else { // User pressed Cancel } } else { NSLog(@"[%@] [%@] alertView.tag is wrong", @"ERROR", [[self class] description]); } } #pragma mark - AJNAuthenticationListener protocol methods - (AJNSecurityCredentials *)requestSecurityCredentialsWithAuthenticationMechanism:(NSString *)authenticationMechanism peerName:(NSString *)peerName authenticationCount:(uint16_t)authenticationCount userName:(NSString *)userName credentialTypeMask:(AJNSecurityCredentialType)mask { AJNSecurityCredentials *creds = nil; bool credFound = false; NSLog(@"requestSecurityCredentialsWithAuthenticationMechanism:%@ forRemotePeer%@ userName:%@", authenticationMechanism, peerName, userName); if ([authenticationMechanism isEqualToString:@"ALLJOYN_SRP_KEYX"] || [authenticationMechanism isEqualToString:@"ALLJOYN_ECDHE_PSK"]) { if (mask & kAJNSecurityCredentialTypePassword) { if (authenticationCount <= 3) { creds = [[AJNSecurityCredentials alloc] init]; // Check if the password stored in peersPasscodes for (NSString *key in self.peersPasscodes.allKeys) { if ([key isEqualToString:peerName]) { creds.password = (self.peersPasscodes)[key]; NSLog(@"Found password %@ for peer %@", creds.password, key); credFound = true; break; } } // Use the default password if (!credFound) { creds.password = DEFAULT_PASSCODE; NSLog(@"Using default password %@ for peer %@", DEFAULT_PASSCODE, peerName); } } } } return creds; } - (void)authenticationUsing:(NSString *)authenticationMechanism forRemotePeer:(NSString *)peerName didCompleteWithStatus:(BOOL)success { NSString *status; status = (success == YES ? @"was successful" : @"failed"); NSLog(@"authenticationUsing:%@ forRemotePeer%@ %@", authenticationMechanism, peerName, status); // [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"authenticationUsing:%@ forRemotePeer%@ %@", authenticationMechanism, peerName, status]]; //get the passcpde for this bus if (!success) { self.peerName = peerName; self.passCodeText = nil; dispatch_async(dispatch_get_main_queue(), ^{ [self.setPassCodeAlert show]; }); } } @end base-16.04/controlpanel/ios/samples/sampleApp/ClientInformation.h000066400000000000000000000023261272147170000251170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/about/AJNAnnouncement.h" #import "AJNTransportMask.h" @interface ClientInformation : NSObject @property (strong, nonatomic) AJNAnnouncement *announcement; @property (strong, nonatomic) NSString *currLang; @end base-16.04/controlpanel/ios/samples/sampleApp/ClientInformation.m000066400000000000000000000024241272147170000251230ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "ClientInformation.h" #import "alljoyn/about/AJNAboutDataConverter.h" @implementation ClientInformation - (void)setAnnouncement:(AJNAnnouncement *)announcement { _announcement = announcement; _currLang = [AJNAboutDataConverter messageArgumentToString:[_announcement aboutData][@"DefaultLanguage"]]; } @end base-16.04/controlpanel/ios/samples/sampleApp/CommonBusListener.h000066400000000000000000000033161272147170000251030ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusListener.h" #import "AJNSessionPortListener.h" /** Implementation of the Bus listener. Called by AllJoyn to inform apps of bus related events. */ @interface CommonBusListener : NSObject /** Init the Value of the SessionPort associated with this SessionPortListener @param sessionPort The port of the session @return Object ID */ - (id)initWithServicePort:(AJNSessionPort)servicePort; /** Set the Value of the SessionPort associated with this SessionPortListener @param sessionPort The port of the session */ - (void)setSessionPort:(AJNSessionPort)sessionPort; /** Get the SessionPort of the listener @return The port of the session */ - (AJNSessionPort)sessionPort; @end base-16.04/controlpanel/ios/samples/sampleApp/CommonBusListener.m000066400000000000000000000051451272147170000251120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "CommonBusListener.h" #import "AJNSessionOptions.h" @interface CommonBusListener () @property AJNSessionPort servicePort; @end @implementation CommonBusListener /** * Accept or reject an incoming JoinSession request. The session does not exist until this * after this function returns. * * This callback is only used by session creators. Therefore it is only called on listeners * passed to BusAttachment::BindSessionPort. * * @param joiner Unique name of potential joiner. * @param sessionPort Session port that was joined. * @param options Session options requested by the joiner. * @return Return true if JoinSession request is accepted. false if rejected. */ - (id)initWithServicePort:(AJNSessionPort)servicePort { self = [super init]; if (self) { self.servicePort = servicePort; } return self; } /** * Set the Value of the SessionPort associated with this SessionPortListener * @param sessionPort */ - (void)setSessionPort:(AJNSessionPort)sessionPort { self.servicePort = sessionPort; } /** * Get the SessionPort of the listener * @return */ - (AJNSessionPort)sessionPort { return self.servicePort; } // protocol method - (BOOL)shouldAcceptSessionJoinerNamed:(NSString *)joiner onSessionPort:(AJNSessionPort)sessionPort withSessionOptions:(AJNSessionOptions *)options { if (sessionPort != self.servicePort) { NSLog(@"Rejecting join attempt on unexpected session port %hu.", sessionPort); return false; } else { NSLog(@"Accepting join session request from %@ (proximity=%c, traffic=%u, transports=%hu).\n", joiner, options.proximity, options.trafficType, options.transports); return true; } } @end base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService.xcodeproj/000077500000000000000000000000001272147170000272345ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService.xcodeproj/project.pbxproj000066400000000000000000000662011272147170000323150ustar00rootroot00000000000000// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 19E2F04317E87CE10005851F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04217E87CE10005851F /* UIKit.framework */; }; 19E2F04517E87CE10005851F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04417E87CE10005851F /* Foundation.framework */; }; 19E2F04717E87CE10005851F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04617E87CE10005851F /* CoreGraphics.framework */; }; 19E2F06917E88AF20005851F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06817E88AF20005851F /* SystemConfiguration.framework */; }; 19E2F06D17E88B030005851F /* libstdc++.6.0.9.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */; }; 19E2F06E17E88B030005851F /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06B17E88B030005851F /* libstdc++.6.dylib */; }; 19E2F06F17E88B030005851F /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06C17E88B030005851F /* libstdc++.dylib */; }; 19E2F07417E88B120005851F /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07117E88B120005851F /* libc++.dylib */; }; 19E2F07517E88B120005851F /* libc++abi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07217E88B120005851F /* libc++abi.dylib */; }; 49838F67189930CE0007FCC6 /* AuthenticationListenerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */; }; 87D309441A70B44200BD4141 /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07017E88B120005851F /* libc++.1.dylib */; }; 9A0118C5187402B400975CE6 /* CommonBusListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0118BF187402B400975CE6 /* CommonBusListener.m */; }; 9A3DB0BC183A0D2A0063D6BE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */; }; 9A3DB0BD183A0D2A0063D6BE /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFE183A0D290063D6BE /* Default.png */; }; 9A3DB0BE183A0D2A0063D6BE /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFF183A0D290063D6BE /* Default@2x.png */; }; 9A3DB0BF183A0D2A0063D6BE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DB000183A0D290063D6BE /* InfoPlist.strings */; }; 9A3DB0C1183A0D2A0063D6BE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB004183A0D290063D6BE /* main.m */; }; 9A3DB0C2183A0D2A0063D6BE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB009183A0D290063D6BE /* AppDelegate.m */; }; 9A3DB0C3183A0D2A0063D6BE /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */; }; 9A3DB0C4183A0D2A0063D6BE /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB00C183A0D290063D6BE /* MainViewController.m */; }; 9A3DB315183A19CB0063D6BE /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A3DB314183A19CB0063D6BE /* libc.dylib */; }; 9A5CC10C183D04AA002327C0 /* alljoynicon.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */; }; 9A5CC10F183D073E002327C0 /* GetAboutCallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */; }; 9A5EFF7D187044BC002833C1 /* ClientInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5EFF7C187044BC002833C1 /* ClientInformation.m */; }; 9AD3D2DE187191AC00D15544 /* AnnounceTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 19E2F03F17E87CE10005851F /* ControlPanelService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ControlPanelService.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19E2F04217E87CE10005851F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 19E2F04417E87CE10005851F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 19E2F04617E87CE10005851F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 19E2F06817E88AF20005851F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.0.9.dylib"; path = "usr/lib/libstdc++.6.0.9.dylib"; sourceTree = SDKROOT; }; 19E2F06B17E88B030005851F /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; }; 19E2F06C17E88B030005851F /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; }; 19E2F07017E88B120005851F /* libc++.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.1.dylib"; path = "usr/lib/libc++.1.dylib"; sourceTree = SDKROOT; }; 19E2F07117E88B120005851F /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; 19E2F07217E88B120005851F /* libc++abi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++abi.dylib"; path = "usr/lib/libc++abi.dylib"; sourceTree = SDKROOT; }; 49838F65189930CE0007FCC6 /* AuthenticationListenerImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationListenerImpl.h; sourceTree = ""; }; 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthenticationListenerImpl.m; sourceTree = ""; }; 9A0118BE187402B400975CE6 /* CommonBusListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonBusListener.h; sourceTree = ""; }; 9A0118BF187402B400975CE6 /* CommonBusListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommonBusListener.m; sourceTree = ""; }; 9A3DAFFB183A0D290063D6BE /* ControlPanelService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ControlPanelService-Info.plist"; sourceTree = ""; }; 9A3DAFFC183A0D290063D6BE /* ControlPanelService-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ControlPanelService-Prefix.pch"; sourceTree = ""; }; 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 9A3DAFFE183A0D290063D6BE /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 9A3DAFFF183A0D290063D6BE /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 9A3DB001183A0D290063D6BE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9A3DB004183A0D290063D6BE /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 9A3DB008183A0D290063D6BE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../AppDelegate.h; sourceTree = ""; }; 9A3DB009183A0D290063D6BE /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ../AppDelegate.m; sourceTree = ""; }; 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 9A3DB00B183A0D290063D6BE /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 9A3DB00C183A0D290063D6BE /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 9A3DB314183A19CB0063D6BE /* libc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libc.dylib; path = usr/lib/libc.dylib; sourceTree = SDKROOT; }; 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = alljoynicon.jpeg; sourceTree = ""; }; 9A5CC10D183D073E002327C0 /* GetAboutCallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetAboutCallViewController.h; sourceTree = ""; }; 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetAboutCallViewController.m; sourceTree = ""; }; 9A5EFF7B187044BC002833C1 /* ClientInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientInformation.h; sourceTree = ""; }; 9A5EFF7C187044BC002833C1 /* ClientInformation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientInformation.m; sourceTree = ""; }; 9AD3D2DC187191AC00D15544 /* AnnounceTextViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnnounceTextViewController.h; sourceTree = ""; }; 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnnounceTextViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 19E2F03C17E87CE10005851F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB315183A19CB0063D6BE /* libc.dylib in Frameworks */, 19E2F07417E88B120005851F /* libc++.dylib in Frameworks */, 87D309441A70B44200BD4141 /* libc++.1.dylib in Frameworks */, 19E2F07517E88B120005851F /* libc++abi.dylib in Frameworks */, 19E2F06F17E88B030005851F /* libstdc++.dylib in Frameworks */, 19E2F06E17E88B030005851F /* libstdc++.6.dylib in Frameworks */, 19E2F06D17E88B030005851F /* libstdc++.6.0.9.dylib in Frameworks */, 19E2F06917E88AF20005851F /* SystemConfiguration.framework in Frameworks */, 19E2F04317E87CE10005851F /* UIKit.framework in Frameworks */, 19E2F04517E87CE10005851F /* Foundation.framework in Frameworks */, 19E2F04717E87CE10005851F /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 19E2F03617E87CE10005851F = { isa = PBXGroup; children = ( 9A3DAFF9183A0D290063D6BE /* ViewControllers */, 9AB8994218758EB400BC53DA /* Utils */, 9AB8994118758EA800BC53DA /* StoryBoards */, 9A3DAFFA183A0D290063D6BE /* Resources */, 19E2F04117E87CE10005851F /* Frameworks */, 19E2F04017E87CE10005851F /* Products */, ); sourceTree = ""; }; 19E2F04017E87CE10005851F /* Products */ = { isa = PBXGroup; children = ( 19E2F03F17E87CE10005851F /* ControlPanelService.app */, ); name = Products; sourceTree = ""; }; 19E2F04117E87CE10005851F /* Frameworks */ = { isa = PBXGroup; children = ( 9A3DB314183A19CB0063D6BE /* libc.dylib */, 19E2F07117E88B120005851F /* libc++.dylib */, 19E2F07017E88B120005851F /* libc++.1.dylib */, 19E2F07217E88B120005851F /* libc++abi.dylib */, 19E2F06C17E88B030005851F /* libstdc++.dylib */, 19E2F06B17E88B030005851F /* libstdc++.6.dylib */, 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */, 19E2F06817E88AF20005851F /* SystemConfiguration.framework */, 19E2F04217E87CE10005851F /* UIKit.framework */, 19E2F04417E87CE10005851F /* Foundation.framework */, 19E2F04617E87CE10005851F /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 9A3DAFF9183A0D290063D6BE /* ViewControllers */ = { isa = PBXGroup; children = ( 9A5CC10D183D073E002327C0 /* GetAboutCallViewController.h */, 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */, 9A3DB00B183A0D290063D6BE /* MainViewController.h */, 9A3DB00C183A0D290063D6BE /* MainViewController.m */, 9AD3D2DC187191AC00D15544 /* AnnounceTextViewController.h */, 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */, ); name = ViewControllers; sourceTree = ""; }; 9A3DAFFA183A0D290063D6BE /* Resources */ = { isa = PBXGroup; children = ( 9A3DB008183A0D290063D6BE /* AppDelegate.h */, 9A3DB009183A0D290063D6BE /* AppDelegate.m */, 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */, 9A3DAFFB183A0D290063D6BE /* ControlPanelService-Info.plist */, 9A3DAFFC183A0D290063D6BE /* ControlPanelService-Prefix.pch */, 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */, 9A3DAFFE183A0D290063D6BE /* Default.png */, 9A3DAFFF183A0D290063D6BE /* Default@2x.png */, 9A3DB000183A0D290063D6BE /* InfoPlist.strings */, 9A3DB004183A0D290063D6BE /* main.m */, ); name = Resources; path = ControlPanelService; sourceTree = ""; }; 9AB8994118758EA800BC53DA /* StoryBoards */ = { isa = PBXGroup; children = ( 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */, ); name = StoryBoards; sourceTree = ""; }; 9AB8994218758EB400BC53DA /* Utils */ = { isa = PBXGroup; children = ( 49838F65189930CE0007FCC6 /* AuthenticationListenerImpl.h */, 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */, 9A0118BE187402B400975CE6 /* CommonBusListener.h */, 9A0118BF187402B400975CE6 /* CommonBusListener.m */, 9A5EFF7B187044BC002833C1 /* ClientInformation.h */, 9A5EFF7C187044BC002833C1 /* ClientInformation.m */, ); name = Utils; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 19E2F03E17E87CE10005851F /* ControlPanelService */ = { isa = PBXNativeTarget; buildConfigurationList = 19E2F06517E87CE10005851F /* Build configuration list for PBXNativeTarget "ControlPanelService" */; buildPhases = ( 19E2F03B17E87CE10005851F /* Sources */, 19E2F03C17E87CE10005851F /* Frameworks */, 19E2F03D17E87CE10005851F /* Resources */, ); buildRules = ( ); dependencies = ( ); name = ControlPanelService; productName = ControlPanelService; productReference = 19E2F03F17E87CE10005851F /* ControlPanelService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 19E2F03717E87CE10005851F /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = AllJoyn; TargetAttributes = { 19E2F03E17E87CE10005851F = { SystemCapabilities = { com.apple.BackgroundModes = { enabled = 0; }; }; }; }; }; buildConfigurationList = 19E2F03A17E87CE10005851F /* Build configuration list for PBXProject "ControlPanelService" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 19E2F03617E87CE10005851F; productRefGroup = 19E2F04017E87CE10005851F /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 19E2F03E17E87CE10005851F /* ControlPanelService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 19E2F03D17E87CE10005851F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB0C3183A0D2A0063D6BE /* MainStoryboard_iPhone.storyboard in Resources */, 9A3DB0BD183A0D2A0063D6BE /* Default.png in Resources */, 9A3DB0BF183A0D2A0063D6BE /* InfoPlist.strings in Resources */, 9A5CC10C183D04AA002327C0 /* alljoynicon.jpeg in Resources */, 9A3DB0BE183A0D2A0063D6BE /* Default@2x.png in Resources */, 9A3DB0BC183A0D2A0063D6BE /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 19E2F03B17E87CE10005851F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB0C4183A0D2A0063D6BE /* MainViewController.m in Sources */, 49838F67189930CE0007FCC6 /* AuthenticationListenerImpl.m in Sources */, 9AD3D2DE187191AC00D15544 /* AnnounceTextViewController.m in Sources */, 9A3DB0C2183A0D2A0063D6BE /* AppDelegate.m in Sources */, 9A5EFF7D187044BC002833C1 /* ClientInformation.m in Sources */, 9A3DB0C1183A0D2A0063D6BE /* main.m in Sources */, 9A0118C5187402B400975CE6 /* CommonBusListener.m in Sources */, 9A5CC10F183D073E002327C0 /* GetAboutCallViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 9A3DB000183A0D290063D6BE /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 9A3DB001183A0D290063D6BE /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 19E2F06317E87CE10005851F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 19E2F06417E87CE10005851F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 19E2F06617E87CE10005851F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ControlPanelService/ControlPanelService-Prefix.pch"; GCC_SYMBOLS_PRIVATE_EXTERN = NO; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", ); INFOPLIST_FILE = "ControlPanelService/ControlPanelService-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_controlpanel_objc", "-lalljoyn_controlpanel_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = ControlPanelService; PROVISIONING_PROFILE = ""; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Debug; }; 19E2F06717E87CE10005851F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ControlPanelService/ControlPanelService-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", ); INFOPLIST_FILE = "ControlPanelService/ControlPanelService-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DNS_BLOCK_ASSERTIONS=1", "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_controlpanel_objc", "-lalljoyn_controlpanel_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = ControlPanelService; PROVISIONING_PROFILE = ""; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 19E2F03A17E87CE10005851F /* Build configuration list for PBXProject "ControlPanelService" */ = { isa = XCConfigurationList; buildConfigurations = ( 19E2F06317E87CE10005851F /* Debug */, 19E2F06417E87CE10005851F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 19E2F06517E87CE10005851F /* Build configuration list for PBXNativeTarget "ControlPanelService" */ = { isa = XCConfigurationList; buildConfigurations = ( 19E2F06617E87CE10005851F /* Debug */, 19E2F06717E87CE10005851F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 19E2F03717E87CE10005851F /* Project object */; } base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService.xcodeproj/project.xcworkspace/000077500000000000000000000000001272147170000332325ustar00rootroot00000000000000contents.xcworkspacedata000066400000000000000000000002441272147170000401150ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService.xcodeproj/project.xcworkspace base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/000077500000000000000000000000001272147170000252405ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/ControlPanelService-Info.plist000066400000000000000000000031521272147170000331300ustar00rootroot00000000000000 CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier org.alljoyn.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 00.01 CFBundleSignature ???? CFBundleVersion 0110 LSRequiresIPhoneOS UIMainStoryboardFile MainStoryboard_iPhone UIMainStoryboardFile~ipad MainStoryboard_iPhone UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/ControlPanelService-Prefix.pch000066400000000000000000000022571272147170000331160ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #ifndef __IPHONE_5_0 #warning "This project uses features only available in iOS SDK 5.0 and later." #endif #ifdef __OBJC__ #import #import #endif base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/Default-568h@2x.png000066400000000000000000000442421272147170000304020ustar00rootroot00000000000000PNG  IHDRpz$iCCPICC Profile8UoT>oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 1136 2012-07-27T15:07:06 Pixelmator 2.0.5 )q?7IDATx=eQqÙ87;;' RBR(JWw^8w<漏7 @^~:;;>9O @F{}w~|}}ޣ#@~<=9G p;*O_8>^#@ ƻZjLZ9:\oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 320 1 480 2012-07-27T15:07:80 Pixelmator 2.0.5 X="IDATxICQDDKIq/L {nov}y>(oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 960 2012-07-27T15:07:37 Pixelmator 2.0.5 PF5IDATx1e HH܎;qoV..Vb&a^p s3;i^;ޟy!@ <>_{x}~\_Wg @܆vW=̻o]yoλ͇ @vU>yO7ן}* p|W}w}5蛿CaW] @>FmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@W>0  @nVjLJޞy @ܞxޝ<x| @7$pߧ:yOߜ' @~y7O/> @!p[_4lIENDB`base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/alljoynicon.jpeg000066400000000000000000000031641272147170000304340ustar00rootroot00000000000000JFIF     "" $(4,$&1'-=-157:::#+?I?8C49:7 8$ $7,57377.,647,,+77/45,,--..7708400,,7,/,,,7.77,54,7775!A12Qa"$Bq#Rr3 !1AQ"2aq#3Bb ?p!LKo+{$lY^pwauēt4<ݙ&ZaY[n',Ga ^e_)ruE)<~m{텺T6Lwy~{S.J`B3z5Ty}vlZֺg"dV>g-7Zln;9^#|ʹzcw6V cRx"SkhH\C~lK7nl :]*Uזԑ34"AIN ņ]f5ۅZ/F)qTK$փO{bD{nv])LHuHo:JCKhBu  HtaA,j~0ݭJ[bƋ5J EylzhʷK9ڑ31XҗÝ!cƆ}N.ž0f<0sܮJTEjRlEOYPX0!!ȓ x?~AGZ  -K1ZTT/ẰhWf*{]13қӿa#_u%«~q s|]ZEtOGrk>I.j_ ߫4odɭXg5m-)JE5sΫ6o^P.YI;'`pcg'!V"`jjJ4r$zbх3l;%B&ns^d7?U"Y}*GăOnlHflrw$_B˒MB⮑!:\TFDkrZ)7ү{rLMu^xȝ-N?\eBok% kZߙQfEG=uB 8t A¤ݟ'ppw!e(h\x;YP<Mпbase-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/en.lproj/000077500000000000000000000000001272147170000267675ustar00rootroot00000000000000base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/en.lproj/InfoPlist.strings000066400000000000000000000000541272147170000323100ustar00rootroot00000000000000// Localized versions of Info.plist keys base-16.04/controlpanel/ios/samples/sampleApp/ControlPanelService/main.m000066400000000000000000000027371272147170000263530ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AppDelegate.h" #import "AJNInit.h" int main(int argc, char *argv[]) { @autoreleasepool { if ([AJNInit alljoynInit] != ER_OK) { return 1; } if ([AJNInit alljoynRouterInit] != ER_OK) { [AJNInit alljoynShutdown]; return 1; } int ret = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); [AJNInit alljoynRouterShutdown]; [AJNInit alljoynShutdown]; return ret; } } base-16.04/controlpanel/ios/samples/sampleApp/GetAboutCallViewController.h000066400000000000000000000032621272147170000267000ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ // #import #import "alljoyn/about/AJNAnnouncementReceiver.h" #import "alljoyn/about/AJNAnnouncement.h" #import "alljoyn/about/AJNAboutDataConverter.h" #import "AJNMessageArgument.h" #import "alljoyn/about/AJNAboutClient.h" #import #import #import "alljoyn/about/AJNAboutServiceApi.h" #import "alljoyn/about/AJNAboutService.h" #import "AJNVersion.h" #import "AJNProxyBusObject.h" #import "GetAboutCallViewController.h" #import "ClientInformation.h" @interface GetAboutCallViewController : UIViewController @property (weak, nonatomic) ClientInformation *clientInformation; @property (weak, nonatomic) AJNBusAttachment *clientBusAttachment; @end base-16.04/controlpanel/ios/samples/sampleApp/GetAboutCallViewController.m000066400000000000000000000175211272147170000267100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ // #import "GetAboutCallViewController.h" static NSString * const CLIENTDEFAULTLANG=@""; @interface GetAboutCallViewController () @property (weak, nonatomic) IBOutlet UILabel *lblVersion; @property (weak, nonatomic) IBOutlet UILabel *lblAboutLanguage; @property (weak, nonatomic) IBOutlet UITextView *txtViewBusObjectDesc; @property (weak, nonatomic) IBOutlet UITextView *txtViewAboutMap; @property (weak, nonatomic) IBOutlet UIButton *optionsButton; @property (strong, nonatomic) AJNMessageArgument *supportedLanguagesMsgArg; @property (nonatomic) AJNSessionId sessionId; @property (nonatomic) UIAlertView *alertBusName; @property (nonatomic) UITextField *alertChooseLanguage; @property (nonatomic) UIAlertView *alertAnnouncementOptions; @property (nonatomic) UIAlertView *alertNoSession; @end @implementation GetAboutCallViewController - (void)prepareAlerts { // busNameAlert.tag = 1 self.alertBusName = [[UIAlertView alloc] initWithTitle:@"Set language" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; self.alertBusName.alertViewStyle = UIAlertViewStylePlainTextInput; self.alertBusName.tag = 1; self.alertChooseLanguage = [self.alertBusName textFieldAtIndex:0]; //connect the UITextField with the alert // announcementOptionsAlert.tag = 2 self.alertAnnouncementOptions = [[UIAlertView alloc] initWithTitle:@"Choose option:" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Refresh", @"Set Language", nil]; self.alertAnnouncementOptions.alertViewStyle = UIAlertViewStyleDefault; self.alertAnnouncementOptions.tag = 2; // alertNoSession.tag = 3 self.alertNoSession = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Session is not connected, check the connection and reconnect." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; self.alertNoSession.alertViewStyle = UIAlertViewStyleDefault; self.alertNoSession.tag = 3; } - (IBAction)TouchUpInsideRefreshandSetLanguage:(UIButton *)sender { [self.alertAnnouncementOptions show]; } - (bool)isValidLanguage:(NSString *)inputLanguage { bool found = false; const ajn::MsgArg *stringArray; size_t fieldListNumElements; QStatus status = [self.supportedLanguagesMsgArg value:@"as", &fieldListNumElements, &stringArray]; if (status == ER_OK) { for (size_t i = 0; i < fieldListNumElements; i++) { char *tempString; stringArray[i].Get("s", &tempString); if ([inputLanguage isEqualToString:@(tempString)]) { found = true; break; } } } return found; } // Get the user's input from the alert dialog - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { switch (alertView.tag) { case 1: // busNameAlert { if (buttonIndex == 1) { //user pressed OK if ([self.alertChooseLanguage.text isEqualToString:@""]) { self.alertChooseLanguage.text = [AJNAboutDataConverter messageArgumentToString:[self.clientInformation.announcement aboutData][@"DefaultLanguage"]]; } if (![self isValidLanguage:self.alertChooseLanguage.text]) { [[[UIAlertView alloc] initWithTitle:@"Error" message:@"Requested language is not supported" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; return; } self.clientInformation.currLang = self.alertChooseLanguage.text; [self UpdateCallViewInformation]; } else { // cancel } } break; case 2: //announcementOptionsAlert { if (buttonIndex == 1) { //refresh [self UpdateCallViewInformation]; } else if (buttonIndex == 2) { self.alertBusName.message = [NSString stringWithFormat:@"Available:%@", [AJNAboutDataConverter messageArgumentToString:self.supportedLanguagesMsgArg]]; [self.alertBusName show]; } } break; case 3: //NoSessionAlert { } break; default: NSLog(@"[%@] [%@] alertView.tag is wrong", @"ERROR", [[self class] description]); break; } } // alert view:clickedButtonAtIndex: - (void)UpdateCallViewInformation { self.lblVersion.text = [NSString stringWithFormat:@"%u", [self.clientInformation.announcement version]]; if (!self.sessionId) { //create sessionOptions AJNSessionOptions *opt = [[AJNSessionOptions alloc] initWithTrafficType:kAJNTrafficMessages supportsMultipoint:false proximity:kAJNProximityAny transportMask:kAJNTransportMaskAny]; //call joinSession self.sessionId = [self.clientBusAttachment joinSessionWithName:[self.clientInformation.announcement busName] onPort:[self.clientInformation.announcement port] withDelegate:(nil) options:opt]; } if (self.sessionId == 0 || self.sessionId == -1) { NSLog(@"[%@] [%@] Failed to join session. sid=%u", @"DEBUG", [[self class] description],self.sessionId); [self.alertNoSession show]; } else { NSMutableDictionary *aboutData; NSMutableDictionary *objDesc; AJNAboutClient *ajnAboutClient = [[AJNAboutClient alloc] initWithBus:self.clientBusAttachment]; QStatus qStatus = [ajnAboutClient aboutDataWithBusName:[self.clientInformation.announcement busName] andLanguageTag:self.clientInformation.currLang andAboutData:&aboutData andSessionId:self.sessionId]; if (qStatus != ER_OK) { UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Calling the about method returned with an error" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [errorAlert show]; } else { [ajnAboutClient objectDescriptionsWithBusName:[self.clientInformation.announcement busName] andObjectDescriptions:&objDesc andSessionId:self.sessionId]; NSLog(@"[%@] [%@] AboutData: %@", @"DEBUG", [[self class] description], [AJNAboutDataConverter aboutDataDictionaryToString:aboutData]); NSLog(@"[%@] [%@] objectDescriptions: %@", @"DEBUG", [[self class] description], [AJNAboutDataConverter objectDescriptionsDictionaryToString:objDesc]); self.supportedLanguagesMsgArg = aboutData[@"SupportedLanguages"]; self.lblAboutLanguage.text = self.clientInformation.currLang; self.txtViewAboutMap.text = [AJNAboutDataConverter aboutDataDictionaryToString:aboutData]; self.txtViewBusObjectDesc.text = [AJNAboutDataConverter objectDescriptionsDictionaryToString:objDesc]; } } } - (void)viewDidLoad { [super viewDidLoad]; [self prepareAlerts]; [self UpdateCallViewInformation]; } - (void)viewWillDisappear:(BOOL)animated { [self.clientBusAttachment leaveSession:self.sessionId]; [super viewWillDisappear:animated]; } @end base-16.04/controlpanel/ios/samples/sampleApp/MainStoryboard_iPhone.storyboard000066400000000000000000000614221272147170000276750ustar00rootroot00000000000000 base-16.04/controlpanel/ios/samples/sampleApp/MainViewController.h000066400000000000000000000025721272147170000252610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusListener.h" #import "alljoyn/about/AJNAnnouncementListener.h" @interface MainViewController : UIViewController @property (weak, nonatomic) IBOutlet UIButton *connectButton; @property (weak, nonatomic) IBOutlet UITableView *servicesTable; - (IBAction)connectButtonDidTouchUpInside:(id)sender; @end base-16.04/controlpanel/ios/samples/sampleApp/MainViewController.m000066400000000000000000000607731272147170000252750ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "MainViewController.h" #import "AJNStatus.h" #import "alljoyn/about/AJNAnnouncement.h" #import "alljoyn/about/AJNAnnouncementReceiver.h" #import "alljoyn/about/AJNAboutDataConverter.h" #import "ClientInformation.h" #import "AnnounceTextViewController.h" #import "GetAboutCallViewController.h" #import "alljoyn/controlpanel/AJCPSGetControlPanelViewController.h" #import "AuthenticationListenerImpl.h" #include #import "AppDelegate.h" static bool ALLOWREMOTEMESSAGES = true; // About Client - allow Remote Messages flag static NSString * const APPNAME = @"AboutClientMain"; // About Client - default application name static NSString * const DAEMON_QUIET_PREFIX = @"quiet@"; // About Client - quiet advertising static NSString * const CONTROLPANEL_OBJECT_PATH = @"/ControlPanel/"; static NSString * const CONTROLPANEL_INTERFACE_NAME = @"org.alljoyn.ControlPanel.ControlPanel"; static NSString * const HTTPCONTROL_INTERFACE_NAME = @"org.alljoyn.ControlPanel.HTTPControl"; static NSString * const DEFAULT_REALM_BUS_NAME = @"org.alljoyn.BusNode.ControlPanelClient"; static NSString * const KEYSTORE_FILE_PATH = @"Documents/alljoyn_keystore/s_central.ks"; static NSString * const AUTH_MECHANISM = @"ALLJOYN_SRP_KEYX ALLJOYN_ECDHE_PSK"; @interface MainViewController () @property NSString *className; // About Client properties @property (strong, nonatomic) AJNBusAttachment *clientBusAttachment; @property (strong, nonatomic) AJNAnnouncementReceiver *announcementReceiver; @property (strong, nonatomic) NSString *realmBusName; @property (nonatomic) bool isAboutClientConnected; @property (strong, nonatomic) NSMutableDictionary *clientInformationDict; // Store the client related information // Announcement @property (strong, nonatomic) NSString *announcementButtonCurrentTitle; // The pressed button's announcementUniqueName @property (strong, nonatomic) dispatch_queue_t annBtnCreationQueue; // About Client strings @property (strong, nonatomic) NSString *ajconnect; @property (strong, nonatomic) NSString *ajdisconnect; @property (strong, nonatomic) NSString *annSubvTitleLabelDefaultTxt; // About Client alerts @property (strong, nonatomic) UIAlertView *announcementOptionsAlert; @property (strong, nonatomic) UIAlertView *announcementOptionsAlertNoCPanel; @property (strong, nonatomic) AuthenticationListenerImpl *authenticationListenerImpl; @end @implementation MainViewController #pragma mark - Built In methods - (void)viewDidLoad { [super viewDidLoad]; [self loadNewSession]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if (self.isAboutClientConnected){ [self.clientInformationDict removeAllObjects]; [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; [self registerAnnouncementReceiver]; } } -(void)viewWillDisappear:(BOOL)animated { [super viewWillAppear:animated]; if (self.isAboutClientConnected){ [self unregisterAnnouncementReceiver]; } } // Get the user's input from the alert dialog - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (alertView == self.announcementOptionsAlert) { [self performAnnouncementAction:buttonIndex]; } else if (alertView == self.announcementOptionsAlertNoCPanel) { [self performAnnouncementAction:buttonIndex]; } else { NSLog(@"[%@] [%@] alertView.tag is wrong", @"ERROR", [[self class] description]); } } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // GetAboutCallViewController if ([segue.destinationViewController isKindOfClass:[GetAboutCallViewController class]]) { GetAboutCallViewController *getAboutCallView = segue.destinationViewController; getAboutCallView.clientInformation = (self.clientInformationDict)[self.announcementButtonCurrentTitle]; getAboutCallView.clientBusAttachment = self.clientBusAttachment; } // AnnounceTextViewController else if ([segue.destinationViewController isKindOfClass:[AnnounceTextViewController class]]) { AnnounceTextViewController *announceTextViewController = segue.destinationViewController; announceTextViewController.ajnAnnouncement = [(ClientInformation *)(self.clientInformationDict)[self.announcementButtonCurrentTitle] announcement]; } } #pragma mark - IBAction Methods - (IBAction)connectButtonDidTouchUpInside:(id)sender { // Connect to the bus with the default realm bus name if (!self.isAboutClientConnected) { [self startAboutClient]; } else { [self stopAboutClient]; } } #pragma mark - AJNAnnouncementListener protocol method // Here we receive an announcement from AJN and add it to the client's list of services avaialble - (void)announceWithVersion:(uint16_t)version port:(uint16_t)port busName:(NSString *)busName objectDescriptions:(NSMutableDictionary *)objectDescs aboutData:(NSMutableDictionary **)aboutData { NSString *announcementUniqueName; // Announcement unique name in a format of ClientInformation *clientInformation = [[ClientInformation alloc] init]; // Save the announcement in a AJNAnnouncement clientInformation.announcement = [[AJNAnnouncement alloc] initWithVersion:version port:port busName:busName objectDescriptions:objectDescs aboutData:aboutData]; // Generate an announcement unique name in a format of announcementUniqueName = [NSString stringWithFormat:@"%@ %@", [clientInformation.announcement busName], [AJNAboutDataConverter messageArgumentToString:[clientInformation.announcement aboutData][@"DeviceName"]]]; NSLog(@"[%@] [%@] Announcement unique name [%@]", @"DEBUG", [[self class] description], announcementUniqueName); AJNMessageArgument *annObjMsgArg = [clientInformation.announcement aboutData][@"AppId"]; uint8_t *appIdBuffer; size_t appIdNumElements; QStatus status; status = [annObjMsgArg value:@"ay", &appIdNumElements, &appIdBuffer]; // Add the received announcement if (status != ER_OK) { NSLog(@"[%@] [%@] Failed to read appId for key [%@]", @"DEBUG", [[self class] description], announcementUniqueName); return; } // Dealing with announcement entries should be syncronized, so we add it to a queue dispatch_sync(self.annBtnCreationQueue, ^{ bool isAppIdExists = false; uint8_t *tmpAppIdBuffer; size_t tmpAppIdNumElements; QStatus tStatus; int res; // Iterate over the announcements dictionary for (NSString *key in self.clientInformationDict.allKeys) { ClientInformation *clientInfo = [self.clientInformationDict valueForKey:key]; AJNAnnouncement *announcement = [clientInfo announcement]; AJNMessageArgument *tmpMsgrg = [announcement aboutData][@"AppId"]; tStatus = [tmpMsgrg value:@"ay", &tmpAppIdNumElements, &tmpAppIdBuffer]; if (tStatus != ER_OK) { NSLog(@"[%@] [%@] Failed to read appId for key [%@]", @"DEBUG", [[self class] description], key); return; } res = 1; if (appIdNumElements == tmpAppIdNumElements) { res = memcmp(appIdBuffer, tmpAppIdBuffer, appIdNumElements); } // Found a matched appId - res=0 if (!res) { isAppIdExists = true; // Same AppId and the same announcementUniqueName if ([key isEqualToString:announcementUniqueName]) { // Update only announcements dictionary NSLog(@"[%@] [%@] Got an announcement from a known device - updating the announcement object", @"DEBUG", [[self class] description]); (self.clientInformationDict)[announcementUniqueName] = clientInformation; // Same AppId but *different* announcementUniqueName } else { NSLog(@"[%@] [%@] Got an announcement from a known device(different bus name) - updating the announcement object and UI ", @"DEBUG", [[self class] description]); // Cancel advertise name if the bus name has changed NSString *prevBusName = [announcement busName]; if (!([busName isEqualToString:prevBusName])) { tStatus = [self.clientBusAttachment cancelFindAdvertisedName:prevBusName]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelAdvertisedName for %@. status:%@", @"DEBUG", [[self class] description],prevBusName, [AJNStatus descriptionForStatusCode:tStatus]); } } // Remove existed record from the announcements dictionary [self.clientInformationDict removeObjectForKey:key]; // Add new record to the announcements dictionary [self.clientInformationDict setValue:clientInformation forKey:announcementUniqueName]; // Update UI [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } break; } //if } //for //appId doesn't exist and there is no match announcementUniqueName if (!(self.clientInformationDict)[announcementUniqueName] && !isAppIdExists) { // Add new pair with this AboutService information (version,port,bus name, object description and about data) [self.clientInformationDict setValue:clientInformation forKey:announcementUniqueName]; [self addNewAnnouncemetEntry]; // AppId doesn't exist and BUT there is no match announcementUniqueName } // else No OP }); // Register interest in a well-known name prefix for the purpose of discovery (didLoseAdertise) [self.clientBusAttachment enableConcurrentCallbacks]; status = [self.clientBusAttachment findAdvertisedName:busName]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to findAdvertisedName for %@. status:%@", @"ERROR", [[self class] description],busName, [AJNStatus descriptionForStatusCode:status]); } } #pragma mark AJNBusListener protocol methods - (void)didFindAdvertisedName:(NSString *)name withTransportMask:(AJNTransportMask)transport namePrefix:(NSString *)namePrefix { NSLog(@"didFindAdvertisedName %@", name); } - (void)didLoseAdvertisedName:(NSString *)name withTransportMask:(AJNTransportMask)transport namePrefix:(NSString *)namePrefix { NSLog(@"didLoseAdvertisedName"); QStatus status; // Find the button title that should be removed for (NSString *key in[self.clientInformationDict allKeys]) { if ([[[[self.clientInformationDict valueForKey:key] announcement] busName] isEqualToString:name]) { // Cancel advertise name for that bus status = [self.clientBusAttachment cancelFindAdvertisedName:name]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelFindAdvertisedName for %@. status:%@", @"DEBUG", [[self class] description],name, [AJNStatus descriptionForStatusCode:status]); } // Remove the anouncement from the dictionary [self.clientInformationDict removeObjectForKey:key]; [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } } [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } #pragma mark - util methods - (void)loadNewSession { // About flags self.isAboutClientConnected = false; self.annBtnCreationQueue = dispatch_queue_create("org.alljoyn.announcementbuttoncreationQueue", NULL); // Set About Client strings self.ajconnect = @"Connect to AllJoyn"; self.ajdisconnect = @"Disconnect from AllJoyn"; self.realmBusName = DEFAULT_REALM_BUS_NAME; self.annSubvTitleLabelDefaultTxt = @"Announcement of "; // Set About Client connect button self.connectButton.backgroundColor = [UIColor darkGrayColor]; //button bg color [self.connectButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; //button font color [self.connectButton setTitle:self.ajconnect forState:UIControlStateNormal]; //default text [self prepareAlerts]; } // Initialize alerts - (void)prepareAlerts { // announcementOptionsAlert.tag = 3 self.announcementOptionsAlert = [[UIAlertView alloc] initWithTitle:@"Choose option:" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Show Announce", @"About", @"Control Panel", nil]; self.announcementOptionsAlert.alertViewStyle = UIAlertViewStyleDefault; // announcementOptionsAlert.tag = 4 self.announcementOptionsAlertNoCPanel = [[UIAlertView alloc] initWithTitle:@"Choose option:" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Show Announce", @"About", nil]; self.announcementOptionsAlertNoCPanel.alertViewStyle = UIAlertViewStyleDefault; } - (void)performAnnouncementAction:(NSInteger)opt { switch (opt) { case 0: // "Cancel" break; case 1: // "Show Announce" { [self performSegueWithIdentifier:@"AboutShowAnnounceSegue" sender:self]; } break; case 2: // "About" { [self performSegueWithIdentifier:@"AboutClientSegue" sender:self]; // get the announcment object } break; case 3: // "CPanel" { AJCPSGetControlPanelViewController *getCpanelView = [[AJCPSGetControlPanelViewController alloc] initWithAnnouncement:[(ClientInformation *)(self.clientInformationDict)[self.announcementButtonCurrentTitle] announcement] bus:self.clientBusAttachment]; [self.navigationController pushViewController:getCpanelView animated:YES]; } break; default: break; } } #pragma mark - AboutClient #pragma mark start AboutClient - (void)startAboutClient { QStatus status; // Create a dictionary to contain announcements using a key in the format of: "announcementUniqueName + announcementObj" self.clientInformationDict = [[NSMutableDictionary alloc] init]; NSLog(@"[%@] [%@] Start About Client", @"DEBUG", [[self class] description]); // Init AJNBusAttachment self.clientBusAttachment = [[AJNBusAttachment alloc] initWithApplicationName:APPNAME allowRemoteMessages:ALLOWREMOTEMESSAGES]; // Start AJNBusAttachment status = [self.clientBusAttachment start]; if (status != ER_OK) { [AppDelegate alertAndLog:@"Failed AJNBusAttachment start" status:status]; [self stopAboutClient]; return; } // Connect AJNBusAttachment status = [self.clientBusAttachment connectWithArguments:@""]; if (status != ER_OK) { [AppDelegate alertAndLog:@"Failed AJNBusAttachment connectWithArguments" status:status]; [self stopAboutClient]; return; } NSLog(@"[%@] [%@] Create aboutClientListener", @"DEBUG", [[self class] description]); NSLog(@"[%@] [%@] Register aboutClientListener", @"DEBUG", [[self class] description]); [self.clientBusAttachment registerBusListener:self]; [self registerAnnouncementReceiver]; NSUUID *UUID = [NSUUID UUID]; NSString *stringUUID = [UUID UUIDString]; self.realmBusName = [NSString stringWithFormat:@"%@-%@", DEFAULT_REALM_BUS_NAME, stringUUID]; // Advertise Daemon for tcl status = [self.clientBusAttachment requestWellKnownName:self.realmBusName withFlags:kAJNBusNameFlagDoNotQueue]; if (status == ER_OK) { status = [self.clientBusAttachment advertiseName:[NSString stringWithFormat:@"%@%@", DAEMON_QUIET_PREFIX, self.realmBusName] withTransportMask:kAJNTransportMaskAny]; if (status != ER_OK) { [AppDelegate alertAndLog:@"Failed to advertise name" status:status]; [self stopAboutClient]; return; } else { NSLog(@"[%@] [%@] Successfully advertised: %@%@", @"DEBUG", [[self class] description], DAEMON_QUIET_PREFIX, self.realmBusName); } } else { [AppDelegate alertAndLog:@"Failed to requestWellKnownName" status:status]; [self stopAboutClient]; return; } // Enable Client Security self.authenticationListenerImpl = [[AuthenticationListenerImpl alloc] init]; status = [self enableClientSecurity]; if (ER_OK != status) { NSLog(@"Failed to enable security."); } else { NSLog(@"Successfully enabled security for the bus"); } [self.connectButton setTitle:self.ajdisconnect forState:UIControlStateNormal]; //change title to "Disconnect from AllJoyn" self.isAboutClientConnected = true; } - (QStatus)enableClientSecurity { QStatus status; status = [self.clientBusAttachment enablePeerSecurity:AUTH_MECHANISM authenticationListener:self.authenticationListenerImpl keystoreFileName:KEYSTORE_FILE_PATH sharing:YES]; if (status != ER_OK) { //try to delete the keystore and recreate it, if that fails return failure NSError *error; NSString *keystoreFilePath = [NSString stringWithFormat:@"%@/alljoyn_keystore/s_central.ks", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]]; [[NSFileManager defaultManager] removeItemAtPath:keystoreFilePath error:&error]; if (error) { NSLog(@"ERROR: Unable to delete keystore. %@", error); return ER_AUTH_FAIL; } status = [self.clientBusAttachment enablePeerSecurity:AUTH_MECHANISM authenticationListener:self.authenticationListenerImpl keystoreFileName:KEYSTORE_FILE_PATH sharing:YES]; } return status; } - (void)addNewAnnouncemetEntry { [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } // announcementGetMoreInfo is an IBAction triggered by pressing a dynamic announcement button - (void)announcementGetMoreInfo:(NSInteger)requestedRow { // set the announcementButtonCurrentTitle self.announcementButtonCurrentTitle = [self.clientInformationDict allKeys][requestedRow]; NSLog(@"[%@] [%@] Requested: [%@]", @"DEBUG", [[self class] description],self.announcementButtonCurrentTitle); // Check if announcement has icon object path if ([self announcementHasCPanel:self.announcementButtonCurrentTitle]) { [self.announcementOptionsAlert show]; // Event is forward to alertView: clickedButtonAtIndex: } else { [self.announcementOptionsAlertNoCPanel show]; // Event is forward to alertView: clickedButtonAtIndex: } } // Return true if an announcement supports icon interface - (bool)announcementHasCPanel:(NSString *)announcementKey { bool hascPanel = false; AJNAnnouncement *announcement = [(ClientInformation *)[self.clientInformationDict valueForKey:announcementKey] announcement]; NSMutableDictionary *announcementObjDecs = [announcement objectDescriptions]; //Dictionary of ObjectDescriptions NSStrings // iterate over the object descriptions dictionary for (NSString *key in announcementObjDecs.allKeys) { if ([key hasPrefix:CONTROLPANEL_OBJECT_PATH]) { // Iterate over the NSMutableArray for (NSString *intf in[announcementObjDecs valueForKey:key]) { if ([intf isEqualToString:(NSString *)CONTROLPANEL_INTERFACE_NAME]) { hascPanel = true; } } } } return hascPanel; } - (void) registerAnnouncementReceiver { QStatus status; self.announcementReceiver = [[AJNAnnouncementReceiver alloc] initWithAnnouncementListener:self andBus:self.clientBusAttachment]; const char* interfaces[] = { [CONTROLPANEL_INTERFACE_NAME UTF8String], [HTTPCONTROL_INTERFACE_NAME UTF8String] }; status = [self.announcementReceiver registerAnnouncementReceiverForInterfaces:&interfaces[0] withNumberOfInterfaces:1]; if (status != ER_OK) { [AppDelegate alertAndLog:@"Failed to registerAnnouncementReceiver" status:status]; [self stopAboutClient]; return; } status = [self.announcementReceiver registerAnnouncementReceiverForInterfaces:&interfaces[1] withNumberOfInterfaces:1]; if (status != ER_OK) { [AppDelegate alertAndLog:@"Failed to registerAnnouncementReceiver" status:status]; [self stopAboutClient]; return; } } - (void) unregisterAnnouncementReceiver { QStatus status; const char* interfaces[] = { [CONTROLPANEL_INTERFACE_NAME UTF8String], [HTTPCONTROL_INTERFACE_NAME UTF8String] }; status = [self.announcementReceiver unRegisterAnnouncementReceiverForInterfaces:&interfaces[0] withNumberOfInterfaces:1]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully unregistered AnnouncementReceiver", @"DEBUG", [[self class] description]); } status = [self.announcementReceiver unRegisterAnnouncementReceiverForInterfaces:&interfaces[1] withNumberOfInterfaces:1]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully unregistered AnnouncementReceiver", @"DEBUG", [[self class] description]); } self.announcementReceiver = nil; } #pragma mark stop AboutClient - (void)stopAboutClient { QStatus status; NSLog(@"[%@] [%@] Stop About Client", @"DEBUG", [[self class] description]); // Bus attachment cleanup status = [self.clientBusAttachment cancelAdvertisedName:[NSString stringWithFormat:@"%@%@", DAEMON_QUIET_PREFIX, self.realmBusName] withTransportMask:kAJNTransportMaskAny]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully cancel advertised name", @"DEBUG", [[self class] description]); } status = [self.clientBusAttachment releaseWellKnownName:self.realmBusName]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully release WellKnownName", @"DEBUG", [[self class] description]); } status = [self.clientBusAttachment removeMatchRule:@"sessionless='t',type='error'"]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully remove MatchRule", @"DEBUG", [[self class] description]); } // Cancel advertise name for each announcement bus for (NSString *key in[self.clientInformationDict allKeys]) { ClientInformation *clientInfo = (self.clientInformationDict)[key]; status = [self.clientBusAttachment cancelFindAdvertisedName:[[clientInfo announcement] busName]]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelAdvertisedName for %@. status:%@", @"ERROR", [[self class] description],key, [AJNStatus descriptionForStatusCode:status]); } } self.clientInformationDict = nil; [self unregisterAnnouncementReceiver]; // Stop bus attachment status = [self.clientBusAttachment stop]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully stopped bus", @"DEBUG", [[self class] description]); } self.clientBusAttachment = nil; // Set flag self.isAboutClientConnected = false; // UI cleanup [self.connectButton setTitle:self.ajconnect forState:UIControlStateNormal]; [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; NSLog(@"[%@] [%@] About Client is stopped", @"DEBUG", [[self class] description]); } #pragma mark UITableView delegates - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.clientInformationDict count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"AnnouncementCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel.text = [self.clientInformationDict allKeys][indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self announcementGetMoreInfo:indexPath.row]; } - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { [self announcementGetMoreInfo:indexPath.row]; } @end base-16.04/controlpanel/ios/src/000077500000000000000000000000001272147170000165205ustar00rootroot00000000000000base-16.04/controlpanel/ios/src/AJCPSAction.mm000066400000000000000000000025771272147170000210640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSAction.h" #import "alljoyn/controlpanel/Action.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSAction () @end @implementation AJCPSAction - (id)initWithHandle:(ajn::services::Action *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } - (QStatus)executeAction { return ((ajn::services::Action *)self.handle)->executeAction(); } @endbase-16.04/controlpanel/ios/src/AJCPSActionDialogCell.mm000066400000000000000000000115651272147170000230010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSActionDialogCell.h" static const float NUM_ACTIONS = 3; @implementation AJCPSActionDialogCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.cpsButton = [UIButton buttonWithType:UIButtonTypeSystem]; [self.cpsButton setFrame:CGRectMake(10,0,300,60)]; [self.cpsButton.titleLabel setFont:[UIFont systemFontOfSize:13]]; [self.cpsButton addTarget:self action:@selector(touchUpInsideAction:) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:self.cpsButton]; [self reloadInputViews]; if ([UIAlertController class]) { self.alertActionDict = nil; } else { self.alertActionDict = [NSMutableDictionary dictionaryWithCapacity:NUM_ACTIONS]; } } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } - (void)touchUpInsideAction:(id)sender { AJCPSDialog* childDialog = [self.actionDialogWidget getChildDialog]; NSString *message = [childDialog getMessage]; uint16_t numActions = [childDialog getNumActions]; if ([UIAlertController class]) { UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert]; for(uint16_t i = 1; i <= numActions; ++i){ SEL getLabel = NSSelectorFromString([NSString stringWithFormat:@"getLabelAction%d", i]); NSString *label = [childDialog performSelector:getLabel]; UIAlertAction* action = [UIAlertAction actionWithTitle:label style: UIAlertActionStyleDefault handler:^(UIAlertAction *action){ SEL executeAction = NSSelectorFromString([NSString stringWithFormat:@"executeAction%d", i]); [childDialog performSelector:executeAction]; }]; [alertController addAction:action]; } [self.viewController presentViewController:alertController animated:YES completion:nil]; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"" message:message delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; for(uint16_t i = 1; i <= numActions; ++i) { SEL getLabel = NSSelectorFromString([NSString stringWithFormat:@"getLabelAction%d", i]); NSString *label = [childDialog performSelector:getLabel]; [alertView addButtonWithTitle:label]; NSString *action = [NSString stringWithFormat:@"executeAction%d", i]; [self.alertActionDict setValue:action forKey:label]; } [alertView show]; } } -(void)setActionDialogWidget:(AJCPSActionWithDialog *)actionDialogWidget { _actionDialogWidget = actionDialogWidget; [self.cpsButton setTitle:[self.actionDialogWidget getLabel] forState:UIControlStateNormal]; [self.cpsButton setEnabled:[self.actionDialogWidget getIsEnabled]?YES:NO]; } -(void)setViewController:(AJCPSGetControlPanelViewController *)viewController { _viewController = viewController; } - (void)alertView:(UIAlertView *)theAlert clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *buttonTitle = [theAlert buttonTitleAtIndex:buttonIndex]; NSLog(@"Button '%@' clicked", buttonTitle); NSString *action = self.alertActionDict[buttonTitle]; NSLog(@"Action retrieved from dict is '%@'", action); if(action) { SEL executeAction = NSSelectorFromString(action); AJCPSDialog* childDialog = [self.actionDialogWidget getChildDialog]; [childDialog performSelector:executeAction]; } } @end base-16.04/controlpanel/ios/src/AJCPSActionWithDialog.mm000066400000000000000000000032231272147170000230250ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSActionWithDialog.h" #import "alljoyn/controlpanel/ActionWithDialog.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSActionWithDialog () @end @implementation AJCPSActionWithDialog - (id)initWithHandle:(ajn::services::ActionWithDialog *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } - (AJCPSDialog *)getChildDialog { return [[AJCPSDialog alloc]initWithHandle:((ajn::services::ActionWithDialog *)self.handle)->getChildDialog()]; } - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { return ((ajn::services::ActionWithDialog *)self.handle)->unregisterObjects((ajn::BusAttachment *)[bus handle]); } @end base-16.04/controlpanel/ios/src/AJCPSButtonCell.mm000066400000000000000000000046761272147170000217240ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSButtonCell.h" #import "AJCPSAction.h" @implementation AJCPSButtonCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.cpsButton = [UIButton buttonWithType:UIButtonTypeSystem]; [self.cpsButton setFrame:CGRectMake(10,0,300,60)]; [self.cpsButton.titleLabel setFont:[UIFont systemFontOfSize:13]]; [self.cpsButton addTarget:self action:@selector(touchUpInsideAction:) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:self.cpsButton]; [self reloadInputViews]; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } - (void)touchUpInsideAction:(id)sender { NSLog(@"Pressed %@",[self.cpsButton titleLabel].text); QStatus status = [((AJCPSAction *)self.actionWidget) executeAction]; if (status != ER_OK) { NSLog(@"execute Action returned error %d, %@",status, [AJNStatus descriptionForStatusCode:status]); } } -(void)setActionWidget:(AJCPSAction *)actionWidget { _actionWidget = actionWidget; [self.cpsButton setTitle:[self.actionWidget getLabel] forState:UIControlStateNormal]; [self.cpsButton setEnabled:[self.actionWidget getIsEnabled]?YES:NO]; // We do not use [self.actionWidget getBgColor] so the iOS look and feel remain the same } @end base-16.04/controlpanel/ios/src/AJCPSConstraintList.mm000066400000000000000000000115411272147170000226160ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSConstraintList.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSConstraintList () @property (nonatomic) ajn::services::ConstraintList *handle; @end @implementation AJCPSConstraintList - (id)initWithHandle:(ajn::services::ConstraintList *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } /** * Get the Constraint Value * @return the Constraint Value */ - (AJCPSConstraintValue)getConstraintValue { return [self convertToAJCPSConstraintValue:self.handle->getConstraintValue()]; } /** * Get the Property Type of the Constraint * @return propertyType of the Constraint */ - (AJCPSPropertyType)getPropertyType { return self.handle->getPropertyType(); } /** * Get the Display * @return Display Value */ - (NSString *)getDisplay { const qcc::String str = self.handle->getDisplay(); return [AJNConvertUtil convertQCCStringtoNSString:str]; } - (NSString *)propertyToNSString:(AJCPSPropertyType)property withValue:(AJCPSConstraintValue) propertyValue { NSMutableString *propertyStr = [[NSMutableString alloc] init]; switch (property) { case AJCPS_UINT16_PROPERTY : [propertyStr appendFormat:@"(%d)",propertyValue.uint16Value]; break; case AJCPS_INT16_PROPERTY : [propertyStr appendFormat:@"(%d)",propertyValue.int16Value]; break; case AJCPS_UINT32_PROPERTY : [propertyStr appendFormat:@"(%d)",propertyValue.uint32Value]; break; case AJCPS_INT32_PROPERTY : [propertyStr appendFormat:@"(%d)",propertyValue.int32Value]; break; case AJCPS_UINT64_PROPERTY : [propertyStr appendFormat:@"(%llu)",propertyValue.uint64Value]; break; case AJCPS_INT64_PROPERTY : [propertyStr appendFormat:@"(%lld)",propertyValue.int64Value]; break; case AJCPS_DOUBLE_PROPERTY : [propertyStr appendFormat:@"(%f)",propertyValue.doubleValue]; break; case AJCPS_STRING_PROPERTY : [propertyStr appendFormat:@"('%s')",propertyValue.charValue]; break; default: NSLog(@"unknown property"); break; } return [NSString stringWithString:propertyStr]; } - (AJCPSConstraintValue)convertToAJCPSConstraintValue:(ajn::services::ConstraintValue) constraintValue { AJCPSConstraintValue tConstraintValue; switch ([self getPropertyType]) { case AJCPS_UINT16_PROPERTY : tConstraintValue.uint16Value = constraintValue.uint16Value; break; case AJCPS_INT16_PROPERTY : tConstraintValue.int16Value = constraintValue.int16Value; break; case AJCPS_UINT32_PROPERTY : tConstraintValue.uint32Value = constraintValue.uint32Value; break; case AJCPS_INT32_PROPERTY : tConstraintValue.int32Value = constraintValue.int32Value; break; case AJCPS_UINT64_PROPERTY : tConstraintValue.uint64Value = constraintValue.uint64Value; break; case AJCPS_INT64_PROPERTY : tConstraintValue.int64Value = constraintValue.int64Value; break; case AJCPS_DOUBLE_PROPERTY : tConstraintValue.doubleValue = constraintValue.doubleValue; break; case AJCPS_STRING_PROPERTY : tConstraintValue.charValue = constraintValue.charValue; break; case AJCPS_DATE_PROPERTY : //TODO break; case AJCPS_TIME_PROPERTY : //TODO break; default: break; } return tConstraintValue; } @endbase-16.04/controlpanel/ios/src/AJCPSConstraintRange.mm000066400000000000000000000030021272147170000227300ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSConstraintRange.h" @interface AJCPSConstraintRange () @property (nonatomic) ajn::services::ConstraintRange *handle; @end @implementation AJCPSConstraintRange - (id)initWithHandle:(ajn::services::ConstraintRange *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (uint16_t)getIncrementValue { return self.handle->getIncrementValue().int16Value; } - (uint16_t)getMaxValue { return self.handle->getMaxValue().int16Value; } - (uint16_t)getMinValue { return self.handle->getMinValue().int16Value; } @endbase-16.04/controlpanel/ios/src/AJCPSContainer.mm000066400000000000000000000102151272147170000215550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSContainer.h" #import "alljoyn/controlpanel/Container.h" #import "alljoyn/controlpanel/Widget.h" #import "AJCPSControlPanelDevice.h" #import "AJCPSAction.h" #import "AJCPSActionWithDialog.h" #import "AJCPSLabel.h" #import "AJCPSProperty.h" #import "AJCPSDialog.h" #import "AJCPSErrorWidget.h" @interface AJCPSContainer () // uses Widget's handle @end @implementation AJCPSContainer - (id)initWithHandle:(ajn::services::Container *)handle { self = [super initWithHandle:handle]; if (self) { //self.handle = handle; } return self; } /** * Register the BusObjects for this Widget * @param bus - the bus to be used * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus { return ((ajn::services::Container *)self.handle)->registerObjects((ajn::BusAttachment *)[bus handle]); } /** * Unregister the BusObjects for this widget * @param bus * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { return ((ajn::services::Container *)self.handle)->unregisterObjects((ajn::BusAttachment *)[bus handle]); } /** * Get the ChildWidget Vector * @return children widgets */ //const std : : vector & getChildWidgets() const; - (NSArray *)getChildWidgets { const std::vector cpp_childWidgets = ((ajn::services::Container *)self.handle)->getChildWidgets(); NSMutableArray *childWidgets = [[NSMutableArray alloc]init]; for (int i = 0; i != cpp_childWidgets.size(); i++) { switch (cpp_childWidgets.at(i)->getWidgetType()) { case AJCPS_CONTAINER: [childWidgets addObject:[[AJCPSContainer alloc]initWithHandle:(ajn::services::Container *)cpp_childWidgets.at(i)]]; break; case AJCPS_ACTION: [childWidgets addObject:[[AJCPSAction alloc]initWithHandle:(ajn::services::Action *)cpp_childWidgets.at(i)]]; break; case AJCPS_ACTION_WITH_DIALOG: [childWidgets addObject:[[AJCPSActionWithDialog alloc]initWithHandle:(ajn::services::ActionWithDialog *)cpp_childWidgets.at(i)]]; break; case AJCPS_LABEL: [childWidgets addObject:[[AJCPSLabel alloc]initWithHandle:(ajn::services::Label *)cpp_childWidgets.at(i)]]; break; case AJCPS_PROPERTY: [childWidgets addObject:[[AJCPSProperty alloc]initWithHandle:(ajn::services::Property *)cpp_childWidgets.at(i)]]; break; case AJCPS_DIALOG: [childWidgets addObject:[[AJCPSDialog alloc]initWithHandle:(ajn::services::Dialog *)cpp_childWidgets.at(i)]]; break; case AJCPS_ERROR: [childWidgets addObject:[[AJCPSErrorWidget alloc]initWithHandle:(ajn::services::ErrorWidget *)cpp_childWidgets.at(i)]]; break; default: NSLog(@"Error. Request to create a widget of unknown type %d",cpp_childWidgets.at(i)->getWidgetType()); break; } } return childWidgets; } - (bool)getIsDismissable { return ((ajn::services::Container *)self.handle)->getIsDismissable(); } @endbase-16.04/controlpanel/ios/src/AJCPSControlPanel.mm000066400000000000000000000045651272147170000222460ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanel.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSControlPanel () @property (nonatomic) ajn::services::ControlPanel *handle; @end @implementation AJCPSControlPanel - (id)initWithHandle:(ajn ::services ::ControlPanel *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } // original cpp constructor: ControlPanel(LanguageSet const& languageSet, qcc::String objectPath, ControlPanelDevice* device); - (NSString *)getPanelName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getPanelName()]; } - (QStatus)registerObjects:(AJNBusAttachment *)bus { return self.handle->registerObjects((ajn::BusAttachment *)[bus handle]); } - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { return self.handle->unregisterObjects((ajn::BusAttachment *)[bus handle]); } - (AJCPSLanguageSet *)getLanguageSet { return [[AJCPSLanguageSet alloc]initWithHandle:(ajn::services::LanguageSet *)&self.handle->getLanguageSet()]; } - (AJCPSControlPanelDevice *)getDevice { return [[AJCPSControlPanelDevice alloc]initWithHandle:self.handle->getDevice()]; } - (NSString *)getObjectPath { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getObjectPath()]; } - (AJCPSContainer *)getRootWidget:(NSString *)Language { return [[AJCPSContainer alloc]initWithHandle:self.handle->getRootWidget([AJNConvertUtil convertNSStringToQCCString:Language])]; } @end base-16.04/controlpanel/ios/src/AJCPSControlPanelController.mm000066400000000000000000000067171272147170000243130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelController.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSControlPanelController () @property (nonatomic) ajn::services::ControlPanelController *handle; @end @implementation AJCPSControlPanelController - (id)init { self = [super init]; if (self) { self.handle = new ajn::services::ControlPanelController(); } return self; } - (id)initWithHandle:(ajn::services::ControlPanelController *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (AJCPSControlPanelDevice *)createControllableDevice:(NSString *)deviceBusName ObjectDescs:(NSDictionary *)objectDescs { ajn::services::AnnounceHandler::ObjectDescriptions *cpp_ObjectDescs = new ajn::services::AnnounceHandler::ObjectDescriptions; for (NSString *key in objectDescs) { NSArray *strings = [objectDescs objectForKey:key]; std::vector cpp_strings; for (NSString *string in strings) { cpp_strings.push_back([AJNConvertUtil convertNSStringToQCCString:string]); } cpp_ObjectDescs->insert(std::make_pair([AJNConvertUtil convertNSStringToQCCString:key], cpp_strings)); } return [[AJCPSControlPanelDevice alloc]initWithHandle:self.handle->createControllableDevice([AJNConvertUtil convertNSStringToQCCString:deviceBusName], *cpp_ObjectDescs)]; } - (AJCPSControlPanelDevice *)getControllableDevice:(NSString *)deviceBusName { return [[AJCPSControlPanelDevice alloc]initWithHandle:self.handle->getControllableDevice([AJNConvertUtil convertNSStringToQCCString:deviceBusName])]; } - (QStatus)deleteControllableDevice:(NSString *)deviceBusName { return self.handle->deleteControllableDevice([AJNConvertUtil convertNSStringToQCCString:deviceBusName]); } - (QStatus)deleteAllControllableDevices { return self.handle->deleteAllControllableDevices(); } - (NSDictionary *)getControllableDevices { std::map cpp_ControllableDevices = self.handle->getControllableDevices(); NSMutableDictionary *controllableDevices = [[NSMutableDictionary alloc]init]; for (std::map ::const_iterator itr = cpp_ControllableDevices.begin(); itr != cpp_ControllableDevices.end(); itr++) { NSString *key = [AJNConvertUtil convertQCCStringtoNSString:itr->first]; AJCPSControlPanelDevice *value = [[AJCPSControlPanelDevice alloc] initWithHandle:itr->second]; [controllableDevices setObject:value forKey:key]; } return controllableDevices; } @endbase-16.04/controlpanel/ios/src/AJCPSControlPanelControllerUnit.mm000066400000000000000000000115261272147170000251450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelControllerUnit.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" #import "AJCPSNotificationAction.h" #import "AJCPSHttpControl.h" #import "AJCPSControlPanel.h" @interface AJCPSControlPanelControllerUnit () @property (nonatomic) ajn::services::ControlPanelControllerUnit *handle; @end @implementation AJCPSControlPanelControllerUnit - (id)initWithHandle:(ajn::services::ControlPanelControllerUnit *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (id)initControlPanelControllerUnit:(NSString *)unitName device:(AJCPSControlPanelDevice *)device { self = [super init]; if (self) { self.handle = new ajn::services::ControlPanelControllerUnit([AJNConvertUtil convertNSStringToQCCString:unitName], [device handle]); } return self; } - (QStatus)addHttpControl:(NSString *)objectPath { return self.handle->addHttpControl([AJNConvertUtil convertNSStringToQCCString:objectPath]); } - (QStatus)addControlPanel:(NSString *)objectPath panelName:(NSString *)panelName { return self.handle->addControlPanel([AJNConvertUtil convertNSStringToQCCString:objectPath], [AJNConvertUtil convertNSStringToQCCString:panelName]); } - (QStatus)addNotificationAction:(NSString *)objectPath actionName:(NSString *)actionName { return self.handle->addNotificationAction([AJNConvertUtil convertNSStringToQCCString:objectPath], [AJNConvertUtil convertNSStringToQCCString:actionName]); } - (QStatus)removeNotificationAction:(NSString *)actionName { return self.handle->removeNotificationAction([AJNConvertUtil convertNSStringToQCCString:actionName]); } - (QStatus)registerObjects { return self.handle->registerObjects(); } - (QStatus)shutdownUnit { return self.handle->shutdownUnit(); } - (AJCPSControlPanelDevice *)getDevice { return [[AJCPSControlPanelDevice alloc] initWithHandle:self.handle->getDevice()]; } - (NSString *)getUnitName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getUnitName()]; } - (NSDictionary *)getControlPanels { const std::map cpp_ControlPanels = self.handle->getControlPanels(); NSMutableDictionary *controlPanels = [[NSMutableDictionary alloc]init]; for (std::map ::const_iterator itr = cpp_ControlPanels.begin(); itr != cpp_ControlPanels.end(); itr++) { NSString *key = [AJNConvertUtil convertQCCStringtoNSString:itr->first]; AJCPSControlPanel *value = [[AJCPSControlPanel alloc] initWithHandle:itr->second]; [controlPanels setObject:value forKey:key]; } return controlPanels; } - (NSDictionary *)getNotificationActions { const std::map cpp_NotificationActions = self.handle->getNotificationActions(); NSMutableDictionary *notificationActions = [[NSMutableDictionary alloc]init]; for (std::map ::const_iterator itr = cpp_NotificationActions.begin(); itr != cpp_NotificationActions.end(); itr++) { NSString *key = [AJNConvertUtil convertQCCStringtoNSString:itr->first]; AJCPSNotificationAction *value = [[AJCPSNotificationAction alloc] initWithHandle:itr->second]; [notificationActions setObject:value forKey:key]; } return notificationActions; } - (AJCPSControlPanel *)getControlPanel:(NSString *)panelName { return [[AJCPSControlPanel alloc]initWithHandle:self.handle->getControlPanel([AJNConvertUtil convertNSStringToQCCString:panelName])]; } - (AJCPSNotificationAction *)getNotificationAction:(NSString *)actionName { return [[AJCPSNotificationAction alloc]initWithHandle:self.handle->getNotificationAction([AJNConvertUtil convertNSStringToQCCString:actionName])]; } - (AJCPSHttpControl *)getHttpControl { if (!self.handle->getHttpControl()) { return nil; } return [[AJCPSHttpControl alloc] initWithHandle:self.handle->getHttpControl()]; } @endbase-16.04/controlpanel/ios/src/AJCPSControlPanelDevice.mm000066400000000000000000000114551272147170000233620ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelDevice.h" #import "alljoyn/about/AJNConvertUtil.h" #import "alljoyn/controlpanel/ControlPanelControllerUnit.h" #import "AJCPSControlPanelListenerAdapter.h" #import "AJCPSControlPanel.h" @interface AJCPSControlPanelDevice () @property (nonatomic) ajn::services::ControlPanelDevice *handle; @end @implementation AJCPSControlPanelDevice - (id)initWithHandle:(ajn::services::ControlPanelDevice *)handle; { self = [super init]; if (self) { self.handle = handle; } return self; } - (void)dealloc { //we are not the creators of this handle } - (QStatus)startSessionAsync { return self.handle->startSessionAsync(); } - (QStatus)startSession { return self.handle->startSession(); } - (QStatus)endSession { return self.handle->endSession(); } - (QStatus)shutdownDevice { return self.handle->shutdownDevice(); } - (NSString *)getDeviceBusName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getDeviceBusName()]; } - (AJNSessionId)getSessionId { return self.handle->getSessionId(); } // const std::map& getDeviceUnits const; - (NSDictionary *)getDeviceUnits { const std::map & cpp_deviceUnits = self.handle->getDeviceUnits(); NSMutableDictionary *deviceUnits = [[NSMutableDictionary alloc]init]; for (std::map ::const_iterator itr = cpp_deviceUnits.begin(); itr != cpp_deviceUnits.end(); itr++) { NSString *key = [AJNConvertUtil convertQCCStringtoNSString:itr->first]; AJCPSControlPanelControllerUnit *value = [[AJCPSControlPanelControllerUnit alloc] initWithHandle:itr->second]; [deviceUnits setObject:value forKey:key]; } return deviceUnits; } - (NSArray *)getAllControlPanels { std::vector controlPanelsVec; self.handle->getAllControlPanels(controlPanelsVec); NSMutableArray *controlPanels = [[NSMutableArray alloc]init]; for (int i = 0; i != controlPanelsVec.size(); i++) { AJCPSControlPanel *controlPanel = [[AJCPSControlPanel alloc]initWithHandle:controlPanelsVec.at(i)]; [controlPanels addObject:controlPanel]; } return controlPanels; } - (AJCPSControlPanelControllerUnit *)getControlPanelUnit:(NSString *)objectPath { return [[AJCPSControlPanelControllerUnit alloc]initWithHandle:self.handle->getControlPanelUnit([AJNConvertUtil convertNSStringToQCCString:objectPath])]; } - (AJCPSControlPanelControllerUnit *)addControlPanelUnit:(NSString *)objectPath interfaces:(NSArray *)interfaces { std::vector cpp_interfaces; for (NSString *str in interfaces) { cpp_interfaces.push_back([AJNConvertUtil convertNSStringToQCCString:str]); } return [[AJCPSControlPanelControllerUnit alloc]initWithHandle:self.handle->addControlPanelUnit([AJNConvertUtil convertNSStringToQCCString:objectPath], cpp_interfaces)]; } - (AJCPSNotificationAction *)addNotificationAction:(NSString *)objectPath { return [[AJCPSNotificationAction alloc]initWithHandle:self.handle->addNotificationAction([AJNConvertUtil convertNSStringToQCCString:objectPath])]; } - (QStatus)removeNotificationAction:(AJCPSNotificationAction *)notificationAction { return self.handle->removeNotificationAction([notificationAction handle]); } - (id )getListener { AJCPSControlPanelListenerAdapter *adapter = (AJCPSControlPanelListenerAdapter *)self.handle->getListener(); return adapter->getListener(); } - (QStatus)setListener:(id )listener { AJCPSControlPanelListenerAdapter *adapter = (AJCPSControlPanelListenerAdapter *)self.handle->getListener(); if (adapter) { delete adapter; adapter = NULL; // for completeness sake } adapter = new AJCPSControlPanelListenerAdapter(listener); return self.handle->setListener(adapter); } @endbase-16.04/controlpanel/ios/src/AJCPSControlPanelEnums.mm000066400000000000000000000021161272147170000232440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelEnums.h" @interface AJCPSControlPanelEnums () @end @implementation AJCPSControlPanelEnums @end base-16.04/controlpanel/ios/src/AJCPSControlPanelEnums.mm-base000066400000000000000000000102501272147170000241520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelEnums.h" @interface AJCPSControlPanelEnums () @end @implementation AJCPSControlPanelEnums @end //#ifndef CONTROLPANELENUMS_H_ //#define CONTROLPANELENUMS_H_ // //namespace ajn { //namespace services { // //#ifndef UINT32_MAX //#define UINT32_MAX (4294967295U) //#endif // ///** // * Typedefs for functionPointers used // */ //typedef bool (*GetBoolFptr)(); //typedef uint32_t (*GetUint32Fptr)(); //typedef const char* (*GetStringFptr)(uint16_t); // ///** // * Mode ControlPanel is in // */ //typedef enum { // CONTROLLEE_MODE, //!< CONTROLLEE_MODE // CONTROLLER_MODE //!< CONTROLLER_MODE //} ControlPanelMode; // ///** // * WidgetType // */ //typedef enum { // CONTAINER = 0, //!< CONTAINER // ACTION = 1, //!< ACTION // ACTION_WITH_DIALOG = 2, //!< ACTION_WITH_DIALOG // LABEL = 3, //!< LABEL // PROPERTY = 4, //!< PROPERTY // DIALOG = 5 //!< DIALOG //} WidgetType; // ///** // * Enum to define the type of Property // */ //typedef enum { // BOOL_PROPERTY = 0, //!< BOOL_PROPERTY // UINT16_PROPERTY = 1, //!< UINT16_PROPERTY // INT16_PROPERTY = 2, //!< INT16_PROPERTY // UINT32_PROPERTY = 3, //!< UINT32_PROPERTY // INT32_PROPERTY = 4, //!< INT32_PROPERTY // UINT64_PROPERTY = 5, //!< UINT64_PROPERTY // INT64_PROPERTY = 6, //!< INT64_PROPERTY // DOUBLE_PROPERTY = 7, //!< DOUBLE_PROPERTY // STRING_PROPERTY = 8, //!< STRING_PROPERTY // DATE_PROPERTY = 9, //!< DATE_PROPERTY // TIME_PROPERTY = 10, //!< TIME_PROPERTY // UNDEFINED = 11 //!< UNDEFINED //} PropertyType; // ///** // * Transactions that could go wrong resulting in an Error Occurred event being fired // */ //typedef enum { // SESSION_JOIN = 0, //!< SESSION_JOIN // REGISTER_OBJECTS = 1, //!< REGISTER_OBJECTS // REFRESH_VALUE = 2, //!< REFRESH_VALUE // REFRESH_PROPERTIES = 3 //!< REFRESH_PROPERTIES //} ControlPanelTransaction; // ///** // * Hints for Containers Widgets // * determining the layout // */ //enum LAYOUT_HINTS { // VERTICAL_LINEAR = 1, //!< VERTICAL_LINEAR // HORIZONTAL_LINEAR = 2 //!< HORIZONTAL_LINEAR //}; // ///** // * Hints for Dialog Widgets // */ //enum DIALOG_HINTS { // ALERTDIALOG = 1 //!< ALERTDIALOG //}; // ///** // * Hints for Property Widgets // */ //enum PROPERTY_HINTS { // SWITCH = 1, //!< SWITCH // CHECKBOX = 2, //!< CHECKBOX // SPINNER = 3, //!< SPINNER // RADIOBUTTON = 4, //!< RADIOBUTTON // SLIDER = 5, //!< SLIDER // TIMEPICKER = 6, //!< TIMEPICKER // DATEPICKER = 7, //!< DATEPICKER // NUMBERPICKER = 8, //!< NUMBERPICKER // KEYPAD = 9, //!< KEYPAD // ROTARYKNOB = 10, //!< ROTARYKNOB // TEXTVIEW = 11, //!< TEXTVIEW // NUMERICVIEW = 12, //!< NUMERICVIEW // EDITTEXT = 13 //!< EDITTEXT //}; // ///** // * Hints for Label Widgets // */ //enum LABEL_HINTS { // TEXTLABEL = 1 //!< TEXTLABEL //}; // ///** // * Hints for ListProperty Widgets // */ //enum LIST_PROPERTY_HINTS { // DYNAMICSPINNER = 1 //!< DYNAMICSPINNER //}; // ///** // * Hints for Action Widgets // */ //enum ACTION_HINTS { // ACTIONBUTTON = 1 //!< ACTIONBUTTON //}; // //} //namespace services //} //namespace ajn // //#endif /* CONTROLPANELENUMS_H_ */ base-16.04/controlpanel/ios/src/AJCPSControlPanelEnums.mm-ours000066400000000000000000000021161272147170000242320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelEnums.h" @interface AJCPSControlPanelEnums () @end @implementation AJCPSControlPanelEnums @end base-16.04/controlpanel/ios/src/AJCPSControlPanelEnums.mm-theirs000066400000000000000000000100461272147170000245410ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelEnums.h" @interface AJCPSControlPanelEnums () @end @implementation AJCPSControlPanelEnums @end //#ifndef CONTROLPANELENUMS_H_ //#define CONTROLPANELENUMS_H_ // //namespace ajn { //namespace services { // //#ifndef UINT32_MAX //#define UINT32_MAX (4294967295U) //#endif // ///** // * Typedefs for functionPointers used // */ //typedef bool (*GetBoolFptr)(); //typedef uint32_t (*GetUint32Fptr)(); //typedef const char* (*GetStringFptr)(uint16_t); // ///** // * Mode ControlPanel is in // */ //typedef enum { // CONTROLLEE_MODE, //!< CONTROLLEE_MODE // CONTROLLER_MODE //!< CONTROLLER_MODE //} ControlPanelMode; // ///** // * WidgetType // */ //typedef enum { // CONTAINER = 0, //!< CONTAINER // ACTION = 1, //!< ACTION // ACTION_WITH_DIALOG = 2, //!< ACTION_WITH_DIALOG // LABEL = 3, //!< LABEL // PROPERTY = 4, //!< PROPERTY // DIALOG = 5 //!< DIALOG //} WidgetType; // ///** // * Enum to define the type of Property // */ //typedef enum { // BOOL_PROPERTY = 0, //!< BOOL_PROPERTY // UINT16_PROPERTY = 1, //!< UINT16_PROPERTY // INT16_PROPERTY = 2, //!< INT16_PROPERTY // UINT32_PROPERTY = 3, //!< UINT32_PROPERTY // INT32_PROPERTY = 4, //!< INT32_PROPERTY // UINT64_PROPERTY = 5, //!< UINT64_PROPERTY // INT64_PROPERTY = 6, //!< INT64_PROPERTY // DOUBLE_PROPERTY = 7, //!< DOUBLE_PROPERTY // STRING_PROPERTY = 8, //!< STRING_PROPERTY // DATE_PROPERTY = 9, //!< DATE_PROPERTY // TIME_PROPERTY = 10, //!< TIME_PROPERTY // UNDEFINED = 11 //!< UNDEFINED //} PropertyType; // ///** // * Transactions that could go wrong resulting in an Error Occurred event being fired // */ //typedef enum { // SESSION_JOIN = 0, //!< SESSION_JOIN // REGISTER_OBJECTS = 1, //!< REGISTER_OBJECTS // REFRESH_VALUE = 2, //!< REFRESH_VALUE // REFRESH_PROPERTIES = 3 //!< REFRESH_PROPERTIES //} ControlPanelTransaction; // ///** // * Hints for Containers Widgets // * determining the layout // */ //enum LAYOUT_HINTS { // VERTICAL_LINEAR = 1, //!< VERTICAL_LINEAR // HORIZONTAL_LINEAR = 2 //!< HORIZONTAL_LINEAR //}; // ///** // * Hints for Dialog Widgets // */ //enum DIALOG_HINTS { // ALERTDIALOG = 1 //!< ALERTDIALOG //}; // ///** // * Hints for Property Widgets // */ //enum PROPERTY_HINTS { // SWITCH = 1, //!< SWITCH // CHECKBOX = 2, //!< CHECKBOX // SPINNER = 3, //!< SPINNER // RADIOBUTTON = 4, //!< RADIOBUTTON // SLIDER = 5, //!< SLIDER // TIMEPICKER = 6, //!< TIMEPICKER // DATEPICKER = 7, //!< DATEPICKER // NUMBERPICKER = 8, //!< NUMBERPICKER // KEYPAD = 9, //!< KEYPAD // ROTARYKNOB = 10, //!< ROTARYKNOB // TEXTVIEW = 11, //!< TEXTVIEW // NUMERICVIEW = 12, //!< NUMERICVIEW // EDITTEXT = 13 //!< EDITTEXT //}; // ///** // * Hints for Label Widgets // */ //enum LABEL_HINTS { // TEXTLABEL = 1 //!< TEXTLABEL //}; // ///** // * Hints for Action Widgets // */ //enum ACTION_HINTS { // ACTIONBUTTON = 1 //!< ACTIONBUTTON //}; // //} //namespace services //} //namespace ajn // //#endif /* CONTROLPANELENUMS_H_ */ base-16.04/controlpanel/ios/src/AJCPSControlPanelService.mm000066400000000000000000000067301272147170000235630ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControlPanelService.h" #import "AJSVCGenericLoggerAdapter.h" #import "AJCPSControlPanelListenerAdapter.h" @interface AJCPSControlPanelService () @property (nonatomic) ajn::services::ControlPanelService *handle; @property (nonatomic) AJCPSControlPanelListenerAdapter *listenerAdapter; @property id currentLogger; @property AJSVCGenericLoggerAdapter *genericLoggerAdapter; @end @implementation AJCPSControlPanelService + (AJCPSControlPanelService *)getInstance { static AJCPSControlPanelService *aboutLogger; static dispatch_once_t donce; dispatch_once(&donce, ^{ aboutLogger = [[self alloc] init]; }); return aboutLogger; } - (id)init { self = [super init]; self.handle = ajn::services::ControlPanelService::getInstance(); return self; } - (QStatus)initController:(AJNBusAttachment *)bus controlPanelController:(AJCPSControlPanelController *)controlPanelController controlPanelListener:(id )controlPanelListener { self.listenerAdapter = new AJCPSControlPanelListenerAdapter(controlPanelListener); return self.handle->initController((ajn::BusAttachment *)[bus handle], [controlPanelController handle], self.listenerAdapter); } /** * Remove locally stored controller. Allows a new call to initController to be made * @return status */ - (QStatus)shutdownController { return self.handle->shutdown(); } - (AJNBusAttachment *)getBusAttachment { return [[AJNBusAttachment alloc]initWithHandle:self.handle->getBusAttachment()]; } /** * Get the ControlPanelListener * @return ControlPanelListener */ - (id )getControlPanelListener { AJCPSControlPanelListenerAdapter *adapter = (AJCPSControlPanelListenerAdapter *)self.handle->getControlPanelListener(); return adapter->getListener(); } /** * Get the Version of the ControlPanelService * @return the ControlPanelService version */ - (uint16_t)getVersion { return self.handle->getVersion(); } #pragma mark - Logger methods - (void)setLogger:(id )logger { if (logger) { // save current logger self.currentLogger = logger; // call setLoger with the adapter and save the prev Logger } else { [self.currentLogger warnTag:([NSString stringWithFormat:@"%@", [[self class] description]]) text:@"Failed set a logger"]; } } - (id )logger { return self.currentLogger; } - (void)setLogLevel:(QLogLevel)newLogLevel { [self.currentLogger setLogLevel:newLogLevel]; } - (QLogLevel)logLevel { return [self.currentLogger logLevel]; } @endbase-16.04/controlpanel/ios/src/AJCPSControllerModel.mm000066400000000000000000000450171272147170000227470ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSControllerModel.h" #import "AJCPSAction.h" #import "AJCPSDialog.h" #import "AJCPSProperty.h" #import "AJCPSDate.h" #import "AJCPSTime.h" #import "AJCPSControlPanelDevice.h" #import "AJCPSActionWithDialog.h" #import "AJCPSConstraintList.h" #import "alljoyn/about/PropertyStore.h" //for ER codes @interface AJCPSControllerModel () @property (strong, nonatomic) NSMutableArray *containerStack; // array of AJCPSContainer * @property (strong, nonatomic) NSArray *supportedLanguages; //array of NSStrings of languages @end @implementation AJCPSControllerModel - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog(@"alert button has been clicked"); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); } - (id)init { if (self = [super init]) { self.containerStack = [[NSMutableArray alloc]init]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hasPasscodeInput:) name:@"hasPasscodeForBus" object:nil]; } return self; } - (void)hasPasscodeInput:(NSNotification *)notification { if ([notification.name isEqualToString:@"hasPasscodeForBus"]) { [[[UIAlertView alloc] initWithTitle:@"Authentication failed" message:@"If you've entered a new password - please press Back to reload data." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } } - (NSString *)widgetTypeToString:(AJCPSWidgetType)widgetType { switch (widgetType) { case AJCPS_CONTAINER: return @"AJCPS_CONTAINER"; case AJCPS_ACTION: return @"AJCPS_ACTION"; case AJCPS_ACTION_WITH_DIALOG: return @"AJCPS_ACTION_WITH_DIALOG"; case AJCPS_LABEL: return @"AJCPS_LABEL"; case AJCPS_PROPERTY: return @"AJCPS_PROPERTY"; case AJCPS_DIALOG: return @"AJCPS_DIALOG"; case AJCPS_ERROR: return @"AJCPS_ERROR"; default: return nil; } // AJCPS_CONTAINER = 0, //!< CONTAINER // AJCPS_ACTION = 1, //!< ACTION // AJCPS_ACTION_WITH_DIALOG = 2, //!< ACTION_WITH_DIALOG // AJCPS_LABEL = 3, //!< LABEL // AJCPS_PROPERTY = 4, //!< PROPERTY // AJCPS_DIALOG = 5 //!< DIALOG } - (void)loadContainer { AJCPSContainer *container = self.containerStack[[self.containerStack count] - 1]; [self printBasicWidget:container]; // Array of AJCPSWidget objects @synchronized(self){ self.widgetsContainer = [container getChildWidgets]; } NSLog(@"Print ChildWidgets: "); for (NSInteger i = 0; i < [self.widgetsContainer count]; i++) { AJCPSWidgetType widgetType = [[self.widgetsContainer objectAtIndex:i] getWidgetType]; NSLog(@"Print %@", [self widgetTypeToString:widgetType]); [self printBasicWidget:self.widgetsContainer[i]]; switch (widgetType) { case AJCPS_CONTAINER: { } break; case AJCPS_ACTION: { } break; case AJCPS_ACTION_WITH_DIALOG: { [self printDialog:[((AJCPSActionWithDialog*)self.widgetsContainer[i]) getChildDialog]]; } break; case AJCPS_LABEL: { } break; case AJCPS_PROPERTY: { [self printProperty:((AJCPSProperty *)self.widgetsContainer[i])]; } break; case AJCPS_DIALOG: { [self printDialog:((AJCPSDialog*)self.widgetsContainer[i])]; } break; default: { NSLog(@"Unsupported AJCPSWidgetType"); } break; } } [self.delegate refreshEntries]; } - (QStatus)loadRootWidget:(AJCPSRootWidget *)rootWidget //- (QStatus)printRootWidget:(AJCPSContainer*) rootWidget { if (!rootWidget) { NSLog(@"faild to load RootWidget - rootWidget is empty."); return ER_FAIL; } AJCPSWidgetType wType = [rootWidget getWidgetType]; NSLog(@"---> printRootWidget: %@", [self widgetTypeToString:wType]); switch (wType) { case AJCPS_CONTAINER: { self.containerStack[0] = [[AJCPSContainer alloc] initWithHandle:(ajn::services::Container*)rootWidget.handle]; [self loadContainer]; } break; case AJCPS_ACTION: {} break; case AJCPS_ACTION_WITH_DIALOG: {} break; case AJCPS_LABEL: {} break; case AJCPS_PROPERTY: {} break; case AJCPS_DIALOG: { [self printBasicWidget:rootWidget]; NSString* dialogLabel = [(AJCPSWidget *)rootWidget getLabel]; AJCPSDialog* dialog = [[AJCPSDialog alloc] initWithHandle:(ajn::services::Dialog *)rootWidget.handle]; uint16_t numActions = [dialog getNumActions]; NSLog(@"AJCPS_DIALOG numActions: %hu",numActions); NSMutableString* actionsString = [[NSMutableString alloc] init]; switch (numActions) { case 3: [actionsString appendString:[NSString stringWithFormat:@"%@ ",[dialog getLabelAction3]]]; case 2: [actionsString appendString:[NSString stringWithFormat:@"%@ ",[dialog getLabelAction2]]]; case 1: [actionsString appendString:[NSString stringWithFormat:@"%@ ",[dialog getLabelAction1]]]; break; default: break; } [[[UIAlertView alloc] initWithTitle:@"Received Dialog:" message:[NSString stringWithFormat:@"%@\n%@\n%@",dialogLabel,[dialog getMessage], actionsString] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } break; default: { NSLog(@"unsupported AJCPSWidgetType"); } break; } return ER_OK; } - (void)printBasicWidget:(AJCPSWidget *)widget { NSLog(@" widget name: %@", [widget getWidgetName]); NSLog(@" widget version: %hu", [widget getInterfaceVersion]); NSLog(@" widget is %@", [widget getIsSecured] ? @"secured" : @"not secured"); NSLog(@" widget is %@", [widget getIsEnabled] ? @"enabled" : @"not enabled"); NSLog(@" widget is %@", [widget getIsWritable] ? @"writable" : @"not writable"); if ([[widget getLabel] length]) NSLog(@" widget label: %@", [widget getLabel]); // if ([widget getBgColor] != UINT32_MAX) NSLog(@" widget bgColor: %u", [widget getBgColor]); } -(void)printProperty:(AJCPSProperty *)property { NSMutableString *str = [[NSMutableString alloc]init]; AJCPSPropertyValue propertyValue; [property getPropertyValue:propertyValue]; switch ([property getPropertyType]) { case AJCPS_BOOL_PROPERTY : [str appendFormat:@"bool property, value:%d",propertyValue.boolValue]; break; case AJCPS_UINT16_PROPERTY : [str appendFormat:@"uint16 property, value:%d",propertyValue.uint16Value]; break; case AJCPS_INT16_PROPERTY : [str appendFormat:@"int16 property, value:%d",propertyValue.int16Value]; break; case AJCPS_UINT32_PROPERTY : [str appendFormat:@"uint32 property, value:%d",propertyValue.uint32Value]; break; case AJCPS_INT32_PROPERTY : [str appendFormat:@"int32 property, value:%d",propertyValue.int32Value]; break; case AJCPS_UINT64_PROPERTY : [str appendFormat:@"uint64 property, value:%llu",propertyValue.uint64Value]; break; case AJCPS_INT64_PROPERTY : [str appendFormat:@"int64 property, value:%lld",propertyValue.int64Value]; break; case AJCPS_DOUBLE_PROPERTY : [str appendFormat:@"double property, value:%f",propertyValue.doubleValue]; break; case AJCPS_STRING_PROPERTY : [str appendFormat:@"string property, value:'%s'",propertyValue.charValue]; break; case AJCPS_DATE_PROPERTY : [str appendFormat:@"date property"]; //TODO support date break; case AJCPS_TIME_PROPERTY : [str appendFormat:@"time property"]; //TODO support time break; default: [str appendFormat:@"unknown property"]; break; } if(![[property getUnitOfMeasure] isEqualToString:@""]) { [str appendFormat:@",unitOfMeasure:%@", [property getUnitOfMeasure]]; } [str appendString:@"\n"]; AJCPSConstraintRange *constraintRange = [property getConstraintRange]; if (constraintRange) { [str appendFormat:@"min:%d,max:%d,inc:%d",[constraintRange getMinValue],[constraintRange getMaxValue],[constraintRange getIncrementValue]]; } NSArray *list = [property getConstraintList]; if ([list count]) { [str appendString:@"list:"]; } for (AJCPSConstraintList *constraintList in list) { [str appendFormat:@"%@",[constraintList getDisplay]]; AJCPSConstraintValue propertyValue = [constraintList getConstraintValue]; AJCPSPropertyType propertyType = [constraintList getPropertyType]; NSString *propertyValueStr = [constraintList propertyToNSString:propertyType withValue:propertyValue]; [str appendFormat:@"%@", propertyValueStr]; } NSLog(@"%@",str); } -(void) printDialog:(AJCPSDialog*) dialog { NSLog(@" Dialog message: %@", [dialog getMessage]); NSLog(@" Dialog numActions: %d", [dialog getNumActions]); if (![[dialog getLabelAction1] isEqualToString:@""]) { NSLog(@" Dialog Label for Action1: %@" , [dialog getLabelAction1]); } if (![[dialog getLabelAction2] isEqualToString:@""]) { NSLog(@" Dialog Label for Action1: %@" , [dialog getLabelAction2]); } if (![[dialog getLabelAction3] isEqualToString:@""]) { NSLog(@" Dialog Label for Action1: %@" , [dialog getLabelAction3]); } } #pragma mark - AJCPSControlPanelListener protocol methods /** * sessionEstablished - callback when a session is established with a device * @param device - the device that the session was established with */ - (void)sessionEstablished:(AJCPSControlPanelDevice *)device { // An example of how to get all the control panels on the device: // NSArray *controlpanels = [device getAllControlPanels]; // // for (AJCPSControlPanel *panel in controlpanels) { // NSLog(@"%@", [panel getPanelName]); // } NSLog(@"Session has been established with device: %@", [device getDeviceBusName]); // Dictionary that contains AJCPSControlPanelControllerUnit's NSDictionary *units = [device getDeviceUnits]; if (![units count]) { NSLog(@"Device %@ has no units.", [device getDeviceBusName]); return; } NSString *unitsKey = units.allKeys[0]; NSLog(@"Start loading unit: %@", unitsKey); self.unit = unitsKey; //Setting the table view titleForHeader AJCPSControlPanelControllerUnit *unitsValue = [units objectForKey:unitsKey]; AJCPSHttpControl *httpControl = [unitsValue getHttpControl]; if (httpControl) { NSLog(@"Unit has a HttpControl: "); NSLog(@" HttpControl version: %hu", [httpControl getInterfaceVersion]); NSLog(@" HttpControl url: %@", [httpControl getUrl]); } // Dictionary that contains AJCPSControlPanel's NSDictionary *controlPanels = [unitsValue getControlPanels]; NSString *controlPanelsKey = controlPanels.allKeys[0]; NSLog(@"-----> Start parsing panelName: %@", controlPanelsKey); self.controlPanel = [controlPanels objectForKey:controlPanelsKey]; // Array of languages in an NSString format self.supportedLanguages = [[self.controlPanel getLanguageSet] getLanguages]; if (![self.supportedLanguages count]) { [[[UIAlertView alloc] initWithTitle:@"Error" message:@"There is no supported language for this Container" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } else { NSString *lang = self.supportedLanguages[0]; [self populateRootContainer:lang]; } dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); } /** * sessionLost - callback when a session is lost with a device * @param device - device that the session was lost with */ - (void)sessionLost:(AJCPSControlPanelDevice *)device { NSLog(@"%@] Calling: %@", [[self class] description], NSStringFromSelector(_cmd)); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); [NSThread sleepForTimeInterval:5]; [device endSession]; } /** * signalPropertiesChanged - callback when a property Changed signal is received * @param device - device signal was received from * @param widget - widget signal was received for */ - (void)signalPropertiesChanged:(AJCPSControlPanelDevice *)device widget:(AJCPSWidget *)widget { NSLog(@"[%@] Calling: %@", [[self class] description], NSStringFromSelector(_cmd)); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); [self printBasicWidget:widget]; [self loadContainer]; } /** * signalPropertyValueChanged - callback when a property Value Changed signal is received * @param device - device signal was received from * @param property - Property signal was received for */ - (void)signalPropertyValueChanged:(AJCPSControlPanelDevice *)device property:(AJCPSProperty *)property { NSLog(@"[%@] Calling: %@", [[self class] description], NSStringFromSelector(_cmd)); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); [self printBasicWidget:property]; [self printProperty:property]; [self loadContainer]; } /** * signalDismiss - callback when a Dismiss signal is received * @param device - device signal was received from * @param notificationAction - notificationAction signal was received for */ - (void)signalDismiss:(AJCPSControlPanelDevice *)device notificationAction:(AJCPSNotificationAction *)notificationAction { NSLog(@"[%@] Calling: %@", [[self class] description], NSStringFromSelector(_cmd)); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); } /** * ErrorOccured - callback to tell application when something goes wrong * @param device - device that had the error * @param status - status associated with error if applicable * @param transaction - the type of transaction that resulted in the error * @param errorMessage - a log-able error Message */ - (void)errorOccured:(AJCPSControlPanelDevice *)device status:(QStatus)status transaction:(AJCPSControlPanelTransaction)transaction errorMessage:(NSString *)errorMessage { NSLog(@"[%@] Calling: %@", [[self class] description], NSStringFromSelector(_cmd)); dispatch_async(dispatch_get_main_queue(), ^{ [self.delegate loadEnded]; }); NSLog(@"error message:'%@'", errorMessage); dispatch_async(dispatch_get_main_queue(), ^{ [[[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"%@" ,errorMessage] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; }); } #pragma mark - util methods - (void)pushChildContainer:(AJCPSContainer *)containerToPush { self.containerStack[[self.containerStack count]] = containerToPush; [self loadContainer]; } - (NSInteger)popChildContainer { if([self.containerStack count] > 0) //until the first container is loaded, this array is empty { [self.containerStack removeObjectAtIndex:[self.containerStack count] - 1]; if ([self.containerStack count] > 0) { [self loadContainer]; } } return [self.containerStack count]; } - (void)populateRootContainer:(NSString*)lang { QStatus status; NSLog(@"---------> Now loading language: %@", lang); AJCPSContainer *rootContainer = (AJCPSContainer *)[self.controlPanel getRootWidget:lang]; NSLog(@"-----> Finished loading widget: %@", [rootContainer getWidgetName]); status = [self loadRootWidget:rootContainer]; if(ER_OK != status) { NSLog(@"Failed to load root widget"); } } -(QStatus)switchLanguage:(NSString *)language { QStatus status = ER_OK; if ([self.supportedLanguages indexOfObject:language] != NSNotFound) { AJCPSContainer *rootContainer = (AJCPSContainer *)[self.controlPanel getRootWidget:language]; NSLog(@"-----> Finished loading widget: %@", [rootContainer getWidgetName]); status = [self loadRootWidget:rootContainer]; return status; } else { return ER_LANGUAGE_NOT_SUPPORTED; } return status; } -(QStatus)switchLanguageForNotificationAction:(AJCPSRootWidget *)rootWidget { QStatus status = ER_OK; if (rootWidget) { NSLog(@"-----> Finished loading widget: %@", [rootWidget getWidgetName]); status = [self loadRootWidget:rootWidget]; return status; } else { return ER_LANGUAGE_NOT_SUPPORTED; } return status; } -(void)setSupportedLanguagesForNotificationAction:(AJCPSNotificationAction *) notificationAction { self.supportedLanguages = [[notificationAction getLanguageSet] getLanguages]; if (![self.supportedLanguages count]) { NSLog(@"notification action languages is empty"); } } -(NSInteger)childContainerPosition { return [self.containerStack count]; } @end base-16.04/controlpanel/ios/src/AJCPSDate.mm000066400000000000000000000034601272147170000205140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSDate.h" @interface AJCPSDate () @property (nonatomic) ajn::services::CPSDate *handle; @end @implementation AJCPSDate - (id)initWithDay:(uint16_t) day month:(uint16_t) month year:(uint16_t) year { self = [super init]; if (self) { self.handle = new ajn::services::CPSDate(day, month, year); } return self; } - (id)initWithHandle:(ajn::services::CPSDate *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (uint16_t)getDay { return self.handle->getDay(); } - (void)setDay:(uint16_t)day { return self.handle->setDay(day); } - (uint16_t)getMonth { return self.handle->getMonth(); } - (void)setMonth:(uint16_t)month { return self.handle->setMonth(month); } - (uint16_t)getYear { return self.handle->getYear(); } - (void)setYear:(uint16_t)year { return self.handle->setYear(year); } @end base-16.04/controlpanel/ios/src/AJCPSDialog.mm000066400000000000000000000042261272147170000210370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSDialog.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSDialog () @end @implementation AJCPSDialog - (id)initWithHandle:(ajn::services::Dialog *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } - (uint16_t)getNumActions { return ((ajn::services::Dialog *)self.handle)->getNumActions(); } - (NSString *)getMessage { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::Dialog *)self.handle)->getMessage()]; } - (NSString *)getLabelAction1 { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::Dialog *)self.handle)->getLabelAction1()]; } - (NSString *)getLabelAction2 { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::Dialog *)self.handle)->getLabelAction2()]; } - (NSString *)getLabelAction3 { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::Dialog *)self.handle)->getLabelAction3()]; } - (QStatus)executeAction1 { return ((ajn::services::Dialog *)self.handle)->executeAction1(); } - (QStatus)executeAction2 { return ((ajn::services::Dialog *)self.handle)->executeAction2(); } - (QStatus)executeAction3 { return ((ajn::services::Dialog *)self.handle)->executeAction3(); } @end base-16.04/controlpanel/ios/src/AJCPSErrorWidget.mm000066400000000000000000000026461272147170000221010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSErrorWidget.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSErrorWidget () @end @implementation AJCPSErrorWidget - (id)initWithHandle:(ajn::services::ErrorWidget *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } - (AJCPSWidget*)getOriginalWidget { return [[AJCPSWidget alloc]initWithHandle:((ajn::services::ErrorWidget *)self.handle)->getOriginalWidget()]; } @end base-16.04/controlpanel/ios/src/AJCPSGeneralCell.mm000066400000000000000000000263411272147170000220170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSGeneralCell.h" #import "AJCPSProperty.h" #import "AJCPSConstraintRange.h" #import "AJCPSConstraintList.h" #import "AJCPSErrorWidget.h" @implementation AJCPSGeneralCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Widget Name self.widgetNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 310, 20)]; // Hint self.hintLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 310, 20)]; self.hintLabel.textColor = [UIColor colorWithRed:0.4 green:0 blue:0.4 alpha:1]; // Label Details self.widgetDetailsLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 270, 110)]; [self.widgetDetailsLabel setFont:[UIFont systemFontOfSize:11]]; self.widgetDetailsLabel.lineBreakMode = NSLineBreakByWordWrapping; self.widgetDetailsLabel.numberOfLines = 0; // Add UI objects to subview [self.contentView addSubview:self.widgetNameLabel]; [self.contentView addSubview:self.widgetDetailsLabel]; [self.contentView addSubview:self.hintLabel]; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } - (NSString *)widgetHints { NSMutableString *str = [[NSMutableString alloc]init]; NSArray *propertyHintsStrings = [[NSArray alloc] initWithObjects: @"", @"SWITCH", @"CHECKBOX", @"SPINNER", @"RADIOBUTTON", @"SLIDER", @"TIMEPICKER", @"DATEPICKER", @"NUMBERPICKER", @"KEYPAD", @"ROTARYKNOB", @"TEXTVIEW", @"NUMERICVIEW", @"EDITTEXT", nil]; [self setAccessoryType:UITableViewCellAccessoryNone]; NSArray *hints = [self.widget getHints]; if ([hints count]) { for (NSInteger i = 0 ; i < [hints count]; i++) { NSInteger hint = [hints[i] integerValue]; switch ([self.widget getWidgetType]) { case AJCPS_ACTION: case AJCPS_ACTION_WITH_DIALOG: if (hint == AJCPS_ACTIONBUTTON) self.hintLabel.text=@"ACTIONBUTTON"; else self.hintLabel.text=@"UNKNOWN"; break; case AJCPS_LABEL: if (hint == AJCPS_TEXTLABEL) self.hintLabel.text=@"TEXTLABEL"; else self.hintLabel.text=@"UNKNOWN"; break; case AJCPS_PROPERTY: { AJCPSPropertyValue propertyValue; [(AJCPSProperty *)self.widget getPropertyValue:propertyValue]; switch ([(AJCPSProperty *)self.widget getPropertyType]) { case AJCPS_BOOL_PROPERTY : [str appendFormat:@"bool property, value:%d",propertyValue.boolValue]; break; case AJCPS_UINT16_PROPERTY : [str appendFormat:@"uint16 property, value:%d",propertyValue.uint16Value]; break; case AJCPS_INT16_PROPERTY : [str appendFormat:@"int16 property, value:%d",propertyValue.int16Value]; break; case AJCPS_UINT32_PROPERTY : [str appendFormat:@"uint32 property, value:%d",propertyValue.uint32Value]; break; case AJCPS_INT32_PROPERTY : [str appendFormat:@"int32 property, value:%d",propertyValue.int32Value]; break; case AJCPS_UINT64_PROPERTY : [str appendFormat:@"uint64 property, value:%llu",propertyValue.uint64Value]; break; case AJCPS_INT64_PROPERTY : [str appendFormat:@"int64 property, value:%lld",propertyValue.int64Value]; break; case AJCPS_DOUBLE_PROPERTY : [str appendFormat:@"double property, value:%f",propertyValue.doubleValue]; break; case AJCPS_STRING_PROPERTY : [str appendFormat:@"string property, value:'%s'",propertyValue.charValue]; break; case AJCPS_DATE_PROPERTY : [str appendFormat:@"date property"]; //TODO support date break; case AJCPS_TIME_PROPERTY : [str appendFormat:@"time property"]; //TODO support time break; default: [str appendFormat:@"unknown property"]; break; } if (hint > 0 && hint < [propertyHintsStrings count]){ self.hintLabel.text=[NSString stringWithFormat:@"%@", propertyHintsStrings[hint]]; } else self.hintLabel.text=@"UNKNOWN"; if(![[((AJCPSProperty *)self.widget) getUnitOfMeasure] isEqualToString:@""]) { [str appendFormat:@",unitOfMeasure:%@", [((AJCPSProperty *)self.widget) getUnitOfMeasure]]; } [str appendString:@"\n"]; AJCPSConstraintRange *constraintRange = [((AJCPSProperty *)self.widget) getConstraintRange]; if (constraintRange) { [str appendFormat:@"min:%d,max:%d,inc:%d",[constraintRange getMinValue],[constraintRange getMaxValue],[constraintRange getIncrementValue]]; } NSArray *list = [((AJCPSProperty *)self.widget) getConstraintList]; if ([list count]) { [str appendString:@"list:"]; } for (AJCPSConstraintList *constraintList in list) { [str appendFormat:@"%@",[constraintList getDisplay]]; AJCPSConstraintValue propertyValue = [constraintList getConstraintValue]; AJCPSPropertyType propertyType = [constraintList getPropertyType]; NSString *propertyValueStr = [constraintList propertyToNSString:propertyType withValue:propertyValue]; [str appendFormat:@"%@", propertyValueStr]; } } break; case AJCPS_CONTAINER: if (hint == AJCPS_VERTICAL_LINEAR) self.hintLabel.text=@"VERTICAL_LINEAR"; else if (hint == AJCPS_HORIZONTAL_LINEAR) self.hintLabel.text=@"HORIZONTAL_LINEAR"; else self.hintLabel.text=@"UNKNOWN"; [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];//TODO break; case AJCPS_DIALOG: if (hint == AJCPS_ALERTDIALOG) self.hintLabel.text=@"ALERTDIALOG"; else self.hintLabel.text=@"UNKNOWN"; break; } [str appendFormat:@"%@",(i == ([hints count] - 1)) ? @"\n" : @", "]; } } else { [str appendString:@"No hints for this widget"]; } return str; } - (NSString *)widgetType { switch ([self.widget getWidgetType]) { case AJCPS_CONTAINER: { return @"Container"; } break; case AJCPS_ACTION: { return @"Action"; } break; case AJCPS_ACTION_WITH_DIALOG: { return @"Action & Dialog"; } break; case AJCPS_LABEL: { return @"Label"; } break; case AJCPS_PROPERTY: { return @"Property"; } break; case AJCPS_DIALOG: { return @"Dialog"; } break; case AJCPS_ERROR: { return @"Error Widget"; } break; default: { return @"Unsupported AJCPSWidgetType"; } break; } return nil; } -(void)setWidget:(AJCPSWidget *)widget { _widget = widget; self.widgetNameLabel.text = [NSString stringWithFormat:@"%@,%@",[self.widget getLabel],[self widgetType]]; NSString *widgetLabel; if ([[widget getLabel] length]) widgetLabel = [widget getLabel]; NSString *detailedText = [NSString stringWithFormat:@"label:'%@'\n%@,%@,%@\nbg:0x%x\n%@", widgetLabel, [widget getIsSecured] ? @"secured" : @"not secured", [widget getIsEnabled] ? @"enabled" : @"not enabled", [widget getIsWritable] ? @"writable" : @"not writable", [widget getBgColor], [self widgetHints]]; if ([widget getWidgetType] == AJCPS_ERROR) { AJCPSWidget *originalWidget = [(AJCPSErrorWidget *)self.widget getOriginalWidget]; self.hintLabel.text = [NSString stringWithFormat:@"Original Widget name:%@",[originalWidget getWidgetName]]; } //[self printHints:widget widgetType:widgetType indent:indent]; NSLog(@" widgetName:%@ widgetLabel:%@", [self.widget getLabel], widgetLabel); self.widgetDetailsLabel.text = detailedText; } @end base-16.04/controlpanel/ios/src/AJCPSGetControlPanelViewController.mm000066400000000000000000000502641272147170000256020ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSGetControlPanelViewController.h" #import "alljoyn/Status.h" #import "AJCPSControlPanelService.h" #import "AJCPSControlPanelController.h" #import "AJCPSContainer.h" #import "AJCPSControllerUpdateEvents.h" #import "AJCPSButtonCell.h" #import "AJCPSGeneralCell.h" #import "AJCPSLabelCell.h" #import "AJCPSPickerCell.h" #import "AJCPSActionDialogCell.h" const float GENERAL_CELL_HEIGHT = 115.00; const float BUTTON_CELL_HEIGHT = 65.00; const float LABEL_CELL_HEIGHT = 55.00; const float PICKER_CELL_HEIGHT = 75.00; static NSString * const CLIENTDEFAULTLANG=@""; static NSString * const CPS_BUTTON_CELL = @"CPSButtonCell"; static NSString * const CPS_GENERAL_CELL = @"CPSGeneralCell"; static NSString * const CPS_LABEL_CELL = @"CPSLabelCell"; static NSString * const CPS_PICKER_CELL = @"CPSPickerCell"; static NSString * const CPS_ACTION_DIALOG_CELL = @"CPSActionDialogCell"; @interface AJCPSGetControlPanelViewController () @property (strong, nonatomic) AJCPSControllerModel *controllerModel; @property (strong, nonatomic) AJCPSControlPanelService *controlPanelService; @property (strong, nonatomic) AJCPSControlPanelController *controlPanelController; @property (strong, nonatomic) AJCPSControlPanelDevice *controlPanelDevice; @property (strong, nonatomic) UITextField *alertChooseLanguage; @property (strong, nonatomic) UIBarButtonItem *chooseLangButton; @property (strong, nonatomic) UITableView* tableView; @property (weak, nonatomic) AJNBusAttachment *clientBusAttachment; @property (weak, nonatomic) AJNAnnouncement *announcement; @property (nonatomic) bool isAnnouncementMode; @property (strong, nonatomic) NSString *notificationSenderBusName; @property (strong, nonatomic) NSString *notificationCPSObjectPath; @property (nonatomic) bool isNotificationMode; @property (strong, nonatomic) AJCPSNotificationAction* notificationAction; @property (strong, atomic) UIAlertView *loadingAV; @property (strong, atomic) UIAlertController *loadingAC; @end @implementation AJCPSGetControlPanelViewController - (id)initWithNotificationSenderBusName:(NSString*) senderBusName cpsObjectPath:(NSString*) cpsObjectPath bus:(AJNBusAttachment*) bus { if (self = [super init]) { self.notificationSenderBusName = senderBusName; self.notificationCPSObjectPath = cpsObjectPath; self.clientBusAttachment = bus; self.isNotificationMode = true; } return self; } - (id)initWithAnnouncement:(AJNAnnouncement*) announcement bus:(AJNBusAttachment*) bus { if (self = [super init]) { self.announcement = announcement; self.clientBusAttachment = bus; self.isAnnouncementMode = true; } return self; } - (void)viewDidLoad { QStatus status; [super viewDidLoad]; self.navigationItem.hidesBackButton = YES; [self showLoadingAlert:@"Loading..."]; // Add language button if (self.isAnnouncementMode) { [self addLanguageButton]; } CGRect tableViewFrame = self.view.bounds; self.tableView = [[UITableView alloc] initWithFrame:tableViewFrame style:UITableViewStylePlain]; self.tableView.delegate = self; self.tableView.dataSource = self; [self.tableView registerClass:[AJCPSButtonCell class] forCellReuseIdentifier:CPS_BUTTON_CELL]; [self.tableView registerClass:[AJCPSGeneralCell class] forCellReuseIdentifier:CPS_GENERAL_CELL]; [self.tableView registerClass:[AJCPSLabelCell class] forCellReuseIdentifier:CPS_LABEL_CELL]; [self.tableView registerClass:[AJCPSPickerCell class] forCellReuseIdentifier:CPS_PICKER_CELL]; [self.tableView registerClass:[AJCPSActionDialogCell class] forCellReuseIdentifier:CPS_ACTION_DIALOG_CELL]; [self.view addSubview:self.tableView]; if (!self.controllerModel) { status = [self startService]; if (ER_OK != status) { NSLog(@"Failed to start control panel"); [[[UIAlertView alloc] initWithTitle:@"Error" message:@"Failed to start control panel." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; [self loadEnded]; } } } -(QStatus)startService { QStatus status; if (!self.clientBusAttachment) { NSLog(@"Bus attachment is nil."); return ER_FAIL; } if (self.isNotificationMode && self.isAnnouncementMode) { NSLog(@"Using both Annnouncement and Notification mode is not supported"); return ER_FAIL; } // Get a controllable device using senderBusName (Notification1.1) self.controlPanelController = [[AJCPSControlPanelController alloc] init]; if (self.isNotificationMode) { self.controlPanelDevice = [self.controlPanelController getControllableDevice:self.notificationSenderBusName]; if (!self.controlPanelDevice) { NSLog(@"Could not initialize control panel device."); return ER_FAIL; } } self.controllerModel = [[AJCPSControllerModel alloc] init]; if (!self.controllerModel) { NSLog(@"Could not initialize controller model."); return ER_FAIL; } self.controllerModel.delegate = self; self.controlPanelService = [AJCPSControlPanelService getInstance]; status = [self.controlPanelService initController:self.clientBusAttachment controlPanelController:self.controlPanelController controlPanelListener:self.controllerModel]; if (status != ER_OK) { NSLog(@"Could not initialize Controller."); return ER_FAIL; } else { NSLog(@"Successfully initialize Controller."); } if (self.isAnnouncementMode) { // Create a controllable device using the announcement bus name - this will trigger a listener method self.controlPanelDevice = [self.controlPanelController createControllableDevice:self.announcement.busName ObjectDescs:self.announcement.objectDescriptions]; if (!self.controlPanelDevice) { NSLog(@"Could not initialize control panel device."); return ER_FAIL; } else { NSLog(@"Successfully initialize control panel device."); } return status; } if (self.isNotificationMode) { status = [self loadNewSessionForNotificationWithAction]; if (ER_OK != status) { NSLog(@"Failed to load session for notification with action"); } else { NSLog(@"Successfully load a session for notification with action"); } } return status; } -(QStatus)loadNewSessionForNotificationWithAction { QStatus status; status = [self.controlPanelDevice startSession]; // Triggers sessionEstablished if (ER_OK != status) { NSLog(@"Failed to start a session. ERROR: %@", [AJNStatus descriptionForStatusCode:status]); // if (status != ER_ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED) { return ER_FAIL; // } } else { NSLog(@"Successfully start session with device %@",self.notificationSenderBusName); } // Add notification action self.notificationAction = [self.controlPanelDevice addNotificationAction:self.notificationCPSObjectPath]; if (!self.notificationAction) { NSLog(@"Failed to add notification action."); return ER_FAIL; } else { NSLog(@"Successfully added a notification action."); } [self.controllerModel setSupportedLanguagesForNotificationAction:self.notificationAction]; NSArray *languages= [self.controllerModel supportedLanguages]; if (![languages count]) { NSLog(@"notification action languages is empty"); return ER_FAIL; } else { [self addLanguageButton]; NSLog(@"Get rootWidget for the first language: %@",languages[0]); AJCPSRootWidget *rootWidget = [self.notificationAction getRootWidget:languages[0]]; // Take the rootWidget first language NSLog(@"Finished loading widget: %@", [rootWidget getWidgetName]); [self.controllerModel loadRootWidget:rootWidget]; } return ER_OK; } -(void)addLanguageButton { _chooseLangButton = [[UIBarButtonItem alloc] initWithTitle:@"Language" style:UIBarButtonItemStyleBordered target:self action:@selector(chooseLanguageAction)]; [[self navigationItem] setRightBarButtonItem:_chooseLangButton]; self.navigationItem.rightBarButtonItem.enabled = NO; } - (void)chooseLanguageAction { NSString *supportedLangs; supportedLangs = [[self.controllerModel supportedLanguages] componentsJoinedByString:@" "]; NSLog(@"Supported languages: %@",supportedLangs); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Choose Language" message:supportedLangs delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil]; alert.alertViewStyle = UIAlertViewStylePlainTextInput; self.alertChooseLanguage = [alert textFieldAtIndex:0]; //connect the UITextField with the alert [alert show]; } - (void)stopControlPanel { QStatus status; if (self.isNotificationMode) { status = [self.controlPanelDevice removeNotificationAction:self.notificationAction]; if (ER_OK != status) { NSLog(@"Failed to remove notification action."); } } self.controlPanelDevice = nil; self.controllerModel = nil; self.controlPanelController = nil; // shutdown will handle the self.controlPanelDevice endSession/shutdownDevice status = [self.controlPanelService shutdownController]; if (ER_OK != status) { NSLog(@"Failed to shutdown control panel controller"); } else { NSLog(@"Successfully shutdown control panel controller"); } self.controlPanelService = nil; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 1) { //user pressed OK QStatus status = ER_OK; if (self.isAnnouncementMode) { status = [self.controllerModel switchLanguage:self.alertChooseLanguage.text]; } if (self.isNotificationMode) { status = [self.controllerModel switchLanguageForNotificationAction:[self.notificationAction getRootWidget:self.alertChooseLanguage.text]]; } if (status != ER_OK) { [[[UIAlertView alloc]initWithTitle:@"Invalid Language" message:@"" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } } } - (void)viewWillAppear:(BOOL)animated { self.controllerModel.delegate = self; // enable BackButton for all other containers but the top container(handeled by the AJCPSControlPanelListener protocol methods) if ([self.controllerModel childContainerPosition]) { self.navigationItem.hidesBackButton = NO; [self dismissLoadingAlert]; } } - (void)viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // the UINavigation controller's back button pressed. the current viewcontroller is no longer in the view controller's list NSInteger pos = [self.controllerModel popChildContainer]; if(pos == 0) { //this is the top most container [self stopControlPanel]; } } [super viewWillDisappear:animated]; } #pragma mark - ControllerUpdateEvents - (void)refreshEntries { dispatch_async(dispatch_get_main_queue(), ^{ [self.tableView reloadData]; }); } -(void)loadEnded { self.navigationItem.hidesBackButton = NO; self.navigationItem.rightBarButtonItem.enabled = YES; [self dismissLoadingAlert]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections - Currently we use only 1 section return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. NSInteger count; @synchronized(self.controllerModel){ count = [[self.controllerModel widgetsContainer]count]; }; return count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { AJCPSWidget *widget = [self.controllerModel widgetsContainer][indexPath.row]; switch ([widget getWidgetType]) { case AJCPS_ACTION: { NSArray *hints = [widget getHints]; for (NSNumber *hint in hints) { if(hint.shortValue == AJCPS_ACTIONBUTTON) { AJCPSButtonCell *cell = (AJCPSButtonCell *)[tableView dequeueReusableCellWithIdentifier:CPS_BUTTON_CELL forIndexPath:indexPath]; cell.actionWidget = (AJCPSAction *)widget; return cell; } } break; } case AJCPS_LABEL: { AJCPSLabelCell *cell = (AJCPSLabelCell *)[tableView dequeueReusableCellWithIdentifier:CPS_LABEL_CELL forIndexPath:indexPath]; cell.widget = widget; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } case AJCPS_PROPERTY: { NSArray *hints = [widget getHints]; for (NSNumber *hint in hints) { if(hint.shortValue == AJCPS_SPINNER) { AJCPSPickerCell *cell = (AJCPSPickerCell *)[tableView dequeueReusableCellWithIdentifier:CPS_PICKER_CELL forIndexPath:indexPath]; cell.widget = widget; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } } break; } case AJCPS_ACTION_WITH_DIALOG: { AJCPSActionDialogCell *cell = (AJCPSActionDialogCell *)[tableView dequeueReusableCellWithIdentifier:CPS_ACTION_DIALOG_CELL forIndexPath:indexPath]; cell.viewController = self; cell.actionDialogWidget = (AJCPSActionWithDialog *)widget; return cell; } } AJCPSGeneralCell *cell; cell = (AJCPSGeneralCell *)[tableView dequeueReusableCellWithIdentifier:CPS_GENERAL_CELL forIndexPath:indexPath]; cell.widget = widget; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { return self.controllerModel.unit; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { AJCPSWidget *widget = [self.controllerModel widgetsContainer][indexPath.row]; switch ([widget getWidgetType]) { case AJCPS_ACTION: case AJCPS_ACTION_WITH_DIALOG: return BUTTON_CELL_HEIGHT; break; case AJCPS_LABEL: return LABEL_CELL_HEIGHT; break; case AJCPS_PROPERTY: return PICKER_CELL_HEIGHT; break; } return GENERAL_CELL_HEIGHT; } #pragma mark - Navigation - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { AJCPSWidget *widget = [self.controllerModel widgetsContainer][indexPath.row]; if ([widget getWidgetType] == AJCPS_CONTAINER) { AJCPSGetControlPanelViewController *viewController = [[AJCPSGetControlPanelViewController alloc] init]; // prepare the view we load to show the child container widgets viewController.controllerModel = self.controllerModel; viewController.controllerModel.delegate = viewController; viewController.navigationItem.rightBarButtonItem.enabled = NO; [viewController.controllerModel pushChildContainer:(AJCPSContainer *)widget]; // show the table [self.navigationController pushViewController:viewController animated:YES]; } else { NSLog(@"tried to segue into a non container of type %d name %@",[widget getWidgetType], [widget getWidgetName]); return; } } -(void)showLoadingAlert:(NSString *)message { if ([UIAlertController class]) { self.loadingAC = [UIAlertController alertControllerWithTitle:nil message:[NSString stringWithFormat:@"%@\n\n", message] preferredStyle:UIAlertControllerStyleAlert]; UIActivityIndicatorView *activityIV = [[UIActivityIndicatorView alloc] initWithFrame:self.loadingAC.view.bounds]; [activityIV setTranslatesAutoresizingMaskIntoConstraints:NO]; activityIV.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; [self.loadingAC.view addSubview:activityIV]; [self.loadingAC.view addConstraint:[NSLayoutConstraint constraintWithItem:activityIV attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.loadingAC.view attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; [self.loadingAC.view addConstraint:[NSLayoutConstraint constraintWithItem:activityIV attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.loadingAC.view attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]]; [activityIV startAnimating]; [self presentViewController:self.loadingAC animated:NO completion:nil]; } else { self.loadingAV = [[UIAlertView alloc] initWithTitle:@"Please wait" message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; UIActivityIndicatorView *activityIV = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 80, 40)]; activityIV.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; [activityIV startAnimating]; [self.loadingAV setValue:activityIV forKey:@"accessoryView"]; [self.loadingAV show]; } NSLog(@"Showing loading alert"); } -(void)dismissLoadingAlert { if ([UIAlertController class]) { [self.loadingAC dismissViewControllerAnimated:YES completion:nil]; } else{ [self.loadingAV dismissWithClickedButtonIndex:0 animated:YES]; } NSLog(@"dismissLoadingAlert called"); } @end base-16.04/controlpanel/ios/src/AJCPSHttpControl.mm000066400000000000000000000056501272147170000221220ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSHttpControl.h" #import "AJCPSControlPanelDevice.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSHttpControl () @property ajn::services::HttpControl *handle; @end @implementation AJCPSHttpControl - (id)initWithHandle:(ajn::services::HttpControl *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (uint16_t)getInterfaceVersion { return ((ajn::services::HttpControl *)self.handle)->getInterfaceVersion(); } /** * Register the HttpControl BusObject * @param bus - bus used for registering the object * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus { return ((ajn::services::HttpControl *)self.handle)->registerObjects((ajn::BusAttachment *)[bus handle]); } /** * Refresh the HttpControl * @param bus - bus used for refreshing the object * @return status - success/failure */ - (QStatus)refreshObjects:(AJNBusAttachment *)bus { return ((ajn::services::HttpControl *)self.handle)->refreshObjects((ajn::BusAttachment *)[bus handle]); } /** * Unregister the HttpControl BusObject * @param bus - bus used to unregister the object * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { return ((ajn::services::HttpControl *)self.handle)->unregisterObjects((ajn::BusAttachment *)[bus handle]); } /** * Get the Device that contains this HttpControl * @return ControlPanelDevice */ - (AJCPSControlPanelDevice *)getDevice { return [[AJCPSControlPanelDevice alloc]initWithHandle:((ajn::services::HttpControl *)self.handle)->getDevice()]; } /** * Get the Url for the HttpControl * @return url */ - (NSString *)getUrl { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::HttpControl *)self.handle)->getUrl()]; } /** * Get the ControlPanelMode of this HttpControl * @return ControlPanelMode */ - (AJCPSControlPanelMode)getControlPanelMode { return ((ajn::services::HttpControl *)self.handle)->getControlPanelMode(); } @end base-16.04/controlpanel/ios/src/AJCPSLabel.mm000066400000000000000000000023661272147170000206620ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSLabel.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSLabel () @end @implementation AJCPSLabel - (id)initWithHandle:(ajn::services::Label *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } @end base-16.04/controlpanel/ios/src/AJCPSLabelCell.mm000066400000000000000000000032101272147170000214470ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSLabelCell.h" @implementation AJCPSLabelCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.widgetNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 310, 20)]; [self.contentView addSubview:self.widgetNameLabel]; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } -(void)setWidget:(AJCPSWidget *)widget { _widget = widget; self.widgetNameLabel.text = [NSString stringWithFormat:@"%@",[self.widget getLabel]]; } @endbase-16.04/controlpanel/ios/src/AJCPSLanguageSet.mm000066400000000000000000000037731272147170000220450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSLanguageSet.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSLanguageSet () @property (nonatomic) ajn::services::LanguageSet *handle; @end @implementation AJCPSLanguageSet - (id)initWithHandle:(ajn::services::LanguageSet *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (NSString *)getLanguageSetName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getLanguageSetName()]; } - (size_t)getNumLanguages { return self.handle->getNumLanguages(); } - (void)addLanguage:(NSString *)language { return self.handle->addLanguage([AJNConvertUtil convertNSStringToQCCString:language]); } - (NSArray *)getLanguages { if (!self.handle) return nil; const std::vector cpp_languages = self.handle->getLanguages(); NSMutableArray *languages = [[NSMutableArray alloc]init]; for (int i = 0; i != cpp_languages.size(); i++) { [languages addObject:[AJNConvertUtil convertQCCStringtoNSString:cpp_languages.at(i)]]; } return languages; } @end base-16.04/controlpanel/ios/src/AJCPSLanguageSets.mm000066400000000000000000000030001272147170000222070ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSLanguageSets.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJCPSLanguageSets () @property (nonatomic) ajn::services::LanguageSets *handle; @end @implementation AJCPSLanguageSets - (id)initWithHandle:(ajn::services::LanguageSets *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (AJCPSLanguageSet *)getLanguageSet:(NSString *)languageSetName { return [[AJCPSLanguageSet alloc]initWithHandle:self.handle->LanguageSets::get([AJNConvertUtil convertNSStringToQCCString:languageSetName])]; } @endbase-16.04/controlpanel/ios/src/AJCPSNotificationAction.mm000066400000000000000000000056741272147170000234340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSNotificationAction.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSNotificationAction () @property (nonatomic) ajn::services::NotificationAction *handle; @end @implementation AJCPSNotificationAction - (id)initWithHandle:(ajn::services::NotificationAction *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } - (NSString *)getNotificationActionName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getNotificationActionName()]; } /** * Register the BusObjects for this Widget * @param bus - bus used to register the busObjects * @return status - success/failure */ - (QStatus)registerObjects:(AJNBusAttachment *)bus { return self.handle->registerObjects((ajn::BusAttachment *)[bus handle]); } /** * Unregister the BusObjects of the NotificationAction class * @param bus - bus used to unregister the objects * @return status - success/failure */ - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { return self.handle->unregisterObjects((ajn::BusAttachment *)[bus handle]); } /** * Get the LanguageSet of the NotificationAction * @return */ - (AJCPSLanguageSet *)getLanguageSet { return [[AJCPSLanguageSet alloc] initWithHandle:(ajn::services::LanguageSet *)&self.handle->getLanguageSet()]; } /** * Get the Device of the NotificationAction * @return controlPanelDevice */ - (AJCPSControlPanelDevice *)getDevice { return [[AJCPSControlPanelDevice alloc]initWithHandle:self.handle->getDevice()]; } /** * Get the objectPath * @return */ - (NSString *)getObjectPath { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getObjectPath()]; } /** * Get the RootWidget of the NotificationAction * @param Language - languageSet of RootWidget to retrieve * @return rootWidget */ - (AJCPSRootWidget *)getRootWidget:(NSString *)Language { return [[AJCPSRootWidget alloc]initWithHandle:self.handle->getRootWidget([AJNConvertUtil convertNSStringToQCCString:Language])]; } @end base-16.04/controlpanel/ios/src/AJCPSPickerCell.mm000066400000000000000000000126071272147170000216570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSPickerCell.h" #import "AJCPSConstraintList.h" @implementation AJCPSPickerCell const NSInteger NUM_COLUMNS = 1; const CGFloat COMPONENT_WIDTH = 300; const CGFloat COMPONENT_HEIGHT = 40; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 310, 20)]; [self.contentView addSubview:self.label]; self.pickerTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 20, 300, 40)]; self.picker = [[UIPickerView alloc] init]; self.picker.delegate = self; self.picker.dataSource = self; self.picker.showsSelectionIndicator = YES; self.picker.hidden = NO; self.pickerTextField.inputView = self.picker; self.pickerTextField.borderStyle = UITextBorderStyleRoundedRect; [self.contentView addSubview:self.pickerTextField]; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } - (void)setWidget:(AJCPSWidget *)widget { _widget = widget; self.label.text = [NSString stringWithFormat:@"%@",[self.widget getLabel]]; NSLog(@"widget is: %@", self.widget); NSArray *list = [((AJCPSProperty *)self.widget) getConstraintList]; self.pickerOptions = [self buildPickerOptions:list]; NSLog(@"widget constraint list is: %@", self.pickerOptions); if ([self.pickerTextField.text length] <= 0){ self.pickerTextField.text = self.pickerOptions[0]; } } - (void)setPickerOptions:(NSMutableArray *)pickerOptions { _pickerOptions = pickerOptions; [self.picker reloadAllComponents]; } - (NSMutableArray *)buildPickerOptions:(NSArray *)list { NSMutableArray *options = [[NSMutableArray alloc]init]; if ([list count] <= 0) { NSLog(@"Building picker options failed due to empty list: %@", list); return nil; } NSLog(@"Building picker options for list: %@", list); for (AJCPSConstraintList *constraintList in list) { NSMutableString *str = [[NSMutableString alloc] init]; [str appendFormat:@"%@",[constraintList getDisplay]]; AJCPSConstraintValue propertyValue = [constraintList getConstraintValue]; AJCPSPropertyType propertyType = [constraintList getPropertyType]; [str appendFormat:@"%@", [constraintList propertyToNSString:propertyType withValue:propertyValue]]; NSLog(@"'%@' added to options list", str); [options addObject:str]; } NSLog(@"picker options built: %@", options); return options; } - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return NUM_COLUMNS; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [self.pickerOptions count]; } - (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if ([self.pickerOptions count] > 0) { return self.pickerOptions[row]; } return nil; } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSArray *list = [((AJCPSProperty *)self.widget) getConstraintList]; for (AJCPSConstraintList *constraintList in list) { NSMutableString *str = [[NSMutableString alloc] init]; [str appendFormat:@"%@",[constraintList getDisplay]]; AJCPSConstraintValue propertyValue = [constraintList getConstraintValue]; AJCPSPropertyType propertyType = [constraintList getPropertyType]; [str appendFormat:@"%@", [constraintList propertyToNSString:propertyType withValue:propertyValue]]; NSString *pickerName = self.pickerOptions[row]; if ([pickerName isEqualToString:str]){ AJCPSProperty *property = (AJCPSProperty *)self.widget; [property setValueFromUnsignedShort:propertyValue.uint16Value]; break; } } self.pickerTextField.text = self.pickerOptions[row]; [self.pickerTextField resignFirstResponder]; } -(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component { return COMPONENT_WIDTH; } -(CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { return COMPONENT_HEIGHT; } @endbase-16.04/controlpanel/ios/src/AJCPSProperty.mm000066400000000000000000000134031272147170000214610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "alljoyn/controlpanel/Property.h" #import "AJCPSProperty.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" #import "AJCPSConstraintList.h" @interface AJCPSProperty () //using AJCPSWidget handle @end @implementation AJCPSProperty - (id)initWithHandle:(ajn::services::Property *)handle { self = [super initWithHandle:handle]; if (self) { } return self; } /** * Get the PropertyType * @return PropertyType */ - (AJCPSPropertyType)getPropertyType { return ((ajn::services::Property *)self.handle)->getPropertyType(); } /** * Get the PropertyValue of the property * @return the value of the property */ - (void)getPropertyValue:(AJCPSPropertyValue &)propertyValue { [self convertToAJCPSPropertyValue:((ajn::services::Property *)self.handle)->getPropertyValue() to:&propertyValue]; } /** * Get the Unit of Measure * @return Unit of Measure Values */ - (NSString *)getUnitOfMeasure { return [AJNConvertUtil convertQCCStringtoNSString:((ajn::services::Property *)self.handle)->getUnitOfMeasure()]; } /** * Get the Constraint List vector * @return the Constraint List vector */ //const std::vector& - (NSArray *)getConstraintList { // TODO: the list gets erased when we leave this loop NSMutableArray *constraintList = [[NSMutableArray alloc]init]; for (int i = 0; i != ((ajn::services::Property *)self.handle)->getConstraintList().size(); i++) { [constraintList addObject:[[AJCPSConstraintList alloc] initWithHandle:(ajn::services::ConstraintList *)&((ajn::services::Property *)self.handle)->getConstraintList().at(i)]]; } return constraintList; } - (AJCPSConstraintRange *)getConstraintRange { ajn::services::ConstraintRange *constraintRange = ((ajn::services::Property *)self.handle)->getConstraintRange(); if (constraintRange) { return [[AJCPSConstraintRange alloc] initWithHandle:constraintRange]; } else return nil; } - (QStatus)setValueFromBool:(bool)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromUnsignedShort:(uint16_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromShort:(int16_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromUnsignedLong:(uint32_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromLong:(int32_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromUnsignedLongLong:(uint64_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromLongLong:(int64_t)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromDouble:(double)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromCString:(const char *)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (QStatus)setValueFromDate:(AJCPSDate *)value { return ((ajn::services::Property *)self.handle)->setValue(*[value handle]); } - (QStatus)setValueFromTime:(AJCPSTime *)value { return ((ajn::services::Property *)self.handle)->setValue(value); } - (void)convertToAJCPSPropertyValue:(ajn::services::PropertyValue) constraintValue to:(AJCPSPropertyValue *)tConstraintValue { switch ([self getPropertyType]) { case AJCPS_BOOL_PROPERTY : tConstraintValue->boolValue = constraintValue.boolValue; break; case AJCPS_UINT16_PROPERTY : tConstraintValue->uint16Value = constraintValue.uint16Value; break; case AJCPS_INT16_PROPERTY : tConstraintValue->int16Value = constraintValue.int16Value; break; case AJCPS_UINT32_PROPERTY : tConstraintValue->uint32Value = constraintValue.uint32Value; break; case AJCPS_INT32_PROPERTY : tConstraintValue->int32Value = constraintValue.int32Value; break; case AJCPS_UINT64_PROPERTY : tConstraintValue->uint64Value = constraintValue.uint64Value; break; case AJCPS_INT64_PROPERTY : tConstraintValue->int64Value = constraintValue.int64Value; break; case AJCPS_DOUBLE_PROPERTY : tConstraintValue->doubleValue = constraintValue.doubleValue; break; case AJCPS_STRING_PROPERTY : tConstraintValue->charValue = constraintValue.charValue; break; case AJCPS_DATE_PROPERTY : //TODO break; case AJCPS_TIME_PROPERTY : //TODO break; default: break; } } @end base-16.04/controlpanel/ios/src/AJCPSRootWidget.mm000066400000000000000000000021441272147170000217240ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSRootWidget.h" #import "alljoyn/controlpanel/RootWidget.h" @interface AJCPSRootWidget () @end @implementation AJCPSRootWidget @endbase-16.04/controlpanel/ios/src/AJCPSTime.mm000066400000000000000000000043261272147170000205370ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSTime.h" @interface AJCPSTime () @property (nonatomic) ajn::services::CPSTime *handle; @end @implementation AJCPSTime - (id)initWithHour:(uint16_t) hour minute:(uint16_t) minute second:(uint16_t) second { self = [super init]; if (self) { self.handle = new ajn::services::CPSTime(hour, minute, second); } return self; } - (id)initWithHandle:(ajn::services::CPSTime *)handle { self = [super init]; if (self) { self.handle = handle; } return self; } /** * Get the hour value of the date * @return hour value */ - (uint16_t)getHour { return self.handle->getHour(); } /** * Set the hour Value of the date * @param hour value */ - (void)setHour:(uint16_t)hour { self.handle->setHour(hour); } /** * Get the Minute value of the date * @return minute value */ - (uint16_t)getMinute { return self.handle->getMinute(); } /** * Set the Minute value of the date * @param minute value */ - (void)setMinute:(uint16_t)minute { return self.handle->setMinute(minute); } /** * Get the Second value of the date * @return second value */ - (uint16_t)getSecond { return self.handle->getSecond(); } /** * Set the Second value of the date * @param second value */ - (void)setSecond:(uint16_t)second { return self.handle->setSecond(second); } @endbase-16.04/controlpanel/ios/src/AJCPSWidget.mm000066400000000000000000000071311272147170000210610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJCPSWidget.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJCPSControlPanelDevice.h" @interface AJCPSWidget () @property (nonatomic) ajn::services::Widget *handle; @end @implementation AJCPSWidget - (id)init { return Nil; // This is an abstract class. Do Not Instantiate. } - (id)initWithHandle:(ajn::services::Widget *)handle { self = [super init]; if (self) { self.handle = handle; if (!self.handle) { NSLog(@"Failed getting a pointer to a Widget subclass"); return Nil; } } return self; } - (void)dealloc { // it is very important not to delete anything using widget, this is all taken care of by lower layers } - (AJCPSWidgetType)getWidgetType { return self.handle->getWidgetType(); } - (NSString *)getWidgetName { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getWidgetName()]; } - (AJCPSControlPanelMode)getControlPanelMode { return (AJCPSControlPanelMode)self.handle->getControlPanelMode(); } - (const AJCPSWidget *)getRootWidget { return [[AJCPSWidget alloc]initWithHandle:self.handle->getRootWidget()]; } - (const AJCPSControlPanelDevice *)getDevice { return [[AJCPSControlPanelDevice alloc] initWithHandle:self.handle->getDevice()]; } - (const uint16_t)getInterfaceVersion { return self.handle->getInterfaceVersion(); } - (bool)getIsSecured { return self.handle->getIsSecured(); } - (bool)getIsEnabled { return self.handle->getIsEnabled(); } - (bool)getIsWritable { return self.handle->getIsWritable(); } - (uint32_t)getStates { return self.handle->getStates(); } - (uint32_t)getBgColor { return self.handle->getBgColor(); } - (NSString *)getLabel { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getLabel()]; } - (NSArray *)getHints { const std::vector cpp_hints = self.handle->getHints(); NSMutableArray *hints = [[NSMutableArray alloc]init]; if (cpp_hints.size()) { for (int i = 0; i != cpp_hints.size(); i++) { [hints addObject:[NSNumber numberWithShort:cpp_hints.at(i)]]; } } return hints; } - (QStatus)registerObjects:(AJNBusAttachment *)bus atObjectPath:(NSString *)objectPath { ajn::BusAttachment *cpp_bus = (ajn::BusAttachment *)[bus handle]; return self.handle->registerObjects(cpp_bus, [AJNConvertUtil convertNSStringToQCCString:objectPath]); } - (QStatus)refreshObjects:(AJNBusAttachment *)bus { ajn::BusAttachment *cpp_bus = (ajn::BusAttachment *)[bus handle]; return self.handle->refreshObjects(cpp_bus); } - (QStatus)unregisterObjects:(AJNBusAttachment *)bus { ajn::BusAttachment *cpp_bus = (ajn::BusAttachment *)[bus handle]; return self.handle->unregisterObjects(cpp_bus); } @end base-16.04/controlpanel/java/000077500000000000000000000000001272147170000160605ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/000077500000000000000000000000001272147170000217615ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/.classpath000066400000000000000000000010471272147170000237460ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelAdapter/.gitignore000066400000000000000000000001301272147170000237430ustar00rootroot00000000000000local.properties proguard-project.txt .classpath .project *.class *.jar /bin /gen /docs base-16.04/controlpanel/java/ControlPanelAdapter/.project000066400000000000000000000021431272147170000234300ustar00rootroot00000000000000 ControlPanelAdapter ControlPanelService com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature 1369893179588 26 org.eclipse.ui.ide.multiFilter 1.0-name-matches-false-false-.svn base-16.04/controlpanel/java/ControlPanelAdapter/AndroidManifest.xml000066400000000000000000000023721272147170000255560ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelAdapter/build.xml000066400000000000000000000152241272147170000236060ustar00rootroot00000000000000 AllJoyn™ Control Panel Adapter Version 15.04.00]]> AllJoyn™ Control Panel Adapter Java API Reference Manual Version 15.04.00
Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
]]>
base-16.04/controlpanel/java/ControlPanelAdapter/project.properties000066400000000000000000000011101272147170000255360ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 android.library=true base-16.04/controlpanel/java/ControlPanelAdapter/src/000077500000000000000000000000001272147170000225505ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/000077500000000000000000000000001272147170000233375ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/000077500000000000000000000000001272147170000250075ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/000077500000000000000000000000001272147170000255635ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapter/000077500000000000000000000000001272147170000316245ustar00rootroot00000000000000ContainerCreatedListener.java000066400000000000000000000026021272147170000373300ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapter/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpaneladapter; import android.view.View; /** * Implement this interface to receive an event of creating a Root-Container-Element. */ public interface ContainerCreatedListener { /** * This method is called when the Root-Container-Element is created * @param container The container {@link View}. */ void onContainerViewCreated(View container); } ControlPanelAdapter.java000066400000000000000000003241741272147170000363240ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapterpackage org.alljoyn.ioe.controlpaneladapter; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import java.util.Calendar; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.ui.ActionWidget; import org.alljoyn.ioe.controlpanelservice.ui.ActionWidgetHintsType; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget.DialogButton; import org.alljoyn.ioe.controlpanelservice.ui.ContainerWidget; import org.alljoyn.ioe.controlpanelservice.ui.ErrorWidget; import org.alljoyn.ioe.controlpanelservice.ui.LabelWidget; import org.alljoyn.ioe.controlpanelservice.ui.LayoutHintsType; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ConstrainToValues; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.RangeConstraint; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ValueType; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidgetHintsType; import org.alljoyn.ioe.controlpanelservice.ui.UIElement; import org.alljoyn.ioe.controlpanelservice.ui.UIElementType; import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.TypedArray; import android.text.InputFilter; import android.text.InputType; import android.text.Layout; import android.text.Spanned; import android.text.format.DateFormat; import android.util.Log; import android.util.SparseArray; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.DatePicker; import android.widget.EditText; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.NumberPicker; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.ScrollView; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.Spinner; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import android.widget.TimePicker; public class ControlPanelAdapter { private final static String TAG = "cpapp" + ControlPanelAdapter.class.getSimpleName(); private static final Object PROPERTY_VALUE = "property_value"; private static final Object PROPERTY_EDITOR = "property_editor"; /* a context for creating Views */ private final Context uiContext; /* mapping of UIElements to Views that were created by this adapter */ private final Map uiElementToView = new WeakHashMap(10); /* * mapping of AlertDialogWidgets to AlertDialogs that were created by this * adapter */ private final Map alertWidgetToDialog = new WeakHashMap(3); /* App handler for control panel exceptions */ private final ControlPanelExceptionHandler exceptionHandler; /*Time out value to call the ControlPanelService to retrieve a value*/ private long timeoutValue = 4; /*Time out measurement unit to call the ControlPanelService to retrieve a value*/ private TimeUnit timeoutUnit = TimeUnit.SECONDS; // ===================================================================================================================== /** * Constructor * @param uiContext The context of the {@link Activity} hosting the {@link ControlPanelAdapter} * @param exceptionHandler Exceptions listener */ public ControlPanelAdapter(Context uiContext, ControlPanelExceptionHandler exceptionHandler) { if ( uiContext == null || exceptionHandler == null) { throw new IllegalArgumentException("uiContext or exceptionHandler are undefined"); } if ( !(uiContext instanceof Activity) ) { throw new IllegalArgumentException("uiContext should be instance of Activity"); } this.uiContext = uiContext; this.exceptionHandler = exceptionHandler; } // ===================================================================================================================== /** * The maximum time to wait before timing out retrieving the control panel element's current value. * @param timeoutValue The value of the timeout * @param timeoutUnit The {@link TimeUnit} of the timeout value */ public void setTimeout(long timeoutValue, TimeUnit timeoutUnit) { this.timeoutValue = timeoutValue; this.timeoutUnit = timeoutUnit; } // ===================================================================================================================== /** * Creates a {@link Layout} that corresponds with the given ContainerWidget. * Then for each contained widget the corresponded {@link View} is created. * @param container input widget defining a container. * @return a resulting Layout. * @deprecated Use the {@link ControlPanelAdapter#createContainerViewAsync(ContainerWidget, ContainerCreatedListener)} * instead */ @Deprecated public View createContainerView(ContainerWidget container) { if (container == null) { Log.e(TAG, "createContainerView(container==null)"); return null; } Log.w(TAG, "The deprecated createContainerView() methdod has been called, handling"); return createContainerViewImpl(container, new HashMap()); } // ===================================================================================================================== /** * Creates a {@link Layout} that corresponds with the given ContainerWidget. * Then for each contained widget the corresponded {@link View} is created. * The thread that calls this method is released immediately. Once the container {@link Layout} is created * the caller is notified via the {@link ContainerCreatedListener#onContainerViewCreated(View)} method. * @param container input widget defining a container. * @return a resulting Layout. */ public void createContainerViewAsync(final ContainerWidget container, final ContainerCreatedListener contCreateListener) { if (container == null || contCreateListener == null) { throw new IllegalArgumentException("Received an undefined argument"); } Log.i(TAG, "createContainerViewAsync() method has been called, handling"); Runnable task = new Runnable() { @Override public void run() { Map initialData = new HashMap(); ServiceTasksExecutor exec = ServiceTasksExecutor.createExecutor(); traverseContainerElements(container, exec, initialData); retrieveElementsValues(initialData); exec.shutdown(); submitCreateContainerViewTask(container, contCreateListener, initialData); } }; Thread t = new Thread(task); t.start(); } // ===================================================================================================================== /** * Creates a Layout that corresponds with the given ContainerWidget by * iterating the contained widgets and creating the corresponding inner {@link View}s. * The container elements are initialized with the given {@link Map} of the initialData * @param container input widget defining a container. * @param initialData Key: element's object path; Value: element's initial value or NULL * @return a resulting Layout. */ private View createContainerViewImpl(ContainerWidget container, Map initialData) { if (container == null) { Log.e(TAG, "createContainerView(container==null)"); return null; } Log.d(TAG, "Received main container, objPath: '" + container.getObjectPath() + "'"); // the returned Layout object ViewGroup scrollView; LinearLayout containerLayout; ViewGroup.LayoutParams layoutParams; // initialize the container by type List layoutHints = container.getLayoutHints(); Log.d(TAG, "Container has LayoutHints: " + layoutHints); LayoutHintsType layoutHintsType = (layoutHints.size() == 0) ? LayoutHintsType.VERTICAL_LINEAR : layoutHints.get(0); // set the layout switch (layoutHintsType) { case HORIZONTAL_LINEAR: scrollView = new HorizontalScrollView(uiContext); LinearLayout linearLayout = new LinearLayout(uiContext); linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setGravity(Gravity.CENTER_VERTICAL); containerLayout = linearLayout; LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 10, 10, 10); layoutParams = hLinearLayoutParams; break; case VERTICAL_LINEAR: default: scrollView = new ScrollView(uiContext); containerLayout = new LinearLayout(uiContext); containerLayout.setOrientation(LinearLayout.VERTICAL); containerLayout.setGravity(Gravity.LEFT); LinearLayout.LayoutParams vLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); vLinearLayoutParams.setMargins(10, 10, 10, 10); layoutParams = vLinearLayoutParams; // set the inner label if (container.getLabel() != null && container.getLabel().trim().length() > 0) { Log.d(TAG, "Setting container label to: " + container.getLabel()); TextView titleTextView = new TextView(uiContext); titleTextView.setText(container.getLabel()); LinearLayout.LayoutParams textLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); textLayoutParams.setMargins(20, 0, 20, 0); containerLayout.addView(titleTextView, textLayoutParams); } break; } Log.d(TAG, "Initialized Layout of class: " + containerLayout.getClass().getSimpleName()); Log.d(TAG, "Container bgColor: " + container.getBgColor()); // if (container.getBgColor() != null) // containerLayout.setBackgroundColor(container.getBgColor()); // recursively layout the items List elements = container.getElements(); Log.d(TAG, String.format("Laying out %d elements", elements.size())); int i = 0; for (UIElement element : elements) { i++; View childView = createInnerView(element, initialData); containerLayout.addView(childView, layoutParams); if (layoutHintsType == LayoutHintsType.VERTICAL_LINEAR && i < elements.size()) { // add a divider containerLayout.addView(createDividerView(), layoutParams); } }// for :: elements LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); scrollView.addView(containerLayout, linearLayoutParams); boolean enabled = container.isEnabled(); Log.d(TAG, "Container is enabled: '" + enabled + "'"); if (!enabled) { enableViewGroup(scrollView, false); // Only if container is created // as disabled, its children // should be disabled } uiElementToView.put(container.getObjectPath(), scrollView); return scrollView; } // ===================================================================================================================== /** * Traverse container elements and use {@link ControlPanelService} to retrieve data required * for creating the element's {@link View}s. * @param container {@link ContainerWidget} containing the elements * @param exec {@link ServiceTasksExecutor} which is responsible to retrieve the element's data and populate the * {@link Future} object * @param initialData The map that is populated with the element's object path as a key and {@link Future} as a value */ private void traverseContainerElements(ContainerWidget container, ServiceTasksExecutor exec, Map initialData) { List elements = container.getElements(); for (UIElement element : elements) { UIElementType elType = element.getElementType(); //Currently only PropertyWidgets need initial data retrieved by the ControlPanelService via AllJoyn if ( elType == UIElementType.PROPERTY_WIDGET ) { Log.d(TAG, "Found a PropertyWidget objPath: '" + element.getObjectPath() + "', retrieving Future value"); initialData.put(element.getObjectPath(), submitGetPropertyCurrentValueTask(exec, (PropertyWidget)element)); } else if ( elType == UIElementType.CONTAINER ) { traverseContainerElements((ContainerWidget)element, exec, initialData); } } } // ===================================================================================================================== /** * Retrieves initial values of the elements from the {@link Future} object stored in the given initialData {@link Map}. * The values are retrieved by the call {@link Future#get(long, TimeUnit)}. * If an {@link Exception} is thrown while retrieving the value, NULL is stored in the initialData instead of the * real value. */ private void retrieveElementsValues(Map initialData) { Log.d(TAG, "Retrieving initial values of the elements with timeout: '" + timeoutValue + " " + timeoutUnit + "'"); for ( String objPath : initialData.keySet() ) { Object fo = initialData.get(objPath); if ( !(fo instanceof Future) ) { Log.w(TAG, "The objPath: '" + objPath + "' doesn't have a Future object"); initialData.put(objPath, null); continue; } @SuppressWarnings("unchecked") Future futureVal = (Future) fo; Object realValue = null; try { //Blocking call with the given timeout realValue = futureVal.get(timeoutValue, timeoutUnit); Log.d(TAG, "Found an initial value of the element: '" + objPath + "', value: '" + realValue + "'"); } catch(Exception e) { Log.e(TAG, "Failed to retrieve the element's initial value objPath: '" + objPath + "'. Exception: ", e); futureVal.cancel(true); } initialData.put(objPath, realValue); } } // ===================================================================================================================== /** * Submits the {@link PropertyWidget#getCurrentValue()} task to the {@link ServiceTasksExecutor}. * @param exec The executor that executes the task * @param property {@link PropertyWidget} to retrieve the current value * @return {@link Future} of the initial {@link PropertyWidget} value or NULL if failed to submit the retrieval task */ private Future submitGetPropertyCurrentValueTask(ServiceTasksExecutor exec, final PropertyWidget property) { Log.d(TAG, "Prepare a task to call PropertyWidget.getCurrentValue(), property: '" + property.getObjectPath() + "'"); Callable task = new Callable() { @Override public Object call() throws Exception { return property.getCurrentValue(); } }; Future future = null; try { future = exec.submit(task); } catch (Exception e){ Log.d(TAG, "Failed to submit the task to call PropertyWidget.getCurrentValue(), property: '" + property.getObjectPath() + "'", e); } return future; } // ===================================================================================================================== /** * Submit the method {@link ControlPanelAdapter#createContainerViewImpl(ContainerWidget, Map)} to run on UI thread * @param container * @param contCreateListener * @param initialData */ private void submitCreateContainerViewTask(final ContainerWidget container, final ContainerCreatedListener contCreateListener, final Map initialData) { ((Activity)uiContext).runOnUiThread( new Runnable() { @Override public void run() { View containerView = createContainerViewImpl(container, initialData); contCreateListener.onContainerViewCreated(containerView); } }); } // ===================================================================================================================== /** * Creates a list divider for vertical layout * @return A list divider */ private View createDividerView() { View listDivider = new View(uiContext); TypedArray listDividerAttrs = uiContext.getTheme().obtainStyledAttributes(new int[] { android.R.attr.listDivider }); if (listDividerAttrs.length() > 0) { // don't change this to setBackground() it'll fly on run time listDivider.setBackgroundDrawable(listDividerAttrs.getDrawable(0)); } listDividerAttrs.recycle(); return listDivider; } // ===================================================================================================================== /** * Creates an Android View that corresponds with the given UIElement using the given initialData * @param element The {@link UIElement} to create the corresponding {@link View}I * @param initialData * @return an Android View that corresponds with the given abstract UIElement */ private View createInnerView(UIElement element, Map initialData) { UIElementType elementType = element.getElementType(); Log.d(TAG, "Creating an Android View for element of type: '" + elementType + "'"); View returnView = new TextView(uiContext); switch (elementType) { case ACTION_WIDGET: { returnView = createActionView((ActionWidget) element); break; }// ACTION_WIDGET case CONTAINER: { returnView = createContainerViewImpl((ContainerWidget) element, initialData); break; }// CONTAINER // case LIST_PROPERTY_WIDGET: { // break; // }//LIST_PROPERTY_WIDGET case PROPERTY_WIDGET: { //Currently only Properties require initial data for the creation returnView = createPropertyViewImpl((PropertyWidget) element, initialData); break; }// PROPERTY_WIDGET case LABEL_WIDGET: { returnView = createLabelView((LabelWidget) element); break; }// PROPERTY_WIDGET case ERROR_WIDGET: { returnView = createErrorView((ErrorWidget) element); break; }// ERROR_WIDGET default: break; }// switch :: elementType return returnView; } // ===================================================================================================================== /** * Creates an AlertDialog that corresponds with the given AlertDialogWidget * @param alertDialogWidget input abstract widget defining a dialog. * @return an AlertDialog with up to 3 actions. Each action executes a different DialogButton UIElement. */ public AlertDialog createAlertDialog(final AlertDialogWidget alertDialogWidget) { final SparseArray buttonToAction = new SparseArray(3); List execButtons = alertDialogWidget.getExecButtons(); int numOfButtons = alertDialogWidget.getNumActions(); if (numOfButtons > 0) { buttonToAction.put(DialogInterface.BUTTON_POSITIVE, execButtons.get(0)); if (numOfButtons > 1) { buttonToAction.put(DialogInterface.BUTTON_NEGATIVE, execButtons.get(1)); if (numOfButtons > 2) { buttonToAction.put(DialogInterface.BUTTON_NEUTRAL, execButtons.get(2)); } } } // create a confirmation dialog DialogInterface.OnClickListener confirmationListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, final int which) { // handle user choice final DialogButton actionButton = buttonToAction.get(which); Log.d(TAG, "User selected: " + actionButton.getLabel()); // execute the action in a background task ExecuteActionAsyncTask asyncTask = new ExecuteActionAsyncTask() { @Override protected void onFailure(ControlPanelException e) { if (exceptionHandler != null) { exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { } }; asyncTask.execute(actionButton); } }; // show the confirmation dialog Builder builder = new AlertDialog.Builder(uiContext).setMessage(alertDialogWidget.getMessage()).setTitle(alertDialogWidget.getLabel()); if (numOfButtons > 0) { builder.setPositiveButton(buttonToAction.get(DialogInterface.BUTTON_POSITIVE).getLabel(), confirmationListener); if (numOfButtons > 1) { builder.setNegativeButton(buttonToAction.get(DialogInterface.BUTTON_NEGATIVE).getLabel(), confirmationListener); if (numOfButtons > 2) { builder.setNeutralButton(buttonToAction.get(DialogInterface.BUTTON_NEUTRAL).getLabel(), confirmationListener); } } } AlertDialog alertDialog = builder.create(); alertWidgetToDialog.put(alertDialogWidget.getObjectPath(), alertDialog); return alertDialog; } // ===================================================================================================================== /** * Creates a Button for an ActionWidget * @param action the UIElement to be represented by this button. * @return a Button with 2 optional flows corresponding with the ActionWidget definition: * A button that executes an action. Or a button that popsup an "Are You Sure?" dialog. */ public View createActionView(final ActionWidget action) { List hints = action.getHints(); String label = action.getLabel(); Integer bgColor = action.getBgColor(); boolean isEnabled = action.isEnabled(); Log.d(TAG, "Create Action: " + label + " BGColor: " + bgColor + " actionMeta: " + hints + " isEnable: '" + isEnabled + "'"); Button actionButton = new Button(uiContext); actionButton.setText(label); actionButton.setEnabled(isEnabled); // if (bgColor != null) { // Unfortunately button loses its pressed behavior when background is // set. // actionButton.setBackgroundColor(bgColor); // } // register a click listener OnClickListener actionButtonListener = new OnClickListener() { @Override public void onClick(View v) { if ( !action.isEnabled() ) { Log.i(TAG, "ActionWidget is disabled, objPath: '" + action.getObjectPath() + "', not reacting onClick"); return; } // check if action requires an extra confirmation AlertDialogWidget alertDialogWidget = action.getAlertDialog(); if (alertDialogWidget != null) { Log.d(TAG, "Showing confirmation: " + alertDialogWidget.getMessage() + "?"); // create a confirmation dialog AlertDialog confirmationDialog = createAlertDialog(alertDialogWidget); confirmationDialog.show(); } // Confirmation needed else { // No confirmation needed // execute the action in a background task ExecuteActionAsyncTask asyncTask = new ExecuteActionAsyncTask() { @Override protected void onFailure(ControlPanelException e) { if (exceptionHandler != null) { exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { } }; asyncTask.execute(action); } // No confirmation needed } };// new OnClickListener() actionButton.setOnClickListener(actionButtonListener); uiElementToView.put(action.getObjectPath(), actionButton); return actionButton; }// createActionView // ===================================================================================================================== /** * Creates a TextView for a LabelWidget * @param labelWidget the UIElement to be represented by this View * @return a TextView displaying the contents of the LabelWidget */ public View createLabelView(final LabelWidget labelWidget) { String label = labelWidget.getLabel(); Integer bgColor = labelWidget.getBgColor(); Log.d(TAG, "Creating Label: \"" + label + "\" BGColor: " + bgColor); TextView labelView = new TextView(uiContext); labelView.setText(label); // if (bgColor != null) // labelView.setBackgroundColor(bgColor); uiElementToView.put(labelWidget.getObjectPath(), labelView); return labelView; }// createLabelView // ===================================================================================================================== /** * Creates a TextView for a ErrorWidget * @param errorWidget the UIElement to be represented by this View * @return a TextView displaying the label of the ErrorWidget */ public View createErrorView(final ErrorWidget errorWidget) { String label = errorWidget.getLabel(); String errorMessage = errorWidget.getError(); Log.w(TAG, "Creating Error Label: \"" + label + "\" Error: '" + errorMessage + "', Original Element Type: " + errorWidget.getOriginalUIElement()); TextView errorView = new TextView(uiContext); errorView.setText(label); uiElementToView.put(errorWidget.getObjectPath(), errorView); return errorView; }// createErrorView // ===================================================================================================================== // ============================================= PropertyWidget // ======================================================== // ===================================================================================================================== /** * A factory method for creating a View for a given PropertyWidget. * @param propertyWidget the UIElement to be represented by this View * @return a View that represents the property. The type of View corresponds * with the property's hint. */ public View createPropertyView(PropertyWidget propertyWidget) { return createPropertyViewImpl(propertyWidget, new HashMap()); } /** * A factory method for creating a View for a given PropertyWidget. * @param propertyWidget the UIElement to be represented by this View * @param initialData The initialData to initialize the {@link PropertyWidget} * @return a View that represents the property. The type of View corresponds * with the property's hint. */ private View createPropertyViewImpl(PropertyWidget propertyWidget, Map initialData) { ValueType valueType = propertyWidget.getValueType(); List hints = propertyWidget.getHints(); PropertyWidgetHintsType hint = (hints == null || hints.size() == 0) ? null : hints.get(0); Object initialValue = getPropertyInitialValue(propertyWidget, initialData); Log.d(TAG, "Creating a View for property '" + propertyWidget.getLabel() + "', using UI hint: ;" + hint + "', value type: '" + valueType + "' initial value: '" + initialValue + "', objPath: '" + propertyWidget.getObjectPath() + "'"); // default view. just in case... View returnView = new TextView(uiContext); switch (valueType) { case BOOLEAN: // Boolean Property returnView = createCheckBoxView(propertyWidget, initialValue); break; case DATE: // Date Property returnView = createDatePickerView(propertyWidget, initialValue); break; case TIME: // Time Property returnView = createTimePickerView(propertyWidget, initialValue); break; case BYTE: case INT: case SHORT: case LONG: case DOUBLE: // Scalar Property if (hint == null) { Log.d(TAG, "No hint provided for property '" + propertyWidget.getLabel() + "', creating default: NumericView"); returnView = createNumericView(propertyWidget, initialValue); } else { switch (hint) { case SPINNER: returnView = createSpinnerView(propertyWidget, initialValue); break; case RADIO_BUTTON: returnView = createRadioButtonView(propertyWidget, initialValue); break; case NUMBER_PICKER: returnView = createNumberPickerView(propertyWidget, initialValue); break; case NUMERIC_VIEW: returnView = createNumericView(propertyWidget, initialValue); break; case SLIDER: returnView = createSliderView(propertyWidget, initialValue); break; case NUMERIC_KEYPAD: returnView = createNumericKeypadView(propertyWidget, initialValue); break; default: Log.d(TAG, "Unsupported hint provided for property '" + propertyWidget.getLabel() + "', creating default: NumericView"); returnView = createNumericView(propertyWidget, initialValue); break; } } break; case STRING: // String Property if (hint == null) { Log.d(TAG, "No hint provided for property '" + propertyWidget.getLabel() + "', creating default: TextView"); returnView = createTextView(propertyWidget, initialValue); } else { switch (hint) { case SPINNER: returnView = createSpinnerView(propertyWidget, initialValue); break; case RADIO_BUTTON: returnView = createRadioButtonView(propertyWidget, initialValue); break; case EDIT_TEXT: returnView = createEditTextView(propertyWidget, initialValue); break; case TEXT_VIEW: returnView = createTextView(propertyWidget, initialValue); break; default: Log.d(TAG, "Unsupported hint provided for property '" + propertyWidget.getLabel() + "', creating default: TextView"); returnView = createTextView(propertyWidget, initialValue); break; } } break; default: Log.d(TAG, "Received an unsupported ValueType: '" + valueType + "' , returning an empty view"); return returnView; } uiElementToView.put(propertyWidget.getObjectPath(), returnView); return returnView; } /** * Retrieves the initial value from the initialData Map. * If the objectPath isn't stored as the key in the initialData Map, the method * {@link ControlPanelAdapter#submitGetPropertyCurrentValueTask(ServiceTasksExecutor, PropertyWidget)} * is called. Otherwise the value retrieved from the Map is returned. * @param propertyWidget The property to look for in the {@link Map}. * @param initialData The {@link Map} with the initial values * @return Object to initialize the Property Widget {@link View} or NULL. */ private Object getPropertyInitialValue(PropertyWidget propertyWidget, Map initialData) { String objPath = propertyWidget.getObjectPath(); Log.d(TAG, "Searching for the initial value of the property: '" + objPath + "'"); if ( !initialData.containsKey(objPath) ) { //This code may be called when there is a use of the deprecated createContainerView method Log.w(TAG, "The object path: '" + objPath + "' is unknown, submitting PropertyWidget.getCurrentValue()"); ServiceTasksExecutor exec = ServiceTasksExecutor.createExecutor(1); Future fo = submitGetPropertyCurrentValueTask(exec, propertyWidget); try { if ( fo == null ) { return null; } return fo.get(timeoutValue, timeoutUnit); } catch (Exception e) { Log.e(TAG, "Failed to retrieve property's initial value objPath: '" + objPath + "'. Exception: ", e); fo.cancel(true); return null; } finally { exec.shutdown(); } } return initialData.get(objPath); } // ===================================================================================================================== private View createSpinnerView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a spinner for propertyWidget " + propertyWidget.getLabel()); final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.VERTICAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setPadding(10, 0, 0, 0); nameTextView.setText(propertyWidget.getLabel()); final Spinner spinner = new Spinner(uiContext); LinearLayout.LayoutParams vLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layout.addView(nameTextView, vLinearLayoutParams); layout.addView(spinner, vLinearLayoutParams); spinner.setTag(PROPERTY_VALUE); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); // spinner.setEnabled(propertyWidget.isEnabled() && // propertyWidget.isWritable()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); // set the data model final ArrayAdapter adapter = new ArrayAdapter(uiContext, android.R.layout.simple_spinner_item); int selection = 0; if (propertyWidget.getListOfConstraint() != null) { // create a spinner model made of the given ConstrainToValues // entries int position = 0; for (ConstrainToValues valueCons : propertyWidget.getListOfConstraint()) { boolean isDefault = valueCons.getValue().equals(initialValue); Log.d(TAG, "Adding spinner item, Label: " + valueCons.getLabel() + " Value: " + valueCons.getValue() + (isDefault ? " (default)" : "")); adapter.add(new LabelValuePair(valueCons.getLabel(), valueCons.getValue())); if (isDefault) { selection = position; } position++; } } else if (propertyWidget.getPropertyRangeConstraint() != null) { // dynamically create a spinner model made of integers from min to // max RangeConstraint propertyRangeConstraint = propertyWidget.getPropertyRangeConstraint(); ValueType valueType = propertyWidget.getValueType(); Object minT = propertyRangeConstraint.getMin(); int min = ValueType.SHORT.equals(valueType) ? ((Short) minT) : ValueType.INT.equals(valueType) ? ((Integer) minT) : 0; Object maxT = propertyRangeConstraint.getMax(); int max = ValueType.SHORT.equals(valueType) ? ((Short) maxT) : ValueType.INT.equals(valueType) ? ((Integer) maxT) : 0; Object incrementT = propertyRangeConstraint.getIncrement(); int increment = ValueType.SHORT.equals(valueType) ? ((Short) incrementT) : ValueType.INT.equals(valueType) ? ((Integer) incrementT) : 0; int position = 0; for (int i = min; i <= max; i += increment) { boolean isDefault = false; switch (valueType) { case SHORT: short shortI = (short) i; adapter.add(new LabelValuePair(String.valueOf(i), shortI)); isDefault = Short.valueOf(shortI).equals(initialValue); break; case INT: default: { adapter.add(new LabelValuePair(String.valueOf(i), i)); isDefault = Integer.valueOf(i).equals(initialValue); } } Log.d(TAG, "Added spinner item, Value: " + i + (isDefault ? " (default)" : "")); if (isDefault) { selection = position; } position++; } } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setSelection(selection); final int initialSelection = selection; // Unfortunately spinner loses some of its UI components when background // is set. // spinner.setBackgroundColor(property.getBgColor()); // register a selection listener OnItemSelectedListener listener = new OnItemSelectedListener() { int currentSelection = initialSelection; @Override public void onItemSelected(AdapterView parent, View view, final int pos, long id) { if (pos == currentSelection) { Log.d(TAG, String.format("Selected position %d already selected. No action required", pos)); } else { LabelValuePair item = adapter.getItem(pos); // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { spinner.setSelection(currentSelection); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. Store the new value. currentSelection = pos; } }; asyncTask.execute(propertyWidget, item.value); } } @Override public void onNothingSelected(AdapterView parent) { // Another interface callback } }; spinner.setOnItemSelectedListener(listener); return layout; } // ===================================================================================================================== private View createRadioButtonView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a radio button group for property '" + propertyWidget.getLabel() + "'"); // Create external widget layout final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams vLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); // Create internal label/unit of measure layout final LinearLayout innerLayout = new LinearLayout(uiContext); innerLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(innerLayout, vLinearLayoutParams); final TextView nameTextView = new TextView(uiContext); nameTextView.setPadding(10, 0, 0, 0); nameTextView.setText(propertyWidget.getLabel()); innerLayout.addView(nameTextView, hLinearLayoutParams); // Add unit of measure String unitOfMeasure = propertyWidget.getUnitOfMeasure(); if (unitOfMeasure != null && unitOfMeasure.length() > 0) { final TextView unitsOfMeasureTextView = new TextView(uiContext); unitsOfMeasureTextView.setText(unitOfMeasure); innerLayout.addView(unitsOfMeasureTextView, hLinearLayoutParams); } RadioGroup radioGroup = new RadioGroup(uiContext); layout.addView(radioGroup, vLinearLayoutParams); radioGroup.setTag(PROPERTY_VALUE); final List> listOfConstraint = propertyWidget.getListOfConstraint(); if (listOfConstraint != null) { for (ConstrainToValues valueCons : listOfConstraint) { boolean isDefault = valueCons.getValue().equals(initialValue); Log.d(TAG, "Adding radio button, Label: " + valueCons.getLabel() + " Value: " + valueCons.getValue() + (isDefault ? " (default)" : "")); RadioButton radioButton = new RadioButton(uiContext); radioButton.setText(valueCons.getLabel()); LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); radioGroup.addView(radioButton, layoutParams); // check the default value if (isDefault && !radioButton.isChecked()) { radioButton.toggle(); } } }// LOV constraints Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); // radioGroup.setBackgroundColor(propertyWidget.getBgColor()); final int initialCheckedId = radioGroup.getCheckedRadioButtonId(); // register selection listener radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { int currentCheckedId = initialCheckedId; @Override public void onCheckedChanged(final RadioGroup group, final int checkedId) { int index = group.indexOfChild(group.findViewById(checkedId)); if (index > -1) { // Avoid fast consecutive selections. The problem is with // the valueChange events that a controllable device sends // following each selection of the RadioButton. // If a user selects different RadioButton(s) from the group // very fast, the valueChange events start toggling the // RadioGroup automatically for (int i = 0; i < group.getChildCount(); i++) { group.getChildAt(i).setEnabled(false); } group.postDelayed(new Runnable() { @Override public void run() { for (int i = 0; i < group.getChildCount(); i++) { group.getChildAt(i).setEnabled(true); } } }, 1000); ConstrainToValues item = listOfConstraint.get(index); Log.d(TAG, "Selected radio button, Label: '" + item.getLabel() + "' Value: " + item.getValue()); // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { group.check(currentCheckedId); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. Store the new value. currentCheckedId = checkedId; } }; asyncTask.execute(propertyWidget, item.getValue()); } } }); return layout; } // ===================================================================================================================== private CheckBox createCheckBoxView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a checkbox for property " + propertyWidget.getLabel()); CheckBox checkbox = new CheckBox(uiContext); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled() + " InitialValue: '" + initialValue + "'"); // initialize meta data checkbox.setEnabled(propertyWidget.isEnabled() && propertyWidget.isWritable()); // if (propertyWidget.getBgColor() != null) // checkbox.setBackgroundColor(propertyWidget.getBgColor()); // initialize data if (initialValue instanceof Boolean) { checkbox.setChecked((Boolean) initialValue); } checkbox.setText(propertyWidget.getLabel()); // register selection listener OnCheckedChangeListener listener = new OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { // Avoid fast consecutive selections. The problem is with the // valueChange events that a controllable device sends // following each change of the Checkbox state. // If a user selects/unselects checkbox fast, these valueChange // events start toggle the Checkbox state automatically buttonView.setEnabled(false); buttonView.postDelayed(new Runnable() { @Override public void run() { buttonView.setEnabled(true); } }, 1000); // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { buttonView.setChecked(!isChecked); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. } }; asyncTask.execute(propertyWidget, isChecked); } }; checkbox.setOnCheckedChangeListener(listener); return checkbox; } // ===================================================================================================================== private View createTextView(final PropertyWidget propertyWidget, Object initialValue) { String label = propertyWidget.getLabel(); Integer bgColor = propertyWidget.getBgColor(); Log.d(TAG, "Creating TextView: \"" + label + "\" BGColor: " + bgColor); final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(label); layout.addView(nameTextView); final TextView valueTextView = new TextView(uiContext); valueTextView.setTag(PROPERTY_VALUE); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueTextView, hLinearLayoutParams); // if (bgColor != null) // labelView.setBackgroundColor(bgColor); if (initialValue != null) { Log.d(TAG, "Setting property value to: " + initialValue.toString()); valueTextView.setText(initialValue.toString()); } return layout; }// createTextView // ===================================================================================================================== private View createEditTextView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a text editor for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final EditText valueEditText = new EditText(uiContext); valueEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); valueEditText.setTag(PROPERTY_EDITOR); layout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueEditText, hLinearLayoutParams); // initialize meta data // if (propertyWidget.getBgColor() != null) // valueEditText.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); // valueEditText.setEnabled(propertyWidget.isEnabled() && // propertyWidget.isWritable()); // nameTextView.setEnabled(true); final String initialValueStr = initialValue == null ? "" : initialValue.toString(); valueEditText.setText(initialValueStr); // register edit listener valueEditText.setInputType(InputType.TYPE_CLASS_TEXT); // limit the number of characters // editText.setFilters( new InputFilter[] {new // InputFilter.LengthFilter(10)}); valueEditText.setOnEditorActionListener(new OnEditorActionListener() { String currentText = initialValueStr; @Override public boolean onEditorAction(final TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { v.setText(currentText); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. Store the new value. currentText = v.getText().toString(); } }; asyncTask.execute(propertyWidget, v.getText().toString()); } // otherwise keyboard remains up return false; } }); return layout; }// createEditTextView // ===================================================================================================================== private View createNumericKeypadView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a number text editor for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final EditText valueEditText = new EditText(uiContext); valueEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); valueEditText.setTag(PROPERTY_EDITOR); layout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueEditText, hLinearLayoutParams); // initialize meta data // if (propertyWidget.getBgColor() != null) // valueEditText.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); final ValueType valueType = propertyWidget.getValueType(); final Number initialValueNum = (initialValue == null ? 0 : ValueType.SHORT.equals(valueType) ? ((Short) initialValue) : ValueType.INT.equals(valueType) ? ((Integer) initialValue) : 0); valueEditText.setText(String.valueOf(initialValue)); // register edit listener valueEditText.setInputType(InputType.TYPE_CLASS_NUMBER); // limit to Short/Integer MAX_VALUE InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { String insert = source.toString(); String insertInto = dest.toString(); Log.d(TAG, "Trying to insert ' " + insert + "' into '" + insertInto + "' between characters " + dstart + " and " + dend); try { String prefix = insertInto.substring(0, dstart); String suffix = insertInto.substring(dend); String result = prefix + insert + suffix; if (ValueType.SHORT.equals(valueType)) { short input = Short.parseShort(result); Log.d(TAG, "Valid short entered: " + input); // if we got here we're fine. Accept the editing by // returning null return null; } if (ValueType.INT.equals(valueType)) { int input = Integer.parseInt(result); Log.d(TAG, "Valid int entered: " + input); // if we got here we're fine. Accept the editing by // returning null return null; } } catch (NumberFormatException nfe) { Log.e(TAG, "Rejecting insert because'" + nfe.getMessage() + "'"); } // returning "" will reject the editing action return ""; } }; valueEditText.setFilters(new InputFilter[] { filter }); valueEditText.setOnEditorActionListener(new OnEditorActionListener() { Number currentValue = initialValueNum; @Override public boolean onEditorAction(final TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { Number readEnteredValue = null; try { if (ValueType.SHORT == valueType) { readEnteredValue = Short.valueOf(v.getText().toString()); } else if (ValueType.INT == valueType) { readEnteredValue = Integer.valueOf(v.getText().toString()); } } catch (NumberFormatException nfe) { if (ValueType.SHORT == valueType) { Log.e(TAG, "Failed parsing Short: '" + nfe.getMessage() + "' returing to previous value"); } else if (ValueType.INT == valueType) { Log.e(TAG, "Failed parsing Integer: '" + nfe.getMessage() + "' returing to previous value"); } v.setText(String.valueOf(currentValue)); return true; } final Number enteredValue = readEnteredValue; // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { v.setText(String.valueOf(currentValue)); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. Store the new value. currentValue = enteredValue; } }; asyncTask.execute(propertyWidget, enteredValue); } // otherwise keyboard remains up return false; } }); return layout; }// createEditTextView // ===================================================================================================================== private View createTimePickerView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a time picker for property " + propertyWidget.getLabel()); final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final Button valueButton = new Button(uiContext); valueButton.setTag(PROPERTY_VALUE); layout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueButton, hLinearLayoutParams); // initialize meta data // if (propertyWidget.getBgColor() != null) // valueButton.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); // set the current value if (initialValue != null && (ValueType.TIME.equals(propertyWidget.getValueType()))) { PropertyWidget.Time time = (PropertyWidget.Time) initialValue; valueButton.setText(formatTime(time.getHour(), time.getMinute())); } else { Log.e(TAG, "TimePicker property.getValueType() is not TIME, initializing property without current value"); } // register time picker dialog listener final TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { PropertyWidget.Time time = new PropertyWidget.Time(); time.setHour((short) hourOfDay); time.setMinute((short) minute); time.setSecond((short) 0); // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { if (exceptionHandler != null) { // no need to restore value, it hasn't changed. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // don't worry about the result, it will be broadcasted // with ValueChanged // All went well. } }; asyncTask.execute(propertyWidget, time); } }; // register click listener OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View v) { // set the current value ServiceTasksExecutor exec = ServiceTasksExecutor.createExecutor(1); Future futCurrValue = submitGetPropertyCurrentValueTask(exec, propertyWidget); Object currentValue = null; PropertyWidget.Time time; try { if ( futCurrValue != null ) { currentValue = futCurrValue.get(timeoutValue, timeoutUnit); } } catch (Exception e) { Log.e(TAG, "TimePickerView property.getCurrentValue() failed, initializing picker without current value", e); futCurrValue.cancel(true); time = new PropertyWidget.Time(); } if (currentValue != null && (ValueType.TIME.equals(propertyWidget.getValueType()))) { time = (PropertyWidget.Time) currentValue; } else { Log.e(TAG, "TimePickerView property.getValueType() is not TIME, initializing picker without current value"); time = new PropertyWidget.Time(); } // Use the current time as the default values for the picker final Calendar c = Calendar.getInstance(); int hour = currentValue == null ? c.get(Calendar.HOUR_OF_DAY) : time.getHour(); int minute = currentValue == null ? c.get(Calendar.MINUTE) : time.getMinute(); // Pop a TimePickerDialog new TimePickerDialog(uiContext, onTimeSetListener, hour, minute, DateFormat.is24HourFormat(uiContext)).show(); } }; valueButton.setOnClickListener(onClickListener); return layout; }// createTimePickerView // ===================================================================================================================== private View createDatePickerView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a date picker for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final Button valueButton = new Button(uiContext); valueButton.setTag(PROPERTY_VALUE); layout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueButton, hLinearLayoutParams); // initialize meta data // if (propertyWidget.getBgColor() != null) // valueButton.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); if (initialValue != null && (ValueType.DATE.equals(propertyWidget.getValueType()))) { PropertyWidget.Date date = (PropertyWidget.Date) initialValue; valueButton.setText(formatDate(date.getDay(), date.getMonth(), date.getYear())); } else { Log.e(TAG, "DatePicker property.getValueType() is not DATE, initializing property without current value"); } // register time picker dialog listener final DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int day) { PropertyWidget.Date date = new PropertyWidget.Date(); // DatePicker enums months from 0..11 :( month++; date.setDay((short) day); date.setMonth((short) month); date.setYear((short) year); // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { if (exceptionHandler != null) { // no need to restore value, it hasn't changed. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // don't worry about the result, it will be broadcasted // with ValueChanged // All went well. } }; asyncTask.execute(propertyWidget, date); } }; // register click listener OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View v) { // set the current value ServiceTasksExecutor exec = ServiceTasksExecutor.createExecutor(1); Future futCurrValue = submitGetPropertyCurrentValueTask(exec, propertyWidget); Object currentValue = null; PropertyWidget.Date date; try { if ( futCurrValue != null) { currentValue = futCurrValue.get(timeoutValue, timeoutUnit); } } catch (Exception e) { Log.e(TAG, "DatePickerView property.getCurrentValue() failed, initializing picker without current value", e); futCurrValue.cancel(true); date = new PropertyWidget.Date(); } finally { exec.shutdown(); } if (currentValue != null && (ValueType.DATE.equals(propertyWidget.getValueType()))) { date = (PropertyWidget.Date) currentValue; } else { Log.e(TAG, "property.getValueType() is not DATE, initializing picker without current value"); date = new PropertyWidget.Date(); } // Use the current date as the default values for the picker final Calendar c = Calendar.getInstance(); int day = currentValue == null ? c.get(Calendar.DAY_OF_MONTH) : date.getDay(); int month = currentValue == null ? c.get(Calendar.MONTH) : date.getMonth(); int year = currentValue == null ? c.get(Calendar.YEAR) : date.getYear(); // DatePicker enums months from 0..11 :( month--; // Pop a DatePickerDialog new DatePickerDialog(uiContext, onDateSetListener, year, month, day).show(); } }; valueButton.setOnClickListener(onClickListener); return layout; }// createTimePickerView // ===================================================================================================================== private View createNumberPickerView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a number picker for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.VERTICAL); final LinearLayout innerLayout = new LinearLayout(uiContext); innerLayout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final TextView valueTextView = new TextView(uiContext); valueTextView.setTag(PROPERTY_VALUE); final TextView unitsOfMeasureTextView = new TextView(uiContext); innerLayout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); innerLayout.addView(valueTextView, hLinearLayoutParams); innerLayout.addView(unitsOfMeasureTextView, hLinearLayoutParams); LinearLayout.LayoutParams vLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layout.addView(innerLayout, vLinearLayoutParams); ValueType valueType = propertyWidget.getValueType(); final int initialValueNum = (initialValue == null ? 0 : ValueType.SHORT.equals(valueType) ? ((Short) initialValue) : ValueType.INT.equals(valueType) ? ((Integer) initialValue) : 0); Log.d(TAG, "number picker initial value is: " + initialValueNum); valueTextView.setText(String.valueOf(initialValueNum)); String unitOfMeasure = propertyWidget.getUnitOfMeasure(); Log.d(TAG, "Setting property units of measure to: " + unitOfMeasure); unitsOfMeasureTextView.setText(unitOfMeasure); RangeConstraint propertyRangeConstraint = propertyWidget.getPropertyRangeConstraint(); if (propertyRangeConstraint == null) { Log.e(TAG, "Found null property-range. Disabling Number Picker. Returning a plain label."); valueTextView.setEnabled(false); return layout; } Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); // Number picker only works for Honeycomb(API 11) and above if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { final NumberPicker picker = new NumberPicker(uiContext); picker.setTag(PROPERTY_EDITOR); layout.addView(picker, vLinearLayoutParams); Object minT = propertyRangeConstraint.getMin(); Log.d(TAG, "number picker min value is: " + minT.toString()); final int min = ValueType.SHORT.equals(valueType) ? ((Short) minT) : ValueType.INT.equals(valueType) ? ((Integer) minT) : 0; Object maxT = propertyRangeConstraint.getMax(); Log.d(TAG, "number picker max value is: " + maxT.toString()); int max = ValueType.SHORT.equals(valueType) ? ((Short) maxT) : ValueType.INT.equals(valueType) ? ((Integer) maxT) : 0; picker.setValue(initialValueNum); picker.setMinValue(min); picker.setMaxValue(max); picker.setWrapSelectorWheel(true); picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { public void onValueChange(NumberPicker picker, int oldVal, int newVal) { Log.d(TAG, "New value is: " + newVal); valueTextView.setText(String.valueOf(newVal)); } }); } return layout; } // ===================================================================================================================== private View createNumericView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a numberic view for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final TextView valueTextView = new TextView(uiContext); valueTextView.setTag(PROPERTY_VALUE); layout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); layout.addView(valueTextView, hLinearLayoutParams); // initialize meta data // if (propertyWidget.getBgColor() != null) // valueTextView.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); if (initialValue != null) { Log.d(TAG, "Setting property value to: " + initialValue.toString()); valueTextView.setText(initialValue.toString()); } return layout; } // ===================================================================================================================== private View createSliderView(final PropertyWidget propertyWidget, Object initialValue) { Log.d(TAG, "Creating a slider for property " + propertyWidget.getLabel()); // create the label final LinearLayout layout = new LinearLayout(uiContext); layout.setOrientation(LinearLayout.VERTICAL); final LinearLayout innerLayout = new LinearLayout(uiContext); innerLayout.setOrientation(LinearLayout.HORIZONTAL); final TextView nameTextView = new TextView(uiContext); nameTextView.setText(propertyWidget.getLabel()); final TextView valueTextView = new TextView(uiContext); valueTextView.setTag(PROPERTY_VALUE); final TextView unitsOfMeasureTextView = new TextView(uiContext); final SeekBar slider = new SeekBar(uiContext); slider.setTag(PROPERTY_EDITOR); innerLayout.addView(nameTextView); LinearLayout.LayoutParams hLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); hLinearLayoutParams.setMargins(10, 0, 0, 0); innerLayout.addView(valueTextView, hLinearLayoutParams); innerLayout.addView(unitsOfMeasureTextView, hLinearLayoutParams); LinearLayout.LayoutParams vLinearLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layout.addView(innerLayout, vLinearLayoutParams); layout.addView(slider, vLinearLayoutParams); // initialize meta data // valueTextView.setBackgroundColor(propertyWidget.getBgColor()); Log.d(TAG, "Property isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); enableViewGroup(layout, propertyWidget.isEnabled() && propertyWidget.isWritable()); String unitOfMeasure = propertyWidget.getUnitOfMeasure(); Log.d(TAG, "Setting property units of measure to: " + unitOfMeasure); unitsOfMeasureTextView.setText(unitOfMeasure); RangeConstraint propertyRangeConstraint = propertyWidget.getPropertyRangeConstraint(); if (propertyRangeConstraint == null) { Log.e(TAG, "Found null property-range. Disabling Slider. Returning a plain label."); return new TextView(uiContext); } // set the current value ValueType valueType = propertyWidget.getValueType(); final int initialValueNum = (initialValue == null ? 0 : ValueType.SHORT.equals(valueType) ? ((Short) initialValue) : ValueType.INT.equals(valueType) ? ((Integer) initialValue) : 0); // !!! Android sliders always start from 0 !!! Object minT = propertyRangeConstraint.getMin(); final int min = ValueType.SHORT.equals(valueType) ? ((Short) minT) : ValueType.INT.equals(valueType) ? ((Integer) minT) : 0; Object maxT = propertyRangeConstraint.getMax(); int max = ValueType.SHORT.equals(valueType) ? ((Short) maxT) : ValueType.INT.equals(valueType) ? ((Integer) maxT) : 0; Object incrementT = propertyRangeConstraint.getIncrement(); final int increment = ValueType.SHORT.equals(valueType) ? ((Short) incrementT) : ValueType.INT.equals(valueType) ? ((Integer) incrementT) : 0; // because the minimum value in android always starts from 0, we move // the max value to persist the min,max range max -= min; slider.setMax(max); slider.setKeyProgressIncrement(increment); final int initialValueTrans = initialValueNum - min; Log.d(TAG, "Setting property value to: " + String.valueOf(initialValueNum) + " Slider value: '" + initialValueTrans + "'"); slider.setProgress(initialValueTrans); valueTextView.setText(String.valueOf(initialValueNum)); slider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { int currentProgress = initialValueTrans; final int listenMin = min; @Override public void onStopTrackingTouch(final SeekBar seekBar) { // set the property in a background task SetPropertyAsyncTask asyncTask = new SetPropertyAsyncTask() { @Override protected void onFailure(ControlPanelException e) { seekBar.setProgress(currentProgress); valueTextView.setText(String.valueOf(currentProgress + listenMin)); if (exceptionHandler != null) { // An exception was thrown. Restore old value. exceptionHandler.handleControlPanelException(e); } } @Override protected void onSuccess() { // All went well. Store the new value. currentProgress = seekBar.getProgress(); } }; int progress = seekBar.getProgress(); int valueToUpdate = progress + listenMin; Log.d(TAG, "The slider progress: '" + progress + "' valueToUpdate: '" + valueToUpdate + "'"); asyncTask.execute(propertyWidget, valueToUpdate); }// onStopTrackingTouch @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { valueTextView.setText(String.valueOf(progress + listenMin)); } }); return layout; } // ===================================================================================================================== /** * A callback that is invoked when the meta data of a UIElement has changed. * Refreshes the UIElement and the corresponding View. * * @param element * the abstract UIElement */ public void onMetaDataChange(UIElement element) { UIElementType elementType = element.getElementType(); Log.d(TAG, "Refreshing the Android View for element : '" + element.getObjectPath() + "'"); switch (elementType) { case ACTION_WIDGET: { onActionMetaDataChange((ActionWidget) element); break; }// ACTION_WIDGET case CONTAINER: { onContainerMetaDataChange((ContainerWidget) element); break; }// CONTAINER // case LIST_PROPERTY_WIDGET: { // break; // }//LIST_PROPERTY_WIDGET case PROPERTY_WIDGET: { onPropertyMetaDataChange((PropertyWidget) element); break; }// PROPERTY_WIDGET case ALERT_DIALOG: { onAlertDialogMetaDataChange((AlertDialogWidget) element); break; }// PROPERTY_WIDGET default: break; }// switch :: elementType } // ===================================================================================================================== private void onContainerMetaDataChange(ContainerWidget container) { if (container == null) { Log.e(TAG, "onContainerMetaDataChange"); return; } // get a handle to the corresponding view ViewGroup containerLayout = (ViewGroup) uiElementToView.get(container.getObjectPath()); if (containerLayout == null) { Log.d(TAG, "ViewGroup not found for widget " + container.getObjectPath()); return; } boolean enabled = container.isEnabled(); Log.d(TAG, "Refreshing ContainerWidget bgColor: " + container.getBgColor() + " enabled: " + enabled); // if (container.getBgColor() != null) // containerLayout.setBackgroundColor(container.getBgColor()); if (enabled && !containerLayout.isEnabled()) { enableViewGroup(containerLayout, true); } else if (!enabled && containerLayout.isEnabled()) { enableViewGroup(containerLayout, false); } } // ===================================================================================================================== private void onActionMetaDataChange(final ActionWidget actionWidget) { // get a handle to the corresponding view Button actionButton = (Button) uiElementToView.get(actionWidget.getObjectPath()); if (actionButton == null) { Log.d(TAG, "Button not found for widget " + actionWidget.getObjectPath()); return; } String label = actionWidget.getLabel(); Integer bgColor = actionWidget.getBgColor(); boolean enabled = actionWidget.isEnabled(); Log.d(TAG, "Refreshing ActionWidget: Label: " + label + " BGColor: " + bgColor + " Enabled: " + enabled); actionButton.setText(label); actionButton.setEnabled(enabled); // if (bgColor != null) { // Unfortunately button loses its pressed behavior when background is // set. // actionButton.setBackgroundColor(bgColor); // } }// onActionMetaDataChange // ===================================================================================================================== private void onAlertDialogMetaDataChange(final AlertDialogWidget alertDialogWidget) { // get a handle to the corresponding AlertDialog AlertDialog alertDialog = alertWidgetToDialog.get(alertDialogWidget.getObjectPath()); if (alertDialog == null) { Log.d(TAG, "AlertDialog not found for widget " + alertDialogWidget.getObjectPath()); return; } if (!alertDialogWidget.isEnabled() && alertDialog.isShowing()) { Log.d(TAG, "Dismissing AlertDialog"); alertDialog.dismiss(); } }// onAlertDialogMetaDataChange // ===================================================================================================================== private void onPropertyMetaDataChange(PropertyWidget propertyWidget) { // get a handle to the corresponding view View propertyView = uiElementToView.get(propertyWidget.getObjectPath()); if (propertyView == null) { Log.d(TAG, "Property View not found for widget " + propertyWidget.getObjectPath()); return; } Log.d(TAG, "Refreshing the view of property '" + propertyWidget.getLabel() + "' isWritable? " + propertyWidget.isWritable() + ", isEnabled? " + propertyWidget.isEnabled()); // Set enable/disable property if (propertyView instanceof ViewGroup) { enableViewGroup(propertyView, propertyWidget.isEnabled() && propertyWidget.isWritable()); }// if :: ViewGroup else { propertyView.setEnabled(propertyWidget.isEnabled() && propertyWidget.isWritable()); } // if (!(propertyView instanceof Spinner)) { // if (propertyWidget.getBgColor() != null) // propertyView.setBackgroundColor(propertyWidget.getBgColor()); // } } /** * Iteration over the given {@link ViewGroup} and set it enable/disable state * @param propertyView {@link ViewGroup} to set its enable/disable state * @param enable */ private void enableViewGroup(View propertyView, boolean enable) { if (!(propertyView instanceof ViewGroup)) { Log.w(TAG, "The given propertyView is no intanceof ViewGroup"); return; } ViewGroup viewGroup = (ViewGroup) propertyView; for (int i = 0; i < viewGroup.getChildCount(); ++i) { View element = viewGroup.getChildAt(i); if (element instanceof ViewGroup) { enableViewGroup(element, enable); } if (PROPERTY_EDITOR.equals(element.getTag())) { element.setEnabled(enable); } }// for :: viewGroup viewGroup.setEnabled(enable); }// enableViewGroup // ===================================================================================================================== /** * A callback that is invoked when a value of a UIElement has changed. * Refreshes the UIElement and the corresponding View. * @param element the abstract UIElement * @param newValue the new value */ public void onValueChange(UIElement element, Object newValue) { UIElementType elementType = element.getElementType(); Log.d(TAG, "Value changed for the Android View for element : '" + element.getObjectPath() + "', newValue: '" + newValue); switch (elementType) { case PROPERTY_WIDGET: { onPropertyValueChange((PropertyWidget) element, newValue); break; }// PROPERTY_WIDGET case ACTION_WIDGET: { Log.d(TAG, "Ignoring change of value for action : '" + element.getObjectPath() + "'"); break; }// ACTION_WIDGET case CONTAINER: { Log.d(TAG, "Ignoring change of value for container : '" + element.getObjectPath() + "'"); break; }// CONTAINER // case LIST_PROPERTY_WIDGET: { // break; // }//LIST_PROPERTY_WIDGET default: break; }// switch :: elementType } // ===================================================================================================================== /** * A callback that is invoked when a value of a property has changed. * Refreshes the property and the corresponding View. * @param propertyWidget the property whose value has changed. * @param newValue new value for the property */ private void onPropertyValueChange(PropertyWidget propertyWidget, Object newValue) { // get a handle to the corresponding view View propertyView = uiElementToView.get(propertyWidget.getObjectPath()); if (propertyView == null) { Log.d(TAG, "Property View not found for widget " + propertyWidget.getObjectPath()); return; } if (newValue == null) { Log.e(TAG, "onPropertyValueChange() failed, new value is null"); // ==== return; } ValueType valueType = propertyWidget.getValueType(); List hints = propertyWidget.getHints(); PropertyWidgetHintsType hint = (hints == null || hints.size() == 0) ? null : hints.get(0); Log.d(TAG, "Refreshing the View for property '" + propertyWidget.getLabel() + "' , using UI hint: " + hint + ", value type: '" + valueType + "', objPath: '" + propertyWidget.getObjectPath() + "'" + "', newValue: '" + newValue); switch (valueType) { case BOOLEAN: // Boolean Property onCheckBoxValueChange(propertyView, propertyWidget, newValue); break; case DATE: // Date Property onDateValueChange(propertyView, propertyWidget, newValue); break; case TIME: // Time Property onTimeValueChange(propertyView, propertyWidget, newValue); break; case BYTE: case INT: case SHORT: case LONG: case DOUBLE: // Scalar Property if (hint == null) { onNumericViewValueChange(propertyView, propertyWidget, newValue); } else { switch (hint) { case SPINNER: onSpinnerValueChange(propertyView, propertyWidget, newValue); break; case RADIO_BUTTON: onRadioButtonValueChange(propertyView, propertyWidget, newValue); break; case NUMBER_PICKER: onNumberPickerValueChange(propertyView, propertyWidget, newValue); break; case NUMERIC_VIEW: onNumericViewValueChange(propertyView, propertyWidget, newValue); break; case SLIDER: onSliderValueChange(propertyView, propertyWidget, newValue); break; case NUMERIC_KEYPAD: onNumericKeypadValueChange(propertyView, propertyWidget, newValue); break; default: onNumericViewValueChange(propertyView, propertyWidget, newValue); break; } } break; case STRING: // String Property if (hint == null) { Log.d(TAG, "No hint provided for property '" + propertyWidget.getLabel() + "', creating default: TextView"); onTextViewValueChange(propertyView, propertyWidget, newValue); } else { switch (hint) { case SPINNER: onSpinnerValueChange(propertyView, propertyWidget, newValue); break; case RADIO_BUTTON: onRadioButtonValueChange(propertyView, propertyWidget, newValue); break; case EDIT_TEXT: onEditTextValueChange(propertyView, propertyWidget, newValue); break; case TEXT_VIEW: onTextViewValueChange(propertyView, propertyWidget, newValue); break; default: onTextViewValueChange(propertyView, propertyWidget, newValue); break; } } break; default: Log.d(TAG, "Received an unsupported ValueType: '" + valueType + "' , not refreshing any view"); break; } } // ===================================================================================================================== private void onSliderValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue2) { ViewGroup layout = (ViewGroup) propertyView; final TextView valueTextView = (TextView) layout.findViewWithTag(PROPERTY_VALUE); final SeekBar slider = (SeekBar) layout.findViewWithTag(PROPERTY_EDITOR); Log.d(TAG, "Refreshing the value of property " + propertyWidget.getLabel()); // set the current value ValueType valueType = propertyWidget.getValueType(); int newValue = -1; switch (valueType) { case SHORT: newValue = (Short) newValue2; break; case INT: newValue = (Integer) newValue2; break; default: Log.e(TAG, "property.getValueType() has unexpected value type: " + valueType); // ==== return; } // set value RangeConstraint rangeCons = propertyWidget.getPropertyRangeConstraint(); if (rangeCons == null) { Log.e(TAG, "Found null property-range nothing to do with it..."); return; } Object minT = rangeCons.getMin(); final int min = ValueType.SHORT.equals(valueType) ? ((Short) minT) : ValueType.INT.equals(valueType) ? ((Integer) minT) : 0; valueTextView.setText(String.valueOf(newValue)); slider.setProgress(newValue - min); } // ===================================================================================================================== private void onCheckBoxValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the CheckBox of property " + propertyWidget.getLabel()); CheckBox checkbox = (CheckBox) propertyView; ValueType valueType = propertyWidget.getValueType(); // set checked if (ValueType.BOOLEAN.equals(valueType)) { checkbox.setChecked((Boolean) newValue); } else { Log.e(TAG, "property.getCurrentValue() failed, cannot update property with value: " + newValue); } } // ===================================================================================================================== private void onTextViewValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { String label = propertyWidget.getLabel(); Log.d(TAG, "Refreshing the TextView of property '" + label + "'"); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final TextView valueTextView = (TextView) layout.findViewWithTag(PROPERTY_VALUE); // set the current value String newValueStr = newValue.toString(); Log.d(TAG, "Setting property value to: '" + newValueStr + "'"); valueTextView.setText(newValueStr); } // ===================================================================================================================== private void onNumericViewValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the NumericView of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final TextView valueTextView = (TextView) layout.findViewWithTag(PROPERTY_VALUE); // set the current value Log.d(TAG, "Setting property value to: " + newValue.toString()); valueTextView.setText(newValue.toString()); } // ===================================================================================================================== private void onNumberPickerValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the NumericPicker of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final TextView valueTextView = (TextView) layout.findViewWithTag(PROPERTY_VALUE); // set the current value Log.d(TAG, "Setting property value to: " + newValue.toString()); valueTextView.setText(newValue.toString()); } // ===================================================================================================================== private void onNumericKeypadValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the NumericKeypad View of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final EditText valueEditText = (EditText) layout.findViewWithTag(PROPERTY_EDITOR); // set the current value Log.d(TAG, "Setting property value to: " + newValue.toString()); valueEditText.setText(newValue.toString()); } // ===================================================================================================================== private void onTimeValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the Time View of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final Button valueButton = (Button) layout.findViewWithTag(PROPERTY_VALUE); // set the current value if (ValueType.TIME.equals(propertyWidget.getValueType())) { PropertyWidget.Time time = (PropertyWidget.Time) newValue; String formattedTime = formatTime(time.getHour(), time.getMinute()); Log.d(TAG, "Setting property value to: " + formattedTime); valueButton.setText(formattedTime); } else { Log.e(TAG, "property.getValueType() is not TIME, cannot update property with new value: " + newValue); } } // ===================================================================================================================== private void onDateValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the Date View of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final Button valueButton = (Button) layout.findViewWithTag(PROPERTY_VALUE); // set the current value if (ValueType.DATE.equals(propertyWidget.getValueType())) { PropertyWidget.Date date = (PropertyWidget.Date) newValue; String formattedDate = formatDate(date.getDay(), date.getMonth(), date.getYear()); Log.d(TAG, "Setting property value to: " + formattedDate); valueButton.setText(formattedDate); } else { Log.e(TAG, "property.getValueType() is not DATE, cannot update property with current value: " + newValue); } } // ===================================================================================================================== private void onEditTextValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the EditText View of property " + propertyWidget.getLabel()); // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final EditText valueEditText = (EditText) layout.findViewWithTag(PROPERTY_EDITOR); // set the current value Log.d(TAG, "Setting property value to: " + newValue.toString()); valueEditText.setText(newValue.toString()); } // ===================================================================================================================== private void onSpinnerValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { // extract the text view final ViewGroup layout = (ViewGroup) propertyView; final Spinner spinner = (Spinner) layout.findViewWithTag(PROPERTY_VALUE); Log.d(TAG, "Refreshing the spinner of property " + propertyWidget.getLabel()); // set the selected item int selection = 0; @SuppressWarnings("unchecked") final ArrayAdapter adapter = (ArrayAdapter) spinner.getAdapter(); for (int i = 0; i < adapter.getCount(); i++) { LabelValuePair item = adapter.getItem(i); if (item != null && item.value.equals(newValue)) { selection = i; break; } } spinner.setSelection(selection); adapter.notifyDataSetChanged(); } // ===================================================================================================================== private void onRadioButtonValueChange(View propertyView, PropertyWidget propertyWidget, Object newValue) { Log.d(TAG, "Refreshing the RadioButton of property '" + propertyWidget.getLabel() + "', new value: " + newValue); final ViewGroup layout = (ViewGroup) propertyView; final RadioGroup radioGroup = (RadioGroup) layout.findViewWithTag(PROPERTY_VALUE); // set the selected item int selection = 0; final List> listOfConstraint = propertyWidget.getListOfConstraint(); if (listOfConstraint != null) { for (ConstrainToValues valueCons : listOfConstraint) { boolean selectThis = valueCons.getValue().equals(newValue); // check the default value if (selectThis) { Log.d(TAG, "Selecting radio button, Label: " + valueCons.getLabel() + " Value: " + valueCons.getValue()); RadioButton radioButton = (RadioButton) radioGroup.getChildAt(selection); if (!radioButton.isChecked()) { radioButton.setChecked(true); } } else { selection++; } } }// LOV constraints } // ===================================================================================================================== /** * A wrapper class for hosting a {label,value} pair inside an ArrayAdapter. * So that the label is displayed, while practically the real value is used. */ class LabelValuePair { final String label; final Object value; public LabelValuePair(String label, Object value) { super(); this.value = value; this.label = label; } @Override // This does the trick of displaying the label and not the value in the // Adapter public String toString() { return label; } } /** * A utility method that formats time for display, following the user's * locale as given by context * @param hour * @param minute * @return */ private String formatTime(short hour, short minute) { Calendar calendar = new GregorianCalendar(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minute); return DateFormat.getTimeFormat(uiContext.getApplicationContext()).format(calendar.getTime()); // return String.format("%02d", hour) + ":" + String.format("%02d", // minute); } /** * A utility method that formats dates for display, following the user's * locale as given by context * @param day * @param month * @param year * @return */ private String formatDate(short day, short month, short year) { // GregorianCalendar enums months from 0..11 month--; Calendar calendar = new GregorianCalendar(year, month, day); return DateFormat.getDateFormat(uiContext.getApplicationContext()).format(calendar.getTime()); } } ControlPanelExceptionHandler.java000066400000000000000000000022501272147170000401640ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapterpackage org.alljoyn.ioe.controlpaneladapter; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import org.alljoyn.ioe.controlpanelservice.ControlPanelException; public interface ControlPanelExceptionHandler { public void handleControlPanelException(ControlPanelException e); } ExecuteActionAsyncTask.java000066400000000000000000000056071272147170000370010ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapterpackage org.alljoyn.ioe.controlpaneladapter; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ui.ActionWidget; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget.DialogButton; import android.os.AsyncTask; import android.util.Log; /** * A Utility class that has 2 functions: * 1. Executing an action on the remote device, in a background process, to free the UI thread. * 2. Notifying the caller about the result. */ abstract class ExecuteActionAsyncTask extends AsyncTask { private final static String TAG = "cpapp" + ExecuteActionAsyncTask.class.getSimpleName(); @Override /** * This background processor assumes params[0] to be a ActionWidget or DialogButton. */ protected ControlPanelException doInBackground(Object... params) { try { if (params[0] instanceof ActionWidget) { ActionWidget actionWidget = (ActionWidget) params[0]; Log.d(TAG, String.format("Executing action '%s'", actionWidget.getLabel())); actionWidget.exec(); Log.d(TAG, "Action executed"); } else if (params[0] instanceof DialogButton) { DialogButton dialogButton = (DialogButton) params[0]; Log.d(TAG, String.format("Executing action '%s'", dialogButton.getLabel())); dialogButton.exec(); Log.d(TAG, "Action executed"); } } catch (ControlPanelException e) { Log.e(TAG, "Failed executing the action, error in calling remote object: '" + e.getMessage() + "'"); return e; } return null; // No exception...ok! } @Override /** * Exception means failure. Otherwise - success. */ protected void onPostExecute(ControlPanelException e) { if (e != null) { onFailure(e); } else { onSuccess(); } } /** * Notify the caller about an exception. */ abstract protected void onFailure(ControlPanelException e); /** * Notify the caller about success. */ abstract protected void onSuccess(); } ServiceTasksExecutor.java000066400000000000000000000066461272147170000365510ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapter/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpaneladapter; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; import android.util.Log; /** * Executes {@link Callable} tasks. * The class is initialized with a given number of threads or with {@link ServiceTasksExecutor#NUM_THREADS_DEFAULT} */ public class ServiceTasksExecutor { private final static String TAG = "cpapp" + ServiceTasksExecutor.class.getSimpleName(); /** * Default number of threads */ private static final int NUM_THREADS_DEFAULT = 2; /** * Executor service */ private final ExecutorService executor; /** * Create the {@link ServiceTasksExecutor} with {@link ServiceTasksExecutor#NUM_THREADS_DEFAULT} * @return {@link ServiceTasksExecutor} */ public static ServiceTasksExecutor createExecutor(){ return createExecutor(NUM_THREADS_DEFAULT); } /** * Create the {@link ServiceTasksExecutor} with the given number of threads. * @param numThreads Create the executor with the given number of threads * @return {@link ServiceTasksExecutor} */ public static ServiceTasksExecutor createExecutor(int numThreads){ return new ServiceTasksExecutor(numThreads); } /** * Constructor */ private ServiceTasksExecutor(int numThreads) { Log.d(TAG, "Creating ServiceTaskExecutor with numThreads: '" + numThreads + "'"); executor = Executors.newFixedThreadPool(numThreads); } /** * Do the best effort to shutdown the executor. * @see ExecutorService#shutdownNow() */ public void shutdown() { Log.d(TAG, "Shutting down the ServiceTaskExecutor"); executor.shutdownNow(); } /** * Submit the given task for execution * @param task The {@link Callable} task to execute * @return {@link Future} of the submitted object * @throws IllegalArgumentException if the given task in NULL * @throws RejectedExecutionException * @see ExecutorService#submit(Callable) */ public Future submit(Callable task) { if ( task == null ) { throw new IllegalArgumentException("task is indefined"); } return executor.submit(task); } } SetPropertyAsyncTask.java000066400000000000000000000051601272147170000365330ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelAdapter/src/org/alljoyn/ioe/controlpaneladapterpackage org.alljoyn.ioe.controlpaneladapter; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget; import android.os.AsyncTask; import android.util.Log; /** * A Utility class that has 2 functions: * 1. Executing an action on the remote device, in a background process, to free the UI thread. * 2. Notifying the caller about the result. */ abstract class SetPropertyAsyncTask extends AsyncTask { private final static String TAG = "cpapp" + SetPropertyAsyncTask.class.getSimpleName(); @Override /** * This background processor assumes params[0] to be a PropertyWidget and params[1] to be the value Object. */ public ControlPanelException doInBackground(Object... params) { PropertyWidget propertyWidget = (PropertyWidget) params[0]; Object value = params[1]; Log.d(TAG, String.format("Setting property %s to value %s", propertyWidget.getLabel(), value.toString())); try { propertyWidget.setCurrentValue(value); Log.d(TAG, "Property successfully set"); } catch (ControlPanelException e) { Log.e(TAG, "Failed setting property, error in calling remote object: '" + e.getMessage() + "'"); return e; } return null; // No exception...ok! } @Override /** * Exception means failure. Otherwise - success. */ protected void onPostExecute(ControlPanelException e) { if (e != null) { onFailure(e); } else { onSuccess(); } } /** * Notify the caller about an exception. */ abstract protected void onFailure(ControlPanelException e); /** * Notify the caller about success. */ abstract protected void onSuccess(); } base-16.04/controlpanel/java/ControlPanelService/000077500000000000000000000000001272147170000220015ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/.classpath000066400000000000000000000013531272147170000237660ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/.project000066400000000000000000000014661272147170000234570ustar00rootroot00000000000000 ControlPanelService com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature base-16.04/controlpanel/java/ControlPanelService/.settings/000077500000000000000000000000001272147170000237175ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000003201272147170000306740ustar00rootroot00000000000000#Tue Apr 23 10:24:42 IDT 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.source=1.6 base-16.04/controlpanel/java/ControlPanelService/AndroidManifest.xml000066400000000000000000000042651272147170000256010ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/build.xml000066400000000000000000000172151272147170000236300ustar00rootroot00000000000000 AllJoyn™ Control Panel Service Version 15.04.00]]> AllJoyn™ Control Panel Service Java API Reference Manual Version 15.04.00
Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
]]>
base-16.04/controlpanel/java/ControlPanelService/ic_launcher-web.png000066400000000000000000000030601272147170000255350ustar00rootroot00000000000000PNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`base-16.04/controlpanel/java/ControlPanelService/project.properties000066400000000000000000000011111272147170000255570ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 android.library=false base-16.04/controlpanel/java/ControlPanelService/res/000077500000000000000000000000001272147170000225725ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/drawable-hdpi/000077500000000000000000000000001272147170000252755ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/drawable-hdpi/ic_launcher.png000066400000000000000000000022661272147170000302650ustar00rootroot00000000000000PNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`base-16.04/controlpanel/java/ControlPanelService/res/drawable-ldpi/000077500000000000000000000000001272147170000253015ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/drawable-ldpi/ic_launcher.png000066400000000000000000000022661272147170000302710ustar00rootroot00000000000000PNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`base-16.04/controlpanel/java/ControlPanelService/res/drawable-mdpi/000077500000000000000000000000001272147170000253025ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/drawable-mdpi/ic_launcher.png000066400000000000000000000022661272147170000302720ustar00rootroot00000000000000PNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`base-16.04/controlpanel/java/ControlPanelService/res/drawable-xhdpi/000077500000000000000000000000001272147170000254655ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/drawable-xhdpi/ic_launcher.png000066400000000000000000000030601272147170000304460ustar00rootroot00000000000000PNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`base-16.04/controlpanel/java/ControlPanelService/res/layout/000077500000000000000000000000001272147170000241075ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/layout/activity_control_panel.xml000066400000000000000000000024051272147170000314050ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/res/menu/000077500000000000000000000000001272147170000235365ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/menu/activity_control_panel.xml000066400000000000000000000023631272147170000310370ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/res/values-v11/000077500000000000000000000000001272147170000244765ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/values-v11/styles.xml000066400000000000000000000024771272147170000265550ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/res/values-v14/000077500000000000000000000000001272147170000245015ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/values-v14/styles.xml000066400000000000000000000025711272147170000265530ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/res/values/000077500000000000000000000000001272147170000240715ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/res/values/strings.xml000066400000000000000000000023361272147170000263100ustar00rootroot00000000000000 Control Panel Service Hello world! Settings base-16.04/controlpanel/java/ControlPanelService/res/values/styles.xml000066400000000000000000000032531272147170000261410ustar00rootroot00000000000000 base-16.04/controlpanel/java/ControlPanelService/src/000077500000000000000000000000001272147170000225705ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/000077500000000000000000000000001272147170000233575ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/000077500000000000000000000000001272147170000250275ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/bus/000077500000000000000000000000001272147170000256205ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/bus/VariantUtil.java000066400000000000000000000025121272147170000307250ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.bus; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; /** * The temporary utility class to retrieve {@link Variant) signature */ public class VariantUtil { public static String getSignature(Variant aVariant) throws BusException { return MsgArg.getSignature( new long [] {aVariant.getMsgArg()} ); } } base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/000077500000000000000000000000001272147170000256035ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/000077500000000000000000000000001272147170000316645ustar00rootroot00000000000000ControlPanelCollection.java000066400000000000000000000313711272147170000370710ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.UIWidgetSignalHandler; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ControlPanel; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.NotificationAction; import org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; import android.util.Log; /** * ControlPanelCollection represents a family of the {@link DeviceControlPanel} objects per language that belong to the same functional {@link Unit} */ public class ControlPanelCollection { private static final String TAG = "cpan" + ControlPanelCollection.class.getSimpleName(); public class NotificationActionReceiver implements NotificationAction { @Override public short getVersion() throws BusException {return 0;} /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.NotificationAction#Dismiss() */ @Override public void Dismiss() throws BusException { Log.d(TAG, "Received NotificationAction.Dismiss() signal, objPath: '" + objectPath + "', notify ControlPanels"); for (DeviceControlPanel panel : controlPanels.values() ) { ControlPanelEventsListener eventsListener = panel.getEventsListener(); if ( eventsListener != null ) { eventsListener.notificationActionDismiss(panel); } }//for :: controlPanels }//Dismiss } //========================================================// /** * The device */ private ControllableDevice device; /** * The {@link Unit} the collection belongs to */ private Unit unit; /** * The name of the collection */ private String name; /** * The object path that represents the {@link ControlPanelCollection} */ private String objectPath; /** * The mask of the interfaces the object path implements */ private int ifaceMask; /** * The version of the {@link ControlPanel} interface of the remote device */ private Short controlPanelVersion; /** * The version of the {@link NotificationAction} of the remote device */ private Short notificationActionVersion; /** * Signal handler of the {@link NotificationAction} interface */ private UIWidgetSignalHandler notifActSignalHandler; /** * Map from the language tag to the {@link DeviceControlPanel} */ private Map controlPanels; /** * Constructor * @param controllableDevice The {@link ControllableDevice} the collection belongs to * @param unit The {@link Unit} the collection belongs to * @param collName The name of the control panel collection * @param objPath The object path to introspect the control panel collection */ public ControlPanelCollection(ControllableDevice controllableDevice, Unit unit, String collName, String objPath) { this.device = controllableDevice; this.unit = unit; this.name = collName; this.objectPath = objPath; controlPanels = new HashMap(); } /** * @return The {@link ControllableDevice} */ public ControllableDevice getDevice() { return device; } /** * @return The functional {@link Unit} the collection belongs to */ public Unit getUnit() { return unit; } /** * @return The name of the collection */ public String getName() { return name; } /** * @return The {@link ControlPanelCollection} object path */ public String getObjectPath() { return objectPath; } /** * @return The version of the {@link ControlPanel} interface, NULL if failed to be set */ public Short getControlPanelVersion() { return controlPanelVersion; } /** * @return The version of the {@link NotificationAction} interface, may be NULL if failed to be set, or the objectPath doesn't implement * the {@link NotificationAction} interface */ public Short getNotificationActionVersion() { return notificationActionVersion; } /** * @return Collection of {@link DeviceControlPanel} */ public Collection getControlPanels() { return Collections.unmodifiableCollection(controlPanels.values()); }//getControlPanels /** * @return A set of languages of the control panels of this collection */ public Set getLanguages() { return Collections.unmodifiableSet(controlPanels.keySet()); }//getLanguages /** * Cleans the object resources */ public void release() { Log.d(TAG, "Cleaning the ControlPanelCollection: '" + name + "'"); if ( notifActSignalHandler != null ) { try { notifActSignalHandler.unregister(); } catch (ControlPanelException cpe) { Log.d(TAG, "Failed to unregister the NotificationAction signal handler"); } notifActSignalHandler = null; } releaseControlPanels(); }//release /** * Creates and fills this collection with the {@link DeviceControlPanel} objects
* The operation is done by introspection of the remote object * @throws ControlPanelException Is thrown if failed to retrieve the ControlPanel objects */ void retrievePanels() throws ControlPanelException { Log.d(TAG, "Introspecting ControlPanels for objectPath: '" + objectPath + "'"); if ( device.getSessionId() == null ) { throw new ControlPanelException("The session wasn't established, can't introspect ControlPanels"); } try { //Introspect the ControlPanelCollection child nodes IntrospectionNode introNode = new IntrospectionNode(objectPath); introNode.parseOneLevel(ConnectionManager.getInstance().getBusAttachment(), device.getSender(), device.getSessionId()); //Analyze interfaces ifaceMask = CommunicationUtil.getInterfaceMask((String[])introNode.getInterfaces().toArray(new String[0])); //Perform version check checkVersion(); releaseControlPanels(); Log.d(TAG, "Fill the ControlPanelCollection, objectPath: '" + objectPath + "'"); List children = introNode.getChidren(); for ( IntrospectionNode node : children ) { String path = node.getPath(); String segments[] = path.split("/"); //Extract the language tag and replace "_" with "-" to comply the IETF standard String lang = segments[ segments.length - 1 ].replace("_", "-"); Log.v(TAG, "Introspected ControlPanel lang: '" + lang + "', objPath: '" + objectPath + "'"); DeviceControlPanel panel = new DeviceControlPanel(device, unit, this, path, lang); controlPanels.put(lang, panel); }//for :: children } catch(Exception e) { Log.e(TAG, "Failed to introspect the ControlPanels for objectPath: '" + objectPath + "', Error: '" + e.getMessage() + "'"); throw new ControlPanelException("Failed to introspect the ControlPanels"); } }//introspectPanels /** * Checks whether the given objectPath implements the {@link NotificationAction} interface and registers the signal handler * @throws ControlPanelException */ void handleNotificationAction() throws ControlPanelException { if ( !CommunicationUtil.maskIncludes(ifaceMask, NotificationAction.ID_MASK)) { throw new ControlPanelException("The received objectPath: '" + objectPath + "' doesn't implement the NotificationAction protocol"); } if ( notificationActionVersion == null ) { throw new ControlPanelException("Undefined the NotificationAction protocol version"); } Log.d(TAG, "Registering NotificationAction signal handler, objPath: '" + objectPath + "'"); Method method = CommunicationUtil.getNotificationActionDismissSignal("Dismiss"); if ( method == null ) { throw new ControlPanelException("Failed to register the NotificationAction.Dismiss signal, no reflection method was found"); } notifActSignalHandler = new UIWidgetSignalHandler(objectPath, new NotificationActionReceiver(), method, NotificationAction.IFNAME); notifActSignalHandler.register(); }//handleNotificationAction /** * Performs version comparison for ControlPanel and NotificationAction interfaces (if is relevant) * @throws ControlPanelException */ private void checkVersion() throws ControlPanelException { boolean isControlPanel = CommunicationUtil.maskIncludes(ifaceMask, ControlPanel.ID_MASK); boolean isNotifAction = CommunicationUtil.maskIncludes(ifaceMask, NotificationAction.ID_MASK); List> interfaces = new ArrayList>(2); if ( isControlPanel ) { interfaces.add(ControlPanel.class); } if ( isNotifAction ) { interfaces.add(NotificationAction.class); } ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, device.getSessionId(), (Class[])interfaces.toArray(new Class[0]) ); if ( isControlPanel ) { Log.d(TAG, "The objPath: '" + objectPath + "' implements the ControlPanel interface, performing version check"); try { ControlPanel remoteControl = proxyObj.getInterface(ControlPanel.class); short version = remoteControl.getVersion(); Log.d(TAG, "Version check for ControlPanel interface, my protocol version is: '" + ControlPanel.VERSION + "'" + " the remote device version is: '" + version + "'"); if ( version > ControlPanel.VERSION ) { throw new ControlPanelException("Incompatible ControlPanel version, my protocol version is: '" + ControlPanel.VERSION + "'" + " the remote device version is: '" + version + "'"); } this.controlPanelVersion = version; } catch (BusException be) { throw new ControlPanelException("Failed to call getVersion() for ControlPanel interface, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"); } }//if :: isControlPanel if ( isNotifAction ) { Log.d(TAG, "The objPath: '" + objectPath + "' implements the NotificationAction interface, performing version check"); try { NotificationAction remoteControl = proxyObj.getInterface(NotificationAction.class); short version = remoteControl.getVersion(); Log.d(TAG, "Version check for NotificationAction interface, my protocol version is: '" + NotificationAction.VERSION + "'" + " the remote device version is: '" + version + "'"); if ( version > NotificationAction.VERSION ) { Log.e(TAG,"Incompatible NotificationAction version, my protocol version is: '" + NotificationAction.VERSION + "'" + " the remote device version is: '" + version + "'"); this.notificationActionVersion = null; } else { this.notificationActionVersion = version; } } catch (BusException be) { Log.e(TAG, "Failed to call getVersion() for NotificationAction interface, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"); this.notificationActionVersion = null; } }//if :: notifAction }//setRemoteController /** * Cleans the DeviceControlPanel collection */ private void releaseControlPanels() { for (DeviceControlPanel panel : controlPanels.values() ) { panel.release(); } controlPanels.clear(); }//releaseControlPanels } ControlPanelException.java000066400000000000000000000027431272147170000367350ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; public class ControlPanelException extends Exception { private static final long serialVersionUID = -3845000274158639384L; public ControlPanelException() { super(); } public ControlPanelException(String detailMessage, Throwable throwable) { super(detailMessage, throwable); } public ControlPanelException(String detailMessage) { super(detailMessage); } public ControlPanelException(Throwable throwable) { super(throwable); } } ControlPanelService.java000066400000000000000000000401411272147170000363710ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.bus.AboutListener; import org.alljoyn.bus.AboutObjectDescription; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantUtil; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventType; import org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventsListener; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ControlPanel; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.HTTPControl; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; import org.alljoyn.services.common.utils.TransportUtil; import android.os.Handler; import android.os.Message; import android.util.Log; /** * Provides the main methods for control panel service */ public class ControlPanelService implements ConnManagerEventsListener, AboutListener { private static final String TAG = "cpan" + ControlPanelService.class.getSimpleName(); private static final ControlPanelService SELF = new ControlPanelService(); public static final String INTERFACE_PREFIX = "org.alljoyn.ControlPanel"; private static final String[] ANNOUNCEMENT_IFACES = new String[] { ControlPanel.IFNAME, HTTPControl.IFNAME }; /** * Reference to connection manager object */ private final ConnectionManager connMgr; /** * Listens to changes of the devices in the control panel proximity */ private DeviceRegistry deviceRegistry; /** * Creates instance of the control panel service * * @return {@link ControlPanelService} */ public static ControlPanelService getInstance() { return SELF; }// getInstance /** * Constructor */ private ControlPanelService() { connMgr = ConnectionManager.getInstance(); } /** * Starts {@link ControlPanelService} which discovers controllable devices * in its proximity.
* The ControlPanelService user is informed about the devices in proximity * via the {@link DeviceRegistry} interface.
* The discovery mechanism is implemented by receiving Announcement signals.
* * @param bus * BusAttachment that the service should use * @param deviceRegistry * Holds the information about the devices in proximity
* {@link DefaultDeviceRegistry} may be passed in to receive * information about the devices * @throws ControlPanelException * if failed to initialize the control panel service */ public void init(BusAttachment bus, DeviceRegistry deviceRegistry) throws ControlPanelException { if (deviceRegistry == null) { throw new ControlPanelException("deviceRegistry can't be NULL"); } // Perform the basic service initialization init(bus); this.deviceRegistry = deviceRegistry; Log.d(TAG, "Start listening for Announcement signals"); connMgr.registerEventListener(ConnManagerEventType.ANNOUNCEMENT_RECEIVED, this); // Add announcement handlers connMgr.getBusAttachment().registerAboutListener(this); for (String iface : ANNOUNCEMENT_IFACES) { connMgr.getBusAttachment().whoImplements(new String[] { iface }); } }// init /** * Starts {@link ControlPanelService} without discovering new devices in * proximity * * @param bus */ public void init(BusAttachment bus) throws ControlPanelException { connMgr.setBusAttachment(bus); TaskManager.getInstance().initPool(); }// init /** * @return Returns this device registry, or NULL if not defined */ public DeviceRegistry getDeviceRegistry() { return deviceRegistry; }// getDeviceRegistry /** * Creates object of controllable device.
* The controllable device allows to join session with the remote device and * to receive its {@link DeviceControlPanel} * * @param sender * The unique name of the remote device * @return Created ControllableDevice * @throws ControlPanelException * cpe */ public ControllableDevice getControllableDevice(String sender) throws ControlPanelException { return getControllableDevice(UUID.randomUUID().toString(), sender); }// getControllableDevice /** * Creates object of controllable device.
* The controllable device allows to join session with the remote device and * to receive its {@link DeviceControlPanel} * * @param deviceId * The device unique identifier * @param sender * The unique name of the remote device * @return Created ControllableDevice * @throws ControlPanelException * cpe */ public ControllableDevice getControllableDevice(String deviceId, String sender) throws ControlPanelException { if (sender == null || sender.length() == 0) { throw new ControlPanelException("Received an illegal sender name, Sender: '" + sender + "'"); } Log.i(TAG, "Creating ControllableDevice, Sender: '" + sender + "', DeviceId: '" + deviceId + "'"); return new ControllableDevice(deviceId, sender); }// getControllableDevice /** * Shutdown the {@link ControlPanelService} */ public void shutdown() { Log.d(TAG, "Shutdown ControlPanelService"); for (String iface : ANNOUNCEMENT_IFACES) { connMgr.getBusAttachment().cancelWhoImplements(new String[] { iface }); } connMgr.getBusAttachment().unregisterAboutListener(this); if (deviceRegistry != null) { Log.d(TAG, "Clear devices registry"); for (ControllableDevice device : deviceRegistry.getDevices().values()) { stopControllableDevice(device); } deviceRegistry = null; } TaskManager taskManager = TaskManager.getInstance(); if (taskManager.isRunning()) { taskManager.shutdown(); } connMgr.shutdown(); }// shutdown /** * Stops activities of the passed {@link ControllableDevice} * * @param device * {@link ControllableDevice} to be stopped */ public void stopControllableDevice(ControllableDevice device) { Log.d(TAG, "Stop device: '" + device.getDeviceId() + "' activities"); device.stopDeviceActivities(); }// shutdown /** * Called when received a connection manager event * * @see org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventsListener#connMgrEventOccured(org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventType, * java.util.Map) */ @Override public void connMgrEventOccured(ConnManagerEventType eventType, Map args) { Log.d(TAG, "Received event from connection manager, type: '" + eventType + "'"); switch (eventType) { case ANNOUNCEMENT_RECEIVED: { handleAnnouncement(args); break; }// announcement default: break; }// switch }// connMgrEventOccured // ======================================================// /** * Checks whether the received announcement has ControlPanel interface
* If has creates ControllableObject and save it in the registry * * @param args */ private void handleAnnouncement(Map args) { String deviceId = (String) args.get("DEVICE_ID"); String appId = (String) args.get("APP_ID"); String sender = (String) args.get("SENDER"); AboutObjectDescription[] objDescList = (AboutObjectDescription[]) args.get("OBJ_DESC"); if (deviceId == null || deviceId.length() == 0) { Log.e(TAG, "Received a bad Announcement signal, deviceId can't be NULL or empty"); return; } if (sender == null || sender.length() == 0) { Log.e(TAG, "Received a bad Announcement signal, sender can't be NULL or empty"); return; } if (objDescList == null || objDescList.length == 0) { Log.e(TAG, "Received a bad Announcement signal, BusObjectDescription array is empty"); return; } // The controllable device id should be constructed from the deviceId // and the appId deviceId = deviceId + "_" + appId; boolean newDevice = false; // TRUE if it's a not registered new device boolean handledDevice = false; // TRUE if for at least one received // control panel object path we handled // the device ControllableDevice device = deviceRegistry.getDevices().get(deviceId); // Iterate over the BusObjectDescription objects received from an // Announcement signal for (AboutObjectDescription busObjDesc : objDescList) { Log.v(TAG, "Found objPath: '" + busObjDesc.path + "'"); String[] interfaces = busObjDesc.interfaces; int ifaceMask = CommunicationUtil.getInterfaceMask(interfaces); // Check if found a ControlPanel or HTTPControl interfaces if (!CommunicationUtil.maskIncludes(ifaceMask, ControlPanel.ID_MASK) && !CommunicationUtil.maskIncludes(ifaceMask, HTTPControl.ID_MASK)) { continue; } String objPath = busObjDesc.path; Log.d(TAG, "Found ControlPanel object, path: '" + objPath + "'"); if (!handledDevice) { if (device == null) { Log.d(TAG, "Discovered new device, deviceId: '" + deviceId + "', sender: '" + sender + "'"); device = new ControllableDevice(deviceId, sender); device.subscribeOnFoundLostEvents(); // Listen to events of // found | lost adv. // name newDevice = true; }// device == null else { Log.d(TAG, "Device with deviceId: '" + deviceId + "' already exists, updating sender to be: '" + sender + "'"); device.setSender(sender); try { connMgr.cancelFindAdvertisedName(sender); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to call cancelFindAdvertisedName(), Error: '" + cpe.getMessage() + "'"); return; } }// else :: device == null device.setReachable(true); device.startDeviceFoundVerificationService(); // Start scheduled // service before // call // findAdvName Log.d(TAG, "Start findAdvertisedName for sender: '" + sender + "'"); Status res; try { res = connMgr.findAdvertisedName(sender); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to call findAdvertisedName(), Error: '" + cpe.getMessage() + "'"); return; } if (res != Status.OK) { Log.d(TAG, "Failed to start findAdvertisedName for sender: '" + sender + "', Error: '" + res + "'"); device.stopDeviceActivities(); return; } // We handled the discovered device for at least one of the // received ControlPanel object paths handledDevice = true; }// if :: not handledDevice try { device.addControlPanel(objPath, ifaceMask); } catch (ControlPanelException cpe) { Log.w(TAG, "Received a broken object path: '" + objPath + "', Error: '" + cpe.getMessage() + "'"); } }// for :: BusObjectDescription if (handledDevice) { if (newDevice) { deviceRegistry.foundNewDevice(device); } else { deviceRegistry.reachabilityChanged(device, true); } } }// handleAnnouncement @Override public void announced(String serviceName, int version, short port, AboutObjectDescription[] objectDescriptions, Map aboutData) { Log.v(TAG, "Received Announcement signal"); Handler handler = ConnectionManager.getInstance().getHandler(); if (handler == null) { return; } UUID appId; String deviceId; try { Variant varAppId = aboutData.get(AboutKeys.ABOUT_APP_ID); String appIdSig = VariantUtil.getSignature(varAppId); if (!appIdSig.equals("ay")) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_APP_ID + "', that has an unexpected signature: '" + appIdSig + "', the expected signature is: 'ay'"); return; } byte[] rawAppId = varAppId.getObject(byte[].class); appId = TransportUtil.byteArrayToUUID(rawAppId); if (appId == null) { Log.e(TAG, "Failed to translate the received AppId into UUID"); return; } Variant varDeviceId = aboutData.get(AboutKeys.ABOUT_DEVICE_ID); String devIdSig = VariantUtil.getSignature(varDeviceId); if (!devIdSig.equals("s")) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_DEVICE_ID + "', that has an unexpected signature: '" + devIdSig + "', the expected signature is: 's'"); return; } deviceId = varDeviceId.getObject(String.class); } catch (BusException be) { Log.e(TAG, "Failed to retreive an Announcement properties, Error: '" + be.getMessage() + "'"); return; } Map args = new HashMap(); args.put("SENDER", serviceName); args.put("DEVICE_ID", deviceId); args.put("APP_ID", appId.toString()); args.put("OBJ_DESC", objectDescriptions); Message.obtain(handler, ConnManagerEventType.ANNOUNCEMENT_RECEIVED.ordinal(), args).sendToTarget(); }// onAnnouncement } ControllableDevice.java000066400000000000000000000462241272147170000362200ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.alljoyn.bus.Status; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventType; import org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventsListener; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ControlPanel; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.HTTPControl; import android.util.Log; /** * The class includes the generic information about the controllable device.
*/ public class ControllableDevice implements ConnManagerEventsListener { private static final String TAG = "cpan" + ControllableDevice.class.getSimpleName(); /** * The time window in which this device sender name may be found by AJ foundAdvertisedName
* Time in seconds */ private static final int DEVICE_FOUND_TIME = 45; /** * Connection manager */ private ConnectionManager connMgr; /** * The device registry */ private DeviceRegistry deviceRegistry; /** * The scheduled service executing special task */ private ScheduledExecutorService scheduledService; /** * Device events listener */ private DeviceEventsListener deviceEventsListener; /** * The session id with the remote controllable device * If session isn't established the value is null */ private Integer sessionId; /** * The device unique identifier */ private String deviceId; /** * The unique identifier of the remote device */ private String sender; /** * The Map of functional units belonging to this {@link ControllableDevice}
* The map is from unitId to the {@Link Unit} object */ private Map unitMap; /** * Whether the device is reachable, meaning may be controlled */ private AtomicBoolean isReachable; /** * Constructor * @param deviceId The device unique identifier * @param sender The unique identifier of the remote device */ public ControllableDevice(String deviceId, String sender) { this.deviceId = deviceId; this.sender = sender; this.isReachable = new AtomicBoolean(false); this.unitMap = new HashMap(); this.sessionId = null; this.deviceRegistry = ControlPanelService.getInstance().getDeviceRegistry(); this.connMgr = ConnectionManager.getInstance(); }//Constructor /** * The device unique identifier * @return the deviceId */ public String getDeviceId() { return deviceId; } /** * The controllable device reachability state * @return Whether the remotely controllable device can be reached */ public boolean isReachable() { return isReachable.get(); } /** * @return the sender's BusAttachment unique name */ public String getSender() { return sender; } /** * @return Returns sessionId. If the there is no established session with the remote device, NULL is returned */ public Integer getSessionId() { return sessionId; } /** * @return Device events listener */ public DeviceEventsListener getDeviceEventsListener() { return deviceEventsListener; }//getDeviceEventsListener /** * Starts the session with the remote controllable device * @param eventsListener */ public void startSession(DeviceEventsListener eventsListener) throws ControlPanelException { if ( eventsListener == null ) { throw new ControlPanelException("Events listener can't be NULL"); } deviceEventsListener = eventsListener; if ( sessionId != null ) { String msg = "The device is already in session: '" + deviceId + "', sessionId: '" + sessionId + "'"; Log.d(TAG, msg); deviceEventsListener.sessionEstablished(this, getControlPanelCollections()); return; } connMgr.registerEventListener(ConnManagerEventType.SESSION_JOINED, this); connMgr.registerEventListener(ConnManagerEventType.SESSION_LOST, this); connMgr.registerEventListener(ConnManagerEventType.SESSION_JOIN_FAIL, this); Log.d(TAG, "Device: '" + deviceId + "' starting session with sender: '" + sender + "'"); Status status = connMgr.joinSession(sender, deviceId); if ( status != Status.OK ) { String statusName = status.name(); Log.e(TAG, "Failed to join session: '" + statusName + "'"); deviceEventsListener.errorOccurred(this, statusName); return; } }//startSession /** * End the session with the remote controllable device * @return {@link Status} of endSession execution */ public Status endSession() { Log.i(TAG, "endSession has been called, leaving the session"); if ( sessionId == null ) { Log.w(TAG, "Fail to execute endSession, sessionId is NULL, returning Status of FAIL"); return Status.FAIL; } Status status; try { status = connMgr.leaveSession(sessionId); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to call leaveSession, Error: '" + cpe.getMessage() + "', returning status of FAIL"); return Status.FAIL; } String logMsg = "endSession return Status is: '" + status + "'"; if ( status == Status.OK ) { sessionId = null; Log.i(TAG, logMsg); // Unregister the session relevant events connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOINED, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_LOST, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOIN_FAIL, this); } else { Log.w(TAG, logMsg); } return status; }//endSession /** * Receives Connection manager events * @see org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventsListener#connMgrEventOccured(org.alljoyn.ioe.controlpanelservice.communication.ConnManagerEventType, java.util.Map) */ @Override public void connMgrEventOccured(ConnManagerEventType eventType, Map args) { switch (eventType) { case FOUND_DEVICE: { handleFoundAdvName(args); break; } case LOST_DEVICE: { handleLostAdvName(args); break; } case SESSION_JOINED: { handleSessionJoined(args); break; } case SESSION_JOIN_FAIL: { handleSessionJoinFailed(args); break; } case SESSION_LOST: { handleSessionLost(args); break; } default: break; }//switch }//connMgrEventOccured /** * @return Collection of {@link Unit} that belongs to this device */ public Collection getUnitCollection() { return Collections.unmodifiableCollection(unitMap.values()); }//getUnits /** * Adds a ControlPanel for the given objectPath. * @param objectPath The object path of the added control panel * @param interfaces The interfaces the object path implements * @return {@link Unit} this object path belongs to * @throws ControlPanelException */ public Unit addControlPanel(String objectPath, String... interfaces) throws ControlPanelException { if ( objectPath == null ) { throw new ControlPanelException("The objectPath: '" + objectPath + "' is undefined"); } int ifaceMask = CommunicationUtil.getInterfaceMask(interfaces); if ( !CommunicationUtil.maskIncludes(ifaceMask, ControlPanel.ID_MASK) && !CommunicationUtil.maskIncludes(ifaceMask, HTTPControl.ID_MASK) ) { throw new ControlPanelException("The objectPath: '" + objectPath + "', doesn't implement any ControlPanel permitted interface"); } return addControlPanel(objectPath, ifaceMask); }//addControlPanel /** * Creates a NotificationAction control panel for the given objectPath
* The method should be used after establishment a session with a controllable device * @param objectPath The object path to the created control panel * @return {@link ControlPanelCollection} * @throws ControlPanelException */ public ControlPanelCollection createNotificationAction(String objectPath) throws ControlPanelException { if ( sessionId == null ) { throw new ControlPanelException("The session wasn't established, can't create a ControlPanelCollection"); } if ( objectPath == null ) { throw new ControlPanelException("Received an undefined objectPath"); } Log.i(TAG, "Creating a NotificationAction control panel, objectPath: '" + objectPath + "'"); String[] segments = CommunicationUtil.parseObjPath(objectPath); String unitId = segments[0]; String panelName = segments[1]; Unit unit = new Unit(this, unitId); ControlPanelCollection coll = unit.createControlPanelCollection(objectPath, panelName); coll.retrievePanels(); coll.handleNotificationAction(); return coll; }//addNotificationAction /** * Cleans the {@link ControlPanelCollection} that was created following the invocation of the createNotificationAction() method.
* It's important to call this method after the NotificationAction control panel has been completed * @param panelCollection The {@link ControlPanelCollection} to be cleaned out */ public void removeNotificationAction(ControlPanelCollection panelCollection) { panelCollection.getUnit().release(); }//removeNotificationAction //========================================// /** * @param isReachable the isActive to set */ void setReachable(boolean isReachable) { this.isReachable.set(isReachable); } /** * @param sender the sender to set */ void setSender(String sender) { this.sender = sender; } /** * Subscribe to receive foundAdvName and lostAdvName events of ConnectionManager */ void subscribeOnFoundLostEvents() { Log.d(TAG, "Register on ConnManager to receive events of found and lost advertised name"); connMgr.registerEventListener(ConnManagerEventType.FOUND_DEVICE, this); connMgr.registerEventListener(ConnManagerEventType.LOST_DEVICE, this); }//subscribeOnFoundLostEvents /** * Stops all the device activities
* close session
* stop find adv name
* stop scheduled service
* Set is reachable to false */ void stopDeviceActivities() { isReachable.set(false); try { connMgr.cancelFindAdvertisedName(sender); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to call cancelFindAdvertisedName(), Error: '" + cpe.getMessage() + "'"); } connMgr.unregisterEventListener(ConnManagerEventType.FOUND_DEVICE, this); connMgr.unregisterEventListener(ConnManagerEventType.LOST_DEVICE, this); Status status = endSession(); if ( status != Status.OK ) { Log.e(TAG, "Failed to end the session, Status: '" + status + "'"); } stopDeviceFoundVerificationService(); for (Unit unit : unitMap.values() ) { unit.release(); } unitMap.clear(); }//stopDeviceActivities /** * Start device found scheduled service */ void startDeviceFoundVerificationService() { Log.d(TAG, "Start DeviceFoundVerificationService for device: '" + deviceId + "', the verification will be done after: " + DEVICE_FOUND_TIME + " seconds"); //If the process started previously -> stop it stopDeviceFoundVerificationService(); scheduledService = Executors.newScheduledThreadPool(1); scheduledService.schedule(new Runnable() { @Override public void run() { Log.d(TAG, "DeviceFoundVerificationService is wake up, set the device: '" + deviceId + "' reachability to 'false'"); isReachable.set(false); deviceRegistry.reachabilityChanged(ControllableDevice.this, false); } }, DEVICE_FOUND_TIME, TimeUnit.SECONDS); }//startDeviceFoundVerification /** * * @param objPath * @param ifaceMask * @throws ControlPanelException */ Unit addControlPanel(String objPath, int ifaceMask) throws ControlPanelException { Log.d(TAG, "Creating ControlPanelCollection object for objPath: '" + objPath + "', device: '" + deviceId + "'"); //parse the received object path String[] segments = CommunicationUtil.parseObjPath(objPath); String unitId = segments[0]; String panelId = segments[1]; Unit unit = unitMap.get(unitId); if ( unit == null ) { Log.v(TAG, "Found new functional unit: '" + unitId + "', panel: '" + panelId + "'"); unit = new Unit(this, unitId); unitMap.put(unitId, unit); // Store the new unit object }else { Log.v(TAG, "Found an existent functional unit: '" + unitId + "', panel: '" + panelId + "'"); } if ( CommunicationUtil.maskIncludes(ifaceMask, HTTPControl.ID_MASK) ) { Log.d(TAG, "The objPath: '" + objPath + "' belongs to the HTTPControl interface, setting"); unit.setHttpControlObjPath(objPath); } else { unit.createControlPanelCollection(objPath, panelId); } return unit; }//createUnit /** * @return Collection of the {@link ControlPanelCollection} of all of the functional units of this device */ private Collection getControlPanelCollections() { List collect = new LinkedList(); for ( Unit unit : unitMap.values() ) { collect.addAll(unit.getControlPanelCollection()); } return collect; }// getControlPanelCollection /** * Stop device found scheduled service */ private void stopDeviceFoundVerificationService() { if ( scheduledService == null ) { return; } Log.d(TAG, "Device: '" + deviceId + "' stops DeviceFoundVerification scheduled service"); scheduledService.shutdownNow(); scheduledService = null; }//stopDeviceFoundVerification /** * If received foundAdvName:
* Stop the scheduled timer.
* If reachable state is false - set it to true and call the registry with reachability state changed * @param args Event handler argument */ private void handleFoundAdvName(Map args){ String foundSender = (String)args.get("SENDER"); Log.v(TAG, "Received foundAdvertisedName of sender: '" + foundSender + "', my sender name is: '" + sender + "'"); if ( foundSender == null || !foundSender.equals(sender) ) { Log.v(TAG, "The received sender: '" + foundSender + "' doesn't belong to this device"); return; } stopDeviceFoundVerificationService(); //Atomically sets the value to the given updated value if the current value == the expected value. //Returns - true if successful. False return indicates that the actual value was not equal to the expected value if ( isReachable.compareAndSet(false, true) ) { boolean newVal = isReachable.get(); Log.d(TAG, "The device: '" + deviceId + "' isReachable set to: '" + newVal + "'"); deviceRegistry.reachabilityChanged(this, newVal); } }//handleFoundAdvName /** * If received lostAdvName:
* Stop the scheduled timer.
* set isReachable to false * @param args @param args Event handler argument */ private void handleLostAdvName(Map args) { String foundSender = (String)args.get("SENDER"); Log.d(TAG, "Received lostAdvertisedName of sender: '" + foundSender + "', my sender name is: '" + sender + "'"); if ( foundSender == null || !foundSender.equals(sender) ) { Log.v(TAG, "Received sender: '" + foundSender + "' doesn't belong to this device"); return; } stopDeviceFoundVerificationService(); //Atomically sets the value to the given updated value if the current value == the expected value. //Returns - true if successful. False return indicates that the actual value was not equal to the expected value if ( isReachable.compareAndSet(true, false) ) { boolean newVal = isReachable.get(); Log.d(TAG, "The device: '" + deviceId + "' isReachable set to: '" + newVal + "'"); deviceRegistry.reachabilityChanged(this, newVal); } }//handleLostAdvName /** * Handle session joined * @param args */ private void handleSessionJoined(Map args) { String deviceId = (String)args.get("DEVICE_ID"); Integer sessionId = (Integer)args.get("SESSION_ID"); Log.i(TAG, "Received SESSION_JOINED event for deviceId: '" + deviceId + "', this deviceId is: '" + this.deviceId + "', sid: '" + sessionId + "'"); if ( deviceId == null || !deviceId.equals(this.deviceId) ) { return; } if ( sessionId == null ) { return; } this.sessionId = sessionId; for (Unit unit : unitMap.values() ) { try { unit.fillControlPanelCollections(); } catch (ControlPanelException cpe) { String error = "Failed to fill the ControlPanelCollection of the unit: '" + unit.getUnitId() + "'"; Log.e(TAG, error); deviceEventsListener.errorOccurred(this, error); } }//for unit deviceEventsListener.sessionEstablished(this, getControlPanelCollections()); }//handleSessionJoined /** * Handle session lost * @param args */ private void handleSessionLost(Map args) { Integer sessionId = (Integer)args.get("SESSION_ID"); Log.w(TAG, "Received SESSION_LOST event for sessionId: '" + sessionId + "', this device sessionId is: '" + this.sessionId + "'"); if ( sessionId == null || !sessionId.equals(this.sessionId) ) { return; } this.sessionId = null; connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOINED, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_LOST, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOIN_FAIL, this); deviceEventsListener.sessionLost(this); }//handleSessionLost /** * Handle session join failed * @param args */ private void handleSessionJoinFailed(Map args) { String deviceId = (String)args.get("DEVICE_ID"); Object statusObj = args.get("STATUS"); if ( statusObj == null || !(statusObj instanceof Status) ) { return; } String status = ((Status)statusObj).name(); Log.w(TAG, "Received SESSION_JOIN_FAIL event for deviceId: '" + deviceId + "', this deviceId is: '" + this.deviceId + "', Status: '" + status + "'"); if ( deviceId == null || !deviceId.equals(this.deviceId) ) { return; } this.sessionId = null; connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOINED, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_LOST, this); connMgr.unregisterEventListener(ConnManagerEventType.SESSION_JOIN_FAIL, this); deviceEventsListener.errorOccurred(this, status); }//handleSessionJoinedFailed } DefaultDeviceRegistry.java000066400000000000000000000064101272147170000367060ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.Collections; import java.util.HashMap; import java.util.Map; import android.util.Log; /** * The default implementation of the DeviceRegistry interface.
* Inherit this class in order to be notified about changes in the {@link DeviceRegistry}. */ public class DefaultDeviceRegistry implements DeviceRegistry { private static final String TAG = "cpan" + DefaultDeviceRegistry.class.getSimpleName(); /** * The devices that in the proximity and may be controlled */ private Map controllableDevices; /** * Constructor */ public DefaultDeviceRegistry() { controllableDevices = new HashMap(); } /** * Adds the device to the registry * @see org.alljoyn.ioe.controlpanelservice.DeviceRegistry#foundNewDevice(org.alljoyn.ioe.controlpanelservice.ControllableDevice) */ @Override public void foundNewDevice(ControllableDevice device) { controllableDevices.put(device.getDeviceId(), device); Log.d(TAG, "Added device, deviceId: '" + device.getDeviceId() + "'"); } /** * Mark the device as not active * @see org.alljoyn.ioe.controlpanelservice.DeviceRegistry#reachabilityChanged(org.alljoyn.ioe.controlpanelservice.ControllableDevice, boolean) */ @Override public void reachabilityChanged(ControllableDevice device, boolean isReachable) { Log.d(TAG, "ReachabilityChanged for device: '" + device.getDeviceId() + "' the device isReachable: '" + isReachable + "'"); } /** * Removes the device from the registry * @see org.alljoyn.ioe.controlpanelservice.DeviceRegistry#removeDevice(org.alljoyn.ioe.controlpanelservice.ControllableDevice) */ @Override public void removeDevice(ControllableDevice device) { Log.d(TAG, "Remove device called, deviceId: '" + device.getDeviceId() + "', cancelFindAdvertise name and remove the device from the registry"); device.stopDeviceActivities(); controllableDevices.remove(device.getDeviceId()); } /** * Returns the devices list * @see org.alljoyn.ioe.controlpanelservice.DeviceRegistry#getDevices() */ @Override public Map getDevices() { return Collections.unmodifiableMap(controllableDevices); } }//DefaultDeviceRegistry DeviceEventsListener.java000066400000000000000000000041631272147170000365460ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.Collection; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; /** * The interface to be implemented in order to receive {@link ControllableDevice} relevant events */ public interface DeviceEventsListener { /** * Notify the interface implementer about session establishment with the remote device * @param device The {@link ControllableDevice} * @param controlPanelContainer Used to request the Root UI Container and a relevant to it information * @see DeviceControlPanel */ public void sessionEstablished(ControllableDevice device, Collection controlPanelContainer); /** * Notify the interface implementer about loosing session with the remote device * @param device The {@link ControllableDevice} where the session has lost */ public void sessionLost(ControllableDevice device); /** * Notify the interface implementer about an error in the device activities * @param device The {@link ControllableDevice} where the error has occurred * @param reason The error reason */ public void errorOccurred(ControllableDevice device, String reason); } DeviceRegistry.java000066400000000000000000000041531272147170000354030ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.Map; /** * Used as a callback interface to inform the interface implementer about new discovered devices * and changes in their reachability state */ public interface DeviceRegistry { /** * Called when a new controllable device was found in the control panel service proximity
* @param device */ public void foundNewDevice(ControllableDevice device); /** * Called when a controllable device left the control panel service proximity
* The method implementation should be thread safe * @param device The controllable device * @param isReachable Whether the device is in reachable state */ public void reachabilityChanged(ControllableDevice device, boolean isReachable); /** * Remove a device from registry
* When a device is removed from the registry it will be inserted back after foundDevice method is called * @param device */ public void removeDevice(ControllableDevice device); /** * @return Returns collection of controllable devices */ public Map getDevices(); } base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/Unit.java000066400000000000000000000203531272147170000334510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.HTTPControl; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; import android.util.Log; /** * The class represents a functional unit of the controllable device {@link ControllableDevice}
* The unit might has a list of the {@link ControlPanelCollection} */ public class Unit { private static final String TAG = "cpan" + Unit.class.getSimpleName(); /** * The controllable device the unit belongs to */ private ControllableDevice device; /** * The unit id retrieved from the object path */ private String unitId; /** * The object path to HTTPControl Interface */ private String httpControlObjPath; /** * The Map from object path to {@link ControlPanelCollection} */ private Map panelCollections; /** * The HTTPControl proxy bus object */ private ProxyBusObject proxyObj; /** * The remote HTTP control object */ private HTTPControl remoteControl; /** * HTTP Protocol version */ private Short version; /** * Constructor * @param unitId The id of the functional unit */ public Unit(ControllableDevice device, String unitId) { this.device = device; this.unitId = unitId; this.panelCollections = new HashMap(); } /** * @return object path of the HTTPControl Interface, if the object path is defined, otherwise NULL is returned */ public String getHttpIfaceObjPath() { return httpControlObjPath; } /** * Set the HTTP control object path * @param httpControlObjPath */ void setHttpControlObjPath(String httpControlObjPath) { this.httpControlObjPath = httpControlObjPath; } /** * @return Get unit Id */ public String getUnitId() { return unitId; }//getUnitId /** * @return Get {@link ControllableDevice} */ public ControllableDevice getDevice() { return device; }//getDevice /** * @return {@link DeviceControlPanel} collection of this functional unit */ public Collection getControlPanelCollection() { return Collections.unmodifiableCollection(panelCollections.values()); }//getControlPanelList /** * @return The URL of this functional unit or NULL of not defined * @throws ControlPanelException */ public String getRootURL() throws ControlPanelException { if ( httpControlObjPath == null ) { return null; } setRemoteController(); try { return remoteControl.GetRootURL(); } catch (BusException be) { throw new ControlPanelException("Failed to receive the Root URL, Error: '" + be.getMessage() + "'"); } }//getRootURL /** * @return The HTTP Protocol version or NULL if the version is not defined * @throws ControlPanelException if failed to get version */ public Short getHttpControlVersion() throws ControlPanelException { if ( httpControlObjPath == null ) { return null; } setRemoteController(); return version; }//getVersion /** * Release all the object resources */ public void release() { Log.d(TAG, "Cleaning the Unit name: '" + unitId + "'"); if ( proxyObj != null ) { proxyObj.release(); } remoteControl = null; version = null; for (ControlPanelCollection coll : panelCollections.values()) { coll.release(); } panelCollections.clear(); }//release /** * Creates and adds to the {@link Unit} a new {@link ControlPanelCollection}
* If the session with a controllable device is already been established, then the created {@link ControlPanelCollection} * is filled * @param objPath The object path that identifies the {@link ControlPanelCollection} * @param collName The collection name * @throws ControlPanelException Is thrown if failed to create the collection */ ControlPanelCollection createControlPanelCollection(String objPath, String collName) throws ControlPanelException { ControlPanelCollection coll = panelCollections.get(collName); if ( coll == null ) { Log.i(TAG, "Received a new ControlPanelCollection Name: '" + collName + "' objPath: '" + objPath + "', creating..."); coll = new ControlPanelCollection(device, this, collName, objPath); panelCollections.put(collName, coll); } else { Log.d(TAG, "Received a known ControlPanelCollection Name: '" + collName + "' objPath: '" + objPath + "'"); } Integer sessionId = device.getSessionId(); if ( sessionId != null && coll.getControlPanels().size() == 0 ) { Log.d(TAG, "The session with the remote device has been previously established , sid: '" + sessionId + "', filling the new collection"); coll.retrievePanels(); } return coll; }//addControlPanel /** * Fills the {@link ControlPanelCollection} objects of this Unit
* The method invokes {@link ControlPanelCollection#retrievePanels()} for each {@link ControlPanelCollection} * @throws ControlPanelException If failed to fill the ControlPanelCollection */ void fillControlPanelCollections() throws ControlPanelException { for (ControlPanelCollection coll : panelCollections.values() ) { coll.retrievePanels(); } }//fillControlPanelCollections /** * Set the remote controller of the HTTP protocol interface * @throws ControlPanelException */ private void setRemoteController() throws ControlPanelException { //If the proxy bus object is defined and is built with the correct bus name, then no need to execute this method if ( proxyObj != null && device.getSender().equals(proxyObj.getBusName()) ) { return; } //Release the resources of the previously created BusObject if ( proxyObj != null ) { proxyObj.release(); } Integer sessionId = device.getSessionId(); if ( sessionId == null ) { throw new ControlPanelException("Session is not established"); } proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), httpControlObjPath, sessionId, new Class[]{HTTPControl.class} ); remoteControl = proxyObj.getInterface(HTTPControl.class); try { short version = remoteControl.getVersion(); Log.d(TAG, "Version check for HTTP Protocol, my protocol version is: '" + HTTPControl.VERSION + "'" + " the remote device version is: '" + version + "'"); if ( version > HTTPControl.VERSION ) { throw new ControlPanelException("Incompatible HTTPProtocol version, my protocol version is: '" + HTTPControl.VERSION + "'" + " the remote device version is: '" + version + "'"); } this.version = version; } catch (BusException be) { proxyObj = null; remoteControl = null; throw new ControlPanelException("Failed to call getVersion() for HTTPProtocol, objPath: '" + httpControlObjPath + "', Error: '" + be.getMessage() + "'"); } }//setRemoteController } application/000077500000000000000000000000001272147170000341105ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelserviceControlPanelActivity.java000066400000000000000000000031431272147170000410710ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/application/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.application; import org.alljoyn.ioe.controlpanelservice.R; import android.app.Activity; import android.os.Bundle; import android.view.Menu; public class ControlPanelActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_control_panel); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_control_panel, menu); return true; } } ControlPanelApplication.java000066400000000000000000000124721272147170000415450ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/application/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.application; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusAttachment.RemoteMessage; import org.alljoyn.bus.SessionOpts; import org.alljoyn.bus.Status; import org.alljoyn.bus.alljoyn.DaemonInit; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.services.android.security.AuthPasswordHandler; import org.alljoyn.services.android.security.SrpAnonymousKeyListener; import org.alljoyn.services.android.utils.AndroidLogger; import android.app.Application; import android.util.Log; public class ControlPanelApplication extends Application implements AuthPasswordHandler { private static final String TAG = "cpan" + ControlPanelApplication.class.getSimpleName(); /** * The daemon should advertise itself "quietly" (directly to the calling * port) This is to reply directly to a TC looking for a daemon */ private static final String DAEMON_NAME = "org.alljoyn.BusNode.IoeService"; /** * The daemon should advertise itself "quietly" (directly to the calling * port) This is to reply directly to a TC looking for a daemon */ private static final String DAEMON_QUIET_PREFIX = "quiet@"; private static final String[] authMechanisms = new String[] { "ALLJOYN_SRP_KEYX", "ALLJOYN_ECDHE_PSK" }; static { System.loadLibrary("alljoyn_java"); } private BusAttachment bus; private ControlPanelService service; @Override public void onCreate() { super.onCreate(); service = ControlPanelService.getInstance(); DaemonInit.PrepareDaemon(this); bus = new BusAttachment("ControlPanel", RemoteMessage.Receive); // bus.setDaemonDebug("ALL", 7); // bus.setLogLevels("ALLJOYN=7"); // bus.setLogLevels("ALL=7"); // bus.useOSLogging(true); Log.d(TAG, "Setting the AuthListener"); SrpAnonymousKeyListener authListener = new SrpAnonymousKeyListener(this, new AndroidLogger(), authMechanisms); Status status = bus.registerAuthListener(authListener.getAuthMechanismsAsString(), authListener, getFileStreamPath("alljoyn_keystore").getAbsolutePath()); if (status != Status.OK) { Log.e(TAG, "Failed to register AuthListener"); } status = bus.connect(); if (status != Status.OK) { Log.e(TAG, "Failed to connect bus attachment, bus: '" + status + "'"); return; } // Advertise the daemon so that the thin client can find it advertiseDaemon(); try { service.init(bus, new ControlPanelTestApp()); } catch (ControlPanelException cpe) { Log.e(TAG, "Failure happened, Error: '" + cpe.getMessage() + "'"); } catch (Exception e) { Log.e(TAG, "Unexpected failure occurred, Error: '" + e.getMessage() + "'"); } }// onCreate /** * @see org.alljoyn.services.android.security.AuthPasswordHandler#completed(java.lang.String, * java.lang.String, boolean) */ @Override public void completed(String mechanism, String authPeer, boolean authenticated) { Log.d(TAG, "The peer: '" + authPeer + "' has been authenticated: '" + authenticated + "', mechanism: '" + mechanism + "'"); } /** * @see org.alljoyn.services.android.security.AuthPasswordHandler#getPassword(java.lang.String) */ @Override public char[] getPassword(String peerName) { return SrpAnonymousKeyListener.DEFAULT_PINCODE; } /** * Advertise the daemon so that the thin client can find it * * @param logger */ private void advertiseDaemon() { // request the name int flag = BusAttachment.ALLJOYN_REQUESTNAME_FLAG_DO_NOT_QUEUE; Status reqStatus = bus.requestName(DAEMON_NAME, flag); if (reqStatus == Status.OK) { // advertise the name with a quite prefix for TC to find it Status adStatus = bus.advertiseName(DAEMON_QUIET_PREFIX + DAEMON_NAME, SessionOpts.TRANSPORT_ANY); if (adStatus != Status.OK) { bus.releaseName(DAEMON_NAME); Log.d(TAG, "failed to advertise daemon name " + DAEMON_NAME); } else { Log.d(TAG, "Succefully advertised daemon name " + DAEMON_NAME); } } } } ControlPanelTestApp.java000066400000000000000000000637001272147170000406620ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/application/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.application; import java.util.Collection; import java.util.EnumMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Random; import org.alljoyn.ioe.controlpanelservice.ControlPanelCollection; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControllableDevice; import org.alljoyn.ioe.controlpanelservice.DefaultDeviceRegistry; import org.alljoyn.ioe.controlpanelservice.DeviceEventsListener; import org.alljoyn.ioe.controlpanelservice.Unit; import org.alljoyn.ioe.controlpanelservice.ui.ActionWidget; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget.DialogButton; import org.alljoyn.ioe.controlpanelservice.ui.ContainerWidget; import org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; import org.alljoyn.ioe.controlpanelservice.ui.ErrorWidget; import org.alljoyn.ioe.controlpanelservice.ui.LabelWidget; import org.alljoyn.ioe.controlpanelservice.ui.LayoutHintsType; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ConstrainToValues; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.Date; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.RangeConstraint; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.Time; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ValueType; import org.alljoyn.ioe.controlpanelservice.ui.UIElement; import org.alljoyn.ioe.controlpanelservice.ui.UIElementType; import android.annotation.SuppressLint; import android.util.Log; public class ControlPanelTestApp extends DefaultDeviceRegistry implements DeviceEventsListener, ControlPanelEventsListener { private static final String TAG = "cpan" + ControlPanelTestApp.class.getSimpleName(); private Map> uiControls = new EnumMap>(UIElementType.class); private Map> uiControlsList = new EnumMap>(UIElementType.class); /** * Constructor */ public ControlPanelTestApp() { } @Override public void foundNewDevice(ControllableDevice device) { super.foundNewDevice(device); if ( !device.isReachable() ) { Log.d(TAG, "Device isn't reachable"); return; } Log.d(TAG, "FOUND_NEW_DEVICE received, handling"); handleNewDevice(device); }//foundNewDevice @Override public void reachabilityChanged(ControllableDevice device, boolean isReachable) { super.reachabilityChanged(device, isReachable); Log.d(TAG, "Device: '" + device.getDeviceId() + "' got event of 'REACHABILITY_CHANGED' value: '" + isReachable + "'"); if ( isReachable ) { handleNewDevice(device); } }//reachabilityChanged @Override public void removeDevice(ControllableDevice device) { super.removeDevice(device); } private void handleNewDevice(ControllableDevice device) { try { Log.d(TAG, "Device: '" + device.getDeviceId() + "', call to start a session"); device.startSession(this); } catch (ControlPanelException e) { e.printStackTrace(); } }//handleNewDevice //==========================================// @Override public void sessionEstablished(ControllableDevice device, Collection controlPanelCollections) { Log.d(TAG, "Received SESSION_ESTABLISHED, looping over the received control panels"); for(ControlPanelCollection controlPanelCollection : controlPanelCollections) { initCollectionTest(controlPanelCollection); }//for :: control panel collections try { //======== Test the NotificationAction================// Log.d(TAG, "Test the NotificationAction ControlPanel"); ControlPanelCollection notifActColl = device.createNotificationAction("/ControlPanel/MyDevice/areYouSure"); initCollectionTest(notifActColl); Log.d(TAG, "Calling removeNotificationAction()"); notifActColl.getDevice().removeNotificationAction(notifActColl); //======== Test the ControlPanel using addControlPanel ================// /*Log.d(TAG, "Test the ControlPanel using addControlPanel"); //Unit unit = device.addControlPanel("/ControlPanel/MyDevice/rootContainer", "org.alljoyn.ControlPanel.ControlPanel"); Unit unit = device.addControlPanel("/ControlPanel/MyDevice/areYouSure", "org.alljoyn.ControlPanel.ControlPanel"); for ( ControlPanelCollection coll : unit.getControlPanelCollection() ) { initCollectionTest(coll); } */ } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to create the NotificationAction application, Error: '" + cpe. getMessage() + "'"); } }//sessionEstablished @Override public void sessionLost(ControllableDevice device) { Log.d(TAG, "Received SESSION_LOST for device: '" + device.getDeviceId() + "'"); //If we lost session we don't want to store reference to the old UI widgets uiControls.clear(); uiControlsList.clear(); //reconnectSession(device); }//sessionLost @Override public void errorOccurred(ControllableDevice device, String reason) { Log.e(TAG, "Found error: '" + reason + "'"); }//errorOccurred @Override public void errorOccurred(DeviceControlPanel panel, String reason) { Log.e(TAG, "An error occurred in the DeviceControlPanel, name: '" + panel.getObjPath() + "' Panels name: '" + panel.getCollection().getName() + "', Reason: '" + reason + "'"); } @Override public void valueChanged(DeviceControlPanel panel, UIElement uielement, Object newValue) { Log.i(TAG, "VALUE_CHANGED : Received value changed signal, device: '" + panel.getDevice().getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "', NewValue: '" + newValue + "'"); } @Override public void metadataChanged(DeviceControlPanel panel, UIElement uielement) { UIElementType elementType = uielement.getElementType(); Log.i(TAG, "METADATA_CHANGED : Received metadata changed signal, device: '" + panel.getDevice().getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "', element type: '" + elementType + "'"); switch(elementType) { case CONTAINER: { ContainerWidget container = (ContainerWidget)uielement; Log.i(TAG, "Container metadata IsEnabled: '" + container.isEnabled() + "'"); break; } case ACTION_WIDGET: { ActionWidget action = (ActionWidget)uielement; Log.i(TAG, "Action metadata IsEnabled: '" + action.isEnabled() + "'"); break; } case PROPERTY_WIDGET: { PropertyWidget prop = (PropertyWidget)uielement; Log.i(TAG, "Property metadata IsEnabled: '" + prop.isEnabled() + "'"); break; } case ALERT_DIALOG : { AlertDialogWidget alertDialog = (AlertDialogWidget)uielement; Log.i(TAG, "AlertDialog metadata IsEnabled: '" + alertDialog.isEnabled() + "'"); break; } case LABEL_WIDGET: { LabelWidget labelWidget = (LabelWidget)uielement; Log.i(TAG, "LabelWidget metadata IsEnabled: '" + labelWidget.isEnabled() + "'"); break; } case ERROR_WIDGET: { break; } } }//metadataChanged @Override public void notificationActionDismiss(DeviceControlPanel panel) { Log.i(TAG, "NOTIFICATION_ACTION_DISMISS has been received, dismissing the panel: '" + panel.getObjPath()+ "'"); //Log.d(TAG, "Calling removeNotificationAction()"); //panel.getDevice().removeNotificationAction(panel.getCollection()); } //============================================// private void handleContainer(ContainerWidget container, boolean isFromList) { if ( container == null ) { Log.e(TAG, "The received main container is null"); return; } String fromList = ""; if ( isFromList ) { fromList = "(FROM LIST)"; try { container.refreshProperties(); } catch (ControlPanelException e) { Log.e(TAG, "Failed to update the properties of the ContainerWidget objPath: '" + container.getObjectPath() + "'"); return; } } Log.i(TAG, "===== " + fromList + " CONTAINER profiler ===== "); Log.i(TAG, "Received container, Version: '" + container.getVersion() + "', objPath: '" + container.getObjectPath() + "'" + " label: '" + container.getLabel() + "' bgColor: " + container.getBgColor() + " enabled: " + container.isEnabled()); List layHints = container.getLayoutHints(); if ( layHints == null || layHints.size() == 0 ) { Log.i(TAG, "Not found layout hints"); } Log.i(TAG, "LayoutHints: " + layHints); List elements = container.getElements(); if ( elements.size() == 0 ) { Log.d(TAG, "Not found any nested elements in the container"); return; } Log.i(TAG, "Iterating over the elements: "); for(UIElement element : elements) { UIElementType elementType = element.getElementType(); Log.d(TAG, "Found element of type: '" + elementType + "'"); switch(elementType) { case ACTION_WIDGET: { handleAction((ActionWidget)element, isFromList); addToUiControls(UIElementType.ACTION_WIDGET, element, isFromList); break; }//ACTION_WIDGET case CONTAINER: { handleContainer((ContainerWidget) element, isFromList); addToUiControls(UIElementType.CONTAINER, element, isFromList); break; }// CONTAINER case PROPERTY_WIDGET: { handleProperty((PropertyWidget) element, isFromList); addToUiControls(UIElementType.PROPERTY_WIDGET, element, isFromList); break; }//PROPERTY_WIDGET case LABEL_WIDGET: { handleLabel((LabelWidget) element, isFromList); addToUiControls(UIElementType.LABEL_WIDGET, element, isFromList); break; } case ALERT_DIALOG: { handleAlertDialog((AlertDialogWidget) element, isFromList); addToUiControls(UIElementType.ALERT_DIALOG, element, isFromList); break; } case ERROR_WIDGET: { handleErrorWidget((ErrorWidget) element); break; } }//switch :: elementType }//for :: elements addToUiControls(UIElementType.CONTAINER, container, isFromList); }//render private void handleProperty(PropertyWidget property, boolean isFromList) { String fromList = ""; if ( isFromList ) { fromList = "(FROM LIST)"; try { property.refreshProperties(); } catch (ControlPanelException e) { Log.e(TAG, "Failed to update the properties of the PropertyWidget objPath: '" + property.getObjectPath() + "'"); return; } } Log.i(TAG, "===== " + fromList + " PROPERTY profiler ===== "); ValueType valueType = property.getValueType(); Log.i(TAG, "Property of value type: '" + valueType + "', objPath: '" + property.getObjectPath() + "'"); Log.i(TAG, "Property Version: '" + property.getVersion() + "' label: '" + property.getLabel() + "' Writable: '" + property.isWritable() + "' unitOfMeas: '" + property.getUnitOfMeasure() + "', BGcolor: '" + property.getBgColor() + "' PropHints: '" + property.getHints() + "' Enabled: '" + property.isEnabled() + "'"); if ( property.getListOfConstraint() != null ) { Log.i(TAG, "Property List-Of-Constraints: "); for (ConstrainToValues valueCons : property.getListOfConstraint() ) { Log.i(TAG, " lovCons Value: " + valueCons.getValue() + " label: " + valueCons.getLabel()); } }//LOV constraints if ( property.getPropertyRangeConstraint() != null ) { RangeConstraint propRangeCons = property.getPropertyRangeConstraint(); Log.d(TAG, "Property Range Constraint, Min: " + propRangeCons.getMin() + " Max: " + propRangeCons.getMax() + " Increment: " + propRangeCons.getIncrement()); } Log.i(TAG, "===== END OF PROPERTY profiler ===== "); }//handleProperty private void handleAction(ActionWidget actionWidget, boolean isFromList) { String fromList = ""; if ( isFromList ) { fromList = "(FROM LIST)"; try { actionWidget.refreshProperties(); } catch (ControlPanelException e) { Log.e(TAG, "Failed to update the properties of the ActionWidget objPath: '" + actionWidget.getObjectPath() + "'"); return; } } Log.i(TAG, "===== " + fromList + " ACTION profiler ===== "); Log.i(TAG, "ActionWidget: objPath: '" + actionWidget.getObjectPath() + "'"); Log.i(TAG, "Version: '" + actionWidget.getVersion() + "' Enabled: '" + actionWidget.isEnabled() + "'" + " Label: '" + actionWidget.getLabel() + "' BGColor: '" + actionWidget.getBgColor() + "' actionHints: '" + actionWidget.getHints() + "'"); AlertDialogWidget alertDialog = actionWidget.getAlertDialog(); if ( alertDialog != null ) { Log.i(TAG, "The ActionWidget: objPath: '" + actionWidget.getObjectPath() + "' has AlertDialog in the sub tree, handling..."); handleAlertDialog(alertDialog, isFromList); addToUiControls(UIElementType.ALERT_DIALOG, alertDialog, isFromList); } else { Log.i(TAG, "The ActionWidget: objPath: '" + actionWidget.getObjectPath() + "' doesn't have the AlertDialog"); } }//handleAction private void handleAlertDialog(AlertDialogWidget alertDialog, boolean isFromList) { String fromList = ""; if ( isFromList ) { fromList = "(FROM LIST)"; try { alertDialog.refreshProperties(); } catch (ControlPanelException e) { Log.e(TAG, "Failed to update the properties of the AlertDialog objPath: '" + alertDialog.getObjectPath() + "'"); return; } } Log.i(TAG, "===== " + fromList + " ALERT_DIALOG profiler ===== "); Log.i(TAG, "AlertDialog: objPath: '" + alertDialog.getObjectPath() + "'"); Log.i(TAG, "Version: '" + alertDialog.getVersion() + "' Enabled: '" + alertDialog.isEnabled() + "'" + " Message: '" + alertDialog.getMessage() + "' NumActions: '" + alertDialog.getNumActions() + "'" + " Label: '" + alertDialog.getLabel() + "' BGColor: '" + alertDialog.getBgColor() + "' hints: '" + alertDialog.getHints() + "'"); Log.i(TAG, "===== END OF ALERT_DIALOG profiler ===== "); }//handleAlertDialog private void handleLabel(LabelWidget label, boolean isFromList) { String fromList = ""; if ( isFromList ) { fromList = "(FROM LIST)"; try { label.refreshProperties(); } catch (ControlPanelException e) { Log.e(TAG, "Failed to update the properties of the LabelWidget objPath: '" + label.getObjectPath() + "'"); return; } } Log.i(TAG, "==== " + fromList + " LABEL profiler ===== "); Log.i(TAG, "LabelWidget: objPath: '" + label.getObjectPath() + "'"); Log.i(TAG, "Version: '" + label.getVersion() + "' Enabled: '" + label.isEnabled() + "'" + " Label: '" + label.getLabel() + "' BGColor: '" + label.getBgColor() + "', LabelHints: '" + label.getHints() + "'"); Log.i(TAG, "===== END OF LABEL profiler ===== "); }//handleLabel private void handleErrorWidget(ErrorWidget errorWidget) { Log.w(TAG, "==== ERROR_WIDGET profiler ===== "); Log.w(TAG, "ErrorWidget: objPath: '" + errorWidget.getObjectPath() + "', failed to be created"); Log.w(TAG, "Default Error Label: '" + errorWidget.getLabel() + "' Error: '" + errorWidget.getError() + "', OriginalUIElement: '" + errorWidget.getOriginalUIElement() + "'"); Log.w(TAG, "===== END OF ERROR_WIDGET profiler ===== "); }//handleErrorWidget //=================================================// // TESTS // //=================================================// /** * @param collection Initialize test of the given collection */ private void initCollectionTest(ControlPanelCollection controlPanelCollection) { Unit unit = controlPanelCollection.getUnit(); try { Log.d(TAG, "Testing the UNIT: '" + unit.getUnitId() + "'"); if ( unit.getHttpIfaceObjPath() != null ) { Log.d(TAG, "The unit: '" + unit.getUnitId() + "' has a control, HTTPProtocol version: '" + unit.getHttpControlVersion() + " URL: '" + unit.getRootURL() + "'"); } } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to read attributes of the UNIT: '" + unit.getUnitId() + "'"); } Log.i(TAG, "Test the ControlPanelCollection name: '" + controlPanelCollection.getName() + "', objPath: '" + controlPanelCollection.getObjectPath() + "' collection languages: '" + controlPanelCollection.getLanguages() + "', ControlPanelVersion: '" + controlPanelCollection.getControlPanelVersion() + "', NotificationActionVersion: '" + controlPanelCollection.getNotificationActionVersion() + "'"); for ( DeviceControlPanel controlPanel : controlPanelCollection.getControlPanels() ) { uiControls.clear(); uiControlsList.clear(); Log.i(TAG, "STARTED TEST OF CONTROL PANEL, objPath: '" + controlPanel.getObjPath() + "', lang: '" + controlPanel.getLanguage() + "'"); try { UIElement rootContainerElement = controlPanel.getRootElement(this); if ( rootContainerElement == null ) { Log.e(TAG, "RootContainerElement wasn't created!!! Can't continue"); return; } UIElementType elementType = rootContainerElement.getElementType(); Log.d(TAG, "Found root container of type: '" + elementType + "'"); if ( elementType == UIElementType.CONTAINER ) { handleContainer((ContainerWidget)rootContainerElement, false); } else if ( elementType == UIElementType.ALERT_DIALOG ) { handleAlertDialog((AlertDialogWidget)rootContainerElement, false); addToUiControls(UIElementType.ALERT_DIALOG, (AlertDialogWidget)rootContainerElement, false); } runTestForUiControls(uiControls); }//try catch(ControlPanelException cpe) { Log.e(TAG, "Failed to access remote methods of control panel, Error: '" + cpe.getMessage() + "'"); continue; } Log.i(TAG, "FINISHED TEST OF THE CONTROL_PANEL: '" + controlPanel.getObjPath() + "'"); }//for :: ControlPanels }//initCollectionTest /** * Adds the tested UI widget to the UI controls list * @param type * @param element */ private void addToUiControls(UIElementType type, UIElement element, boolean isFromList) { List elements = null; if ( !isFromList ) { elements = uiControls.get(type); if ( elements == null ) { elements = new LinkedList(); uiControls.put(type, elements); } } else { elements = uiControlsList.get(type); if ( elements == null ) { elements = new LinkedList(); uiControlsList.put(type, elements); } } elements.add(element); }//addToUiControls /** * Run tests for UI controls */ @SuppressLint("DefaultLocale") private void runTestForUiControls(Map> uiControls) { Log.i(TAG, "==== START CONTROL TESTING ===="); for (UIElementType elementType : uiControls.keySet() ) { String elementTypeStr = elementType.toString().toUpperCase(); Log.d(TAG, "TEST element: '" + elementTypeStr + "'"); switch(elementType) { case CONTAINER: { List elements = uiControls.get(UIElementType.CONTAINER); for (UIElement element : elements) { ContainerWidget container = (ContainerWidget) element; try { Log.i(TAG, elementTypeStr + " - Test container: '" + container.getObjectPath() + "', Version: '" + container.getVersion() + "'"); Log.i(TAG, elementTypeStr + " - Refreshing CONTAINER metadata"); container.refreshProperties(); Log.i(TAG, elementTypeStr + " - The refreshed container ENABLE is: '" + container.isEnabled() + "'"); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed happened in calling remote object: '" + cpe.getMessage() + "'"); } }//for :: elements break; }//CONTAINER case PROPERTY_WIDGET: { List elements = uiControls.get(UIElementType.PROPERTY_WIDGET); for (UIElement element : elements) { PropertyWidget property = (PropertyWidget) element; try { Log.i(TAG, elementTypeStr + " - Test property: '" + property.getObjectPath() + "', Version: '" + property.getVersion() + "'" + " Type: '" + property.getValueType() + "', Current Property Value: '" + property.getCurrentValue() + "'"); Log.i(TAG, elementTypeStr + " - Refreshing PROPERTY"); property.refreshProperties(); Log.i(TAG, elementTypeStr + " - The refreshed property ENABLE is: '" + property.isEnabled() + "'"); Log.i(TAG, elementTypeStr +" - PROPERTY setting new value"); switch( property.getValueType() ) { case BOOLEAN :{ property.setCurrentValue(true); break; } case BYTE: { property.setCurrentValue((byte) 1); break; } case DOUBLE:{ property.setCurrentValue(123.45); break; } case INT: { property.setCurrentValue(123); break; } case LONG:{ property.setCurrentValue(111222323L); break; } case SHORT: { property.setCurrentValue((short)12); break; } case STRING: { property.setCurrentValue("THE NEW PROP VALUE: " + Math.random()); break; } case DATE: { Date dt = new PropertyWidget.Date(); dt.setDay((short)29); dt.setMonth((short)11); dt.setYear((short)1947); property.setCurrentValue(dt); break; }//DATE case TIME: { Time time = new PropertyWidget.Time(); time.setHour((short)23); time.setMinute((short)59); time.setSecond((short)59); property.setCurrentValue(time); }//TIME }//switch Log.i(TAG, elementTypeStr + " - Test property: '" + property.getObjectPath() + "', test NEW PROPERTY VALUE, call: property.getCurrentValue(): '" + property.getCurrentValue() + "'"); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed happened in calling remote object: '" + cpe.getMessage() + "'"); } }//for :: elements break; }//PROPERTY_WIDGET case ACTION_WIDGET: { List elements = uiControls.get(UIElementType.ACTION_WIDGET); for (UIElement element : elements) { ActionWidget action = (ActionWidget)element; try { Log.i(TAG, elementTypeStr + " - Test action: '" + action.getObjectPath() + "', Version: '" + action.getVersion() + "'"); Log.i(TAG, elementTypeStr + " - Refreshing ACTION metadata"); action.refreshProperties(); Log.i(TAG, elementTypeStr + " - The refreshed property ENABLE is: '" + action.isEnabled() + "'"); if ( action.getAlertDialog() == null ) { Log.i(TAG, "AlertDialog is not found in the action, calling Action.exec"); action.exec(); Log.i(TAG, "Action.exec was called successfully"); } else { Log.i(TAG, "The action: '" + action.getObjectPath() + "', has alertDialog, not calling exec"); } } catch (ControlPanelException cpe) { Log.e(TAG, "Failed happened in calling remote object: '" + cpe.getMessage() + "'"); } }//for :: elements break; }//ACTION_WIDGET case ALERT_DIALOG: { List elements = uiControls.get(UIElementType.ALERT_DIALOG); for (UIElement element : elements) { AlertDialogWidget alertDialog = (AlertDialogWidget)element; try { Log.i(TAG, elementTypeStr + " - Test alertDialog: '" + alertDialog.getObjectPath() + "', Version: '" + alertDialog.getVersion() + "'"); Log.i(TAG, elementTypeStr + " - Refreshing AlertDialog"); alertDialog.refreshProperties(); Log.i(TAG, elementTypeStr + " - The refreshed AlertDialog ENABLE is: '" + alertDialog.isEnabled() + "'"); List buttons = alertDialog.getExecButtons(); Log.i(TAG, "The AlertDialog objPath: '" + alertDialog.getObjectPath() + "', has '" + buttons.size() + "' buttons"); for (DialogButton button : buttons) { Log.i(TAG, "Found button '" + button.getLabel() + "', pressing"); button.exec(); } } catch (ControlPanelException cpe) { Log.e(TAG, "Failed happened in calling remote object: '" + cpe.getMessage() + "'"); } }//for :: elements break; }//ALERT_DIALOG case LABEL_WIDGET: { List elements = uiControls.get(UIElementType.LABEL_WIDGET); for (UIElement element : elements) { LabelWidget label = (LabelWidget)element; try { Log.i(TAG, elementTypeStr + " - Test LabelWidget: '" + label.getObjectPath() + "', Version: '" + label.getVersion() + "'"); Log.i(TAG, elementTypeStr + " - Refreshing LABEL_WIDGET"); label.refreshProperties(); Log.i(TAG, elementTypeStr + " - The refreshed property ENABLE is: '" + label.isEnabled() + "'"); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed happened in calling remote object: '" + cpe.getMessage() + "'"); } }//for :: elements break; }//LABEL_WIDGET case ERROR_WIDGET: { break; } }//switch :: elementType }//for::elementType Log.i(TAG, "==== TEST IS COMPLETED ==== "); }//runTestForUiControls } MyLogger.java000066400000000000000000000031001272147170000364720ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/applicationpackage org.alljoyn.ioe.controlpanelservice.application; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /* import org.alljoyn.about.GenericLogger; import android.util.Log; public class MyLogger implements GenericLogger { @Override public void debug(String TAG, String msg) { Log.d(TAG, msg); } @Override public void info(String TAG, String msg) { Log.i(TAG, msg); } @Override public void warn(String TAG, String msg) { Log.w(TAG, msg); } @Override public void error(String TAG, String msg) { Log.e(TAG, msg); } @Override public void fatal(String TAG, String msg) { Log.wtf(TAG, msg); } } */communication/000077500000000000000000000000001272147170000344525ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelserviceAnnouncementReceiver.java000066400000000000000000000076051272147170000414440ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantUtil; import org.alljoyn.services.common.AnnouncementHandler; import org.alljoyn.services.common.BusObjectDescription; import org.alljoyn.services.common.utils.TransportUtil; import android.os.Handler; import android.os.Message; import android.util.Log; /** * Receives announcement signals */ public class AnnouncementReceiver implements AnnouncementHandler { private static final String TAG = "cpan" + AnnouncementReceiver.class.getSimpleName(); /** * @see org.alljoyn.services.common.AnnouncementHandler#onAnnouncement(java.lang.String, short, org.alljoyn.services.common.BusObjectDescription[], java.util.Map) */ @Override public void onAnnouncement(String serviceName, short port, BusObjectDescription[] objectDescriptions, Map aboutData) { Log.v(TAG, "Received Announcement signal"); Handler handler = ConnectionManager.getInstance().getHandler(); if ( handler == null ) { return; } UUID appId; String deviceId; try { Variant varAppId = aboutData.get(AboutKeys.ABOUT_APP_ID); String appIdSig = VariantUtil.getSignature(varAppId); if ( !appIdSig.equals("ay") ) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_APP_ID + "', that has an unexpected signature: '" + appIdSig + "', the expected signature is: 'ay'"); return; } byte[] rawAppId = varAppId.getObject(byte[].class); appId = TransportUtil.byteArrayToUUID(rawAppId); if ( appId == null ) { Log.e(TAG, "Failed to translate the received AppId into UUID"); return; } Variant varDeviceId = aboutData.get(AboutKeys.ABOUT_DEVICE_ID); String devIdSig = VariantUtil.getSignature(varDeviceId); if ( !devIdSig.equals("s") ) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_DEVICE_ID + "', that has an unexpected signature: '" + devIdSig + "', the expected signature is: 's'"); return; } deviceId = varDeviceId.getObject(String.class); } catch (BusException be) { Log.e(TAG, "Failed to retreive an Announcement properties, Error: '" + be.getMessage() + "'"); return; } Map args = new HashMap(); args.put("SENDER", serviceName); args.put("DEVICE_ID", deviceId); args.put("APP_ID", appId.toString()); args.put("OBJ_DESC", objectDescriptions); Message.obtain(handler, ConnManagerEventType.ANNOUNCEMENT_RECEIVED.ordinal(), args).sendToTarget(); }//onAnnouncement /** * @see org.alljoyn.services.common.AnnouncementHandler#onDeviceLost(java.lang.String) */ @Override public void onDeviceLost(String serviceName) {} } CommunicationUtil.java000066400000000000000000000163411272147170000407650ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.lang.reflect.Method; import org.alljoyn.bus.SessionOpts; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControlSuper; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialogSuper; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ContainerSuper; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ControlPanel; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.HTTPControl; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Label; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.NotificationAction; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControlSuper; import android.util.Log; /** * Communication utilities class */ public class CommunicationUtil { private static final String TAG = "cpan" + CommunicationUtil.class.getSimpleName(); /** * @return MetadataChanged reflection for container */ public static Method getContainerMetadataChanged(String name) { try { return ContainerSuper.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getContainerMetadataChanged /** * @return MetadataChanged reflection for property metadata changed signal */ public static Method getPropertyMetadataChanged(String name) { try { return PropertyControlSuper.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getContainerMetadataChanged /** * @return MetadataChanged reflection for property value changed signal */ public static Method getPropertyValueChanged(String name) { try { return PropertyControlSuper.class.getMethod(name, Variant.class ); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getContainerMetadataChanged /** * @return MetadataChanged reflection for action metadata changed signal */ public static Method getActionMetadataChanged(String name) { try { return ActionControlSuper.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getContainerMetadataChanged /** * @return reflection for alert dialog metadata changed signal */ public static Method getAlertDialogMetadataChanged(String name) { try { return AlertDialogSuper.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getAlertDialogMetadataChanged /** * @return reflection for label widget metadata changed signal */ public static Method getLabelWidgetMetadataChanged(String name) { try { return Label.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getAlertDialogMetadataChanged /** * @return reflection for {@link NotificationAction} signal */ public static Method getNotificationActionDismissSignal(String name) { try { return NotificationAction.class.getMethod(name); } catch (NoSuchMethodException nsme) { Log.e(TAG, "Not found reflection of " + name + " method"); } return null; }//getNotificationActionDismissSignal /** * Creates SessionOpts * @return SessionOpts to be used to advertise service and ot join session */ public static SessionOpts getSessionOpts(){ SessionOpts sessionOpts = new SessionOpts(); sessionOpts.traffic = SessionOpts.TRAFFIC_MESSAGES; // Use reliable message-based communication to move data between session endpoints sessionOpts.isMultipoint = false; // A session is multi-point if it can be joined multiple times sessionOpts.proximity = SessionOpts.PROXIMITY_ANY; // Holds the proximity for this SessionOpt sessionOpts.transports = SessionOpts.TRANSPORT_ANY; // Holds the allowed transports for this SessionOpt return sessionOpts; }//getSessionOpts /** * Test the given interfaces list
* If an interface from the given interfaces list is a top level interface then adds it to a resultant mask * @param interfaces The interfaces to test * @return Interfaces resultant mask */ public static int getInterfaceMask(String... interfaces) { int resMask = 0; if ( interfaces == null ) { return resMask; } for (String iface : interfaces) { if ( iface.equals(ControlPanel.IFNAME) ) { resMask |= ControlPanel.ID_MASK; } else if ( iface.equals(HTTPControl.IFNAME) ) { resMask |= HTTPControl.ID_MASK; } else if ( iface.equals(NotificationAction.IFNAME) ) { resMask |= NotificationAction.ID_MASK; } }//for :: interfaces return resMask; }//parseInterfaces /** * Checks whether the given numToTest includes the mask * @param numToTest * @param mask * @return TRUE if includes */ public static boolean maskIncludes(int numToTest, int mask) { return (numToTest & mask) == mask; }//maskIncludes /** * Parses the objectPath of the form of: /ControlPanel/{unitId}/{panelId} * @param objPath The objPath to parse * @return Array(0 => unitId, 1 => panelId) */ public static String[] parseObjPath(String objPath) throws ControlPanelException { String[] segments = objPath.split("/"); int segLength = segments.length; if ( segLength == 0 ) { throw new ControlPanelException("Received a broken object path: '" + objPath + "'"); } String panelId = segments[segLength - 1]; // The name of the control panel String unitId; // The name of the functional unit if ( (segLength - 2) >= 0 ) { unitId = segments[segLength - 2]; } else { unitId = "unknown"; } return new String[]{unitId, panelId}; }//parseObjPath } ConnManagerEventType.java000066400000000000000000000023411272147170000413510ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; /** * Connection Manager events */ public enum ConnManagerEventType { ANNOUNCEMENT_RECEIVED, SESSION_JOINED, SESSION_JOIN_FAIL, SESSION_LOST, FOUND_DEVICE, LOST_DEVICE, ; } ConnManagerEventsListener.java000066400000000000000000000026461272147170000424100ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.util.Map; /** * Used to notify observers about the connection manager events */ public interface ConnManagerEventsListener { /** * The method is launched when the event happened in ConnectionManager * @param eventType The type of the event * @param args */ public void connMgrEventOccured(ConnManagerEventType eventType, Map args); } ConnectionManager.java000066400000000000000000000401751272147170000407160ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.lang.reflect.Method; import java.util.Comparator; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentSkipListSet; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusListener; import org.alljoyn.bus.OnJoinSessionListener; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.SessionListener; import org.alljoyn.bus.SessionOpts; import org.alljoyn.bus.Status; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.util.Log; /** * Performs AJ communication for controller */ public class ConnectionManager implements Handler.Callback { private class ConnMgrBusListener extends BusListener { /** * @see org.alljoyn.bus.BusListener#foundAdvertisedName(java.lang.String, short, java.lang.String) */ @Override public void foundAdvertisedName(String name, short transport, String namePrefix) { if ( bus == null ) { return; } bus.enableConcurrentCallbacks(); Map args = new HashMap(); args.put("SENDER", name); if ( handler != null ) { Message.obtain(handler, ConnManagerEventType.FOUND_DEVICE.ordinal(), args).sendToTarget(); } }//foundAdvertisedName /** * @see org.alljoyn.bus.BusListener#lostAdvertisedName(java.lang.String, short, java.lang.String) */ @Override public void lostAdvertisedName(String name, short transport, String namePrefix) { bus.enableConcurrentCallbacks(); Map args = new HashMap(); args.put("SENDER", name); if ( handler != null ) { Message.obtain(handler, ConnManagerEventType.LOST_DEVICE.ordinal(), args).sendToTarget(); } }//lostAdvertisedName } //===================================================// /** * Events listener of lost session */ private class ConnMgrSessionListener extends SessionListener { @Override public void sessionLost(int sessionId, int reason) { Log.d(TAG, "Received SESSION_LOST for session: '" + sessionId + "', Reason: '" + reason + "'"); Map args = new HashMap(); args.put("SESSION_ID", sessionId); if ( handler != null ) { Message.obtain(handler, ConnManagerEventType.SESSION_LOST.ordinal(), args).sendToTarget(); } }//sessionLost }//ControlPanelSessionListener //=====================================================// /** * OnJoinSession events listener */ private class ConnMgrOnJoinSessionListener extends OnJoinSessionListener { @Override public void onJoinSession(Status status, int sessionId, SessionOpts opts, Object context) { super.onJoinSession(status, sessionId, opts, context); Map args = new HashMap(); args.put("DEVICE_ID", context.toString()); args.put("STATUS", status); if (status != Status.OK) { Log.e(TAG, "JoinSessionCB - Failed to join session, device: '" + context.toString() +"' Status: '" + status + "'"); if ( handler != null ) { Message.obtain(handler, ConnManagerEventType.SESSION_JOIN_FAIL.ordinal(), args).sendToTarget(); } return; } Log.d(TAG, "JoinSessionCB - Succeeded to join session, device: '" + context.toString() +"' SID: '" + sessionId + "'"); args.put("SESSION_ID", sessionId); if ( handler != null ) { Message.obtain(handler, ConnManagerEventType.SESSION_JOINED.ordinal(), args).sendToTarget(); } }//onJoinSession }//ControlPanelOnJoinSessionListener //=====================================================// private class ListenersComparator implements Comparator { @Override public int compare(ConnManagerEventsListener lhs, ConnManagerEventsListener rhs) { if ( lhs.hashCode() > rhs.hashCode() ) { return 1; } if ( lhs.hashCode() < rhs.hashCode() ) { return -1; } else { return 0; } }//compare }//ListenersComparator //=============================================================// // END OF NESTED CLASSES // //=============================================================// private static final String TAG = "cpan" + ConnectionManager.class.getSimpleName(); private static final ConnectionManager SELF = new ConnectionManager(); public static final String ANNOUNCE_SIGNAL_NAME = "Announce"; private static final short PORT_NUMBER = 1000; /** * BusAttachment */ private BusAttachment bus; /** * AJ Session listener object */ private ConnMgrSessionListener sessionListener; /** * AJ On join session listener */ private ConnMgrOnJoinSessionListener onJoinSessionListener; /** * AJ Bus listener */ private ConnMgrBusListener busListener; /** * Announcement receiver */ private AnnouncementReceiver announcementReceiver; /** * Events listeners */ private volatile Map> listenersContainer; /** * Handler thread for the Looper thread */ private HandlerThread handlerThread; /** * Handler */ private Handler handler; /** * Constructor */ private ConnectionManager(){ listenersContainer = new EnumMap>(ConnManagerEventType.class); sessionListener = new ConnMgrSessionListener(); onJoinSessionListener = new ConnMgrOnJoinSessionListener(); busListener = new ConnMgrBusListener(); } /** * @return ConnectionManager instance */ public static ConnectionManager getInstance() { return SELF; } /** * @see android.os.Handler.Callback#handleMessage(android.os.Message) */ @Override public boolean handleMessage(Message msg) { ConnManagerEventType eventType = ConnManagerEventType.values()[msg.what]; Log.d(TAG, "Received message type: '" + eventType + "'"); @SuppressWarnings("unchecked") Map args = (Map)msg.obj; notifyListeners(eventType, args); return true; }//handleMessage /** * Set bus attachment to be used * @param busAttachment */ public void setBusAttachment(BusAttachment busAttachment) throws ControlPanelException { if ( busAttachment == null || !busAttachment.isConnected() ) { throw new ControlPanelException("The received BusAttachment is not connected"); } if ( bus != null ) { throw new ControlPanelException("The BusAttachment already exists"); } if ( handlerThread == null ) { handlerThread = new HandlerThread("ControlPanelConnMgr"); handlerThread.start(); handler = new Handler(handlerThread.getLooper(), this); } bus = busAttachment; bus.registerBusListener(busListener); }//setBusAttachment /** * Returns handler * @return */ public Handler getHandler() { return handler; }//returns handler /** * @return BusAttachement that in use of the ConnectionManager */ public BusAttachment getBusAttachment() { return bus; } /** * @return {@link AnnouncementReceiver} object */ public AnnouncementReceiver getAnnouncementReceiver() { return announcementReceiver; } /** * Add listener to be notified when the event of eventType happened * @param eventType * @param listener The listener object */ public void registerEventListener(ConnManagerEventType eventType, ConnManagerEventsListener listener) { synchronized (listenersContainer) { Set listeners = listenersContainer.get(eventType); if ( listeners == null ) { listeners = new ConcurrentSkipListSet( new ListenersComparator() ); listeners.add(listener); listenersContainer.put(eventType, listeners); } else { listeners.add(listener); }//listener == null }//synch }//registerEventListener /** * Removes the listener from receiving events of type eventType * @param eventType * @param listener */ public void unregisterEventListener (ConnManagerEventType eventType, ConnManagerEventsListener listener) { Set listeners = listenersContainer.get(eventType); if ( listeners == null) { return; } else { listeners.remove(listener); } }//unregisterEventListener /** * Notify the events listeners * @param eventType */ public void notifyListeners(ConnManagerEventType eventType, Map args) { Set listeners = listenersContainer.get(eventType); if ( listeners == null ) { return; } else { // notify listeners for (ConnManagerEventsListener listener : listeners) { listener.connMgrEventOccured(eventType, args); } } }//notify listeners /** * Start find advertised name * @param wellKnownName * @return Status AllJoyn Status * @throws ControlPanelException if failed to execute findAdvertisedName */ public Status findAdvertisedName(String wellKnownName) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("The BusAttachment is not defined"); } return bus.findAdvertisedName(wellKnownName); }//findAdvertisedName /** * Cancel findAdvertisedName * @return AllJoyn Status * @throws ControlPanelException If failed to execute cancelFindAdvertisedName */ public Status cancelFindAdvertisedName(String wellKnownName) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("The BusAttachment is not defined"); } return bus.cancelFindAdvertisedName(wellKnownName); } /** * Register bus object that is intended to be signal handler * @param ifName Interface name that signal handler object belongs to * @param signalName * @param handlerMethod The reflection of the method that is handling the signal * @param toBeRegistered The object to be registered on the bus and set to be signal handler * @param servicePath The identifier of the object * @param source The object path to receive signals from * @throws ControlPanelException if failed to register signal handler */ public void registerObjectAndSetSignalHandler(String ifName, String signalName, Method handlerMethod, Object toBeRegistered, String objectPath, String source) throws ControlPanelException { Log.d(TAG, "Registering BusObject and setting signal handler, IFName: '" + ifName + ", method: '" + handlerMethod.getName() + "'"); if ( bus == null ) { throw new ControlPanelException("Not initialized BusAttachment"); } Status status; if ( source.length() == 0 ) { Log.d(TAG, "Registering signal handler without source object"); status = bus.registerSignalHandler(ifName, signalName, toBeRegistered, handlerMethod); } else { Log.d(TAG, "Registering signal handler with source object: '" + source + "'"); status = bus.registerSignalHandler(ifName, signalName, toBeRegistered, handlerMethod, source); } if ( status == Status.OK ) { Log.d(TAG, "Signal receiver ifname: '" + ifName + "', signal '" + signalName + "' registered successfully"); } else { Log.e(TAG, "Failed to register signal handler, status: '" + status + "'"); throw new ControlPanelException("Failed to register signal handler"); } status = bus.addMatch("type='signal',interface='" + ifName + "',member='" + signalName + "'"); if ( status != Status.OK ) { Log.e(TAG, "Failed to register addMatch rule for interface: '" + ifName + "',signal: '" + signalName + "', status: '" + status + "'"); throw new ControlPanelException("Failed to register signal handler"); } }//registerObjectAndSetSignalHandler /** * Unregisters the signal handler and the bus object * @param receiverObj * @param handlerMethod * @throws ControlPanelException if failed to register signal handler */ public void unregisterSignalHandler(Object receiverObj, Method handlerMethod) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("The BusAttachment is not defined"); } bus.unregisterSignalHandler(receiverObj, handlerMethod); }//unregisterObjectAndSignalHandler /** * Join session with the sender's host * @param sender The host to join the session with * @param deviceId The device Id this join session request belongs to * @return Return status whether the synchronous part of join session succeeded * @throws ControlPanelException if failed to register signal handler */ public Status joinSession(String sender, String deviceId) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("The BusAttachment is not defined"); } Status status = bus.joinSession(sender, PORT_NUMBER, getSessionOpts(), sessionListener, onJoinSessionListener, deviceId); return status; }//joinSession /** * @param sessionId Leave session */ public Status leaveSession(int sessionId) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("LeaveSession was called, but BusAttachment has not been defined"); } return bus.leaveSession(sessionId); }//leaveSession /** * Creates proxy bus object and returns the desired interface * @param busName * @param objPath * @param sessionId * @param busInterfaces * @param iface The desired interface class * @return * @throws ControlPanelException if failed to register signal handler */ public ProxyBusObject getProxyObject(String busName, String objPath, int sessionId, Class[] busInterfaces) throws ControlPanelException { if ( bus == null ) { throw new ControlPanelException("The BusAttachment is not defined"); } ProxyBusObject proxyObj = bus.getProxyBusObject(busName, objPath, sessionId, busInterfaces); return proxyObj; } /** * Shutdown the connection manager */ public void shutdown() { Log.d(TAG, "Shutdown the ConnectionMgr service"); if ( handlerThread != null ) { handlerThread.getLooper().quit(); handlerThread = null; handler = null; } bus = null; }//shutdown //================= PRIVATE ==================// /** * Creates SessionOpts * @return SessionOpts to be used to advertise service and ot join session */ private SessionOpts getSessionOpts(){ SessionOpts sessionOpts = new SessionOpts(); sessionOpts.traffic = SessionOpts.TRAFFIC_MESSAGES; // Use reliable message-based communication to move data between session endpoints sessionOpts.isMultipoint = false; // A session is multi-point if it can be joined multiple times sessionOpts.proximity = SessionOpts.PROXIMITY_ANY; // Holds the proximity for this SessionOpt sessionOpts.transports = SessionOpts.TRANSPORT_ANY; // Holds the allowed transports for this SessionOpt return sessionOpts; }//getSessionOpts } IntrospectionNode.java000066400000000000000000000225051272147170000407670ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; import java.util.LinkedList; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.ifaces.Introspectable; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import android.util.Log; public class IntrospectionNode { class NoOpEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, java.io.IOException { return new InputSource(new ByteArrayInputStream("".getBytes())); } } //=============================================// class IntrospectionParser extends DefaultHandler{ private XMLReader xmlReader = null; private SAXParser saxParser = null; private IntrospectionNode currentNode = null; private boolean sawRootNode = false; public IntrospectionParser() throws IOException, ParserConfigurationException, SAXException { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(false); saxParser = spf.newSAXParser(); xmlReader = saxParser.getXMLReader(); xmlReader.setContentHandler(this); xmlReader.setEntityResolver(new NoOpEntityResolver()); } public void parse(IntrospectionNode node, String xml) throws SAXException { this.currentNode = node; sawRootNode = false; try{ xmlReader.parse(new InputSource(new StringReader(xml))); }catch(IOException cantReallyHappen) { Log.e("IntrospectionNode", "Failed to read the XML: '" + cantReallyHappen.getMessage() + "', ", cantReallyHappen); } this.currentNode = null; } public void startElement(String namespaceURI, String localName, String qName, Attributes attrs) throws SAXException { if(qName.equals("node")) { if(!sawRootNode) { sawRootNode = true; return; } currentNode.addChild(getNameAttr(attrs)); }else if(qName.equals("interface")){ if(null == currentNode) throw new SAXException("interface not in node"); currentNode.interfaces.add(getNameAttr(attrs)); } } private String getNameAttr(Attributes attrs) throws SAXException { int i = attrs.getIndex("name"); if(-1 == i) throw new SAXException("inner node without a name"); return attrs.getValue(i); } } //================================================// // END OF NESTED CLASSES // //================================================// private boolean parsed = false; private String path = null; private IntrospectionParser parser = null; private List children = new LinkedList(); private List interfaces = new LinkedList(); public IntrospectionNode(String path) throws ParserConfigurationException, IOException, SAXException { this.path = path; this.parser = new IntrospectionParser(); } private IntrospectionNode(String path, IntrospectionParser parser){ this.path = path; this.parser = parser; } protected void addChild(String name) { StringBuilder sb = new StringBuilder(path); if(!name.endsWith("/")) sb.append('/'); sb.append(name); children.add(new IntrospectionNode(sb.toString(), parser)); } public String getPath() { return path; } public boolean isParsed() { return parsed; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(path); sb.append('\n'); if(!parsed) { sb.append(" Not parsed\n"); return sb.toString(); } for(String ifc : interfaces) { sb.append(' '); sb.append(ifc); sb.append('\n'); } for(IntrospectionNode node : children ) { sb.append(node.toString()); } return sb.toString(); } public void parse(BusAttachment bus, String busName, int sessionId) throws SAXException, ControlPanelException { String xml = getInstrospection(bus, busName, path, sessionId); parse(xml); for (IntrospectionNode childNode : children) { childNode.parse(bus, busName, sessionId); } }//parse public void parseOneLevel(BusAttachment bus, String busName, int sessionId) throws SAXException, ControlPanelException { String xml = getInstrospection(bus, busName, path, sessionId); parse(xml); } public void parse(String xml) throws SAXException { parser.parse(this, xml); parsed = true; }//parse public List getChidren() { return children; } public List getInterfaces() { return interfaces; } /** * Get introspection of the object path * @param bus BusAttachment * @param busName * @param objPath * @param sessionId * @return Introspection XML * @throws ControlPanelException If failed to get the introspection */ public static String getInstrospection(BusAttachment bus, String busName, String objPath, int sessionId) throws ControlPanelException { Log.v("IntrospectionNode", "Introspecting the Object: '" + objPath + "', BusUniqueName: '" + busName + "', sessionId: '" + sessionId + "'"); ProxyBusObject proxyObj = bus.getProxyBusObject(busName, objPath, sessionId, new Class[]{Introspectable.class}); Introspectable introObj = proxyObj.getInterface(Introspectable.class); String introXML; try { introXML = introObj.Introspect(); } catch (BusException be) { throw new ControlPanelException("Failed to get introspection of: '" + objPath + "', Error: '" + be.getMessage() + "'"); } proxyObj.release(); return introXML; }//getIntrospection /* public static void main(String[] args) throws Exception { IntrospectionNode n = new IntrospectionNode("/josh"); n.parse(blob); System.out.println(n.toString()); } static private String blob = " "; */ } TaskManager.java000066400000000000000000000126321272147170000375160ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import android.util.Log; /** * The thread pool manager is used to handle different tasks.
* The tasks can be executed instantly by invoking the {@link TaskManager#execute(Runnable)} method, or * they may be enqueued and executed later, by calling the {@link TaskManager#enqueue(Runnable)} method */ public class TaskManager implements RejectedExecutionHandler { private static final String TAG = "cpan" + TaskManager.class.getSimpleName(); /** * Self reference for singleton */ private static final TaskManager SELF = new TaskManager(); /** * Gets TRUE if the object is valid, which means it has been initialized */ private volatile boolean isValid; /** * The thread TTL time */ private static final long THREAD_TTL = 3; /** * The thread TTL time unit */ private static final TimeUnit TTL_TIME_UNIT = TimeUnit.SECONDS; /** * Amount of the core threads */ private static final int THREAD_CORE_NUM = 4; /** * The maximum number of threads that may be spawn */ private static final int THREAD_MAX_NUM = 10; /** * Thread pool object */ private ThreadPoolExecutor threadPool; /** * The queue of tasks to be handled sequentially */ private ExecutorService taskQueue; /** * Constructor */ private TaskManager() {} /** * @return {@link TaskManager} instance */ public static TaskManager getInstance() { return SELF; } /** * Initializes the thread pool * @param nativePlatform The reference to the platform dependent object */ public void initPool() { Log.d(TAG, "Initializing TaskManager"); initThreadPool(); initTaskQueue(); isValid = true; } /** * @param task Executes the given {@link Runnable} task if there is a free thread worker * @throws IllegalStateException if the object has not been initialized */ public void execute(Runnable task) { checkValid(); Log.d(TAG,"Executing task, Current Thread pool size: '" + threadPool.getPoolSize() + "', 'Number of currently working threads: '" + threadPool.getActiveCount() + "'"); threadPool.execute(task); } /** * Enqueue the given {@link Runnable} task to be executed later * @param task to executed * @throws IllegalStateException if the object has not been initialized */ public void enqueue(Runnable task){ checkValid(); Log.d(TAG, "Enqueueing task to be executed"); taskQueue.execute(task); } /** * @return TRUE if the {@link TaskManager} has been initialized and it is running */ public boolean isRunning() { return isValid; } /** * Tries to stop the thread pool and all its threads * @throws IllegalStateException if the object has not been initialized */ public void shutdown() { Log.d(TAG, "Shutting down TaskManager"); isValid = false; if ( threadPool != null && !threadPool.isShutdown() ) { threadPool.shutdown(); threadPool = null; } if ( taskQueue != null && !taskQueue.isShutdown() ) { taskQueue.shutdown(); taskQueue = null; } } /** * The callback is called, when there are no free threads to execute the given task */ @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { throw new RejectedExecutionException("Failed to execute the given task, all the worker threads are busy"); } //=================================================// /** * Checks the object validity * @throws IllegalStateException if the object hasn't been initialized */ private void checkValid() { if ( !isValid ){ throw new IllegalStateException("The WorkPoolManager has not been initialized. " + "The initPool mathod should have been invoked"); } } /** * Initialize the threadpool */ private void initThreadPool() { threadPool = new ThreadPoolExecutor( THREAD_CORE_NUM, THREAD_MAX_NUM, THREAD_TTL, TTL_TIME_UNIT, new SynchronousQueue(true) // The fair order FIFO ); threadPool.setRejectedExecutionHandler(this); } /** * Initialize the task queue */ private void initTaskQueue() { taskQueue = Executors.newSingleThreadExecutor(); } } UIWidgetSignalHandler.java000066400000000000000000000137551272147170000414450ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ui.UIElement; import android.util.Log; /** * The class includes all the required data to register/unregister signals
* Additionally the class has a logic to dispatch the received signals to be handled on the separate thread from AllJoyn */ public class UIWidgetSignalHandler implements InvocationHandler { private static final String TAG = "cpan" + UIWidgetSignalHandler.class.getSimpleName(); /** * MetadataChanged signal refreshes the {@link UIElement} object properties which it was sent for. * This is done by executing {@link org.alljoyn.bus.ifaces.Properties#GetAll(String)} method. * To avoid load on the AJ daemon when it receives multiple METADATA_CHANGED signals, we handle them * sequentially on a separate thread by invoking {@link TaskManager#enqueue(Runnable)}. * All the other signals that are just delegated to an appropriate listener will be simultaneously * handled by a separate thread from the {@link TaskManager} thread pool by invoking {@link TaskManager#execute(Runnable)} */ private static final String METADATA_CHANGED = "MetadataChanged"; /** * The object path that is used as a signal source. */ private String objPath; /** * The real signal handler object */ private Object signalReceiver; /** * The proxy object signal handler is created based on the {@link Proxy} * This is the object that actually receives signals from the daemon and its {@link InvocationHandler} dispatches * the signal to be handled on the separate thread from AllJoyn. * Signal handling logic is executed in the signalReceiver object */ private Object proxySignalReceiver; /** * The reflection of the signal method */ private Method method; /** * The interface of the signal */ private String ifName; /** * Constructor * @param objPath The object path that is used as a signal source. * @param signalReceiver The signal receiver object * @param method The reflection of the signal method * @param ifName The interface of the signal */ public UIWidgetSignalHandler(String objPath, Object signalReceiver, Method method, String ifName) { this.objPath = objPath; this.signalReceiver = signalReceiver; this.method = method; this.ifName = ifName; } /** * Registers signal handler * @throws ControlPanelException */ public void register() throws ControlPanelException { Class[] ifaceList = signalReceiver.getClass().getInterfaces(); if ( ifaceList.length == 0 ) { String msg = "Received signalReceiver object doesn't implement any interface"; Log.e(TAG, msg); throw new ControlPanelException(msg); } proxySignalReceiver = createProxySignalReceiver(ifaceList); ConnectionManager.getInstance().registerObjectAndSetSignalHandler( ifName, method.getName(), method, proxySignalReceiver, objPath, objPath ); }//register /** * Unregisters signal handler * @throws ControlPanelException */ public void unregister() throws ControlPanelException { Log.v(TAG, "Unregistering signal handler: '" + method.getName() + "', objPath: '" + objPath + "'"); ConnectionManager.getInstance().unregisterSignalHandler(proxySignalReceiver, method); signalReceiver = null; proxySignalReceiver = null; }//unregister /** * Create {@link Proxy} object based on the given array of interface classes * @return Created object */ private Object createProxySignalReceiver(Class[] ifaceClassList) { return Proxy.newProxyInstance(ifaceClassList[0].getClassLoader(), ifaceClassList, this); } /** * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) */ @Override public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { Runnable task = new Runnable() { @Override public void run() { try { method.invoke(signalReceiver, args); } catch (Exception e) { Log.d(TAG, "Failed to invoke the method: '" + method.getName() + "', Error: '" + e.getMessage() + "'", e); } } }; //Received METADATA_CHANGED signal enqueue it to be executed if ( METADATA_CHANGED.equals(method.getName()) ) { Log.d(TAG, "Received '" + METADATA_CHANGED + "' signal storing it in the queue for later execution"); TaskManager.getInstance().enqueue(task) ; } else { Log.d(TAG, "Received '" + method.getName() + "' signal passing it for execution"); TaskManager.getInstance().execute(task); } return null; }//invoke } interfaces/000077500000000000000000000000001272147170000365755ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communicationActionControl.java000066400000000000000000000045771272147170000422330ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Action control interface */ @BusInterface (name = ActionControl.IFNAME) public interface ActionControl extends ActionControlSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".Action"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * Called when the action is executed on the widget */ @BusMethod public void Exec() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } ActionControlSecured.java000066400000000000000000000047171272147170000435420ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.bus.annotation.Secure; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Action control secured interface */ @BusInterface (name = ActionControlSecured.IFNAME) @Secure public interface ActionControlSecured extends ActionControlSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".SecuredAction"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * Called when the action is executed on the widget */ @BusMethod public void Exec() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } ActionControlSuper.java000066400000000000000000000036061272147170000432420ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; /** * The parent interface of the {@link ActionControl} and {@link ActionControlSecured} interfaces */ public interface ActionControlSuper { /** * @return Interface version */ public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ public Map getOptParams() throws BusException; /** * Called when the action is executed on the widget */ public void Exec() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ public void MetadataChanged() throws BusException; } AlertDialog.java000066400000000000000000000056121272147170000416330ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Dialog interface */ @BusInterface (name = AlertDialog.IFNAME) public interface AlertDialog extends AlertDialogSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".Dialog"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * @return Returns the dialog message * @throws BusException */ @BusProperty(signature="s") public String getMessage() throws BusException; /** * @return Returns the number of the dialog buttons * @throws BusException */ @BusProperty(signature="q") public short getNumActions() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action1() throws BusException;; /** * Call the method if is relevant */ @BusMethod public void Action2() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action3() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } AlertDialogSecured.java000066400000000000000000000057351272147170000431540ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.bus.annotation.Secure; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Secured dialog interface */ @BusInterface (name = AlertDialogSecured.IFNAME) @Secure public interface AlertDialogSecured extends AlertDialogSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".SecuredDialog"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * @return Returns the dialog message * @throws BusException */ @BusProperty(signature="s") public String getMessage() throws BusException; /** * @return Returns the number of the dialog buttons * @throws BusException */ @BusProperty(signature="q") public short getNumActions() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action1() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action2() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action3() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } AlertDialogSuper.java000066400000000000000000000044171272147170000426540ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; /** * Super interface for dialog interfaces */ public interface AlertDialogSuper { /** * @return Interface version */ public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ public Map getOptParams() throws BusException; /** * @return Returns the dialog message * @throws BusException */ public String getMessage() throws BusException; /** * @return Returns the number of the dialog buttons * @throws BusException */ public short getNumActions() throws BusException; /** * Call the method if is relevant */ public void Action1() throws BusException; /** * Call the method if is relevant */ public void Action2() throws BusException; /** * Call the method if is relevant */ public void Action3() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ public void MetadataChanged() throws BusException; } Container.java000066400000000000000000000043051272147170000413640ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * UIContainer interface */ @BusInterface (name = Container.IFNAME) public interface Container extends ContainerSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".Container"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } ContainerSecured.java000066400000000000000000000043511272147170000427000ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.bus.annotation.Secure; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; @BusInterface (name = ContainerSecured.IFNAME) @Secure public interface ContainerSecured extends ContainerSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".SecuredContainer"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } ContainerSuper.java000066400000000000000000000032431272147170000424030ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; public interface ContainerSuper { /** * @return Interface version */ public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ public Map getOptParams() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ public void MetadataChanged() throws BusException; } ControlPanel.java000066400000000000000000000033121272147170000420370ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import org.alljoyn.bus.BusException; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * This interface indicates whether the object is a control panel */ @BusInterface (name = ControlPanel.IFNAME) public interface ControlPanel { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".ControlPanel"; public static final int ID_MASK = 0x01; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; } HTTPControl.java000066400000000000000000000035471272147170000415710ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import org.alljoyn.bus.BusException; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * HTTPControl interface */ @BusInterface (name = HTTPControl.IFNAME) public interface HTTPControl { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".HTTPControl"; public static final int ID_MASK = 0x02; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return Retrieve the URL of the home page * @throws BusException */ @BusMethod public String GetRootURL() throws BusException; } Label.java000066400000000000000000000043741272147170000404670ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * LabelProperty interface */ @BusInterface (name = Label.IFNAME) public interface Label { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".LabelProperty"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * @return The label value * @throws BusException */ @BusProperty(signature="s") public String getLabel() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } NotificationAction.java000066400000000000000000000036451272147170000432340ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import org.alljoyn.bus.BusException; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * This interface indicates whether the object is a notification action object */ @BusInterface (name = NotificationAction.IFNAME) public interface NotificationAction { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".NotificationAction"; public static final int ID_MASK = 0x04; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * The controller needs to dismiss this NotificationAction panel */ @BusSignal public void Dismiss() throws BusException; } PropertyControl.java000066400000000000000000000052771272147170000426400ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Property control interface */ @BusInterface (name = PropertyControl.IFNAME) public interface PropertyControl extends PropertyControlSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".Property"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * @return Returns the property current value */ @BusProperty(signature="v") public Variant getValue() throws BusException; /** * @param value The property value */ @BusProperty(signature="v") public void setValue(Variant value) throws BusException; /** * Signal is sent when the property value changed * @param newValue The new property value */ @BusSignal(signature="v") public void ValueChanged(Variant newValue) throws BusException; /** * Signal is sent when the property metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } PropertyControlSecured.java000066400000000000000000000054241272147170000441450ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.bus.annotation.Secure; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Property control secured interface */ @BusInterface (name = PropertyControlSecured.IFNAME) @Secure public interface PropertyControlSecured extends PropertyControlSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".SecuredProperty"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature="q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature="u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature="a{qv}") public Map getOptParams() throws BusException; /** * @return Returns the property current value */ @BusProperty(signature="v") public Variant getValue() throws BusException; /** * @param value The property value */ @BusProperty(signature="v") public void setValue(Variant value) throws BusException; /** * Signal is sent when the property value changed * @param newValue The new property value */ @BusSignal(signature="v") public void ValueChanged(Variant newValue) throws BusException; /** * Signal is sent when the property metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; } PropertyControlSuper.java000066400000000000000000000042431272147170000436470ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; /** * The parent interface of the {@link PropertyControl} and {@link PropertyControlSecured} interfaces */ public interface PropertyControlSuper { /** * @return Interface version */ public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ public Map getOptParams() throws BusException; /** * @return Returns the property current value */ public Variant getValue() throws BusException; /** * @param value The property value */ public void setValue(Variant value) throws BusException; /** * Signal is sent when the property value changed * @param newValue The new property value */ public void ValueChanged(Variant newValue) throws BusException; /** * Signal is sent when the property metadata changed * @param metadata */ public void MetadataChanged() throws BusException; } package-info.java000066400000000000000000000041061272147170000347750ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * The package includes classes that allow to start the control panel service {@link org.alljoyn.ioe.controlpanelservice.ControlPanelService}, * and manage the list of controllable devices {@link org.alljoyn.ioe.controlpanelservice.ControllableDevice}.
* The list of controllable devices is managed by the {@link org.alljoyn.ioe.controlpanelservice.DeviceRegistry} interface * and its default implementation {@link org.alljoyn.ioe.controlpanelservice.DefaultDeviceRegistry}
* For each controllable device there is a list of the device control panels {@link org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel} * that is passed to the user when {@link org.alljoyn.ioe.controlpanelservice.ControllableDevice#startSession(DeviceEventsListener)} * is called. By using the {@link org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel} a user may call * {@link org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel#getRootElement(org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener)} to retrieve the root * UI container */ package org.alljoyn.ioe.controlpanelservice; base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/000077500000000000000000000000001272147170000323015ustar00rootroot00000000000000ActionWidget.java000066400000000000000000000271321272147170000354530ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantTypeReference; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControlSuper; import android.util.Log; /** * Action widget */ public class ActionWidget extends UIElement { private static final String TAG = "cpan" + ActionWidget.class.getSimpleName(); private static final int ENABLED_MASK = 0x01; /** * The remote action object */ private ActionControlSuper remoteControl; /** * Action label
* Not required to be sets */ private String label; /** * Action bgcolor
* Not required to be sets */ private Integer bgColor; /** * Whether the action is enabled
* Not required to be sets */ private boolean enabled; /** * The widget rendering hints
* Not required to be sets */ private List hints; /** * The alert dialog that should be presented. * In this case use of Exec button is illegal */ private AlertDialogWidget alertDialog; /** * Constructor * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public ActionWidget(String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(UIElementType.ACTION_WIDGET, ifName, objectPath, controlPanel, children); } public String getLabel() { return label; } public Integer getBgColor() { return bgColor; } public boolean isEnabled() { return enabled; } public List getHints() { return hints; } public AlertDialogWidget getAlertDialog() { return alertDialog; } /** * Call the remote device to execute its activity * @throws ControlPanelException */ public void exec() throws ControlPanelException { if ( alertDialog != null ) { throw new ControlPanelException("ActionWidget objPath: '" + objectPath + "', alertDialog is defined, can't call exec"); } Log.d(TAG, "Exec called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "'"); try { remoteControl.Exec(); } catch(BusException be) { String msg = "Failed to call Exec, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//exec /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { WidgetFactory widgetFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgetFactory == null ) { String msg = "Received an unrecognized interface name: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifClass = widgetFactory.getIfaceClass(); ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, sessionId, new Class[]{ ifClass, Properties.class } ); Log.d(TAG, "Setting remote control ActionWidget, objPath: '" + objectPath + "'"); properties = proxyObj.getInterface(Properties.class); remoteControl = (ActionControlSuper) proxyObj.getInterface(ifClass); try { this.version = remoteControl.getVersion(); } catch (BusException e) { String msg = "Failed to call getVersion for element: '" + elementType + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//setRemoteController /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ @Override protected void registerSignalHandler() { Method metaDataChangedMethod = CommunicationUtil.getActionMetadataChanged("MetadataChanged"); if ( metaDataChangedMethod == null ) { Log.e(TAG, "ActionWidget, MetadataChanged method is not defined"); return; } try { registerSignalHander(new ActionWidgetSignalHandler(this), metaDataChangedMethod); } catch(ControlPanelException cpe) { String msg = "Device: '" + device.getDeviceId() + "', ActionWidget, failed to register signal handler, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); controlPanel.getEventsListener().errorOccurred(controlPanel, msg); } }//registerSignalHandler /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { try { if ( "States".equals(propName) ) { int states = propValue.getObject(int.class); enabled = (states & ENABLED_MASK) == ENABLED_MASK; } else if ( "OptParams".equals(propName) ) { Map optParams = propValue.getObject(new VariantTypeReference>() {}); fillOptionalParams(optParams); } } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal the property: '" + propName + "', Error: '" + be.getMessage() + "'"); } }//setProperty /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() throws ControlPanelException { int size = children.size(); if ( size == 0 ) { Log.d(TAG, "ActionWidget objPath: '" + objectPath + "', doesn't have any child nodes"); return; } //ActionWidget may has only AlertDialog widget as a child node if ( size > 1) { throw new ControlPanelException("ActionWidget objPath: '" + objectPath + "' has more than one child nodes: '" + size + "'"); } IntrospectionNode childNode = children.get(0); String path = childNode.getPath(); List interfaces = childNode.getInterfaces(); //Search for existence of the AlertDialog interface for (String ifName : interfaces) { if ( !ifName.startsWith(ControlPanelService.INTERFACE_PREFIX + ".") ) { Log.v(TAG, "Found not a ControlPanel interface: '" + ifName + "'"); continue; } //Check the ControlPanel interface WidgetFactory widgFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgFactory == null ) { String msg = "Received an unknown ControlPanel interface: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } //Found a known interface, check whether it's an AlertDialog if ( widgFactory.getElementType() == UIElementType.ALERT_DIALOG ) { Log.i(TAG, "ActionWidget objPath: '" + objectPath + "', has AlertDialog objPath: '" + path + "', creating..."); alertDialog = new AlertDialogWidget(ifName, path, controlPanel, childNode.getChidren()); alertDialog.init(); return; } }//for :: interfaces throw new ControlPanelException("ActionWidget objPath: '" + objectPath + "', not found the AlertDialog interface"); }//createChildWidgets /** * Fill the actionWidget optional parameters * @throws ControlPanelException if failed to read optional parameters */ private void fillOptionalParams(Map optParams) throws ControlPanelException { // Add optional parameters Log.d(TAG, "ActionWidget - scanning optional parameters"); for (ActionWidgetEnum optKeyEnum : ActionWidgetEnum.values()) { Variant optParam = optParams.get(optKeyEnum.ID); if ( optParam == null ) { Log.v(TAG, "OptionalParameter: '" + optKeyEnum + "', is not found"); continue; } Log.v(TAG, "Found OptionalParameter: '" + optKeyEnum + "'"); try { switch (optKeyEnum) { case LABEL: { label = optParam.getObject(String.class); break; } case BG_COLOR: { bgColor = optParam.getObject(int.class); break; } case HINTS: { short[] actHints = optParam.getObject(short[].class); setListOfActionWidgetHints(actHints); break; } }//switch } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal optional parameters, Error: '" + be.getMessage() + "'"); } }//for }//fillOptionalParams /** * Fill the list of ActionWidgetHint types * @param hIds * @return List of Action hints */ private void setListOfActionWidgetHints(short[] hIds) { Log.v(TAG, "Scanning ActionWidgetHints"); hints = new ArrayList( hIds.length ); for (short hintId : hIds) { ActionWidgetHintsType hintType = ActionWidgetHintsType.getEnumById(hintId); if (hintType == null) { Log.w(TAG, "Received unrecognized ActionWidgetHint: '" + hintId + "', ignoring..."); continue; } hints.add(hintType); }//for :: hIds }//getListOfActionWidgetHints } ActionWidgetEnum.java000066400000000000000000000025261272147170000363000ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Optional parameters keys of {@link ActionWidget} */ public enum ActionWidgetEnum { LABEL((short)0), BG_COLOR((short)1), HINTS((short)2) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private ActionWidgetEnum(short id) { ID = id; } } ActionWidgetHintsType.java000066400000000000000000000034221272147170000373170ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Possible types of Action UI hints */ public enum ActionWidgetHintsType { ACTION_BUTTON ((short)1) ; /** * The key number */ public final short ID; private ActionWidgetHintsType(short id) { ID = id; } /** * Search for the enum by the given id * If not found returns NULL * @param id * @return Enum type by the given id */ public static ActionWidgetHintsType getEnumById(short id) { ActionWidgetHintsType retType = null; for (ActionWidgetHintsType type : ActionWidgetHintsType.values()) { if ( id == type.ID ) { retType = type; break; } } return retType; }//getEnumById } ActionWidgetSignalHandler.java000066400000000000000000000071541272147170000401110ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControl; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControlSecured; import android.util.Log; /** * The class is a signal handler that is responsible to receive signals of ActionControl interface.
* Signals:
* - MetadataChanged */ public class ActionWidgetSignalHandler implements ActionControl, ActionControlSecured { private static final String TAG = "cpan" + ActionWidgetSignalHandler.class.getSimpleName(); /** * Container widget to be notified about signal receiving */ private ActionWidget actionWidget; /** * Constructor * @param actionWidget */ public ActionWidgetSignalHandler(ActionWidget actionWidget) { this.actionWidget = actionWidget; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControl#getVersion() */ @Override public short getVersion() throws BusException { return 0; } @Override public int getStates() throws BusException { // TODO Auto-generated method stub return 0; } @Override public Map getOptParams() throws BusException { // TODO Auto-generated method stub return null; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControl#Exec() */ @Override public void Exec() { } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControl#MetadataChanged() */ @Override public void MetadataChanged() { String msg = "Device: '" + actionWidget.device.getDeviceId() + "', ActionWidget: '" + actionWidget.objectPath + "', received METADATA_CHANGED signal"; Log.d(TAG, msg); final ControlPanelEventsListener eventsListener = actionWidget.controlPanel.getEventsListener(); try{ actionWidget.refreshProperties(); } catch(ControlPanelException cpe) { msg += ", but failed to refresh the ActionWidget properties"; Log.e(TAG, msg); eventsListener.errorOccurred(actionWidget.controlPanel, msg); return; } //Delegate to the listener on a separate thread TaskManager.getInstance().execute( new Runnable() { @Override public void run() { eventsListener.metadataChanged(actionWidget.controlPanel, actionWidget); } }); }//MetadataChanged } AlertDialogHintsType.java000066400000000000000000000035711272147170000371320ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * The hint types of the {@link AlertDialogWidget} */ public enum AlertDialogHintsType { ALERT_DIALOG((short)1) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private AlertDialogHintsType(short id) { ID = id; } /** * Search for the enum by the given id * If not found returns NULL * @param id * @return Enum type by the given id */ public static AlertDialogHintsType getEnumById(short id) { AlertDialogHintsType retType = null; for (AlertDialogHintsType type : AlertDialogHintsType.values()) { if ( id == type.ID ) { retType = type; break; } } return retType; }//getEnumById } AlertDialogWidget.java000066400000000000000000000340061272147170000364230ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantTypeReference; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialogSuper; import android.util.Log; public class AlertDialogWidget extends UIElement { private static final String TAG = "cpan" + AlertDialogWidget.class.getSimpleName(); /** * The class represents a dialog button */ public static class DialogButton { /** * Action label */ private String label; /** * The method that should be executed when exec called */ private Method bindMethod; /** * The alert dialog on which to call the bind method */ private AlertDialogWidget alertDialog; /** * Constructor */ private DialogButton(String label, Method bindMethod, AlertDialogWidget alertDialog) { this.label = label; this.bindMethod = bindMethod; this.alertDialog = alertDialog; } /** * @return Get the button label */ public String getLabel() { return label; } /** * Execute the action * @throws ControlPanelException */ public void exec() throws ControlPanelException { try { bindMethod.invoke(alertDialog); } catch (InvocationTargetException ite) { String invokeError = ite.getTargetException().getMessage(); throw new ControlPanelException("DialogButton label: '" + label + "', failed to invoke the method: '" + bindMethod.getName() + "', Error: '" + invokeError + "'"); } catch (Exception e) { throw new ControlPanelException("DialogButton label: '" + label + "', failed to invoke the method: '" + bindMethod.getName() + "'"); } }//exec } //=====================================================// // END OF NESTED CLASSES // //=====================================================// private static final int ENABLED_MASK = 0x01; /** * The remote AlertDialog object */ private AlertDialogSuper remoteControl; /** * Whether the widget is enabled */ private boolean enabled; /** * The Alert dialog display message */ private String message; /** * The number of the available actions */ private short numActions; /** * The Alert dialog label */ private String label; /** * Background color */ private Integer bgColor; /** * The hints for this alert dialog */ private List hints; /** * List of this alert dialog supported buttons */ private List execButtons; /** * Constructor * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public AlertDialogWidget(String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(UIElementType.ALERT_DIALOG, ifName, objectPath, controlPanel, children); } public boolean isEnabled() { return enabled; } /** * @return Display message */ public String getMessage() { return message; } /** * @return The number of the available actions */ public short getNumActions() { return numActions; } public String getLabel() { return label; } public Integer getBgColor() { return bgColor; } public List getHints() { return hints; } /** * @return List of this alert dialog supported buttons */ public List getExecButtons() { return execButtons; } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { WidgetFactory widgetFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgetFactory == null ) { String msg = "Received an unrecognized interface name: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifClass = widgetFactory.getIfaceClass(); ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, sessionId, new Class[]{ifClass, Properties.class} ); Log.d(TAG, "Setting remote control AlertDialog, objPath: '" + objectPath + "'"); properties = proxyObj.getInterface(Properties.class); remoteControl = (AlertDialogSuper) proxyObj.getInterface(ifClass); try { this.version = remoteControl.getVersion(); } catch (BusException e) { String msg = "Failed to call getVersion for element: '" + elementType + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//setRemoteController /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ @Override protected void registerSignalHandler() throws ControlPanelException { Method alertMetaDataChanged = CommunicationUtil.getAlertDialogMetadataChanged("MetadataChanged"); if ( alertMetaDataChanged == null ) { String msg = "AlertDialogWidget, MetadataChanged method isn't defined"; Log.e(TAG, msg); throw new ControlPanelException(msg); } try { registerSignalHander(new AlertDialogWidgetSignalHandler(this), alertMetaDataChanged); } catch(ControlPanelException cpe) { String msg = "Device: '" + device.getDeviceId() + "', AlertDialogWidget, failed to register signal handler, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); controlPanel.getEventsListener().errorOccurred(controlPanel, msg); } }//registerSignalHandler /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { try{ if ( "States".equals(propName) ) { int states = propValue.getObject(int.class); enabled = (states & ENABLED_MASK) == ENABLED_MASK; } else if ( "OptParams".equals(propName) ) { Map optParams = propValue.getObject(new VariantTypeReference>() {}); fillOptionalParams(optParams); } else if ( "Message".equals(propName) ) { message = propValue.getObject(String.class); } else if ( "NumActions".equals(propName) ) { numActions = propValue.getObject(short.class); } } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal the property: '" + propName + "', Error: '" + be.getMessage() + "'"); } }//setProperty /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() throws ControlPanelException { int size = children.size(); Log.d(TAG, "Test AlertDialogWidget validity - AlertDialogWidget can't has child nodes. #ChildNodes: '" + size + "'"); if ( size > 0 ) { throw new ControlPanelException("The AlertDialogWidget objPath: '" + objectPath + "' is not valid, found '" + size + "' child nodes"); } }//createChildWidgets /** * Execute the action number 1 * @throws ControlPanelException if failed to execute the remote call */ void execAction1() throws ControlPanelException { Log.d(TAG, "ExecAction1 called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "'"); try { remoteControl.Action1(); } catch(BusException be) { String msg = "Failed to call ExecAction1, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//execAction1 /** * Execute the action number 2 * @throws ControlPanelException if failed to execute the remote call */ void execAction2() throws ControlPanelException { Log.d(TAG, "ExecAction2 called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "'"); try { remoteControl.Action2(); } catch(BusException be) { String msg = "Failed to call ExecAction2, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//execAction2 /** * Execute the action number 3 * @throws ControlPanelException if failed to execute the remote call */ void execAction3() throws ControlPanelException { Log.d(TAG, "ExecAction3 called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "'"); try { remoteControl.Action3(); } catch(BusException be) { String msg = "Failed to call ExecAction3, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//execAction2 /** * Fill the alertDialogWidget optional parameters * @throws ControlPanelException if failed to read optional parameters */ private void fillOptionalParams(Map optParams) throws ControlPanelException { this.execButtons = new ArrayList(); // Add optional parameters Log.d(TAG, "AlertDialogWidget - scanning optional parameters"); for (AlertDialogWidgetEnum optKeyEnum : AlertDialogWidgetEnum.values()) { Variant optParam = optParams.get(optKeyEnum.ID); if ( optParam == null ) { Log.v(TAG, "OptionalParameter: '" + optKeyEnum + "', is not found"); continue; } Log.v(TAG, "Found OptionalParameter: '" + optKeyEnum + "'"); try { switch (optKeyEnum) { case LABEL: { label = optParam.getObject(String.class); break; } case BG_COLOR: { bgColor = optParam.getObject(int.class); break; } case HINTS: { short[] alertHints = optParam.getObject(short[].class); fillAlertDialogHints(alertHints); break; } case LABEL_ACTION1: { String label = optParam.getObject(String.class); execButtons.add( new DialogButton(label, getActionMethodReflection("execAction1"), this) ); break; } case LABEL_ACTION2: { String label = optParam.getObject(String.class); execButtons.add( new DialogButton(label, getActionMethodReflection("execAction2"), this)); break; } case LABEL_ACTION3: { String label = optParam.getObject(String.class); execButtons.add( new DialogButton(label, getActionMethodReflection("execAction3"), this)); break; } }//switch } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal optional parameters, Error: '" + be.getMessage() + "'"); } }//for }//fillOptionalParams /** * Iterate over the alert dialog hints and fill it * @param hIds */ private void fillAlertDialogHints(short[] hIds) { hints = new ArrayList( hIds.length ); Log.v(TAG, "Searching for AlertDialog hints"); //Fill layout hints for (short hintId : hIds) { AlertDialogHintsType hintType = AlertDialogHintsType.getEnumById(hintId); if ( hintType != null ) { Log.v(TAG, "Found AlertDialog hint: '" + hintType + "', adding"); hints.add(hintType); } else { Log.w(TAG, "AlertDialog hint id: '" + hintId + "' is unknown"); } }//hints }//fillAlertDialogHints /** * Return reflection of getAction1 method * @param methodName The name of the method to get the reflection object * @return Method reflection of the received methodName */ private Method getActionMethodReflection(String methodName) throws ControlPanelException { Method method; try { method = AlertDialogWidget.class.getDeclaredMethod(methodName, (Class[])null); } catch (NoSuchMethodException nse) { throw new ControlPanelException("Failed to get reflection of the '" + methodName + "', Error: '" + nse.getMessage() + "'"); } return method; }//getAction1Method } AlertDialogWidgetEnum.java000066400000000000000000000027661272147170000372600ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Optional parameters keys of {@link AlertDialogWidget} */ public enum AlertDialogWidgetEnum { LABEL((short)0), BG_COLOR((short)1), HINTS((short)2), LABEL_ACTION1((short)6), LABEL_ACTION2((short)7), LABEL_ACTION3((short)8) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private AlertDialogWidgetEnum(short id) { ID = id; } } AlertDialogWidgetSignalHandler.java000066400000000000000000000075161272147170000410650ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialog; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialogSecured; import android.util.Log; public class AlertDialogWidgetSignalHandler implements AlertDialog, AlertDialogSecured { private static final String TAG = "cpan" + AlertDialogWidgetSignalHandler.class.getSimpleName(); /** * AlertDialog to be notified about signal receiving */ private AlertDialogWidget alertDialog; /** * @param alertDialog */ public AlertDialogWidgetSignalHandler(AlertDialogWidget alertDialog) { this.alertDialog = alertDialog; } @Override public short getVersion() throws BusException { // TODO Auto-generated method stub return 0; } @Override public int getStates() throws BusException { // TODO Auto-generated method stub return 0; } @Override public Map getOptParams() throws BusException { // TODO Auto-generated method stub return null; } @Override public String getMessage() throws BusException { // TODO Auto-generated method stub return null; } @Override public short getNumActions() throws BusException { // TODO Auto-generated method stub return 0; } @Override public void Action1() throws BusException { // TODO Auto-generated method stub } @Override public void Action2() throws BusException { // TODO Auto-generated method stub } @Override public void Action3() throws BusException { // TODO Auto-generated method stub } /** * Signal handler * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialog#MetadataChanged() */ @Override public void MetadataChanged() throws BusException { String msg = "Device: '" + alertDialog.device.getDeviceId() + "', AlertDialogWidget: '" + alertDialog.objectPath + "', received METADATA_CHANGED signal"; Log.d(TAG, msg); final ControlPanelEventsListener eventsListener = alertDialog.controlPanel.getEventsListener(); try { alertDialog.refreshProperties(); } catch (ControlPanelException cpe) { msg += ", but failed to refresh the Container properties"; Log.e(TAG, msg); eventsListener.errorOccurred(alertDialog.controlPanel, msg); return; } //Delegate to the listener on a separate thread TaskManager.getInstance().execute( new Runnable() { @Override public void run() { eventsListener.metadataChanged(alertDialog.controlPanel, alertDialog); } }); }//MetadataChanged } ContainerWidget.java000066400000000000000000000270161272147170000361610ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantTypeReference; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ContainerSuper; import android.util.Log; /** * Container widget */ public class ContainerWidget extends UIElement { private static final String TAG = "cpan" + ContainerWidget.class.getSimpleName(); private static final int ENABLED_MASK = 0x01; /** * The remote container object */ private ContainerSuper remoteControl; /** * The list of UI elements
* Not required to be set */ private List elements; /** * The layout hints
* Not required to be set */ private List layoutHints; /** * The label
* Not required to be set */ private String label; /** * bgColor
* Not required to be set */ private Integer bgColor; /** * Indicates whether the UI element is enabled
* Default is true
* Not required to be set */ private boolean enabled; /** * Constructor * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public ContainerWidget(String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(UIElementType.CONTAINER, ifName, objectPath, controlPanel, children); layoutHints = new ArrayList(); bgColor = 0; enabled = true; } public List getElements() { return elements; } public List getLayoutHints() { return layoutHints; } public String getLabel() { return label; } public Integer getBgColor() { return bgColor; } public boolean isEnabled() { return enabled; } //===========================================// /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { try{ if ( "States".equals(propName) ) { int states = propValue.getObject(int.class); enabled = (states & ENABLED_MASK) == ENABLED_MASK; } else if ( "OptParams".equals(propName) ) { Map optParams = propValue.getObject(new VariantTypeReference>() {}); fillOptionalParams(optParams); } } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal the property: '" + propName + "', Error: '" + be.getMessage() + "'"); } }//setProperty /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { WidgetFactory widgetFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgetFactory == null ) { String msg = "Received an unrecognized interface name: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifClass = widgetFactory.getIfaceClass(); ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, sessionId, new Class[]{ifClass, Properties.class} ); Log.d(TAG, "Setting remote control ContainerWidget, objPath: '" + objectPath + "'"); properties = proxyObj.getInterface(Properties.class); remoteControl = (ContainerSuper) proxyObj.getInterface(ifClass); try { this.version = remoteControl.getVersion(); } catch (BusException e) { String msg = "Failed to call getVersion for element: '" + elementType + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//newSessionEstablished /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ @Override protected void registerSignalHandler() throws ControlPanelException { Method containerMetadataChanged = CommunicationUtil.getContainerMetadataChanged("MetadataChanged"); if ( containerMetadataChanged == null ) { String msg = "ContainerWidget, MetadataChanged method isn't defined"; Log.e(TAG, msg); throw new ControlPanelException(msg); } try { registerSignalHander(new ContainerWidgetSignalHandler(this), containerMetadataChanged); } catch(ControlPanelException cpe) { String msg = "Device: '" + device.getDeviceId() + "', ContainerWidget, failed to register signal handler, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); controlPanel.getEventsListener().errorOccurred(controlPanel, msg); } }//registerSignalHandler /** * Fill container optional parameters * @param optParams * @throws ControlPanelException if failed to read optional parameters */ private void fillOptionalParams(Map optParams) throws ControlPanelException { // Add optional parameters Log.d(TAG, "Container - scanning optional parameters"); for (ContainerWidgetEnum optKeyEnum : ContainerWidgetEnum.values()) { Variant optParam = optParams.get(optKeyEnum.ID); if ( optParam == null ) { Log.v(TAG, "OptionalParameter: '" + optKeyEnum + "', is not found"); continue; } Log.v(TAG, "Found OptionalParameter: '" + optKeyEnum + "'"); try { switch (optKeyEnum) { case LABEL: { label = optParam.getObject(String.class); break; } case BG_COLOR: { bgColor = optParam.getObject(int.class); break; } case LAYOUT_HINTS: { short[] layoutHints = optParam.getObject( short[].class ); fillLayoutHints(layoutHints); break; } }//switch } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal optional parameters, Error: '" + be.getMessage() + "'"); } }//for }//fillOptionalParams /** * Iterate over the layout hints and fill it * @param hIds */ private void fillLayoutHints(short[] hIds) { layoutHints = new ArrayList( hIds.length ); Log.v(TAG, "Searching for layoutHints"); //Fill layout hints for (short hintId : hIds) { LayoutHintsType hintType = LayoutHintsType.getEnumById(hintId); if ( hintType != null ) { Log.v(TAG, "Found layout hint: '" + hintType + "', adding"); layoutHints.add(hintType); } else { Log.w(TAG, "Layout hint id: '" + hintId + "' is unknown"); } }//hints }//fillLayoutHints /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() { Log.d(TAG, "Device: '" + device.getDeviceId() + "', iterate over the child elements"); elements = new LinkedList(); for ( IntrospectionNode childNode : children ) { String path = childNode.getPath(); List interfaces = childNode.getInterfaces(); Log.d(TAG, "Device: '" + device.getDeviceId() + "' found child node objPath: '" + path + "', interfaces: '" + interfaces + "'"); for (String ifName : interfaces) { try { if ( !ifName.startsWith(ControlPanelService.INTERFACE_PREFIX + ".") ) { Log.v(TAG, "Found not a ControlPanel interface: '" + ifName + "'"); continue; } //Check the ControlPanel interface WidgetFactory widgFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgFactory == null ) { String msg = "Received an unknown ControlPanel interface: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } UIElement childElement = widgFactory.create(path, controlPanel, childNode.getChidren()); elements.add(childElement); }//try catch (Exception e) { Log.w(TAG, "An error occurred during creation the Object: '" + path + "', device: '" + device.getDeviceId() + "'"); controlPanel.getEventsListener().errorOccurred(controlPanel, e.getMessage()); try { ErrorWidget errorWidget = new ErrorWidget(UIElementType.ERROR_WIDGET, ifName, path, controlPanel, childNode.getChidren()); errorWidget.init(); errorWidget.setError(e.getMessage()); elements.add(errorWidget); } catch (Exception ex) { //This should never happen, because ErrorWidget never throws an exception Log.w(TAG, "A failure has occurred in creation the ErrorWidget"); } } }//for :: interfaces }//for :: children }//createChildWidgets } ContainerWidgetEnum.java000066400000000000000000000025461272147170000370070ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Optional parameters keys of {@link ContainerWidget} */ public enum ContainerWidgetEnum { LABEL((short)0), BG_COLOR((short)1), LAYOUT_HINTS((short)2) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private ContainerWidgetEnum(short id) { ID = id; } } ContainerWidgetSignalHandler.java000066400000000000000000000066511272147170000406170ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Container; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ContainerSecured; import android.util.Log; /** * The class is a signal handler that is responsible to receive signals of UIContainer interface.
* Signals:
* - MetadataChanged */ public class ContainerWidgetSignalHandler implements Container, ContainerSecured { private static final String TAG = "cpan" + ContainerWidgetSignalHandler.class.getSimpleName(); /** * Container widget to be notified about signal receiving */ private ContainerWidget containerWidget; /** * Constructor * @param containerWidget */ public ContainerWidgetSignalHandler(ContainerWidget containerWidget) { this.containerWidget = containerWidget; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.Container#getVersion() */ @Override public short getVersion() throws BusException { return 0; } @Override public int getStates() throws BusException { // TODO Auto-generated method stub return 0; } @Override public Map getOptParams() throws BusException { // TODO Auto-generated method stub return null; } /** * Signal handler * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.Container#MetadataChanged() */ @Override public void MetadataChanged() throws BusException { String msg = "Device: '" + containerWidget.device.getDeviceId() + "', ContainerWidget: '" + containerWidget.objectPath + "', received METADATA_CHANGED signal"; Log.d(TAG, msg); final ControlPanelEventsListener eventsListener = containerWidget.controlPanel.getEventsListener(); try { containerWidget.refreshProperties(); } catch (ControlPanelException cpe) { msg += ", but failed to refresh the Container properties"; Log.e(TAG, msg); eventsListener.errorOccurred(containerWidget.controlPanel, msg); return; } //Delegate to the listener on a separate thread TaskManager.getInstance().execute( new Runnable() { @Override public void run() { eventsListener.metadataChanged(containerWidget.controlPanel, containerWidget); } }); }//MetadataChanged } ControlPanelEventsListener.java000066400000000000000000000045201272147170000403610ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * The interface to be implemented in order to receive {@link DeviceControlPanel} relevant events */ public interface ControlPanelEventsListener { /** * Notify the interface implementer about the changed value in the {@link UIElement} * @param panel {@link DeviceControlPanel} where the value has changed * @param uielement The {@link UIElement} where the change has occurred * @param newValue The new value */ public void valueChanged(DeviceControlPanel panel, UIElement uielement, Object newValue); /** * Notify the interface implementer about the metadata changed in the {@link UIElement} * @param panel {@link DeviceControlPanel} where the metadata has changed * @param uielement The {@link UIElement} where the change has occurred */ public void metadataChanged(DeviceControlPanel panel, UIElement uielement); /** * Dismiss the NotificationAction of the given {@link DeviceControlPanel} * @param panel The NotificationAction control panel to dismissed */ public void notificationActionDismiss(DeviceControlPanel panel); /** * Notify the interface implementer about an error in the {@link DeviceControlPanel} activities * @param panel {@link DeviceControlPanel} where the error has occurred * @param reason The error reason */ public void errorOccurred(DeviceControlPanel panel, String reason); } DeviceControlPanel.java000066400000000000000000000167741272147170000366240ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.LinkedList; import java.util.List; import org.alljoyn.ioe.controlpanelservice.ControlPanelCollection; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.ControllableDevice; import org.alljoyn.ioe.controlpanelservice.Unit; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.UIWidgetSignalHandler; import android.util.Log; /** * Represents a device control panel.
* This class provides methods of receiving a root UI container and its label */ public class DeviceControlPanel { private static final String TAG = "cpan" + DeviceControlPanel.class.getSimpleName(); /** * The device this control panel belongs to */ private ControllableDevice device; /** * The functional unit that this control panel belongs to */ private Unit unit; /** * The {@link ControlPanelCollection} the device belongs to */ private ControlPanelCollection collection; /** * The remote object identifier of this control panel */ private String objPath; /** * The IETF standard language tag */ private String language; /** * The signal handler objects of this ControlPanel */ private List widgetSignalHandlers; /** * The listener of the events that happen on the widgets of this {@link DeviceControlPanel} */ private ControlPanelEventsListener eventsListener; /** * Constructor * @param device */ public DeviceControlPanel(ControllableDevice device, Unit unit, ControlPanelCollection collection, String objPath, String language) { this.device = device; this.objPath = objPath; this.unit = unit; this.collection = collection; this.language = language; this.widgetSignalHandlers = new LinkedList(); } /** * @return The functional unit of the device */ public Unit getUnit() { return unit; }//getUnit /** * @return {@link DeviceControlPanel} object path */ public String getObjPath() { return objPath; }//getObjPath /** * @return The IETF language tag */ public String getLanguage() { return language; }//getLanguage /** * @return The {@link ControllableDevice} this {@link DeviceControlPanel} belongs to */ public ControllableDevice getDevice() { return device; }//getDevice /** * @return The {@link ControlPanelCollection} the device belongs to */ public ControlPanelCollection getCollection() { return collection; } /** * @return The events listener that is used by this {@link DeviceControlPanel} */ public synchronized ControlPanelEventsListener getEventsListener() { return eventsListener; } /** * @param listener The listener of the events that happen on the UI widgets of this {@link DeviceControlPanel} * @return UIElement of either {@link ContainerWidget} or {@link AlertDialogWidget}. If failed to build the element, NULL is returned * @throws ControlPanelException */ public synchronized UIElement getRootElement(ControlPanelEventsListener listener) throws ControlPanelException { if ( listener == null ) { throw new ControlPanelException("Received an undefined ControlPanelEventsListener"); } this.eventsListener = listener; Integer sessionId = device.getSessionId(); if ( sessionId == null ) { Log.e(TAG, "Device: '" + device.getDeviceId() + "', getRootElement() called, but session not defined"); throw new ControlPanelException("Session not established"); } // Clean the previous signal handlers if exist cleanSignalHandlers(); Log.i(TAG, "GetRootElement was called, handling..."); IntrospectionNode introNode; try { introNode = new IntrospectionNode(objPath); introNode.parse(ConnectionManager.getInstance().getBusAttachment(), device.getSender(), sessionId); } catch (Exception e) { String msg = "Failed to introspect the path '" + objPath + "', Error: '" + e.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } List interfaces = introNode.getInterfaces(); Log.v(TAG, "For requested objPath: '" + objPath + "', the found interfaces are: '" + interfaces + "'"); Log.d(TAG, "Search for Container or Dialog interface"); if ( !WidgetFactory.isInitialized() ) { Log.e(TAG, "Failed to initialize the WidgetFactory, returning NULL"); return null; } for (String ifName : interfaces) { if ( !ifName.startsWith(ControlPanelService.INTERFACE_PREFIX + ".") ) { Log.v(TAG, "Found not a ControlPanel interface: '" + ifName + "'"); continue; } //Check the ControlPanel interface WidgetFactory widgFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgFactory == null ) { Log.e(TAG, "Received an unknown ControlPanel interface: '" + ifName + "', return NULL"); return null; } if ( widgFactory.isTopLevelObj() ) { Log.d(TAG, "Found the top level interface: '" + ifName + "', creating widgets..."); return widgFactory.create(objPath, this, introNode.getChidren()); } }//for::interfaces return null; }//getRootContainer /** * Cleans the object resources */ public synchronized void release() { Log.d(TAG, "Cleaning the DeviceControlPanel, objPath: '" + objPath + "'"); try { cleanSignalHandlers(); } catch (ControlPanelException cpe) { Log.e(TAG, "Failed to unregister a signal handler from the bus"); } eventsListener = null; }//release /** * Adds the UI widget signal handler to the signal handlers list * @param signalHandler */ synchronized void addSignalHandler(UIWidgetSignalHandler signalHandler) { this.widgetSignalHandlers.add(signalHandler); }//addSignalHandler /** * Unregister the signal handlers * @throws ControlPanelException Is thrown if failed to unregister a signal handler */ private void cleanSignalHandlers() throws ControlPanelException { if ( widgetSignalHandlers.size() > 0 ) { Log.d(TAG, "Found the previous signal handlers, unregistering them from the bus"); for (UIWidgetSignalHandler handler : widgetSignalHandlers) { handler.unregister(); } widgetSignalHandlers.clear(); }//if :: handler size > 0 }//cleanSignalHandlers } ErrorWidget.java000066400000000000000000000110431272147170000353210ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.List; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; /** * The widget is used to replace a {@link UIElement} that had a failure in its creation
* Use the {@link ErrorWidget#getLabel()} method to receive a proposed label for this widget.
* Use the {@link ErrorWidget#getError()} method to receive an error description that triggered creation of this widget */ public class ErrorWidget extends UIElement { /** * The error message that explains the reason of this widget creation */ private String errorMsg; /** * The default label for the widget */ private final String LABEL = "NOT AVAILABLE"; /** * Constructor * @param elementType * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public ErrorWidget(UIElementType elementType, String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(elementType, ifName, objectPath, controlPanel, children); } /** * The default label for the widget * @return The label content */ public String getLabel() { return LABEL; }//getLabel /** * The error message that explains the reason of this widget creation * @return The error message */ public String getError() { return errorMsg; }//getError /** * The method tries to retrieve the original {@link UIElementType} that failed during the creation process * @return {@link UIElementType} of the original {@link UIElement} or NULL if it couldn't be retrieved */ public UIElementType getOriginalUIElement() { if ( ifName == null ) { return null; } if ( !WidgetFactory.isInitialized() ) { return null; } WidgetFactory widgetFact = WidgetFactory.getWidgetFactory(ifName); if ( widgetFact == null ) { return null; } return widgetFact.getElementType(); }//getUIElement /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#refreshProperties() */ @Override public void refreshProperties() throws ControlPanelException { } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#getVersion() */ @Override public short getVersion() { return 0; } /** * The error message that explains the reason of this widget creation * @param errorMsg */ void setError(String errorMsg) { this.errorMsg = errorMsg; } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ @Override protected void registerSignalHandler() throws ControlPanelException { } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() throws ControlPanelException { } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#versionCheck() */ @Override protected void versionCheck() throws ControlPanelException { } } LabelWidget.java000066400000000000000000000215571272147170000352620ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantTypeReference; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Label; import android.util.Log; public class LabelWidget extends UIElement { private static final String TAG = LabelWidget.class.getSimpleName(); private static final int ENABLED_MASK = 0x01; /** * The remote property object */ private Label remoteControl; /** * Whether the label is enabled */ private boolean enabled; /** * The label */ private String label; /** * The label widget bgcolor */ private Integer bgColor; /** * The hints for this Label Widget */ private List hints; /** * Constructor * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public LabelWidget(String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(UIElementType.LABEL_WIDGET, ifName, objectPath, controlPanel, children); } public boolean isEnabled() { return enabled; } public String getLabel() { return label; } public Integer getBgColor() { return bgColor; } public List getHints() { return hints; } /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { WidgetFactory widgetFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgetFactory == null ) { String msg = "Received an unrecognized interface name: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifClass = widgetFactory.getIfaceClass(); ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, sessionId, new Class[]{ ifClass, Properties.class } ); Log.d(TAG, "Setting remote control LabelWidget, objPath: '" + objectPath + "'"); properties = proxyObj.getInterface(Properties.class); remoteControl = (Label) proxyObj.getInterface(ifClass); try { this.version = remoteControl.getVersion(); } catch (BusException e) { String msg = "Failed to call getVersion for element: '" + elementType + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//setRemoteController /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ @Override protected void registerSignalHandler() throws ControlPanelException { Method labelMetadataChanged = CommunicationUtil.getLabelWidgetMetadataChanged("MetadataChanged"); if ( labelMetadataChanged == null ) { String msg = "LabelWidget, MetadataChanged method isn't defined"; Log.e(TAG, msg); throw new ControlPanelException(msg); } try { registerSignalHander(new LabelWidgetSignalHandler(this), labelMetadataChanged); } catch(ControlPanelException cpe) { String msg = "Device: '" + device.getDeviceId() + "', LabelWidget, failed to register signal handler, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); controlPanel.getEventsListener().errorOccurred(controlPanel, msg); } }//registerSignalHandler /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { try{ if ( "States".equals(propName) ) { int states = propValue.getObject(int.class); enabled = (states & ENABLED_MASK) == ENABLED_MASK; } else if ( "Label".equals(propName) ) { label = propValue.getObject(String.class); } else if ( "OptParams".equals(propName) ) { Map optParams = propValue.getObject(new VariantTypeReference>() {}); fillOptionalParams(optParams); } } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal the property: '" + propName + "', Error: '" + be.getMessage() + "'"); } }//setProperty /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() throws ControlPanelException { int size = children.size(); Log.d(TAG, "Test LabelWidget validity - LabelWidget can't has child nodes. #ChildNodes: '" + size + "'"); if ( size > 0 ) { throw new ControlPanelException("The LabelWidget objPath: '" + objectPath + "' is not valid, found '" + size + "' child nodes"); } }//createChildWidgets /** * Fill LabelWidget optional parameters * @param optParams * @throws ControlPanelException if failed to read optional parameters */ private void fillOptionalParams(Map optParams) throws ControlPanelException { // Add optional parameters Log.d(TAG, "LabelWidget - scanning optional parameters"); for (LabelWidgetEnum optKeyEnum : LabelWidgetEnum.values()) { Variant optParam = optParams.get(optKeyEnum.ID); if ( optParam == null ) { Log.v(TAG, "OptionalParameter: '" + optKeyEnum + "', is not found"); continue; } Log.v(TAG, "Found OptionalParameter: '" + optKeyEnum + "'"); try { switch (optKeyEnum) { case BG_COLOR: { bgColor = optParam.getObject(int.class); break; } case HINTS: { short[] labelHints = optParam.getObject(short[].class); fillLabelHints(labelHints); break; } }//switch } catch(BusException be) { throw new ControlPanelException("Failed to unmarshal optional parameters, Error: '" + be.getMessage() + "'"); } }//for }//fillOptionalParams /** * Iterate over the alert dialog hints and fill it * @param hIds */ private void fillLabelHints(short[] hIds) { hints = new ArrayList( hIds.length ); Log.v(TAG, "Searching for LabelWidget hints"); //Fill layout hints for (short hintId : hIds) { LabelWidgetHintsType hintType = LabelWidgetHintsType.getEnumById(hintId); if ( hintType != null ) { Log.v(TAG, "Found LabelWidget hint: '" + hintType + "', adding"); hints.add(hintType); } else { Log.w(TAG, "LabelWidget hint id: '" + hintId + "' is unknown"); } }//hints }//fillLabelHints } LabelWidgetEnum.java000066400000000000000000000025431272147170000361010ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Optional parameters keys of {@link LabelWidget} */ public enum LabelWidgetEnum { BG_COLOR((short)1), HINTS((short)2) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private LabelWidgetEnum(short id) { ID = id; } } LabelWidgetHintsType.java000066400000000000000000000035641272147170000371300ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * The hint types of the {@link LabelWidget} */ public enum LabelWidgetHintsType { TEXT_LABEL((short)1) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private LabelWidgetHintsType(short id) { ID = id; } /** * Search for the enum by the given id * If not found returns NULL * @param id * @return Enum type by the given id */ public static LabelWidgetHintsType getEnumById(short id) { LabelWidgetHintsType retType = null; for (LabelWidgetHintsType type : LabelWidgetHintsType.values()) { if ( id == type.ID ) { retType = type; break; } } return retType; }//getEnumById } LabelWidgetSignalHandler.java000066400000000000000000000063731272147170000377150ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Label; import android.util.Log; public class LabelWidgetSignalHandler implements Label { private static final String TAG = "cpan" + LabelWidgetSignalHandler.class.getSimpleName(); /** * Container widget to be notified about signal receiving */ private LabelWidget labelWidget; /** * Constructor * @param labelWidget */ public LabelWidgetSignalHandler(LabelWidget labelWidget) { this.labelWidget = labelWidget; } @Override public short getVersion() throws BusException { // TODO Auto-generated method stub return 0; } @Override public int getStates() throws BusException { // TODO Auto-generated method stub return 0; } @Override public Map getOptParams() throws BusException { // TODO Auto-generated method stub return null; } @Override public String getLabel() throws BusException { // TODO Auto-generated method stub return null; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.Label#MetadataChanged() */ @Override public void MetadataChanged() throws BusException { String msg = "Device: '" + labelWidget.device.getDeviceId() + "', labelWidget: '" + labelWidget.objectPath + "', received METADATA_CHANGED signal"; Log.d(TAG, msg); final ControlPanelEventsListener eventsListener = labelWidget.controlPanel.getEventsListener(); try { labelWidget.refreshProperties(); } catch (ControlPanelException cpe) { msg += ", but failed to refresh the LabelWidget properties"; Log.e(TAG, msg); eventsListener.errorOccurred(labelWidget.controlPanel, msg); return; } //Delegate to the listener on a separate thread TaskManager.getInstance().execute( new Runnable() { @Override public void run() { eventsListener.metadataChanged(labelWidget.controlPanel, labelWidget); } }); }//MetadataChanged } LayoutHintsType.java000066400000000000000000000033251272147170000362150ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Possible types of layout hints */ public enum LayoutHintsType { VERTICAL_LINEAR((short)1), HORIZONTAL_LINEAR((short)2), ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private LayoutHintsType(short id) { ID = id; } /** * Search for the enum by the given id * If not found returns NULL * @param id * @return Enum type by the given id */ public static LayoutHintsType getEnumById(short id) { LayoutHintsType retType = null; for (LayoutHintsType type : LayoutHintsType.values()) { if ( id == type.ID ) { retType = type; break; } } return retType; }//getEnumById } PropertyWidget.java000066400000000000000000000623231272147170000360630ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.VariantTypeReference; import org.alljoyn.bus.VariantUtil; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.CommunicationUtil; import org.alljoyn.ioe.controlpanelservice.communication.ConnectionManager; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControlSuper; import org.alljoyn.ioe.controlpanelservice.ui.ajstruct.PropertyWidgetConstrainToValuesAJ; import org.alljoyn.ioe.controlpanelservice.ui.ajstruct.PropertyWidgetRangeConstraintAJ; import org.alljoyn.ioe.controlpanelservice.ui.ajstruct.PropertyWidgetThreeShortAJ; import android.util.Log; /** * Property widget */ public class PropertyWidget extends UIElement { private static final String TAG = "cpan" + PropertyWidget.class.getSimpleName(); /** * The possible types that {@link PropertyWidget} can be casted.
* The {@link PropertyWidget} type is defined according to the received DBus signature. */ public static enum ValueType { BOOLEAN, DOUBLE, INT, SHORT, STRING, LONG, BYTE, DATE, TIME ; } //=================================================// /** * The class defines a range constraint of {@link PropertyWidget}
* The generic type designates the actual type of the property value */ public static class RangeConstraint { /** * The min value with the same type as that of the property */ private T min; /** * The max value with the same type as that of the property */ private T max; /** * The increment/decrement value with the same type as that of the property */ private T increment; /** * Conctructor * @param min The min value with the same type as that of the property * @param max The max value with the same type as that of the property * @param increment The increment/decrement value with the same type as that of the property
* The generic type designates the actual type of the property value */ public RangeConstraint(T min, T max, T increment) { this.min = min; this.max = max; this.increment = increment; } /** * The min value with the same type as that of the property */ public T getMin() { return min; } /** * The max value with the same type as that of the property */ public T getMax() { return max; } /** * The increment/decrement value with the same type as that of the property */ public T getIncrement() { return increment; } } //=====================================================// /** * The class define a single entry of the List-Of-Values constraint
* {@link PropertyWidget#listOfValuesConstraint}
* The generic type designates the actual type of the property value */ public static class ConstrainToValues { /** * Constraint value */ private T value; /** * The value to be displayed */ private String label; /** * Constructor * @param value Constraint value * @param label The value to be displayed */ public ConstrainToValues(T value, String label) { super(); this.value = value; this.label = label; } /** * Constraint value * @return The constraint value */ public T getValue() { return value; } /** * The value to be displayed * @return The label content */ public String getLabel() { return label; } } //=====================================================// /** * The class defines the {@link ValueType#DATE} object of the {@link PropertyWidget} */ public static class Date { private short day; private short month; private short year; public static final short TYPE_CODE = 0; public short getDay() { return day; } public void setDay(short day) { this.day = day; } public short getMonth() { return month; } public void setMonth(short month) { this.month = month; } public short getYear() { return year; } public void setYear(short year) { this.year = year; } @Override public String toString() { return day + "/" + month + "/" + year; } } //=====================================================// /** * The class defines the {@link ValueType#TIME} object of the {@link PropertyWidget} */ public static class Time { private short hour; private short minute; private short second; public static final short TYPE_CODE = 1; public short getHour() { return hour; } public void setHour(short hour) { this.hour = hour; } public short getMinute() { return minute; } public void setMinute(short minute) { this.minute = minute; } public short getSecond() { return second; } public void setSecond(short second) { this.second = second; } @Override public String toString() { return hour + ":" + minute + ":" + second; } } //=====================================================// // END OF NESTED CLASSES // //=====================================================// private static final int ENABLED_MASK = 0x01; private static final int WRITABLE_MASK = 0x02; /** * The remote property object */ private PropertyControlSuper remoteControl; /** * The property value dbus signature */ private String signature; /** * Use this variable for decision to what type the property currentValue should be casted */ private ValueType valueType; /** * The propertyWidget type used to unmarshal the property value from a Variant type */ private Type conversionType; /** * Property label
* Not required to be set */ private String label; /** * The property unit of measure
* Not required to be set */ private String unitOfMeasure; /** * The background color *
* Not required to be set */ private Integer bgColor; /** * Whether the property is enabled
* Not required to be set */ private boolean enabled; /** * Does the property has a permits a read & write *
* Not required to be set */ private boolean writable; /** * The list of value constraints *
* Not required to be set */ private List> listOfValuesConstraint; /** * Stores PropertyRange constraint *
* Not required to be set */ private RangeConstraint propertyRangeConstraint; /** * The widget rendering hints */ private List hints; /** * Optional parameters */ private Map optParams; /** * Constructor * @param ifName * @param objectPath * @param controlPanel * @param children * @throws ControlPanelException */ public PropertyWidget(String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { super(UIElementType.PROPERTY_WIDGET, ifName, objectPath, controlPanel, children); } /** * @return Returns the current property value of the remote controllable device * @throws ControlPanelException If failed to read the remote current property value */ public Object getCurrentValue() throws ControlPanelException { Object retValue; Log.d(TAG, "getCurrentValue called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "'"); try{ Variant currValVar = remoteControl.getValue(); retValue = unmarshalCurrentValue(currValVar); } catch(BusException be) { String msg = "Failed to getCurrentValue, objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } return retValue; }//getValue /** * @param newValue Set the new property value to the remote controllable device * @throws ControlPanelException If failed to set the new property value */ public void setCurrentValue(Object newValue) throws ControlPanelException { Log.i(TAG, "setCurrentValue called, device: '" + device.getDeviceId() + "' objPath: '" + objectPath + "', value: '" + newValue + "'"); if ( newValue == null ) { throw new ControlPanelException("PropertyWidget: '" + objectPath + "', the new value can't be NULL"); } try { if ( valueType == ValueType.DATE ) { Date dt = (Date)newValue; PropertyWidgetThreeShortAJ struct = new PropertyWidgetThreeShortAJ(); struct.dataType = Date.TYPE_CODE; struct.data = new PropertyWidgetThreeShortAJ.ThreeShortAJ(); struct.data.var1 = dt.day; struct.data.var2 = dt.month; struct.data.var3 = dt.year; remoteControl.setValue( new Variant(struct, signature) ); }//if DATE_TIME else if ( valueType == ValueType.TIME ) { PropertyWidgetThreeShortAJ struct = new PropertyWidgetThreeShortAJ(); Time time = (Time)newValue; struct.dataType = Time.TYPE_CODE; struct.data = new PropertyWidgetThreeShortAJ.ThreeShortAJ(); struct.data.var1 = time.hour; struct.data.var2 = time.minute; struct.data.var3 = time.second; remoteControl.setValue( new Variant(struct, signature) ); } else { remoteControl.setValue( new Variant(newValue, signature) ); } }//try catch(BusException be) { String msg = "Failed to setCurrentValue objPath: '" + objectPath + "', Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//setCurrentValue public String getSignature() { return signature; } /** * @return Returns the list of value constraints.
* Each constraint value stored in {@link ConstrainToValues} */ public List> getListOfConstraint() { return listOfValuesConstraint; } /** * Use the type for casting the property value returned from getCurrentValue * @return PropertyValueType */ public ValueType getValueType() { return valueType; } public String getLabel() { return label; } public String getUnitOfMeasure() { return unitOfMeasure; } public Integer getBgColor() { return bgColor; } public boolean isEnabled() { return enabled; } public boolean isWritable() { return writable; } public RangeConstraint getPropertyRangeConstraint() { return propertyRangeConstraint; } public List getHints() { return hints; } //=============================================================// /** * Unmarshal the current value from Variant object * @param curValVar The variant object * @return The unmarshalled value * @throws ControlPanelException If failed to unmarshal the current value from variant */ Object unmarshalCurrentValue(Variant curValVar) throws ControlPanelException { Object retVal; try { if ( valueType == ValueType.DATE ) { Date retDate = new Date(); PropertyWidgetThreeShortAJ struct = curValVar.getObject(PropertyWidgetThreeShortAJ.class); retDate.day = struct.data.var1; retDate.month = struct.data.var2; retDate.year = struct.data.var3; retVal = retDate; } else if ( valueType == ValueType.TIME ) { Time retTime = new Time(); PropertyWidgetThreeShortAJ struct = curValVar.getObject(PropertyWidgetThreeShortAJ.class); retTime.hour = struct.data.var1; retTime.minute = struct.data.var2; retTime.second = struct.data.var3; retVal = retTime; } else { retVal = curValVar.getObject(conversionType); } }//try catch(BusException be) { String msg = "Failed to unmarshal current property value, Error: '" + be.getMessage() + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } return retVal; }//unmarshalCurrentValue /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setRemoteController() */ @Override protected void setRemoteController() throws ControlPanelException { WidgetFactory widgetFactory = WidgetFactory.getWidgetFactory(ifName); if ( widgetFactory == null ) { String msg = "Received an unrecognized interface name: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifClass = widgetFactory.getIfaceClass(); ProxyBusObject proxyObj = ConnectionManager.getInstance().getProxyObject( device.getSender(), objectPath, sessionId, new Class[]{ ifClass, Properties.class } ); Log.d(TAG, "Setting remote control PropertyWidget, objPath: '" + objectPath + "'"); properties = proxyObj.getInterface(Properties.class); remoteControl = (PropertyControlSuper) proxyObj.getInterface(ifClass); try { this.version = remoteControl.getVersion(); } catch (BusException e) { String msg = "Failed to call getVersion for element: '" + elementType + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } }//setRemoteController /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#registerSignalHandler() */ protected void registerSignalHandler() { try { Method propertyMetaDataChanged = CommunicationUtil.getPropertyMetadataChanged("MetadataChanged"); if ( propertyMetaDataChanged == null ) { String msg = "PropertyWidget, MetadataChanged method isn't defined"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Method propertyValueChanged = CommunicationUtil.getPropertyValueChanged("ValueChanged"); if ( propertyValueChanged == null ) { String msg = "PropertyWidget, ValueChanged method isn't defined"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Log.d(TAG, "PropertyWidget objPath: '" + objectPath + "', registering signal handler 'MetadataChanged'"); registerSignalHander(new PropertyWidgetSignalHandler(this), propertyMetaDataChanged); Log.d(TAG, "PropertyWidget objPath: '" + objectPath + "', registering signal handler 'ValueChanged'"); registerSignalHander(new PropertyWidgetSignalHandler(this), propertyValueChanged); }//try catch (ControlPanelException cpe) { String msg = "Device: '" + device.getDeviceId() + "', PropertyWidget, failed to register signal handler, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); controlPanel.getEventsListener().errorOccurred(controlPanel, msg); } }//registerSignalHandler //=============================================================// /** * One note fillOptionalParameter method needs the valueType for execution. Therefore there is a code that ensures that the valueType * will be defined before the fillOptionalParameter method is called * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#setProperty(java.lang.String, org.alljoyn.bus.Variant) */ @Override protected void setProperty(String propName, Variant propValue) throws ControlPanelException { try { if( "States".equals(propName) ) { int states = propValue.getObject(int.class); enabled = (states & ENABLED_MASK) == ENABLED_MASK; writable = (states & WRITABLE_MASK) == WRITABLE_MASK; } else if ( "OptParams".equals(propName) ) { optParams = propValue.getObject(new VariantTypeReference>() {}); if ( valueType != null ) { // The property type has been already realized, it's possible to call fillOptionalParams fillOptionalParams(optParams); optParams = null; } } else if ( "Value".equals(propName) ) { Variant value = propValue.getObject(Variant.class); definePropertyType(value); if ( optParams != null ) { // The OptionalParameters have been already set, call fillOptionalParams fillOptionalParams(optParams); optParams = null; } } }//try catch(BusException be) { throw new ControlPanelException("Failed to unmarshal the property: '" + propName + "', Error: '" + be.getMessage() + "'"); } }//setProperty /** * @see org.alljoyn.ioe.controlpanelservice.ui.UIElement#createChildWidgets() */ @Override protected void createChildWidgets() throws ControlPanelException { int size = children.size(); Log.d(TAG, "Test PropertyWidget validity - PropertyWidget can't has child nodes. #ChildNodes: '" + size + "'"); if ( size > 0 ) { throw new ControlPanelException("The PropertyWidget objPath: '" + objectPath + "' is not valid, found '" + size + "' child nodes"); } }//createChildWidgets /** * Define the property type from the given value * @param value * @throws ControlPanelException Is throws when failed to realize the property type */ private void definePropertyType(Variant value) throws ControlPanelException { if ( valueType != null ) { return; } try { signature = VariantUtil.getSignature(value); fromDbusSignatureToType(value); Log.d(TAG, "The PropertyWidget objPath: '" + objectPath + "', type is: '" + valueType + "', DbusSign: '" + signature + "'"); } catch (BusException be) { throw new ControlPanelException("Failed to read the property objPath: '" + objectPath + "' value, Error: '" + be.getMessage() + "'"); } }//realize /** * Converts from DBUS signature to the PropertyValueType * @param propValue the value * @throws ControlPanelException if the signature is of unsupported type */ private void fromDbusSignatureToType(Variant propValue) throws ControlPanelException { if ( "b".equals(signature) ) { valueType = ValueType.BOOLEAN; conversionType = boolean.class; } else if ( "d".equals(signature) ) { valueType = ValueType.DOUBLE; conversionType = double.class; } else if ( "s".equals(signature) ) { valueType = ValueType.STRING; conversionType = String.class; } else if ( "y".equals(signature) ) { valueType = ValueType.BYTE; conversionType = byte.class; } else if ( "n".equals(signature) || "q".equals(signature) ) { valueType = ValueType.SHORT; conversionType = short.class; } else if ( "i".equals(signature) || "u".equals(signature) ) { valueType = ValueType.INT; conversionType = int.class; } else if ( "t".equals(signature) || "x".equals(signature) ) { valueType = ValueType.LONG; conversionType = long.class; } //Handler 3q structure else if ( "(q(qqq))".equals(signature) ) { PropertyWidgetThreeShortAJ struct; try { struct = propValue.getObject(PropertyWidgetThreeShortAJ.class); } catch (BusException be) { throw new ControlPanelException("PropertyWidget objPath: '" + objectPath + "', failed to unmarshal value of sugnature: '" + signature + "'"); } switch ( struct.dataType ) { case Date.TYPE_CODE: { valueType = ValueType.DATE; conversionType = PropertyWidgetThreeShortAJ.class; break; } case Time.TYPE_CODE: { valueType = ValueType.TIME; conversionType = PropertyWidgetThreeShortAJ.class; break; } default: { throw new ControlPanelException("PropertyWidget objPath: '" + objectPath + "' belongs to an unsupported composite type: '" + signature + "'"); } }//switch }//if :: 3q struct else { throw new ControlPanelException("PropertyWidget objPath: '" + objectPath + "' belongs to an unsupported type: '" + signature + "'"); } }//fromDbusSignatureToType /** * Fill the PropertyWidget optional parameters * @param optParams The optinal parameters to fill * @throws ControlPanelException */ private void fillOptionalParams(Map optParams) throws ControlPanelException { // Add optional parameters Log.d(TAG, "PropertyWidget - scanning optional parameters"); for (PropertyWidgetEnum optKeyEnum : PropertyWidgetEnum.values()) { Variant optParam = optParams.get(optKeyEnum.ID); if ( optParam == null ) { Log.v(TAG, "OptionalParameter: '" + optKeyEnum + "', is not found"); continue; } Log.v(TAG, "Found OptionalParameter: '" + optKeyEnum + "'"); try { switch (optKeyEnum) { case LABEL: { label = optParam.getObject(String.class); break; } case UNIT_OF_MEASURE: { unitOfMeasure = optParam.getObject(String.class); break; } case BG_COLOR: { bgColor = optParam.getObject(int.class); break; } case CONSTRAINT_TO_VALUES: { PropertyWidgetConstrainToValuesAJ[] lovConsAJ = optParam.getObject( PropertyWidgetConstrainToValuesAJ[].class ); setListOfValuesConstraints(lovConsAJ); break; } case RANGE: { PropertyWidgetRangeConstraintAJ propRangeConsAJ = optParam.getObject( PropertyWidgetRangeConstraintAJ.class ); RangeConstraint propRangeCons = propRangeConsAJ.getPropertyWidgetRangeConstraint(valueType); if ( propRangeCons == null ) { throw new ControlPanelException("Fail to unmarshal a range constraint for PropertyWidget objPath: '" + objectPath + "'"); } this.propertyRangeConstraint = propRangeCons; break; } case HINTS: { short[] propertyWidgetHints = optParam.getObject(short[].class); setListOfPropertyWidgetHints(propertyWidgetHints); break; } }//switch }//try catch(BusException be) { throw new ControlPanelException("Failed to unmarshal optional parameters for PropertyWidget objPath: '" + objectPath + "'"); } }//for }//fillOptionalParams /** * Iterates over PropertyWidgetListOfValuesConstraintAJ[]. For each value call {@link PropertyWidgetConstrainToValuesAJ#getPropertyWidgetConstrainToValues(ValueType)} * to receive {@link ConstrainToValues} * @param * @param lovConsAJ Array of PropertyWidgetListOfValuesConstraintAJ * @param valueType The type of property value * @return List of values constraints or null on fail * @throws ControlPanelException If failed to unmarshal ConstaintToValues property */ private void setListOfValuesConstraints(PropertyWidgetConstrainToValuesAJ[] lovConsAJ) throws ControlPanelException { listOfValuesConstraint = new ArrayList>( lovConsAJ.length ); for (PropertyWidgetConstrainToValuesAJ consValueAJ : lovConsAJ) { ConstrainToValues consValue = consValueAJ.getPropertyWidgetConstrainToValues(valueType); if ( consValue == null ) { throw new ControlPanelException("PropertyWidget objPath: '" + objectPath + "', failed to unmarshal constraint value object"); } listOfValuesConstraint.add(consValue); }//for :: consAJ[] }//getListOfValuesConstraints /** * Iterates over the hintIds array and fills list of {@link PropertyWidgetHintsType} * @param hintIds Ids of the widget hints * @return */ private void setListOfPropertyWidgetHints(short[] hintIds) { Log.v(TAG, "PropertyWidget objPath: '" + objectPath + "', filling PropertyWidget hints"); this.hints = new ArrayList( hintIds.length ); for (short hId : hintIds) { PropertyWidgetHintsType hintType = PropertyWidgetHintsType.getEnumById(hId); if (hintType == null) { Log.w(TAG, "Received unrecognized hintId: '" + hId + "', ignoring"); continue; } hints.add(hintType); }//for :: hintId }//setListOfPropertyWidgetHints } PropertyWidgetEnum.java000066400000000000000000000026561272147170000367130ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Optional parameters keys of {@link PropertyWidget} */ public enum PropertyWidgetEnum { LABEL((short)0), BG_COLOR((short)1), HINTS((short)2), UNIT_OF_MEASURE((short)3), CONSTRAINT_TO_VALUES((short)4), RANGE((short)5) ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private PropertyWidgetEnum(short id) { ID = id; } } PropertyWidgetHintsType.java000066400000000000000000000042411272147170000377260ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * Possible types of property UI hints */ public enum PropertyWidgetHintsType { SWITCH((short)1), CHECKBOX((short)2), SPINNER((short)3), RADIO_BUTTON((short)4), SLIDER((short)5), TIME_PICKER((short)6), DATE_PICKER((short)7), NUMBER_PICKER((short)8), NUMERIC_KEYPAD((short)9), ROTARY_KNOB((short)10), TEXT_VIEW((short)11), NUMERIC_VIEW((short)12), EDIT_TEXT((short)13), ; /** * The key number */ public final short ID; /** * Constructor * @param id */ private PropertyWidgetHintsType(short id) { ID = id; } /** * Search for the enum by the given id * If not found returns NULL * @param id * @return Enum type by the given id */ public static PropertyWidgetHintsType getEnumById(short id) { PropertyWidgetHintsType retType = null; for (PropertyWidgetHintsType type : PropertyWidgetHintsType.values()) { if ( id == type.ID ) { retType = type; break; } } return retType; }//getEnumById } PropertyWidgetSignalHandler.java000066400000000000000000000115641272147170000405200ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.TaskManager; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControlSecured; import android.util.Log; /** * The class is a signal handler that is responsible to receive signals of PropertyControl interface.
* Signals:
* - ValueChanged
* - MetadataChanged */ public class PropertyWidgetSignalHandler implements PropertyControlSecured, PropertyControl { private static final String TAG = "cpan" + PropertyWidgetSignalHandler.class.getSimpleName(); /** * Property widget to be notified about signal receiving */ private PropertyWidget propertyWidget; /** * @param propertyWidget */ public PropertyWidgetSignalHandler(PropertyWidget propertyWidget) { this.propertyWidget = propertyWidget; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl#getVersion() */ @Override public short getVersion() throws BusException { return 0; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl#getValue() */ @Override public Variant getValue() throws BusException { return null; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl#setValue(org.alljoyn.bus.Variant) */ @Override public void setValue(Variant value) throws BusException { } @Override public int getStates() throws BusException { return 0; } @Override public Map getOptParams() throws BusException { return null; } /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl#ValueChanged(org.alljoyn.bus.Variant) */ @Override public void ValueChanged(Variant value) throws BusException { ControlPanelEventsListener eventsListener = propertyWidget.controlPanel.getEventsListener(); String msg = "Device: '" + propertyWidget.device.getDeviceId() + "', PropertyWidget: '" + propertyWidget.objectPath + "', received VALUE_CHANGED signal"; Log.d(TAG, msg); try { Object unmarshVal = propertyWidget.unmarshalCurrentValue(value); Log.d(TAG, "The new property: '" + propertyWidget.objectPath + "' value is: '" + unmarshVal + "'"); eventsListener.valueChanged(propertyWidget.controlPanel, propertyWidget, unmarshVal); } catch (ControlPanelException cpe) { msg += ", but failed to unmarshal the received data, Error: '" + cpe.getMessage() + "'"; Log.e(TAG, msg); eventsListener.errorOccurred(propertyWidget.controlPanel, msg); } }//ValueChanged /** * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl#MetadataChanged() */ @Override public void MetadataChanged() throws BusException { String msg = "Device: '" + propertyWidget.device.getDeviceId() + "', PropertyWidget: '" + propertyWidget.objectPath + "', received METADATA_CHANGED signal"; Log.d(TAG, msg); final ControlPanelEventsListener eventsListener = propertyWidget.controlPanel.getEventsListener(); try { propertyWidget.refreshProperties(); } catch(ControlPanelException cpe) { msg += ", but failed to refresh the widget properties"; Log.e(TAG, msg); eventsListener.errorOccurred(propertyWidget.controlPanel, msg); return; } //Delegate to the listener on a separate thread TaskManager.getInstance().execute( new Runnable() { @Override public void run() { eventsListener.metadataChanged(propertyWidget.controlPanel, propertyWidget); } }); }//MetadataChanged } UIElement.java000066400000000000000000000215071272147170000347210ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Method; import java.util.List; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.ifaces.Properties; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControllableDevice; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.UIWidgetSignalHandler; import android.util.Log; /** * The parent class for another UI elements */ public abstract class UIElement { private static final String TAG = "cpan" + UIElement.class.getSimpleName(); /** * Element type */ protected UIElementType elementType; /** * The interface name this element is connected to the remote device */ protected String ifName; /** * The object path to the object with the UIContainer Interface */ protected String objectPath; /** * This {@link UIElement} child nodes after the introspection */ protected List children; /** * The proxy bus object of the remote device */ protected Properties properties; /** * The {@link DeviceControlPanel} the widget belongs to */ protected DeviceControlPanel controlPanel; /** * The controllable device this widget belongs to */ protected ControllableDevice device; /** * The session id in which this object is connected to the remote controlled object */ protected Integer sessionId; /** * The interface version */ protected short version; /** * Constructor * @param elementType The type of the element * @param objectPath The object path to the remote object * @throws ControlPanelException if failed to build the element */ public UIElement(UIElementType elementType, String ifName, String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { this.elementType = elementType; this.ifName = ifName; this.objectPath = objectPath; this.children = children; this.controlPanel = controlPanel; this.device = controlPanel.getDevice(); this.sessionId = device.getSessionId(); if ( this.sessionId == null ) { throw new ControlPanelException("Failed to create widget: '" + elementType + "', objPath: '" + objectPath + "', session not established"); } }//Constructor public UIElementType getElementType() { return elementType; } public String getObjectPath() { return objectPath; } /** * Explicit initialization function. Must be called by subclass after instantiation of the object. * Initialization is seperated from construction to avoid bugs such as ASABASE-568 and referencing variables in the subclass before they have been constructed. */ public void init() throws ControlPanelException { setRemoteController(); versionCheck(); registerSignalHandler(); refreshProperties(); createChildWidgets(); } /** * Retrieve and set all the widget properties from the remote device * @throws ControlPanelException if failed to retrieve a property data from the remote device */ public void refreshProperties() throws ControlPanelException { Log.d(TAG, "Retreive the " + elementType + " properties, object path: '" + objectPath + "'"); Map props; try { props = properties.GetAll(ifName); } catch (BusException be) { throw new ControlPanelException("Failed to retreive properties for ifName: '" + ifName + "', Error: '" + be.getMessage() + "'"); } catch (Exception e) { throw new ControlPanelException("Unexpected error happened on retrieving properties for ifName: '" + ifName + "', Error: '" + e.getMessage() + "'"); } for(String propName : props.keySet() ) { Log.v(TAG, "Set property: '" + propName + "', object path: '" + objectPath + "'"); setProperty(propName, props.get(propName)); } }//refreshProperties /** * Returns the version number of this widget interface * @throws ControlPanelException if failed to call remote object * @return The widget version number */ public short getVersion() { return version; } /** * Performs version check of this interface version vs. the interface version of the remote device * @throws ControlPanelException If the interface version of the remote device is greater than the version of this interface */ protected void versionCheck() throws ControlPanelException { WidgetFactory widgFactory = WidgetFactory.getWidgetFactory(ifName); //Check the ControlPanel interface if ( widgFactory == null ) { String msg = "Received an unknown ControlPanel interface: '" + ifName + "'"; Log.e(TAG, msg); throw new ControlPanelException(msg); } Class ifaceClass = widgFactory.getIfaceClass(); try { short myVersion = ifaceClass.getDeclaredField("VERSION").getShort(short.class); Log.d(TAG, "Version check for interface: '" + ifName + "' my version is: '" + myVersion + "'" + " the remote device version is: '" + this.version + "'"); if ( this.version > myVersion ) { throw new ControlPanelException("Incompatible interface version: '" + ifName + "', my interface version is: '" + myVersion + "'" + " the remote device interface version is: '" + this.version + "'"); } } catch (Exception e) { throw new ControlPanelException("Failed to perform version check for interface: '" + ifName + "', unable to get the reflection of the VERSION field"); } }//versionCheck /** * Register signal handler of the given busObject and its signalHandlerMethod * @param signalReceiver The object that receives the signal * @param signalHandlerMethod The method that handles the signal * @throws ControlPanelException Thrown if failed to register signal handler */ protected void registerSignalHander(Object signalReceiver, Method signalHandlerMethod) throws ControlPanelException { UIWidgetSignalHandler signalHandler = new UIWidgetSignalHandler(objectPath, signalReceiver, signalHandlerMethod, ifName); signalHandler.register(); controlPanel.addSignalHandler(signalHandler); }//registerSignalHander /** * Set remote controller of the object * @throws ControlPanelException if failed to set remote control */ protected abstract void setRemoteController() throws ControlPanelException; /** * Register signal handler of the remote object * @throws ControlPanelException Thrown if failed to register signal handler */ protected abstract void registerSignalHandler() throws ControlPanelException; /** * Sets the specific property * @param propName The name of the property to be set * @param propValue The property value * @throws ControlPanelException If failed to set the property value */ protected abstract void setProperty(String propName, Variant propValue) throws ControlPanelException; /** * Create this element child widgets * @throws ControlPanelException */ protected abstract void createChildWidgets() throws ControlPanelException; } UIElementType.java000066400000000000000000000023371272147170000355630ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; /** * The types of all the UI elements */ public enum UIElementType { CONTAINER, PROPERTY_WIDGET, LIST_PROPERTY_WIDGET, ACTION_WIDGET, ALERT_DIALOG, LABEL_WIDGET, ERROR_WIDGET ; } WidgetFactory.java000066400000000000000000000207421272147170000356450ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.communication.IntrospectionNode; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControl; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ActionControlSecured; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialog; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.AlertDialogSecured; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Container; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ContainerSecured; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.Label; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControl; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.PropertyControlSecured; import android.util.Log; /** * The factory class for the UI widgets */ public class WidgetFactory { private static final String TAG = "cpan" + WidgetFactory.class.getSimpleName(); /** * Whether the factory was initialized successfully */ private static boolean isInitialized = false; /** * The interface lookup */ private static Map ifaceLookup = new HashMap(); static { init(); } private String iface; /** * The class reflection of the AJ interface */ private Class ifaceClass; /** * The constructor reflection of the widget class */ private Constructor constructor; /** * The element type */ private UIElementType elementType; /** * Whether the created widget is a top level object */ private boolean isTopLevelObj; private static void init () { try { ifaceLookup.put(ActionControl.IFNAME, new WidgetFactory(ActionControl.IFNAME, ActionControl.class, getConstructorReflection(ActionWidget.class), UIElementType.ACTION_WIDGET, false)); ifaceLookup.put(ActionControlSecured.IFNAME, new WidgetFactory(ActionControlSecured.IFNAME, ActionControlSecured.class, getConstructorReflection(ActionWidget.class), UIElementType.ACTION_WIDGET, false)); ifaceLookup.put(Container.IFNAME, new WidgetFactory(Container.IFNAME, Container.class, getConstructorReflection(ContainerWidget.class), UIElementType.CONTAINER, true)); ifaceLookup.put(ContainerSecured.IFNAME, new WidgetFactory(ContainerSecured.IFNAME, ContainerSecured.class, getConstructorReflection(ContainerWidget.class), UIElementType.CONTAINER, true)); ifaceLookup.put(AlertDialog.IFNAME, new WidgetFactory(AlertDialog.IFNAME, AlertDialog.class, getConstructorReflection(AlertDialogWidget.class), UIElementType.ALERT_DIALOG, true)); ifaceLookup.put(AlertDialogSecured.IFNAME, new WidgetFactory(AlertDialogSecured.IFNAME, AlertDialogSecured.class, getConstructorReflection(AlertDialogWidget.class), UIElementType.ALERT_DIALOG, true)); ifaceLookup.put(PropertyControl.IFNAME, new WidgetFactory(PropertyControl.IFNAME, PropertyControl.class, getConstructorReflection(PropertyWidget.class), UIElementType.PROPERTY_WIDGET, false)); ifaceLookup.put(PropertyControlSecured.IFNAME, new WidgetFactory(PropertyControlSecured.IFNAME, PropertyControlSecured.class, getConstructorReflection(PropertyWidget.class), UIElementType.PROPERTY_WIDGET, false)); ifaceLookup.put(Label.IFNAME, new WidgetFactory(Label.IFNAME, Label.class, getConstructorReflection(LabelWidget.class), UIElementType.LABEL_WIDGET, false)); isInitialized = true; } catch(Exception e) { Log.e(TAG, "Failed to initialize widget factory, Error: '" + e.getMessage() + "'"); isInitialized = false; } }//init /** * @return Whether the {@link WidgetFactory} is successfully initialized */ public static boolean isInitialized() { return isInitialized; } /** * @param ifName The interface name to look for the appropriate factory * @return Return {@link WidgetFactory} if the ifName is a known interface and WidgetFactory was initialized successfully, * otherwise returns NULL */ public static WidgetFactory getWidgetFactory(String ifName) { if ( !isInitialized ) { return null; } Log.d(TAG, "getWidgetFactory() is looking for the interface '" + ifName + "'"); return ifaceLookup.get(ifName); }//getWidgetFactory /** * Constructor * @param iface The name of the AJ interface * @param ifaceClass The class reflection object of the AJ interface * @param constructor The constructor reflection of the widget class * @param elementType The element type * @param isTopLevelObj Whether the built element is a top level object */ private WidgetFactory(String iface, Class ifaceClass, Constructor constructor, UIElementType elementType, boolean isTopLevelObj) { this.iface = iface; this.ifaceClass = ifaceClass; this.constructor = constructor; this.elementType = elementType; this.isTopLevelObj = isTopLevelObj; } /** * @param widgClass * @return Returns constructor object of the received class * @throws NoSuchMethodException */ private static Constructor getConstructorReflection(Class widgClass) throws NoSuchMethodException { return widgClass.getConstructor( String.class, String.class, DeviceControlPanel.class, List.class ); }//getConstructorReflection public String getIface() { return iface; } public Class getIfaceClass() { return ifaceClass; } public UIElementType getElementType() { return elementType; } public boolean isTopLevelObj() { return isTopLevelObj; } /** * Create the {@link UIElement} * @param objectPath * @param controlPanel * @param children * @return Return the {@link UIElement} if create succeeded or NULL if failed to create the object * @throws ControlPanelException */ public UIElement create(String objectPath, DeviceControlPanel controlPanel, List children) throws ControlPanelException { Log.i(TAG, "Create element: '" + elementType + "' objPath: '" + objectPath + "'"); UIElement retValue; try { retValue = (UIElement) constructor.newInstance(iface, objectPath, controlPanel, children); } catch (InvocationTargetException ite) { String invokeError = ite.getTargetException().getMessage(); Log.e(TAG, "Error happened when invoking the constructor of '" + elementType + "', Error: '" + invokeError + "'"); throw new ControlPanelException(invokeError); } catch (Exception e) { Log.e(TAG, "Unexpected error happened, failed to create the UIElement: '" + elementType + "'"); throw new ControlPanelException(e); } retValue.init(); return retValue; }//create } ajstruct/000077500000000000000000000000001272147170000340615ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/uiPropertyWidgetConstrainToValuesAJ.java000066400000000000000000000064471272147170000435060ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/ajstruct/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui.ajstruct; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.Position; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ConstrainToValues; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ValueType; import android.util.Log; public class PropertyWidgetConstrainToValuesAJ { @Position(0) public Variant value; @Position(1) public String label; /** * Returns single object of PropertyWidget list of values * @param valueType The property type of value * @return */ public ConstrainToValues getPropertyWidgetConstrainToValues(ValueType valueType) { Log.v("cpan" + PropertyWidgetConstrainToValuesAJ.class.getSimpleName(), "Unmarshalling PropertyWidget LOV constraint, label: '" + label + "'"); try { switch (valueType) { case BOOLEAN: { Boolean valueCast = value.getObject(boolean.class); return new ConstrainToValues(valueCast, label); } case BYTE: { Byte valueCast = value.getObject(byte.class); return new ConstrainToValues(valueCast, label); } case DOUBLE: { Double valueCast = value.getObject(double.class); return new ConstrainToValues(valueCast, label); } case INT: { Integer valueCast = value.getObject(int.class); return new ConstrainToValues(valueCast, label); } case LONG: { Long valueCast = value.getObject(long.class); return new ConstrainToValues(valueCast, label); } case SHORT: { Short valueCast = value.getObject(short.class); return new ConstrainToValues(valueCast, label); } case STRING: { String valueCast = value.getObject(String.class); return new ConstrainToValues(valueCast, label); } default: { break; } }//SWITCH }//TRY catch (BusException be) { Log.e("cpan" + PropertyWidgetConstrainToValuesAJ.class.getSimpleName(), "Failed to unmarshal PropertyWidget LOV - Error: '" + be.getMessage() + "'" ); return null; } Log.e("cpan" + PropertyWidgetConstrainToValuesAJ.class.getSimpleName(), "Failed to unmarshal PropertyWidget LOV" ); return null; }//getPropertyWidgetRangeConstraint } PropertyWidgetRangeConstraintAJ.java000066400000000000000000000075001272147170000431530ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/ajstruct/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui.ajstruct; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.Position; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.RangeConstraint; import org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget.ValueType; import android.util.Log; /** * Property widget range constraint */ public class PropertyWidgetRangeConstraintAJ { /** * Minimum range value */ @Position(0) public Variant min; /** * Maximum range value */ @Position(1) public Variant max; /** * The value to increment/decerement */ @Position(2) public Variant increment; /** * @param valueType The value type of this property * @param * @return Property widget range constraint or NULL if failed to unmarshal */ public RangeConstraint getPropertyWidgetRangeConstraint(ValueType valueType) { Log.v("cpan" + PropertyWidgetRangeConstraintAJ.class.getSimpleName(), "Unmarshalling PropertyWidget range constraint"); try { switch (valueType) { case BYTE: { Byte minCast = min.getObject(byte.class); Byte maxCast = max.getObject(byte.class); Byte incrementCast = increment.getObject(byte.class); return new RangeConstraint(minCast, maxCast, incrementCast); } case DOUBLE: { Double minCast = min.getObject(double.class); Double maxCast = max.getObject(double.class); Double incrementCast = increment.getObject(double.class); return new RangeConstraint(minCast, maxCast, incrementCast); } case INT: { Integer minCast = min.getObject(int.class); Integer maxCast = max.getObject(int.class); Integer incrementCast = increment.getObject(int.class); return new RangeConstraint(minCast, maxCast, incrementCast); } case LONG: { Long minCast = min.getObject(long.class); Long maxCast = max.getObject(long.class); Long incrementCast = increment.getObject(long.class); return new RangeConstraint(minCast, maxCast, incrementCast); } case SHORT: { Short minCast = min.getObject(short.class); Short maxCast = max.getObject(short.class); Short incrementVal = increment.getObject(short.class); return new RangeConstraint(minCast, maxCast, incrementVal); } default : { break; } }//SWITCH }//TRY catch (BusException be) { Log.e("cpan" + PropertyWidgetRangeConstraintAJ.class.getSimpleName(), "Failed to unmarshal Range constraint: Error: '" + be.getMessage() + "'" ); return null; } Log.e("cpan" + PropertyWidgetRangeConstraintAJ.class.getSimpleName(), "Failed to unmarshal Range constraint" ); return null; }//getPropertyWidgetRangeConstraint } PropertyWidgetThreeShortAJ.java000066400000000000000000000027531272147170000421460ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/ajstruct/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.ui.ajstruct; import org.alljoyn.bus.annotation.Position; public class PropertyWidgetThreeShortAJ { /** * The type of the received structure, either Date or Time */ @Position(0) public short dataType; /** * Either Hour or Day */ @Position(1) public ThreeShortAJ data; public static class ThreeShortAJ { @Position(0) public short var1; @Position(1) public short var2; @Position(2) public short var3; } } package-info.java000066400000000000000000000045561272147170000354230ustar00rootroot00000000000000base-16.04/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/ui/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * The package includes classes that represent the UI widgets and its metadata
* The UI widget classes are used to receive the initial values that were set by the remotely controllable device.
* In addition these classes used to perform the remote control of the device. * For example:
* {@link org.alljoyn.ioe.controlpanelservice.ui.ActionWidget#exec()} is used to invoke an action * on the remote device
* {@link org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget#setCurrentValue(Object)} is used to set a * new property value on the remote device
* {@link org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget#getCurrentValue()} is used to receive the current * property value
* Each UI widget has its signal handler to be notified about the state changes in the remote device. * The user receives these notifications by implementing the {@link org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener} interface
* The signal {@link org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener#metadataChanged(DeviceControlPanel, UIElement)} * notifies about a possible change in a widget UI state.
* The method refreshProperties, i.e: {@link org.alljoyn.ioe.controlpanelservice.ui.PropertyWidget#refreshProperties()} * is used to receive the updated state of a Property */ package org.alljoyn.ioe.controlpanelservice.ui; base-16.04/controlpanel/java/sample_applications/000077500000000000000000000000001272147170000221075ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/000077500000000000000000000000001272147170000235275ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/000077500000000000000000000000001272147170000274735ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/.classpath000066400000000000000000000016251272147170000314620ustar00rootroot00000000000000 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/.project000066400000000000000000000014661272147170000311510ustar00rootroot00000000000000 ControlPanelBrowser com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/AndroidManifest.xml000066400000000000000000000054471272147170000332760ustar00rootroot00000000000000 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/build.xml000066400000000000000000000121611272147170000313150ustar00rootroot00000000000000 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/ic_launcher-web.png000066400000000000000000000215151272147170000332340ustar00rootroot00000000000000PNG  IHDR``w8tEXtSoftwareAdobe ImageReadyqe<"iTXtXML:com.adobe.xmp TIDATx]y嵿2, 4J( ( FE" 1$yHI^b3z$EM^ѼgD(383&02=k{ARs^]s;}O onwIHy?3e`Μ9PYYɿ( $Iϩy<w}Tԃ&G¼yc~! -++mUUoR) ţߥt.|Y֯__"?S 3~?x<. ^/7@Aa^ܓU|s2LoĤ_o}#>_L]"=# % 6UСCgVgHu{mnY~EօӅ.-^W%!;ڳ Ptz)ca[ϟ)R/s遃[oo… K.p8̵I\=ߺG| i1_o$^lǰ:p vC 8رc g pgU7:8.DJ//>G EJtHA@ke˖ ӹO8szL[D#ODDD@؅~iʕロ_ imCyկD'}2V] 6kqvRm>z\8 i|{bkbP#Re3]5P;w'JhJĨ rhw>Bϓ ҥKFgAUA(㝄R7|-rR@ЅaHOOўk 7.'(2 M >SYuP⥠E-ClchʯN"U[OBhӡho_ԔC'! wցsk-?c,Fnn8yy%. P@T<-ub uւRw6㕕E*>i(^QEۓXˮ\M!xVb;2CIB:ipE{)x杕9cU|o8}F-x8Ks!r/1#D5|RJsN`1-C. ^@͋|xjDg|po68r'(!9* >*bysj8eq ԎWk taJ1k$ :艭y#4ٺ6P\:j ΋ z*T3*~Q2|? }?j8 :_+v@0)qX[PV]^ bЫD-Yvccu>ZMoZ-ޙX!t_r&i<3GzL@Ж\w(-a%D<B_GH -(A@SMf<pR}&{ F Pc~^/j=jP v&U~Sč$b/cu(T֭X0źa|>/?qsNWWvO# - ޭs>ݙE'V셁wD(GGJC"x(J3a -@(rI|FBgɪwbѾmY|ʢ}sQ+ݿ6{v4+J&i z59zaBVIs)xUE1X =7- V1B?c45peZ$9:Jq:Ҝ2!E`%-RPAy Qߝ-[ ;o8p C.|^M Kl4n]zrny#`b_wyrX;öCR&@ͺ[Y5ᓀdBJrb-wj8e9`hJDOh~ye$S+[z1nn n7yOOD+ jA EOJmݶY B&';wqӦCM%1bgKvknL>g*tbyG=tCoow 9=_y@H~hSo#Mxޠ'.}}Y-Qr)'Q_G:`@MK,_Žn1[TRs>q}m^O@YPAsjԃiK*G(A Y V),ō,;x^DzbOnѯyȥ݌A$)E9a⹿ .ic`OzUU΃-]o&E _\jz(dYQa@ x矍 rX--US`\0ybXO_E囋Ξ}nP,&G׌d=ʿ{䐩\\29ʚaGW iW`[(vMOz*ҫZ M ڼ=2(1>@n7 ӽ?]:q[WWQZ-YmTzLկp-+DS &Mʓf-[dǬh3ɩ3Q5#% /( 9մ ## ('>|PIA;w7j&,9:J|i# ^-eh2.ضj,AVPE!IؽL}MSou@fCw}'a\)to#NTbJ!;ԡAdBNP(#FiN\I _r륅qc`{[%uҌ2^YQze1=-u#+#jEB`m&&T,AE/ᗚþ={eyv7BT|P]QiꢢGIH[2) xE_pщF),蘢**&cz^h(+w+Q f̀\v~)/"щR}LZ*3d`HbFMlAIZmh8ʇT'JF\Z77 d"'3fZ؋4PSA~>_kgc\IFGC〩A区ϩrΊE>hhQ>𙌰%sk&I+BZ{ wC 匚D9&#Ff%Vl9JE\2&7RjavІ&(ue /MGwf W9iZOһ]W ~'RA Ma);AP8ciIR K_o?` ~Nv4>?o[-+ "})/dQe!2_lI%^k[.-ISvL{B yH(UM\ Q oHH#?lg˷OY!V@Mά,˭=89OG4iPnJ&vH4 H 0Y)ZYQ kJvYJ.z@#柝)h>CVD%B<":c󠀡XZY2͵RC;O|OvFя(ĉl*rNFT eZ SI &csF!dadY7 ㈭` =C*`k董^g`&LL#}tM}|³b~(GR\[c*z^'ɑiUjD !ZUT8Y%ȵR!P}y{>i}d $ b`6u e)Ңpclz(YY5ʀH'Xc5F,p:s , E*o$m&8(h1!<;8_ʃr7q&H3c[)K |EX^nV[xS|G:`4B8A ꬉ8m}A 6 Xrf(J2E.vYb_Ѻ\2{Iu(\"QTcGIzˈFKͲ@- `h)A/+{ <4tڡW  /7?"7^ގh!m'bEGv q FX5 YXvђbY Oi}ve(IzoXn P-ScYͷuz~kgL Cم ]3d 30{ V`VͷL`'ⴉ gU$`<3jtĺY,{6ֵudD09z caMԑ~m L_`ͫ-E20yt#>h0]vRt(SR$KNB_'he߄qH,m~eBV7R 9EReSM/#mNp!j3iլ*D:K&M u!49_IArh>eCVLh{cJf5)?PGB57(UYL" Rni̬{ Vv.x*e4GVYu4=̓ ٨TtOm9ɋ~hǑ߃ŸVxv_4"#b.2v }b5Z3'-b, Vz9i0Plߐ#2*u8i~2X~~Z:}0mW QQmXp1;􅞄:Cb&eDv7 ĊQ)6|T'wb]cLa%XgWA_g;6BEiCE҆qNHcR@!]8s\9U 唩[! a.'"ka~1i(f#;+Iڕ^h*=*zJ,L)Cu`tIWOqlz>hV 9L( }3d &RjG503]u!{mZ] mh6 G1$MJ$:$jY6?rLNǢx#k (pp1ihxZ^H@ZjA!/+RN@_غ?'XFf ,Ԭ^5_8]`v$3|5'Yj]e}2h]N?y/΃Y 'g/-t2OHML I/[<*iSc!%LB/0 ]hUA^d&͛&?+j _72g(8J9ٛ$BoF)x%4f_gU4H"gƪ"ى\@ `oÒ(1XLY},{ˈSuopYP!;Q.3i;&9aD)`zvIBĽP. qJ~!p 2,٫gbkyQ5\6K!حA JKɲ[=CDyBDGv$,RNNJodyQNƥ_/H֠L+k7MըIy Sc6]gť~~'tw>^^VOmCJzbUYOfը̲yiÂY󭹈u,i{gtf>N;Ž$ ˢPrW&BMثxx ^zc,0H{eoGv9ErIa_#Z{DH<.wSqUr.s )ymG_Ee,L "1Fdk6.tഅ΢Nz#OLyIENDB`base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/project.properties000066400000000000000000000010631272147170000332570ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/000077500000000000000000000000001272147170000302645ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-hdpi/000077500000000000000000000000001272147170000327675ustar00rootroot00000000000000ic_launcher.png000066400000000000000000000022661272147170000357000ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-hdpiPNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-mdpi/000077500000000000000000000000001272147170000327745ustar00rootroot00000000000000ic_launcher.png000066400000000000000000000022661272147170000357050ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-mdpiPNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-xhdpi/000077500000000000000000000000001272147170000331575ustar00rootroot00000000000000ic_launcher.png000066400000000000000000000030601272147170000360610ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-xhdpiPNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-xxhdpi/000077500000000000000000000000001272147170000333475ustar00rootroot00000000000000ic_launcher.png000066400000000000000000000030601272147170000362510ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/drawable-xxhdpiPNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout/000077500000000000000000000000001272147170000316015ustar00rootroot00000000000000activity_device_detail.xml000066400000000000000000000024721272147170000367460ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout activity_device_list.xml000066400000000000000000000027011272147170000364520ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout activity_device_twopane.xml000066400000000000000000000045331272147170000371610ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout enter_password_popup.xml000066400000000000000000000045341272147170000365340ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout fragment_device_detail.xml000066400000000000000000000034521272147170000367140ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/layout base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/menu/000077500000000000000000000000001272147170000312305ustar00rootroot00000000000000activity_control_panel.xml000066400000000000000000000023331272147170000364470ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/menu base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-large/000077500000000000000000000000001272147170000326535ustar00rootroot00000000000000refs.xml000066400000000000000000000025301272147170000342550ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-large @layout/activity_device_twopane base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-sw600dp/000077500000000000000000000000001272147170000327645ustar00rootroot00000000000000refs.xml000066400000000000000000000025271272147170000343740ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-sw600dp @layout/activity_device_twopane base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-v11/000077500000000000000000000000001272147170000321705ustar00rootroot00000000000000styles.xml000066400000000000000000000024431272147170000341610ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-v11 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-v14/000077500000000000000000000000001272147170000321735ustar00rootroot00000000000000styles.xml000066400000000000000000000025341272147170000341650ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values-v14 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values/000077500000000000000000000000001272147170000315635ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values/strings.xml000066400000000000000000000026021272147170000337760ustar00rootroot00000000000000 ControlPanelBrowser Appliance Detail Action failed Set password Enter device password Show password base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/res/values/styles.xml000066400000000000000000000032071272147170000336320ustar00rootroot00000000000000 base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/000077500000000000000000000000001272147170000302625ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/000077500000000000000000000000001272147170000310515ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/000077500000000000000000000000001272147170000325215ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/000077500000000000000000000000001272147170000332755ustar00rootroot00000000000000controlpanelbrowser/000077500000000000000000000000001272147170000373225ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioeDeviceDetailActivity.java000066400000000000000000000112321272147170000442230ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/controlpanelbrowserpackage org.alljoyn.ioe.controlpanelbrowser; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import org.alljoyn.ioe.controlpanelbrowser.DeviceDetailFragment.DeviceDetailCallback; import org.alljoyn.ioe.controlpanelbrowser.DeviceList.DeviceContext; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.NavUtils; import android.util.Log; import android.view.MenuItem; /** * An activity representing a single Appliance detail screen. This activity is * only used on handset devices. On tablet-size devices, item details are * presented side-by-side with a list of items in a {@link DeviceListActivity}. *

* This activity is mostly just a 'shell' activity containing nothing more than * a {@link DeviceDetailFragment}. */ public class DeviceDetailActivity extends FragmentActivity implements DeviceDetailCallback { /** * For logging */ private final static String TAG = "cpappDeviceDetailActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_device_detail); // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); // savedInstanceState is non-null when there is fragment state // saved from previous configurations of this activity // (e.g. when rotating the screen from portrait to landscape). // In this case, the fragment will automatically be re-added // to its container so we don't need to manually add it. // For more information, see the Fragments API guide at: // // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { // Create the detail fragment and add it to the activity // using a fragment transaction. DeviceContext deviceContext = getIntent().getParcelableExtra(DeviceDetailFragment.ARG_ITEM_ID); // set the activity title to the context's label setTitle(deviceContext.toString()); // pass the context to the fragment Bundle arguments = new Bundle(); arguments.putParcelable(DeviceDetailFragment.ARG_ITEM_ID, deviceContext); DeviceDetailFragment fragment = new DeviceDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().add(R.id.appliance_detail_container, fragment).commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, DeviceListActivity.class)); return true; } return super.onOptionsItemSelected(item); } /** * @see org.alljoyn.ioe.controlpanelbrowser.DeviceDetailFragment.DeviceDetailCallback#onControlPanelStale() */ @Override public void onControlPanelStale() { Log.d(TAG, "onControlPanelStale was called, navigating to the DeviceListActivity"); Intent intent = new Intent(this, DeviceListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } DeviceDetailFragment.java000066400000000000000000001076201272147170000442010ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/controlpanelbrowserpackage org.alljoyn.ioe.controlpanelbrowser; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import java.util.Collection; import java.util.Locale; import java.util.LinkedList; import org.alljoyn.bus.Status; import org.alljoyn.ioe.controlpaneladapter.ContainerCreatedListener; import org.alljoyn.ioe.controlpaneladapter.ControlPanelAdapter; import org.alljoyn.ioe.controlpaneladapter.ControlPanelExceptionHandler; import org.alljoyn.ioe.controlpanelservice.ControlPanelCollection; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.ControllableDevice; import org.alljoyn.ioe.controlpanelservice.DeviceEventsListener; import org.alljoyn.ioe.controlpanelservice.Unit; import org.alljoyn.ioe.controlpanelservice.ui.AlertDialogWidget; import org.alljoyn.ioe.controlpanelservice.ui.ContainerWidget; import org.alljoyn.ioe.controlpanelservice.ui.ControlPanelEventsListener; import org.alljoyn.ioe.controlpanelservice.ui.DeviceControlPanel; import org.alljoyn.ioe.controlpanelservice.ui.UIElement; import org.alljoyn.ioe.controlpanelservice.ui.UIElementType; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; /** * A fragment representing a single Appliance detail screen. This fragment is * either contained in a {@link DeviceListActivity} in two-pane mode (on * tablets) or a {@link DeviceDetailActivity} on handsets. */ public class DeviceDetailFragment extends Fragment { /** * Implement this interface to receive events from the {@link DeviceDetailFragment} */ public static interface DeviceDetailCallback { /** * This event is sent when the ControlPanel, presented by this * {@link Fragment} is stale and can't be used anymore. * For example when the session with the Controllable device is closed or * an error has occurred to establish the session. */ void onControlPanelStale(); } //===========================================// /** * For logging */ private final static String TAG = "cpappApplianceDetailFragment"; /** * The fragment argument representing the item ID that this fragment * represents. */ public static final String ARG_ITEM_ID = "item_id"; /** * The dummy content this fragment is presenting. */ private DeviceList.DeviceContext deviceContext; /** * The device controller this fragment is presenting. */ private DeviceController deviceController; private View rootView; private Activity activity; /** * Progress dialog */ private ProgressDialog progressDialog; /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ public DeviceDetailFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments().containsKey(ARG_ITEM_ID)) { // Load the dummy content specified by the fragment // arguments. In a real-world scenario, use a Loader // to load content from a content provider. deviceContext = getArguments().getParcelable(ARG_ITEM_ID); // get the controllable device try { ControllableDevice controllableDevice = ControlPanelService.getInstance().getControllableDevice(deviceContext.getDeviceId(), deviceContext.getBusName()); if (controllableDevice != null) { for (String objPath: deviceContext.getBusObjects()) { controllableDevice.addControlPanel(objPath, deviceContext.getInterfaces(objPath)); } showProgressDialog("Connecting..."); deviceController = new DeviceController(controllableDevice); deviceController.start(); } } catch (ControlPanelException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_device_detail, container, false); return rootView; } @Override public void onDestroy() { if (deviceController != null) { deviceController.stop(); } super.onDestroy(); } @Override public void onAttach(Activity activity) { super.onAttach(activity); if ( !(activity instanceof DeviceDetailCallback) ) { throw new IllegalStateException("The hosting Activity must implement the DeviceDetailCallback"); } this.activity = activity; } /** * Workaround for cases where the Fragment needs to call actions on the Acitvity, but getActivity() returns null. * This happens at scren initialization. * @return if getActivity() returns null, then return the formerly attached Activity. see {@link #onAttach(Activity)} */ private Activity getActivitySafely() { Activity retActivity = getActivity(); if (retActivity == null) { Log.w(TAG, "getActivity() returned null. using formerly attached activity"); retActivity = this.activity; } return retActivity; } /** * The method is called when there is a fundamental problem in the Control Panel management, such as * failure in session establishment */ private void raiseControlPanelStaleEvent() { Activity activity = getActivitySafely(); if ( activity == null || activity.isFinishing() ) { Log.w(TAG, "The acitivity is NULL or is finishing can't call to raiseControlPanelStaleEvent"); return; } ((DeviceDetailCallback)activity).onControlPanelStale(); } /** * If the {@link ProgressDialog} is not initialized it's created and is presented. * If the {@link ProgressDialog} is already presented it's msg is updated. * @param msg The message to show with the {@link ProgressDialog} */ private void showProgressDialog(String msg) { if ( progressDialog == null || !progressDialog.isShowing() ) { Activity activity = getActivitySafely(); if ( activity == null || activity.isFinishing() ) { Log.w(TAG, "The activity is finishing, can't show the ProgressDialog"); return; } progressDialog = ProgressDialog.show(activity, "", msg, true); progressDialog.setCancelable(false); } else if ( progressDialog.isShowing() ) { progressDialog.setMessage(msg); } } /** * Hide {@link ProgressDialog} */ private void hideProgressDialog() { if ( progressDialog != null ) { progressDialog.dismiss(); } } class DeviceController implements DeviceEventsListener, ControlPanelExceptionHandler, ControlPanelEventsListener, ContainerCreatedListener { final ControllableDevice device; private DeviceControlPanel deviceControlPanel; private ControlPanelAdapter controlPanelAdapter; private AlertDialog alertDialog; DeviceController(ControllableDevice controllableDevice) { this.device = controllableDevice; } public void start() throws ControlPanelException { try { Log.d(TAG, "Starting the session with the device"); if (device != null) { device.startSession(this); } } catch (Exception e) { hideProgressDialog(); String text = "Failed to establish the session"; Log.d(TAG, text, e); Toast.makeText(getActivitySafely(), text, Toast.LENGTH_LONG).show(); stop(); raiseControlPanelStaleEvent(); } } public void stop() { try { Log.d(TAG, "Closing session and releasing the device resources"); if (device != null) { ControlPanelService.getInstance().stopControllableDevice(device); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void sessionLost(final ControllableDevice device) { if (this.device.getDeviceId().equalsIgnoreCase(device.getDeviceId())) { getActivitySafely().runOnUiThread(new Runnable(){ @Override public void run() { String text = "Received SESSION_LOST for device: '" + device.getDeviceId() + "'"; Log.d(TAG, text); Toast.makeText(getActivitySafely(), text, Toast.LENGTH_LONG).show(); stop(); raiseControlPanelStaleEvent(); }}); } } @Override public void sessionEstablished(final ControllableDevice device, java.util.Collection controlPanelContainer) { Log.d(TAG, "Received sessionEstablished for device: '" + device.getDeviceId() + "'"); getActivitySafely().runOnUiThread(new Runnable(){ @Override public void run() { hideProgressDialog(); selectControlPanel(device); } }); } /** * Act when Control Panel is selected */ private void onControlPanelSelected() { //The time unit depends on the given TimeUnit object AsyncTask panelLoader; panelLoader = new AsyncTask () { @Override protected void onPreExecute() { showProgressDialog("Retrieving Control Panel"); } @Override protected Object doInBackground(Void... params) { try { return deviceControlPanel.getRootElement(DeviceController.this); } catch (ControlPanelException cpe) { return cpe; } } @Override protected void onPostExecute(Object result) { if ( result instanceof ControlPanelException ) { String errMsg = "Failed to retrieve the Control Panel"; Log.e(TAG, errMsg, (ControlPanelException)result); renderErrorMessage(errMsg); hideProgressDialog(); return; } controlPanelAdapter = new ControlPanelAdapter(getActivitySafely(), DeviceController.this); hideProgressDialog(); buildControlPanel((UIElement)result); } }; panelLoader.execute(); } /** * Builds the Control Panel depending on its type * @param rootContainerElement */ private void buildControlPanel(UIElement rootContainerElement) { UIElementType elementType = rootContainerElement.getElementType(); Log.d(TAG, "Found root container of type: '" + elementType + "', building"); if ( elementType == UIElementType.CONTAINER ) { showProgressDialog("Populating container"); controlPanelAdapter.createContainerViewAsync((ContainerWidget) rootContainerElement, this); } else if ( elementType == UIElementType.ALERT_DIALOG ) { renderControlPanelDialog(rootContainerElement); } } /** * @see org.alljoyn.ioe.controlpaneladapter.ContainerCreatedListener#onContainerViewCreated(android.view.View) */ @Override public void onContainerViewCreated(final View containerLayout) { getActivitySafely().runOnUiThread(new Runnable(){ @Override public void run() { hideProgressDialog(); if (rootView != null) { LinearLayout body = (LinearLayout) rootView.findViewById(R.id.control_panel); body.removeAllViews(); body.addView(containerLayout); } } }); } /** * Render the Control Panel Alert Dialog * @param rootContainerElement */ private void renderControlPanelDialog(UIElement rootContainerElement) { Log.d(TAG, "Found root container of type: '" + rootContainerElement.getElementType() + "', building"); AlertDialogWidget alertDialogWidget = ((AlertDialogWidget)rootContainerElement); AlertDialog alertDialog = controlPanelAdapter.createAlertDialog(alertDialogWidget); alertDialog.setCancelable(false); alertDialog.setCanceledOnTouchOutside(false); alertDialog.setOnDismissListener(new AlertDialog.OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { String text = "Dialog dismissed."; Toast.makeText(getActivitySafely(), text, Toast.LENGTH_LONG).show(); Log.d(TAG, text); } }); alertDialog.show(); } /** * Renders the error message on the screen * @param msg The message to render */ private void renderErrorMessage(String msg) { final TextView returnView = new TextView(getActivitySafely()); returnView.setText(msg); getActivitySafely().runOnUiThread(new Runnable() { @Override public void run() { if (rootView != null) { LinearLayout body = (LinearLayout) rootView.findViewById(R.id.control_panel); body.removeAllViews(); body.addView(returnView); } } }); } private void selectControlPanel(ControllableDevice device) { if (rootView != null) { Spinner unitSelector = (Spinner) rootView.findViewById(R.id.unit_selector); Collection unitCollection = device.getUnitCollection(); if (unitCollection.size() == 0) { Log.w(TAG, "No units found"); unitSelector.setEnabled(false); } else { final ArrayAdapter adapter = new ArrayAdapter(getActivitySafely(), android.R.layout.simple_spinner_item); for (Unit unit: unitCollection) { adapter.add(new LabelValuePair(unit.getUnitId(), unit)); } unitSelector.setAdapter(adapter); if (unitCollection.size() == 1) { unitSelector.setEnabled(false); onUnitSelection(unitCollection.iterator().next()); } else { // register a selection listener OnItemSelectedListener listener = new OnItemSelectedListener() { int currentSelection = 1000; @Override public void onItemSelected(AdapterView parent, View view, final int pos, long id) { if (pos == currentSelection) { Log.d(TAG, String.format("Selected position %d already selected. No action required", pos)); } else { currentSelection = pos; LabelValuePair item = adapter.getItem(pos); Unit selectedUnit = (Unit) item.value; onUnitSelection(selectedUnit); } } @Override public void onNothingSelected(AdapterView parent) { // Another interface callback } }; unitSelector.setOnItemSelectedListener(listener); } } } } private void onUnitSelection(Unit selectedUnit) { Log.d(TAG, String.format("Unit selected: '%s'", selectedUnit.getUnitId())); Collection controlPanelContainer = selectedUnit.getControlPanelCollection(); selectControlPanelCollection(controlPanelContainer); } private void selectControlPanelCollection( Collection controlPanelContainer) { if (rootView != null) { Spinner cpCollectionSelector = (Spinner) rootView.findViewById(R.id.cp_collection_selector); if (controlPanelContainer.size() == 0) { Log.w(TAG, "No control panel collections found"); cpCollectionSelector.setEnabled(false); } else { final ArrayAdapter adapter = new ArrayAdapter(getActivitySafely(), android.R.layout.simple_spinner_item); for (ControlPanelCollection cpCollection: controlPanelContainer) { adapter.add(new LabelValuePair(cpCollection.getName(), cpCollection)); } cpCollectionSelector.setAdapter(adapter); if (controlPanelContainer.size() == 1) { cpCollectionSelector.setEnabled(false); onControlPanelCollectionSelection(controlPanelContainer.iterator().next()); } else { // register a selection listener OnItemSelectedListener listener = new OnItemSelectedListener() { int currentSelection = 1000; @Override public void onItemSelected(AdapterView parent, View view, final int pos, long id) { if (pos == currentSelection) { Log.d(TAG, String.format("Selected position %d already selected. No action required", pos)); } else { currentSelection = pos; LabelValuePair item = adapter.getItem(pos); ControlPanelCollection cpCollection = (ControlPanelCollection) item.value; onControlPanelCollectionSelection(cpCollection); } } @Override public void onNothingSelected(AdapterView parent) { // Another interface callback } }; cpCollectionSelector.setOnItemSelectedListener(listener); } } } } private int getMatchingPartCount(String[] language1InParts, String[] language2InParts) { // Language tag "en-US" in parts would be [ "en", "US" ] - use string.split("-"). int matchingPartCount = 0; // For both provided language tags, compare how many matching sub-parts they have. for (String language1Part : language1InParts) { for (String language2Part : language2InParts) { if (language1Part.equalsIgnoreCase(language2Part)) { matchingPartCount++; break; } } } return matchingPartCount; } /** * Simple string concatenation method with separating character between parts. */ private String concatenateStringParts(String[] stringParts, String separator) { String concatenatedParts = ""; for(int i = 0; i < stringParts.length; i++) { concatenatedParts += stringParts[i]; if(i < (stringParts.length - 1)) concatenatedParts += separator; } return concatenatedParts; } private DeviceControlPanel findControlPanelByLanguage(Collection controlPanelList, String language) { DeviceControlPanel selectedControlPanel = null; for (DeviceControlPanel controlPanel : controlPanelList) { String controlPanelLanguage = controlPanel.getLanguage(); if (controlPanelLanguage.equalsIgnoreCase(language)) { selectedControlPanel = controlPanel; break; } } return selectedControlPanel; } private String findClosestLanguageFromList(String[] targetLanguageList, String language_IETF_RFC5646, // E.g. zh-cmn-Hans-CN String language_ISO639) { // E.g. zh String closestLanguage = ""; // Extract the language tags from the list which contain the specified ISO 639 language // part (i.e. eliminate all languages but those related to the one being searched for). LinkedList relatedLanguageList = new LinkedList(); for (String language : targetLanguageList) { if (language.startsWith(language_ISO639)) { relatedLanguageList.push(language); } } // Break up all test language strings into their language parts. String[] languageInParts = language_IETF_RFC5646.split("-"); // E.g. "zh", "cmn", "Hans", "CN" LinkedList targetLanguagePartList = new LinkedList(); for (String language : relatedLanguageList) { targetLanguagePartList.push(language.split("-")); } // Perform a per-part search for an exact match, and then generalisations, of the provided language // in the list - so "zh-cmn-Hans-CN", then "zh-Hans-CN", then "zh-CN" could pass (if found). for (int i = languageInParts.length; i > 0; i--) { boolean closestLanguageFound = false; for (String[] targetLanguageInParts : targetLanguagePartList) { if (targetLanguageInParts.length == i) { if (getMatchingPartCount(languageInParts, targetLanguageInParts) == i) { closestLanguage = concatenateStringParts(targetLanguageInParts, "-"); closestLanguageFound = true; break; } } } if(closestLanguageFound) { break; } } // If that fails, a specialisation of the language needs to be chosen from the list. So // choose the most generalised one. if(closestLanguage.length() == 0 && targetLanguagePartList.size() > 0) { int shortestTargetLanguageIndex = 0; for (int i = 1; i < targetLanguagePartList.size(); i++) { if (targetLanguagePartList.get(i).length < targetLanguagePartList.get(shortestTargetLanguageIndex).length) { shortestTargetLanguageIndex = i; } } closestLanguage = concatenateStringParts(targetLanguagePartList.get(shortestTargetLanguageIndex), "-"); } return closestLanguage; } private void onControlPanelCollectionSelection(ControlPanelCollection controlPanelCollection) { Collection controlPanels = controlPanelCollection.getControlPanels(); // Detect controller language - some special variations of language tag only available on Lollipop+. String controllerLanguage_IETF_RFC5646; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { controllerLanguage_IETF_RFC5646 = Locale.getDefault().toLanguageTag(); } else { controllerLanguage_IETF_RFC5646 = Locale.getDefault().toString(); } controllerLanguage_IETF_RFC5646 = controllerLanguage_IETF_RFC5646.replace('_', '-'); String controllerLanguage_ISO639 = Locale.getDefault().getLanguage(); // E.g. 'en' part of 'en-US' // Trick to include specialised ISO 639 codes - since we're just doing language tag part // comparison after this, just append it to the end of full language tag so it's included // in the checks. String controllerLanguage_ISO639_3 = Locale.getDefault().getISO3Language(); if (controllerLanguage_ISO639_3.length() > 0 && controllerLanguage_IETF_RFC5646.length() > 0) { controllerLanguage_IETF_RFC5646 += "-" + controllerLanguage_ISO639_3; } // Obtain supported control panel languages from controllee. String[] controlPanelLanguageList = new String[controlPanels.size()]; int i = 0; for (DeviceControlPanel controlPanel : controlPanels) { controlPanelLanguageList[i] = controlPanel.getLanguage(); i++; } // Get the control panel with the language that either matches, or is a close match to, // this device's detected language. String closestLanguage = findClosestLanguageFromList(controlPanelLanguageList, controllerLanguage_IETF_RFC5646, controllerLanguage_ISO639); DeviceControlPanel selectedControlPanel = findControlPanelByLanguage(controlPanels, closestLanguage); DeviceControlPanel previousControlPanel = deviceControlPanel; if(selectedControlPanel != null) { deviceControlPanel = selectedControlPanel; Log.d(TAG, String.format("Found a control panel with closest match to phone languages: RFC5646=%s, ISO639=%s, Given language was: %s", controllerLanguage_IETF_RFC5646, controllerLanguage_ISO639, deviceControlPanel.getLanguage())); } else if (!controlPanels.isEmpty()) { Log.w(TAG, String.format("Could not find a control panel that matches phone languages: RFC5646=%s, ISO639=%s", controllerLanguage_IETF_RFC5646, controllerLanguage_ISO639)); deviceControlPanel = controlPanels.iterator().next(); Log.d(TAG, String.format("Defaulting to the control panel of language: %s", deviceControlPanel.getLanguage())); } Log.d(TAG, "Releasing the previous device control panel"); if (previousControlPanel != null) { previousControlPanel.release(); } if (deviceControlPanel != null) { onControlPanelSelected(); } else { Log.w(TAG, "No DeviceControlPanel found, ControlPanelCollection size: '" + controlPanels.size() + "'"); } } public void metadataChanged(ControllableDevice device, final UIElement uielement) { UIElementType elementType = uielement.getElementType(); Log.d(TAG, "METADATA_CHANGED : Received metadata changed signal, device: '" + device.getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "', element type: '" + elementType + "'"); Activity activity = getActivitySafely(); if (activity != null) { activity.runOnUiThread(new Runnable() { @Override public void run() { controlPanelAdapter.onMetaDataChange(uielement); } }); } } @Override public void errorOccurred(ControllableDevice device, final String reason) { final String text = "ErrorOccurred was called, Reason: '" + reason + "'"; Log.e(TAG, text); if (this.device.getDeviceId().equalsIgnoreCase(device.getDeviceId())) { final Activity activity = getActivitySafely(); if (activity == null) { return; } activity.runOnUiThread(new Runnable() { @Override public void run() { hideProgressDialog(); Toast.makeText(activity, text, Toast.LENGTH_LONG).show(); if ( isErrorSevere(reason) ) { Log.w(TAG, "The received error: '" + reason + "' is severe, calling raiseControlPanelStaleEvent"); raiseControlPanelStaleEvent(); } } }); } } /** * Analyzes whether the given error reason is severe that * {@link DeviceDetailFragment#raiseControlPanelStaleEvent()} should be called * @param reason The error reason * @return TRUE if the error is severe otherwise FALSE is returned */ private boolean isErrorSevere(String reason) { if ( reason == null ) { return false; } Status status; try { status = Status.valueOf(reason); } catch(IllegalArgumentException ilae) { //Not an AllJoyn status return false; } if ( status == Status.ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED ) { return false; //Not considered as an error } return true; //All the other cases are considered as a severe error } @Override public void handleControlPanelException(ControlPanelException e) { Activity activity = getActivitySafely(); if ( activity == null ) { Log.w(TAG, "handleControlPanelException - activity is not defined, returning"); return; } String text = activity.getString(R.string.action_failed); Log.e(TAG, text + ", error in calling remote object: '" + e.getMessage() + "'"); Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } @Override public void errorOccurred(DeviceControlPanel deviceControlPanel, String reason) { errorOccurred(deviceControlPanel.getDevice(), reason); } @Override public void metadataChanged(DeviceControlPanel deviceControlPanel, final UIElement uielement) { Log.d(TAG, "Received metadataChanged signal, device: '" + deviceControlPanel.getDevice().getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "'"); if (device.getDeviceId().equalsIgnoreCase(deviceControlPanel.getDevice().getDeviceId())) { UIElementType elementType = uielement.getElementType(); Log.d(TAG, "Received metadataChanged : Received metadata changed signal, device: '" + device.getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "', element type: '" + elementType + "'"); Activity activity = getActivitySafely(); if (activity != null) { activity.runOnUiThread(new Runnable() { @Override public void run() { controlPanelAdapter.onMetaDataChange(uielement); } }); } } } @Override public void valueChanged(DeviceControlPanel deviceControlPanel, final UIElement uielement, final Object newValue) { Log.d(TAG, "Received valueChanged signal, device: '" + deviceControlPanel.getDevice().getDeviceId() + "', ObjPath: '" + uielement.getObjectPath() + "', NewValue: '" + newValue + "'"); if (device.getDeviceId().equalsIgnoreCase(deviceControlPanel.getDevice().getDeviceId())) { if (controlPanelAdapter != null) { final Activity activity = getActivitySafely(); if (activity != null) { activity.runOnUiThread(new Runnable() { @Override public void run() { controlPanelAdapter.onValueChange(uielement, newValue); String text = "Received value changed signal, ObjPath: '" + uielement.getObjectPath() + "', NewValue: '" + newValue + "'"; Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } }); } } } } @Override public void notificationActionDismiss(DeviceControlPanel deviceControlPanel) { Log.d(TAG,"Received notificationActionDismiss"); if (alertDialog != null && alertDialog.isShowing()) { Log.d(TAG,"Dismissing the dialog"); alertDialog.dismiss(); } } }; /** * A wrapper class for hosting a {label,value} pair inside an ArrayAdapter. * So that the label is displayed, while practically the real value is used. */ class LabelValuePair { final String label; final Object value; public LabelValuePair(String label, Object value) { super(); this.value = value; this.label = label; } @Override // This does the trick of displaying the label and not the value in the Adapter public String toString() { return label; } } } DeviceList.java000066400000000000000000000141531272147170000422240ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/controlpanelbrowserpackage org.alljoyn.ioe.controlpanelbrowser; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; /** * The list of the Devices discovered by Announcements */ public class DeviceList { private static final String TAG = "cpappDeviceList"; /** * An array of ControlPanelContexts. */ private final List contexts = new ArrayList(); public void addItem(DeviceContext item) { //If the device with the same deviceId, appId exists, then remove it removeExistingDevice(item.getDeviceId(), item.getAppId()); contexts.add(item); } public List getContexts() { return contexts; } public void onDeviceOffline(String busName) { Iterator iter = contexts.iterator(); while ( iter.hasNext() ) { DeviceContext context = iter.next(); if ( context.getBusName().equals(busName) ) { Log.d(TAG, "Found the busName to be removed from the list: '" + busName + "'"); iter.remove(); } } } /** * Check whether the {@link DeviceContext} with the given deviceId and appId exist in the list. * If the device is found it's removed from the {@link DeviceList}. * @param deviceId * @param appId * @return {@link DeviceContext} if the device was found and removed from the {@link DeviceList} * otherwise NULL is returned */ private DeviceContext removeExistingDevice(String deviceId, UUID appId) { Iterator iter = contexts.iterator(); while ( iter.hasNext() ) { DeviceContext context = iter.next(); if ( context.getDeviceId().equals(deviceId) && context.getAppId().equals(appId) ) { Log.d(TAG, "The Device with the deviceId: '" + deviceId + "', appId: '" + appId + "' already exists, removing"); iter.remove(); return context; } } return null; } //=========================================================// /** * An item representing a device. */ public static class DeviceContext implements Parcelable { final private String deviceId; final private String busName; final private String label; final private Map object2Interfaces; final private UUID appId; /** * Constructor * @param deviceId * @param busName * @param deviceName * @param appId */ public DeviceContext(String deviceId, String busName, String deviceName, UUID appId) { Log.d("DeviceList", String.format("Adding a new device. id='%s', busName='%s', name='%s' appId='%s;", deviceId, busName, deviceName, appId)); this.deviceId = deviceId; this.busName = busName; this.appId = appId; this.object2Interfaces = new HashMap(5); label = deviceName + '(' + busName + ')'; } public String getDeviceId() { return deviceId; } public String getBusName() { return busName; } public UUID getAppId() { return appId; } public String getLabel() { return label; } public void addObjectInterfaces(String objPath, String[] interfaces) { object2Interfaces.put(objPath, interfaces); } public String[] getInterfaces(String objPath) { return object2Interfaces.get(objPath); } @Override public String toString() { return label; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeStringArray(new String[] { deviceId, busName, label, appId.toString() }); out.writeMap(this.object2Interfaces); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public DeviceContext createFromParcel(Parcel in) { return new DeviceContext(in); } @Override public DeviceContext[] newArray(int size) { return new DeviceContext[size]; } }; private DeviceContext(Parcel in) { String[] fields = new String[4]; in.readStringArray(fields); this.deviceId = fields[0]; this.busName = fields[1]; this.label = fields[2]; this.appId = UUID.fromString(fields[3]); this.object2Interfaces = new HashMap(5); in.readMap(object2Interfaces, getClass().getClassLoader()); } public Set getBusObjects() { return object2Interfaces.keySet(); } } } DeviceListActivity.java000066400000000000000000000117341272147170000437430ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/controlpanelbrowserpackage org.alljoyn.ioe.controlpanelbrowser; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import org.alljoyn.ioe.controlpanelbrowser.DeviceDetailFragment.DeviceDetailCallback; import org.alljoyn.ioe.controlpanelbrowser.DeviceList.DeviceContext; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.util.Log; /** * An activity representing a list of Appliances. This activity has different * presentations for handset and tablet-size devices. On handsets, the activity * presents a list of items, which when touched, lead to a * {@link DeviceDetailActivity} representing item details. On tablets, the * activity presents the list of items and item details side-by-side using two * vertical panes. *

* The activity makes heavy use of fragments. The list of items is a * {@link DeviceListFragment} and the item details (if present) is a * {@link DeviceDetailFragment}. *

* This activity also implements the required * {@link DeviceListFragment.DeviceListCallback} interface to listen for item * selections. */ public class DeviceListActivity extends FragmentActivity implements DeviceListFragment.DeviceListCallback, DeviceDetailCallback { /** * For logging */ private final static String TAG = "cpappApplianceListActivity"; /** * Whether or not the activity is in two-pane mode, i.e. running on a tablet * device. */ private boolean isTwoPane; /** * The {@link Fragment} containing the Control Panel */ private DeviceDetailFragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_device_list); if (findViewById(R.id.appliance_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-large and // res/values-sw600dp). If this view is present, then the // activity should be in two-pane mode. isTwoPane = true; // In two-pane mode, list items should be given the // 'activated' state when touched. ((DeviceListFragment) getSupportFragmentManager().findFragmentById(R.id.appliance_list)).setActivateOnItemClick(true); } } @Override public void onDestroy() { super.onDestroy(); } /** * Callback method from {@link DeviceListFragment.DeviceListCallback} * indicating that the item with the given ID was selected. */ @Override public void onItemSelected(DeviceContext context) { if (isTwoPane) { // In two-pane mode, show the detail view in this activity by // adding or replacing the detail fragment using a // fragment transaction. Bundle arguments = new Bundle(); arguments.putParcelable(DeviceDetailFragment.ARG_ITEM_ID, context); fragment = new DeviceDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.appliance_detail_container, fragment).commit(); } else { // In single-pane mode, simply start the detail activity // for the selected item ID. Intent detailIntent = new Intent(this, DeviceDetailActivity.class); detailIntent.putExtra(DeviceDetailFragment.ARG_ITEM_ID, context); startActivity(detailIntent); } } /** * @see org.alljoyn.ioe.controlpanelbrowser.DeviceDetailFragment.DeviceDetailCallback#onControlPanelStale() */ @Override public void onControlPanelStale() { if ( fragment == null ) { Log.wtf(TAG, "onControlPanelStale was called, but Fragment is NULL, weird..."); return; } Log.d(TAG, "onControlPanelStale was called need to detach the DeviceDetailFragment"); getSupportFragmentManager().beginTransaction().detach(fragment).commit(); } } DeviceListFragment.java000066400000000000000000000562611272147170000437160ustar00rootroot00000000000000base-16.04/controlpanel/java/sample_applications/android/ControlPanelBrowser/src/org/alljoyn/ioe/controlpanelbrowserpackage org.alljoyn.ioe.controlpanelbrowser; /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ import java.util.Map; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.bus.AboutListener; import org.alljoyn.bus.AboutObjectDescription; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.SessionOpts; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.ioe.controlpanelbrowser.DeviceList.DeviceContext; import org.alljoyn.ioe.controlpanelservice.ControlPanelException; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.ControlPanel; import org.alljoyn.ioe.controlpanelservice.communication.interfaces.HTTPControl; import org.alljoyn.services.android.security.AuthPasswordHandler; import org.alljoyn.services.android.security.SrpAnonymousKeyListener; import org.alljoyn.services.common.utils.GenericLogger; import org.alljoyn.services.common.utils.TransportUtil; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.support.v4.app.ListFragment; import android.text.InputType; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; /** * A list fragment representing a list of Appliances. This fragment also * supports tablet devices by allowing list items to be given an 'activated' * state upon selection. This helps indicate which item is currently being * viewed in a {@link DeviceDetailFragment}. *

* Activities containing this fragment MUST implement the * {@link DeviceListCallback} interface. */ public class DeviceListFragment extends ListFragment { /** * The serialization (saved instance state) Bundle key representing the * activated item position. Only used on tablets. */ private static final String STATE_ACTIVATED_POSITION = "activated_position"; /** * The fragment's current callback object, which is notified of list item * clicks. */ private DeviceListCallback mCallbacks = sDummyCallbacks; /** * The current activated item position. Only used on tablets. */ private int mActivatedPosition = ListView.INVALID_POSITION; /** * A callback interface that all activities containing this fragment must * implement. This mechanism allows activities to be notified of item * selections. */ public interface DeviceListCallback { /** * Callback for when an item has been selected. */ public void onItemSelected(DeviceContext context); } /** * A dummy implementation of the {@link DeviceListCallback} interface that * does nothing. Used only when this fragment is not attached to an * activity. */ private static DeviceListCallback sDummyCallbacks = new DeviceListCallback() { @Override public void onItemSelected(DeviceContext context) { } }; /** * For logging */ private final static String TAG = "cpappApplianceListFragment"; /** * A Handler for handling AllJoyn connection and disconnection on a * separated thread. */ private AsyncHandler handler; /** * A device registry */ private DeviceList deviceRegistry; /** * The AllJoyn bus attachment */ private BusAttachment bus; /** * The AllJoyn daemon advertises itself so thin clients can connect to it. * This is the known prefix of the daemon advertisement. */ private static final String DAEMON_NAME_PREFIX = "org.alljoyn.BusNode"; /** * The daemon should advertise itself "quietly" (directly to the calling * port) This is to reply directly to a TC looking for a daemon */ private static final String DAEMON_QUIET_PREFIX = "quiet@"; /** * The password for authentication with a remote secured Interface */ private static final String PREFS_NAME = "MyPrefsFile"; private static final String PREFS_PASSWORD = "CPB_PASS"; private static final String DEFAULT_SECURED_SRP_PASSWORD = "000000"; private String srpPassword = DEFAULT_SECURED_SRP_PASSWORD; /** * Supported Authentication mechanisms */ private final String[] AUTH_MECHANISMS = new String[] { "ALLJOYN_SRP_KEYX", "ALLJOYN_ECDHE_PSK" }; private static final String[] ANNOUNCE_IFACES = new String[] { ControlPanel.IFNAME, HTTPControl.IFNAME }; /** * Load the native alljoyn_java library. */ static { System.loadLibrary("alljoyn_java"); } /** * Reference to Logger */ private final GenericLogger logger = new GenericLogger() { @Override public void debug(String TAG, String msg) { Log.d(TAG, msg); } @Override public void info(String TAG, String msg) { Log.i(TAG, msg); } @Override public void warn(String TAG, String msg) { Log.w(TAG, msg); } @Override public void error(String TAG, String msg) { Log.e(TAG, msg); } @Override public void fatal(String TAG, String msg) { Log.wtf(TAG, msg); } }; /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ public DeviceListFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); deviceRegistry = new DeviceList(); HandlerThread busThread = new HandlerThread("BusHandler"); busThread.start(); handler = new AsyncHandler(busThread.getLooper()); handler.sendEmptyMessage(AsyncHandler.CONNECT); } @Override public void onDestroy() { // Disconnect to prevent any resource leaks. handler.disconnect(); handler.getLooper().quit(); super.onDestroy(); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Restore the previously serialized activated item position. if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); } } @Override public void onAttach(Activity activity) { super.onAttach(activity); // Activities containing this fragment must implement its callbacks. if (!(activity instanceof DeviceListCallback)) { throw new IllegalStateException("Activity must implement fragment's callbacks."); } mCallbacks = (DeviceListCallback) activity; } @Override public void onDetach() { super.onDetach(); // Reset the active callbacks interface to the dummy implementation. mCallbacks = sDummyCallbacks; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Add your menu entries here super.onCreateOptionsMenu(menu, inflater); // Inflate the menu; this adds items to the action bar if it is present. inflater.inflate(R.menu.activity_control_panel, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection if (item.getItemId() == R.id.menu_set_password) { showSetPasswordDialog(); return true; } else { return super.onOptionsItemSelected(item); } } @Override public void onListItemClick(ListView listView, View view, int position, long id) { super.onListItemClick(listView, view, position, id); // Notify the active callbacks interface (the activity, if the // fragment is attached to one) that an item has been selected. mCallbacks.onItemSelected(deviceRegistry.getContexts().get(position)); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { // Serialize and persist the activated item position. outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } } /** * Turns on activate-on-click mode. When this mode is on, list items will be * given the 'activated' state when touched. */ public void setActivateOnItemClick(boolean activateOnItemClick) { // When setting CHOICE_MODE_SINGLE, ListView will automatically // give items the 'activated' state when touched. getListView().setChoiceMode(activateOnItemClick ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE); } private void setActivatedPosition(int position) { if (position == ListView.INVALID_POSITION) { getListView().setItemChecked(mActivatedPosition, false); } else { getListView().setItemChecked(position, true); } mActivatedPosition = position; } /* This class will handle all AllJoyn calls. See onCreate(). */ class AsyncHandler extends Handler implements AboutListener, AuthPasswordHandler { public static final int CONNECT = 1; public static final int DISCONNECT = 2; public AsyncHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { switch (msg.what) { /* Connect to the bus and start our service. */ case CONNECT: { connect(); break; } /* Release all resources acquired in connect. */ case DISCONNECT: { disconnect(); break; } } } // =================================== Connect // ============================================ /** * Connect to the bus and start our services. */ private void connect() { Log.d(TAG, "connect()"); /* initialize AllJoyn BusAttachment. */ bus = new BusAttachment("ControlPanelBrowser", BusAttachment.RemoteMessage.Receive); // Pump up the daemon debug level // bus.setDaemonDebug("ALL", 7); // bus.setLogLevels("ALLJOYN=7"); // bus.useOSLogging(true); // load the password for accessing secured interfaces on the board SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, 0); srpPassword = settings.getString(PREFS_PASSWORD, DEFAULT_SECURED_SRP_PASSWORD); Log.d(TAG, "Setting the AuthListener"); SrpAnonymousKeyListener authListener = new SrpAnonymousKeyListener(this, logger, AUTH_MECHANISMS); Status authStatus = bus.registerAuthListener(authListener.getAuthMechanismsAsString(), authListener, getKeyStoreFileName()); if (authStatus != Status.OK) { Log.e(TAG, "Failed to register AuthListener"); } Status status = bus.connect(); if (Status.OK == status) { Log.d(TAG, "BusAttachment.connect(): ok. BusUniqueName: " + bus.getUniqueName()); // request the name String daemonName = DAEMON_NAME_PREFIX + ".ControlPanelBrowser.G" + bus.getGlobalGUIDString(); int flag = BusAttachment.ALLJOYN_REQUESTNAME_FLAG_DO_NOT_QUEUE; Status reqStatus = bus.requestName(daemonName, flag); if (reqStatus == Status.OK) { // advertise the name with a quite prefix for thin clients // to find it Status adStatus = bus.advertiseName(DAEMON_QUIET_PREFIX + daemonName, SessionOpts.TRANSPORT_ANY); if (adStatus != Status.OK) { bus.releaseName(daemonName); Log.e(TAG, "Failed to advertise daemon name: '" + daemonName + "', Error: '" + status + "'"); } else { Log.d(TAG, "Succefully advertised daemon name: '" + daemonName + "'"); } } else { Log.e(TAG, "Failed to request daemon name: '" + daemonName + "', Error: '" + status + "'"); } } // Initialize AboutService bus.registerAboutListener(this); for (String iface : ANNOUNCE_IFACES) { bus.whoImplements(new String[] { iface }); } // Initialize ControlPanelService ControlPanelService controlPanelService = ControlPanelService.getInstance(); try { controlPanelService.init(bus); Log.d(TAG, "Initialized ControlPanelService with BusAttachment " + bus.getUniqueName()); } catch (ControlPanelException e) { Log.e(TAG, "Unable to start ControlPanelService, Error: " + e.getMessage()); } Toast.makeText(getActivity(), "Initialized", Toast.LENGTH_SHORT).show(); // update the list refreshListView(); } // =================================== Disconnect // ============================================ /** * Release all resources acquired in connect. */ private void disconnect() { ControlPanelService.getInstance().shutdown(); for (String iface : ANNOUNCE_IFACES) { bus.cancelWhoImplements(new String[] { iface }); } bus.unregisterAboutListener(this); bus.disconnect(); bus.release(); } // =================================== onAnnouncement // ============================================ /* * A callback where About service notifies listeners about a new * announcement. * * @see * org.alljoyn.services.common.AnnouncementHandler#onAnnouncement(java * .lang.String, short, * org.alljoyn.services.common.BusObjectDescription[], java.util.Map) */ @Override public void announced(String busName, int version, short port, AboutObjectDescription[] objectDescriptions, Map aboutMap) { String deviceId; String deviceFriendlyName; UUID appId; DeviceContext deviceContext = null; try { Variant varDeviceId = aboutMap.get(AboutKeys.ABOUT_DEVICE_ID); String devIdSig = (varDeviceId != null) ? varDeviceId.getSignature() : ""; if (!devIdSig.equals("s")) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_DEVICE_ID + "', that has an unexpected signature: '" + devIdSig + "', the expected signature is: 's'"); return; } deviceId = varDeviceId.getObject(String.class); Variant varFriendlyName = aboutMap.get(AboutKeys.ABOUT_DEVICE_NAME); String friendlyNameSig = (varFriendlyName != null) ? varFriendlyName.getSignature() : ""; if (!friendlyNameSig.equals("s")) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_DEVICE_NAME + "', that has an unexpected signature: '" + friendlyNameSig + "', the expected signature is: 's'"); return; } deviceFriendlyName = varFriendlyName.getObject(String.class); Variant varAppId = aboutMap.get(AboutKeys.ABOUT_APP_ID); String appIdSig = (varAppId != null) ? varAppId.getSignature() : ""; if (!appIdSig.equals("ay")) { Log.e(TAG, "Received '" + AboutKeys.ABOUT_APP_ID + "', that has an unexpected signature: '" + appIdSig + "', the expected signature is: 'ay'"); return; } byte[] rawAppId = varAppId.getObject(byte[].class); appId = TransportUtil.byteArrayToUUID(rawAppId); if (appId == null) { Log.e(TAG, "Received a bad AppId, failed to convert it to the UUID"); return; } } catch (BusException be) { Log.e(TAG, "Failed to retreive an Announcement properties, Error: '" + be.getMessage() + "'", be); return; } // scan the object descriptions, pick those who implement a control // panel interface for (int i = 0; i < objectDescriptions.length; ++i) { AboutObjectDescription description = objectDescriptions[i]; String[] supportedInterfaces = description.interfaces; for (int j = 0; j < supportedInterfaces.length; ++j) { if (supportedInterfaces[j].startsWith(ControlPanelService.INTERFACE_PREFIX)) { // found a control panel interface Log.d(TAG, "Adding BusObjectDesciption: " + description); if (deviceContext == null) { deviceContext = new DeviceContext(deviceId, busName, deviceFriendlyName, appId); } deviceContext.addObjectInterfaces(description.path, supportedInterfaces); } } } // add the device context if (deviceContext != null) { deviceRegistry.addItem(deviceContext); } // update the list refreshListView(); } public void onDeviceLost(String busName) { Log.d(TAG, "Received DeviceLost for '" + busName + "'"); deviceRegistry.onDeviceOffline(busName); // update the list refreshListView(); } private void refreshListView() { getActivity().runOnUiThread(new Runnable() { @Override public void run() { ArrayAdapter arrayAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_activated_1, android.R.id.text1, deviceRegistry.getContexts()); setListAdapter(arrayAdapter); arrayAdapter.notifyDataSetChanged(); } }); } /** * @see org.alljoyn.services.android.security.AuthPasswordHandler#getPassword(java.lang.String) */ @Override public char[] getPassword(String peer) { return srpPassword.toCharArray(); } /** * @see org.alljoyn.bus.AuthListener#completed(java.lang.String, * java.lang.String, boolean) */ @Override public void completed(String authMechanism, String authPeer, final boolean authenticated) { Log.d(TAG, "Authentication completed. peer: '" + authPeer + "', authenticated: " + authenticated + " using mechanism: '" + authMechanism + "'"); if (authenticated) { Log.d(TAG, "The peer: '" + authPeer + "', authenticated successfully for authMechanism: '" + authMechanism + "'"); } else { Log.w(TAG, "The peer: '" + authPeer + "', WAS NOT authenticated for authMechanism: '" + authMechanism + "'"); } if (getActivity() != null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), "Authenticated: " + authenticated, Toast.LENGTH_SHORT).show(); } }); } /** * Persistent authentication and encryption data is stored at this * location. * * This uses the private file area associated with the application * package. */ public String getKeyStoreFileName() { return getActivity().getFileStreamPath("alljoyn_keystore").getAbsolutePath(); }// getKeyStoreFileName } private void showSetPasswordDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle(R.string.enter_device_password); alert.setCancelable(false); View view = getActivity().getLayoutInflater().inflate(R.layout.enter_password_popup, null); final EditText input = (EditText) view.findViewById(R.id.passwordEditText); input.setText(srpPassword); final CheckBox showPassword = (CheckBox) view.findViewById(R.id.showPasswordCheckBox); alert.setView(view); showPassword.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { input.setInputType(InputType.TYPE_CLASS_TEXT); } else { input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } } }); alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { srpPassword = input.getText().toString(); // store the new password SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(PREFS_PASSWORD, srpPassword); editor.commit(); } }); alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); } } base-16.04/notification/000077500000000000000000000000001272147170000151255ustar00rootroot00000000000000base-16.04/notification/.gitignore000066400000000000000000000005721272147170000171210ustar00rootroot00000000000000*.developerprofile *.xcuserdatad *.a *.class *.jar *.o *.so *~ .cproject .project .sconsign.dblite */.settings/* libs QA ajlite.nvram alljoyn-daemon bin build deploy docs/*.html docs/html/*.html gen lib local.properties obj* # OS generated files # ###################### .DS_Store .DS_Store? ios/samples/.DS_Store ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db xcshareddata base-16.04/notification/SConscript000066400000000000000000000040221272147170000171350ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os Import('env') env['_ALLJOYN_NOTIFICATION_'] = True env['OBJDIR_SERVICES_NOTIFICATION'] = env['OBJDIR'] + '/services/notification' # Make config library and header file paths available to the global environment env.Append(LIBPATH = '$DISTDIR/notification/lib'); env.Append(CPPPATH = '$DISTDIR/notification/inc'); if not env.has_key('_ALLJOYN_SERVICES_COMMON_') and os.path.exists('../services_common/SConscript'): env.SConscript('../services_common/SConscript') nsenv = env.Clone() # ASABASE-452, ASACORE-1419 # Even though we have deprecated the About Service code the notification service is # designed so a developer can use the deprecated AboutService or the new # About Feature code. So the notification service can continue to support the # deprecated methods we must turn off the deprecated-declarations warning. if nsenv['OS_GROUP'] == 'posix': nsenv.Append(CXXFLAGS = ['-Wno-deprecated-declarations']) for b in nsenv['bindings']: if os.path.exists('%s/SConscript' % b): nsenv.VariantDir('$OBJDIR_SERVICES_NOTIFICATION/%s' % b, b, duplicate = 0) nsenv.SConscript(['$OBJDIR_SERVICES_NOTIFICATION/%s/SConscript' % b for b in env['bindings'] if os.path.exists('%s/SConscript' % b) ], exports = ['nsenv']) base-16.04/notification/SConstruct000066400000000000000000000043221272147170000171600ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os env = SConscript('../build_core/SConscript') vars = Variables() vars.Add('BINDINGS', 'Bindings to build (comma separated list): cpp, java', 'cpp,java') vars.Add(EnumVariable('BUILD_SERVICES_SAMPLES', 'Build the services samples.', 'on', allowed_values = ['on', 'off'])) vars.Add(PathVariable('ALLJOYN_DISTDIR', 'Directory containing a built AllJoyn Core dist directory.', os.environ.get('ALLJOYN_DISTDIR'))) vars.Add(PathVariable('APP_COMMON_DIR', 'Directory containing common sample application sources.', os.environ.get('APP_COMMON_DIR','../sample_apps'))) vars.Update(env) Help(vars.GenerateHelpText(env)) if '' == env.subst('$ALLJOYN_DISTDIR'): print 'ALLJOYN_DISTDIR variable is required' if not GetOption('help'): Exit(1) else: # normalize ALLJOYN_DISTDIR first env['ALLJOYN_DISTDIR'] = env.Dir('$ALLJOYN_DISTDIR') env.Append(CPPPATH = [ env.Dir('$ALLJOYN_DISTDIR/cpp/inc'), env.Dir('$ALLJOYN_DISTDIR/cpp/inc/alljoyn') ]) env.Append(LIBPATH = [ env.Dir('$ALLJOYN_DISTDIR/cpp/lib') ]) if env.get('APP_COMMON_DIR'): # normalize APP_COMMON_DIR env['APP_COMMON_DIR'] = env.Dir('$APP_COMMON_DIR') env['bindings'] = set([ b.strip() for b in env['BINDINGS'].split(',') ]) env.SConscript('SConscript') base-16.04/notification/cpp/000077500000000000000000000000001272147170000157075ustar00rootroot00000000000000base-16.04/notification/cpp/SConscript000066400000000000000000000031141272147170000177200ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('nsenv') if not nsenv.has_key('_ALLJOYNCORE_'): nsenv.Append(LIBS = ['alljoyn']) if nsenv['BR'] == 'on' : nsenv['ajrlib'] = 'ajrouter' if nsenv['OS'] == 'openwrt': nsenv.AppendUnique(LIBS = [ 'stdc++', 'pthread' ]) nsenv['NS_DISTDIR'] = nsenv['DISTDIR'] + '/notification' nsenv.Install('$NS_DISTDIR/inc/alljoyn/notification', nsenv.Glob('inc/alljoyn/notification/*.h')) nsenv.Install('$NS_DISTDIR/lib', nsenv.SConscript('src/SConscript', exports = ['nsenv'])) if nsenv['BUILD_SERVICES_SAMPLES'] == 'on': nsenv.Install('$NS_DISTDIR/bin', nsenv.SConscript('samples/SConscript', exports = ['nsenv'])) # Build docs installDocs = nsenv.SConscript('docs/SConscript', exports = ['nsenv']) nsenv.Depends(installDocs, nsenv.Glob('$NS_DISTDIR/inc/alljoyn/notification/*.h')); base-16.04/notification/cpp/docs/000077500000000000000000000000001272147170000166375ustar00rootroot00000000000000base-16.04/notification/cpp/docs/Doxygen_html000066400000000000000000001700461272147170000212330ustar00rootroot00000000000000# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "AllJoyn™ Notification API Reference Manual" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = "Version 00.00.01" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = YES # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../inc/alljoyn/notification # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. # 20120131: header.html should no longer be used in production builds [MBUS-463] # doxygen 1.7.4 and later will generate buggy html if header.html is included HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = "QCC_DEPRECATED(func)=func" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 3 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES base-16.04/notification/cpp/docs/SConscript000066400000000000000000000024231272147170000206520ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import os Import('env') returnValue = [] docenv = env.Clone() # Build docs if docenv['DOCS'] == 'html': # the target directory 'docs/tmp' is never built this will cause doxygen # to run every time DOCS == 'html' generateDocs = docenv.Doxygen(source='Doxygen_html', target=[Dir('tmp'), Dir('html')]) returnValue = docenv.Install('$NS_DIST_DIR/docs', Dir('html')) docenv.Clean('Doxygen_html', Dir('html')) docenv.Depends(returnValue, generateDocs) Return('returnValue') base-16.04/notification/cpp/docs/footer.html000066400000000000000000000025051272147170000210250ustar00rootroot00000000000000


$projectname $projectnumber ($datetime)
Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
base-16.04/notification/cpp/inc/000077500000000000000000000000001272147170000164605ustar00rootroot00000000000000base-16.04/notification/cpp/inc/alljoyn/000077500000000000000000000000001272147170000201305ustar00rootroot00000000000000base-16.04/notification/cpp/inc/alljoyn/notification/000077500000000000000000000000001272147170000226165ustar00rootroot00000000000000base-16.04/notification/cpp/inc/alljoyn/notification/LogModule.h000066400000000000000000000023671272147170000246660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef LOGMODULE_H_ #define LOGMODULE_H_ #include #include #include namespace ajn { namespace services { static char const* const QCC_MODULE = logModules::NOTIFICATION_MODULE_LOG_NAME; } } #endif /* LOGMODULE_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/Notification.h000066400000000000000000000227571272147170000254320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATION_H_ #define NOTIFICATION_H_ #include #include #include #include #include #include #include #include "NotificationAsyncTaskEvents.h" #include namespace ajn { namespace services { /** * NotificationMsg * This message will be sent when user uses interface NotificationProducer * Implicit or explicit copy constructor must work. */ class NotificationMsg : public TaskData { public: /** * NotificationMsg constructor */ NotificationMsg(const char* originalSender, int32_t messageId, const char* appId) : m_OriginalSender(originalSender), m_MessageId(messageId), m_AppId(appId) { } /** * NotificationMsg destructor */ ~NotificationMsg() { } public: /** * The original sender of the notification */ const qcc::String m_OriginalSender; /** * The Notification's Message Id */ const int32_t m_MessageId; /** * The Notification's App Id */ const qcc::String m_AppId; }; /** * The Notification Class is used to send and receive Notifications */ class Notification { public: /** * Constructor for Notification * @param messageId * @param messageType * @param deviceId * @param deviceName * @param appId * @param appName * @param sender * @param customAttributes * @param notificationText * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath * @param originalSender */ Notification(int32_t messageId, NotificationMessageType messageType, const char* deviceId, const char* deviceName, const char* appId, const char* appName, const char* sender, std::map const& customAttributes, std::vector const& notificationText, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender); /** * Construct for Notification * @param messageType * @param notificationText */ Notification(NotificationMessageType messageType, std::vector const& notificationText); /** * Destructor of Notification */ ~Notification(); /** * copy constructor */ Notification(const Notification& notification); /** * Get the Version * @return version */ const uint16_t getVersion() const; /** * Get the device Id * @return deviceId */ const char* getDeviceId() const; /** * Get the Device Name * @return deviceName */ const char* getDeviceName() const; /** * Get the app Id * @return appId */ const char* getAppId() const; /** * Get the app Name * @return appName */ const char* getAppName() const; /** * Get the map of customAttributes * @return customAttributes */ const std::map& getCustomAttributes() const; /** * Get the Message Id * @return notificationId */ const int32_t getMessageId() const; /** * Get the Sender * @return Sender */ const char* getSenderBusName() const; /** * Get the MessageType * @return MessageType */ const NotificationMessageType getMessageType() const; /** * Get the Notification Text * @return notificationText */ const std::vector& getText() const; /** * Get the Rich Icon Url * @return richIconUrl */ const char* getRichIconUrl() const; /** * Get the Rich Icon Object Path * @return richIconObjectPath */ const char* getRichIconObjectPath() const; /** * Get the Rich Audio Object Path * @return richAudioObjectPath */ const char* getRichAudioObjectPath() const; /** * Get the Rich Audio Urls * @return RichAudioUrl */ const std::vector& getRichAudioUrl() const; /** * Get the ControlPanelService object path * @return ControlPanelServiceObjectPath */ const char* getControlPanelServiceObjectPath() const; /** * Get the OriginalSender object path * @return OriginalSender */ const char* getOriginalSender() const; /** * Set the App Id of the Notification * @param appId */ void setAppId(const char* appId); /** * Set the App Name of the Notification * @param appName */ void setAppName(const char* appName); /** * Set the Control Panel Service Object Path of the Notification * @param controlPanelServiceObjectPath */ void setControlPanelServiceObjectPath( const char* controlPanelServiceObjectPath); /** * Set the Custom Attributed of the Notification * @param customAttributes */ void setCustomAttributes( const std::map& customAttributes); /** * Set the deviceId of the Notification * @param deviceId */ void setDeviceId(const char* deviceId); /** * Set the deviceName of the Notification * @param deviceName */ void setDeviceName(const char* deviceName); /** * Set the messageId of the Notification * @param messageId */ void setMessageId(int32_t messageId); /** * Set the richAudioUrl of the Notification * @param richAudioUrl */ void setRichAudioUrl(const std::vector& richAudioUrl); /** * Set the richIconUrl of the Notification * @param richIconUrl */ void setRichIconUrl(const char* richIconUrl); /** * Set the richIconObjectPath of the Notification * @param richIconObjectPath */ void setRichIconObjectPath(const char* richIconObjectPath); /** * Set the richAudioObjectPath of the Notification * @param richAudioObjectPath */ void setRichAudioObjectPath(const char* richAudioObjectPath); /** * Set the sender of the Notification * @param sender */ void setSender(const char* sender); /** * dismiss */ QStatus dismiss(); /** * Responsible to get and handle events comming from the queue. */ static NotificationAsyncTaskEvents m_NotificationAsyncTaskEvents; /** * Purpose is to handle tasks asynchronously. * Handling user dismiss of the notification. */ static AsyncTaskQueue m_AsyncTaskQueue; private: /** * assignment operator is forbidden */ Notification& operator=(const Notification&); /** * set the original sender */ void setOriginalSender(const char* originalSender); /** * The Notification's Message Id */ int32_t m_MessageId; /** * The Notifications Sender */ qcc::String* m_Sender; /** * The Notifications MessageType */ NotificationMessageType m_MessageType; /** * The Notification's Device Id */ qcc::String* m_DeviceId; /** * The Notification's Device Name */ qcc::String* m_DeviceName; /** * The Notification's App Id */ qcc::String* m_AppId; /** * The Notification's App Name */ qcc::String* m_AppName; /** * The Notification's map of Custom Attributs */ std::map m_CustomAttributes; /** * The Notification's vector of Notification Texts */ std::vector m_Text; /** * The Notification's rich Icon Url */ qcc::String* m_RichIconUrl; /** * The Notification's vector of Rich Audio Urls */ std::vector m_RichAudioUrl; /** * The Notification's rich Icon Object Path */ qcc::String* m_RichIconObjectPath; /** * The Notification's rich Audio Object */ qcc::String* m_RichAudioObjectPath; /** * The Notification's ControlPanelService object path */ qcc::String* m_ControlPanelServiceObjectPath; /** * The Notification's original sender */ qcc::String* m_OriginalSender; }; } //namespace services } //namespace ajn #endif /* NOTIFICATION_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationAsyncTaskEvents.h000066400000000000000000000041661272147170000304320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATION_ASYNCTASK_EVENTS_H_ #define NOTIFICATION_ASYNCTASK_EVENTS_H_ #include #include #include #include #include namespace ajn { namespace services { /** * Notification async task events. * Class implementing callbacks fto handle messages. */ class NotificationAsyncTaskEvents : public AsyncTask { public: /** * constructor of NotificationAsyncTaskEvents */ NotificationAsyncTaskEvents(); /** * destructor of NotificationAsyncTaskEvents */ virtual ~NotificationAsyncTaskEvents(); /** * callback to handle the case of empty message queue. */ virtual void OnEmptyQueue(); /** * callback to handle the case of new message * @param taskdata - object to handle */ virtual void OnTask(TaskData const* taskdata); private: /** * send dismiss signal * @param asyncTaskQueue - a template type of message */ void sendDismissSignal(TaskData const* taskdata); }; } //namespace services } //namespace ajn #endif /* NOTIFICATION_ASYNCTASK_EVENTS_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationEnums.h000066400000000000000000000050721272147170000264310ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONENUMS_H_ #define NOTIFICATIONENUMS_H_ #include namespace ajn { namespace services { /** * Enum to describe Message type levels */ enum NotificationMessageType { EMERGENCY = 0, //!< EMERGENCY - Urgent Message WARNING = 1, //!< WARNING - Warning Message INFO = 2, //!< INFO - Informational Message MESSAGE_TYPE_CNT = 3, //!< MESSAGE_TYPE_CNT - Number of Message Types Defined UNSET = 4 //!< UNSET - No message Type set - used for testing }; /** * A Util class that convers MessageType to String * */ class MessageTypeUtil { public: /** * Get MessageType String back based on int received * @param messageType - MessageType to convert * @return String that represents MessageType Enum */ static qcc::String const& getMessageTypeString(int32_t messageType); /** * Get MessageType int and convert to enum * To prevent ugly casting in many places * @param messageType - MessageType to convert * @return Enum MessageType */ static NotificationMessageType getMessageType(int32_t messageType); /** * Get the number of MessageType * Same as using enum MESSAGE_TYPE_CNT * @return amount of MessageType defined */ static int32_t getNumMessageTypes(); private: /** * Array that holds message type Strings */ static const qcc::String MESSAGE_TYPE_STRINGS[]; /** * private Constructor */ MessageTypeUtil() { }; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONENUMS_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationReceiver.h000066400000000000000000000037341272147170000271110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONRECEIVER_H_ #define NOTIFICATIONRECEIVER_H_ #include namespace ajn { namespace services { /** * An Abstract class with function receive. The implementation of this class * can be passed in to the initReceive function and will be the callback for * when notifications are received */ class NotificationReceiver { public: /** * Constructor for NotificationReceiver */ NotificationReceiver() { }; /** * Destructor for NotificationReceiver */ virtual ~NotificationReceiver() { }; /** * Pure abstract function that receives a notification * Consumer Application must override this method * @param notification the notification that is received */ virtual void Receive(Notification const& notification) = 0; /** * Dismiss handler */ virtual void Dismiss(const int32_t msgId, const qcc::String appId) = 0; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONRECEIVER_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationSender.h000066400000000000000000000060651272147170000265650ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONSENDER_H_ #define NOTIFICATIONSENDER_H_ #include #include #include #include #include #include namespace ajn { namespace services { class Notification; /** * The class used to send Notifications or delete the last sent Notification */ class NotificationSender { public: /** * Constructor for NotificationSenderImpl * @param aboutdata - AboutData that includes entries * for deviceId, deviceName, appId and appName */ NotificationSender(ajn::AboutData* aboutdata); /** * Constructor for NotificationSenderImpl * @param propertyStore - propertyStoreImplementation that includes entries * for deviceId, deviceName, appId and appName * @deprecated see NotificationSender(ajn::AboutData*) */ QCC_DEPRECATED(NotificationSender(ajn::services::PropertyStore* propertyStore)); /** * Destructor for NotificationSenderImpl */ ~NotificationSender() { }; /** * Send notification * @param notification * @param ttl * @return */ QStatus send(Notification const& notification, uint16_t ttl); /** * Delete last message that was sent with given MessageType * @param messageType MessageType of message to be deleted * @return success/failure */ QStatus deleteLastMsg(NotificationMessageType messageType); /** * Get the notification id of the last message sent with the given MessageType * @param messageType type of message * @param messageId pointer to hold the notification id of the last message * @return success/failure */ QStatus getLastMsgId(NotificationMessageType messageType, int32_t* messageId); private: /** * Pointer to AboutData implementing the storage. */ ajn::AboutData* m_aboutdata; /** * Pointer to PropertyStore implementing the storage. */ ajn::services::PropertyStore* m_PropertyStore; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONSENDER_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationService.h000066400000000000000000000074461272147170000267510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONSERVICE_H_ #define NOTIFICATIONSERVICE_H_ #include #include #include #include #include namespace ajn { namespace services { class NotificationReceiver; /** * Notification Service class. Used to initialize and shutdown the service */ class NotificationService { public: /** * Get Instance of NotificationService - singleton implementation * @return instance */ static NotificationService* getInstance(); /** * Destructor for NotificationService */ ~NotificationService(); /** * Initialize Producer side via Transport. Create and * return NotificationSender. * @param bus * @param store * @return NotificationSender instance */ NotificationSender* initSend(ajn::BusAttachment* bus, ajn::AboutData* store); /** * Initialize Producer side via Transport. Create and * return NotificationSender. * @param bus * @param store * * @deprecated see initSend(ajn::BusAttachment*, ajn::AboutData*) * * @return NotificationSender instance */ QCC_DEPRECATED(NotificationSender* initSend(ajn::BusAttachment* bus, ajn::services::PropertyStore* store)); /** * Initialize Consumer side via Transport. * Set NotificationReceiver to given receiver * @param bus * @param notificationReceiver * @return status */ QStatus initReceive(ajn::BusAttachment* bus, NotificationReceiver* notificationReceiver); /** * Stops sender but leaves bus and other objects alive */ void shutdownSender(); /** * Stops receiving but leaves bus and other objects alive */ void shutdownReceiver(); /** * Cleanup and get ready for shutdown */ void shutdown(); /** * @deprecated May 2015 for 15.04 release. * Disabling superagent mode. * Needs to be called before starting receiver * @return ER_OK */ QCC_DEPRECATED(QStatus disableSuperAgent() {return ER_OK; }); /** * Virtual method to get the busAttachment used in the service. */ ajn::BusAttachment* getBusAttachment(); /** * Get the Version of the NotificationService * @return the NotificationService version */ static uint16_t getVersion(); private: /** * Default constructor for NotificationServiceImpl * Private to allow for singleton implementation */ NotificationService(); /** * Version of the API */ static uint16_t const NOTIFICATION_SERVICE_VERSION; /** * instance variable - NotificationServiceImpl is a singleton */ static NotificationService* s_Instance; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONSERVICE_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/NotificationText.h000066400000000000000000000043521272147170000262660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONTEXT_H_ #define NOTIFICATIONTEXT_H_ #include namespace ajn { namespace services { /** * Class NotificationText is used to represent the actual text message of the notification * Made up of language and text values */ class NotificationText { public: /** * Constructor for NotificationText * @param language Language of Notification * @param text Text of Notification */ NotificationText(qcc::String const& language, qcc::String const& text); /** * Destructor for NotificationText */ ~NotificationText() { }; /** * Set Language for Notification * @param language */ void setLanguage(qcc::String const& language); /** * Get Language for Notification * @return language */ qcc::String const& getLanguage() const; /** * Set Text for Notification * @param text */ void setText(qcc::String const& text); /** * Get Text for Notification * @return text */ qcc::String const& getText() const; private: /** * Notification Language */ qcc::String m_Language; /** * Notification Text */ qcc::String m_Text; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONTEXT_H_ */ base-16.04/notification/cpp/inc/alljoyn/notification/RichAudioUrl.h000066400000000000000000000042001272147170000253150ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef RICHAUDIOURL_H_ #define RICHAUDIOURL_H_ #include namespace ajn { namespace services { /** * Class to store RichAudio urls, a url per language */ class RichAudioUrl { public: /** * Constructor for RichAudioUrl * @param language Language of Audio Content * @param url Url of Audio Content */ RichAudioUrl(qcc::String const& language, qcc::String const& url); /** * Destructor for RichAudioUrl */ ~RichAudioUrl() { }; /** * Set Language for Audio Content * @param language */ void setLanguage(qcc::String const& language); /** * Get Language for Audio Content * @return language */ qcc::String const& getLanguage() const; /** * Set URL for Audio Content * @param url */ void setUrl(qcc::String const& url); /** * Get URL for Audio Content * @return url */ qcc::String const& getUrl() const; private: /** * Audio Content Language String */ qcc::String m_Language; /** * Audio Content URL */ qcc::String m_Url; }; } //namespace services } //namespace ajn #endif /* RICHAUDIOURL_H_ */ base-16.04/notification/cpp/samples/000077500000000000000000000000001272147170000173535ustar00rootroot00000000000000base-16.04/notification/cpp/samples/ConsumerService/000077500000000000000000000000001272147170000224675ustar00rootroot00000000000000base-16.04/notification/cpp/samples/ConsumerService/.gitignore000066400000000000000000000000261272147170000244550ustar00rootroot00000000000000/obj /ConsumerService base-16.04/notification/cpp/samples/ConsumerService/ConsumerService.cc000066400000000000000000000102701272147170000261120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "../common/NotificationReceiverTestImpl.h" #include "CommonSampleUtil.h" #include #include using namespace ajn; using namespace services; NotificationService* conService = 0; NotificationReceiverTestImpl* Receiver = 0; ajn::BusAttachment* busAttachment = 0; static volatile sig_atomic_t s_interrupt = false; void cleanup() { std::cout << "cleanup() - start" << std::endl; if (conService) { std::cout << "cleanup() - conService" << std::endl; conService->shutdown(); conService = NULL; } if (Receiver) { std::cout << "cleanup() - Receiver" << std::endl; delete Receiver; Receiver = NULL; } if (busAttachment) { std::cout << "cleanup() - busAttachment" << std::endl; delete busAttachment; busAttachment = NULL; } std::cout << "cleanup() - end" << std::endl; } void CDECL_CALL signal_callback_handler(int32_t signum) { QCC_UNUSED(signum); std::cout << "got signal_callback_handler" << std::endl; s_interrupt = true; } void WaitForSigInt() { while (s_interrupt == false) { #ifdef _WIN32 Sleep(100); #else usleep(100 * 1000); #endif } std::cout << "Getting out from WaitForSigInt()" << std::endl; } int main() { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } std::string listOfApps; // Allow CTRL+C to end application signal(SIGINT, signal_callback_handler); std::cout << "Begin Consumer Application. (Press CTRL+C to end application)" << std::endl; std::cout << "Enter in a list of app names (separated by ';') you would like to receive notifications from." << std::endl; std::cout << "Empty list means all app names." << std::endl; getline(std::cin, listOfApps); // Initialize Service object and send it Notification Receiver object conService = NotificationService::getInstance(); // change loglevel to debug: QCC_SetLogLevels("ALLJOYN_ABOUT_CLIENT=7"); QCC_SetLogLevels("ALLJOYN_ABOUT_ICON_CLIENT=7"); QCC_SetLogLevels("ALLJOYN_ABOUT_ANNOUNCE_HANDLER=7"); QCC_SetLogLevels("ALLJOYN_ABOUT_ANNOUNCEMENT_REGISTRAR=7"); QCC_SetDebugLevel(logModules::NOTIFICATION_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); Receiver = new NotificationReceiverTestImpl(false); // Set the list of applications this receiver should receive notifications from Receiver->setApplications(listOfApps.c_str()); busAttachment = CommonSampleUtil::prepareBusAttachment(); if (busAttachment == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; cleanup(); return 1; } QStatus status; status = conService->initReceive(busAttachment, Receiver); if (status != ER_OK) { std::cout << "Could not initialize receiver." << std::endl; cleanup(); return 1; } std::cout << "Waiting for notifications." << std::endl; WaitForSigInt(); cleanup(); return 0; } base-16.04/notification/cpp/samples/ConsumerService/SConscript000066400000000000000000000016721272147170000245070ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) prog = env.Program('ConsumerService', objs) Return('prog') base-16.04/notification/cpp/samples/ProducerBasic/000077500000000000000000000000001272147170000221005ustar00rootroot00000000000000base-16.04/notification/cpp/samples/ProducerBasic/.gitignore000066400000000000000000000000241272147170000240640ustar00rootroot00000000000000/obj /ProducerBasic base-16.04/notification/cpp/samples/ProducerBasic/ProducerBasic.cc000066400000000000000000000161211272147170000251350ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include "CommonSampleUtil.h" #include #include #include #include using namespace qcc; using namespace ajn; // Set application constants #define DEVICE_NAME "testdeviceName" #define APP_NAME "testappName" #define LANG1 "en" #define TEXT1 "Hello World" #define LANG2 "es" #define TEXT2 "Hola Mundo" #define KEY1 "On" #define VAL1 "Hello" #define KEY2 "Off" #define VAL2 "Goodbye" #define URL1 "http://url1.com" #define URL2 "http://url2.com" #define RICH_ICON_URL "http://iconurl.com" #define CONTROL_PANEL_SERVICE_OBJECT_PATH "/ControlPanel/MyDevice/areYouSure" #define RICH_ICON_OBJECT_PATH "/icon/objectPath" #define RICH_AUDIO_OBJECT_PATH "/Audio/objectPath" #define SERVICE_PORT 900 using namespace ajn; using namespace services; NotificationService* prodService = 0; NotificationSender* Sender = 0; BusAttachment* bus = 0; AboutData* aboutData = NULL; AboutObj* aboutObj = NULL; CommonBusListener* busListener = 0; static volatile sig_atomic_t s_interrupt = false; void cleanup() { // Clean up if (prodService) { prodService->shutdown(); prodService = NULL; } if (bus && busListener) { CommonSampleUtil::aboutServiceDestroy(bus, busListener); } if (busListener) { delete busListener; busListener = NULL; } if (aboutData) { delete aboutData; aboutData = NULL; } if (aboutObj) { delete aboutObj; aboutObj = NULL; } if (bus) { delete bus; bus = NULL; } std::cout << "Goodbye!" << std::endl; } void CDECL_CALL signal_callback_handler(int32_t signum) { QCC_UNUSED(signum); std::cout << "got signal_callback_handler" << std::endl; s_interrupt = true; } void WaitForSigInt() { while (s_interrupt == false) { #ifdef _WIN32 Sleep(100); #else usleep(100 * 1000); #endif } } int main() { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } // Allow CTRL+C to end application signal(SIGINT, signal_callback_handler); // Initialize Service object and Sender Object prodService = NotificationService::getInstance(); QStatus status; QCC_SetDebugLevel(logModules::NOTIFICATION_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); bus = CommonSampleUtil::prepareBusAttachment(); if (bus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; return 1; } qcc::String deviceid; GuidUtil::GetInstance()->GetDeviceIdString(&deviceid); qcc::String appid; GuidUtil::GetInstance()->GenerateGUID(&appid); aboutData = new AboutData("en"); DeviceNamesType deviceNames; deviceNames.insert(std::pair("en", "ProducerBasicDeviceName")); status = CommonSampleUtil::fillAboutData(aboutData, appid, APP_NAME, deviceid, deviceNames); if (status != ER_OK) { std::cout << "Could not fill About Data." << std::endl; cleanup(); return 1; } busListener = new CommonBusListener(); aboutObj = new AboutObj(*bus, BusObject::ANNOUNCED); status = CommonSampleUtil::prepareAboutService(bus, aboutData, aboutObj, busListener, SERVICE_PORT); if (status != ER_OK) { std::cout << "Could not set up the AboutService." << std::endl; cleanup(); return 1; } Sender = prodService->initSend(bus, aboutData); if (!Sender) { std::cout << "Could not initialize Sender - exiting application" << std::endl; cleanup(); return 1; } status = CommonSampleUtil::aboutServiceAnnounce(); if (status != ER_OK) { std::cout << "Could not announce." << std::endl; cleanup(); return 1; } // Prepare message type NotificationMessageType messageType = INFO; // Prepare text object, set language and text, add notification to vector NotificationText textToSend1(LANG1, TEXT1); NotificationText textToSend2(LANG2, TEXT2); std::vector vecMessages; vecMessages.push_back(textToSend1); vecMessages.push_back(textToSend2); // Add variable parameters std::map customAttributes; customAttributes[KEY1] = VAL1; customAttributes[KEY2] = VAL2; //Prepare Rich Notification Content RichAudioUrl audio1(LANG1, URL1); RichAudioUrl audio2(LANG2, URL2); std::vector richAudioUrl; richAudioUrl.push_back(audio1); richAudioUrl.push_back(audio2); qcc::String richIconUrl = RICH_ICON_URL; qcc::String richIconObjectPath = RICH_ICON_OBJECT_PATH; qcc::String richAudioObjectPath = RICH_AUDIO_OBJECT_PATH; qcc::String controlPanelServiceObjectPath = CONTROL_PANEL_SERVICE_OBJECT_PATH; // Send messages Notification notification(messageType, vecMessages); notification.setCustomAttributes(customAttributes); notification.setRichIconUrl(richIconUrl.c_str()); notification.setRichAudioUrl(richAudioUrl); notification.setRichIconObjectPath(richIconObjectPath.c_str()); notification.setRichAudioObjectPath(richAudioObjectPath.c_str()); notification.setControlPanelServiceObjectPath(controlPanelServiceObjectPath.c_str()); status = Sender->send(notification, 7200); if (status != ER_OK) { std::cout << "Notification was not sent successfully - exiting application" << std::endl; cleanup(); return 1; } std::cout << "Notification sent! " << std::endl; std::cout << "Hit Ctrl+C to exit the application" << std::endl; WaitForSigInt(); std::cout << "Exiting the application and deleting the bus connection." << std::endl; cleanup(); return 0; } base-16.04/notification/cpp/samples/ProducerBasic/SConscript000066400000000000000000000016701272147170000241160ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) prog = env.Program('ProducerBasic', objs) Return('prog') base-16.04/notification/cpp/samples/ProducerService/000077500000000000000000000000001272147170000224575ustar00rootroot00000000000000base-16.04/notification/cpp/samples/ProducerService/.gitignore000066400000000000000000000000261272147170000244450ustar00rootroot00000000000000/obj /ProducerService base-16.04/notification/cpp/samples/ProducerService/ProducerService.cc000066400000000000000000000464251272147170000261050ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include "CommonSampleUtil.h" #include #include #include #include #include #define DEFAULT_DEVICE_NAME "defaultDeviceName" #define DEFAULT_APP_NAME "defaultAppName" #define DEFAULT_TTL 30 #define DEFAULT_SLEEP_TIME 20 #define SERVICE_PORT 900 using namespace ajn; using namespace services; using namespace qcc; NotificationService* prodService = 0; BusAttachment* bus = 0; CommonBusListener* notificationBusListener = 0; AboutData* aboutData = NULL; AboutObj* aboutObj = NULL; NotificationSender* Sender = 0; static volatile sig_atomic_t s_interrupt = false; enum states { BeginNewNotification, SetDeviceName, SetAppName, SetMsgType, CheckForNewMsg, SetMsgLang, SetMsgText, CheckForCustomAttributes, SetCustomKey, SetCustomVal, CheckForRichIconUrl, SetRichIconUrl, CheckForNewRichAudioUrl, SetRichAudioUrlLang, SetRichAudioUrlUrl, CheckForRichIconObjectPath, SetRichIconObjectPath, CheckForRichAudioObjectPath, SetRichAudioObjectPath, CheckForControlPanelServiceObjectPath, SetControlPanelServiceObjectPath, SetTTL, SetSleepTime, EndNotification, }; bool getInput(qcc::String& device_name, qcc::String& app_name, NotificationMessageType& messageType, std::vector& vecMessages, std::map& customAttributes, qcc::String& richIconUrl, std::vector& richAudioUrl, qcc::String& richIconObjectPath, qcc::String& richAudioObjectPath, qcc::String& controlPanelServiceObjectPath, uint16_t& ttl, int32_t& sleepTime) { int32_t state = BeginNewNotification; std::string input; qcc::String tempLang = ""; qcc::String tempText = ""; qcc::String tempUrl = ""; qcc::String tempKey; qcc::String defaultDeviceName = DEFAULT_DEVICE_NAME; qcc::String defaultAppName = DEFAULT_APP_NAME; qcc::String defaultLang = "en"; qcc::String defaultText = "Using the default text."; qcc::String defaultRichAudioUrl = "http://myRichContentAudioUrl.wv"; qcc::String defaultRichIconUrl = "http://myRichContentIconUrl.jpg"; uint16_t defaultTTL = DEFAULT_TTL; qcc::String defaultRichIconObjectPath = "/Icon/ObjectPath"; qcc::String defaultRichAudioObjectPath = "/Audio/ObjectPath"; qcc::String defaultControlPanelServiceObjectPath = "/ControlPanel/MyDevice/areYouSure"; std::cout << "Enter in new notification info:" << std::endl; std::cout << "Enter in device name or press 'enter' to use default:" << std::endl; state = SetDeviceName; getline(std::cin, input); while (!std::cin.eof()) { switch (state) { case SetDeviceName: device_name = input.length() ? input.c_str() : defaultDeviceName; std::cout << "Enter in application name or press 'enter' to use default:" << std::endl; state = SetAppName; break; case SetAppName: app_name = input.length() ? input.c_str() : defaultAppName; std::cout << "Enter in message type (0,1,2) or press 'enter' to use default:" << std::endl; state = SetMsgType; break; case SetMsgType: // If atoi fails message type will hold a 0 which is fine in this case messageType = input.length() ? (NotificationMessageType)atoi(input.c_str()) : NotificationMessageType(INFO); // We require to send at least one message std::cout << "Enter in message language (ex: en_US) or press 'enter' to use default and move to message text:" << std::endl; state = SetMsgLang; break; case CheckForNewMsg: if (input.compare("y") == 0) { std::cout << "Enter in message language (ex: en_US) or press 'enter' to use default and move to message text:" << std::endl; state = SetMsgLang; } else { std::cout << "Do you want to enter a set of custom Attributes? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForCustomAttributes; } break; case SetMsgLang: // Currently allowing an empty value for the language so no need to check the value tempLang = input.length() ? input.c_str() : defaultLang; std::cout << "Enter in message text or press 'enter' to use default and move on to custom Attributes:" << std::endl; state = SetMsgText; break; case SetMsgText: { tempText = input.length() ? input.c_str() : defaultText; // It is possible for both the language and text to be empty NotificationText textToSend(tempLang.c_str(), tempText.c_str()); vecMessages.push_back(textToSend); tempLang = ""; tempText = ""; std::cout << "Do you want to enter a new message? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForNewMsg; break; } case CheckForCustomAttributes: if (input.compare("y") == 0) { std::cout << "Enter in custom attribute key or press 'enter' to continue:" << std::endl; state = SetCustomKey; } else { std::cout << "Do you want to enter a rich content icon url? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForRichIconUrl; } break; case SetCustomKey: tempKey = input.c_str(); std::cout << "Enter in custom attribute value or press 'enter' to continue:" << std::endl; state = SetCustomVal; break; case SetCustomVal: customAttributes[tempKey] = input.c_str(); std::cout << "Do you want to enter another set of custom attributes? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForCustomAttributes; break; case CheckForRichIconUrl: if (input.compare("y") == 0) { std::cout << "Enter in a url for rich icon or press 'enter' to use default:" << std::endl; state = SetRichIconUrl; } else { std::cout << "Do you want to enter a rich content audio url? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForNewRichAudioUrl; } break; case SetRichIconUrl: richIconUrl = input.length() ? input.c_str() : defaultRichIconUrl; std::cout << "Do you want to enter a rich content audio url? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForNewRichAudioUrl; break; case CheckForNewRichAudioUrl: if (input.compare("y") == 0) { std::cout << "Enter in a language (ex: en_US) for the audio content or press 'enter' to use default and move to url text:" << std::endl; state = SetRichAudioUrlLang; } else { std::cout << "Do you want to enter a rich content icon object path? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForRichIconObjectPath; } break; case SetRichAudioUrlLang: // Currently allowing an empty value for the language so no need to check the value tempLang = input.length() ? input.c_str() : defaultLang; std::cout << "Enter in a url for audio content or press 'enter' to use default and move on to set ttl:" << std::endl; state = SetRichAudioUrlUrl; break; case SetRichAudioUrlUrl: { tempUrl = input.length() ? input.c_str() : defaultRichAudioUrl; // It is possible for both the language and text to be empty RichAudioUrl audioContent(tempLang.c_str(), tempUrl.c_str()); richAudioUrl.push_back(audioContent); tempLang = ""; tempText = ""; std::cout << "Do you want to enter another rich audio content? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForNewRichAudioUrl; break; } case CheckForRichIconObjectPath: if (input.compare("y") == 0) { std::cout << "Enter in a object path for rich icon or press 'enter' to use default:" << std::endl; state = SetRichIconObjectPath; } else { std::cout << "Do you want to enter a rich content audio object path? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForRichAudioObjectPath; } break; case SetRichIconObjectPath: richIconObjectPath = input.length() ? input.c_str() : defaultRichIconObjectPath; std::cout << "Do you want to enter a rich content audio object path? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForRichAudioObjectPath; break; case CheckForRichAudioObjectPath: if (input.compare("y") == 0) { std::cout << "Enter in a object path for rich audio or press 'enter' to use default:" << std::endl; state = SetRichAudioObjectPath; } else { std::cout << "Do you want to enter a control panel service object path? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForControlPanelServiceObjectPath; } break; case SetRichAudioObjectPath: richAudioObjectPath = input.length() ? input.c_str() : defaultRichAudioObjectPath; std::cout << "Do you want to enter a control panel service object path? (press 'y' for yes or anything else for no)" << std::endl; state = CheckForControlPanelServiceObjectPath; break; case CheckForControlPanelServiceObjectPath: if (input.compare("y") == 0) { std::cout << "Enter in the ControlPanelService object path or press 'enter' to use default:" << std::endl; state = SetControlPanelServiceObjectPath; } else { std::cout << "Enter in TTL of message in seconds or press 'enter' to use default:" << std::endl; state = SetTTL; } break; case SetControlPanelServiceObjectPath: controlPanelServiceObjectPath = input.length() ? input.c_str() : defaultControlPanelServiceObjectPath; std::cout << "Enter in TTL of message in seconds or press 'enter' to use default:" << std::endl; state = SetTTL; break; case SetTTL: if (input.length()) { ttl = atoi(input.c_str()); } else { ttl = defaultTTL; } std::cout << "Enter in sleep time between messages (in milliseconds) or press 'enter' to end notification:" << std::endl; state = SetSleepTime; break; case SetSleepTime: if (input.size() > 0) { sleepTime = (atoi(input.c_str()) / 1000); } else { sleepTime = 0; } return true; } getline(std::cin, input); } return false; } void cleanup() { if (prodService) { prodService->shutdown(); prodService = NULL; } if (Sender) { delete Sender; Sender = NULL; } if (bus && notificationBusListener) { CommonSampleUtil::aboutServiceDestroy(bus, notificationBusListener); } if (notificationBusListener) { delete notificationBusListener; notificationBusListener = NULL; } if (aboutData) { delete aboutData; aboutData = NULL; } if (aboutObj) { delete aboutObj; bus = NULL; } if (bus) { delete bus; bus = NULL; } std::cout << "Goodbye!" << std::endl; } void CDECL_CALL signal_callback_handler(int32_t signum) { QCC_UNUSED(signum); s_interrupt = true; } int main(int argc, char* argv[]) { // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } bool automated = (argc > 1); int count = automated ? atoi(argv[1]) : 1; if (count <= 0) { std::cout << "Usage: " << argv[0] << " [AutomatedMessageCount]" << std::endl; return 1; } notificationBusListener = new CommonBusListener(); aboutData = new AboutData("en"); // Allow CTRL+C to end application signal(SIGINT, signal_callback_handler); // Initialize Service object prodService = NotificationService::getInstance(); QCC_SetDebugLevel(logModules::NOTIFICATION_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); std::cout << "Begin Producer Application. (Press CTRL+D to end application)" << std::endl; bus = CommonSampleUtil::prepareBusAttachment(); if (bus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; cleanup(); return 1; } aboutObj = new AboutObj(*bus, AboutObj::ANNOUNCED); qcc::String device_id = "749df3c84b2e489cbd534cc8fd3fd5f4"; qcc::String app_id = "AC7a0787-d8b4-474f-a298-6bf0964f02d5"; if (!automated) { GuidUtil::GetInstance()->GetDeviceIdString(&device_id); GuidUtil::GetInstance()->GenerateGUID(&app_id); } //Run in loop unless ctrl+c has been hit while (s_interrupt == false) { qcc::String device_name = DEFAULT_DEVICE_NAME; qcc::String app_name = DEFAULT_APP_NAME; qcc::String richIconUrl = ""; qcc::String richIconObjectPath = ""; qcc::String richAudioObjectPath = ""; qcc::String controlPanelServiceObjectPath = ""; NotificationMessageType messageType = NotificationMessageType(INFO); std::vector vecMessages; std::map customAttributes; std::vector richAudioUrl; uint16_t ttl = DEFAULT_TTL; int32_t sleepTime = DEFAULT_SLEEP_TIME; QStatus status; if (!automated) { if (!getInput(device_name, app_name, messageType, vecMessages, customAttributes, richIconUrl, richAudioUrl, richIconObjectPath, richAudioObjectPath, controlPanelServiceObjectPath, ttl, sleepTime)) { break; } } else { NotificationText textToSend("en", "Default notification text"); vecMessages.push_back(textToSend); } DeviceNamesType deviceNames; deviceNames.insert(std::pair("en", device_name)); status = CommonSampleUtil::fillAboutData(aboutData, app_id, app_name, device_id, deviceNames); if (status != ER_OK) { std::cout << "Could not fill About Data." << std::endl; cleanup(); return 1; } status = CommonSampleUtil::prepareAboutService(bus, aboutData, aboutObj, notificationBusListener, SERVICE_PORT); if (status != ER_OK) { std::cout << "Could not set up the AboutService." << std::endl; cleanup(); return 1; } Sender = prodService->initSend(bus, aboutData); if (!Sender) { std::cout << "Could not initialize the sender" << std::endl; CommonSampleUtil::aboutServiceDestroy(bus, notificationBusListener); continue; } status = CommonSampleUtil::aboutServiceAnnounce(); if (status != ER_OK) { std::cout << "Could not announce." << std::endl; cleanup(); return 1; } for (int i = 0; i < count; i++) { if (i > 0) { #ifdef _WIN32 Sleep(sleepTime * 1000); #else sleep(sleepTime); #endif } Notification notification(messageType, vecMessages); notification.setCustomAttributes(customAttributes); notification.setRichAudioUrl(richAudioUrl); if (richIconUrl.length()) { notification.setRichIconUrl(richIconUrl.c_str()); } if (richIconObjectPath.length()) { notification.setRichIconObjectPath(richIconObjectPath.c_str()); } if (richAudioObjectPath.length()) { notification.setRichAudioObjectPath(richAudioObjectPath.c_str()); } if (controlPanelServiceObjectPath.length()) { notification.setControlPanelServiceObjectPath(controlPanelServiceObjectPath.c_str()); } if (Sender->send(notification, ttl) != ER_OK) { std::cout << "Could not send the message successfully" << std::endl; } else { std::cout << "Notification sent with ttl of " << ttl << std::endl; } } if (!automated) { std::string input; do { std::cout << "To delete the bus connection and start again please push 'c' character:" << std::endl; getline(std::cin, input); } while ((std::cin) && (input != "c")); } else { s_interrupt = true; } prodService->shutdownSender(); if (Sender) { std::cout << "Going to delete Sender" << std::endl; delete Sender; Sender = 0; } std::cout << "Going to call aboutServiceDestroy" << std::endl; CommonSampleUtil::aboutServiceDestroy(bus, notificationBusListener); std::cout << "Going to sleep:" << sleepTime << std::endl; #ifdef _WIN32 Sleep(sleepTime * 1000); #else sleep(sleepTime); #endif } std::cout << "Exiting the application deletes the bus connection." << std::endl; cleanup(); return 0; } base-16.04/notification/cpp/samples/ProducerService/SConscript000066400000000000000000000016721272147170000244770ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) prog = env.Program('ProducerService', objs) Return('prog') base-16.04/notification/cpp/samples/SConscript000066400000000000000000000032251272147170000213670ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('nsenv') samples_env = nsenv.Clone() samples_env.Append(CPPPATH = samples_env.Dir('common').srcnode()) samples_env.Append(CPPPATH = samples_env.Dir('$APP_COMMON_DIR/cpp/samples_common').srcnode()) samples_env.Prepend(LIBS = ['alljoyn_notification', 'alljoyn_about', 'alljoyn_services_common']) if samples_env['BR'] == 'on' and samples_env.has_key('ajrlib'): # Build apps with bundled daemon support samples_env.Prepend(LIBS = [samples_env['ajrlib']]) samples_env.Append(CPPDEFINES='QCC_USING_BD') cobjs = samples_env.SConscript('common/SConscript', {'env': samples_env}) sample_dirs = [ 'ConsumerService', 'ProducerBasic', 'ProducerService', 'TestService' ] exports = { 'env':samples_env, 'cobjs': cobjs } progs = [ samples_env.SConscript('%s/SConscript' % sampleapp, exports = exports) for sampleapp in sample_dirs ] Return('progs') base-16.04/notification/cpp/samples/TestService/000077500000000000000000000000001272147170000216135ustar00rootroot00000000000000base-16.04/notification/cpp/samples/TestService/.gitignore000066400000000000000000000000221272147170000235750ustar00rootroot00000000000000/obj /TestService base-16.04/notification/cpp/samples/TestService/SConscript000066400000000000000000000016661272147170000236360ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env', 'cobjs') srcs = env.Glob('*.cc') objs = env.Object(srcs) objs.extend(cobjs) prog = env.Program('TestService', objs) Return('prog') base-16.04/notification/cpp/samples/TestService/TestFunction.cc000066400000000000000000000045611272147170000245550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include "TestFunction.h" using namespace qcc; TestFunction::TestFunction() : activateTest(0) { } TestFunction::~TestFunction() { } bool TestFunction::checkRequiredParams(std::map& params) { if (requiredParams.size() == 0) { return true; } for (std::vector::const_iterator reqParams_it = requiredParams.begin(); reqParams_it != requiredParams.end(); ++reqParams_it) { if (params.find(*reqParams_it) == params.end()) { std::cout << "Missing required parameter " << reqParams_it->c_str() << std::endl; std::cout << usage.c_str() << std::endl; return false; } } return true; } void TestFunction::checkOptionalParams(std::map& params) { for (std::map::const_iterator params_it = params.begin(); params_it != params.end(); ++params_it) { if (find(optionalParams.begin(), optionalParams.end(), params_it->first) == optionalParams.end()) { if (find(requiredParams.begin(), requiredParams.end(), params_it->first) == requiredParams.end()) { // Element is NOT in either vector so let the user know std::cout << "Parameter " << params_it->first.c_str() << " is not a valid parameter for " << functionName.c_str() << ". Ignoring value" << std::endl; } } } } base-16.04/notification/cpp/samples/TestService/TestFunction.h000066400000000000000000000045211272147170000244130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef TESTFUNCTION_H_ #define TESTFUNCTION_H_ #include #include #include #include /** * TestFunction class used to represent on of the possible API calls * in the TestService application */ class TestFunction { public: /** * Constructor */ TestFunction(); /** * Destructor */ virtual ~TestFunction(); /** * Validate that required params were added * @param params * @return true/false */ bool checkRequiredParams(std::map& params); /** * Check the optional parameters * @param params */ void checkOptionalParams(std::map& params); /** * The name of the function */ qcc::String functionName; /** * The usage string */ qcc::String usage; /** * The required Parameters */ std::vector requiredParams; /** * The optional Parameters */ std::vector optionalParams; /** * Preconditions - steps that need to be taken before this API call */ std::vector requiredSteps; /** * functionPointer to function that will execute the API call * @param params * @return */ bool (*activateTest)(std::map& params); }; #endif /* TESTFUNCTION_H_ */ base-16.04/notification/cpp/samples/TestService/TestService.cc000066400000000000000000000623711272147170000243730ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include #include #include #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include "../common/NotificationReceiverTestImpl.h" #include "CommonSampleUtil.h" #include "TestFunction.h" #include #include #include #define SERVICE_PORT 900 using namespace ajn; using namespace services; using namespace qcc; // Global members NotificationService* Service = 0; NotificationSender* Sender = 0; NotificationReceiverTestImpl* Receiver = 0; BusAttachment* testBus = 0; AboutData* aboutData = 0; AboutObj* aboutObj = 0; CommonBusListener* notificationBusListener = 0; NotificationMessageType messageType = UNSET; std::vector vecMessages; std::vector richAudioUrl; qcc::String richIconUrl = ""; qcc::String richIconObjectPath = ""; qcc::String richAudioObjectPath = ""; qcc::String controlPanelServiceObjectPath = ""; std::map customAttributes; bool didInitSend = false; bool didInitReceive = false; uint16_t ttl = 0; int32_t sleepTime; static volatile sig_atomic_t s_interrupt = false; void resetParams() { customAttributes.clear(); vecMessages.clear(); richAudioUrl.clear(); richIconUrl = ""; richIconObjectPath = ""; richAudioObjectPath = ""; controlPanelServiceObjectPath = ""; ttl = 0; messageType = UNSET; } /* * Begin Function functions */ bool createService(std::map& params) { QCC_UNUSED(params); // Initialize Service object and sent it Notification Receiver object if (!testBus) { testBus = CommonSampleUtil::prepareBusAttachment(); if (testBus == NULL) { std::cout << "Could not initialize BusAttachment." << std::endl; return 1; } } Service = NotificationService::getInstance(); std::cout << "Service Created" << std::endl; return true; } bool initSend(std::map& params) { if (!notificationBusListener) { notificationBusListener = new CommonBusListener(); } if (!aboutData) { aboutData = new AboutData("en"); } if (!aboutObj) { aboutObj = new AboutObj(*testBus, BusObject::ANNOUNCED); } qcc::String deviceid; GuidUtil::GetInstance()->GetDeviceIdString(&deviceid); qcc::String appid; GuidUtil::GetInstance()->GenerateGUID(&appid); DeviceNamesType deviceNames; deviceNames.insert(std::pair("en", params["device_name"])); QStatus status; status = CommonSampleUtil::fillAboutData(aboutData, appid, params["app_name"].c_str(), deviceid, deviceNames); if (status != ER_OK) { std::cout << "Could not fill About Data." << std::endl; return false; } status = CommonSampleUtil::prepareAboutService(testBus, aboutData, aboutObj, notificationBusListener, SERVICE_PORT); if (status != ER_OK) { std::cout << "Could not set up the AboutService." << std::endl; return false; } Sender = Service->initSend(testBus, aboutData); if (!Sender) { std::cout << "Could not initialize the sender"; return false; } status = CommonSampleUtil::aboutServiceAnnounce(); if (status != ER_OK) { std::cout << "Could not announce." << std::endl; return 1; } didInitSend = true; std::cout << "Sender Initialized" << std::endl; return true; } bool send(std::map& params) { int32_t type = atoi(params["type"].c_str()); std::ostringstream oss; oss << type; String typeString = oss.str().c_str(); if (!(params["type"].compare(typeString) == 0)) { std::cout << "Could not send message: Message Type is not an integer value." << std::endl; return false; } messageType = (NotificationMessageType)atoi(params["type"].c_str()); ttl = ((uint16_t)atoi(params["ttl"].c_str())); Notification notification(messageType, vecMessages); notification.setCustomAttributes(customAttributes); notification.setRichAudioUrl(richAudioUrl); if (richIconUrl.length()) { notification.setRichIconUrl(richIconUrl.c_str()); } if (richIconObjectPath.length()) { notification.setRichIconObjectPath(richIconObjectPath.c_str()); } if (richAudioObjectPath.length()) { notification.setRichAudioObjectPath(richAudioObjectPath.c_str()); } if (controlPanelServiceObjectPath.length()) { notification.setControlPanelServiceObjectPath(controlPanelServiceObjectPath.c_str()); } QStatus status = Sender->send(notification, ttl); if (status != ER_OK) { std::cout << "Could not send the message successfully."; return false; } std::cout << "Notification Sent for message type " << messageType << " and ttl of " << ttl << " seconds" << std::endl; resetParams(); return true; } bool setMsg(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here NotificationText textToSend(params["lang"].c_str(), params["text"].c_str()); vecMessages.push_back(textToSend); std::cout << "Message " << params["text"].c_str() << " set." << std::endl; return true; } bool setCustomAttributes(std::map& params) { // Empty qcc::Strings are valid input, only check format was correct customAttributes[params["key"].c_str()] = params["value"].c_str(); std::cout << "Set custom pair " << params["key"].c_str() << " : " << params["value"].c_str() << std::endl; return true; } bool setLogger(std::map& params) { QCC_UNUSED(params); QCC_SetDebugLevel(logModules::NOTIFICATION_MODULE_LOG_NAME, logModules::ALL_LOG_LEVELS); return true; } bool initReceive(std::map& params) { QCC_UNUSED(params); Receiver = new NotificationReceiverTestImpl(); if (Service->initReceive(testBus, Receiver) != ER_OK) { std::cout << "Could not initialize receiver." << std::endl; return false; } didInitReceive = true; std::cout << "Receiver Initialized" << std::endl; return true; } bool ResponseToNotification(std::map& params) { QCC_UNUSED(params); NotificationReceiverTestImpl::NotificationAction action = ((NotificationReceiverTestImpl::NotificationAction)atoi(params["action"].c_str())); Receiver->SetNotificationAction(action); return true; } bool setRichIconUrl(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here richIconUrl = params["url"]; std::cout << "Icon Url " << params["url"].c_str() << " set." << std::endl; return true; } bool setRichAudioUrl(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here RichAudioUrl audioContent(params["lang"].c_str(), params["url"].c_str()); richAudioUrl.push_back(audioContent); std::cout << "Audio Content " << params["url"].c_str() << " set." << std::endl; return true; } bool setRichIconObjectPath(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here richIconObjectPath = params["path"]; std::cout << "Icon Object Path " << params["path"].c_str() << " set." << std::endl; return true; } bool setRichAudioObjectPath(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here richAudioObjectPath = params["path"]; std::cout << "Icon Object Path " << params["path"].c_str() << " set." << std::endl; return true; } bool setControlPanelServiceObjectPath(std::map& params) { // Empty qcc::Strings are valid input so we will not check it here controlPanelServiceObjectPath = params["path"]; std::cout << "ControlPanelService Object Path " << params["path"].c_str() << " set." << std::endl; return true; } bool shutdownSender(std::map& params) { QCC_UNUSED(params); didInitSend = false; CommonSampleUtil::aboutServiceDestroy(testBus, notificationBusListener); Service->shutdownSender(); std::cout << "service sender stopped" << std::endl; return true; } bool shutdown(std::map& params) { QCC_UNUSED(params); // clean up CommonSampleUtil::aboutServiceDestroy(testBus, notificationBusListener); if (notificationBusListener) { delete notificationBusListener; notificationBusListener = 0; } if (aboutData) { delete aboutData; aboutData = 0; } if (aboutObj) { delete aboutObj; aboutObj = NULL; } if (Service) { Service->shutdown(); Service = 0; } if (Receiver) { delete Receiver; Receiver = 0; } if (testBus) { delete testBus; testBus = 0; } didInitSend = false; didInitReceive = false; resetParams(); std::cout << "Service Shutdown!" << std::endl; return true; } bool shutdownReceiver(std::map& params) { QCC_UNUSED(params); didInitReceive = false; Service->shutdownReceiver(); std::cout << "service receiver stopped" << std::endl; return true; } bool deleteLastMsg(std::map& params) { NotificationMessageType deleteMessageType = (NotificationMessageType)atoi(params["type"].c_str()); QStatus status = Sender->deleteLastMsg(deleteMessageType); if (status != ER_OK) { std::cout << "Could not delete the message successfully" << std::endl; return false; } std::cout << "Deleted last message of type " << params["type"].c_str() << std::endl; return true; } bool clearParams(std::map& params) { QCC_UNUSED(params); std::cout << "Clearing out message data. " << std::endl; resetParams(); return true; } /* * Begin Utility Functions */ #define NUM_OF_FUNCTIONS 19 void checkNumFunctions(int32_t*i) { if (*i == NUM_OF_FUNCTIONS) { std::cout << "Max number of functions < " << NUM_OF_FUNCTIONS << "> reached. Exiting application due to error." << std::endl; exit(0); } } void createListOfFunctions(TestFunction*testFunctions) { int32_t i = 0; // createService testFunctions[i].functionName = "createservice"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = createService; i++; checkNumFunctions(&i); // initSend testFunctions[i].functionName = "initsend"; testFunctions[i].usage = testFunctions[i].functionName + " device_name=&app_name="; testFunctions[i].activateTest = initSend; testFunctions[i].requiredParams.push_back("device_name"); testFunctions[i].requiredParams.push_back("app_name"); testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // send testFunctions[i].functionName = "send"; testFunctions[i].usage = testFunctions[i].functionName + " type=<0,1,2>&ttl="; testFunctions[i].activateTest = send; testFunctions[i].requiredParams.push_back("type"); testFunctions[i].requiredParams.push_back("ttl"); testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredSteps.push_back("messageType"); testFunctions[i].requiredSteps.push_back("vecMessages"); i++; checkNumFunctions(&i); // setMsg testFunctions[i].functionName = "setmsg"; testFunctions[i].usage = testFunctions[i].functionName + " text=&lang="; testFunctions[i].activateTest = setMsg; testFunctions[i].requiredParams.push_back("text"); testFunctions[i].requiredParams.push_back("lang"); i++; checkNumFunctions(&i); // setCustomAttributes testFunctions[i].functionName = "setcustomattributes"; testFunctions[i].usage = testFunctions[i].functionName + " key=&value="; testFunctions[i].activateTest = setCustomAttributes; testFunctions[i].requiredParams.push_back("key"); testFunctions[i].requiredParams.push_back("value"); i++; checkNumFunctions(&i); // setLogger testFunctions[i].functionName = "setlogger"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = setLogger; testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // initReceive testFunctions[i].functionName = "initreceive"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = initReceive; testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // ResponseToNotification testFunctions[i].functionName = "responsetonotification"; testFunctions[i].usage = testFunctions[i].functionName + " action=<0-Nothing,1-Dismiss>"; testFunctions[i].activateTest = ResponseToNotification; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Receiver"); testFunctions[i].requiredParams.push_back("action"); i++; checkNumFunctions(&i); // shutdown testFunctions[i].functionName = "shutdown"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = shutdown; testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // shutdownSender testFunctions[i].functionName = "shutdownsender"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = shutdownSender; testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // shutdownReceiver testFunctions[i].functionName = "shutdownreceiver"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = shutdownReceiver; testFunctions[i].requiredSteps.push_back("Service"); i++; checkNumFunctions(&i); // deletelastmsg testFunctions[i].functionName = "deletelastmsg"; testFunctions[i].usage = testFunctions[i].functionName + " type=<0,1,2>"; testFunctions[i].activateTest = deleteLastMsg; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("type"); i++; checkNumFunctions(&i); // clearParams testFunctions[i].functionName = "clearparams"; testFunctions[i].usage = testFunctions[i].functionName; testFunctions[i].activateTest = clearParams; i++; checkNumFunctions(&i); // setRichIconUrl testFunctions[i].functionName = "setrichiconurl"; testFunctions[i].usage = testFunctions[i].functionName + " url="; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("url"); testFunctions[i].activateTest = setRichIconUrl; i++; checkNumFunctions(&i); // setRichAudioUrl testFunctions[i].functionName = "setrichaudiourl"; testFunctions[i].usage = testFunctions[i].functionName + " url=&lang="; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("lang"); testFunctions[i].requiredParams.push_back("url"); testFunctions[i].activateTest = setRichAudioUrl; i++; checkNumFunctions(&i); // setRichIconObjectPath testFunctions[i].functionName = "setrichiconobjectpath"; testFunctions[i].usage = testFunctions[i].functionName + " path="; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("path"); testFunctions[i].activateTest = setRichIconObjectPath; i++; checkNumFunctions(&i); // setRichAudioObjectPath testFunctions[i].functionName = "setrichaudioobjectpath"; testFunctions[i].usage = testFunctions[i].functionName + " path="; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("path"); testFunctions[i].activateTest = setRichAudioObjectPath; i++; checkNumFunctions(&i); // setcontrolpanelserviceobjectpath testFunctions[i].functionName = "setcontrolpanelserviceobjectpath"; testFunctions[i].usage = testFunctions[i].functionName + " path="; testFunctions[i].requiredSteps.push_back("Service"); testFunctions[i].requiredSteps.push_back("Sender"); testFunctions[i].requiredParams.push_back("path"); testFunctions[i].activateTest = setControlPanelServiceObjectPath; } bool functionExists(qcc::String& funcName, TestFunction*testFunctions, int32_t*functionIndex) { for (int32_t i = 0; i < NUM_OF_FUNCTIONS; i++) { if (((testFunctions[i].functionName).compare(funcName)) == 0) { *functionIndex = i; return true; } } std::cout << "functionExists - ERROR - not found funcName:" << funcName.c_str() << std::endl; return false; } void Usage(TestFunction*testFunctions, qcc::String funcName = "", int32_t*functionIndex = 0) { if (funcName.size() > 0) { if (functionExists(funcName, testFunctions, functionIndex)) { std::cout << testFunctions[*functionIndex].usage.c_str() << std::endl; return; } } std::cout << "FUNCTION USAGE-------------------------------------FUNCTION USAGE" << std::endl; std::cout << "function name param=value¶m=value" << std::endl << std::endl; std::cout << "Add -h after any function name to print out the function usage." << std::endl << std::endl; std::cout << "Press 'enter' at any time to receive this help message again." << std::endl << std::endl; std::cout << "Available functions are:\n" << std::endl; for (int32_t i = 0; i < NUM_OF_FUNCTIONS; i++) { std::cout << testFunctions[i].functionName.c_str() << std::endl; } return; } void CDECL_CALL signal_callback_handler(int32_t signum) { QCC_UNUSED(signum); s_interrupt = true; } bool checkRequiredSteps(TestFunction& test, TestFunction*testFunctions, int32_t*functionIndex) { std::vector reqSteps = test.requiredSteps; for (std::vector::const_iterator reqSteps_it = reqSteps.begin(); reqSteps_it != reqSteps.end(); ++reqSteps_it) { if ((reqSteps_it->compare("Service") == 0) && (!Service)) { std::cout << "Action not allowed. Cannot run '" << test.functionName.c_str() << "' without creating a service first (createservice)" << std::endl; return false; } else if ((reqSteps_it->compare("Sender") == 0) && (!didInitSend)) { std::cout << "Action not allowed. Cannot run '" << test.functionName.c_str() << "' without initializing a sender." << std::endl; qcc::String preReqApi = "initsend"; if (functionExists(preReqApi, testFunctions, functionIndex)) { Usage(testFunctions, preReqApi, functionIndex); } return false; } else if ((reqSteps_it->compare("Receiver") == 0) && (!didInitReceive)) { std::cout << "Action not allowed. Cannot run '" << test.functionName.c_str() << "' without initializing a receiver." << std::endl; qcc::String preReqApi = "initreceive"; if (functionExists(preReqApi, testFunctions, functionIndex)) { Usage(testFunctions, preReqApi, functionIndex); } return false; } else if ((reqSteps_it->compare("vecMessages") == 0) && (!vecMessages.size())) { std::cout << "Cannot send message. Missing mandatory parameter message text." << std::endl; qcc::String preReqApi = "setmsg"; if (functionExists(preReqApi, testFunctions, functionIndex)) { Usage(testFunctions, preReqApi, functionIndex); } return false; } } return true; } void trim(qcc::String& str, const qcc::String& whitespace = " ") { if (str.size() > 0) { size_t strBegin = str.find_first_not_of(whitespace.c_str()); if (strBegin == qcc::String::npos) { str = ""; // no content return; } unsigned strEnd = str.find_last_not_of(whitespace.c_str()); if (strEnd == strBegin) { std::cout << "no content" << std::endl; str = ""; // no content return; } unsigned strRange = strEnd - strBegin + 1; str = str.substr(strBegin, strRange); } } bool processInput(const qcc::String& input, qcc::String& funcName, std::map& params, TestFunction*testFunctions, int32_t*functionIndex) { // Check first if the user pressed enter. if (!input.size()) { return false; } unsigned spacePos = input.find(" "); funcName = input.substr(0, spacePos).c_str(); if (!funcName.size()) { std::cout << "Incorrect input format. Please check usage format" << std::endl; return false; } // Make FUNCTION name lower case std::transform(funcName.begin(), funcName.end(), funcName.begin(), ::tolower); if (!functionExists(funcName, testFunctions, functionIndex)) { std::cout << "Incorrect Function name. Please check usage format" << std::endl; return false; } // Check if the function was sent in with a help command // This covers -h, --h, -help and --help if (input.find(" -h") != qcc::String::npos) { // Help requested return false; } // Now parse the parameters sent in and put them into a std::map qcc::String paramString = input.substr(spacePos + 1).c_str(); if (input.size() == paramString.size()) { // no parameters sent in so return early return true; } trim(paramString, " "); std::stringstream iss(paramString.c_str()); std::string singleParam; while (getline(iss, singleParam, '&')) { size_t equalPos = singleParam.find("="); if (equalPos == qcc::String::npos) { std::cout << "Parameters were not entered in the correct format. Please check usage format." << std::endl; Usage(testFunctions); return false; } params[singleParam.substr(0, equalPos).c_str()] = singleParam.substr(equalPos + 1).c_str(); } return true; } int main(int argc, char* argv[]) { QCC_UNUSED(argv); // Initialize AllJoyn AJInitializer ajInit; if (ajInit.Initialize() != ER_OK) { return 1; } std::cout << "Beginning TestService Application. (Press CTRL+C and Enter to end application)" << std::endl; TestFunction testFunctions[NUM_OF_FUNCTIONS]; createListOfFunctions(testFunctions); Usage(testFunctions); if (argc > 1) { return 0; } // Allow CTRL+C to end application signal(SIGINT, signal_callback_handler); while (!s_interrupt) { std::cout << "> "; std::string input; qcc::String funcName; std::map params; int32_t functionIndex; getline(std::cin, input); if (processInput(input.c_str(), funcName, params, testFunctions, &functionIndex)) { if (((testFunctions[functionIndex].functionName).compare(funcName)) == 0) { if (checkRequiredSteps(testFunctions[functionIndex], testFunctions, &functionIndex)) { if (testFunctions[functionIndex].checkRequiredParams(params)) { testFunctions[functionIndex].checkOptionalParams(params); testFunctions[functionIndex].activateTest(params); } } } } else if (!s_interrupt) { Usage(testFunctions, funcName, &functionIndex); } } std::map params; // clean up shutdown(params); std::cout << "Goodbye!" << std::endl; return 0; } base-16.04/notification/cpp/samples/common/000077500000000000000000000000001272147170000206435ustar00rootroot00000000000000base-16.04/notification/cpp/samples/common/.gitignore000066400000000000000000000000151272147170000226270ustar00rootroot00000000000000/obj /obj_sl base-16.04/notification/cpp/samples/common/NotificationReceiverTestImpl.cc000066400000000000000000000216401272147170000267520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "NotificationReceiverTestImpl.h" #include #include #include #include #include #include #ifdef _WIN32 #include #endif using namespace ajn; using namespace services; using namespace qcc; NotificationReceiverTestImpl::NotificationReceiverTestImpl(bool waitForExternalNotificationAction) : m_NotificationAction(ACTION_NOTHING), m_WaitForExternalNotificationAction(waitForExternalNotificationAction) { if (m_WaitForExternalNotificationAction) { #ifdef _WIN32 InitializeCriticalSection(&m_Lock); InitializeConditionVariable(&m_Condition); #else pthread_mutex_init(&m_Lock, NULL); pthread_cond_init(&m_Condition, NULL); #endif } } NotificationReceiverTestImpl::~NotificationReceiverTestImpl() { if (m_WaitForExternalNotificationAction) { #ifdef _WIN32 EnterCriticalSection(&m_Lock); WakeConditionVariable(&m_Condition); LeaveCriticalSection(&m_Lock); DeleteCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); pthread_cond_signal(&m_Condition); pthread_mutex_unlock(&m_Lock); pthread_cond_destroy(&m_Condition); pthread_mutex_destroy(&m_Lock); #endif } } void NotificationReceiverTestImpl::Receive(Notification const& notification) { qcc::String appName = notification.getAppName(); // If applications list is empty or the name exists in the filter list then print the notification if ((m_Applications.size() == 0) || (find(m_Applications.begin(), m_Applications.end(), appName) != m_Applications.end())) { std::cout << "******************** Begin New Message Received ********************" << std::endl; std::cout << "Message Id: " << notification.getMessageId() << std::endl; std::cout << "Device Id: " << notification.getDeviceId() << std::endl; std::cout << "Device Name: " << notification.getDeviceName() << std::endl; std::cout << "App Id: " << notification.getAppId() << std::endl; std::cout << "App Name: " << notification.getAppName() << std::endl; std::cout << "Sender BusName: " << notification.getSenderBusName() << std::endl; std::cout << "Message Type " << notification.getMessageType() << " " << MessageTypeUtil::getMessageTypeString(notification.getMessageType()).c_str() << std::endl; std::cout << "Notification version: " << notification.getVersion() << std::endl; // get vector of text messages and iterate through it std::vector vecMessages = notification.getText(); for (std::vector::const_iterator vecMessage_it = vecMessages.begin(); vecMessage_it != vecMessages.end(); ++vecMessage_it) { std::cout << "Language: " << vecMessage_it->getLanguage().c_str() << " Message: " << vecMessage_it->getText().c_str() << std::endl; } // Print out any other parameters sent in std::cout << "Other parameters included:" << std::endl; std::map customAttributes = notification.getCustomAttributes(); for (std::map::const_iterator customAttributes_it = customAttributes.begin(); customAttributes_it != customAttributes.end(); ++customAttributes_it) { std::cout << "Custom Attribute Key: " << customAttributes_it->first.c_str() << " Custom Attribute Value: " << customAttributes_it->second.c_str() << std::endl; } if (notification.getRichIconUrl()) { std::cout << "Rich Content Icon Url: " << notification.getRichIconUrl() << std::endl; } // get vector of audio content and iterate through it std::vector richAudioUrl = notification.getRichAudioUrl(); if (!richAudioUrl.empty()) { std::cout << "******************** Begin Rich Audio Content ********************" << std::endl; for (std::vector::const_iterator vecAudio_it = richAudioUrl.begin(); vecAudio_it != richAudioUrl.end(); ++vecAudio_it) { std::cout << "Language: " << vecAudio_it->getLanguage().c_str() << " Audio Url: " << vecAudio_it->getUrl().c_str() << std::endl; } std::cout << "******************** End Rich Audio Content ********************" << std::endl; } if (notification.getRichIconObjectPath()) { std::cout << "Rich Content Icon Object Path: " << notification.getRichIconObjectPath() << std::endl; } if (notification.getRichAudioObjectPath()) { std::cout << "Rich Content Audio Object Path: " << notification.getRichAudioObjectPath() << std::endl; } if (notification.getControlPanelServiceObjectPath()) { std::cout << "ControlPanelService object path: " << notification.getControlPanelServiceObjectPath() << std::endl; } if (notification.getOriginalSender()) { std::cout << "OriginalSender: " << notification.getOriginalSender() << std::endl; } std::cout << "******************** End New Message Received ********************" << std::endl << std::endl; Notification nonConstNotification(notification); if (m_WaitForExternalNotificationAction) { #ifdef _WIN32 EnterCriticalSection(&m_Lock); SleepConditionVariableCS(&m_Condition, &m_Lock, INFINITE); #else pthread_mutex_lock(&m_Lock); pthread_cond_wait(&m_Condition, &m_Lock); #endif } else { std::cout << "Notification action (0-Nothing 1-Dismiss):" << std::endl; int32_t notificationAction(ACTION_NOTHING); int retScan = scanf("%d", ¬ificationAction); if (retScan != EOF) { m_NotificationAction = static_cast(notificationAction); } } switch (GetNotificationAction()) { case ACTION_NOTHING: std::cout << "Nothing planed to do with the notification message id:" << nonConstNotification.getMessageId() << std::endl; break; case ACTION_DISMISS: { std::cout << "going to call dismiss for message id:" << nonConstNotification.getMessageId() << std::endl; nonConstNotification.dismiss(); } break; default: std::cout << "Got non valid action to do:" << GetNotificationAction() << std::endl; break; } ; if (m_WaitForExternalNotificationAction) { #ifdef _WIN32 LeaveCriticalSection(&m_Lock); #else pthread_mutex_unlock(&m_Lock); #endif } } std::cout << "End handling notification!!!" << std::endl; } void NotificationReceiverTestImpl::setApplications(qcc::String const& listOfApps) { std::istringstream iss(listOfApps.c_str()); std::string singleAppName; while (std::getline(iss, singleAppName, ';')) { m_Applications.push_back(singleAppName.c_str()); } } void NotificationReceiverTestImpl::Dismiss(const int32_t msgId, const qcc::String appId) { std::cout << "Got NotificationReceiverTestImpl::Dismiss with msgId=" << msgId << " appId=" << appId.c_str() << std::endl; } NotificationReceiverTestImpl::NotificationAction NotificationReceiverTestImpl::GetNotificationAction() { return m_NotificationAction; } void NotificationReceiverTestImpl::SetNotificationAction(NotificationReceiverTestImpl::NotificationAction notificationAction) { if (m_WaitForExternalNotificationAction) { #ifdef _WIN32 EnterCriticalSection(&m_Lock); m_NotificationAction = notificationAction; WakeConditionVariable(&m_Condition); LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); m_NotificationAction = notificationAction; pthread_cond_signal(&m_Condition); pthread_mutex_unlock(&m_Lock); #endif } } base-16.04/notification/cpp/samples/common/NotificationReceiverTestImpl.h000066400000000000000000000075561272147170000266260ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONRECEIVERTESTIMPL_H_ #define NOTIFICATIONRECEIVERTESTIMPL_H_ #include #include #include #ifdef _WIN32 #include #define pthread_mutex_t CRITICAL_SECTION #define pthread_cond_t CONDITION_VARIABLE #else #include #endif /** * Class that will receive Notifications. Implements NotificationReceiver * Receives list of applications to filter by and will only display notifications * from those applications */ class NotificationReceiverTestImpl : public ajn::services::NotificationReceiver { public: enum NotificationAction { ACTION_NOTHING, ACTION_DISMISS }; /** * Constructor * @param wait to external notification action */ NotificationReceiverTestImpl(bool waitForExternalNotificationAction = true); /** * Destructor */ ~NotificationReceiverTestImpl(); /** * Receive - function that receives a notification * @param notification */ void Receive(ajn::services::Notification const& notification); /** * receive a list of applications to filter by and set the filter * @param listOfApps */ void setApplications(qcc::String const& listOfApps); /** * receive Dismiss signal * @param message id * @param application id */ void Dismiss(const int32_t msgId, const qcc::String appId); /** * Get notification action * @return NotificationAction */ NotificationAction GetNotificationAction(); /** * Set notification action * This method is called from a free thread to set an action and to release the blocked thread (At NotificationReceiverTestImpl::Receive(...)), * that received the notification and waiting to the action decision. * @param NotificationAction */ void SetNotificationAction(NotificationAction notificationAction); private: /** * vector of applications to filter by */ std::vector m_Applications; /** * action to do after getting notification */ NotificationAction m_NotificationAction; /** * locks for the condition according to 'pthread_cond_t' declaration. */ pthread_mutex_t m_Lock; /** * thread condition * Blocking the notification receiving thread in case m_WaitForExternalNotificationAction is true, until SetNotificationAction() will be called. */ pthread_cond_t m_Condition; /** * Wait to external notification action * If true - external thread will need to call to SetNotificationAction() to unblock the thread that received the notification. * If false - a normal standard input will block the thread that received the notification until the user will decide what to do with the notification. */ bool m_WaitForExternalNotificationAction; }; #endif /* NOTIFICATIONRECEIVERTESTIMPL_H_ */ base-16.04/notification/cpp/samples/common/SConscript000066400000000000000000000020421272147170000226530ustar00rootroot00000000000000# Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Import('env') import os srcs = env.Glob('*.cc') objs = env.Object(srcs) env.VariantDir('AppCommon', '$APP_COMMON_DIR/cpp/samples_common/', duplicate = 0) cobjs = env.SConscript('AppCommon/SConscript', {'env': env}) objs.extend(cobjs) Return('objs') base-16.04/notification/cpp/src/000077500000000000000000000000001272147170000164765ustar00rootroot00000000000000base-16.04/notification/cpp/src/.gitignore000066400000000000000000000000401272147170000204600ustar00rootroot00000000000000/obj /libnotificationService.so base-16.04/notification/cpp/src/Notification.cc000066400000000000000000000306721272147170000214430ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "Transport.h" #include "NotificationConstants.h" #include #include #include #include #include #include using namespace ajn; using namespace services; using namespace qcc; NotificationAsyncTaskEvents Notification::m_NotificationAsyncTaskEvents; AsyncTaskQueue Notification::m_AsyncTaskQueue(&Notification::m_NotificationAsyncTaskEvents); /* * Checks if a valid AllJoyn Object path has been specified in str. * Please note that this function is same as ajn::BusUtil::IsLegalObjectPath() * but since this is not exposed to external applications, this function is * being added here */ static bool IsLegalObjectPath(const char* str) { if (!str) { return false; } /* Must begin with slash */ char c = *str++; if (c != '/') { return false; } while ((c = *str++) != 0) { if ((!(qcc::IsAlphaNumeric(c))) && (c != '_')) { if ((c != '/') || (*str == '/') || (*str == 0)) { return false; } } } return true; } Notification::Notification(int32_t messageId, NotificationMessageType messageType, const char* deviceId, const char* deviceName, const char* appId, const char* appName, const char* sender, std::map const& customAttributes, std::vector const& notificationText, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender) : m_MessageId(messageId), m_Sender(0), m_MessageType(messageType), m_DeviceId(0), m_DeviceName(0), m_AppId(0), m_AppName(0), m_CustomAttributes(customAttributes), m_Text(notificationText), m_RichIconUrl(0), m_RichAudioUrl(richAudioUrl), m_RichIconObjectPath(0), m_RichAudioObjectPath(0), m_ControlPanelServiceObjectPath(0), m_OriginalSender(0) { setDeviceId(deviceId); setDeviceName(deviceName); setAppId(appId); setAppName(appName); setSender(sender); setRichIconUrl(richIconUrl); setRichIconObjectPath(richIconObjectPath); setRichAudioObjectPath(richAudioObjectPath); setControlPanelServiceObjectPath(controlPanelServiceObjectPath); setOriginalSender(originalSender); } Notification::Notification(NotificationMessageType messageType, std::vector const& notificationText) : m_MessageId(-1), m_Sender(0), m_MessageType(messageType), m_DeviceId(0), m_DeviceName(0), m_AppId(0), m_AppName(0), m_Text(notificationText), m_RichIconUrl(0), m_RichIconObjectPath(0), m_RichAudioObjectPath(0), m_ControlPanelServiceObjectPath(0), m_OriginalSender(0) { } Notification::Notification(const Notification& notification) { m_Sender = NULL; m_DeviceId = NULL; m_DeviceName = NULL; m_AppId = NULL; m_AppName = NULL; m_RichIconUrl = NULL; m_RichIconObjectPath = NULL; m_RichAudioObjectPath = NULL; m_ControlPanelServiceObjectPath = NULL; m_OriginalSender = NULL; setDeviceId(notification.getDeviceId()); setDeviceName(notification.getDeviceName()); setAppId(notification.getAppId()); setAppName(notification.getAppName()); setSender(notification.getSenderBusName()); setRichIconUrl(notification.getRichIconUrl()); setRichIconObjectPath(notification.getRichIconObjectPath()); setRichAudioObjectPath(notification.getRichAudioObjectPath()); setControlPanelServiceObjectPath(notification.getControlPanelServiceObjectPath()); setOriginalSender(notification.getOriginalSender()); m_CustomAttributes = notification.m_CustomAttributes; m_MessageId = notification.m_MessageId; m_MessageType = notification.m_MessageType; m_Text = notification.m_Text; m_RichAudioUrl = notification.m_RichAudioUrl; } Notification::~Notification() { delete m_Sender; m_Sender = NULL; delete m_DeviceId; m_DeviceId = NULL; delete m_DeviceName; m_DeviceName = NULL; delete m_AppId; m_AppId = NULL; delete m_AppName; m_AppName = NULL; delete m_RichIconUrl; m_RichIconUrl = NULL; delete m_RichIconObjectPath; m_RichIconObjectPath = NULL; delete m_RichAudioObjectPath; m_RichAudioObjectPath = NULL; delete m_ControlPanelServiceObjectPath; m_ControlPanelServiceObjectPath = NULL; delete m_OriginalSender; m_OriginalSender = NULL; } const uint16_t Notification::getVersion() const { return NotificationService::getVersion(); } const char* Notification::getDeviceId() const { if (m_DeviceId == NULL) { return NULL; } return m_DeviceId->c_str(); } const char* Notification::getDeviceName() const { if (m_DeviceName == NULL) { return NULL; } return m_DeviceName->c_str(); } const char* Notification::getAppId() const { if (m_AppId == NULL) { return NULL; } return m_AppId->c_str(); } const char* Notification::getAppName() const { if (m_AppName == NULL) { return NULL; } return m_AppName->c_str(); } const std::map& Notification::getCustomAttributes() const { return m_CustomAttributes; } const int32_t Notification::getMessageId() const { return m_MessageId; } const std::vector& Notification::getText() const { return m_Text; } const char* Notification::getSenderBusName() const { if (m_Sender == NULL) { return NULL; } return m_Sender->c_str(); } const NotificationMessageType Notification::getMessageType() const { return m_MessageType; } const char* Notification::getRichIconUrl() const { if (m_RichIconUrl == NULL) { return NULL; } return m_RichIconUrl->c_str(); } const char* Notification::getRichIconObjectPath() const { if (m_RichIconObjectPath == NULL) { return NULL; } return m_RichIconObjectPath->c_str(); } const char* Notification::getRichAudioObjectPath() const { if (m_RichAudioObjectPath == NULL) { return NULL; } return m_RichAudioObjectPath->c_str(); } const std::vector& Notification::getRichAudioUrl() const { return m_RichAudioUrl; } const char* Notification::getControlPanelServiceObjectPath() const { if (m_ControlPanelServiceObjectPath == NULL) { return NULL; } return m_ControlPanelServiceObjectPath->c_str(); } const char* Notification::getOriginalSender() const { if (m_OriginalSender == NULL) { return NULL; } return m_OriginalSender->c_str(); } void Notification::setAppId(const char* appId) { if (appId == NULL) { delete m_AppId; m_AppId = NULL; return; } if (!m_AppId) { m_AppId = new qcc::String(appId); } else { m_AppId->assign(appId); } } void Notification::setAppName(const char* appName) { if (appName == NULL) { delete m_AppName; m_AppName = NULL; return; } if (!m_AppName) { m_AppName = new qcc::String(appName); } else { m_AppName->assign(appName); } } void Notification::setControlPanelServiceObjectPath( const char* controlPanelServiceObjectPath) { if (controlPanelServiceObjectPath == NULL) { delete m_ControlPanelServiceObjectPath; m_ControlPanelServiceObjectPath = NULL; return; } if (!IsLegalObjectPath(controlPanelServiceObjectPath)) { QCC_LogError(ER_BUS_BAD_OBJ_PATH, ("Illegal object path \"%s\" specified", controlPanelServiceObjectPath)); return; } if (!m_ControlPanelServiceObjectPath) { m_ControlPanelServiceObjectPath = new qcc::String(controlPanelServiceObjectPath); } else { m_ControlPanelServiceObjectPath->assign(controlPanelServiceObjectPath); } } void Notification::setCustomAttributes( const std::map& customAttributes) { m_CustomAttributes = customAttributes; } void Notification::setDeviceId(const char* deviceId) { if (deviceId == NULL) { delete m_DeviceId; m_DeviceId = NULL; return; } if (!m_DeviceId) { m_DeviceId = new qcc::String(deviceId); } else { m_DeviceId->assign(deviceId); } } void Notification::setDeviceName(const char* deviceName) { if (deviceName == NULL) { delete m_DeviceName; m_DeviceName = NULL; return; } if (!m_DeviceName) { m_DeviceName = new qcc::String(deviceName); } else { m_DeviceName->assign(deviceName); } } void Notification::setOriginalSender(const char* originalSender) { if (originalSender == NULL) { delete m_OriginalSender; m_OriginalSender = NULL; return; } if (!m_OriginalSender) { m_OriginalSender = new qcc::String(originalSender); } else { m_OriginalSender->assign(originalSender); } } void Notification::setMessageId(int32_t messageId) { m_MessageId = messageId; } void Notification::setRichAudioUrl( const std::vector& richAudioUrl) { m_RichAudioUrl = richAudioUrl; } void Notification::setRichIconUrl(const char* richIconUrl) { if (richIconUrl == NULL) { delete m_RichIconUrl; m_RichIconUrl = NULL; return; } if (!m_RichIconUrl) { m_RichIconUrl = new qcc::String(richIconUrl); } else { m_RichIconUrl->assign(richIconUrl); } } void Notification::setRichIconObjectPath(const char* richIconObjectPath) { if (richIconObjectPath == NULL) { delete m_RichIconObjectPath; m_RichIconObjectPath = NULL; return; } if (!IsLegalObjectPath(richIconObjectPath)) { QCC_LogError(ER_BUS_BAD_OBJ_PATH, ("Illegal object path \"%s\" specified", richIconObjectPath)); return; } if (!m_RichIconObjectPath) { m_RichIconObjectPath = new qcc::String(richIconObjectPath); } else { m_RichIconObjectPath->assign(richIconObjectPath); } } void Notification::setRichAudioObjectPath(const char* richAudioObjectPath) { if (richAudioObjectPath == NULL) { delete m_RichAudioObjectPath; m_RichAudioObjectPath = NULL; return; } if (!IsLegalObjectPath(richAudioObjectPath)) { QCC_LogError(ER_BUS_BAD_OBJ_PATH, ("Illegal object path \"%s\" specified", richAudioObjectPath)); return; } if (!m_RichAudioObjectPath) { m_RichAudioObjectPath = new qcc::String(richAudioObjectPath); } else { m_RichAudioObjectPath->assign(richAudioObjectPath); } } void Notification::setSender(const char* sender) { if (sender == NULL) { delete m_Sender; m_Sender = NULL; return; } if (!m_Sender) { m_Sender = new qcc::String(sender); } else { m_Sender->assign(sender); } } QStatus Notification::dismiss() { QCC_DbgPrintf(("Notification::dismiss() called OriginalSender:%s MessageId:%d AppId:%s", getOriginalSender(), getMessageId(), getAppId())); NotificationMsg* notificationMsg = new NotificationMsg(getOriginalSender(), getMessageId(), getAppId()); m_AsyncTaskQueue.Enqueue(notificationMsg); return ER_OK; } base-16.04/notification/cpp/src/NotificationAsyncTaskEvents.cc000066400000000000000000000140751272147170000244500ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include "Transport.h" #include "NotificationProducerSender.h" #include "NotificationDismisserSender.h" #include #include #include #include #include using namespace ajn; using namespace services; using namespace qcc; NotificationAsyncTaskEvents::NotificationAsyncTaskEvents() { } NotificationAsyncTaskEvents::~NotificationAsyncTaskEvents() { } void NotificationAsyncTaskEvents::OnEmptyQueue() { } void NotificationAsyncTaskEvents::OnTask(TaskData const* taskData) { QCC_DbgTrace(("NotificationAsyncTaskEvents", "OnTask() called")); NotificationMsg const* notificationMsg = static_cast(taskData); QStatus status = ER_OK; Transport* pTransport = Transport::getInstance(); SessionOpts opts(SessionOpts::TRAFFIC_MESSAGES, false, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY); ajn::SessionId sessionId(0); if (notificationMsg->m_OriginalSender.length() > 0) { status = pTransport->getBusAttachment()->JoinSession(notificationMsg->m_OriginalSender.c_str(), (ajn::SessionPort)nsConsts::AJ_NOTIFICATION_PRODUCER_SERVICE_PORT, NULL, sessionId, opts); } else { QCC_DbgHLPrintf(("There is no original sender in the message. Can't join session.")); status = ER_FAIL; } if ((ER_OK != status) && (status != ER_ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED)) { QCC_LogError(status, ("Failed to JoinSession to %s", notificationMsg->m_OriginalSender.c_str())); sendDismissSignal(notificationMsg); return; } else { QCC_DbgPrintf(("JoinSession to %s SUCCEEDED (Session id=%u)", notificationMsg->m_OriginalSender.c_str(), sessionId)); } NotificationProducerSender* pNotificationProducerSender = Transport::getInstance()->getNotificationProducerSender(); if (pNotificationProducerSender == NULL) { status = ER_FAIL; return; } status = pNotificationProducerSender->Dismiss(notificationMsg->m_OriginalSender.c_str(), sessionId, notificationMsg->m_MessageId); if (status != ER_OK) { QCC_LogError(status, ("Dismiss failed")); sendDismissSignal(taskData); } else { QCC_DbgPrintf(("Dismiss succeeded")); } status = Transport::getInstance()->getBusAttachment()->LeaveSession(sessionId); } void NotificationAsyncTaskEvents::sendDismissSignal(TaskData const* taskData) { QCC_DbgPrintf(("NotificationAsyncTaskEvents", "sendDismissSignal() called!")); NotificationMsg const* notificationMsg = static_cast(taskData); QStatus status = ER_OK; MsgArg msgIdArg; MsgArg appIdArg; status = msgIdArg.Set(nsConsts::AJPARAM_INT.c_str(), notificationMsg->m_MessageId); if (status != ER_OK) { return; } uint8_t AppId[16]; HexStringToBytes(notificationMsg->m_AppId, AppId, 16); status = appIdArg.Set(nsConsts::AJPARAM_ARR_BYTE.c_str(), 16, AppId); if (status != ER_OK) { return; } { MsgArg dismisserArgs[nsConsts::AJ_DISMISSER_NUM_PARAMS]; dismisserArgs[0] = msgIdArg; dismisserArgs[1] = appIdArg; /**Code commented below is for future use * In case dismiss signal will not need to be sent via different object path each time. * In that case enable code below and disable next paragraph. * * status = Transport::getInstance()->getNotificationDismisserSender()->sendSignal(dismisserArgs,nsConsts::TTL_MAX); * if (status != ER_OK) { * QCC_LogError(status,("NotificationAsyncTaskEvents", "sendSignal failed.")); * return; * } * * End of paragraph */ /* * Paragraph to be disabled in case dismiss signal will not need to be sent via different object path each time */ std::ostringstream stm; stm << abs(notificationMsg->m_MessageId); qcc::String objectPath = nsConsts::AJ_NOTIFICATION_DISMISSER_PATH + "/" + notificationMsg->m_AppId + "/" + std::string(stm.str()).c_str(); NotificationDismisserSender notificationDismisserSender(Transport::getInstance()->getBusAttachment(), objectPath, status); status = Transport::getInstance()->getBusAttachment()->RegisterBusObject(notificationDismisserSender); if (status != ER_OK) { QCC_LogError(status, ("Could not register NotificationDismisserSender.")); return; } status = notificationDismisserSender.sendSignal(dismisserArgs, nsConsts::TTL_MAX); if (status != ER_OK) { QCC_LogError(status, ("sendSignal failed.")); return; } Transport::getInstance()->getBusAttachment()->UnregisterBusObject(notificationDismisserSender); /* * End of paragraph */ } } base-16.04/notification/cpp/src/NotificationConstants.cc000066400000000000000000000017641272147170000233400ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include "NotificationConstants.h" base-16.04/notification/cpp/src/NotificationConstants.h000066400000000000000000000122641272147170000231770ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONCONSTANTS_H_ #define NOTIFICATIONCONSTANTS_H_ #include #if defined(QCC_OS_GROUP_WINDOWS) /* Disabling warning C 4706. Assignment within conditional expression */ #pragma warning(push) #pragma warning(disable: 4706) #endif /* * Common Macros */ #define CHECK(x) if ((status = x)) { break; } namespace ajn { namespace services { namespace nsConsts { static const qcc::String BUS_NAME = "NotificationService"; static const uint16_t TTL_MIN = 30; static const uint16_t TTL_MAX = 43200; static const uint16_t UUID_LENGTH = 16; static const int16_t ANNOUNCMENT_PORT_NUMBER = 900; static const uint16_t NOTIFICATION_DISMISSER_VERSION = 1; static const uint16_t NOTIFICATION_PRODUCER_VERSION = 1; static const qcc::String AJPARAM_BOOL = "b"; static const qcc::String AJPARAM_UINT16 = "q"; static const qcc::String AJPARAM_STR = "s"; static const qcc::String AJPARAM_INT = "i"; static const qcc::String AJPARAM_ARR_BYTE = "ay"; static const qcc::String AJPARAM_DICT_INT_VAR = "{iv}"; static const qcc::String AJPARAM_DICT_INT_UINT16 = "{iq}"; static const qcc::String AJPARAM_DICT_INT_STR = "{is}"; static const qcc::String AJPARAM_DICT_STR_STR = "{ss}"; static const qcc::String AJPARAM_DICT_STR_VAR = "{sv}"; static const qcc::String AJPARAM_ARR_DICT_INT_VAR = "a{iv}"; static const qcc::String AJPARAM_ARR_DICT_STR_VAR = "a{sv}"; static const qcc::String AJPARAM_ARR_DICT_STR_STR = "a{ss}"; static const qcc::String AJPARAM_STRUCT_STR_STR = "(ss)"; static const qcc::String AJPARAM_ARR_STRUCT_STR_STR = "a(ss)"; static const qcc::String AJPARAM_ARR_STRUCT_STR_ARR_STR = "a(sas)"; static const qcc::String AJPARAM_STRUCT_STR_ARR_STR = "(sas)"; static const int32_t AJ_NOTIFY_NUM_PARAMS = 10; static const int32_t AJ_NUM_METADATA_DEFLT_PARAMS = 0; static const int32_t RICH_CONTENT_ICON_URL_ATTRIBUTE_KEY = 0; static const int32_t RICH_CONTENT_AUDIO_URL_ATTRIBUTE_KEY = 1; static const int32_t RICH_CONTENT_ICON_OBJECT_PATH_ATTRIBUTE_KEY = 2; static const int32_t RICH_CONTENT_AUDIO_OBJECT_PATH_ATTRIBUTE_KEY = 3; static const int32_t CPS_OBJECT_PATH_ATTRIBUTE_KEY = 4; static const int32_t ORIGINAL_SENDER_ATTRIBUTE_KEY = 5; static const qcc::String AJ_NOTIFICATION_INTERFACE_NAME = "org.alljoyn.Notification"; static const uint16_t AJ_NOTIFICATION_PRODUCER_SERVICE_PORT = 1010; static const qcc::String AJ_PROPERTY_VERSION = "Version"; static const qcc::String AJ_SIGNAL_METHOD = "notify"; static const qcc::String AJ_CONSUMER_SERVICE_PATH = "/receiver"; static const qcc::String AJ_PRODUCER_SERVICE_PATH_PREFIX = "/"; static const qcc::String AJ_NOTIFY_PARAMS = AJPARAM_UINT16 + AJPARAM_INT + AJPARAM_UINT16 + AJPARAM_STR + AJPARAM_STR + AJPARAM_ARR_BYTE + AJPARAM_STR + AJPARAM_ARR_DICT_INT_VAR + AJPARAM_ARR_DICT_STR_STR + AJPARAM_ARR_STRUCT_STR_STR; static const qcc::String AJ_NOTIFY_PARAM_NAMES = "version, notificationId, messageType, deviceId, deviceName, appId, appName, attributes, customAttributes, notificationText"; static const qcc::String AJ_NOTIFY_SIGNAL_DESCRIPTION = "AllJoyn signal-carrying notification message."; static const qcc::String AJ_SESSIONLESS_MATCH = "sessionless='t'"; static const qcc::String AJ_NOTIFICATION_PRODUCER_INTERFACE = "org.alljoyn.Notification.Producer"; static const qcc::String AJ_NOTIFICATION_PRODUCER_PATH = "/notificationProducer"; static const qcc::String AJ_DISMISS_METHOD_NAME = "Dismiss"; static const qcc::String AJ_DISMISS_METHOD_DESCRIPTION = "Dismiss notification"; static const qcc::String AJ_DISMISS_METHOD_PARAMS = "i"; static const qcc::String AJ_DISMISS_METHOD_PARAMS_NAMES = "msgId"; static const qcc::String AJ_NOTIFICATION_DISMISSER_INTERFACE = "org.alljoyn.Notification.Dismisser"; static const qcc::String AJ_DISMISS_SIGNAL_NAME = "Dismiss"; static const qcc::String AJ_DISMISS_SIGNAL_PARAMS = AJPARAM_INT + AJPARAM_ARR_BYTE; static const qcc::String AJ_DISMISS_SIGNAL_DESCRIPTION = "Notifies consumers that the notification has been dismissed."; static const qcc::String AJ_DISMISS_PARAM_NAMES = "msgId, appId"; static const int32_t AJ_DISMISSER_NUM_PARAMS = 2; static const qcc::String AJ_NOTIFICATION_DISMISSER_PATH = "/notificationDismisser"; } //namespace nsConsts } //namespace services } //namespace ajn #endif /* NOTIFICATIONCONSTANTS_H_ */ base-16.04/notification/cpp/src/NotificationDismisser.cc000066400000000000000000000101421272147170000233140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "NotificationDismisser.h" #include "NotificationConstants.h" #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationDismisser::NotificationDismisser(ajn::BusAttachment* bus, qcc::String const& objectPath, QStatus& status) : BusObject(objectPath.c_str()), m_SignalMethod(0), m_InterfaceDescription(NULL) { m_InterfaceDescription = const_cast(bus->GetInterface(AJ_NOTIFICATION_DISMISSER_INTERFACE.c_str())); if (!m_InterfaceDescription) { if ((status = bus->CreateInterface(nsConsts::AJ_NOTIFICATION_DISMISSER_INTERFACE.c_str(), m_InterfaceDescription, false)) != ER_OK) { return; } if (!m_InterfaceDescription) { status = ER_FAIL; QCC_LogError(status, ("m_InterfaceDescription is NULL")); return; } status = m_InterfaceDescription->AddSignal(AJ_DISMISS_SIGNAL_NAME.c_str(), AJ_DISMISS_SIGNAL_PARAMS.c_str(), AJ_DISMISS_PARAM_NAMES.c_str(), 0); if (status != ER_OK) { QCC_LogError(status, ("AddSignal failed.")); return; } // Mark the signal as sessionless. status = m_InterfaceDescription->SetMemberDescription(AJ_DISMISS_SIGNAL_NAME.c_str(), AJ_DISMISS_SIGNAL_DESCRIPTION.c_str(), true); if (status != ER_OK) { QCC_LogError(status, ("SetMemberDescription failed.")); return; } status = m_InterfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ); if (status != ER_OK) { QCC_LogError(status, ("AddProperty failed.")); return; } m_InterfaceDescription->Activate(); } status = AddInterface(*m_InterfaceDescription, ANNOUNCED); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface.")); return; } // Get the signal method for future use. m_SignalMethod = m_InterfaceDescription->GetMember(AJ_DISMISS_SIGNAL_NAME.c_str()); if (m_SignalMethod == NULL) { status = ER_FAIL; QCC_LogError(status, ("Could not add interface.")); return; } } NotificationDismisser::~NotificationDismisser() { } QStatus NotificationDismisser::Get(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_DbgPrintf(("Get property was called:")); if (0 != strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { QCC_LogError(ER_BUS_NO_SUCH_PROPERTY, ("Called for property different than version.")); return ER_BUS_NO_SUCH_PROPERTY; } val.typeId = ALLJOYN_UINT16; val.v_uint16 = NOTIFICATION_DISMISSER_VERSION; return ER_OK; } QStatus NotificationDismisser::Set(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } const char* NotificationDismisser::getAppId() const { return m_AppId; } base-16.04/notification/cpp/src/NotificationDismisser.h000066400000000000000000000056361272147170000231720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONDISMISSER_H_ #define NOTIFICATIONDISMISSER_H_ #include #include #include namespace ajn { namespace services { /** * a base class to implement the dismisser interface */ class NotificationDismisser : public ajn::BusObject { public: /** * Constructor for NotificationDismisser. Creates Interface and prepares * infrastructure to be able to send Signal * @param bus - BusAttachment that is used * @param objectPath - object path name of the dismisser * @param status - success/failure */ NotificationDismisser(ajn::BusAttachment* bus, qcc::String const& objectPath, QStatus& status); /** * Destructor for NotificationDismisser */ virtual ~NotificationDismisser() = 0; /** * Callback for GetProperty * @param ifcName - interface name * @param propName - property name to get * @param val - value requested * @return status */ QStatus Get(const char* ifcName, const char* propName, ajn::MsgArg& val); /** * Callback for SetProperty * @param ifcName - interface name * @param propName - property name to set * @param val - value to set * @return status */ QStatus Set(const char* ifcName, const char* propName, ajn::MsgArg& val); /** * Get the app Id * @return appId */ const char* getAppId() const; protected: /** * The pointer used to send signal/register Signal Handler */ const ajn::InterfaceDescription::Member* m_SignalMethod; /** * message Id of the last message sent with this message type */ int32_t m_MsgId; /** * The Notification's App Id */ const char* m_AppId; /** * pointer to InterfaceDescription */ InterfaceDescription* m_InterfaceDescription; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONDISMISSER_H_ */ base-16.04/notification/cpp/src/NotificationDismisserReceiver.cc000066400000000000000000000214361272147170000250110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "NotificationDismisserReceiver.h" #include "NotificationConstants.h" #include "Transport.h" #include #include #include #ifdef _WIN32 #include #endif using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationDismisserReceiver::NotificationDismisserReceiver(BusAttachment* bus, QStatus& status) : NotificationDismisser(bus, AJ_NOTIFICATION_DISMISSER_PATH, status), m_IsStopping(false) { QCC_DbgTrace(("NotificationDismisserReceiver::NotificationDismisserReceiver() - called()")); /** * Do not add code until the status that returned from the base class is verified. */ if (status != ER_OK) { return; } #ifdef _WIN32 InitializeCriticalSection(&m_Lock); InitializeConditionVariable(&m_QueueChanged); status = bus->RegisterSignalHandler(this, static_cast(&NotificationDismisserReceiver::Signal), m_SignalMethod, NULL); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } else { QCC_DbgPrintf(("Registered the SignalHandler successfully")); } m_handle = reinterpret_cast(_beginthreadex(NULL, 256 * 1024, (unsigned int (__stdcall*)(void*))ReceiverThreadWrapper, this, 0, NULL)); #else pthread_mutex_init(&m_Lock, NULL); pthread_cond_init(&m_QueueChanged, NULL); status = bus->RegisterSignalHandler(this, static_cast(&NotificationDismisserReceiver::Signal), m_SignalMethod, NULL); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } else { QCC_DbgPrintf(("Registered the SignalHandler successfully")); } pthread_create(&m_ReceiverThread, NULL, ReceiverThreadWrapper, this); #endif } void NotificationDismisserReceiver::Signal(const InterfaceDescription::Member* member, const char* srcPath, Message& msg) { QCC_UNUSED(member); QCC_UNUSED(srcPath); QCC_DbgPrintf(("Received dismisser signal.")); #ifdef _WIN32 EnterCriticalSection(&m_Lock); m_MessageQueue.push(msg); WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); m_MessageQueue.push(msg); pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); #endif } void NotificationDismisserReceiver::unregisterHandler(BusAttachment* bus) { #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); WaitForSingleObject(m_handle, INFINITE); CloseHandle(m_handle); bus->UnregisterSignalHandler(this, static_cast(&NotificationDismisserReceiver::Signal), m_SignalMethod, NULL); DeleteCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); pthread_join(m_ReceiverThread, NULL); bus->UnregisterSignalHandler(this, static_cast(&NotificationDismisserReceiver::Signal), m_SignalMethod, NULL); pthread_cond_destroy(&m_QueueChanged); pthread_mutex_destroy(&m_Lock); #endif } void* NotificationDismisserReceiver::ReceiverThreadWrapper(void* context) { NotificationDismisserReceiver* consumer = reinterpret_cast(context); if (consumer == NULL) { // should not happen return NULL; } consumer->ReceiverThread(); return NULL; } void NotificationDismisserReceiver::ReceiverThread() { #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { Message message = m_MessageQueue.front(); m_MessageQueue.pop(); LeaveCriticalSection(&m_Lock); QCC_DbgPrintf(("ReceiverThread() - got a dismiss message.")); int32_t msgId; qcc::String appId; QStatus status = UnmarshalMessage(message, msgId, appId); if (status == ER_OK) { Transport::getInstance()->getNotificationReceiver()->Dismiss(msgId, appId); } EnterCriticalSection(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { //pthread_testcancel(); //for win only? SleepConditionVariableCS(&m_QueueChanged, &m_Lock, INFINITE); } } LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { Message message = m_MessageQueue.front(); m_MessageQueue.pop(); pthread_mutex_unlock(&m_Lock); QCC_DbgPrintf(("ReceiverThread() - got a dismiss message.")); int32_t msgId; qcc::String appId; QStatus status = UnmarshalMessage(message, msgId, appId); if (status == ER_OK) { Transport::getInstance()->getNotificationReceiver()->Dismiss(msgId, appId); } pthread_mutex_lock(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { pthread_cond_wait(&m_QueueChanged, &m_Lock); } } pthread_mutex_unlock(&m_Lock); #endif } QStatus NotificationDismisserReceiver::UnmarshalMessage(Message& in_message, int32_t& msgId, qcc::String& appId) { QStatus status = ER_OK; const MsgArg* messageIdArg = in_message.unwrap()->GetArg(0); const MsgArg* appIdArg = in_message.unwrap()->GetArg(1); if ((messageIdArg == NULL) || (appIdArg == NULL)) { status = ER_BAD_ARG_COUNT; return status; } //unmarshal messageid if (messageIdArg->typeId != ALLJOYN_INT32) { status = ER_BUS_BAD_VALUE_TYPE; QCC_LogError(status, ("UnmarshalMessage() - bad type to unmarshal.")); return status; } status = messageIdArg->Get(AJPARAM_INT.c_str(), &msgId); if (status != ER_OK) { QCC_LogError(status, ("UnmarshalMessage() - failed to get parameter.")); return status; } //Unmarshal appId uint8_t* appIdBin = NULL; size_t len; if (appIdArg->typeId != ALLJOYN_BYTE_ARRAY) { status = ER_BUS_BAD_VALUE_TYPE; QCC_LogError(status, ("ERROR- Problem receiving message: Can not unmarshal this array of bytes argument.")); return status; } status = appIdArg->Get(AJPARAM_ARR_BYTE.c_str(), &len, &appIdBin); if (len != UUID_LENGTH) { status = ER_BUS_BAD_VALUE; QCC_LogError(status, ("ERROR- Array of bytes length is not equal to %d but to %d", UUID_LENGTH * 2, len)); return status; } //convert bytes to qcc::String appId = BytesToHexString(appIdBin, len); return status; } base-16.04/notification/cpp/src/NotificationDismisserReceiver.h000066400000000000000000000063501272147170000246510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONDISMISSERRECEIVER_H_ #define NOTIFICATIONDISMISSERRECEIVER_H_ #include #include #include "NotificationDismisser.h" #ifdef _WIN32 #include #define pthread_mutex_t CRITICAL_SECTION #define pthread_cond_t CONDITION_VARIABLE #else #include #endif namespace ajn { namespace services { /** * Notification Dismisser Receiver */ class NotificationDismisserReceiver : public NotificationDismisser { public: /** * Constructor for TransportConsumer * @param bus - BusAttachment that is used * @param servicePath - servicePath of BusObject * @param status - success/failure */ NotificationDismisserReceiver(ajn::BusAttachment* bus, QStatus& status); /** * Destructor of TransportConsumer */ ~NotificationDismisserReceiver() { }; /** * Callback when Signal arrives * @param member Method or signal interface member entry. * @param srcPath Object path of signal emitter. * @param message The received message. */ void Signal(const ajn::InterfaceDescription::Member* member, const char* srcPath, ajn::Message& msg); /** * To stop thread processing of messages * @param - bus attachment */ void unregisterHandler(ajn::BusAttachment* bus); private: /** * The thread responsible for receiving the notification */ #ifdef _WIN32 HANDLE m_handle; #else pthread_t m_ReceiverThread; #endif /** * A Queue that holds the messages */ std::queue m_MessageQueue; /** * The mutex Lock */ pthread_mutex_t m_Lock; /** * The Queue Changed thread condition */ pthread_cond_t m_QueueChanged; /** * is the thread in the process of shutting down */ bool m_IsStopping; /** * A wrapper for the receiver Thread * @param context */ static void* ReceiverThreadWrapper(void* context); /** * The function run in the ReceiverThread */ void ReceiverThread(); /** * unmarshal dismisser message */ QStatus UnmarshalMessage(Message& in_message, int32_t& messageId, qcc::String& appId); }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONDISMISSERRECEIVER_H_ */ base-16.04/notification/cpp/src/NotificationDismisserSender.cc000066400000000000000000000050341272147170000244610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "NotificationDismisserSender.h" #include "NotificationConstants.h" #include "Transport.h" #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationDismisserSender::NotificationDismisserSender(BusAttachment* bus, String const& objectPath, QStatus& status) : NotificationDismisser(bus, objectPath, status) { /** * Do not add code until the status that returned from the base class is verified. */ if (status != ER_OK) { return; } //Add code here QCC_DbgPrintf(("NotificationDismisserSender() - Got objectpath=%s", objectPath.c_str())); } QStatus NotificationDismisserSender::sendSignal(ajn::MsgArg const dismisserArgs[AJ_DISMISSER_NUM_PARAMS], uint16_t ttl) { QCC_DbgTrace(("Notification::sendSignal() called")); if (m_SignalMethod == 0) { QCC_LogError(ER_BUS_INTERFACE_NO_SUCH_MEMBER, ("signalMethod not set. Can't send signal")); return ER_BUS_INTERFACE_NO_SUCH_MEMBER; } uint8_t flags = ALLJOYN_FLAG_SESSIONLESS; QStatus status = Signal(NULL, 0, *m_SignalMethod, dismisserArgs, AJ_DISMISSER_NUM_PARAMS, ttl, flags); if (status != ER_OK) { QCC_LogError(status, ("Could not send signal.")); return status; } QCC_DbgPrintf(("Sent signal successfully")); return status; } base-16.04/notification/cpp/src/NotificationDismisserSender.h000066400000000000000000000042631272147170000243260ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONDISMISSERSENDER_H_ #define NOTIFICATIONDISMISSERSENDER_H_ #include #include "NotificationDismisser.h" #include "NotificationConstants.h" namespace ajn { namespace services { /** * Implementing the sender side of the dismiss signal in dismisser interface */ class NotificationDismisserSender : public NotificationDismisser { public: /** * Constructor for TransportProducer. Creates Interface and prepares * infrastructure to be able to send Signal * @param bus - BusAttachment that is used * @param objectPath - Object path name of the dismisser * @param status - success/failure */ NotificationDismisserSender(ajn::BusAttachment* bus, qcc::String const& objectPath, QStatus& status); /** * Destructor for TransportProducer */ ~NotificationDismisserSender() { }; /** * Send Signal over Bus. * @param notificationArgs * @param ttl * @return status */ QStatus sendSignal(ajn::MsgArg const dismisserArgs[nsConsts::AJ_DISMISSER_NUM_PARAMS], uint16_t ttl); }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONDISMISSERSENDER_H_ */ base-16.04/notification/cpp/src/NotificationEnums.cc000066400000000000000000000027661272147170000224560ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include using namespace ajn; using namespace services; const qcc::String MessageTypeUtil::MESSAGE_TYPE_STRINGS[3] = { "emergency", "warning", "info" }; qcc::String const& MessageTypeUtil::getMessageTypeString(int32_t messageType) { return MESSAGE_TYPE_STRINGS[messageType]; } NotificationMessageType MessageTypeUtil::getMessageType(int32_t messageType) { return (NotificationMessageType) messageType; } int32_t MessageTypeUtil::getNumMessageTypes() { return (int32_t) MESSAGE_TYPE_CNT; } base-16.04/notification/cpp/src/NotificationProducer.cc000066400000000000000000000076621272147170000231520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "NotificationProducer.h" #include #include #include "NotificationConstants.h" #include #include using namespace ajn; using namespace services; using namespace qcc; using namespace nsConsts; NotificationProducer::NotificationProducer(ajn::BusAttachment *bus, QStatus &status, qcc::String pathSuffix) : BusObject((AJ_NOTIFICATION_PRODUCER_PATH + pathSuffix).c_str()), m_InterfaceDescription(NULL), m_BusAttachment(bus) { m_InterfaceDescription = const_cast(m_BusAttachment->GetInterface(AJ_NOTIFICATION_PRODUCER_INTERFACE.c_str())); if (!m_InterfaceDescription) { status = m_BusAttachment->CreateInterface(nsConsts::AJ_NOTIFICATION_PRODUCER_INTERFACE.c_str(), m_InterfaceDescription, false); if (status != ER_OK) { QCC_LogError(status, ("CreateInterface failed")); return; } if (!m_InterfaceDescription) { status = ER_FAIL; QCC_LogError(status, ("m_InterfaceDescription is NULL")); return; } status = m_InterfaceDescription->AddMethod(AJ_DISMISS_METHOD_NAME.c_str(), AJ_DISMISS_METHOD_PARAMS.c_str(), NULL, AJ_DISMISS_METHOD_PARAMS_NAMES.c_str()); if (status != ER_OK) { QCC_LogError(status, ("AddMethod failed.")); return; } status = m_InterfaceDescription->AddMemberAnnotation(AJ_DISMISS_METHOD_NAME.c_str(), "org.alljoyn.Bus.DocString.En", AJ_DISMISS_METHOD_DESCRIPTION.c_str()); if (status != ER_OK) { QCC_LogError(status, ("AddMemberAnnotation failed.")); return; } status = m_InterfaceDescription->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), (uint8_t) PROP_ACCESS_READ); if (status != ER_OK) { QCC_LogError(status, ("AddProperty failed.")); return; } m_InterfaceDescription->Activate(); } status = AddInterface(*m_InterfaceDescription, ANNOUNCED); if (status != ER_OK) { QCC_LogError(status, ("AddInterface failed.")); return; } } NotificationProducer::~NotificationProducer() { } QStatus NotificationProducer::Get(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_DbgTrace(("Get property was called.")); if (0 != strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { QCC_LogError(ER_BUS_NO_SUCH_PROPERTY, ("Called for property different than version.")); return ER_BUS_NO_SUCH_PROPERTY; } val.typeId = ALLJOYN_UINT16; val.v_uint16 = NOTIFICATION_PRODUCER_VERSION; return ER_OK; } QStatus NotificationProducer::Set(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } base-16.04/notification/cpp/src/NotificationProducer.h000066400000000000000000000050361272147170000230050ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONPRODUCER_H_ #define NOTIFICATIONPRODUCER_H_ #include namespace ajn { namespace services { /** * NotificationProducer * This class has method to dismiss the notification. * The producer will send dismiss signal to notify other entities. */ class NotificationProducer : public ajn::BusObject { public: /** * Constructor for NotificationProducer. Creates Interface and prepares * infrastructure to be able to send Signal * @param bus - BusAttachment that is used * @param status - success/failure */ NotificationProducer(ajn::BusAttachment *bus, QStatus &status, qcc::String pathSuffix); /** * Destructor for NotificationTransport */ virtual ~NotificationProducer() = 0; /** * Callback for GetProperty * @param ifcName - interface name * @param propName - property name to get * @param val - value requested * @return status */ QStatus Get(const char* ifcName, const char* propName, MsgArg& val); /** * Callback for SetProperty * @param ifcName - interface name * @param propName - property name to set * @param val - value to set * @return status */ QStatus Set(const char* ifcName, const char* propName, MsgArg& val); protected: /** * pointer to InterfaceDescription */ InterfaceDescription* m_InterfaceDescription; /** * pointer to BusAttachment */ ajn::BusAttachment* m_BusAttachment; private: }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONPRODUCER_H_ */ base-16.04/notification/cpp/src/NotificationProducerListener.cc000066400000000000000000000045431272147170000246530ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "NotificationProducerListener.h" #include #include #include #include "NotificationConstants.h" #include using namespace ajn; using namespace services; using namespace qcc; using namespace nsConsts; NotificationProducerListener::NotificationProducerListener() : SessionPortListener(), m_SessionPort(0) { } NotificationProducerListener::~NotificationProducerListener() { } void NotificationProducerListener::setSessionPort(ajn::SessionPort sessionPort) { m_SessionPort = sessionPort; } SessionPort NotificationProducerListener::getSessionPort() { return m_SessionPort; } bool NotificationProducerListener::AcceptSessionJoiner(ajn::SessionPort sessionPort, const char* joiner, const ajn::SessionOpts& opts) { QCC_UNUSED(joiner); //joiner only used in debug build not release QCC_UNUSED(opts); if (sessionPort != m_SessionPort) { return false; } QCC_DbgPrintf(("NotificationProducerListener::AcceptSessionJoiner() sessionPort=%hu joiner:%s", sessionPort, joiner)); return true; } void NotificationProducerListener::SessionJoined(SessionPort sessionPort, SessionId sessionId, const char* joiner) { QCC_UNUSED(sessionPort); QCC_UNUSED(sessionId); QCC_UNUSED(joiner); } base-16.04/notification/cpp/src/NotificationProducerListener.h000066400000000000000000000050241272147170000245100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONPRODUCERLISTENER_H_ #define NOTIFICATIONPRODUCERLISTENER_H_ #include #include #include namespace ajn { namespace services { /** * Class that implements SessionPortListener and SessionListener */ class NotificationProducerListener : public SessionPortListener { public: /** * Constructor of NotificationProducerListener */ NotificationProducerListener(); /** * Destructor of NotificationProducerListener */ ~NotificationProducerListener(); /** * Set the Value of the SessionPort associated with this SessionPortListener * @param sessionPort */ void setSessionPort(SessionPort sessionPort); /** * Get the SessionPort of the listener * @return */ SessionPort getSessionPort(); /** * AcceptSessionJoiner - Receive request to join session and decide whether to accept it or not * @param sessionPort - the port of the request * @param joiner - the name of the joiner * @param opts - the session options * @return true/false */ bool AcceptSessionJoiner(SessionPort sessionPort, const char* joiner, const SessionOpts& opts); /** * SessionJoined * @param sessionPort * @param sessionId * @param joiner */ void SessionJoined(SessionPort sessionPort, SessionId sessionId, const char* joiner); private: /** * The port used as part of the join session request */ SessionPort m_SessionPort; }; } } #endif /* NOTIFICATIONPRODUCERLISTENER_H_ */ base-16.04/notification/cpp/src/NotificationProducerReceiver.cc000066400000000000000000000225701272147170000246320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "NotificationProducerReceiver.h" #include "Transport.h" #include "NotificationConstants.h" #include #include #include #include "NotificationDismisserSender.h" #include #include #ifdef _WIN32 #include #endif using namespace ajn; using namespace services; using namespace qcc; using namespace nsConsts; NotificationProducerReceiver::NotificationProducerReceiver(ajn::BusAttachment* bus, QStatus& status) : NotificationProducer(bus, status, (qcc::String())), m_IsStopping(false) { /** * Do not add code until the status that returned from the base class is verified. */ if (status != ER_OK) { return; } status = AddMethodHandler(m_InterfaceDescription->GetMember(AJ_DISMISS_METHOD_NAME.c_str()), static_cast(&NotificationProducerReceiver::Dismiss)); if (status != ER_OK) { QCC_LogError(status, ("AddMethodHandler failed.")); return; } #ifdef _WIN32 InitializeCriticalSection(&m_Lock); InitializeConditionVariable(&m_QueueChanged); m_handle = reinterpret_cast(_beginthreadex(NULL, 256 * 1024, (unsigned int (__stdcall*)(void*))ReceiverThreadWrapper, this, 0, NULL)); #else pthread_mutex_init(&m_Lock, NULL); pthread_cond_init(&m_QueueChanged, NULL); pthread_create(&m_ReceiverThread, NULL, ReceiverThreadWrapper, this); #endif } NotificationProducerReceiver::~NotificationProducerReceiver() { QCC_DbgTrace(("start")); QCC_DbgTrace(("end")); } void NotificationProducerReceiver::unregisterHandler(BusAttachment* bus) { QCC_UNUSED(bus); #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); WaitForSingleObject(m_handle, INFINITE); CloseHandle(m_handle); DeleteCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); pthread_join(m_ReceiverThread, NULL); pthread_cond_destroy(&m_QueueChanged); pthread_mutex_destroy(&m_Lock); #endif } void* NotificationProducerReceiver::ReceiverThreadWrapper(void* context) { QCC_DbgTrace(("NotificationProducerReceiver::ReceiverThreadWrapper()")); NotificationProducerReceiver* pNotificationProducerReceiver = reinterpret_cast(context); if (pNotificationProducerReceiver == NULL) { // should not happen return NULL; } pNotificationProducerReceiver->Receiver(); return NULL; } void NotificationProducerReceiver::Dismiss(const ajn::InterfaceDescription::Member* member, ajn::Message& msg) { QCC_DbgTrace(("NotificationProducerReceiver::Dismiss()")); HandleMethodCall(member, msg); } void NotificationProducerReceiver::HandleMethodCall(const ajn::InterfaceDescription::Member* member, ajn::Message& msg) { QCC_UNUSED(member); QCC_DbgTrace(("NotificationProducerReceiver::HandleMethodCall()")); const ajn::MsgArg* args = 0; size_t numArgs = 0; QStatus status = ER_OK; msg->GetArgs(numArgs, args); if (numArgs != 1) { status = ER_INVALID_DATA; goto exit; } int32_t msgId; status = args[0].Get(AJPARAM_INT.c_str(), &msgId); if (status != ER_OK) { goto exit; } QCC_DbgPrintf(("msgId:%d", msgId)); MethodReply(msg, args, 0); #ifdef _WIN32 EnterCriticalSection(&m_Lock); { MsgQueueContent msgQueueContent(msgId); m_MessageQueue.push(msgQueueContent); QCC_DbgPrintf(("HandleMethodCall() - message pushed")); } WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); { MsgQueueContent msgQueueContent(msgId); m_MessageQueue.push(msgQueueContent); QCC_DbgPrintf(("HandleMethodCall() - message pushed")); } pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); #endif exit: if (status != ER_OK) { MethodReply(msg, ER_INVALID_DATA); QCC_LogError(status, ("")); } } void NotificationProducerReceiver::Receiver() { #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { MsgQueueContent message = m_MessageQueue.front(); m_MessageQueue.pop(); QCC_DbgPrintf(("NotificationProducerReceiver::ReceiverThread() - got a message.")); LeaveCriticalSection(&m_Lock); Transport::getInstance()->deleteMsg(message.m_MsgId); sendDismissSignal(message.m_MsgId); EnterCriticalSection(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { //pthread_testcancel(); //for win only? SleepConditionVariableCS(&m_QueueChanged, &m_Lock, INFINITE); } } LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { MsgQueueContent message = m_MessageQueue.front(); m_MessageQueue.pop(); QCC_DbgPrintf(("NotificationProducerReceiver::ReceiverThread() - got a message.")); pthread_mutex_unlock(&m_Lock); Transport::getInstance()->deleteMsg(message.m_MsgId); sendDismissSignal(message.m_MsgId); pthread_mutex_lock(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { pthread_cond_wait(&m_QueueChanged, &m_Lock); } } pthread_mutex_unlock(&m_Lock); #endif } QStatus NotificationProducerReceiver::sendDismissSignal(int32_t msgId) { QCC_DbgTrace(("Notification::sendDismissSignal() called")); QStatus status; MsgArg msgIdArg; msgIdArg.Set(nsConsts::AJPARAM_INT.c_str(), msgId); MsgArg dismisserArgs[nsConsts::AJ_DISMISSER_NUM_PARAMS]; dismisserArgs[0] = msgIdArg; dismisserArgs[1] = m_AppIdArg; /**Code commented below is for future use * In case dismiss signal will not need to be sent via different object path each time. * In that case enable code below and disable next paragraph. * * Transport::getInstance()->getNotificationDismisserSender()->sendSignal(dismisserArgs,nsConsts::TTL_MAX); * if (status != ER_OK) { * QCC_LogError(status,"NotificationAsyncTaskEvents", "sendSignal failed."); * return; * } * * End of paragraph */ /* * Paragraph to be disabled in case dismiss signal will not need to be sent via different object path each time */ String appId; uint8_t* appIdBin; size_t len; m_AppIdArg.Get(AJPARAM_ARR_BYTE.c_str(), &len, &appIdBin); appId = BytesToHexString(appIdBin, len); std::ostringstream stm; stm << abs(msgId); qcc::String objectPath = nsConsts::AJ_NOTIFICATION_DISMISSER_PATH + "/" + appId + "/" + std::string(stm.str()).c_str(); NotificationDismisserSender notificationDismisserSender(Transport::getInstance()->getBusAttachment(), objectPath, status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationDismisserSender.")); } status = Transport::getInstance()->getBusAttachment()->RegisterBusObject(notificationDismisserSender); if (status != ER_OK) { QCC_LogError(status, ("Could not register NotificationDismisserSender.")); return status; } QCC_DbgPrintf(("sendDismissSignal: going to send dismiss signal with object path %s", objectPath.c_str())); status = notificationDismisserSender.sendSignal(dismisserArgs, nsConsts::TTL_MAX); if (status != ER_OK) { QCC_LogError(status, ("Failed to sendSignal")); return status; } Transport::getInstance()->getBusAttachment()->UnregisterBusObject(notificationDismisserSender); /* * End of paragraph */ return status; } base-16.04/notification/cpp/src/NotificationProducerReceiver.h000066400000000000000000000070101272147170000244640ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONPRODUCERRECEIVER_H_ #define NOTIFICATIONPRODUCERRECEIVER_H_ #include "NotificationProducer.h" #include #ifdef _WIN32 #include #define pthread_mutex_t CRITICAL_SECTION #define pthread_cond_t CONDITION_VARIABLE #else #include #endif namespace ajn { namespace services { /** * class MsgQueueContent * */ class MsgQueueContent { public: MsgQueueContent(uint32_t msgId) : m_MsgId(msgId) { } uint32_t m_MsgId; }; /** * class NotificationProducerReceiver * Implements NotificationProducer interface at producer side */ class NotificationProducerReceiver : public ajn::services::NotificationProducer { public: /** * constructor of NotificationProducerReceiver * @param bus attachment * @param status */ NotificationProducerReceiver(ajn::BusAttachment* bus, QStatus& status); /** * destructor of NotificationProducerReceiver */ ~NotificationProducerReceiver(); /** * Handles Dismiss method * @param[in] member * @param[in] msg reference of AllJoyn Message */ void Dismiss(const ajn::InterfaceDescription::Member* member, ajn::Message& msg); /** * SetAppIdArg * @param application id argument */ void SetAppIdArg(MsgArg appIdArg) { m_AppIdArg = appIdArg; } /** * unregisterHandler * @param bus attachment */ void unregisterHandler(BusAttachment* bus); private: /** * implement method calls from notification producer interface */ void HandleMethodCall(const ajn::InterfaceDescription::Member* member, ajn::Message& msg); /** * The thread responsible for receiving the notification */ #ifdef _WIN32 HANDLE m_handle; #else pthread_t m_ReceiverThread; #endif /** * A Queue that holds the messages */ std::queue m_MessageQueue; /** * The mutex Lock */ pthread_mutex_t m_Lock; /** * The Queue Changed thread condition */ pthread_cond_t m_QueueChanged; /** * is the thread in the process of shutting down */ bool m_IsStopping; /** * A wrapper for the receiver Thread * @param context */ static void* ReceiverThreadWrapper(void* context); /** * The function run in the ReceiverThread */ void Receiver(); /** * sendDismissSignal */ QStatus sendDismissSignal(int32_t msgId); /** * appIdArg */ MsgArg m_AppIdArg; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONPRODUCERRECEIVER_H_ */ base-16.04/notification/cpp/src/NotificationProducerSender.cc000066400000000000000000000056501272147170000243060ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include "NotificationProducerSender.h" #include "Transport.h" #include "NotificationConstants.h" #include #include using namespace ajn; using namespace services; using namespace qcc; using namespace nsConsts; NotificationProducerSender::NotificationProducerSender(ajn::BusAttachment* bus, QStatus& status) : NotificationProducer(bus, status, (qcc::String("Sender"))) { /** * Do not add code until the status that returned from the base class is verified. */ if (status != ER_OK) { return; } } NotificationProducerSender::~NotificationProducerSender() { } QStatus NotificationProducerSender::Dismiss(const char* busName, ajn::SessionId sessionId, int32_t mgsId) { QCC_DbgPrintf(("NotificationProducerSender::Dismiss busName:%s sessionId:%u mgsId:%d", busName, sessionId, mgsId)); QStatus status = ER_OK; if (!m_InterfaceDescription) { return ER_FAIL; } ProxyBusObject*proxyBusObj = new ProxyBusObject(*m_BusAttachment, busName, AJ_NOTIFICATION_PRODUCER_PATH.c_str(), sessionId); if (!proxyBusObj) { return ER_FAIL; } status = proxyBusObj->AddInterface(*m_InterfaceDescription); if (status != ER_OK) { QCC_LogError(status, ("MethodCallDismiss - AddInterface.")); delete proxyBusObj; proxyBusObj = NULL; return status; } MsgArg args[1]; Message replyMsg(*m_BusAttachment); args[0].Set(AJPARAM_INT.c_str(), mgsId); status = proxyBusObj->MethodCall(AJ_NOTIFICATION_PRODUCER_INTERFACE.c_str(), AJ_DISMISS_METHOD_NAME.c_str(), args, 1, replyMsg); if (status != ER_OK) { QCC_LogError(status, ("MethodCallDismiss - MethodCall.")); delete proxyBusObj; proxyBusObj = NULL; return status; } delete proxyBusObj; proxyBusObj = NULL; return status; } base-16.04/notification/cpp/src/NotificationProducerSender.h000066400000000000000000000036551272147170000241530ustar00rootroot00000000000000 /****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONPRODUCERSENDER_H_ #define NOTIFICATIONPRODUCERSENDER_H_ #include "NotificationProducer.h" namespace ajn { namespace services { /** * NotificationProducerSender class * Calls NotificationProducer interface methods */ class NotificationProducerSender : public ajn::services::NotificationProducer { public: /** * constructor of NotificationProducerSender * @param bus attachment * @param status */ NotificationProducerSender(ajn::BusAttachment* bus, QStatus& status); /** * destructor of NotificationProducerSender */ ~NotificationProducerSender(); /* * calls method Dismiss at the producer side * @param bus attachment * @param relevant session id * @param elevant message id * @return status */ QStatus Dismiss(const char* busName, ajn::SessionId sessionId, int32_t mgsId); private: }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONPRODUCERSENDER_H_ */ base-16.04/notification/cpp/src/NotificationReceiver.cc000066400000000000000000000021401272147170000231150ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include base-16.04/notification/cpp/src/NotificationSender.cc000066400000000000000000000111571272147170000226010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "PayloadAdapter.h" #include "Transport.h" #include "NotificationConstants.h" #include #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationSender::NotificationSender(AboutData* aboutdata) : m_aboutdata(aboutdata), m_PropertyStore(NULL) { } NotificationSender::NotificationSender(PropertyStore* propertyStore) : m_aboutdata(NULL), m_PropertyStore(propertyStore) { } QStatus NotificationSender::send(Notification const& notification, uint16_t ttl) { QCC_DbgTrace(("Send Message called")); //Validations if (notification.getMessageType() < 0 || notification.getMessageType() >= MESSAGE_TYPE_CNT) { QCC_LogError(ER_BAD_ARG_1, ("MessageType sent is not a valid MessageType")); return ER_BAD_ARG_1; } if (notification.getText().size() == 0) { QCC_LogError(ER_BAD_ARG_1, ("There must be at least one notification defined")); return ER_BAD_ARG_1; } else if ((TTL_MIN > ttl) || (ttl > TTL_MAX)) { // ttl value is not in range QCC_LogError(ER_BAD_ARG_2, ("TTL sent is not a valid TTL value")); return ER_BAD_ARG_2; } ajn::BusAttachment* pBus = Transport::getInstance()->getBusAttachment(); String originalSender = pBus ? pBus->GetUniqueName() : ""; if (m_aboutdata) { return PayloadAdapter::sendPayload(m_aboutdata, notification.getMessageType(), notification.getText(), notification.getCustomAttributes(), ttl, notification.getRichIconUrl(), notification.getRichAudioUrl(), notification.getRichIconObjectPath(), notification.getRichAudioObjectPath(), notification.getControlPanelServiceObjectPath(), originalSender.c_str()); } if (m_PropertyStore) { return PayloadAdapter::sendPayload(m_PropertyStore, notification.getMessageType(), notification.getText(), notification.getCustomAttributes(), ttl, notification.getRichIconUrl(), notification.getRichAudioUrl(), notification.getRichIconObjectPath(), notification.getRichAudioObjectPath(), notification.getControlPanelServiceObjectPath(), originalSender.c_str()); } return ER_FAIL; } QStatus NotificationSender::deleteLastMsg(NotificationMessageType messageType) { QCC_DbgTrace(("Delete Last Message called")); //Validation if (messageType < 0 || messageType >= MESSAGE_TYPE_CNT) { QCC_LogError(ER_BAD_ARG_1, ("MessageType sent is not a valid MessageType")); return ER_BAD_ARG_1; } Transport* transport = Transport::getInstance(); return transport->deleteLastMsg(messageType); } QStatus NotificationSender::getLastMsgId(NotificationMessageType messageType, int32_t* messageId) { QCC_DbgTrace(("Get Last Message Id called")); if (messageType < 0 || messageType >= MESSAGE_TYPE_CNT) { QCC_LogError(ER_BAD_ARG_1, ("MessageType sent is not a valid MessageType")); return ER_BAD_ARG_1; } Transport* transport = Transport::getInstance(); return transport->getLastMsgId(messageType, messageId); } base-16.04/notification/cpp/src/NotificationService.cc000066400000000000000000000156541272147170000227670ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include "NotificationConstants.h" #include "Transport.h" #include "NotificationProducerReceiver.h" #include using namespace ajn; using namespace services; using namespace qcc; using namespace nsConsts; NotificationService* NotificationService::s_Instance(NULL); uint16_t const NotificationService::NOTIFICATION_SERVICE_VERSION = 2; NotificationService* NotificationService::getInstance() { if (!s_Instance) { s_Instance = new NotificationService(); } return s_Instance; } NotificationService::NotificationService() { } NotificationService::~NotificationService() { } uint16_t NotificationService::getVersion() { return NOTIFICATION_SERVICE_VERSION; } NotificationSender* NotificationService::initSend(BusAttachment* bus, AboutData* store) { QCC_DbgTrace(("NotificationService::initSend")); if (!bus) { QCC_DbgHLPrintf(("BusAttachment cannot be NULL")); return NULL; } if (!store) { QCC_DbgHLPrintf(("PropertyStore cannot be NULL")); return NULL; } Transport* transport = Transport::getInstance(); if (transport->startSenderTransport(bus) != ER_OK) { return NULL; } MsgArg configArgs; MsgArg* configEntries; size_t configNum = 0; QStatus status; if ((status = store->GetAboutData(&configArgs))) { QCC_LogError(status, ("Error reading all in configuration data")); return NULL; } if ((status = configArgs.Get(AJPARAM_ARR_DICT_STR_VAR.c_str(), &configNum, &configEntries))) { QCC_LogError(status, ("Error reading in configuration data")); return NULL; } MsgArg appIdArg; for (size_t i = 0; i < configNum; i++) { char* keyChar; String key; MsgArg* variant; status = configEntries[i].Get(AJPARAM_DICT_STR_VAR.c_str(), &keyChar, &variant); if (status != ER_OK) { QCC_LogError(status, ("Error reading in configuration data")); return NULL; } key = keyChar; if (key.compare("AppId") == 0) { appIdArg = *variant; } } if (status != ER_OK) { QCC_LogError(status, ("Something went wrong unmarshalling the propertystore.")); return NULL; } if (appIdArg.typeId != ALLJOYN_BYTE_ARRAY) { QCC_DbgHLPrintf(("ApplicationId argument is not correct type.")); return NULL; } transport->getNotificationProducerReceiver()->SetAppIdArg(appIdArg); return new NotificationSender(store); } NotificationSender* NotificationService::initSend(BusAttachment* bus, PropertyStore* store) { QCC_DbgTrace(("NotificationService::initSend")); if (!bus) { QCC_DbgHLPrintf(("BusAttachment cannot be NULL")); return NULL; } if (!store) { QCC_DbgHLPrintf(("PropertyStore cannot be NULL")); return NULL; } Transport* transport = Transport::getInstance(); if (transport->startSenderTransport(bus) != ER_OK) { return NULL; } MsgArg configArgs[1]; MsgArg* configEntries; size_t configNum = 0; QStatus status; if ((status = store->ReadAll(0, PropertyStore::READ, configArgs[0]))) { QCC_LogError(status, ("Error reading all in configuration data")); return NULL; } if ((status = configArgs[0].Get(AJPARAM_ARR_DICT_STR_VAR.c_str(), &configNum, &configEntries))) { QCC_LogError(status, ("Error reading in configuration data")); return NULL; } MsgArg appIdArg; for (size_t i = 0; i < configNum; i++) { char* keyChar; String key; MsgArg* variant; status = configEntries[i].Get(AJPARAM_DICT_STR_VAR.c_str(), &keyChar, &variant); if (status != ER_OK) { QCC_LogError(status, ("Error reading in configuration data")); return NULL; } key = keyChar; if (key.compare("AppId") == 0) { appIdArg = *variant; } } if (status != ER_OK) { QCC_LogError(status, ("Something went wrong unmarshalling the propertystore.")); return NULL; } if (appIdArg.typeId != ALLJOYN_BYTE_ARRAY) { QCC_DbgHLPrintf(("ApplicationId argument is not correct type.")); return NULL; } transport->getNotificationProducerReceiver()->SetAppIdArg(appIdArg); return new NotificationSender(store); } QStatus NotificationService::initReceive(ajn::BusAttachment* bus, NotificationReceiver* notificationReceiver) { if (!bus) { QCC_LogError(ER_BAD_ARG_1, ("BusAttachment cannot be NULL.")); return ER_BAD_ARG_1; } if (!notificationReceiver) { QCC_LogError(ER_BAD_ARG_2, ("Could not set NotificationReceiver to null pointer")); return ER_BAD_ARG_2; } QCC_DbgPrintf(("Init receive")); Transport* transport = Transport::getInstance(); transport->setNotificationReceiver(notificationReceiver); QStatus status; if ((status = transport->startReceiverTransport(bus)) != ER_OK) { transport->setNotificationReceiver(0); } return status; } void NotificationService::shutdownSender() { QCC_DbgTrace(("Stop Sender")); Transport* transport = Transport::getInstance(); transport->cleanupSenderTransport(); } void NotificationService::shutdownReceiver() { QCC_DbgTrace(("Stop Receiver")); Transport* transport = Transport::getInstance(); transport->cleanupReceiverTransport(); } void NotificationService::shutdown() { QCC_DbgTrace(("Shutdown")); Transport* transport = Transport::getInstance(); transport->cleanup(); s_Instance = 0; delete this; } BusAttachment* NotificationService::getBusAttachment() { QCC_DbgTrace(("In Get BusAttachment")); Transport* transport = Transport::getInstance(); return transport->getBusAttachment(); } base-16.04/notification/cpp/src/NotificationText.cc000066400000000000000000000030101272147170000222720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include using namespace ajn; using namespace services; using namespace qcc; NotificationText::NotificationText(String const& language, String const& text) { m_Language = language; m_Text = text; } void NotificationText::setLanguage(String const& language) { m_Language = language; } String const& NotificationText::getLanguage() const { return m_Language; } void NotificationText::setText(String const& text) { m_Text = text; } String const& NotificationText::getText() const { return m_Text; } base-16.04/notification/cpp/src/NotificationTransport.cc000066400000000000000000000074721272147170000233620ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "NotificationTransport.h" #include "NotificationConstants.h" #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationTransport::NotificationTransport(ajn::BusAttachment* bus, qcc::String const& servicePath, QStatus& status, String const& interfaceName) : BusObject(servicePath.c_str()), m_SignalMethod(0) { InterfaceDescription* intf = NULL; status = bus->CreateInterface(interfaceName.c_str(), intf); if (status == ER_OK) { status = intf->AddSignal(AJ_SIGNAL_METHOD.c_str(), AJ_NOTIFY_PARAMS.c_str(), AJ_NOTIFY_PARAM_NAMES.c_str(), 0); if (status != ER_OK) { QCC_LogError(status, ("AddSignal failed.")); return; } // Mark the signal as sessionless. status = intf->SetMemberDescription(AJ_SIGNAL_METHOD.c_str(), AJ_NOTIFY_SIGNAL_DESCRIPTION.c_str(), true); if (status != ER_OK) { QCC_LogError(status, ("SetMemberDescription failed.")); return; } status = intf->AddProperty(AJ_PROPERTY_VERSION.c_str(), AJPARAM_UINT16.c_str(), PROP_ACCESS_READ); if (status != ER_OK) { QCC_LogError(status, ("AddProperty failed.")); return; } intf->Activate(); } else if (status == ER_BUS_IFACE_ALREADY_EXISTS) { intf = (InterfaceDescription*) bus->GetInterface(interfaceName.c_str()); if (!intf) { status = ER_BUS_UNKNOWN_INTERFACE; QCC_LogError(status, ("Could not get interface")); return; } } else { QCC_LogError(status, ("Could not create interface")); return; } status = AddInterface(*intf, ANNOUNCED); if (status != ER_OK) { QCC_LogError(status, ("Could not add interface")); return; } // Get the signal method for future use m_SignalMethod = intf->GetMember(AJ_SIGNAL_METHOD.c_str()); } NotificationTransport::~NotificationTransport() { } QStatus NotificationTransport::Get(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_DbgTrace(("Get property was called")); if (0 != strcmp(AJ_PROPERTY_VERSION.c_str(), propName)) { QCC_LogError(ER_BUS_NO_SUCH_PROPERTY, ("Called for property different than version.")); return ER_BUS_NO_SUCH_PROPERTY; } val.typeId = ALLJOYN_UINT16; val.v_uint16 = NotificationService::getVersion(); return ER_OK; } QStatus NotificationTransport::Set(const char* ifcName, const char* propName, MsgArg& val) { QCC_UNUSED(ifcName); QCC_UNUSED(propName); QCC_UNUSED(val); return ER_ALLJOYN_ACCESS_PERMISSION_ERROR; } base-16.04/notification/cpp/src/NotificationTransport.h000066400000000000000000000050221272147170000232110ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONTRANSPORT_H_ #define NOTIFICATIONTRANSPORT_H_ #include #include #include namespace ajn { namespace services { /** * A class implementing the BusObject used to create the Notification interface * and register it on the bus */ class NotificationTransport : public ajn::BusObject { public: /** * Constructor for NotificationTransport. Creates Interface and prepares * infrastructure to be able to send Signal * @param bus - BusAttachment that is used * @param servicePath - servicePath of BusObject * @param status - success/failure */ NotificationTransport(ajn::BusAttachment* bus, qcc::String const& servicePath, QStatus& status, qcc::String const& interfaceName); /** * Destructor for NotificationTransport */ virtual ~NotificationTransport() = 0; /** * Callback for GetProperty * @param ifcName * @param propName * @param val * @return */ QStatus Get(const char* ifcName, const char* propName, ajn::MsgArg& val); /** * Callback for SetProperty * @param ifcName * @param propName * @param val * @return */ QStatus Set(const char* ifcName, const char* propName, ajn::MsgArg& val); protected: /** * The pointer used to send signal/register Signal Handler */ const ajn::InterfaceDescription::Member* m_SignalMethod; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONTRANSPORT_H_ */ base-16.04/notification/cpp/src/NotificationTransportConsumer.cc000066400000000000000000000147521272147170000250750ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include "NotificationTransportConsumer.h" #include "NotificationConstants.h" #include "PayloadAdapter.h" #include #ifdef _WIN32 #include #endif using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationTransportConsumer::NotificationTransportConsumer( BusAttachment* bus, String const& servicePath, QStatus& status) : NotificationTransport(bus, servicePath, status, AJ_NOTIFICATION_INTERFACE_NAME), m_IsStopping(false) { if (status != ER_OK) { return; } #ifdef _WIN32 InitializeCriticalSection(&m_Lock); InitializeConditionVariable(&m_QueueChanged); status = bus->RegisterSignalHandler(this, static_cast(&NotificationTransportConsumer::handleSignal), m_SignalMethod, NULL); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } else { QCC_DbgPrintf(("Registered the SignalHandler successfully")); } m_handle = reinterpret_cast(_beginthreadex(NULL, 256 * 1024, (unsigned int (__stdcall*)(void*))ReceiverThreadWrapper, this, 0, NULL)); #else pthread_mutex_init(&m_Lock, NULL); pthread_cond_init(&m_QueueChanged, NULL); status = bus->RegisterSignalHandler(this, static_cast(&NotificationTransportConsumer::handleSignal), m_SignalMethod, NULL); if (status != ER_OK) { QCC_LogError(status, ("Could not register the SignalHandler")); } else { QCC_DbgPrintf(("Registered the SignalHandler successfully")); } pthread_create(&m_ReceiverThread, NULL, ReceiverThreadWrapper, this); #endif } void NotificationTransportConsumer::handleSignal(const InterfaceDescription::Member* member, const char* srcPath, Message& msg) { QCC_UNUSED(member); QCC_UNUSED(srcPath); QCC_DbgPrintf(("Received Message from producer.")); #ifdef _WIN32 EnterCriticalSection(&m_Lock); m_MessageQueue.push(msg); WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); m_MessageQueue.push(msg); pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); #endif } void NotificationTransportConsumer::unregisterHandler(BusAttachment* bus) { #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; WakeConditionVariable(&m_QueueChanged); LeaveCriticalSection(&m_Lock); WaitForSingleObject(m_handle, INFINITE); CloseHandle(m_handle); bus->UnregisterSignalHandler(this, static_cast(&NotificationTransportConsumer::handleSignal), m_SignalMethod, NULL); DeleteCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_MessageQueue.empty()) { m_MessageQueue.pop(); } m_IsStopping = true; pthread_cond_signal(&m_QueueChanged); pthread_mutex_unlock(&m_Lock); pthread_join(m_ReceiverThread, NULL); bus->UnregisterSignalHandler(this, static_cast(&NotificationTransportConsumer::handleSignal), m_SignalMethod, NULL); pthread_cond_destroy(&m_QueueChanged); pthread_mutex_destroy(&m_Lock); #endif } void* NotificationTransportConsumer::ReceiverThreadWrapper(void* context) { NotificationTransportConsumer* consumer = reinterpret_cast(context); if (consumer == NULL) { // should not happen return NULL; } consumer->ReceiverThread(); return NULL; } void NotificationTransportConsumer::ReceiverThread() { #ifdef _WIN32 EnterCriticalSection(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { Message message = m_MessageQueue.front(); m_MessageQueue.pop(); LeaveCriticalSection(&m_Lock); PayloadAdapter::receivePayload(message); EnterCriticalSection(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { SleepConditionVariableCS(&m_QueueChanged, &m_Lock, INFINITE); } } LeaveCriticalSection(&m_Lock); #else pthread_mutex_lock(&m_Lock); while (!m_IsStopping) { while (!m_MessageQueue.empty()) { Message message = m_MessageQueue.front(); m_MessageQueue.pop(); pthread_mutex_unlock(&m_Lock); PayloadAdapter::receivePayload(message); pthread_mutex_lock(&m_Lock); } // it's possible m_IsStopping changed while executing OnTask() (which is done unlocked) // therefore we have to check it again here, otherwise we potentially deadlock here if (!m_IsStopping) { pthread_cond_wait(&m_QueueChanged, &m_Lock); } } pthread_mutex_unlock(&m_Lock); #endif } base-16.04/notification/cpp/src/NotificationTransportConsumer.h000066400000000000000000000062631272147170000247350ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONTRANSPORTCONSUMER_H_ #define NOTIFICATIONTRANSPORTCONSUMER_H_ #include #ifdef _WIN32 #include #define pthread_mutex_t CRITICAL_SECTION #define pthread_cond_t CONDITION_VARIABLE #else #include #endif #include "NotificationTransport.h" namespace ajn { namespace services { /** * Notification Transport Consumer. Used to Create the Notification Interface * on the receiver side and register a signal handler to receive the notify signals */ class NotificationTransportConsumer : public NotificationTransport { public: /** * Constructor for TransportConsumer * @param bus - BusAttachment that is used * @param servicePath - servicePath of BusObject * @param status - success/failure */ NotificationTransportConsumer(ajn::BusAttachment* bus, qcc::String const& servicePath, QStatus& status); /** * Destructor of TransportConsumer */ ~NotificationTransportConsumer() { }; /** * Callback when Signal arrives * @param member Method or signal interface member entry. * @param srcPath Object path of signal emitter. * @param message The received message. */ void handleSignal(const ajn::InterfaceDescription::Member* member, const char* srcPath, ajn::Message& msg); void unregisterHandler(ajn::BusAttachment* bus); private: /** * The thread responsible for receiving the notification */ #ifdef _WIN32 HANDLE m_handle; #else pthread_t m_ReceiverThread; #endif /** * A Queue that holds the messages */ std::queue m_MessageQueue; /** * The mutex Lock */ pthread_mutex_t m_Lock; /** * The Queue Changed thread condition */ pthread_cond_t m_QueueChanged; /** * is the thread in the process of shutting down */ bool m_IsStopping; /** * A wrapper for the receiver Thread * @param context */ static void* ReceiverThreadWrapper(void* context); /** * The function run in the ReceiverThread */ void ReceiverThread(); }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONTRANSPORTCONSUMER_H_ */ base-16.04/notification/cpp/src/NotificationTransportProducer.cc000066400000000000000000000106071272147170000250600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include "NotificationTransportProducer.h" #include "NotificationConstants.h" #include "Transport.h" #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; NotificationTransportProducer::NotificationTransportProducer(BusAttachment* bus, String const& servicePath, QStatus& status, qcc::String const& interfaceName, uint32_t serialNumber) : NotificationTransport(bus, servicePath, status, interfaceName), m_SerialNumber(serialNumber), m_MsgId(0) { } QStatus NotificationTransportProducer::sendSignal(ajn::MsgArg const notificationArgs[AJ_NOTIFY_NUM_PARAMS], uint16_t ttl) { if (m_SignalMethod == 0) { QCC_LogError(ER_BUS_INTERFACE_NO_SUCH_MEMBER, ("signalMethod not set. Can't send signal")); return ER_BUS_INTERFACE_NO_SUCH_MEMBER; } uint8_t flags = ALLJOYN_FLAG_SESSIONLESS; Message msg(*Transport::getInstance()->getBusAttachment()); m_MsgId = notificationArgs[1].v_int32; //grab message id from payload. QStatus status = Signal(NULL, 0, *m_SignalMethod, notificationArgs, AJ_NOTIFY_NUM_PARAMS, ttl, flags, &msg); if (status != ER_OK) { QCC_LogError(status, ("Could not send signal.")); return status; } m_SerialNumber = msg->GetCallSerial(); QCC_DbgPrintf(("Sent signal successfully")); return status; } QStatus NotificationTransportProducer::deleteLastMsg(NotificationMessageType messageType) { QCC_UNUSED(messageType); if (m_SerialNumber == 0) { QCC_LogError(ER_BUS_INVALID_HEADER_SERIAL, ("Unable to delete the last message. No message on this object.")); return ER_BUS_INVALID_HEADER_SERIAL; } QStatus status = CancelSessionlessMessage(m_SerialNumber); if (status != ER_OK) { QCC_LogError(status, ("Could not delete last message.")); return status; } m_SerialNumber = 0; m_MsgId = 0; QCC_DbgPrintf(("Deleted last message successfully")); return status; } QStatus NotificationTransportProducer::getLastMsgId(NotificationMessageType messageType, int32_t* messageId) { QCC_UNUSED(messageType); QCC_DbgTrace(("NotificationTransportProducer::getLastMsgId()")); if (m_SerialNumber == 0) { QCC_LogError(ER_BUS_INVALID_HEADER_SERIAL, ("No message on this object.")); return ER_BUS_INVALID_HEADER_SERIAL; } *messageId = m_MsgId; return ER_OK; } QStatus NotificationTransportProducer::deleteMsg(int32_t msgId) { QCC_DbgTrace(("NotificationTransportProducer::deleteMsg()")); if (m_SerialNumber == 0) { return ER_BUS_INVALID_HEADER_SERIAL; } if (m_MsgId != msgId) { QCC_LogError(ER_BUS_INVALID_HEADER_SERIAL, ("Unable to delete the message. No such message id on this object.")); return ER_BUS_INVALID_HEADER_SERIAL; } QStatus status = CancelSessionlessMessage(m_SerialNumber); if (status != ER_OK) { QCC_LogError(status, ("Could not delete last message.")); return status; } m_SerialNumber = 0; m_MsgId = 0; QCC_DbgPrintf(("Deleted last message successfully")); return status; } base-16.04/notification/cpp/src/NotificationTransportProducer.h000066400000000000000000000065411272147170000247240ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef NOTIFICATIONTRANSPORTPRODUCER_H_ #define NOTIFICATIONTRANSPORTPRODUCER_H_ #include #include "NotificationTransport.h" #include "NotificationConstants.h" namespace ajn { namespace services { /** * Notification Transport Producer. Used to Create the Notification Interface * on the producers side and send the notify signals */ class NotificationTransportProducer : public NotificationTransport { public: /** * Constructor for TransportProducer. Creates Interface and prepares * infrastructure to be able to send Signal * @param bus - BusAttachment that is used * @param servicePath - servicePath of BusObject * @param status - success/failure * @param m_serialNumber - serial number of the last successful message on the bus */ NotificationTransportProducer(ajn::BusAttachment* bus, qcc::String const& servicePath, QStatus& status, qcc::String const& interfaceName = nsConsts::AJ_NOTIFICATION_INTERFACE_NAME, uint32_t serialNumber = 0); /** * Destructor for TransportProducer */ ~NotificationTransportProducer() { }; /** * Send Signal over Bus. * @param notificationArgs * @param ttl * @return status */ QStatus sendSignal(ajn::MsgArg const notificationArgs[nsConsts::AJ_NOTIFY_NUM_PARAMS], uint16_t ttl); /** * delete last message * @param type of message to delete * @return status */ QStatus deleteLastMsg(NotificationMessageType messageType); /** * Delete Signal sent off for this messageType * @param messageId * @return status */ QStatus deleteMsg(int32_t msgId); /** * get the notification id of the last message sent with the given MessageType * @param messageType type of message * @param messageId pointer to hold the notification id of the last message * @return status */ QStatus getLastMsgId(NotificationMessageType messageType, int32_t* messageId); private: /** * Serial Number of the last message sent with this message type */ uint32_t m_SerialNumber; /** * message Id of the last message sent with this message type */ int32_t m_MsgId; }; } //namespace services } //namespace ajn #endif /* NOTIFICATIONTRANSPORTPRODUCER_H_ */ base-16.04/notification/cpp/src/PayloadAdapter.cc000066400000000000000000000647551272147170000217200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include #include "NotificationConstants.h" #include "PayloadAdapter.h" #include "Transport.h" #include using namespace qcc; using namespace ajn; using namespace services; using namespace nsConsts; int32_t PayloadAdapter::m_MessageId(0); QStatus PayloadAdapter::sendPayload(const char* deviceId, const char* deviceName, const uint8_t* appId, size_t appIdlen, const char* appName, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender, int32_t messageId) { MsgArg deviceIdArg; MsgArg deviceNameArg; MsgArg appIdArg; MsgArg appNameArg; QStatus status; do { CHECK(deviceIdArg.Set(AJPARAM_STR.c_str(), deviceId)); CHECK(deviceNameArg.Set(AJPARAM_STR.c_str(), deviceName)); CHECK(appIdArg.Set(AJPARAM_ARR_BYTE.c_str(), appIdlen, appId)); CHECK(appNameArg.Set(AJPARAM_STR.c_str(), appName)); return(sendPayload(deviceIdArg, deviceNameArg, appIdArg, appNameArg, messageType, notificationText, customAttributes, ttl, richIconUrl, richAudioUrl, richIconObjectPath, richAudioObjectPath, controlPanelServiceObjectPath, originalSender, messageId)); } while (0); QCC_LogError(status, ("Error occurred. Could not marshal parameters.")); return status; } QStatus PayloadAdapter::sendPayload(AboutData* propertyStore, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender) { MsgArg deviceIdArg; MsgArg deviceNameArg; MsgArg appIdArg; MsgArg appNameArg; if (!m_MessageId) { srand(time(NULL)); m_MessageId = rand(); } MsgArg configArgs; MsgArg* configEntries; size_t configNum; QStatus status; if ((status = propertyStore->GetAboutData(&configArgs))) { return status; } if ((status = configArgs.Get(AJPARAM_ARR_DICT_STR_VAR.c_str(), &configNum, &configEntries))) { QCC_LogError(status, ("Error reading in about configuration data")); return status; } for (size_t i = 0; i < configNum; i++) { char* keyChar; String key; MsgArg* variant; CHECK(configEntries[i].Get(AJPARAM_DICT_STR_VAR.c_str(), &keyChar, &variant)); key = keyChar; if (key.compare("DeviceId") == 0) { deviceIdArg = *variant; } else if (key.compare("DeviceName") == 0) { deviceNameArg = *variant; } else if (key.compare("AppId") == 0) { appIdArg = *variant; } else if (key.compare("AppName") == 0) { appNameArg = *variant; } } if (status != ER_OK) { QCC_LogError(status, ("Something went wrong unmarshalling the propertystore.")); return status; } /* Validate Arguments */ if (deviceIdArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("DeviceId argument is not correct type.")); return ER_BAD_ARG_1; } if (deviceIdArg.v_string.str == 0 || deviceIdArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("DeviceId argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } if (deviceNameArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("DeviceName argument is not correct type.")); return ER_BAD_ARG_1; } if (deviceNameArg.v_string.str == 0 || deviceNameArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("DeviceName argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } if (appIdArg.typeId != ALLJOYN_BYTE_ARRAY) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationId argument is not correct type.")); return ER_BAD_ARG_1; } if (appIdArg.v_scalarArray.numElements == 0) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationId argument cannot be empty")); return ER_BAD_ARG_1; } if (appNameArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationName argument is not correct type.")); return ER_BAD_ARG_1; } if (appNameArg.v_string.str == 0 || appNameArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationName argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } return (sendPayload(deviceIdArg, deviceNameArg, appIdArg, appNameArg, messageType, notificationText, customAttributes, ttl, richIconUrl, richAudioUrl, richIconObjectPath, richAudioObjectPath, controlPanelServiceObjectPath, originalSender, ++m_MessageId)); } QStatus PayloadAdapter::sendPayload(PropertyStore* propertyStore, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender) { MsgArg deviceIdArg; MsgArg deviceNameArg; MsgArg appIdArg; MsgArg appNameArg; if (!m_MessageId) { srand(time(NULL)); m_MessageId = rand(); } MsgArg configArgs[1]; MsgArg* configEntries; size_t configNum; QStatus status; if ((status = propertyStore->ReadAll(0, PropertyStore::READ, configArgs[0]))) { return status; } if ((status = configArgs[0].Get(AJPARAM_ARR_DICT_STR_VAR.c_str(), &configNum, &configEntries))) { QCC_LogError(status, ("Error reading in about configuration data")); return status; } for (size_t i = 0; i < configNum; i++) { char* keyChar; String key; MsgArg* variant; CHECK(configEntries[i].Get(AJPARAM_DICT_STR_VAR.c_str(), &keyChar, &variant)); key = keyChar; if (key.compare("DeviceId") == 0) { deviceIdArg = *variant; } else if (key.compare("DeviceName") == 0) { deviceNameArg = *variant; } else if (key.compare("AppId") == 0) { appIdArg = *variant; } else if (key.compare("AppName") == 0) { appNameArg = *variant; } } if (status != ER_OK) { QCC_LogError(status, ("Something went wrong unmarshalling the propertystore.")); return status; } /* Validate Arguments */ if (deviceIdArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("DeviceId argument is not correct type.")); return ER_BAD_ARG_1; } if (deviceIdArg.v_string.str == 0 || deviceIdArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("DeviceId argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } if (deviceNameArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("DeviceName argument is not correct type.")); return ER_BAD_ARG_1; } if (deviceNameArg.v_string.str == 0 || deviceNameArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("DeviceName argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } if (appIdArg.typeId != ALLJOYN_BYTE_ARRAY) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationId argument is not correct type.")); return ER_BAD_ARG_1; } if (appIdArg.v_scalarArray.numElements == 0) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationId argument cannot be empty")); return ER_BAD_ARG_1; } if (appNameArg.typeId != ALLJOYN_STRING) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationName argument is not correct type.")); return ER_BAD_ARG_1; } if (appNameArg.v_string.str == 0 || appNameArg.v_string.len == 0) { QCC_LogError(ER_BAD_ARG_1, ("ApplicationName argument can not be NULL or an empty String.")); return ER_BAD_ARG_1; } return (sendPayload(deviceIdArg, deviceNameArg, appIdArg, appNameArg, messageType, notificationText, customAttributes, ttl, richIconUrl, richAudioUrl, richIconObjectPath, richAudioObjectPath, controlPanelServiceObjectPath, originalSender, ++m_MessageId)); } QStatus PayloadAdapter::sendPayload(ajn::MsgArg deviceIdArg, ajn::MsgArg deviceNameArg, ajn::MsgArg appIdArg, ajn::MsgArg appNameArg, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender, int32_t messageId) { QStatus status; MsgArg versionArg; MsgArg messageIdArg; MsgArg messageTypeArg; MsgArg richIconUrlArg; MsgArg richAudioArg; MsgArg richIconObjectPathArg; MsgArg richAudioObjectPathArg; MsgArg controlPanelServiceObjectPathArg; MsgArg originalSenderArg; do { CHECK(versionArg.Set(AJPARAM_UINT16.c_str(), NotificationService::getVersion())); CHECK(messageIdArg.Set(AJPARAM_INT.c_str(), messageId)); CHECK(messageTypeArg.Set(AJPARAM_UINT16.c_str(), messageType)); int32_t attrSize = 1; if (richIconUrl) { attrSize++; } if (!richAudioUrl.empty()) { attrSize++; } if (richIconObjectPath) { attrSize++; } if (richAudioObjectPath) { attrSize++; } if (controlPanelServiceObjectPath) { attrSize++; } std::vector attributes(attrSize); std::vector::const_iterator contIter; std::vector audioContent(richAudioUrl.size()); int32_t attrIndx = 0; CHECK(originalSenderArg.Set(AJPARAM_STR.c_str(), originalSender)) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), ORIGINAL_SENDER_ATTRIBUTE_KEY, &originalSenderArg)); if (richIconUrl) { CHECK(richIconUrlArg.Set(AJPARAM_STR.c_str(), richIconUrl)) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), RICH_CONTENT_ICON_URL_ATTRIBUTE_KEY, &richIconUrlArg)); } if (!richAudioUrl.empty()) { /* Fill the audioContent array using the richAudioUrl passed in Then Marshal attributes argument */ int32_t audioIndx = 0; for (contIter = richAudioUrl.begin(); contIter != richAudioUrl.end(); contIter++) { if (!(contIter->getLanguage().size()) || !(contIter->getUrl().size())) { QCC_LogError(ER_BAD_ARG_7, ("Problem sending message. Cannot send a message with audio content with an empty language/url values.")); return ER_BAD_ARG_7; } CHECK(audioContent[audioIndx++].Set(AJPARAM_STRUCT_STR_STR.c_str(), contIter->getLanguage().c_str(), contIter->getUrl().c_str())); } if (status != ER_OK) { break; } CHECK(richAudioArg.Set(AJPARAM_ARR_STRUCT_STR_STR.c_str(), audioContent.size(), audioContent.data())) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), RICH_CONTENT_AUDIO_URL_ATTRIBUTE_KEY, &richAudioArg)); } if (richIconObjectPath) { CHECK(richIconObjectPathArg.Set(AJPARAM_STR.c_str(), richIconObjectPath)) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), RICH_CONTENT_ICON_OBJECT_PATH_ATTRIBUTE_KEY, &richIconObjectPathArg)); } if (richAudioObjectPath) { CHECK(richAudioObjectPathArg.Set(AJPARAM_STR.c_str(), richAudioObjectPath)) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), RICH_CONTENT_AUDIO_OBJECT_PATH_ATTRIBUTE_KEY, &richAudioObjectPathArg)); } if (controlPanelServiceObjectPath) { CHECK(controlPanelServiceObjectPathArg.Set(AJPARAM_STR.c_str(), controlPanelServiceObjectPath)) CHECK(attributes[attrIndx++].Set(AJPARAM_DICT_INT_VAR.c_str(), CPS_OBJECT_PATH_ATTRIBUTE_KEY, &controlPanelServiceObjectPathArg)); } if (status != ER_OK) { break; } MsgArg attributesArg; CHECK(attributesArg.Set(AJPARAM_ARR_DICT_INT_VAR.c_str(), attrSize, attributes.data())); /* Fill the custom attributes array then using customAttributes Then Marshal the custom attributes argument */ int32_t customAttrIndx = 0; std::vector sendCustomAttributes(customAttributes.size()); std::map::const_iterator cAiter; for (cAiter = customAttributes.begin(); cAiter != customAttributes.end(); cAiter++) { CHECK(sendCustomAttributes[customAttrIndx++].Set(AJPARAM_DICT_STR_STR.c_str(), cAiter->first.c_str(), cAiter->second.c_str())); } if (status != ER_OK) { break; } MsgArg customAttributesArg; CHECK(customAttributesArg.Set(AJPARAM_ARR_DICT_STR_STR.c_str(), customAttributes.size(), sendCustomAttributes.data())); /* Fill the notificationText array using the notifications passed in Then Marshal notificationText argument */ int32_t notifIndx = 0; std::vector::const_iterator notIter; std::vector notifications(notificationText.size()); for (notIter = notificationText.begin(); notIter != notificationText.end(); notIter++) { if (!(notIter->getLanguage().size()) || !(notIter->getText().size())) { QCC_LogError(ER_BAD_ARG_6, ("Problem sending message. Cannot send a message with an empty language/text values.")); return ER_BAD_ARG_6; } CHECK(notifications[notifIndx++].Set(AJPARAM_STRUCT_STR_STR.c_str(), notIter->getLanguage().c_str(), notIter->getText().c_str())); } if (status != ER_OK) { break; } MsgArg notificationTextArg; CHECK(notificationTextArg.Set(AJPARAM_ARR_STRUCT_STR_STR.c_str(), notificationText.size(), notifications.data())); MsgArg notificationArgs[AJ_NOTIFY_NUM_PARAMS]; notificationArgs[0] = versionArg; notificationArgs[1] = messageIdArg; notificationArgs[2] = messageTypeArg; notificationArgs[3] = deviceIdArg; notificationArgs[4] = deviceNameArg; notificationArgs[5] = appIdArg; notificationArgs[6] = appNameArg; notificationArgs[7] = attributesArg; notificationArgs[8] = customAttributesArg; notificationArgs[9] = notificationTextArg; QCC_DbgPrintf(("Attempting to send messageId: %d", messageId)); Transport* transport = Transport::getInstance(); status = transport->sendNotification(messageType, notificationArgs, ttl); if (status == ER_OK) { QCC_DbgHLPrintf(("Message sent successfully with messageId: %d", messageId)); } return status; } while (0); QCC_LogError(status, ("Error occurred. Could not marshal parameters.")); return status; } void PayloadAdapter::receivePayload(Message& msg) { QStatus status; const MsgArg* versionArg = msg.unwrap()->GetArg(0); const MsgArg* messageIdArg = msg.unwrap()->GetArg(1); const MsgArg* messageTypeArg = msg.unwrap()->GetArg(2); const MsgArg* deviceIdArg = msg.unwrap()->GetArg(3); const MsgArg* deviceNameArg = msg.unwrap()->GetArg(4); const MsgArg* appIdArg = msg.unwrap()->GetArg(5); const MsgArg* appNameArg = msg.unwrap()->GetArg(6); const MsgArg* attributesArg = msg.unwrap()->GetArg(7); const MsgArg* customAttributesArg = msg.unwrap()->GetArg(8); const MsgArg* notificationsArg = msg.unwrap()->GetArg(9); const char* sender = msg->GetSender(); do { //Unmarshal Version if (versionArg->typeId != ALLJOYN_UINT16) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this Version argument.")); return; } uint16_t version; CHECK(versionArg->Get(AJPARAM_UINT16.c_str(), &version)); //Unmarshal messageId if (messageIdArg->typeId != ALLJOYN_INT32) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this messageId argument.")); return; } int32_t messageId; CHECK(messageIdArg->Get(AJPARAM_INT.c_str(), &messageId)); //Unmarshal messageType if (messageTypeArg->typeId != ALLJOYN_UINT16) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this message type argument.")); return; } uint16_t intVal; NotificationMessageType messageType; CHECK(messageTypeArg->Get(AJPARAM_UINT16.c_str(), &intVal)); messageType = MessageTypeUtil::getMessageType(intVal); //Unmarshal deviceId if (deviceIdArg->typeId != ALLJOYN_STRING) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this deviceId argument.")); return; } char* deviceId; CHECK(deviceIdArg->Get(AJPARAM_STR.c_str(), &deviceId)); //Unmarshal deviceName if (deviceNameArg->typeId != ALLJOYN_STRING) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this device Name argument.")); return; } char* deviceName; CHECK(deviceNameArg->Get(AJPARAM_STR.c_str(), &deviceName)); //Unmarshal appId if (appIdArg->typeId != ALLJOYN_BYTE_ARRAY) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this appId argument.")); return; } String appId; uint8_t* appIdBin; size_t len; CHECK(appIdArg->Get(AJPARAM_ARR_BYTE.c_str(), &len, &appIdBin)); if (len != UUID_LENGTH) { QCC_DbgHLPrintf(("App id length is not equal to %u", UUID_LENGTH * 2)); return; } //convert bytes to stringstrea uint32_t i; static const char* const chars = "0123456789ABCDEF"; appId.reserve(2 * len); for (i = 0; i < len; ++i) { const unsigned char c = appIdBin[i]; appId.push_back(chars[c >> 4]); appId.push_back(chars[c & 15]); } //Unmarshal appName if (appNameArg->typeId != ALLJOYN_STRING) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this app Name argument.")); return; } char* appName; CHECK(appNameArg->Get(AJPARAM_STR.c_str(), &appName)); //Unmarshal Attributes if (attributesArg->typeId != ALLJOYN_ARRAY) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this Attributes argument.")); return; } MsgArg*attribEntries; size_t attribNum; char* richIconUrl = 0; char* richIconObjectPath = 0; char* richAudioObjectPath = 0; char* controlPanelServiceObjectPath = 0; char* originalSender = 0; std::vector richAudioUrl; CHECK(attributesArg->Get(AJPARAM_ARR_DICT_INT_VAR.c_str(), &attribNum, &attribEntries)); for (size_t i = 0; i < attribNum; i++) { int32_t key; MsgArg* variant; CHECK(attribEntries[i].Get(AJPARAM_DICT_INT_VAR.c_str(), &key, &variant)); switch (key) { case RICH_CONTENT_ICON_URL_ATTRIBUTE_KEY: { CHECK(variant->Get(AJPARAM_STR.c_str(), &richIconUrl)); break; } case RICH_CONTENT_AUDIO_URL_ATTRIBUTE_KEY: { MsgArg*richAudioEntries; size_t richAudioNum; CHECK(variant->Get(AJPARAM_ARR_STRUCT_STR_STR.c_str(), &richAudioNum, &richAudioEntries)); for (size_t i = 0; i < richAudioNum; i++) { char*key; char*StringVal; status = richAudioEntries[i].Get(AJPARAM_STRUCT_STR_STR.c_str(), &key, &StringVal); if (status != ER_OK) { QCC_LogError(status, ("Can not Unmarshal this NotificationText argument.")); break; } richAudioUrl.push_back(RichAudioUrl(key, StringVal)); } break; } case RICH_CONTENT_ICON_OBJECT_PATH_ATTRIBUTE_KEY: { CHECK(variant->Get(AJPARAM_STR.c_str(), &richIconObjectPath)); break; } case RICH_CONTENT_AUDIO_OBJECT_PATH_ATTRIBUTE_KEY: { CHECK(variant->Get(AJPARAM_STR.c_str(), &richAudioObjectPath)); break; } case CPS_OBJECT_PATH_ATTRIBUTE_KEY: { CHECK(variant->Get(AJPARAM_STR.c_str(), &controlPanelServiceObjectPath)); break; } case ORIGINAL_SENDER_ATTRIBUTE_KEY: { CHECK(variant->Get(AJPARAM_STR.c_str(), &originalSender)); break; } default: QCC_DbgHLPrintf(("Can not Unmarshal this attribute argument")); break; } } // for (size_t i = 0; i < attribNum; i++) //Unmarshal Custom Attributes if (customAttributesArg->typeId != ALLJOYN_ARRAY) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this custom Attributes argument.")); return; } MsgArg*customAttributesEntries; size_t customAttributesNum; std::map customAttributes; CHECK(customAttributesArg->Get(AJPARAM_ARR_DICT_STR_STR.c_str(), &customAttributesNum, &customAttributesEntries)); for (size_t i = 0; i < customAttributesNum; i++) { char*key; char*StringVal; status = customAttributesEntries[i].Get(AJPARAM_DICT_STR_STR.c_str(), &key, &StringVal); if (status != ER_OK) { QCC_DbgHLPrintf(("Can not Unmarshal this Custom Attribute argument")); break; } customAttributes.insert(std::pair(key, StringVal)); } if (status != ER_OK) { break; } //Unmarshal NotificationTexts if (notificationsArg->typeId != ALLJOYN_ARRAY) { QCC_DbgHLPrintf(("Problem receiving message: Can not Unmarshal this NotificationsArg argument.")); return; } MsgArg*notTextEntries; size_t notTextNum; CHECK(notificationsArg->Get(AJPARAM_ARR_STRUCT_STR_STR.c_str(), ¬TextNum, ¬TextEntries)); std::vector text; for (size_t i = 0; i < notTextNum; i++) { char*key; char*StringVal; status = notTextEntries[i].Get(AJPARAM_STRUCT_STR_STR.c_str(), &key, &StringVal); if (status != ER_OK) { QCC_DbgHLPrintf(("Can not Unmarshal this NotificationText argument")); break; } text.push_back(NotificationText(key, StringVal)); } if (status != ER_OK) { break; } //Create notification and send it on Notification notification(messageId, messageType, deviceId, deviceName, appId.c_str(), appName, sender, customAttributes, text, richIconUrl, richAudioUrl, richIconObjectPath, richAudioObjectPath, controlPanelServiceObjectPath, originalSender); Transport* transport = Transport::getInstance(); transport->onReceivedNotification(notification); return; } while (0); QCC_LogError(status, ("Error occurred. Could not unmarshal parameters.")); return; } base-16.04/notification/cpp/src/PayloadAdapter.h000066400000000000000000000154661272147170000215550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef PAYLOADADAPTER_H_ #define PAYLOADADAPTER_H_ #include #include #include #include #include #include #include #include #include #include namespace ajn { namespace services { /** * PayloadAdapter - a class used to prepare the payload from variables to alljoyn message parameters * and unpack the alljoyn message parameters into the individual variables */ class PayloadAdapter { public: /** * Constructor of PayloadAdapter */ PayloadAdapter() { }; /** * Destructor of PayloadAdapter */ ~PayloadAdapter() { }; /** * SendPayload Marshals the Arguments to be sent * @param propertyStore * @param messageType * @param notificationText * @param customAttributes * @param ttl * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath * @param originalSender * @return status - success/failure */ static QStatus sendPayload(ajn::AboutData* propertyStore, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender); /** * SendPayload Marshals the Arguments to be sent * @param propertyStore * @param messageType * @param notificationText * @param customAttributes * @param ttl * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath * @param originalSender * @return status - success/failure */ static QStatus sendPayload(ajn::services::PropertyStore* propertyStore, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender); /** * SendPayload Marshals the Arguments to be sent * @param deviceId * @param deviceName * @param appId * @param appIdlen * @param appName * @param messageType * @param notificationText * @param customAttributes * @param ttl * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath * @param originalSender * @param messageId * @return status - success/failure */ static QStatus sendPayload(const char* deviceId, const char* deviceName, const uint8_t* appId, size_t appIdlen, const char* appName, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender, int32_t messageId); /** * ReceivePayload Unmarshals the arguments received * @param msg */ static void receivePayload(ajn::Message& msg); private: /** * SendPayload Marshals the Arguments to be sent * @param deviceId * @param deviceName * @param appId * @param appName * @param messageType * @param notificationText * @param customAttributes * @param ttl * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath * @param originalSender * @param messageId * @return status - success/failure */ static QStatus sendPayload(ajn::MsgArg deviceIdArg, ajn::MsgArg deviceNameArg, ajn::MsgArg appIdArg, ajn::MsgArg appNameArg, NotificationMessageType messageType, std::vector const& notificationText, std::map const& customAttributes, uint16_t ttl, const char* richIconUrl, std::vector const& richAudioUrl, const char* richIconObjectPath, const char* richAudioObjectPath, const char* controlPanelServiceObjectPath, const char* originalSender, int32_t messageId); /** * static MessageId */ static int32_t m_MessageId; }; } //namespace services } //namespace ajn #endif /* PAYLOADADAPTER_H_ */ base-16.04/notification/cpp/src/RichAudioUrl.cc000066400000000000000000000027431272147170000213450ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #include using namespace ajn; using namespace services; using namespace qcc; RichAudioUrl::RichAudioUrl(String const& language, String const& url) { m_Language = language; m_Url = url; } void RichAudioUrl::setLanguage(String const& language) { m_Language = language; } String const& RichAudioUrl::getLanguage() const { return m_Language; } void RichAudioUrl::setUrl(String const& url) { m_Url = url; } String const& RichAudioUrl::getUrl() const { return m_Url; } base-16.04/notification/cpp/src/SConscript000066400000000000000000000024361272147170000205150ustar00rootroot00000000000000#****************************************************************************** # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #***************************************************************************** Import('nsenv') srcs = nsenv.Glob('*.cc') libs = [] # Static library objs = nsenv.Object(srcs) libs.append(nsenv.StaticLibrary('alljoyn_notification', objs)) # Shared library if nsenv.get('LIBTYPE', 'static') != 'static': shobjs = nsenv.SharedObject(srcs) libs.append(nsenv.SharedLibrary('alljoyn_notification', shobjs)) Return('libs') base-16.04/notification/cpp/src/Transport.cc000066400000000000000000000454521272147170000210130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef _WIN32 /* Disable deprecation warnings */ #pragma warning(disable: 4996) #endif #include #include #include #include #include "NotificationConstants.h" #include "PayloadAdapter.h" #include "Transport.h" #include "NotificationProducerReceiver.h" #include "NotificationProducerSender.h" #include "NotificationProducerListener.h" #include "NotificationDismisserSender.h" #include "NotificationDismisserReceiver.h" #include "NotificationConstants.h" #include "NotificationTransportConsumer.h" #include "NotificationTransportProducer.h" #include using namespace ajn; using namespace services; using namespace nsConsts; using namespace qcc; static qcc::String AJ_NOTIFICATION_INTERFACE_MATCH = "type='signal',sessionless='t',interface='" + AJ_NOTIFICATION_INTERFACE_NAME + "'"; static qcc::String AJ_DISMISSER_INTERFACE_MATCH = "type='signal',sessionless='t',interface='" + AJ_NOTIFICATION_DISMISSER_INTERFACE + "'"; Transport* Transport::s_Instance(NULL); Transport::Transport() : m_Bus(0), m_Receiver(0), m_Consumer(0), m_IsSendingDisabled(false), m_IsReceivingDisabled(false), m_NotificationProducerSender(0), m_NotificationProducerReceiver(0), m_NotificationProducerListener(0), m_NotificationDismisserSender(0), m_NotificationDismisserReceiver(0) { Notification::m_AsyncTaskQueue.Start(); for (int32_t indx = 0; indx < MESSAGE_TYPE_CNT; indx++) m_Producers[indx] = 0; } Transport::~Transport() { if (m_Bus) { cleanup(); } } Transport* Transport::getInstance() { if (!s_Instance) { s_Instance = new Transport(); } return s_Instance; } QStatus Transport::setBusAttachment(ajn::BusAttachment* bus) { if (m_Bus && bus->GetUniqueName().compare(m_Bus->GetUniqueName()) != 0) { QCC_LogError(ER_BUS_LISTENER_ALREADY_SET, ("Could not accept this BusAttachment, a different bus attachment already exists")); return ER_BUS_LISTENER_ALREADY_SET; } if (!bus->IsStarted() || !bus->IsConnected()) { QCC_LogError(ER_BAD_ARG_1, ("Could not acccept this BusAttachment, bus attachment not started or not connected")); return ER_BAD_ARG_1; } m_Bus = bus; return ER_OK; } void Transport::setNotificationReceiver(NotificationReceiver* notificationReceiver) { m_Receiver = notificationReceiver; } void Transport::onReceivedNotification(Notification const& notification) { if (m_Receiver == 0) { QCC_DbgHLPrintf(("Could not receive message, Receiver is not initialized")); return; } if (m_IsReceivingDisabled) { QCC_DbgHLPrintf(("Could not receive message, Receiving is Disabled")); return; } m_Receiver->Receive(notification); } QStatus Transport::sendNotification(NotificationMessageType messageType, MsgArg const notificationArgs[AJ_NOTIFY_NUM_PARAMS], uint16_t ttl) { if (m_Producers[messageType] == 0) { QCC_LogError(ER_BUS_OBJECT_NOT_REGISTERED, ("Could not send message, Sender is not initialized")); return ER_BUS_OBJECT_NOT_REGISTERED; } if (m_IsSendingDisabled) { QCC_LogError(ER_BUS_NOT_ALLOWED, ("Could not send message, Sending is Disabled")); return ER_BUS_NOT_ALLOWED; } return m_Producers[messageType]->sendSignal(notificationArgs, ttl); } QStatus Transport::deleteLastMsg(NotificationMessageType messageType) { if (m_Producers[messageType] == 0) { QCC_LogError(ER_BUS_OBJECT_NOT_REGISTERED, ("Could not delete message, Sender is not initialized")); return ER_BUS_OBJECT_NOT_REGISTERED; } return m_Producers[messageType]->deleteLastMsg(messageType); } QStatus Transport::getLastMsgId(NotificationMessageType messageType, int32_t* messageId) { if (m_Producers[messageType] == 0) { QCC_LogError(ER_BUS_OBJECT_NOT_REGISTERED, ("Sender is not initialized")); return ER_BUS_OBJECT_NOT_REGISTERED; } return m_Producers[messageType]->getLastMsgId(messageType, messageId); } QStatus Transport::deleteMsg(int32_t msgId) { QCC_DbgTrace(("Transport::deleteMsg() msgId=%d", msgId)); QStatus ret = ER_OK; for (size_t i = 0; i < ajn::services::MESSAGE_TYPE_CNT; i++) { if (m_Producers[i] == 0) { QCC_DbgHLPrintf(("Could not delete message, Sender is not initialized")); continue; } else { QCC_DbgHLPrintf(("deleting message")); } ret = m_Producers[i]->deleteMsg(msgId); if (ret == ER_OK) { break; } } if (ret == ER_OK) { QCC_DbgPrintf(("Transport::deleteMsg() - message successfully deleted. msgId=%d", msgId)); } else { QCC_DbgPrintf(("Transport::deleteMsg() - didn't find message to delete. msgId=%d", msgId)); } return ret; } QStatus Transport::startSenderTransport(BusAttachment* bus) { QCC_DbgTrace(("Transport::startSenderTransport")); QStatus status; if ((status = setBusAttachment(bus)) != ER_OK) { QCC_LogError(status, ("Could not start Sender Transport. BusAttachment is not valid")); goto exit; } if (m_Producers[0]) { QCC_DbgPrintf(("Sender Transport already started. Ignoring request")); goto exit; } { for (int32_t messageTypeIndx = 0; messageTypeIndx < MESSAGE_TYPE_CNT; messageTypeIndx++) { status = ER_OK; m_Producers[messageTypeIndx] = new NotificationTransportProducer(m_Bus, AJ_PRODUCER_SERVICE_PATH_PREFIX + MessageTypeUtil::getMessageTypeString(messageTypeIndx), status); if (status != ER_OK) { QCC_LogError(status, ("Could not create BusObject.")); goto exit; } status = m_Bus->RegisterBusObject(*m_Producers[messageTypeIndx]); if (status != ER_OK) { QCC_LogError(status, ("Could not register BusObject.")); goto exit; } } } //Code handles NotificationProducerReceiver - Start cleanupNotificationProducerReceiverInternal(); m_NotificationProducerReceiver = new NotificationProducerReceiver(m_Bus, status); if (status != ER_OK) { goto exit; } status = m_Bus->RegisterBusObject(*m_NotificationProducerReceiver); if (status != ER_OK) { QCC_LogError(status, ("Could not register BusObject.")); goto exit; } else { QCC_DbgPrintf(("Transport::startSenderTransport - registered NotificationProducerReceiver successfully.")); } m_NotificationProducerListener = new NotificationProducerListener(); m_NotificationProducerListener->setSessionPort(AJ_NOTIFICATION_PRODUCER_SERVICE_PORT); { //Handling Bind session SessionPort servicePort = AJ_NOTIFICATION_PRODUCER_SERVICE_PORT; SessionOpts sessionOpts(SessionOpts::TRAFFIC_MESSAGES, true, SessionOpts::PROXIMITY_ANY, TRANSPORT_ANY); status = m_Bus->BindSessionPort(servicePort, sessionOpts, *m_NotificationProducerListener); if (status != ER_OK) { QCC_LogError(status, ("Could not bind Session Port successfully")); goto exit; } else { QCC_DbgPrintf(("bind Session Port successfully for notification producer service")); } } //Code handles NotificationProducerReceiver - End //Handling NotificationDismisserSender - start here cleanupNotificationDismisserSenderInternal(); m_NotificationDismisserSender = new NotificationDismisserSender(m_Bus, AJ_NOTIFICATION_DISMISSER_PATH + "Sender", status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationDismisserSender.")); goto exit; } status = m_Bus->RegisterBusObject(*m_NotificationDismisserSender); if (status != ER_OK) { QCC_LogError(status, ("Could not register NotificationDismisserSender.")); goto exit; } //Handling NotificationDismisserSender - end here exit: //label exit if (status == ER_OK) { QCC_DbgTrace(("Started Sender successfully")); } else { //if (status != ER_OK) QCC_LogError(status, ("Started Sender with error.")); cleanupSenderTransport(); } return status; } QStatus Transport::startReceiverTransport(BusAttachment* bus) { QStatus status = ER_OK; if ((status = setBusAttachment(bus)) != ER_OK) { QCC_LogError(status, ("Could not start Receiver Transport. BusAttachment is not valid")); goto exit; } if (m_Consumer == NULL) { cleanupTransportConsumer(true); m_Consumer = new NotificationTransportConsumer(m_Bus, AJ_CONSUMER_SERVICE_PATH, status); if (status != ER_OK) { QCC_LogError(status, ("Could not create Consumer BusObject.")); goto exit; } status = m_Bus->RegisterBusObject(*m_Consumer); if (status != ER_OK) { QCC_LogError(status, ("Could not register Consumer BusObject.")); goto exit; } QCC_DbgPrintf(("Match String is: %s", AJ_NOTIFICATION_INTERFACE_MATCH.c_str())); status = m_Bus->AddMatch(AJ_NOTIFICATION_INTERFACE_MATCH.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not add filter match for notification service.")); goto exit; } } //Handling NotificationProducerSender - Start if (m_NotificationProducerSender == NULL) { m_NotificationProducerSender = new NotificationProducerSender(m_Bus, status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationProducerSender BusObject.")); goto exit; } status = m_Bus->RegisterBusObject(*m_NotificationProducerSender); if (status != ER_OK) { QCC_LogError(status, ("Could not register NotificationProducerSender BusObject.")); goto exit; } } //Handling NotificationProducerSender - End //Handling NotificationDismisserReceiver - Start if (m_NotificationDismisserReceiver == NULL) { cleanupNotificationDismisserReceiverInternal(); m_NotificationDismisserReceiver = new NotificationDismisserReceiver(m_Bus, status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationDismisserReceiver BusObject.")); goto exit; } status = m_Bus->RegisterBusObject(*m_NotificationDismisserReceiver); if (status != ER_OK) { QCC_LogError(status, ("Could not register m_NotificationDismisserReceiver BusObject.")); goto exit; } QCC_DbgPrintf(("NotificationDismisserReceiver Match String is: %s", AJ_DISMISSER_INTERFACE_MATCH.c_str())); status = m_Bus->AddMatch(AJ_DISMISSER_INTERFACE_MATCH.c_str()); if (status != ER_OK) { QCC_LogError(status, ("Could not add filter match.")); goto exit; } } //Handling NotificationDismisserReceiver - End //Handling NotificationDismisserSender - Start if (m_NotificationDismisserSender == NULL) { cleanupNotificationDismisserSenderInternal(); m_NotificationDismisserSender = new NotificationDismisserSender(m_Bus, AJ_NOTIFICATION_DISMISSER_PATH + "Sender", status); if (status != ER_OK) { QCC_LogError(status, ("Could not create NotificationDismisserSender.")); goto exit; } status = m_Bus->RegisterBusObject(*m_NotificationDismisserSender); if (status != ER_OK) { QCC_LogError(status, ("Could not register BusObject.")); goto exit; } } exit: if (status != ER_OK) { QCC_LogError(status, ("Not listening to any producers")); cleanupReceiverTransport(); } else { QCC_DbgPrintf(("Started Receiver successfully")); } return status; } void Transport::cleanupTransportProducer(int32_t messageTypeIndx, bool unregister) { QCC_DbgTrace(("Transport::cleanupTransportProducer - Start")); for (; messageTypeIndx >= 0; messageTypeIndx--) { if (!m_Producers[messageTypeIndx]) { continue; } if (unregister) { m_Bus->UnregisterBusObject(*m_Producers[messageTypeIndx]); } delete m_Producers[messageTypeIndx]; m_Producers[messageTypeIndx] = 0; } QCC_DbgTrace(("Transport::cleanupTransportProducer - End")); } void Transport::cleanupNotificationProducerReceiver() { QCC_DbgTrace(("Transport::cleanupNotificationProducerReceiver start")); SessionPort sp = AJ_NOTIFICATION_PRODUCER_SERVICE_PORT; QStatus status = m_Bus->UnbindSessionPort(sp); if (status != ER_OK) { QCC_LogError(status, ("Could not unbind the SessionPort ")); } QCC_DbgPrintf(("cleaning NotificationProducerListener")); if (m_NotificationProducerListener) { delete m_NotificationProducerListener; m_NotificationProducerListener = 0; } if (m_NotificationProducerReceiver) { m_NotificationProducerReceiver->unregisterHandler(m_Bus); cleanupNotificationProducerReceiverInternal(); } delete m_NotificationProducerReceiver; m_NotificationProducerReceiver = NULL; QCC_DbgTrace(("Transport::cleanupNotificationProducerReceiver end")); } void Transport::cleanupNotificationProducerReceiverInternal() { QCC_DbgTrace(("Transport::cleanupNotificationProducerReceiverInternal start")); if (m_NotificationProducerReceiver) { QCC_DbgPrintf(("cleaning NotificationProducerReceiver")); m_Bus->UnregisterBusObject(*m_NotificationProducerReceiver); } QCC_DbgTrace(("Transport::cleanupNotificationProducerReceiverInternal end")); } void Transport::cleanupNotificationDismisserSender() { if (!m_NotificationDismisserSender) { return; } cleanupNotificationDismisserSenderInternal(); delete m_NotificationDismisserSender; m_NotificationDismisserSender = 0; } void Transport::cleanupNotificationDismisserSenderInternal() { if (!m_NotificationDismisserSender) { return; } m_Bus->RemoveMatch(AJ_DISMISSER_INTERFACE_MATCH.c_str()); m_Bus->UnregisterBusObject(*m_NotificationDismisserSender); } void Transport::cleanupNotificationDismisserReceiver() { QCC_DbgTrace(("Transport::cleanupNotificationDismisserReceiver start")); if (!m_NotificationDismisserReceiver) { return; } m_NotificationDismisserReceiver->unregisterHandler(m_Bus); cleanupNotificationDismisserReceiverInternal(); delete m_NotificationDismisserReceiver; m_NotificationDismisserReceiver = 0; QCC_DbgTrace(("Transport::cleanupNotificationDismisserReceiver end")); } void Transport::cleanupNotificationDismisserReceiverInternal() { QCC_DbgTrace(("Transport::cleanupNotificationDismisserReceiverInternal start")); if (m_NotificationDismisserReceiver) { m_Bus->UnregisterBusObject(*m_NotificationDismisserReceiver); } QCC_DbgTrace(("Transport::cleanupNotificationDismisserReceiverInternal end")); } void Transport::cleanupSenderTransport() { cleanupNotificationDismisserSender(); cleanupNotificationProducerSender(); cleanupNotificationProducerReceiver(); cleanupTransportProducer(MESSAGE_TYPE_CNT - 1, true); } void Transport::cleanupReceiverTransport() { QCC_DbgTrace(("Transport::cleanupReceiverTransport start")); cleanupNotificationDismisserReceiver(); cleanupNotificationProducerSender(); cleanupTransportConsumer(true); QCC_DbgTrace(("Transport::cleanupReceiverTransport end")); } void Transport::cleanupTransportConsumer(bool unregister) { QCC_DbgTrace(("Transport::cleanupTransportConsumer start")); if (!m_Consumer) { return; } m_Bus->RemoveMatch(AJ_NOTIFICATION_INTERFACE_MATCH.c_str()); if (unregister) { m_Consumer->unregisterHandler(m_Bus); cleanupTransportConsumerInternal(); } delete m_Consumer; m_Consumer = 0; QCC_DbgTrace(("Transport::cleanupTransportConsumer end")); } void Transport::cleanupTransportConsumerInternal(void) { QCC_DbgTrace(("Transport::cleanupTransportConsumerInternal start")); if (!m_Consumer) { return; } m_Bus->UnregisterBusObject(*m_Consumer); QCC_DbgTrace(("Transport::cleanupTransportConsumerInternal end")); } void Transport::cleanupNotificationProducerSender() { QCC_DbgTrace(("Transport::cleanupNotificationProducerSender start")); if (!m_NotificationProducerSender) { return; } cleanupNotificationProducerSenderInternal(); delete m_NotificationProducerSender; m_NotificationProducerSender = 0; QCC_DbgTrace(("Transport::cleanupNotificationProducerSender end")); } void Transport::cleanupNotificationProducerSenderInternal() { QCC_DbgTrace(("Transport::cleanupNotificationProducerSender start")); if (!m_NotificationProducerSender) { return; } m_Bus->UnregisterBusObject(*m_NotificationProducerSender); QCC_DbgTrace(("Transport::cleanupNotificationProducerSender end")); } void Transport::cleanup() { if (m_Bus == 0) { return; } Notification::m_AsyncTaskQueue.Stop(); cleanupSenderTransport(); cleanupReceiverTransport(); m_Bus = 0; s_Instance = 0; delete this; } ajn::BusAttachment* Transport::getBusAttachment() { return m_Bus; } NotificationProducerSender* Transport::getNotificationProducerSender() { return m_NotificationProducerSender; } NotificationProducerReceiver* Transport::getNotificationProducerReceiver() { return m_NotificationProducerReceiver; } NotificationDismisserSender* Transport::getNotificationDismisserSender() { return m_NotificationDismisserSender; } NotificationReceiver* Transport::getNotificationReceiver() { return m_Receiver; } base-16.04/notification/cpp/src/Transport.h000066400000000000000000000212221272147170000206420ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef TRANSPORT_H_ #define TRANSPORT_H_ #include #include #include #include "NotificationConstants.h" namespace ajn { namespace services { class Notification; class NotificationReceiver; class NotificationProducerSender; class NotificationProducerReceiver; class NotificationProducerListener; class NotificationDismisserSender; class NotificationDismisserReceiver; class NotificationConstants; class NotificationTransportConsumer; class NotificationTransportProducer; /** * Class Used for all Transport related tasks including initializing and shutting * down the BusObjects of the services and sending and receiving messages */ class Transport { public: /** * Destructor of Transport */ ~Transport(); /** * static function to get an Instance of the Transport class * @return pointer to Transport instance */ static Transport* getInstance(); /** * Sets the internal NotificationReceiver to the one * provided in the parameter * @param notificationReceiver */ void setNotificationReceiver(NotificationReceiver* notificationReceiver); /** * Start the Sender Transport: * Create a BusAttachment if one doesn't exist. * Create the NotificationTransportProducers (one per MessageType) * @param bus - The busAttachment to be used * @return status */ QStatus startSenderTransport(ajn::BusAttachment* bus); /** * Start the Receiver Transport: * Create a BusAttachment if one doesn't exist. * create the NotificationTransportConsumer to handle the signals * @param bus - the busAttachment to be used * @return status */ QStatus startReceiverTransport(ajn::BusAttachment* bus); /** * Send Notification * @param messageType * @param notificationArgs * @param ttl * @return status */ QStatus sendNotification(NotificationMessageType messageType, ajn::MsgArg const notificationArgs[nsConsts::AJ_NOTIFY_NUM_PARAMS], uint16_t ttl); /** * Delete the last Signal sent off for this messageType * @param messageType * @return status */ QStatus deleteLastMsg(NotificationMessageType messageType); /** * Delete Signal sent off for this messageType * @param messageId * @return status */ QStatus deleteMsg(int32_t msgId); /** * Get the notification id of the last message that was sent with given MessageType * @param messageType * @param messageId * @return status */ QStatus getLastMsgId(NotificationMessageType messageType, int32_t* messageId); /** * Pass on the notification received to the NotificationReceiver * @param notification */ void onReceivedNotification(Notification const& notification); /** * Called on shutdown. Cleans up Alljoyn objects and frees memory where necessary */ void cleanup(); /** * Cleanup the TransportConsumer objects. Also Unregisteres the BusObject depending on input param * @param unregister - should BusObject be Unregistered from Bus */ void cleanupTransportConsumer(bool unregister = false); /** * Cleanup all Sender Transport objects. and Unregister the BusObject */ void cleanupSenderTransport(); /** * Cleanup all Receiver Transport objects. and Unregister the BusObject */ void cleanupReceiverTransport(); /** * Cleanup AnnouncementListener object. Also Unregisteres the listener from the aboutclient * @param unregister - should listener be Unregistered from aboutclient */ void cleanupAnnouncementListener(bool unregister = false); /** * Cleanup cleanupNotificationProducerSender. and Unregister the BusObject. */ void cleanupNotificationProducerSender(); /** * getBusAttachment - returns BusObject */ ajn::BusAttachment* getBusAttachment(); /** * get function for NotificationProducerSender */ NotificationProducerSender* getNotificationProducerSender(); /** * get function for NotificationProducerReceiver */ NotificationProducerReceiver* getNotificationProducerReceiver(); /** * get function for NotificationDismisserSender */ NotificationDismisserSender* getNotificationDismisserSender(); /** * get function for NotificationReceiver */ NotificationReceiver* getNotificationReceiver(); private: /** * Private Constructor - singleton Class */ Transport(); /** * Sets the internal busAttachment to the one * provided in the parameter * @param bus * @return success/failure */ QStatus setBusAttachment(ajn::BusAttachment* bus); /** * Cleanup the TransportProducer objects. Start from messageTypeIndx param and work backwards * Also Unregisters the BusObject depending on input param * @param messageTypeIndx - messageTypeIndx to start from * @param unregister - should BusObject be Unregistered from Bus */ void cleanupTransportProducer(int32_t messageTypeIndx, bool unregister = false); /** * cleanupSenderProducerReceiver */ void cleanupNotificationProducerReceiver(); /** * cleanupSenderProducerReceiver */ void cleanupNotificationProducerReceiverInternal(); /** * cleanupNotificationDismisserSender */ void cleanupNotificationDismisserSender(); /** * cleanupNotificationDismisserSender */ void cleanupNotificationDismisserSenderInternal(); /** * cleanupNotificationDismisserReceiver */ void cleanupNotificationDismisserReceiver(); /** * cleanupNotificationDismisserReceiver */ void cleanupNotificationDismisserReceiverInternal(); /** * Cleanup cleanupNotificationProducerSender. and Unregister the BusObject. */ void cleanupNotificationProducerSenderInternal(); /** * Cleanup the TransportConsumer objects. Also Unregisteres the BusObject depending on input param * @param unregister - should BusObject be Unregistered from Bus */ void cleanupTransportConsumerInternal(void); /** * Static instance of Transport. Makes Transport a singleton */ static Transport* s_Instance; /** * Alljoyn BusAttachment that will be used to connect to Bus */ ajn::BusAttachment* m_Bus; /** * NotificationReceiver that will receive the incoming notifications * Must be created external from library and passed in */ NotificationReceiver* m_Receiver; /** * The BusObjects for the Producer. One per MessageType */ NotificationTransportProducer* m_Producers[MESSAGE_TYPE_CNT]; /** * The BusObjects for the Consumer. */ NotificationTransportConsumer* m_Consumer; /** * Boolean to dictate whether we send notifications or swallow them */ bool m_IsSendingDisabled; /** * Boolean to dictate whether we receive notifications or swallow them */ bool m_IsReceivingDisabled; /** * NotificationProducerSender */ NotificationProducerSender* m_NotificationProducerSender; /** * NotificationProducerReceiver */ NotificationProducerReceiver* m_NotificationProducerReceiver; /** * NotificationProducerListener */ NotificationProducerListener* m_NotificationProducerListener; /** * NotificationDismisserSender */ NotificationDismisserSender* m_NotificationDismisserSender; /** * NotificationDismisserReceiver */ NotificationDismisserReceiver* m_NotificationDismisserReceiver; }; } //namespace services } //namespace ajn #endif /* TRANSPORT_H_ */ base-16.04/notification/ios/000077500000000000000000000000001272147170000157175ustar00rootroot00000000000000base-16.04/notification/ios/inc/000077500000000000000000000000001272147170000164705ustar00rootroot00000000000000base-16.04/notification/ios/inc/alljoyn/000077500000000000000000000000001272147170000201405ustar00rootroot00000000000000base-16.04/notification/ios/inc/alljoyn/notification/000077500000000000000000000000001272147170000226265ustar00rootroot00000000000000base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotification.h000066400000000000000000000157571272147170000261200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/Notification.h" #import "AJNSNotificationEnums.h" #import "AJNSRichAudioUrl.h" #import "AJNSNotificationText.h" /** AJNSNotification class */ @interface AJNSNotification : NSObject ///--------------------- /// @name Properties ///--------------------- /** Array which holds incoming AJNSNotificationText objects */ @property (strong, nonatomic) NSMutableArray *ajnsntArr; - (id)initWithHandle:(const ajn ::services ::Notification *)handle; ///--------------------- /// @name Initialization ///--------------------- /** Designated initializer @param messageId The message id @param messageType The message type @param deviceId The device id @param deviceName The device name @param appId The app id @param appName The app name @param sender The sender name @param customAttributes The notification custom attributes @param notificationText The notification text(s) @param richIconUrl The rich icon url @param richAudioUrl The rich audio url @param richIconObjectPath The rich icon object path @param richAudioObjectPath The rich audio object path @param controlPanelServiceObjectPath The control panel service object path @return a `AJNSNotification` object */ - (AJNSNotification *)initWithMessageId:(int32_t)messageId messageType:(AJNSNotificationMessageType)messageType deviceId:(NSString *)deviceId deviceName:(NSString *)deviceName appId:(NSString *)appId appName:(NSString *)appName sender:(NSString *)sender customAttributes:(NSMutableDictionary *)customAttributes notificationText:(NSMutableArray *)notificationText richIconUrl:(NSString *)richIconUrl richAudioUrl:(NSMutableArray *)richAudioUrl richIconObjectPath:(NSString *)richIconObjectPath richAudioObjectPath:(NSString *)richAudioObjectPath controlPanelServiceObjectPath:(NSString *)controlPanelServiceObjectPath; /** AJNSNotification initializer @param messageType The message type @param notificationText The notification text(s) @return a `AJNSNotification` object */ - (AJNSNotification *)initWithMessageType:(AJNSNotificationMessageType)messageType andNotificationText:(NSMutableArray *)notificationText; ///--------------------- /// @name reterieval methods ///--------------------- /** Get the ProtoVersion @return protoversion The notification proto version */ - (int16_t)version; /** Get the device Id @return deviceId The notification device id */ - (NSString *)deviceId; /** Get the Device Name @return deviceName */ - (NSString *)deviceName; /** Get the app Id @return appId */ - (NSString *)appId; /** Get the app Name @return appName */ - (NSString *)appName; /** Get the map of customAttributes @return customAttributes */ - (NSMutableDictionary *)customAttributes; /** Get the Message Id @return notificationId */ - (int32_t)messageId; /** Get the Sender @return Sender */ - (NSString *)senderBusName; /** Get the MessageType @return MessageType */ - (AJNSNotificationMessageType)messageType; /** Get the Notification Text @return notificationText */ - (NSArray *)text; /** Get the Rich Icon Url @return RichIconUrl */ - (NSString *)richIconUrl; /** Get the Rich Icon Object Path @return richIconObjectPath */ - (NSString *)richIconObjectPath; /** Get the Rich Audio Object Path @return richAudioObjectPath */ - (NSString *)richAudioObjectPath; /** Get the Rich Audio Urls @param inputArray array of URLs @return RichAudioUrl */ - (void)richAudioUrl:(NSMutableArray *)inputArray; /** Get the ControlPanelService object path @return ControlPanelServiceObjectPath */ - (NSString *)controlPanelServiceObjectPath; ///--------------------- /// @name Setters ///--------------------- /** Set the App Id of the Notification @param appId The app id */ - (void)setAppId:(NSString *)appId; /** Set the App Name of the Notification @param appName The app name */ - (void)setAppName:(NSString *)appName; /** Set the Control Panel Service Object Path of the Notification @param controlPanelServiceObjectPath The control panel service object path */ - (void)setControlPanelServiceObjectPath:(NSString *)controlPanelServiceObjectPath; /** Set the Custom Attributed of the Notification @param customAttributes The notification custom attributes */ - (void)setCustomAttributes:(NSMutableDictionary *)customAttributes; /** Set the deviceId of the Notification @param deviceId The device id */ - (void)setDeviceId:(NSString *)deviceId; /** Set the deviceName of the Notification @param deviceName The device name */ - (void)setDeviceName:(NSString *)deviceName; /** Set the messageId of the Notification @param messageId The message id */ - (void)setMessageId:(int32_t)messageId; /** Set the richAudioUrl of the Notification @param richAudioUrl The rich audio url */ - (void)setRichAudioUrl:(NSMutableArray *)richAudioUrl; /** Set the richIconUrl of the Notification @param richIconUrl The rich icon url */ - (void)setRichIconUrl:(NSString *)richIconUrl; /** Set the richIconObjectPath of the Notification @param richIconObjectPath The rich icon object path */ - (void)setRichIconObjectPath:(NSString *)richIconObjectPath; /** Set the richAudioObjectPath of the Notification @param richAudioObjectPath The rich audio object path */ - (void)setRichAudioObjectPath:(NSString *)richAudioObjectPath; /** Set the sender name of the Notification @param sender The sender name */ - (void)setSender:(NSString *)sender; - (QStatus) dismiss; /** * Populate a temporary array to hold incoming AJNSNotificationText objects * This method is called when a new notification is coming */ - (void)createAJNSNotificationTextArray; @property (nonatomic, readonly)ajn::services::Notification * handle; @end base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationEnums.h000066400000000000000000000034141272147170000271130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef AJNSNOTIFICATIONENUMS_H_ #define AJNSNOTIFICATIONENUMS_H_ /** AJNSNotificationEnums class */ @interface AJNSNotificationEnums : NSObject /** @enum AJNSNotificationMessageType enum @abstract AJNSNotificationMessageType DBus request status return values. */ typedef NS_ENUM (NSInteger, AJNSNotificationMessageType) { /** EMERGENCY - Urgent Message */ EMERGENCY = 0, /** WARNING - Warning Message */ WARNING = 1, /** INFO - Informational Message */ INFO = 2, /** MESSAGE_TYPE_CNT - Number of Message Types Defined */ MESSAGE_TYPE_CNT = 3, UNSET = 4 }; /** Convet AJNSNotificationMessageType to an NSString format @param msgType DBus request status @return message type in an NSString format(Capital letters) */ + (NSString *)AJNSMessageTypeToString:(AJNSNotificationMessageType)msgType; @end #endif base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationReceiver.h000066400000000000000000000031641272147170000275720ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef AJNSNOTIFICATIONRECEIVER_H_ #define AJNSNOTIFICATIONRECEIVER_H_ #import #import "alljoyn/notification/NotificationReceiver.h" #import "AJNSNotification.h" /** AJNSNotificationReceiver class */ @protocol AJNSNotificationReceiver /** * Pure abstract function that receives a notification * Consumer Application must override this method * @param notification the notification that is received */ - (void)receive:(AJNSNotification *)notification; /** * Dismiss handler * @param msgId message ID to dismiss * @param appId app ID to use */ - (void)dismissMsgId:(const int32_t)msgId appId:(NSString*) appId; @end #endif base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationReceiverAdapter.h000066400000000000000000000036461272147170000311000ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/NotificationReceiver.h" #import "alljoyn/notification/Notification.h" #import "AJNSNotificationReceiver.h" /** NotificationReceiverAdapter class */ class AJNSNotificationReceiverAdapter : public ajn::services::NotificationReceiver { public: /** NotificationReceiverAdapter @param notificationReceiverHandler a AJNSNotificationReceiver handler */ AJNSNotificationReceiverAdapter(id notificationReceiverHandler); /** receive a notification @param notification the notification will be populated inside this param */ void Receive(ajn::services::Notification const& notification); /** Dismiss handler @param msgId message ID to dismiss @param appId app ID to use */ void Dismiss(const int32_t msgId, const qcc::String appId); /** The handler of the receiver */ id ajnsNotificationReceiverHandler; }; base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationSender.h000066400000000000000000000046341272147170000272510ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/NotificationSender.h" #import "alljoyn/notification/Notification.h" #import "alljoyn/notification/NotificationEnums.h" #import "AJNSNotificationEnums.h" #import "AJNSNotification.h" #import "alljoyn/about/AJNPropertyStore.h" #import "alljoyn/about/AJNAboutPropertyStoreImpl.h" /** AJNSNotificationSender class */ @interface AJNSNotificationSender : NSObject ///--------------------- /// @name Properties ///--------------------- /** NotificationSender Handler*/ @property (nonatomic)ajn::services::NotificationSender * senderHandle; ///--------------------- /// @name Initialization ///--------------------- /** * Designated initializer * @param propertyStore property store */ - (AJNSNotificationSender *)initWithPropertyStore:(AJNAboutPropertyStoreImpl *)propertyStore; ///--------------------- /// @name Instance methods ///--------------------- /** * Send notification * @param ajnsNotification `ajnsNotification` object * @param ttl message ttl * @return status */ - (QStatus)send:(AJNSNotification *)ajnsNotification ttl:(uint16_t)ttl; /** * Delete last message that was sent with given MessageType * @param messageType MessageType of message to be deleted * @return status */ - (QStatus)deleteLastMsg:(AJNSNotificationMessageType)messageType; /** * Get the property store in this sender * @return The property store */ - (ajn ::services ::AboutPropertyStoreImpl *)getPropertyStore; @end base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationService.h000066400000000000000000000064351272147170000274320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/NotificationService.h" #import "AJNSNotificationReceiverAdapter.h" #import "AJNSNotificationReceiver.h" #import "AJNSNotificationSender.h" #import "AJNBusAttachment.h" #import "alljoyn/services_common/AJSVCGenericLoggerAdapter.h" /** AJNSNotificationService class */ @interface AJNSNotificationService : NSObject ///--------------------- /// @name Properties ///--------------------- /** * Get Instance of AJNSNotificationServiceImpl * @return instance */ + (id)sharedInstance; /** * Initialize Producer side via Transport. Create and * return NotificationSender. * @param bus ajn bus * @param store property store * @return NotificationSender instance */ - (AJNSNotificationSender *)startSendWithBus:(AJNBusAttachment *)bus andPropertyStore:(AJNAboutPropertyStoreImpl *)store; /** * Initialize Consumer side via Transport. * Set NotificationReceiver to given receiver * @param bus ajn bus * @param ajnsNotificationReceiver notification receiver * @return status */ - (QStatus)startReceive:(AJNBusAttachment *)bus withReceiver:(id )ajnsNotificationReceiver; /** * Stops sender but leaves bus and other objects alive */ - (void)shutdownSender; /** * Stops receiving but leaves bus and other objects alive */ - (void)shutdownReceiver; /** * Cleanup and get ready for shutdown */ - (void)shutdown; /** @deprecated SuperAgent was deprecated in May 2015 for 15.04 * release * Disabling superagent mode. Needs to be called before * starting receiver * @return status */ - (QStatus)disableSuperAgent DEPRECATED_ATTRIBUTE; /** * Get the currently-configured logger implementation * @return logger Implementation of GenericLogger */ - (id )logger; /** * Set log level filter for subsequent logging messages * @param newLogLevel enum value * @return logLevel enum value that was in effect prior to this change */ - (void)setLogLevel:(QLogLevel)newLogLevel; /** * Get log level filter value currently in effect * @return logLevel enum value currently in effect */ - (QLogLevel)logLevel; /** * Virtual method to get the busAttachment used in the service. */ - (AJNBusAttachment *)busAttachment; /** * Get the Version of the NotificationService * @return the NotificationService version */ - (uint16_t)version; @end base-16.04/notification/ios/inc/alljoyn/notification/AJNSNotificationText.h000066400000000000000000000040101272147170000267410ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/NotificationText.h" /** AJNSNotificationText class. */ @interface AJNSNotificationText : NSObject ///--------------------- /// @name Properties ///--------------------- /** Initialize notification text with language and text @param language The language of this notification text @param text The text of the notification text @return pointer to the noficiation text object */ - (AJNSNotificationText *)initWithLang:(NSString *)language andText:(NSString *)text; /** * Set Language for Notification * @param language set the language of the notification text */ - (void)setLanguage:(NSString *)language; /** * Get Language for Notification * @return language of this notification text */ - (NSString *)getLanguage; /** * Set Text for Notification * @param text set the text for this notification text */ - (void)setText:(NSString *)text; /** * Get Text for Notification * @return text */ - (NSString *)getText; @property (nonatomic, readonly)ajn::services::NotificationText * handle; @end base-16.04/notification/ios/inc/alljoyn/notification/AJNSPropertyStore.h000066400000000000000000000054411272147170000263200ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifndef AJNSPROPERTYSTORE_H_ #define AJNSPROPERTYSTORE_H_ #import #import "Status.h" /** AJNSPropertyStore protocol overview */ @protocol AJNSPropertyStore #pragma mark – Protocol enum ///--------------------- /// @name Protocol enum ///--------------------- /** * Filter has three possible values ANNOUNCE, READ,WRITE * READ is for data that is marked as read * ANNOUNCE is for data that is marked as announce * WRITE is for data that is marked as write */ typedef NS_ENUM (NSInteger, AJNSFilter) { ANNOUNCE, /** ANNOUNCE Property that has ANNOUNCE enabled */ READ, /** READ Property that has READ enabled */ WRITE, /* WRITE Property that has WRITE enabled */ }; #pragma mark – Protocol methods /** Calls Reset() implemented only for ConfigService @return status */ - (QStatus)Reset; /** Reads all properties method @param languageTag is the language to use for the action can be NULL meaning default. @param filter filter describe which properties to read. @param all all reference to MsgArg @return status */ - (QStatus)ReadAllWithLanguageTag:(NSString *)languageTag andFilter:(AJNSFilter)filter andAllMsgArg:(ajn ::MsgArg &)all; /** Update properties method @param name name of the property @param languageTag languageTag is the language to use for the action can be NULL meaning default. @param value value is a pointer to the data to change. @return status */ - (QStatus)UpdatePropertyName:(NSString *)name andLanguageTag:(NSString *)languageTag andValue:(ajn ::MsgArg *)value; /** Delete property method @param name name of the property @param languageTag languageTag is the language to use for the action can't be NULL. @return status */ - (QStatus)DeletePropertyName:(NSString *)name andLanguageTag:(NSString *)languageTag; @end #endif /* AJNSPROPERTYSTORE_H_ */ base-16.04/notification/ios/inc/alljoyn/notification/AJNSRichAudioUrl.h000066400000000000000000000035361272147170000260140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/RichAudioUrl.h" /** AJNSRichAudioUrl class stores RichAudio urls, a url per language */ @interface AJNSRichAudioUrl : NSObject ///--------------------- /// @name Properties ///--------------------- /** richAudioUrlHandler */ @property (nonatomic)ajn::services::RichAudioUrl * richAudioUrlHandler; @property (strong, nonatomic) NSString *url; @property (strong, nonatomic) NSString *language; #pragma mark – Initializers ///--------------------- /// @name Initialization ///--------------------- /** Designated initializer - Returns a AJNSRichAudioUrl object by a given parameters. @param language Language of Audio Content @param url URL for Audio Content */ - (AJNSRichAudioUrl *)initRichAudioUrlWithLang:(NSString *)language andUrl:(NSString *)url; - (void)setUrl:(NSString *)url; - (void)setLanguage:(NSString *)language; @end base-16.04/notification/ios/samples/000077500000000000000000000000001272147170000173635ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/000077500000000000000000000000001272147170000233325ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/.gitignore000066400000000000000000000000441272147170000253200ustar00rootroot00000000000000NotificationService.mobileprovision base-16.04/notification/ios/samples/NotificationService/ConsumerViewController.h000066400000000000000000000034661272147170000302060ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusAttachment.h" #import "alljoyn/services_common/AJSVCGenericLoggerDefaultImpl.h" @interface ConsumerViewController : UIViewController @property (weak, nonatomic) UIViewController *mainVC; @property (weak, nonatomic) IBOutlet UIButton *consumerLangButton; @property (weak, nonatomic) IBOutlet UIButton *dismissChosen; @property (weak, nonatomic) IBOutlet UIButton *actionOnChosen; @property (weak, nonatomic) IBOutlet UITableView *notificationTableView; // Shared @property (strong, nonatomic) AJNBusAttachment *busAttachment; @property (strong, nonatomic) AJSVCGenericLoggerDefaultImpl *logger; @property (strong, nonatomic) NSString *appName; @property (strong, nonatomic) NSString *consumerLang; - (QStatus)startConsumer; - (void)stopConsumer:(bool) isProducerOn; @end base-16.04/notification/ios/samples/NotificationService/ConsumerViewController.m000066400000000000000000000316171272147170000302120ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "ConsumerViewController.h" #import "alljoyn/notification/AJNSNotificationService.h" #import "alljoyn/notification/AJNSNotificationReceiver.h" #import "alljoyn/services_common/AJSVCGenericLoggerUtil.h" #import "DetailsCell.h" #import "NotificationEntry.h" #import "alljoyn/controlpanel/AJCPSGetControlPanelViewController.h" static NSString *const DEFAULT_APP_NAME = @"DISPLAY_ALL"; static NSString *const CONSUMER_DEFAULT_LANG = @"en"; @interface ConsumerViewController () @property (weak, nonatomic) AJNSNotificationService *consumerService; @property (strong, nonatomic) UIAlertView *selectConsumerLang; @property (strong, nonatomic) NSMutableArray *notificationEntries; // array of NotificationEntry objects @end @implementation ConsumerViewController - (void)viewDidLoad { [super viewDidLoad]; [self.view setHidden:YES]; [self.notificationTableView setContentOffset:self.notificationTableView.contentOffset animated:NO]; _notificationEntries = [[NSMutableArray alloc] init]; } - (void) viewWillAppear:(BOOL)animated { [self.navigationController setNavigationBarHidden:YES animated:NO]; [super viewWillAppear:animated]; } - (QStatus)startConsumer { QStatus status; // Initialize Service object and send it Notification Receiver object self.consumerService = [AJNSNotificationService sharedInstance]; /* This is an example of using the AJNSNotificationService default Logger (QSCGenericLoggerDefaultImpl) // Get the default logger [self.consumerService logger]; // Get the default logger log level [self.consumerService logLevel] // Set a new logger level [self.consumerService setLogLevel:QLEVEL_WARN]; // Print the new log level // NSString *newLogLevel = [NSString stringWithFormat:@"Consumer Logger has started in %@ mode", [AJSVCGenericLoggerUtil toStringQLogLevel:[self.consumerService logLevel]]]; // [[self.consumerService logger] debugTag:[[self class] description] text: newLogLevel]; // Instead, you can use a self implementation logger as shown below: */ [self.consumerService setLogLevel:QLEVEL_DEBUG]; if (!self.busAttachment) { [self.logger fatalTag:[[self class] description] text:@"BusAttachment is nil"]; return ER_FAIL; } // Call "initReceive" status = [self.consumerService startReceive:self.busAttachment withReceiver:self]; if (status != ER_OK) { [self.logger fatalTag:[[self class] description] text:@"Could not initialize receiver"]; return ER_FAIL; } // Set Consumer UI [self.logger debugTag:[[self class] description] text:@"Waiting for notifications"]; return ER_OK; } - (void)stopConsumer:(bool) isProducerOn { [self.logger debugTag:[[self class] description] text:@"Stop Consumer service"]; if (self.consumerService && isProducerOn) { [self.consumerService shutdownReceiver]; [self.logger debugTag:[[self class] description] text:@"calling shutdownReceiver"]; } else { [self.consumerService shutdown]; [self.logger debugTag:[[self class] description] text:@"calling shutdown"]; } self.consumerService = nil; [self.notificationEntries removeAllObjects]; [self.notificationTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } // Add AJNSNotification text to the scroll view - (void)addToUITableView:(AJNSNotification *)ajnsNotification { NotificationEntry *notificationEntry= [[NotificationEntry alloc] initWithAJNSNotification:ajnsNotification andConsumerViewController:self ]; notificationEntry.dismissed = NO; [self.notificationEntries addObject:notificationEntry]; [self.notificationTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; [self scrollToLastRow]; } -(void)logNotification:(AJNSNotification *)ajnsNotification { NSMutableString *notificationContent = [[NSMutableString alloc] init]; [notificationContent appendFormat:@"Application name: %@\n[current app name is %@]\n", [ajnsNotification appName], self.appName]; [notificationContent appendFormat:@"Message id: '%d'\n",[ajnsNotification messageId]]; [notificationContent appendFormat:@"MessageType: '%@'\n",[AJNSNotificationEnums AJNSMessageTypeToString:[ajnsNotification messageType]]]; [notificationContent appendFormat:@"Device id: '%@'\n",[ajnsNotification deviceId]]; [notificationContent appendFormat:@"Device Name: '%@'\n",[ajnsNotification deviceName]]; [notificationContent appendFormat:@"Sender: '%@'\n",[ajnsNotification senderBusName]]; [notificationContent appendFormat:@"AppId: '%@'\n",[ajnsNotification appId]]; // [notificationContent appendFormat:@"CustomAttributes: '%@'\n",[ajnsNotification.customAttributes description]]; [notificationContent appendFormat:@"richIconUrl: '%@'\n",[ajnsNotification richIconUrl]]; NSMutableArray *array = [[NSMutableArray alloc]init]; [ajnsNotification richAudioUrl:array]; if ([array count]) { [notificationContent appendString:@"RichAudioUrl: "]; for (AJNSRichAudioUrl *richAudioURL in array) { [notificationContent appendFormat:@"'%@'",[richAudioURL url]]; } [notificationContent appendString:@"\n"]; } else { [notificationContent appendFormat:@"RichAudioUrl is empty\n"]; } [notificationContent appendFormat:@"richIconObjPath: '%@'\n",[ajnsNotification richIconObjectPath]]; [notificationContent appendFormat:@"RichAudioObjPath: '%@'\n",[ajnsNotification richAudioObjectPath]]; [notificationContent appendFormat:@"CPS Path: '%@'\n",[ajnsNotification controlPanelServiceObjectPath]]; AJNSNotificationText *nt = ajnsNotification.ajnsntArr[0]; [notificationContent appendFormat:@"First msg: '%@' [total: %lu]\n", [nt getText], (unsigned long)[ajnsNotification.ajnsntArr count]]; [notificationContent appendFormat:@"Received message Lang: '%@'\n",[nt getLanguage]]; [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Received new Notification:\n%@", notificationContent]]; } #pragma mark - AJNSNotificationReceiver protocol methods - (void)dismissMsgId:(const int32_t)msgId appId:(NSString*) appId { // find the message: for (NotificationEntry *entry in self.notificationEntries) { if ([entry.ajnsNotification messageId] == msgId && [[entry.ajnsNotification appId] isEqualToString:appId]) { [entry setDismissed:YES]; [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"msgId:%d appId:%@ dismissed",msgId,appId]]; } } [self.notificationTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } // Parse AJNSNotification into a string - (void)receive:(AJNSNotification *)ajnsNotification { [self logNotification:ajnsNotification]; //show notification only if (appName is DISPLAY_ALL) || (received app name matches appName) if ((([self.appName isEqualToString:DEFAULT_APP_NAME]) || ([[ajnsNotification appName] isEqualToString:self.appName]))) { if (self.consumerLang == nil) { self.consumerLang = CONSUMER_DEFAULT_LANG; } [self addToUITableView:ajnsNotification]; } else { [self.logger debugTag:[[self class] description] text:@"The received msg app name does not match the application name"]; return; } } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } - (void)showSelectLanguageAlert { NSArray *langArray = [[NSMutableArray alloc] initWithObjects:@"English", @"Hebrew", @"Russian", nil]; self.selectConsumerLang = [[UIAlertView alloc] initWithTitle:@"Select Language" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; for (NSString *str in langArray) { [self.selectConsumerLang addButtonWithTitle:str]; } [self.selectConsumerLang show]; } #pragma mark - UIAlertView delegate function - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { return; // Cancel pressed } if (alertView == self.selectConsumerLang) { self.consumerLang = [self convertToLangCode:[alertView buttonTitleAtIndex:buttonIndex]]; [self.consumerLangButton setTitle:[alertView buttonTitleAtIndex:buttonIndex] forState:UIControlStateNormal]; } } #pragma mark - Application util methods - (NSString *)convertToLangCode:(NSString *)value { if ([value isEqualToString:@"English"]) { return @"en"; } else if ([value isEqualToString:@"Hebrew"]) { return @"he"; } else if ([value isEqualToString:@"Russian"]) { return @"ru"; } return nil; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections - Currently we use only 1 section return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [self.notificationEntries count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { DetailsCell *cell = (DetailsCell *)[tableView dequeueReusableCellWithIdentifier:@"detailsCell" forIndexPath:indexPath]; cell.notificationEntry = self.notificationEntries[indexPath.row]; // Configure the cell... cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } #pragma mark - IBActions - (IBAction)consumerLangButtonPressed:(UIButton *)sender { [self showSelectLanguageAlert]; } - (IBAction)dismissChosenPressed:(UIButton *)sender { for (NotificationEntry *entry in self.notificationEntries) { if (entry.chosen) { NSLog(@"sending dismiss to %@",[entry.ajnsNotification text]); [entry.ajnsNotification dismiss]; } } } - (IBAction)actionOnChosenPressed:(UIButton *)sender { __block NSInteger cnt = 0; [self.notificationEntries enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NotificationEntry *entry = (NotificationEntry *)obj; if (entry.chosen) { cnt++; } }]; if (cnt > 1) { [[[UIAlertView alloc]initWithTitle:@"More than one notification chosen" message:@"select single notification to get notification with action" delegate:Nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; return; } for (NotificationEntry *entry in self.notificationEntries) { if (entry.chosen) { NSLog(@"Action requested."); // Checking if entry has CPS objectpath NSString *cpsObjectPath = [entry.ajnsNotification controlPanelServiceObjectPath]; if ([cpsObjectPath length]) { NSString *message = [NSString stringWithFormat:@"This notification has an action at path: %@", cpsObjectPath]; [[[UIAlertView alloc] initWithTitle:@"Info" message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } else { NSLog(@"%@ has no CPS object path", [entry.ajnsNotification text]); [[[UIAlertView alloc] initWithTitle:@"Info" message:@"This notification doesn't have an action." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; //deselect cell entry.chosen = NO; [self.notificationTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; } } } } -(void)scrollToLastRow { [NSThread sleepForTimeInterval:1]; int lastRowNumber = [self.notificationTableView numberOfRowsInSection:0] - 1; NSIndexPath* ip = [NSIndexPath indexPathForRow:lastRowNumber inSection:0]; [self.notificationTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionTop animated:YES]; } @end base-16.04/notification/ios/samples/NotificationService/DetailsCell.h000066400000000000000000000022641272147170000256740ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "NotificationEntry.h" @interface DetailsCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *detailsLabel; @property (weak,nonatomic) NotificationEntry *notificationEntry; @end base-16.04/notification/ios/samples/NotificationService/DetailsCell.m000066400000000000000000000046421272147170000257030ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "DetailsCell.h" @implementation DetailsCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; if ([self.notificationEntry dismissed]) { [self setAccessoryType:UITableViewCellAccessoryNone]; [self.notificationEntry setChosen:NO]; return; } if(selected) { if (self.accessoryType == UITableViewCellAccessoryNone) { [self setAccessoryType:UITableViewCellAccessoryCheckmark]; [self.notificationEntry setChosen:YES]; } else { [self setAccessoryType:UITableViewCellAccessoryNone]; [self.notificationEntry setChosen:NO]; } } } -(void)setNotificationEntry:(NotificationEntry *)notificationEntry { _notificationEntry = notificationEntry; self.detailsLabel.text = notificationEntry.text; if([self.notificationEntry chosen]) { [self setAccessoryType:UITableViewCellAccessoryCheckmark]; } else { [self setAccessoryType:UITableViewCellAccessoryNone]; } if([self.notificationEntry dismissed]) { [self setBackgroundColor:[UIColor yellowColor]]; } else { [self setBackgroundColor:[UIColor whiteColor]]; } } @end base-16.04/notification/ios/samples/NotificationService/MainStoryboard_iPhone.storyboard000066400000000000000000001173211272147170000317100ustar00rootroot00000000000000 base-16.04/notification/ios/samples/NotificationService/MainViewController.h000066400000000000000000000024071272147170000272710ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import @interface MainViewController : UIViewController @property (weak, nonatomic) IBOutlet UITextField *appNameTextField; @property (weak, nonatomic) IBOutlet UISegmentedControl *appModeSegmentController; - (IBAction)appModeSegmentCtrlValueChanged:(id)sender; @end base-16.04/notification/ios/samples/NotificationService/MainViewController.m000066400000000000000000000235601272147170000273010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "MainViewController.h" #import #import "AJNBus.h" #import "AJNBusAttachment.h" #import "alljoyn/services_common/AJSVCGenericLoggerDefaultImpl.h" #import "ProducerViewController.h" #import "ConsumerViewController.h" #import "NotificationUtils.h" static NSString * const DEFAULT_APP_NAME = @"DISPLAY_ALL"; static NSString * const DAEMON_QUIET_PREFIX = @"quiet@"; // For tcl static NSString * const DAEMON_NAME = @"org.alljoyn.BusNode.IoeService"; // For tcl @interface MainViewController () @property (strong, nonatomic) AJNBusAttachment *busAttachment; @property (strong, nonatomic) AJSVCGenericLoggerDefaultImpl *logger; @property (strong, nonatomic) ProducerViewController *producerVC; @property (strong, nonatomic) ConsumerViewController *consumerVC; @property (strong, nonatomic) NSString *appName; @property (nonatomic) bool isProducerOn; @property (nonatomic) bool isConsumerOn; @property (nonatomic) bool hasAppName; @end @implementation MainViewController #pragma mark - Built In methods - (void)viewDidLoad { [super viewDidLoad]; self.appModeSegmentController.momentary = true; // Set flags self.isConsumerOn = false; self.isProducerOn = false; self.hasAppName = false; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.destinationViewController isKindOfClass:[ProducerViewController class]]) { self.producerVC = segue.destinationViewController; } if ([segue.destinationViewController isKindOfClass:[ConsumerViewController class]]) { self.consumerVC = segue.destinationViewController; } } // Autorotation support - (BOOL)shouldAutorotate { return YES; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } // Limit app rotation to portrait - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } #pragma mark - IBAction Methods // application mode (consumer/producer) - (IBAction)appModeSegmentCtrlValueChanged:(id)sender { QStatus status; if (!self.isConsumerOn && !self.isProducerOn) { [self.logger debugTag:[[self class] description] text:@"loadNewSession"]; status = [self loadNewSession]; if (ER_OK != status) { [[[UIAlertView alloc] initWithTitle:@"Startup Error" message:[NSString stringWithFormat:@"%@ (%@)",@"Failed to prepare AJNBusAttachment", [AJNStatus descriptionForStatusCode:status]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; return; } } // If application name hasn't been set - use the default if (!self.hasAppName) { self.appName = DEFAULT_APP_NAME; self.hasAppName = true; [self.appNameTextField setEnabled:NO]; } int appMode = self.appModeSegmentController.selectedSegmentIndex; switch (appMode) { case 0: // Producer if (!self.isProducerOn) { // Start producer [self.logger debugTag:[[self class] description] text:@"Starting producer...."]; // Forward shared properties self.producerVC.busAttachment = self.busAttachment; self.producerVC.logger = self.logger; self.producerVC.appName = self.appName; // Present view [self.producerVC.view setHidden:NO]; // Set service flag self.isProducerOn = true; status = [self.producerVC startProducer]; if (ER_OK != status) { [self.logger debugTag:[[self class] description] text:@"Failed to startProducer"]; [self producerCleanup]; } } else { [self producerCleanup]; } break; case 1: // Consumer if (!self.isConsumerOn) { //Start consumer [self.logger debugTag:[[self class] description] text:@"Starting consumer..."]; // Forward shared properties self.consumerVC.busAttachment = self.busAttachment; self.consumerVC.logger = self.logger; self.consumerVC.appName = self.appName; // Present view [self.consumerVC.view setHidden:NO]; // Set service flag self.isConsumerOn = true; status = [self.consumerVC startConsumer]; if (ER_OK != status) { [self.logger debugTag:[[self class] description] text:@"Failed to startConsumer"]; [[[UIAlertView alloc] initWithTitle:@"Startup Error" message:[NSString stringWithFormat:@"%@ (%@)",@"Failed to startConsumer", [AJNStatus descriptionForStatusCode:status]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; [self consumerCleanup]; } } else { [self consumerCleanup]; } break; } if (self.isConsumerOn || self.isProducerOn) { // Disable application name editing [self.logger debugTag:[[self class] description] text:@"Application has started - disable application name editing"]; [self.appNameTextField setEnabled:NO]; } // Both services are off - closing session if (!self.isConsumerOn && !self.isProducerOn) { [self closeSession]; } } - (IBAction)appNameChange:(UITextField *)sender { if ([NotificationUtils textFieldIsValid:self.appNameTextField.text]) { self.appName = self.appNameTextField.text; self.hasAppName = true; } else { self.appName = DEFAULT_APP_NAME; self.appNameTextField.text = @""; self.hasAppName = false; } } #pragma mark - Util methods - (QStatus)loadNewSession { QStatus status = ER_OK; // Set a default logger self.logger = [[AJSVCGenericLoggerDefaultImpl alloc] init]; // Set a bus if (!self.busAttachment) { status = [self prepareBusAttachment:nil]; if (ER_OK != status) { [self.logger debugTag:@"" text:@"Failed to prepareBusAttachment"]; return status; } else { [self.logger debugTag:[[self class] description] text:@"Bus is ready to use"]; } } return status; } - (void)closeSession { QStatus status; [self.logger debugTag:[[self class] description] text:@"Both services are off"]; // reset the application Text view [self.appNameTextField setEnabled:YES]; self.appNameTextField.text = @""; self.hasAppName = false; // stop bus attachment [self.logger debugTag:[[self class] description] text:@"Stopping the bus..."]; if (self.busAttachment) { status = [self.busAttachment stop]; if (status != ER_OK) { [self.logger debugTag:[[self class] description] text:@"failed to stop the bus"]; } self.busAttachment = nil; } // destroy logger if (self.logger) { self.logger = nil; } } - (QStatus)prepareBusAttachment:(id )authListener { self.busAttachment = [[AJNBusAttachment alloc] initWithApplicationName:@"CommonServiceApp" allowRemoteMessages:true]; // Start the BusAttachment QStatus status = [self.busAttachment start]; if (status != ER_OK) { [self.logger errorTag:[[self class] description] text:@"Failed to start AJNBusAttachment"]; [self.busAttachment destroy]; return ER_FAIL; } // Connect to the daemon using address provided status = [self.busAttachment connectWithArguments:nil]; if (status != ER_OK) { [self.busAttachment destroy]; return ER_FAIL; } if (authListener) { status = [self.busAttachment enablePeerSecurity:@"ALLJOYN_SRP_KEYX ALLJOYN_ECDHE_PSK" authenticationListener:authListener]; if (status != ER_OK) { [self.busAttachment destroy]; return ER_FAIL; } } // advertise Daemon status = [self.busAttachment requestWellKnownName:DAEMON_NAME withFlags:kAJNBusNameFlagDoNotQueue]; if (status == ER_OK) { //advertise the name with a quite prefix for TC to find it status = [self.busAttachment advertiseName:[NSString stringWithFormat:@"%@%@", DAEMON_QUIET_PREFIX, DAEMON_NAME] withTransportMask:kAJNTransportMaskAny]; if (status != ER_OK) { [self.busAttachment releaseWellKnownName:DAEMON_NAME]; [self.logger errorTag:[[self class] description] text:@"Failed to advertise daemon name"]; } else { [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Succefully advertised daemon name %@", DAEMON_NAME]]; } } return status; } - (void)producerCleanup { [self.logger debugTag:[[self class] description] text:@"Stopping producer...."]; [self.producerVC.view setHidden:YES]; [self.producerVC stopProducer:self.isConsumerOn]; self.isProducerOn = false; } - (void)consumerCleanup { [self.logger debugTag:[[self class] description] text:@"Stopping consumer..."]; [self.consumerVC.view setHidden:YES]; [self.consumerVC stopConsumer:self.isProducerOn]; self.isConsumerOn = false; } @end base-16.04/notification/ios/samples/NotificationService/NotificationEntry.h000066400000000000000000000027111272147170000271540ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "alljoyn/notification/AJNSNotification.h" #import "ConsumerViewController.h" @interface NotificationEntry : NSObject @property (strong, nonatomic) NSString *text; @property (nonatomic) BOOL dismissed; @property (nonatomic) BOOL chosen; @property (strong, nonatomic,readonly) AJNSNotification *ajnsNotification; - (id)initWithAJNSNotification:(AJNSNotification *) ajnsNotification andConsumerViewController:(ConsumerViewController *)consumerViewController; @end base-16.04/notification/ios/samples/NotificationService/NotificationEntry.m000066400000000000000000000104151272147170000271610ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "NotificationEntry.h" #import "NotificationUtils.h" @interface NotificationEntry () @property (strong, nonatomic) AJNSNotification *ajnsNotification; @property (weak,nonatomic) ConsumerViewController *consumerViewController; @end @implementation NotificationEntry - (id)initWithAJNSNotification:(AJNSNotification *) ajnsNotification andConsumerViewController:(ConsumerViewController *)consumerViewController { self = [super init]; if (self) { self.consumerViewController = consumerViewController; self.ajnsNotification = ajnsNotification; } return self; } -(void)setAjnsNotification:(AJNSNotification *)ajnsNotification { _ajnsNotification = ajnsNotification; //show AJNSNotification on self.notificationTextView NSString *nstr = @""; NSString *lang; bool matchLangFlag = false; nstr = [nstr stringByAppendingString:[AJNSNotificationEnums AJNSMessageTypeToString:[ajnsNotification messageType]]]; nstr = [nstr stringByAppendingFormat:@" "]; // get the msg NotificationText for (AJNSNotificationText *nt in ajnsNotification.ajnsntArr) { lang = [nt getLanguage]; if ([lang isEqualToString:self.consumerViewController.consumerLang]) { nstr = [nstr stringByAppendingString:lang]; nstr = [nstr stringByAppendingFormat:@": "]; nstr = [nstr stringByAppendingString:[nt getText]]; nstr = [nstr stringByAppendingFormat:@" "]; matchLangFlag = true; } } //for if (!matchLangFlag) { nstr = [nstr stringByAppendingString:[NSString stringWithFormat:@"\nUnknown language(s) in notification,\n the last one was '%@'",lang]]; self.text = nstr; [self.consumerViewController.logger debugTag:[[self class] description] text:@"The received message lang does not match the consumer lang settings"]; return; } // get the msg NotificationText NSString *richIconUrl = [ajnsNotification richIconUrl]; if ([NotificationUtils textFieldIsValid:richIconUrl]) { nstr = [nstr stringByAppendingFormat:@"\nicon: %@", richIconUrl]; } // get the msg richAudioUrl __strong NSMutableArray *richAudioUrlArray = [[NSMutableArray alloc] init]; [ajnsNotification richAudioUrl:richAudioUrlArray]; int i = 0; for (int x = 0; x != [richAudioUrlArray count]; x++) { [self.consumerViewController.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"%d", i]]; i++; NSString *lang = [(AJNSRichAudioUrl *)[richAudioUrlArray objectAtIndex:x] language]; NSString *audiourl = [(AJNSRichAudioUrl *)[richAudioUrlArray objectAtIndex:x] url]; [self.consumerViewController.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"lang[%@]", lang]]; [self.consumerViewController.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"audiourl[%@]", audiourl]]; if ([lang isEqualToString:(self.consumerViewController.consumerLang)]) { nstr = [nstr stringByAppendingFormat:@"\naudio: %@", audiourl]; } } //for [self.consumerViewController.logger debugTag:[[self class] description] text:([NSString stringWithFormat:@"Adding notification to view:\n %@", nstr])]; self.text = nstr; } @end base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj/000077500000000000000000000000001272147170000312755ustar00rootroot00000000000000project.pbxproj000066400000000000000000000713521272147170000343020ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 1918E02717AE7C2D0082AB83 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E02617AE7C2D0082AB83 /* UIKit.framework */; }; 1918E02917AE7C2D0082AB83 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E02817AE7C2D0082AB83 /* Foundation.framework */; }; 1918E02B17AE7C2D0082AB83 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E02A17AE7C2D0082AB83 /* CoreGraphics.framework */; }; 1918E04F17AE84C40082AB83 /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E04E17AE84C40082AB83 /* libstdc++.dylib */; }; 1918E0A817AE8BFB0082AB83 /* libstdc++.6.0.9.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E0A617AE8BFB0082AB83 /* libstdc++.6.0.9.dylib */; }; 1918E0A917AE8BFB0082AB83 /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E0A717AE8BFB0082AB83 /* libstdc++.6.dylib */; }; 191A7AD31885443600B9AAAE /* ProducerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 191A7AD21885443600B9AAAE /* ProducerViewController.m */; }; 191A7AD91885889400B9AAAE /* NotificationUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 191A7AD81885889400B9AAAE /* NotificationUtils.mm */; }; 1958161C17C2670E00DC6AB4 /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1958161917C2670E00DC6AB4 /* libc++.1.dylib */; }; 1958161D17C2670E00DC6AB4 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1958161A17C2670E00DC6AB4 /* libc++.dylib */; }; 1958161E17C2670E00DC6AB4 /* libc++abi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1958161B17C2670E00DC6AB4 /* libc++abi.dylib */; }; 1958165A17C3927600DC6AB4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1918E04C17AE84B60082AB83 /* SystemConfiguration.framework */; }; 19DCFB8118A7DFAF009EC74D /* ConsumerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 191A7ACC188543A000B9AAAE /* ConsumerViewController.m */; }; 87B9411A1A76B29C00DED7C3 /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 87B941191A76B29C00DED7C3 /* libc.dylib */; }; 9A056B561833B40000A77A36 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A056B3D1833B40000A77A36 /* MainStoryboard_iPhone.storyboard */; }; 9A056B571833B40000A77A36 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A056B401833B40000A77A36 /* AppDelegate.m */; }; 9A056B581833B40000A77A36 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A056B411833B40000A77A36 /* Default-568h@2x.png */; }; 9A056B591833B40000A77A36 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A056B421833B40000A77A36 /* Default.png */; }; 9A056B5A1833B40000A77A36 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A056B431833B40000A77A36 /* Default@2x.png */; }; 9A056B5B1833B40000A77A36 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A056B441833B40000A77A36 /* InfoPlist.strings */; }; 9A056B5E1833B40000A77A36 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A056B4A1833B40000A77A36 /* main.m */; }; 9A056B621833B40000A77A36 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A056B541833B40000A77A36 /* MainViewController.m */; }; 9AB3D32A18A0E96300E7E0EA /* DetailsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3D32918A0E96300E7E0EA /* DetailsCell.m */; }; 9AB3D32D18A0ECAB00E7E0EA /* NotificationEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3D32C18A0ECAB00E7E0EA /* NotificationEntry.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1918E02317AE7C2D0082AB83 /* NotificationService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NotificationService.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1918E02617AE7C2D0082AB83 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 1918E02817AE7C2D0082AB83 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1918E02A17AE7C2D0082AB83 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 1918E04C17AE84B60082AB83 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 1918E04E17AE84C40082AB83 /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; }; 1918E0A617AE8BFB0082AB83 /* libstdc++.6.0.9.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.0.9.dylib"; path = "usr/lib/libstdc++.6.0.9.dylib"; sourceTree = SDKROOT; }; 1918E0A717AE8BFB0082AB83 /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; }; 191A7ACB188543A000B9AAAE /* ConsumerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsumerViewController.h; sourceTree = ""; }; 191A7ACC188543A000B9AAAE /* ConsumerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConsumerViewController.m; sourceTree = ""; }; 191A7AD11885443600B9AAAE /* ProducerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProducerViewController.h; sourceTree = ""; }; 191A7AD21885443600B9AAAE /* ProducerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProducerViewController.m; sourceTree = ""; }; 191A7AD71885889400B9AAAE /* NotificationUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationUtils.h; sourceTree = ""; }; 191A7AD81885889400B9AAAE /* NotificationUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NotificationUtils.mm; sourceTree = ""; }; 1958161917C2670E00DC6AB4 /* libc++.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.1.dylib"; path = "usr/lib/libc++.1.dylib"; sourceTree = SDKROOT; }; 1958161A17C2670E00DC6AB4 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; 1958161B17C2670E00DC6AB4 /* libc++abi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++abi.dylib"; path = "usr/lib/libc++abi.dylib"; sourceTree = SDKROOT; }; 87B941191A76B29C00DED7C3 /* libc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libc.dylib; path = usr/lib/libc.dylib; sourceTree = SDKROOT; }; 9A056B3D1833B40000A77A36 /* MainStoryboard_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 9A056B3F1833B40000A77A36 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = NotificationService/AppDelegate.h; sourceTree = ""; }; 9A056B401833B40000A77A36 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = NotificationService/AppDelegate.m; sourceTree = ""; }; 9A056B411833B40000A77A36 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "NotificationService/Default-568h@2x.png"; sourceTree = ""; }; 9A056B421833B40000A77A36 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = NotificationService/Default.png; sourceTree = ""; }; 9A056B431833B40000A77A36 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "NotificationService/Default@2x.png"; sourceTree = ""; }; 9A056B451833B40000A77A36 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9A056B4A1833B40000A77A36 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = NotificationService/main.m; sourceTree = ""; }; 9A056B4B1833B40000A77A36 /* NotificationService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "NotificationService-Info.plist"; path = "NotificationService/NotificationService-Info.plist"; sourceTree = ""; }; 9A056B4C1833B40000A77A36 /* NotificationService-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NotificationService-Prefix.pch"; path = "NotificationService/NotificationService-Prefix.pch"; sourceTree = ""; }; 9A056B531833B40000A77A36 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 9A056B541833B40000A77A36 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 9AB3D32818A0E96300E7E0EA /* DetailsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailsCell.h; sourceTree = ""; }; 9AB3D32918A0E96300E7E0EA /* DetailsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailsCell.m; sourceTree = ""; }; 9AB3D32B18A0ECAB00E7E0EA /* NotificationEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationEntry.h; sourceTree = ""; }; 9AB3D32C18A0ECAB00E7E0EA /* NotificationEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationEntry.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 1918E02017AE7C2C0082AB83 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 87B9411A1A76B29C00DED7C3 /* libc.dylib in Frameworks */, 1958161D17C2670E00DC6AB4 /* libc++.dylib in Frameworks */, 1958161C17C2670E00DC6AB4 /* libc++.1.dylib in Frameworks */, 1958161E17C2670E00DC6AB4 /* libc++abi.dylib in Frameworks */, 1918E04F17AE84C40082AB83 /* libstdc++.dylib in Frameworks */, 1918E0A917AE8BFB0082AB83 /* libstdc++.6.dylib in Frameworks */, 1918E0A817AE8BFB0082AB83 /* libstdc++.6.0.9.dylib in Frameworks */, 1958165A17C3927600DC6AB4 /* SystemConfiguration.framework in Frameworks */, 1918E02717AE7C2D0082AB83 /* UIKit.framework in Frameworks */, 1918E02917AE7C2D0082AB83 /* Foundation.framework in Frameworks */, 1918E02B17AE7C2D0082AB83 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 1918E01A17AE7C2C0082AB83 = { isa = PBXGroup; children = ( 9AB3D32718A0E93D00E7E0EA /* UITableViewCell */, 191A7AC7188541EE00B9AAAE /* ViewControllers */, 191A7ACA1885426600B9AAAE /* Utils */, 191A7AC91885425800B9AAAE /* StoryBoards */, 191A7AC81885424D00B9AAAE /* Resources */, 1918E02517AE7C2D0082AB83 /* Frameworks */, 1918E02417AE7C2D0082AB83 /* Products */, ); sourceTree = ""; }; 1918E02417AE7C2D0082AB83 /* Products */ = { isa = PBXGroup; children = ( 1918E02317AE7C2D0082AB83 /* NotificationService.app */, ); name = Products; sourceTree = ""; }; 1918E02517AE7C2D0082AB83 /* Frameworks */ = { isa = PBXGroup; children = ( 87B941191A76B29C00DED7C3 /* libc.dylib */, 1958161A17C2670E00DC6AB4 /* libc++.dylib */, 1958161917C2670E00DC6AB4 /* libc++.1.dylib */, 1958161B17C2670E00DC6AB4 /* libc++abi.dylib */, 1918E04E17AE84C40082AB83 /* libstdc++.dylib */, 1918E0A717AE8BFB0082AB83 /* libstdc++.6.dylib */, 1918E0A617AE8BFB0082AB83 /* libstdc++.6.0.9.dylib */, 1918E04C17AE84B60082AB83 /* SystemConfiguration.framework */, 1918E02617AE7C2D0082AB83 /* UIKit.framework */, 1918E02817AE7C2D0082AB83 /* Foundation.framework */, 1918E02A17AE7C2D0082AB83 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 191A7AC7188541EE00B9AAAE /* ViewControllers */ = { isa = PBXGroup; children = ( 191A7AD11885443600B9AAAE /* ProducerViewController.h */, 191A7AD21885443600B9AAAE /* ProducerViewController.m */, 9A056B531833B40000A77A36 /* MainViewController.h */, 9A056B541833B40000A77A36 /* MainViewController.m */, 191A7ACB188543A000B9AAAE /* ConsumerViewController.h */, 191A7ACC188543A000B9AAAE /* ConsumerViewController.m */, ); name = ViewControllers; sourceTree = ""; }; 191A7AC81885424D00B9AAAE /* Resources */ = { isa = PBXGroup; children = ( 9A056B3F1833B40000A77A36 /* AppDelegate.h */, 9A056B401833B40000A77A36 /* AppDelegate.m */, 9A056B411833B40000A77A36 /* Default-568h@2x.png */, 9A056B421833B40000A77A36 /* Default.png */, 9A056B431833B40000A77A36 /* Default@2x.png */, 9A056B441833B40000A77A36 /* InfoPlist.strings */, 9A056B4A1833B40000A77A36 /* main.m */, 9A056B4B1833B40000A77A36 /* NotificationService-Info.plist */, 9A056B4C1833B40000A77A36 /* NotificationService-Prefix.pch */, ); name = Resources; sourceTree = ""; }; 191A7AC91885425800B9AAAE /* StoryBoards */ = { isa = PBXGroup; children = ( 9A056B3D1833B40000A77A36 /* MainStoryboard_iPhone.storyboard */, ); name = StoryBoards; sourceTree = ""; }; 191A7ACA1885426600B9AAAE /* Utils */ = { isa = PBXGroup; children = ( 191A7AD71885889400B9AAAE /* NotificationUtils.h */, 191A7AD81885889400B9AAAE /* NotificationUtils.mm */, ); name = Utils; sourceTree = ""; }; 9AB3D32718A0E93D00E7E0EA /* UITableViewCell */ = { isa = PBXGroup; children = ( 9AB3D32818A0E96300E7E0EA /* DetailsCell.h */, 9AB3D32918A0E96300E7E0EA /* DetailsCell.m */, 9AB3D32B18A0ECAB00E7E0EA /* NotificationEntry.h */, 9AB3D32C18A0ECAB00E7E0EA /* NotificationEntry.m */, ); name = UITableViewCell; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 1918E02217AE7C2C0082AB83 /* NotificationService */ = { isa = PBXNativeTarget; buildConfigurationList = 1918E04917AE7C2D0082AB83 /* Build configuration list for PBXNativeTarget "NotificationService" */; buildPhases = ( 1918E01F17AE7C2C0082AB83 /* Sources */, 1918E02017AE7C2C0082AB83 /* Frameworks */, 1918E02117AE7C2C0082AB83 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = NotificationService; productName = NotificationService.v3; productReference = 1918E02317AE7C2D0082AB83 /* NotificationService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 1918E01B17AE7C2C0082AB83 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0460; ORGANIZATIONNAME = AllJoyn; TargetAttributes = { 1918E02217AE7C2C0082AB83 = { SystemCapabilities = { com.apple.BackgroundModes = { enabled = 1; }; }; }; }; }; buildConfigurationList = 1918E01E17AE7C2C0082AB83 /* Build configuration list for PBXProject "NotificationService" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 1918E01A17AE7C2C0082AB83; productRefGroup = 1918E02417AE7C2D0082AB83 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 1918E02217AE7C2C0082AB83 /* NotificationService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 1918E02117AE7C2C0082AB83 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A056B5B1833B40000A77A36 /* InfoPlist.strings in Resources */, 9A056B5A1833B40000A77A36 /* Default@2x.png in Resources */, 9A056B591833B40000A77A36 /* Default.png in Resources */, 9A056B581833B40000A77A36 /* Default-568h@2x.png in Resources */, 9A056B561833B40000A77A36 /* MainStoryboard_iPhone.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 1918E01F17AE7C2C0082AB83 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 19DCFB8118A7DFAF009EC74D /* ConsumerViewController.m in Sources */, 191A7AD91885889400B9AAAE /* NotificationUtils.mm in Sources */, 191A7AD31885443600B9AAAE /* ProducerViewController.m in Sources */, 9A056B5E1833B40000A77A36 /* main.m in Sources */, 9A056B571833B40000A77A36 /* AppDelegate.m in Sources */, 9AB3D32A18A0E96300E7E0EA /* DetailsCell.m in Sources */, 9A056B621833B40000A77A36 /* MainViewController.m in Sources */, 9AB3D32D18A0ECAB00E7E0EA /* NotificationEntry.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 9A056B441833B40000A77A36 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 9A056B451833B40000A77A36 /* en */, ); name = InfoPlist.strings; path = NotificationService; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 1918E04717AE7C2D0082AB83 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE = ""; "PROVISIONING_PROFILE[sdk=*]" = ""; SDKROOT = iphoneos; SKIP_INSTALL = NO; TARGETED_DEVICE_FAMILY = "1,2"; USE_HEADERMAP = NO; VALID_ARCHS = "armv7 i386"; }; name = Debug; }; 1918E04817AE7C2D0082AB83 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PROVISIONING_PROFILE = "B140D0FD-1531-4C61-9F6E-56A424B03EFA"; "PROVISIONING_PROFILE[sdk=*]" = "B140D0FD-1531-4C61-9F6E-56A424B03EFA"; SDKROOT = iphoneos; SKIP_INSTALL = NO; TARGETED_DEVICE_FAMILY = "1,2"; USE_HEADERMAP = NO; VALIDATE_PRODUCT = YES; VALID_ARCHS = "armv7 i386"; }; name = Release; }; 1918E04A17AE7C2D0082AB83 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "NotificationService/NotificationService-Prefix.pch"; GCC_VERSION = ""; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", "\"$(SRCROOT)/../../../../controlpanel/cpp/inc\"", "\"$(SRCROOT)/../../../../controlpanel/ios/inc\"", "\"$(SRCROOT)/../../../../sample_apps/ios\"", ); INFOPLIST_FILE = "$(SRCROOT)/NotificationService/NotificationService-Info.plist"; INSTALL_PATH = "$(LOCAL_APPS_DIR)"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../controlpanel/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../controlpanel/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_notification_objc", "-lalljoyn_notification_cpp", "-lalljoyn_controlpanel_objc", "-lalljoyn_controlpanel_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = NotificationService; PROVISIONING_PROFILE = ""; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; SKIP_INSTALL = NO; TARGETED_DEVICE_FAMILY = 1; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Debug; }; 1918E04B17AE7C2D0082AB83 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "NotificationService/NotificationService-Prefix.pch"; GCC_VERSION = ""; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", "\"$(SRCROOT)/../../../../controlpanel/cpp/inc\"", "\"$(SRCROOT)/../../../../controlpanel/ios/inc\"", "\"$(SRCROOT)/../../../../sample_apps/ios\"", ); INFOPLIST_FILE = "$(SRCROOT)/NotificationService/NotificationService-Info.plist"; INSTALL_PATH = "$(LOCAL_APPS_DIR)"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../controlpanel/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../controlpanel/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DNS_BLOCK_ASSERTIONS=1", "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_notification_objc", "-lalljoyn_notification_cpp", "-lalljoyn_controlpanel_objc", "-lalljoyn_controlpanel_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = NotificationService; PROVISIONING_PROFILE = ""; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; SKIP_INSTALL = NO; TARGETED_DEVICE_FAMILY = 1; VALIDATE_PRODUCT = YES; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1918E01E17AE7C2C0082AB83 /* Build configuration list for PBXProject "NotificationService" */ = { isa = XCConfigurationList; buildConfigurations = ( 1918E04717AE7C2D0082AB83 /* Debug */, 1918E04817AE7C2D0082AB83 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1918E04917AE7C2D0082AB83 /* Build configuration list for PBXNativeTarget "NotificationService" */ = { isa = XCConfigurationList; buildConfigurations = ( 1918E04A17AE7C2D0082AB83 /* Debug */, 1918E04B17AE7C2D0082AB83 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 1918E01B17AE7C2C0082AB83 /* Project object */; } project.xcworkspace/000077500000000000000000000000001272147170000352145ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeprojcontents.xcworkspacedata000066400000000000000000000002441272147170000421560ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj/project.xcworkspace base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj/xcshareddata/000077500000000000000000000000001272147170000337305ustar00rootroot00000000000000xcschemes/000077500000000000000000000000001272147170000356335ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj/xcshareddataNotificationService.xcscheme000066400000000000000000000063171272147170000433320ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService.xcodeproj/xcshareddata/xcschemes base-16.04/notification/ios/samples/NotificationService/NotificationService/000077500000000000000000000000001272147170000273015ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/AppDelegate.h000066400000000000000000000021331272147170000316240ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end base-16.04/notification/ios/samples/NotificationService/NotificationService/AppDelegate.m000066400000000000000000000063431272147170000316400ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AppDelegate.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; return YES; } -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { do { NSLog(@"Listening in the background... %f", [application backgroundTimeRemaining]); [NSThread sleepForTimeInterval:1.0]; } while ([application backgroundTimeRemaining] > 1.0); completionHandler(UIBackgroundFetchResultFailed); } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end base-16.04/notification/ios/samples/NotificationService/NotificationService/Default-568h@2x.png000066400000000000000000000442421272147170000324430ustar00rootroot00000000000000PNG  IHDRpz$iCCPICC Profile8UoT>oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 1136 2012-07-27T15:07:06 Pixelmator 2.0.5 )q?7IDATx=eQqÙ87;;' RBR(JWw^8w<漏7 @^~:;;>9O @F{}w~|}}ޣ#@~<=9G p;*O_8>^#@ ƻZjLZ9:\oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 320 1 480 2012-07-27T15:07:80 Pixelmator 2.0.5 X="IDATxICQDDKIq/L {nov}y>(oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 960 2012-07-27T15:07:37 Pixelmator 2.0.5 PF5IDATx1e HH܎;qoV..Vb&a^p s3;i^;ޟy!@ <>_{x}~\_Wg @܆vW=̻o]yoλ͇ @vU>yO7ן}* p|W}w}5蛿CaW] @>FmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@W>0  @nVjLJޞy @ܞxޝ<x| @7$pߧ:yOߜ' @~y7O/> @!p[_4lIENDB`base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassets/000077500000000000000000000000001272147170000323425ustar00rootroot00000000000000AppIcon.appiconset/000077500000000000000000000000001272147170000357605ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassetsContents.json000066400000000000000000000014711272147170000404530ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassets/AppIcon.appiconset{ "images" : [ { "idiom" : "iphone", "scale" : "2x", "size" : "60x60" }, { "idiom" : "ipad", "scale" : "1x", "size" : "76x76" }, { "idiom" : "ipad", "scale" : "2x", "size" : "76x76" }, { "idiom" : "iphone", "scale" : "2x", "size" : "40x40" }, { "idiom" : "ipad", "scale" : "1x", "size" : "40x40" }, { "idiom" : "ipad", "scale" : "2x", "size" : "40x40" }, { "idiom" : "iphone", "scale" : "2x", "size" : "29x29" }, { "idiom" : "ipad", "scale" : "1x", "size" : "29x29" }, { "idiom" : "ipad", "scale" : "2x", "size" : "29x29" } ], "info" : { "version" : 1, "author" : "xcode" } }LaunchImage.launchimage/000077500000000000000000000000001272147170000367145ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassetsContents.json000066400000000000000000000021331272147170000414030ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassets/LaunchImage.launchimage{ "images" : [ { "orientation" : "portrait", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" }, { "orientation" : "landscape", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "filename" : "Default@2x.png", "minimum-system-version" : "7.0", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "filename" : "Default-568h@2x.png", "minimum-system-version" : "7.0", "subtype" : "retina4", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } }Default-568h@2x.png000066400000000000000000000442421272147170000420560ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/Images.xcassets/LaunchImage.launchimagePNG  IHDRpz$iCCPICC Profile8UoT>oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 1136 2012-07-27T15:07:06 Pixelmator 2.0.5 )q?7IDATx=eQqÙ87;;' RBR(JWw^8w<漏7 @^~:;;>9O @F{}w~|}}ޣ#@~<=9G p;*O_8>^#@ ƻZjLZ9:\oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 960 2012-07-27T15:07:37 Pixelmator 2.0.5 PF5IDATx1e HH܎;qoV..Vb&a^p s3;i^;ޟy!@ <>_{x}~\_Wg @܆vW=̻o]yoλ͇ @vU>yO7ן}* p|W}w}5蛿CaW] @>FmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@W>0  @nVjLJޞy @ܞxޝ<x| @7$pߧ:yOߜ' @~y7O/> @!p[_4lIENDB`NotificationService-Info.plist000066400000000000000000000045061272147170000351440ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIcons CFBundlePrimaryIcon CFBundleIconFiles NotificationServiceIcon80x80 NotificationServiceIcon58x58 NotificationServiceIcon29x29 NotificationServiceIcon120x120 NotificationServiceIcon114x114 NotificationServiceIcon57x57 CFBundleIdentifier org.alljoyn.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 00.01 CFBundleSignature ???? CFBundleVersion 0110 LSApplicationCategoryType LSRequiresIPhoneOS UIBackgroundModes fetch UIMainStoryboardFile MainStoryboard_iPhone UIMainStoryboardFile~ipad MainStoryboard_iPhone UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight NotificationService-Prefix.pch000066400000000000000000000022571272147170000351260ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #ifndef __IPHONE_5_0 #warning "This project uses features only available in iOS SDK 5.0 and later." #endif #ifdef __OBJC__ #import #import #endif base-16.04/notification/ios/samples/NotificationService/NotificationService/en.lproj/000077500000000000000000000000001272147170000310305ustar00rootroot00000000000000InfoPlist.strings000066400000000000000000000000551272147170000342730ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationService/NotificationService/en.lproj/* Localized versions of Info.plist keys */ base-16.04/notification/ios/samples/NotificationService/NotificationService/main.m000066400000000000000000000027371272147170000304140ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AppDelegate.h" #import "AJNInit.h" int main(int argc, char *argv[]) { @autoreleasepool { if ([AJNInit alljoynInit] != ER_OK) { return 1; } if ([AJNInit alljoynRouterInit] != ER_OK) { [AJNInit alljoynShutdown]; return 1; } int ret = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); [AJNInit alljoynRouterShutdown]; [AJNInit alljoynShutdown]; return ret; } } base-16.04/notification/ios/samples/NotificationService/NotificationServiceIcon114x114.png000066400000000000000000000316771272147170000315020ustar00rootroot00000000000000PNG  IHDRrr݅} AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  )$IDATxY\yOϾ؈\@H͢dERWTIE/KǼ1s?rsΝԐ@C 4$А@C 4$А@C 4$А@~j39z~qƇ|_vlcu@iuv W>[n9xb\t+j3 !s aAPAl.+>B?ʹ_K - eIs(2 ί#[YʝI~?_`"jTG px_O+!{2Bȱ E0EpxqN> cX Q[F7E)HMj3ֶ3I*cm=B`x zg[Cv5/v5\’Z,_/oSUxY7Iexu9ǼN.B!;-!1Xk $J}v~ VSo&Pf4ۥWX: k/ @SQO?;SF?bUqg2x6 d:ivȋV_Q<3ﴆ!5=@* bժ61i# Tu.}֗ ;z0  O$lp4>Prȯ τR7l;&G ^Ȏ`zsh Iҁu"ٜk? amA L4ќ&/.L_jBMFkkߢ  ?PQ/S9XP[on `峈 #3{"sm@;9 "5Kg@wBo)L<CυpÕW:H4'U[TO VJә&@33U.&hZ FG /lNH@[d;'<WL0`5%@&͛(;ѸA90)k (M@x߲ 5y0Ѧnmx gaf::[ک2Qw,ͭo,u/ cbD{M=X~@^O2/3!`'xf)*HP΢ibRH -gIýF^@C" k0 Ma|%\Vd &;iB5դu?{1Ds01towh>r/H% 6cDGҚ~ flSQ&6/-l9hn>J?7 2|!NX!dIY|4;6K!_X.1֙J`&Fb f43_>:{@siwt;ir:x$gmD99XN#Ű!=xGz3B C o:æ;QʧI}ILcDg@#(S(8͕ڹ2EsdW1*i*{[D:]4r/__`@8K 꼟 Li/gY5'?OJS5Cγan ڇ"a4eF 3n2jGhEfW|_:V灧Q"$'Mx|lT? <ةHvd+K0Mwez&,:<"_C/߀? ~(ɻu)5 sY8ԡvhz۾v+sz`Ͷ F>0Btlnؠ[YjW*:ȅsڳ+V s8ÏgMmD] {yJ},!bܙW3D3%ƊNl NH^RL:}g c&ҫic-,\jѲ:޾Sh>'niRJgd@{(EjKo1w-]A}Iy"\ >deVAC'鄵Z y^٠Y]A3anH5CԇKl?.Ď(i\r3>^I"d1BD8Sf`Q!ss>fM$`{H\@1@JI"/2ō0 LK$-E5w#aӀ)V.ȬN[We0HV 3>,`Ub|V/{Ks1yaԳ0nnr]Sx`g(v-l I+lMnפ>5tC3t}+[+op(): @sȶ%}f͘+W(=~u J/aZO(b =#zOSo4#|zfz[i͝E$n,;L284u|m /\җ8 rW)?]ϓdJ  jN5g0XgQtqc>1MaVT皵>˰~V$:]4&Ѝ ciXfH siStZǕ~2 0۹JvdzbRͼ'Tg kDO(@<.r>:~إ=blZo\͞dA# Z*I3α kDr?-qa_f7 st2w=*k%7W]qb>:_ww@#^z<° ˱rga8g.8}<KT/fdbsF;Wh()|b+B6,[sBK[b\MRTR,~7NPM[oNnm]T?13{uGKK N9=`3.F ;k@ CэW}L!ʰ%X<EZ깫=sKb"?zZ;~㧔 d<KY j~ Dh8`\*kn5Gr}>B_Q8΍ͣ9 +vi>v.ΨFb辖I:K&>*sr^~"u}$/Մ7[T#q00NY,~1v9f΅QDnIʙ{iی=,HnMn9vDǾh&qVh>m,wι +A=;OY~@vanu"u7a]: f,`܃Æqk٠S*<7v Vxˤ̎Z68BNyܠ22iv/I%g3?t߱;+0P[r',`ɼݝ{?4cҒj"5S3duHwf&PL=T6DF_735$0<>QT 1̻yAe9LtFۄ;OFuY:tÌ~xP1(e'=!4D,t"~4<ЍE3B`5"<}QƉHP~y7_ȹy\:fzf/QJ3ByLl6@۱B{RX^L}N7&9 HC BT8>5I7EPI47i+X5n$| 䘧-,d];]%J׶i7bc"'q&;U+EtR6x q /a , VMSuYqa+h 빒iҴL.bw>HaC I6G3T#Wч]̃ $mU`9U{N&dڰ*;6Zk5V A&F`r#1TkX n*PIl3g @zr@n ϵi+>ˮҕ̶aL 0onqZ('n"ΰ_ w5Rs2yq}v%ZY:Ͳ{Hs+M){zEx_˸=fr!\_YKwm3K*w = =rv 'aM #1C1!!(I2tgWJ N7-k7ވz ~ fǔ2"| VE&W2p@7ť}U^Ry[%A@ESL`cb7QG xK.8;nhl+9>EhkJsYi.ߡ7= W9}NWsw0ko#wsMga%RW9w*k*o.$kW$hjtf; S^碙(`΢LD<md ߜ'}\ zV>P?5]ѽrͤ61AX[-,Zn6 MB6 dYiMn1ϼp(( *c*bΐ/Lz):MN?B= SiYR+ dN9|d~dgZ6HRKE,^keWe#[jv*sJAXhnp$JXߴ ]Á # ? ~~&EW9~)&850Ml%JAvG1 :fj5Y/PLЃiM ,}.qIt\ռ*ۿD_!OQ;K 5 +ѐIq=CeGI4ΩNL?MQ5R*RM1y(vgO?KW[ST1 O/87Ie}NJr s"1vJ!uƢM?нR_4)7o?Oʣ oOマ g$&$#|4?sx^L?&M Խ'ѼjVu}>p7)6ٺ.6Y#pk$wPf,1|4qA1]C4{P5Xhd' v($sb o2uն湴 g.X1/&F=;?J; w0— ,Iv>ĩ)nV_A~sEQNn2$mU-Nwh; s~H&$_;=WQ|͊GCT"S+1&?si&N`zK+t@3"4 _à C /b3}X͐gA-x0AQ\`N0QsL#͡3sZh.3T϶0@iJRsTg`:ۉM?Ql_|KEm >KqIɂqu^4z;?3nW4Ur{kh3?~IBmZLU[sB"ǿ .h90Z/v"6 ksO\Q\,gbx{Sʶ&=H!~ kt7s҆Y! 35ߎɦza7ϒZAeI]e_X䅢FL4;ܝ^GIP|r"(rzLWv5m>&VW"Ͼuƕ+? +ξEQd2eHfn z$,6\Q:(G27v7Ҫ:LhBE 9f\Y&w V'0D? :q2{)|/f]f(f>Z޹#j=;.lw&'U7\r_@vfU"v,ߍz!!Uc2m4)}+LPhIo5y)E[TϴmM&ڑ&^vǤA^K:(s*g~Ҫwq-\8ql5W[%^5ʢC4U6O:J8-w\|шBjd &Q-P*^fƨWf7k+Nie!1m3&>@%k72̈́\k}zfkT=yrDm%IIQY™k`6.hdBcr5 -"3K낳9*]eH͟~L &`%E*MϩVupfNSZL!jqiIW Iḛ̈'aHwӔJ@16\Ռngp9mi~]U},9$m@b)Y?t_V#H853ouڦXJ-d7<,h^a;QMSR @oL#>_i3! !Mչ?}`՗#EV c/tWR@YD$N)sds2Z"k}+H$r%^>⭪]Hou>>1  bҟUr ipcNºhi:^m'Pc z®14ډc3JqxQtDߩ1iO5vUj[}=C~u }ė5\2#[o楎!o? gW^UvoZh Ms Bqwp/ E޻JK 6 +TkJ.jS|,mƺ˴Yb A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  ,0IDATxY\יOʵI;R%[u,ĞA yCA`A'C!O < L6'x3FdɒeKjvM[jjfDZIoխs=o99vMjJ)hJ)hJ)hJ#=j;9y'wh~ 4.{G3'.ɇUrzy_ ywK,?vT&rJE>kmx /,|[M 4V? }Ck(CI6Bȁ[>|/3aAUxG 7M; 5 gC8"- @7X \t!w>* nwK9+2x9&)܋ tPL5y }RYۘB,CPg9cO@?I9ҋTI]ʝ >@vϿh^e <? x I% |r06㴝kˑs!|oo̷2c}5-SMnkiYA]JZizf?VTGUwluSI.8@ >%umU? a4:O%_hxǟ".cv(h?_cSAm xJWC0t45ZU`[q4O6:;Ca*Y~TkYtV/hv7/[fw(S1\sMLŽh~ -"?Y*: *[ 4x"'C8Ģh]o߂b }Yc+bWEtxWs,^ԼF6j5q5y|E}~?o 5`!UE^A - [N(`ͪc.|@=j v }cYΰ<nw@+_j- -,S@ˑ8w~AxF߻s:&;w-(H͌Q;9GqN%ӉBlXXg2U60ju}xMS, L{ p5zGQS(aC7CkEox0 s;썶thflv'?SX 02ÏΑ0H崯 Mל@q9)" sށHY,%Ï [Y?O/{\7`3>lhx =L%"IYe]Տ{L(Gt)B[MJ*ɷj;FL|3o0{;n<Bx~5;(}@4j6n?0*|-Yth L8Ef4CyVvQ.ZbN}OROv|ooz9$;⡹ncj1ksh$&z㧾8_ζkTQG9b*)x&iJ5R}$]ӂ=wa+,aJXn-xf#!^˾s8|i~h8sRm"P3W9>hf J#Rfk]lƭ uUc~3:XjI cޠc\Sk;빖1cAF tb c{CpPD] f?ha1P,cTR[)JGL&F_ 9V 'n"=Na҃Q xn_`8<4i'҉ &p#!̸쓡<|f(^ 98XX71hKUX ɒ?(R|:.!2eq>6jEK04 Iv_aɯp懿k"5m Iv < Wa{[U]~0sq+2_p& Q 9Uw˷Y-]Dk#g .\i@{>^K6@NUFqz,$%r$dt]EMa?QM zg߆gV1_@6],j3M3hZJ_?rP-om+KK1nt pU)Q6:~KώW+e?65wMh t]tz8RZjqܳhcs |!BQ3|| VHj Ɖ;ZMe؀˒^"ܘjD0vD' j׍x-M 7`*xh~DK}Wx4~gvjY;GAu}_p<Bsk1bGڀzGoAbxJ%FʝSVeM|/Xٶޜd`|>ovhdJd#,COS`3 "/fnĮ X, i.U@ǐM:md=:}=a_#ĭBGȵt?CؗBu/>v<,NvY L7X ^Z0р+(/x Y0W-7&?n؊RĄe0"=%Mp`Y``em5M8N|H Z P:2XgKkaJ s"Z24>mE[ j9{7M:4q u-KeF˗>ؓe^mcLZJń? Lv6lj%;JݍVho;mep+}@'@if1+no"E .H;WU}P'FF %?oQAɀvXmD Dk "+p3w?3b EW8RfUXӀPS]Eʻ''|3<|&4iRsT;ЖĻ \1]teQsލFL.|?phqL5+=]3%EKoj aVxCa((JvF;+Bqk#h@ҞJ`,-AmlԩWo([|4&܉AҎΠAt{}Fq&xc LT =ZW9`,bp'颈W%-r\E9iM+Q[VEqJykB%܍-\W3fEW5Em!b?+`]FN!]eF:sȬXD{03')^zF"],p;y~B+KwdD*3| I~`P{9X~v"`s)y(J^vjкݳԂޚ?c&~tQa<<56zW O+5J&@\a9::UyFM/Q3G)2Z`:kf!2ɡP9uر2uh_\}eIS?xUDtLe b\$PZO9aާmg 03#E;#Or6NFjo!pf5UAF5cC$e3_T4F!/ynBv2xy!1,978v0:XYJ,ڦjL1WZXӓ#]b-|%=y׼8K~a(+!ـBomb ࣗYHSJ2/5ɲ_ lM$TM|(ɆbLo>Lf'lI%T2vID2&!t\cbbb9wM\#}&{¯ma$'2X^ St ӄ;T<d[\?5|q,Xb , V SXX?T%)5{FnCDj=xlx c`dw7I~į7DoUmkgx4~9kf 2382mɵ }F^_ej>aE2OKt\5 V11fV؎HG~1qy>-tE`_}DӍ E͌s8Ma|Z,QV2c ^-oDk$W}6t{xZ7^&nu0`6T"3 r jS br}Z2.Trwz)leUx'_Eo;lJaXvӆ[bj@l{0ƅIaRZ461ܲ_搯k7u[ў"0 Yůw|xi*TV&ݔ3jfШa⮴v%5Cbutj2/U:M#cUoF]ls"օBGq6D5D3\CQ¡3iC*ӗW[Wa 앪vU:V[ 7@ b7YgeU(YqCn=G}kXN>4%#- "ܽl +2Bl|^KHod z_rVx?KhPYo1D$#:d0Uɶ u\nޥkiN@&P{aN?&?yZv%K?Wb}yEr^8}v,׸ {/3\;1 (j"),+AMνӁpqX%PύˀQ:|!-rfrX'Z'iyG#v4ٹ|X8HJ&6jkS5jMEj?H.Inx+0W {T]q^^g.OoСO&CPZ.6K 9 b5P>ZlX8d0e,;3C'Ǭ4)b)Y 2k9A=FڦOpW#j͉gfD >Hto[H,W!b"1"9 f>(jB}]$@T3X B01S%E|:Ôx%2Ȳfr;`e+$ I{'Ogulc縓< |x32Gb$$2,VX;|.ܱx MykWXp4;dC5g93ϱu~"qvXi^>Xaop|>y]7B+O1ʞ:+dS0fDZ/%ENшznέ&N1mxG0gCI:{k t ]IZ+݀:#`+o (hҷ|Ŵ5y}ֆqrt<P)>2vڡL%J(Z8mjnk#.]Sԡt>H݅ iQi8T!)4][l`Ӯ]vU8q~~5 C̐BV%-<3{q!,ǝdϦm*/ş cap/ʐrYB֑m\;@u@ҴG]с&\ld2$B.Hň%uo;cS%/ݒc'pڈTy{aNy-}F3 %{3X҄}5$,JdpS@ȲWV =Zz`/l s ύgiޝ`8>7FyQ@VH,ȚkX`MY5-/-h368qƐvtEWbi;B9),)Zq)G~a^_ȣəA+8;v ʡn~{A5)o#aTkH;PTY%$|VI} 6F~yFeI8 2ٞu3e>~CںFA1&|UV(ؗxڲ9l'H  KtFkĪ>؍m tJul$8,bv3\_G嚧<eY_\nûh#$w0TAMuD m,Q'$\N8;q79!N>;Oj%E!owv{%kWHȝɂ~_Ã'jf-RP띏هJ!h2)Q?#dW>ԥ?691.o?w;o$Ԣ/WHnɄMш] T@@/!yÏ4#iGq5,Y7QؽX - <  GZmnD-68wB&υ* LЗ$gY^31hVdu_zl\]̬9dx'j]F 1g;SEf߶F $j r5JE^gJn+`[Rh҇}eУU Eטry6c)2[qCR?糀W\ V*$s]wM6"S\k 'Q<)\.t!5q|/Da'o0չRi+0M|$ o%C7 H`N<]<;0,K%|ܬC8N1F9r^Y@38Ĺم{"?X! *Naܼe23)t%G-Vc;8qɎ5-{jdG[m-zmZMxL\Zl=^]A  t'p7aq%77IL$~.ՠ%MN+qɌuo݈C~@h~Y@VRr+C&J/F6Gk݀+tWNrz{;?%s־(]ۀ eU8xL Y816ԩ\1+wRQC+C֜ Iz&8\:4}u{})&|RQTNAO IGYO*\/-0寷I_ޝO X^aXN~$fQݡ'y nw޸#Y_rh|S7kTa8%j%,bVg и^P 0hYW0Q1cou󦟣#:/s3-Qyx%6=qY=ǕtUZ}-7 O.ӄ){~:3JۃQz /R<я߇\vr꫟l$ W#X}(\Mr uiB2i`"!}7Kl\28NK],_Z!&Pim 󜾬LXk8wɤ3}*VqMV|˰/ J=v'.‡BH[4#r7FlKނqhsKt;┛n굒qj+li:EnɸUzN[\yHCz?pҟ+A2mbb {ԏ߯RRW; ڇe0^px?shd<4B vgߍNᅥ V BLT"q^N*`3x]0 -N_gn߀VfN<|Im[BUs%|~'$@.0MN !'5#}GSkP*נZDvS!JKط#SDZX؛ ,l4?Ǹ3qw(W83 IQ٦ءMwdYG>՘RNbed]Fz5iNolcdq ~ʼnk."ޤl-/?ʫK{%": kZ,u hJ)hJ)hJ)hJ)hJ)hJ)hJ)hJ)[1!ƐIENDB`base-16.04/notification/ios/samples/NotificationService/NotificationServiceIcon29x29.png000066400000000000000000000102011272147170000313300ustar00rootroot00000000000000PNG  IHDRVg AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  IDATH ogg>Oqj'Ɖmh4.Z@B Kv,Yu Vl@\$(BPj QI$ӱ~\|N 43/G:O}9} )imHҀt$KcrY{6z^nj]5-L;4PE c>«Tk磊Fuce {%DcėIo\{AgIdw)`0Gb&fŁ[TW VlLz i(Vb7Iu g9>AHf[+7U%vs.iHİsewY.W:5]3ncf~3QģCk]5OnXtʿ! wo2kK+BTqcjÒ9ڶ ]$pr2dlIS!ۂsXalLtN z?,&e0IDeT󜌟!4;iWlNG㗏1 @wP/8|{xjTtx9%tz;oo9 UU LBtVC:|"ױB QԻx_bn&-ܾlR٭bJ-z]֔965c G2 ԍ套ؘLs|-+ G)2KB[H}=n0siPI곪 犮_TRXkq.XF,[yH#QY64Rg}QCBErWLxlUG2 uo1{vʣ-׍#7AcVK\?aҺl˱Ȝ#톞*JےZZY)T'6} G5x{,Qhj8iO9,}$>qE34\^*[GMapt4bBm`lâ ׅyRZ([n^lwiDj3|H[ l{\گ_!H=# ;f/Q!shA^o*W*]UL&MGq~''"jvӦ#lfߌG]=79/ŤQK~'ioӗj_(NK2IENDB`base-16.04/notification/ios/samples/NotificationService/NotificationServiceIcon57x57.png000066400000000000000000000154531272147170000313500ustar00rootroot00000000000000PNG  IHDR99 AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  IDAThY\WZWWuuwUv/n۱Cݞ%g h4 A  !!OHH2h3a8^z߷}ݮۮ&1ɟuܺsk<^7+L׊g4-B?IpV7EEJV k %ЧI"__*s*sVTMZqݤ,e(.@z k q8)=Nj[?VtE%UAC)ύF G{R6m^|VjƨRSy_P!rs3gw7 ̭lX#@}/"u`n̏~[ ~C˰J$%C1H#?hy `LAG +u󴅰fuHsREm*dQ9QTzu`\t1H? #G9敷֕+Xco{ !wGyղ7_R*A*8y&ѵ-+-DZN0 ^&z#R ~xJ/ŞPc)قT\>:i U0r^V;\'[ӻAx_Z p` PO U0CRԠKg6XE J=Ziҏٯ|R7+B:5Q_L/fU'eׇY94io1ǰϣWtMa<s+c~Գ0}3%4}g :h7a1I.NDV*6F?n@ |{ |]whW b`zm23с_QCj?F ? \Rroj:9-l+߬WYy| dwo0GqF`Y,%H6u&w W9 #&z;U~'U5ԓrm^ƴ eKm8!PfN;&?پ d;>L*hj;vmֵ?2a,$i=*fH^<U*QXȋ;?p*BM kS˜lt&w7n1H_`Ta]t ϊ&? V~D*MQxS=Ub$i\L/i-3W^UVA?w'~|ӣGalgi *v_Xtm-p=JQ助q#M g:;>KVwgܮ݃8Qt`K6a9aoQ,,[h鑀O)dQGV2*U;ӝm i~Jhk.d&lPpBCcV^{lu(MCs^jc,Om%s=$#h5X v}G;ZLw&rV`[1Y='9 [7^d6bl0~{oNg/x)9>^w#=m8KI޻lZ*[kya{ިO5ORw@q,junf#xmwPIK=MҺ%}{3pw qZt>؂|JT\N536a1f}?_xoTyf#KM_ȿ4A.B:|9xLdfW+68eV @_*lL{ZԖ1,%,S$ tM39U=-HkF󀱋ۀ˚IJv4DCTـu8.T9ޭN?gg?DzNHoMۓΑ MvLhpb2coi=34[J= 18)ߞbǰكAͿ+{㔠$Tq  8ۍpZO~ 13,afP:68꺎'|ЅPz sد0 =&@VO"(h)-}X49.P(^i j85Sg+sU%8aN|8Vu.w&eKSv<g5fl^'jc1i|wqr-):~2Hp€tB[SWtAmMd~ͽCe_֎Ok\YLnpup*omRxe mݔ_?'2?װgIӢN]Nl]"F>b#ăqJ sUz LGV/38^a>[Y4ۼOvGSBDtNt'ڡly  bW,}-]l0[v/'zt;5Fsj%f' 5u::#n'f+Xۤ31\^qC˺/se޺cJ}'6*_-[Tli U fo?xJjwo׍@kl\Iu$6U$`y3 }8G5%35lȝ>&Ym#1T8' ҆w+(XW3DK!K#!t"4L0xE3W̥GO7#|E-΀oDD$9F ojIeqv7j f%vN䣌G8SQycfɫR * ݮ} Sȯ\'9gF乳eQ,ճ E]Ҍ>ia*̌ʴ!8®gQui/JU~}kUÎ1fW0}ld/K0(bays?&6biR$A&)E< (B v<̴:ɀԎ0;>K+MڇZ4v?[v򋭄@X[Ghc_C]ۦ:Hҁ.8Jٷ /79 y De6?w(v^ ^Vus-1*nrP}Q9ٽHMBNvLWJʲFs*;5@)va#@Ze;oU4ѥ}Q~K'سQ0~Vnmw/rtu}gk 0OM!Ɓ %_W5wOcl%=dž'U- 65ӳ|giϾ?֧Tcۘ)k͔?zvߢԫ*?1O]j3L8jHS Ԩb`^`QX`IhCuynaQ~x4Q@/s{A#qXڎm7bis7њofՉ SW0=bmUct-4}%=JlQ(5]19K]GKTA)W <^+x - :IENDB`base-16.04/notification/ios/samples/NotificationService/NotificationServiceIcon58x58.png000066400000000000000000000157011272147170000313460ustar00rootroot00000000000000PNG  IHDR::J( AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  &IDAThٓ\yƟ޷鞥{M4ɑDHlW\8A)U,U&Isܦ*RI9ؕ؉c8` 25g;t1B>[ݿHHK .xF_K@_mmVi6K+ʴbZjҐ1 4.nqͫR` @ՌjմKU)]M2̀[3Vj(LŠu? +rQA[(־߳K(*7Us-c mk }#ދ"]Ū+ Jq-\>Kǵ>]¬jTg]s篆vxeZ%cEvKC\ܹaUʿ`^Yq%7kyGi;= Y\jhH U`Q<, *ޟT);RkxT-9gh&/4x5UNJ^2nW5pjW< xO{Ծ'ri\7ILEuv3џ5U0qZtg⢴D[%Юh0DjA4 @K6ACR^(Sne\ӪTe.7ʁ>jj7^U{祅hցyYm GG ;9ʅiYj\4E #k+,ub)/!ѸG`+h#i@_46-mYNWrԯNo 0fm<.|SaсTB О~Cf'`Z[~6ӱQ/-L/YV_P钂R4ƒj\\ ;ﱥҀż* c ؀XDڍE2qT\a)m(k9䡘QKyɊ!Q?'ڕ[.`f"d/ՂM|:CUGf>bB3nF@#~e~@ղ5oJ9S,Хl W iE?4}2AkVCN4j}ǔ{Yi̧0 `iv7@Pƪ =i"*-ͬUQ'SS#@ &פ)nw29"OaVMX:\kv%G&ت#yLqZbj RWc*LMS}V7ӟcw1ifN+F gٗH?Cn쎚ըW=X Ʌϒ#J0(o Kj2z^Q*!q#%-RīhM֑ZA27R;z@ݱGe=~ףajS~ K;fwm\6 )"~u6A=K=Mrrẗ́_]^-r^Owf:'o |٘v[g9lm#Q/ <2׏y݋oBv! CD&r>ߎVH,P<,&CԸ -lIU5Xݘ4N>~wI";RG/?q bllz7ױ$Z %5;A6 90"ۚ^_ Pط:Pďa%cL;"Oح6e{T+ѸnH2y 8XhOYգ!mLsL}Нt f&ؔ1J~#px( `8B0:(Gh+\AQ*G|T;]0P/_5DdZţ쾏~[+^_?!;zlu/@};]8hjZ63.)G-P _55ԆVK,0e嗹Y-zó?oe1;u '՝1 gWRSmD"iq|S:)YdG1t9nE}zc>,Zd2J+E3V"Mg1#bdS;Fp&e^P>g"8cLBv7GY (9V,[Q]mq,[ \&zhW2w+5M>(@ǟ\2#ȅ%آ4  G{XP297Cm[֟6%!Pרێph u#`IK$&leokq2&Q@7Z~3|5/1vcvFӤ^nC{&rL7ߡݦ5FjcʻNs@kaGʇ p-5|H7;ɂE74M}ecSr, 퉙o֧0vt (!ԴQZw̗-ut{rxg|g?GJRH |<}vA%kl?pj]q{hwERG\ZSm[|SaVvדa4>]h';3`3=cxp)ǼM(6U\ด6!DP9M2( ¡/P0Z Ƌ]CΊJ,PS*4=IX"||1M5ԕ 9k]q-QOQ&TBKs|f| ccr97&fmkvߖ1j@6&Ӱsa7!V&Eli3PěV|րfl}p]k;&"e* u L[1Nq_Dγ,:ĵUc*1?aM=]*4>Vr8Ny/_&rz/hۉ[YVzc^N8% |U1YLk}sZu-'ӱy&c U*}4I%Lw ȯcL7"{jʥpvRBeF)87= ?z?qɾWi x "$`IENDB`base-16.04/notification/ios/samples/NotificationService/NotificationServiceIcon80x80.png000066400000000000000000000225131272147170000313330ustar00rootroot00000000000000PNG  IHDRPP AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ' Zk! $l$T4QOt"y\b)AI&NI$R$)TIj"]&=&!:dGrY@^O$ _%?P(&OJEBN9J@y@yCR nXZOD}J}/G3ɭk{%Oחw_.'_!JQ@SVF=IEbbbb5Q%O@%!BӥyҸM:e0G7ӓ e%e[(R0`3R46i^)*n*|"fLUo՝mO0j&jajj.ϧwϝ_4갺zj=U45nɚ4ǴhZ ZZ^0Tf%9->ݫ=cXgN].[7A\SwBOK/X/_Q>QG[ `Aaac#*Z;8cq>[&IIMST`ϴ kh&45ǢYYF֠9<|y+ =X_,,S-,Y)YXmĚk]c}džjcΦ浭-v};]N"&1=xtv(}'{'IߝY) Σ -rqr.d._xpUەZM׍vm=+KGǔ ^WWbj>:>>>v}/avO8 FV> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  IDATxs\u`B"%ѴDlڲN%rCoIJyr*y+m^J2-Q% A`O~_.x1)jNyܹoYt8@Z"hz.J /r^wߩ/ӻ6n@9Fa L٠S ۥQA_B`HTS-ZPpcl/>x"?REV)_[i =nN~"nmCf5-WM Z9lV*}$`[:y>xE,(KwJUNc,asl;fͺCX;v, mHnt"$g  F:Hq |8n;!=+q#(qa0;4Irnfy;#?t:G,9pf2ÛÀ2 `e=VXr]7[~r$pUl% *ܑ`֮¢~@xFZ瞦acsVKBerg%9b#*9m gf+`f۩<=^XTn1ԗK&~HFGy"uCP2+Bv(b]A:)C4t#0qld n P sPMճc3-N]gZ/WC0tHUߘB?6\l#^[NINFF#[iJg(P}g(9i@Ak5ziR3' 7jP 1 èH`iY6@ɑD48g@u1Ŏ7!_`zM_9;hmoöC؏ djPH2M|D)s5"M?խ[e¼V*s(FcN@uI#`B ^YlQj,u&oNcH鄝aN3.ʹ2-fg6gHq=+G_,4_Q F-d6l%,u M|a; @NGDE ΥGjqtmN?N 4waI8c"4]cU#)5^|i|fS.߄lYHZ @)Q ƣ ès=yZKafc"WqupZ?37a b(< cL6FtGm2^R]m޽8J=Jy ĽJ' 05j@T=5;jɛ (n9އ#.8_wȰ\!P,}@gT4E˚e4%lJG <Q‹: z_!Kē]0X1 @wcs3T;y'& D#Xyfw z[4|t3[hN+X|"[ l#籗OrقBr cb*Z*F5 Z BdK?;܊C3u#S>F'> aXllQ0>0c Џ3Hj^Ac1{)[yN9.||j /@! b3Ţg-WĐ.:=PMx$ԏʶ}J@H)A+nlqҫ~`A=:+&/L &yK8WpfJ7i;jHi{9z7x)(,mSaI@sFnyg|vƶD y pDd6 6땮)XTc{He[:3tAT;Yl#SDB[@,3.b/H^M Jt0PP ƨLڧ1Pe>-P4%֏yU91z{%T&-*7 Q[R !gjZ$< ň+VĹa֎ѓk| l̆mr.ý-&F_řq~hS"[Qˣ@gAc{}W'*84vOq!ccbx2dZs,.aו <43ukx[/v4h<] m04N'qe4(6)A Y_.U]>4 %_&~saB l Z)tuNG(ݣ~6 0 J ? &a%˖rŪ8鮀s*:u-U 涌(VPb0a!Ox{K3na# rL.py4ΒmTrԟotf( n0Ⴝ]Lii(k*1g>P*d'2 RpCf=6iL+Re4 VY%ږKY ։ mlQ+be^S>lfA)wu&@?jc.#{q2=km)g%|L8C1V`Pe{p1m^B̓av>%kBxY3OQ&ij֠u jAZ&Mt;t1 9)uvN^ZJ^47HWLR74Oy_$b )&aè`2"vey;c4x}}]w35,AB"MF_Q*84ܜT:勄Xm_qL{X.*Q":L&̓u1[uΛ[T=:ԨF ~ *F;#,Q>'9|aɈ5u~Š.T syY9FNYf|%"ۢ*VBAqC* @+͍.v/Zek dhh{6׊!^VO١Pdǝ!V `>g&`("TiZs {U6#Jh0d4 ^FvXL]_hQpQ? /8YkNA(1H X\@țvS VmX<~mPr?3S%>Z`rw>k]c8 mVp"\P]D ΋UN5BxH LtHYmWv9l"\.oL4Վ4Y@,x~NSd0OCALWF<# TtE6.jܿ0~8qE`(( KcX5LUmh(həmhVDRڲr${* ȣWND[5t/70Wc ŲN2/@^QZ}ўEEC==P/K0uJ5/^=H[JݚCPD<*V]sM\jO Cm$Ik: j-yߌ:y8DKFk!ThHQۄ+ vQ㞒$D <Ƅ W&Os;߳pm1qtE~γ<#І$d؋n6cUZ']%CQH]*+hb30Q.y6W@#z%9#:ֶŦMzIhRCS{gy̋_|6yXнĩMչI>nHU/S_YxlZvdȧt&*'p6qN_*2zW(u=JM6±*܂MvN]h4I!~v1L|H.s6LTpO 0 CPV`՟rDӜugЛp~vS}/~?$ ")~7rty}=%LE09;p= POc_TN*)~lKE@#}j;v@72fpKw# ɟPzmc`Ŏ<% =K'jY{^kbX/~sRͻ zgzƺƺaa|7vF'}|[Tx߀-._-r63({ôiRVU}$Ը/>KNdt">C,ٍ_G?Ir<5FJ5A 凬# #import "AJNBusAttachment.h" #import "AJNAuthenticationListener.h" @interface NotificationUtils : NSObject + (bool)textFieldIsValid:(NSString *)txt; @end base-16.04/notification/ios/samples/NotificationService/NotificationUtils.mm000066400000000000000000000023521272147170000273360ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "NotificationUtils.h" #import @interface NotificationUtils () @end @implementation NotificationUtils //validate a string (not empty or nil) + (bool)textFieldIsValid:(NSString *)txt { return (!([txt isEqualToString:(@"")]) && txt != nil); } @end base-16.04/notification/ios/samples/NotificationService/ProducerViewController.h000066400000000000000000000052551272147170000301740ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusAttachment.h" #import "alljoyn/services_common/AJSVCGenericLoggerDefaultImpl.h" @interface ProducerViewController : UIViewController @property (weak, nonatomic) UIViewController *mainVC; @property (weak, nonatomic) IBOutlet UITextField *notificationEnTextField; @property (weak, nonatomic) IBOutlet UITextField *notificationLangTextField; @property (weak, nonatomic) IBOutlet UITextField *ttlTextField; @property (weak, nonatomic) IBOutlet UITextField *audioTextField; @property (weak, nonatomic) IBOutlet UITextField *iconTextField; @property (weak, nonatomic) IBOutlet UILabel *defaultLangLabel; @property (weak, nonatomic) IBOutlet UILabel *ttlLabel; @property (weak, nonatomic) IBOutlet UILabel *audioLabel; @property (weak, nonatomic) IBOutlet UILabel *iconLabel; @property (weak, nonatomic) IBOutlet UILabel *messageTypeLabel; @property (weak, nonatomic) IBOutlet UISwitch *audioSwitch; @property (weak, nonatomic) IBOutlet UISwitch *iconSwitch; @property (weak, nonatomic) IBOutlet UIButton *messageTypeButton; @property (weak, nonatomic) IBOutlet UIButton *sendNotificationButton; @property (weak, nonatomic) IBOutlet UIButton *deleteButton; @property (weak, nonatomic) IBOutlet UIButton *langButton; // Shared properties @property (strong, nonatomic) AJNBusAttachment *busAttachment; @property (strong, nonatomic) AJSVCGenericLoggerDefaultImpl *logger; @property (strong, nonatomic) NSString *appName; - (IBAction)didTouchSendNotificationButton:(id)sender; - (IBAction)didChangeAudioSwitchValue:(id)sender; - (IBAction)didChangeIconSwitchValue:(id)sender; - (IBAction)didTouchDeleteButton:(id)sender; - (QStatus)startProducer; - (void)stopProducer:(bool) isConsumerOn; @end base-16.04/notification/ios/samples/NotificationService/ProducerViewController.m000066400000000000000000000546031272147170000302020ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "ProducerViewController.h" #import #import "AJNVersion.h" #import "alljoyn/about/AJNAboutServiceApi.h" #import "samples_common/AJSCCommonBusListener.h" #import "alljoyn/notification/AJNSNotificationSender.h" #import "alljoyn/notification/AJNSNotificationService.h" #import "alljoyn/services_common/AJSVCGenericLoggerUtil.h" #import "NotificationUtils.h" static NSString * const DEVICE_ID_PRODUCER= @"ProducerBasic"; static NSString * const DEVICE_NAME_PRODUCER= @"ProducerBasic"; static NSString * const DEFAULT_LANG_PRODUCER= @"en"; static NSString * const RICH_ICON_OBJECT_PATH= @"rich/Icon/Object/Path"; static NSString * const RICH_AUDIO_OBJECT_PATH= @"rich/Audio/Object/Path"; static short const SERVICE_PORT= 900; static const uint16_t TTL_MIN = 30; static const uint16_t TTL_MAX = 43200; static NSString *const DEFAULT_TTL = @"30"; static NSString *const DEFAULT_MSG_TYPE = @"INFO"; @interface ProducerViewController () @property (weak, nonatomic) AJNSNotificationSender *Sender; @property (strong, nonatomic) AJNSNotificationService *producerService; @property (strong, nonatomic) AJSCCommonBusListener *commonBusListener; @property (weak, nonatomic) AJNAboutServiceApi *aboutService; @property (strong, nonatomic) AJNAboutPropertyStoreImpl *aboutPropertyStoreImpl; @property (strong, nonatomic) UIAlertView *selectLanguage; @property (strong, nonatomic) UIAlertView *selectMessageType; @property (strong, nonatomic) AJNSNotification *notification; @property (strong, nonatomic) NSMutableArray *notificationTextArr; @property (strong, nonatomic) NSMutableDictionary *customAttributesDictionary; @property (strong, nonatomic) NSMutableArray *richAudioUrlArray; @property (strong, nonatomic) NSString *defaultTTL; // Hold the default ttl as set in the UI @property (strong, nonatomic) NSString *defaultMessageType; // Hold the default message type as set in the UI @property (nonatomic) AJNSNotificationMessageType messageType; @property (strong, nonatomic) NSString *otherLang; @end @implementation ProducerViewController - (void)viewDidLoad { [super viewDidLoad]; [self.view setHidden:YES]; } - (QStatus)startProducer { // Set TextField.delegate to enable dissmiss keyboard self.notificationEnTextField.delegate = self; self.notificationLangTextField.delegate = self; self.ttlTextField.delegate = self; self.audioTextField.delegate = self; self.iconTextField.delegate = self; // Set default ttl self.defaultTTL = DEFAULT_TTL; self.ttlTextField.text = DEFAULT_TTL; [self.ttlTextField setKeyboardType:UIKeyboardTypeNumberPad]; // Set default messageType self.defaultMessageType = DEFAULT_MSG_TYPE; self.messageType = [self convertMessageType:self.defaultMessageType]; self.messageTypeButton.titleLabel.text = DEFAULT_MSG_TYPE; // Set switch to off self.audioSwitch.on = false; self.iconSwitch.on = false; // Initialize a AJNSNotificationService object self.producerService = [[AJNSNotificationService alloc] init]; // Set logger (see a logger implementation example in ConsumerViewController.m) [self.producerService setLogLevel:QLEVEL_DEBUG]; // Confirm that bus is valid if (!self.busAttachment) { [self.logger fatalTag:[[self class] description] text:@"BusAttachment is nil"]; return ER_FAIL; } // Prepare propertyStore [self.logger debugTag:[[self class] description] text:@"preparePropertyStore."]; self.aboutPropertyStoreImpl = [[AJNAboutPropertyStoreImpl alloc] init]; QStatus status = [self fillAboutPropertyStoreImplData:[[NSUUID UUID] UUIDString] appName:self.appName deviceId:DEVICE_ID_PRODUCER deviceName:DEVICE_NAME_PRODUCER defaultLanguage:DEFAULT_LANG_PRODUCER]; if (status != ER_OK) { [self.logger errorTag:[[self class] description] text:@"Could not fill PropertyStore."]; return ER_FAIL; } // Prepare AJNSBusListener self.commonBusListener = [[AJSCCommonBusListener alloc] init]; // Prepare AboutService [self.logger debugTag:[[self class] description] text:@"prepareAboutService"]; status = [self prepareAboutService:self.commonBusListener servicePort:SERVICE_PORT]; if (status != ER_OK) { [self.logger fatalTag:[[self class] description] text:@"Could not prepareAboutService."]; return ER_FAIL; } // Call initSend self.Sender = [self.producerService startSendWithBus:self.busAttachment andPropertyStore:self.aboutPropertyStoreImpl]; if (!self.Sender) { [self.logger fatalTag:[[self class] description] text:@"Could not initialize Sender"]; return ER_FAIL; } // Call announce status = [self.aboutService announce]; if (status != ER_OK) { [self.logger fatalTag:[[self class] description] text:@"Could not announce"]; return ER_FAIL; } else { [self.logger debugTag:[[self class] description] text:@"Announce..."]; } return ER_OK; } - (void)stopProducer:(bool) isConsumerOn { QStatus status; [self.logger debugTag:[[self class] description] text:@"Stop Producer service"]; if (self.Sender) { self.Sender = nil; } // AboutService destroy if (self.aboutService) { // AboutService destroyInstance [self.aboutService destroyInstance]; //isServiceStarted = false, call [self.aboutService unregister] status = [self.busAttachment unbindSessionFromPort:SERVICE_PORT]; if (status != ER_OK) { [self.logger errorTag:[[self class] description] text:@"Failed to unbindSessionFromPort"]; } self.aboutService = nil; } if (self.aboutPropertyStoreImpl) { self.aboutPropertyStoreImpl = nil; } // Shutdown producer if (self.producerService && isConsumerOn) { [self.logger debugTag:[[self class] description] text:@"calling shutdownSender"]; [self.producerService shutdownSender]; } else { [self.logger debugTag:[[self class] description] text:@"calling shutdown"]; [self.producerService shutdown]; } self.producerService = nil; // Unregister bus listener from the common if (self.busAttachment && self.commonBusListener) { [self.busAttachment unregisterBusListener:self.commonBusListener]; [self.busAttachment unbindSessionFromPort:([self.commonBusListener sessionPort])]; self.commonBusListener = nil; } } // ENUM convertMessageType - (AJNSNotificationMessageType)convertMessageType:(NSString *)tMsgType { if ([tMsgType isEqualToString:@"INFO"]) { return INFO; } else if ([tMsgType isEqualToString:@"WARNING"]) { return WARNING; } else if ([tMsgType isEqualToString:@"EMERGENCY"]) { return EMERGENCY; } else return UNSET; } - (void)producerPostSendView { self.notificationEnTextField.text = nil; self.notificationLangTextField.text = nil; // Lang field-save perv selection // Color save perv selection self.ttlTextField.text = self.defaultTTL; if (self.iconSwitch.on) { self.iconSwitch.on = false; [self didChangeIconSwitchValue:nil]; } if (self.audioSwitch.on) { self.audioSwitch.on = false; [self didChangeAudioSwitchValue:nil]; } [self.messageTypeButton setTitle:self.defaultMessageType forState:(UIControlStateNormal)]; self.messageType = [self convertMessageType:DEFAULT_MSG_TYPE]; // Clear sent parameters: [self.notificationTextArr removeAllObjects]; } -(void)logNotification:(AJNSNotification *)ajnsNotification ttl:(uint16_t)ttl { [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Sending message with message type: '%@'",[AJNSNotificationEnums AJNSMessageTypeToString:[ajnsNotification messageType]]]]; [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"TTL: %hu", ttl]]; for (AJNSNotificationText *notificationText in self.notificationTextArr) { [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"message: '%@'",[notificationText getText]]]; } [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"richIconUrl: '%@'",[ajnsNotification richIconUrl]]]; NSMutableArray *array = [[NSMutableArray alloc]init]; [ajnsNotification richAudioUrl:array]; for (AJNSRichAudioUrl *richAudioURL in array) { [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"RichAudioUrl: '%@'",[richAudioURL url]]]; } [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"richIconObjPath: '%@'",[ajnsNotification richIconObjectPath]]]; [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"RichAudioObjPath: '%@'",[ajnsNotification richAudioObjectPath]]]; [self.logger debugTag:[[self class] description] text:[NSString stringWithFormat:@"Sending notification message for messageType '%d'",[ajnsNotification messageType]]]; } #pragma mark - IBActions // Send a notification - (IBAction)didTouchSendNotificationButton:(id)sender { uint16_t nttl; NSString *nsender = @"iosTestApp"; NSString *richIconUrl; // Dismiss keyboard [self touchesBegan:sender withEvent:nil]; // Build notification object // Set flags bool hasEnNotificationText = false; bool hasOtherLangNotificationText = false; bool ttlIsValid = false; // Create containers self.notificationTextArr = [[NSMutableArray alloc] init]; self.customAttributesDictionary = [[NSMutableDictionary alloc] init]; // this dictionary holds custom attributes that are sent in notification. see below for an example on how to send the color custom attribute self.richAudioUrlArray = [[NSMutableArray alloc] init]; // Set enNotificationText if ([NotificationUtils textFieldIsValid:self.notificationEnTextField.text]) { NSString *enNotificationText; enNotificationText = self.notificationEnTextField.text; // Insert into the array text and lang [self.notificationTextArr addObject:[[AJNSNotificationText alloc] initWithLang:@"en" andText:enNotificationText]]; hasEnNotificationText = true; } else { // Create UIAlertView alert [[[UIAlertView alloc] initWithTitle:@"Error" message:@"At least one of the messages should be sent in english" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; return; } // Set other lang message if ([NotificationUtils textFieldIsValid:self.notificationLangTextField.text] && self.otherLang) { NSString *langNotificationText; langNotificationText = self.notificationLangTextField.text; [self.notificationTextArr addObject:[[AJNSNotificationText alloc] initWithLang:self.otherLang andText:langNotificationText]]; hasOtherLangNotificationText = true; } // Set ttl unsigned long rcv_ttl; rcv_ttl = [[self.ttlTextField text] intValue]; if ((rcv_ttl >= TTL_MIN) && (rcv_ttl <= TTL_MAX)) { ttlIsValid = true; nttl = rcv_ttl; } else { NSString *ttlErrReport = [NSString stringWithFormat:@"ttl range is %hu - %hu. %lu is invalid", TTL_MIN, TTL_MAX, rcv_ttl]; [[[UIAlertView alloc] initWithTitle:@"Error" message:ttlErrReport delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; } // Set English audio if (self.audioSwitch.on == true && ([NotificationUtils textFieldIsValid:(self.audioTextField.text)])) { AJNSRichAudioUrl *richAudioUrlObj = [[AJNSRichAudioUrl alloc] initRichAudioUrlWithLang:@"en" andUrl:self.audioTextField.text]; [self.richAudioUrlArray addObject:richAudioUrlObj]; // Set other language audio if (self.otherLang) { AJNSRichAudioUrl *richAudioUrlObj = [[AJNSRichAudioUrl alloc] initRichAudioUrlWithLang:self.otherLang andUrl:self.audioTextField.text]; [self.richAudioUrlArray addObject:richAudioUrlObj]; } } // Set icon if (self.iconSwitch.on == true && ([NotificationUtils textFieldIsValid:(self.iconTextField.text)])) { richIconUrl = self.iconTextField.text; } // Set color example - this is how to set the color // [customAttributesDictionary setValue:@"Blue" forKey:@"color"]; NSString *curr_controlPanelServiceObjectPath = @""; // Set the Notification object if ((hasEnNotificationText) && ttlIsValid && (self.messageType != UNSET)) { self.notification = [[AJNSNotification alloc] initWithMessageType:self.messageType andNotificationText:self.notificationTextArr]; // This is an exaple of using AJNSNotification setters : [self.notification setMessageId:-1]; [self.notification setDeviceId:nil]; [self.notification setDeviceName:nil]; [self.notification setAppId:nil]; [self.notification setAppName:self.appName]; [self.notification setSender:nsender]; [self.notification setCustomAttributes:self.customAttributesDictionary]; [self.notification setRichIconUrl:richIconUrl]; [self.notification setRichAudioUrl:self.richAudioUrlArray]; [self.notification setRichIconObjectPath:RICH_ICON_OBJECT_PATH]; [self.notification setRichAudioObjectPath:RICH_AUDIO_OBJECT_PATH]; [self.notification setControlPanelServiceObjectPath:curr_controlPanelServiceObjectPath]; [self logNotification:self.notification ttl:nttl]; [self.richAudioUrlArray removeAllObjects]; // Call send QStatus sendStatus = [self.Sender send:self.notification ttl:nttl]; if (sendStatus != ER_OK) { [self.logger infoTag:[[self class] description] text:[NSString stringWithFormat:@"Send has failed"]]; } else { [self.logger infoTag:[[self class] description] text:[NSString stringWithFormat:@"Successfully sent!"]]; } [self producerPostSendView]; } else { [self.logger infoTag:[[self class] description] text:[NSString stringWithFormat:@"Invalid Notification input:\n EnNotificationText=%u\n OtherLangNotificationText=%u\n ttlIsValid=%u\n hasMessageType=%u", hasEnNotificationText, hasOtherLangNotificationText, ttlIsValid, self.messageType]]; } [self producerPostSendView]; } - (IBAction)didChangeAudioSwitchValue:(id)sender { self.audioTextField.alpha = self.audioSwitch.on; } - (IBAction)didChangeIconSwitchValue:(id)sender { self.iconTextField.alpha = self.iconSwitch.on; } - (IBAction)didTouchDeleteButton:(id)sender { [self.logger errorTag:[[self class] description] text:[NSString stringWithFormat:@"message type is %u", self.messageType]]; if (self.messageType == UNSET) return; QStatus deleteStatus = [self.Sender deleteLastMsg:self.messageType]; if (deleteStatus != ER_OK) { [self.logger errorTag:[[self class] description] text:@"Failed to delete a message"]; } } #pragma mark - About Service methods - (QStatus)prepareAboutService:(AJSCCommonBusListener *)busListener servicePort:(AJNSessionPort)port { if (!self.busAttachment) return ER_BAD_ARG_1; if (!busListener) return ER_BAD_ARG_2; if (!self.aboutPropertyStoreImpl) { [self.logger errorTag:[[self class] description] text:@"PropertyStore is empty"]; return ER_FAIL; } // Prepare About Service self.aboutService = [AJNAboutServiceApi sharedInstance]; if (!self.aboutService) { return ER_BUS_NOT_ALLOWED; } [self.aboutService startWithBus:self.busAttachment andPropertyStore:self.aboutPropertyStoreImpl]; //isServiceStarted = true [self.logger debugTag:[[self class] description] text:@"registerBusListener"]; [busListener setSessionPort:port]; [self.busAttachment registerBusListener:busListener]; AJNSessionOptions *opt = [[AJNSessionOptions alloc] initWithTrafficType:(kAJNTrafficMessages) supportsMultipoint:(false) proximity:(kAJNProximityAny) transportMask:(kAJNTransportMaskAny)]; QStatus aboutStatus = [self.busAttachment bindSessionOnPort:SERVICE_PORT withOptions:opt withDelegate:busListener]; if (aboutStatus == ER_ALLJOYN_BINDSESSIONPORT_REPLY_ALREADY_EXISTS) [self.logger infoTag:[[self class] description] text:([NSString stringWithFormat:@"bind status: ER_ALLJOYN_BINDSESSIONPORT_REPLY_ALREADY_EXISTS"])]; if (aboutStatus != ER_OK) return aboutStatus; return [self.aboutService registerPort:(SERVICE_PORT)]; } -(QStatus)fillAboutPropertyStoreImplData:(NSString*) appId appName:(NSString*) appName deviceId:(NSString*)deviceId deviceName:(NSString*) deviceName defaultLanguage:(NSString*) defaultLang { QStatus status; // AppId to Hex string const char* utf8AppId = [appId UTF8String]; NSMutableString *hex = [[NSMutableString alloc] init]; while(*utf8AppId) { [hex appendFormat:@"%02X", *utf8AppId++ & 0x00FF]; } // AppId status = [self.aboutPropertyStoreImpl setAppId:[NSString stringWithString:hex]]; if (status != ER_OK) { return status; } // AppName status = [self.aboutPropertyStoreImpl setAppName:appName]; if (status != ER_OK) { return status; } // DeviceId status = [self.aboutPropertyStoreImpl setDeviceId:deviceId]; if (status != ER_OK) { return status; } // DeviceName status = [self.aboutPropertyStoreImpl setDeviceName:deviceName]; if (status != ER_OK) { return status; } // SupportedLangs NSArray *languages = @[@"en", @"sp", @"fr"]; status = [self.aboutPropertyStoreImpl setSupportedLangs:languages]; if (status != ER_OK) { return status; } // DefaultLang status = [self.aboutPropertyStoreImpl setDefaultLang:defaultLang]; if (status != ER_OK) { return status; } // ModelNumber status = [self.aboutPropertyStoreImpl setModelNumber:@"Wxfy388i"]; if (status != ER_OK) { return status; } // DateOfManufacture status = [self.aboutPropertyStoreImpl setDateOfManufacture:@"10/1/2199"]; if (status != ER_OK) { return status; } // SoftwareVersion status = [self.aboutPropertyStoreImpl setSoftwareVersion:@"12.20.44 build 44454"]; if (status != ER_OK) { return status; } // AjSoftwareVersion status = [self.aboutPropertyStoreImpl setAjSoftwareVersion:[AJNVersion versionInformation]]; if (status != ER_OK) { return status; } // HardwareVersion status = [self.aboutPropertyStoreImpl setHardwareVersion:@"355.499. b"]; if (status != ER_OK) { return status; } // Description status = [self.aboutPropertyStoreImpl setDescription:@"This is an Alljoyn Application" language:@"en"]; if (status != ER_OK) { return status; } status = [self.aboutPropertyStoreImpl setDescription:@"Esta es una Alljoyn aplicación" language:@"sp"]; if (status != ER_OK) { return status; } status = [self.aboutPropertyStoreImpl setDescription:@"C'est une Alljoyn application" language:@"fr"]; if (status != ER_OK) { return status; } // Manufacturer status = [self.aboutPropertyStoreImpl setManufacturer:@"Company" language:@"en"]; if (status != ER_OK) { return status; } status = [self.aboutPropertyStoreImpl setManufacturer:@"Empresa" language:@"sp"]; if (status != ER_OK) { return status; } status = [self.aboutPropertyStoreImpl setManufacturer:@"Entreprise" language:@"fr"]; if (status != ER_OK) { return status; } // SupportedUrl status = [self.aboutPropertyStoreImpl setSupportUrl:@"http://www.alljoyn.org"]; if (status != ER_OK) { return status; } return status; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } - (IBAction)selectLanguagePressed:(UIButton *)sender { [self showSelectLanguageAlert]; } - (IBAction)selectMessageTypePressed:(UIButton *)sender { [self showMessageTypeAlert]; } - (void)showSelectLanguageAlert { NSArray *langArray = [[NSMutableArray alloc] initWithObjects:@"English", @"Hebrew", @"Russian", nil]; self.selectLanguage = [[UIAlertView alloc] initWithTitle:@"Select Language" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; for (NSString *str in langArray) { [self.selectLanguage addButtonWithTitle:str]; } [self.selectLanguage show]; } - (void)showMessageTypeAlert { NSArray *messageTypeArray = [[NSMutableArray alloc] initWithObjects:@"INFO", @"WARNING", @"EMERGENCY", nil]; self.selectMessageType = [[UIAlertView alloc] initWithTitle:@"Select Language" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; for (NSString *str in messageTypeArray) { [self.selectMessageType addButtonWithTitle:str]; } [self.selectMessageType show]; } #pragma mark - UIAlertView delegate function - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { return; //Cancel was pressed } if (alertView == self.selectLanguage) { self.otherLang = [self convertToLangCode:[alertView buttonTitleAtIndex:buttonIndex]]; [self.langButton setTitle:[alertView buttonTitleAtIndex:buttonIndex] forState:UIControlStateNormal]; } else if (alertView == self.selectMessageType) { self.messageType = [self convertMessageType:[alertView buttonTitleAtIndex:buttonIndex]]; [self.messageTypeButton setTitle:[alertView buttonTitleAtIndex:buttonIndex] forState:UIControlStateNormal]; } } #pragma mark - Application util methods - (NSString *)convertToLangCode:(NSString *)value { if ([value isEqualToString:@"English"]) { return @"en"; } else if ([value isEqualToString:@"Hebrew"]) { return @"he"; } else if ([value isEqualToString:@"Russian"]) { return @"ru"; } return nil; } // Set dismiss keyboard for each UITextField - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UIView *aSubview in[self.view subviews]) { if ([aSubview isKindOfClass:[UITextField class]]) { [(UITextField *)aSubview resignFirstResponder]; } } } @end base-16.04/notification/ios/samples/NotificationServiceWorkspace.xcworkspace/000077500000000000000000000000001272147170000275415ustar00rootroot00000000000000contents.xcworkspacedata000066400000000000000000000017651272147170000344350ustar00rootroot00000000000000base-16.04/notification/ios/samples/NotificationServiceWorkspace.xcworkspace base-16.04/notification/ios/samples/alljoyn_services_cpp/000077500000000000000000000000001272147170000236005ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_notification_cpp.xcodeproj/000077500000000000000000000000001272147170000326545ustar00rootroot00000000000000project.pbxproj000077500000000000000000000743161272147170000356670ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_notification_cpp.xcodeproj// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 9AA93A801855C20800378361 /* Notification.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0518547B6D004660C5 /* Notification.h */; }; 9AA93A811855C20800378361 /* NotificationEnums.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0618547B6D004660C5 /* NotificationEnums.h */; }; 9AA93A821855C20800378361 /* NotificationReceiver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0718547B6D004660C5 /* NotificationReceiver.h */; }; 9AA93A831855C20800378361 /* NotificationSender.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0818547B6D004660C5 /* NotificationSender.h */; }; 9AA93A841855C20800378361 /* NotificationService.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0918547B6D004660C5 /* NotificationService.h */; }; 9AA93A851855C20800378361 /* NotificationText.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0A18547B6D004660C5 /* NotificationText.h */; }; 9AA93A861855C20800378361 /* RichAudioUrl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB9CE0B18547B6D004660C5 /* RichAudioUrl.h */; }; 9AB3A6B0189E7B6E00F152F7 /* NotificationProducerSender.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6A2189E7B6E00F152F7 /* NotificationProducerSender.cc */; }; 9AB3A6B1189E7B6E00F152F7 /* NotificationProducerReceiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6A4189E7B6E00F152F7 /* NotificationProducerReceiver.cc */; }; 9AB3A6B2189E7B6E00F152F7 /* NotificationProducerListener.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6A6189E7B6E00F152F7 /* NotificationProducerListener.cc */; }; 9AB3A6B3189E7B6E00F152F7 /* NotificationProducer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6A8189E7B6E00F152F7 /* NotificationProducer.cc */; }; 9AB3A6B4189E7B6E00F152F7 /* NotificationDismisserSender.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6AA189E7B6E00F152F7 /* NotificationDismisserSender.cc */; }; 9AB3A6B5189E7B6E00F152F7 /* NotificationDismisserReceiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6AC189E7B6E00F152F7 /* NotificationDismisserReceiver.cc */; }; 9AB3A6B6189E7B6E00F152F7 /* NotificationDismisser.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6AE189E7B6E00F152F7 /* NotificationDismisser.cc */; }; 9AB3A6B7189E7B6E00F152F7 /* NotificationAsyncTaskEvents.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB3A6AF189E7B6E00F152F7 /* NotificationAsyncTaskEvents.cc */; }; 9AB3A6B8189E7B9900F152F7 /* NotificationAsyncTaskEvents.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AB3A69D189E7B5600F152F7 /* NotificationAsyncTaskEvents.h */; }; 9AB9CDD618547B37004660C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AB9CDD518547B37004660C5 /* Foundation.framework */; }; 9AB9CF4E18547B6E004660C5 /* Notification.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE2B18547B6D004660C5 /* Notification.cc */; }; 9AB9CF5018547B6E004660C5 /* NotificationConstants.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE2E18547B6D004660C5 /* NotificationConstants.cc */; }; 9AB9CF5118547B6E004660C5 /* NotificationEnums.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3018547B6D004660C5 /* NotificationEnums.cc */; }; 9AB9CF5218547B6E004660C5 /* NotificationReceiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3118547B6D004660C5 /* NotificationReceiver.cc */; }; 9AB9CF5318547B6E004660C5 /* NotificationSender.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3218547B6D004660C5 /* NotificationSender.cc */; }; 9AB9CF5418547B6E004660C5 /* NotificationService.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3318547B6D004660C5 /* NotificationService.cc */; }; 9AB9CF5518547B6E004660C5 /* NotificationText.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3418547B6D004660C5 /* NotificationText.cc */; }; 9AB9CF5618547B6E004660C5 /* NotificationTransport.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3518547B6D004660C5 /* NotificationTransport.cc */; }; 9AB9CF5718547B6E004660C5 /* NotificationTransportConsumer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3718547B6D004660C5 /* NotificationTransportConsumer.cc */; }; 9AB9CF5818547B6E004660C5 /* NotificationTransportProducer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3918547B6D004660C5 /* NotificationTransportProducer.cc */; }; 9AB9CF5A18547B6E004660C5 /* PayloadAdapter.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3D18547B6D004660C5 /* PayloadAdapter.cc */; }; 9AB9CF5B18547B6E004660C5 /* RichAudioUrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE3F18547B6D004660C5 /* RichAudioUrl.cc */; }; 9AB9CF5C18547B6E004660C5 /* Transport.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9AB9CE4118547B6D004660C5 /* Transport.cc */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 9AA93A7F1855C1F600378361 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = inc/alljoyn/notification; dstSubfolderSpec = 16; files = ( 9AB3A6B8189E7B9900F152F7 /* NotificationAsyncTaskEvents.h in CopyFiles */, 9AA93A801855C20800378361 /* Notification.h in CopyFiles */, 9AA93A811855C20800378361 /* NotificationEnums.h in CopyFiles */, 9AA93A821855C20800378361 /* NotificationReceiver.h in CopyFiles */, 9AA93A831855C20800378361 /* NotificationSender.h in CopyFiles */, 9AA93A841855C20800378361 /* NotificationService.h in CopyFiles */, 9AA93A851855C20800378361 /* NotificationText.h in CopyFiles */, 9AA93A861855C20800378361 /* RichAudioUrl.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 9AB3A69D189E7B5600F152F7 /* NotificationAsyncTaskEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationAsyncTaskEvents.h; sourceTree = ""; }; 9AB3A6A1189E7B6E00F152F7 /* NotificationProducerSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationProducerSender.h; sourceTree = ""; }; 9AB3A6A2189E7B6E00F152F7 /* NotificationProducerSender.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationProducerSender.cc; sourceTree = ""; }; 9AB3A6A3189E7B6E00F152F7 /* NotificationProducerReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationProducerReceiver.h; sourceTree = ""; }; 9AB3A6A4189E7B6E00F152F7 /* NotificationProducerReceiver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationProducerReceiver.cc; sourceTree = ""; }; 9AB3A6A5189E7B6E00F152F7 /* NotificationProducerListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationProducerListener.h; sourceTree = ""; }; 9AB3A6A6189E7B6E00F152F7 /* NotificationProducerListener.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationProducerListener.cc; sourceTree = ""; }; 9AB3A6A7189E7B6E00F152F7 /* NotificationProducer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationProducer.h; sourceTree = ""; }; 9AB3A6A8189E7B6E00F152F7 /* NotificationProducer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationProducer.cc; sourceTree = ""; }; 9AB3A6A9189E7B6E00F152F7 /* NotificationDismisserSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationDismisserSender.h; sourceTree = ""; }; 9AB3A6AA189E7B6E00F152F7 /* NotificationDismisserSender.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationDismisserSender.cc; sourceTree = ""; }; 9AB3A6AB189E7B6E00F152F7 /* NotificationDismisserReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationDismisserReceiver.h; sourceTree = ""; }; 9AB3A6AC189E7B6E00F152F7 /* NotificationDismisserReceiver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationDismisserReceiver.cc; sourceTree = ""; }; 9AB3A6AD189E7B6E00F152F7 /* NotificationDismisser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationDismisser.h; sourceTree = ""; }; 9AB3A6AE189E7B6E00F152F7 /* NotificationDismisser.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationDismisser.cc; sourceTree = ""; }; 9AB3A6AF189E7B6E00F152F7 /* NotificationAsyncTaskEvents.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationAsyncTaskEvents.cc; sourceTree = ""; }; 9AB9CDD218547B37004660C5 /* liballjoyn_notification_cpp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liballjoyn_notification_cpp.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9AB9CDD518547B37004660C5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9AB9CDD918547B37004660C5 /* alljoyn_notification_cpp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "alljoyn_notification_cpp-Prefix.pch"; sourceTree = ""; }; 9AB9CDE318547B37004660C5 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 9AB9CDE618547B37004660C5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 9AB9CE0518547B6D004660C5 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Notification.h; sourceTree = ""; }; 9AB9CE0618547B6D004660C5 /* NotificationEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationEnums.h; sourceTree = ""; }; 9AB9CE0718547B6D004660C5 /* NotificationReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationReceiver.h; sourceTree = ""; }; 9AB9CE0818547B6D004660C5 /* NotificationSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationSender.h; sourceTree = ""; }; 9AB9CE0918547B6D004660C5 /* NotificationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = ""; }; 9AB9CE0A18547B6D004660C5 /* NotificationText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationText.h; sourceTree = ""; }; 9AB9CE0B18547B6D004660C5 /* RichAudioUrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichAudioUrl.h; sourceTree = ""; }; 9AB9CE2B18547B6D004660C5 /* Notification.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Notification.cc; sourceTree = ""; }; 9AB9CE2E18547B6D004660C5 /* NotificationConstants.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationConstants.cc; sourceTree = ""; }; 9AB9CE2F18547B6D004660C5 /* NotificationConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationConstants.h; sourceTree = ""; }; 9AB9CE3018547B6D004660C5 /* NotificationEnums.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationEnums.cc; sourceTree = ""; }; 9AB9CE3118547B6D004660C5 /* NotificationReceiver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationReceiver.cc; sourceTree = ""; }; 9AB9CE3218547B6D004660C5 /* NotificationSender.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationSender.cc; sourceTree = ""; }; 9AB9CE3318547B6D004660C5 /* NotificationService.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationService.cc; sourceTree = ""; }; 9AB9CE3418547B6D004660C5 /* NotificationText.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationText.cc; sourceTree = ""; }; 9AB9CE3518547B6D004660C5 /* NotificationTransport.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationTransport.cc; sourceTree = ""; }; 9AB9CE3618547B6D004660C5 /* NotificationTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationTransport.h; sourceTree = ""; }; 9AB9CE3718547B6D004660C5 /* NotificationTransportConsumer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationTransportConsumer.cc; sourceTree = ""; }; 9AB9CE3818547B6D004660C5 /* NotificationTransportConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationTransportConsumer.h; sourceTree = ""; }; 9AB9CE3918547B6D004660C5 /* NotificationTransportProducer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationTransportProducer.cc; sourceTree = ""; }; 9AB9CE3A18547B6D004660C5 /* NotificationTransportProducer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationTransportProducer.h; sourceTree = ""; }; 9AB9CE3D18547B6D004660C5 /* PayloadAdapter.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PayloadAdapter.cc; sourceTree = ""; }; 9AB9CE3E18547B6D004660C5 /* PayloadAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PayloadAdapter.h; sourceTree = ""; }; 9AB9CE3F18547B6D004660C5 /* RichAudioUrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RichAudioUrl.cc; sourceTree = ""; }; 9AB9CE4118547B6D004660C5 /* Transport.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Transport.cc; sourceTree = ""; }; 9AB9CE4218547B6D004660C5 /* Transport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Transport.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 9AB9CDCF18547B37004660C5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AB9CDD618547B37004660C5 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 9AB9CDC918547B37004660C5 = { isa = PBXGroup; children = ( 9AB9CDD718547B37004660C5 /* alljoyn_services_cpp */, 9AB9CDD418547B37004660C5 /* Frameworks */, 9AB9CDD318547B37004660C5 /* Products */, ); sourceTree = ""; }; 9AB9CDD318547B37004660C5 /* Products */ = { isa = PBXGroup; children = ( 9AB9CDD218547B37004660C5 /* liballjoyn_notification_cpp.a */, ); name = Products; sourceTree = ""; }; 9AB9CDD418547B37004660C5 /* Frameworks */ = { isa = PBXGroup; children = ( 9AB9CDD518547B37004660C5 /* Foundation.framework */, 9AB9CDE318547B37004660C5 /* XCTest.framework */, 9AB9CDE618547B37004660C5 /* UIKit.framework */, ); name = Frameworks; sourceTree = ""; }; 9AB9CDD718547B37004660C5 /* alljoyn_services_cpp */ = { isa = PBXGroup; children = ( 9AB9CDFB18547B6D004660C5 /* notification */, 9AB9CDD818547B37004660C5 /* Supporting Files */, ); path = alljoyn_services_cpp; sourceTree = ""; }; 9AB9CDD818547B37004660C5 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AB9CDD918547B37004660C5 /* alljoyn_notification_cpp-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; 9AB9CDFB18547B6D004660C5 /* notification */ = { isa = PBXGroup; children = ( 9AB9CDFD18547B6D004660C5 /* cpp */, ); name = notification; path = ../../../..; sourceTree = ""; }; 9AB9CDFD18547B6D004660C5 /* cpp */ = { isa = PBXGroup; children = ( 9AB9CE0218547B6D004660C5 /* inc */, 9AB9CE2918547B6D004660C5 /* src */, ); path = cpp; sourceTree = ""; }; 9AB9CE0218547B6D004660C5 /* inc */ = { isa = PBXGroup; children = ( 9AB9CE0318547B6D004660C5 /* alljoyn */, ); path = inc; sourceTree = ""; }; 9AB9CE0318547B6D004660C5 /* alljoyn */ = { isa = PBXGroup; children = ( 9AB9CE0418547B6D004660C5 /* notification */, ); path = alljoyn; sourceTree = ""; }; 9AB9CE0418547B6D004660C5 /* notification */ = { isa = PBXGroup; children = ( 9AB3A69D189E7B5600F152F7 /* NotificationAsyncTaskEvents.h */, 9AB9CE0518547B6D004660C5 /* Notification.h */, 9AB9CE0618547B6D004660C5 /* NotificationEnums.h */, 9AB9CE0718547B6D004660C5 /* NotificationReceiver.h */, 9AB9CE0818547B6D004660C5 /* NotificationSender.h */, 9AB9CE0918547B6D004660C5 /* NotificationService.h */, 9AB9CE0A18547B6D004660C5 /* NotificationText.h */, 9AB9CE0B18547B6D004660C5 /* RichAudioUrl.h */, ); path = notification; sourceTree = ""; }; 9AB9CE2918547B6D004660C5 /* src */ = { isa = PBXGroup; children = ( 9AB3A6A1189E7B6E00F152F7 /* NotificationProducerSender.h */, 9AB3A6A2189E7B6E00F152F7 /* NotificationProducerSender.cc */, 9AB3A6A3189E7B6E00F152F7 /* NotificationProducerReceiver.h */, 9AB3A6A4189E7B6E00F152F7 /* NotificationProducerReceiver.cc */, 9AB3A6A5189E7B6E00F152F7 /* NotificationProducerListener.h */, 9AB3A6A6189E7B6E00F152F7 /* NotificationProducerListener.cc */, 9AB3A6A7189E7B6E00F152F7 /* NotificationProducer.h */, 9AB3A6A8189E7B6E00F152F7 /* NotificationProducer.cc */, 9AB3A6A9189E7B6E00F152F7 /* NotificationDismisserSender.h */, 9AB3A6AA189E7B6E00F152F7 /* NotificationDismisserSender.cc */, 9AB3A6AB189E7B6E00F152F7 /* NotificationDismisserReceiver.h */, 9AB3A6AC189E7B6E00F152F7 /* NotificationDismisserReceiver.cc */, 9AB3A6AD189E7B6E00F152F7 /* NotificationDismisser.h */, 9AB3A6AE189E7B6E00F152F7 /* NotificationDismisser.cc */, 9AB3A6AF189E7B6E00F152F7 /* NotificationAsyncTaskEvents.cc */, 9AB9CE2B18547B6D004660C5 /* Notification.cc */, 9AB9CE2E18547B6D004660C5 /* NotificationConstants.cc */, 9AB9CE2F18547B6D004660C5 /* NotificationConstants.h */, 9AB9CE3018547B6D004660C5 /* NotificationEnums.cc */, 9AB9CE3118547B6D004660C5 /* NotificationReceiver.cc */, 9AB9CE3218547B6D004660C5 /* NotificationSender.cc */, 9AB9CE3318547B6D004660C5 /* NotificationService.cc */, 9AB9CE3418547B6D004660C5 /* NotificationText.cc */, 9AB9CE3518547B6D004660C5 /* NotificationTransport.cc */, 9AB9CE3618547B6D004660C5 /* NotificationTransport.h */, 9AB9CE3718547B6D004660C5 /* NotificationTransportConsumer.cc */, 9AB9CE3818547B6D004660C5 /* NotificationTransportConsumer.h */, 9AB9CE3918547B6D004660C5 /* NotificationTransportProducer.cc */, 9AB9CE3A18547B6D004660C5 /* NotificationTransportProducer.h */, 9AB9CE3D18547B6D004660C5 /* PayloadAdapter.cc */, 9AB9CE3E18547B6D004660C5 /* PayloadAdapter.h */, 9AB9CE3F18547B6D004660C5 /* RichAudioUrl.cc */, 9AB9CE4118547B6D004660C5 /* Transport.cc */, 9AB9CE4218547B6D004660C5 /* Transport.h */, ); path = src; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 9AB9CDD118547B37004660C5 /* alljoyn_notification_cpp */ = { isa = PBXNativeTarget; buildConfigurationList = 9AB9CDF518547B37004660C5 /* Build configuration list for PBXNativeTarget "alljoyn_notification_cpp" */; buildPhases = ( 9AB9CDCE18547B37004660C5 /* Sources */, 9AB9CDCF18547B37004660C5 /* Frameworks */, 9AA93A7F1855C1F600378361 /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = alljoyn_notification_cpp; productName = alljoyn_services_cpp; productReference = 9AB9CDD218547B37004660C5 /* liballjoyn_notification_cpp.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 9AB9CDCA18547B37004660C5 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = AllJoyn; }; buildConfigurationList = 9AB9CDCD18547B37004660C5 /* Build configuration list for PBXProject "alljoyn_notification_cpp" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 9AB9CDC918547B37004660C5; productRefGroup = 9AB9CDD318547B37004660C5 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 9AB9CDD118547B37004660C5 /* alljoyn_notification_cpp */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 9AB9CDCE18547B37004660C5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AB9CF5718547B6E004660C5 /* NotificationTransportConsumer.cc in Sources */, 9AB9CF5618547B6E004660C5 /* NotificationTransport.cc in Sources */, 9AB3A6B2189E7B6E00F152F7 /* NotificationProducerListener.cc in Sources */, 9AB3A6B0189E7B6E00F152F7 /* NotificationProducerSender.cc in Sources */, 9AB9CF5818547B6E004660C5 /* NotificationTransportProducer.cc in Sources */, 9AB3A6B1189E7B6E00F152F7 /* NotificationProducerReceiver.cc in Sources */, 9AB3A6B6189E7B6E00F152F7 /* NotificationDismisser.cc in Sources */, 9AB3A6B5189E7B6E00F152F7 /* NotificationDismisserReceiver.cc in Sources */, 9AB9CF4E18547B6E004660C5 /* Notification.cc in Sources */, 9AB9CF5318547B6E004660C5 /* NotificationSender.cc in Sources */, 9AB9CF5B18547B6E004660C5 /* RichAudioUrl.cc in Sources */, 9AB9CF5018547B6E004660C5 /* NotificationConstants.cc in Sources */, 9AB3A6B4189E7B6E00F152F7 /* NotificationDismisserSender.cc in Sources */, 9AB9CF5C18547B6E004660C5 /* Transport.cc in Sources */, 9AB3A6B3189E7B6E00F152F7 /* NotificationProducer.cc in Sources */, 9AB9CF5418547B6E004660C5 /* NotificationService.cc in Sources */, 9AB9CF5518547B6E004660C5 /* NotificationText.cc in Sources */, 9AB9CF5A18547B6E004660C5 /* PayloadAdapter.cc in Sources */, 9AB9CF5118547B6E004660C5 /* NotificationEnums.cc in Sources */, 9AB9CF5218547B6E004660C5 /* NotificationReceiver.cc in Sources */, 9AB3A6B7189E7B6E00F152F7 /* NotificationAsyncTaskEvents.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 9AB9CDF318547B37004660C5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = NO; SDKROOT = iphoneos; }; name = Debug; }; 9AB9CDF418547B37004660C5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 9AB9CDF618547B37004660C5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD)"; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; DSTROOT = /tmp/alljoyn_services_cpp.dst; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_cpp/alljoyn_notification_cpp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; HEADER_SEARCH_PATHS = ( "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", ); OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_notification_cpp; SKIP_INSTALL = YES; }; name = Debug; }; 9AB9CDF718547B37004660C5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD)"; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; DSTROOT = /tmp/alljoyn_services_cpp.dst; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_cpp/alljoyn_notification_cpp-Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; HEADER_SEARCH_PATHS = ( "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/\"", "$(inherited)", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib\"", ); OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_notification_cpp; SKIP_INSTALL = YES; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 9AB9CDCD18547B37004660C5 /* Build configuration list for PBXProject "alljoyn_notification_cpp" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AB9CDF318547B37004660C5 /* Debug */, 9AB9CDF418547B37004660C5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AB9CDF518547B37004660C5 /* Build configuration list for PBXNativeTarget "alljoyn_notification_cpp" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AB9CDF618547B37004660C5 /* Debug */, 9AB9CDF718547B37004660C5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 9AB9CDCA18547B37004660C5 /* Project object */; } project.xcworkspace/000077500000000000000000000000001272147170000365735ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_notification_cpp.xcodeprojcontents.xcworkspacedata000077500000000000000000000002451272147170000435410ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_notification_cpp.xcodeproj/project.xcworkspace base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_services_cpp/000077500000000000000000000000001272147170000300155ustar00rootroot00000000000000alljoyn_notification_cpp-Prefix.pch000077500000000000000000000020151272147170000367460ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_cpp/alljoyn_services_cpp/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef __OBJC__ #import #endif base-16.04/notification/ios/samples/alljoyn_services_objc/000077500000000000000000000000001272147170000237335ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_notification_objc.xcodeproj/000077500000000000000000000000001272147170000331425ustar00rootroot00000000000000project.pbxproj000077500000000000000000000734541272147170000361570ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_notification_objc.xcodeproj// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 9AA935ED1854BC2B00378361 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935EC1854BC2B00378361 /* Foundation.framework */; }; 9AA935FB1854BC2B00378361 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935FA1854BC2B00378361 /* XCTest.framework */; }; 9AA935FC1854BC2B00378361 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935EC1854BC2B00378361 /* Foundation.framework */; }; 9AA935FE1854BC2B00378361 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935FD1854BC2B00378361 /* UIKit.framework */; }; 9AA936011854BC2B00378361 /* liballjoyn_notification_objc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA935E91854BC2B00378361 /* liballjoyn_notification_objc.a */; }; 9AA936071854BC2B00378361 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9AA936051854BC2B00378361 /* InfoPlist.strings */; }; 9AA936091854BC2B00378361 /* alljoyn_services_objcTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */; }; 9AA939491854BD1800378361 /* AJNSNotificationReceiverAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F31854BD1700378361 /* AJNSNotificationReceiverAdapter.mm */; }; 9AA9394B1854BD1800378361 /* AJNSNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F51854BD1700378361 /* AJNSNotification.mm */; }; 9AA9394C1854BD1800378361 /* AJNSNotificationEnums.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F61854BD1700378361 /* AJNSNotificationEnums.mm */; }; 9AA9394D1854BD1800378361 /* AJNSNotificationSender.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F71854BD1700378361 /* AJNSNotificationSender.mm */; }; 9AA9394E1854BD1800378361 /* AJNSNotificationService.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F81854BD1700378361 /* AJNSNotificationService.mm */; }; 9AA9394F1854BD1800378361 /* AJNSSNotificationText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937F91854BD1700378361 /* AJNSSNotificationText.mm */; }; 9AA939511854BD1800378361 /* AJNSRichAudioUrl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AA937FB1854BD1700378361 /* AJNSRichAudioUrl.mm */; }; 9AA93A991855CCB800378361 /* AJNSNotificationReceiverAdapter.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937B71854BD1700378361 /* AJNSNotificationReceiverAdapter.h */; }; 9AA93A9B1855CCB800378361 /* AJNSNotification.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937B91854BD1700378361 /* AJNSNotification.h */; }; 9AA93A9C1855CCB800378361 /* AJNSNotificationEnums.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937BA1854BD1700378361 /* AJNSNotificationEnums.h */; }; 9AA93A9D1855CCB800378361 /* AJNSNotificationReceiver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937BB1854BD1700378361 /* AJNSNotificationReceiver.h */; }; 9AA93A9E1855CCB800378361 /* AJNSNotificationSender.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937BC1854BD1700378361 /* AJNSNotificationSender.h */; }; 9AA93A9F1855CCB800378361 /* AJNSNotificationService.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937BD1854BD1700378361 /* AJNSNotificationService.h */; }; 9AA93AA01855CCB800378361 /* AJNSNotificationText.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937BE1854BD1700378361 /* AJNSNotificationText.h */; }; 9AA93AA21855CCB800378361 /* AJNSPropertyStore.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937C01854BD1700378361 /* AJNSPropertyStore.h */; }; 9AA93AA31855CCB800378361 /* AJNSRichAudioUrl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AA937C11854BD1700378361 /* AJNSRichAudioUrl.h */; }; 9AABD3F318ACFBA50026304D /* AJSCCommonBusListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9AABD3F218ACFBA50026304D /* AJSCCommonBusListener.mm */; }; 9AABD3F418ACFBB80026304D /* AJSCCommonBusListener.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9AABD3F118ACFBA50026304D /* AJSCCommonBusListener.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 9AA935FF1854BC2B00378361 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9AA935E11854BC2B00378361 /* Project object */; proxyType = 1; remoteGlobalIDString = 9AA935E81854BC2B00378361; remoteInfo = alljoyn_services_objc; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ 9AA93A981855CC8E00378361 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = inc/alljoyn/notification; dstSubfolderSpec = 16; files = ( 9AA93A991855CCB800378361 /* AJNSNotificationReceiverAdapter.h in CopyFiles */, 9AA93A9B1855CCB800378361 /* AJNSNotification.h in CopyFiles */, 9AA93A9C1855CCB800378361 /* AJNSNotificationEnums.h in CopyFiles */, 9AA93A9D1855CCB800378361 /* AJNSNotificationReceiver.h in CopyFiles */, 9AA93A9E1855CCB800378361 /* AJNSNotificationSender.h in CopyFiles */, 9AA93A9F1855CCB800378361 /* AJNSNotificationService.h in CopyFiles */, 9AA93AA01855CCB800378361 /* AJNSNotificationText.h in CopyFiles */, 9AA93AA21855CCB800378361 /* AJNSPropertyStore.h in CopyFiles */, 9AA93AA31855CCB800378361 /* AJNSRichAudioUrl.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; 9AA93AA91855CD0F00378361 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = inc/alljoyn/samples_common; dstSubfolderSpec = 16; files = ( 9AABD3F418ACFBB80026304D /* AJSCCommonBusListener.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 9AA935E91854BC2B00378361 /* liballjoyn_notification_objc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liballjoyn_notification_objc.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9AA935EC1854BC2B00378361 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9AA935F01854BC2B00378361 /* alljoyn_notification_objc-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "alljoyn_notification_objc-Prefix.pch"; sourceTree = ""; }; 9AA935F91854BC2B00378361 /* alljoyn_notification_objcTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = alljoyn_notification_objcTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9AA935FA1854BC2B00378361 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 9AA935FD1854BC2B00378361 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 9AA936041854BC2B00378361 /* alljoyn_notification_objcTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "alljoyn_notification_objcTests-Info.plist"; sourceTree = ""; }; 9AA936061854BC2B00378361 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = alljoyn_services_objcTests.m; sourceTree = ""; }; 9AA937B71854BD1700378361 /* AJNSNotificationReceiverAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationReceiverAdapter.h; sourceTree = ""; }; 9AA937B91854BD1700378361 /* AJNSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotification.h; sourceTree = ""; }; 9AA937BA1854BD1700378361 /* AJNSNotificationEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationEnums.h; sourceTree = ""; }; 9AA937BB1854BD1700378361 /* AJNSNotificationReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationReceiver.h; sourceTree = ""; }; 9AA937BC1854BD1700378361 /* AJNSNotificationSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationSender.h; sourceTree = ""; }; 9AA937BD1854BD1700378361 /* AJNSNotificationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationService.h; sourceTree = ""; }; 9AA937BE1854BD1700378361 /* AJNSNotificationText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSNotificationText.h; sourceTree = ""; }; 9AA937C01854BD1700378361 /* AJNSPropertyStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSPropertyStore.h; sourceTree = ""; }; 9AA937C11854BD1700378361 /* AJNSRichAudioUrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJNSRichAudioUrl.h; sourceTree = ""; }; 9AA937F31854BD1700378361 /* AJNSNotificationReceiverAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSNotificationReceiverAdapter.mm; sourceTree = ""; }; 9AA937F51854BD1700378361 /* AJNSNotification.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSNotification.mm; sourceTree = ""; }; 9AA937F61854BD1700378361 /* AJNSNotificationEnums.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSNotificationEnums.mm; sourceTree = ""; }; 9AA937F71854BD1700378361 /* AJNSNotificationSender.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSNotificationSender.mm; sourceTree = ""; }; 9AA937F81854BD1700378361 /* AJNSNotificationService.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSNotificationService.mm; sourceTree = ""; }; 9AA937F91854BD1700378361 /* AJNSSNotificationText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSSNotificationText.mm; sourceTree = ""; }; 9AA937FB1854BD1700378361 /* AJNSRichAudioUrl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJNSRichAudioUrl.mm; sourceTree = ""; }; 9AABD3F118ACFBA50026304D /* AJSCCommonBusListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJSCCommonBusListener.h; sourceTree = ""; }; 9AABD3F218ACFBA50026304D /* AJSCCommonBusListener.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AJSCCommonBusListener.mm; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 9AA935E61854BC2B00378361 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AA935ED1854BC2B00378361 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; 9AA935F61854BC2B00378361 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9AA935FB1854BC2B00378361 /* XCTest.framework in Frameworks */, 9AA936011854BC2B00378361 /* liballjoyn_notification_objc.a in Frameworks */, 9AA935FE1854BC2B00378361 /* UIKit.framework in Frameworks */, 9AA935FC1854BC2B00378361 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 9AA935E01854BC2B00378361 = { isa = PBXGroup; children = ( 9AABD3F018ACFBA50026304D /* samples_common */, 9AA9376B1854BD1700378361 /* notification */, 9AA935EE1854BC2B00378361 /* alljoyn_services_objc */, 9AA936021854BC2B00378361 /* alljoyn_services_objcTests */, 9AA935EB1854BC2B00378361 /* Frameworks */, 9AA935EA1854BC2B00378361 /* Products */, ); sourceTree = ""; }; 9AA935EA1854BC2B00378361 /* Products */ = { isa = PBXGroup; children = ( 9AA935E91854BC2B00378361 /* liballjoyn_notification_objc.a */, 9AA935F91854BC2B00378361 /* alljoyn_notification_objcTests.xctest */, ); name = Products; sourceTree = ""; }; 9AA935EB1854BC2B00378361 /* Frameworks */ = { isa = PBXGroup; children = ( 9AA935EC1854BC2B00378361 /* Foundation.framework */, 9AA935FA1854BC2B00378361 /* XCTest.framework */, 9AA935FD1854BC2B00378361 /* UIKit.framework */, ); name = Frameworks; sourceTree = ""; }; 9AA935EE1854BC2B00378361 /* alljoyn_services_objc */ = { isa = PBXGroup; children = ( 9AA935EF1854BC2B00378361 /* Supporting Files */, ); path = alljoyn_services_objc; sourceTree = ""; }; 9AA935EF1854BC2B00378361 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AA935F01854BC2B00378361 /* alljoyn_notification_objc-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; 9AA936021854BC2B00378361 /* alljoyn_services_objcTests */ = { isa = PBXGroup; children = ( 9AA936081854BC2B00378361 /* alljoyn_services_objcTests.m */, 9AA936031854BC2B00378361 /* Supporting Files */, ); path = alljoyn_services_objcTests; sourceTree = ""; }; 9AA936031854BC2B00378361 /* Supporting Files */ = { isa = PBXGroup; children = ( 9AA936041854BC2B00378361 /* alljoyn_notification_objcTests-Info.plist */, 9AA936051854BC2B00378361 /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; 9AA9376B1854BD1700378361 /* notification */ = { isa = PBXGroup; children = ( 9AA937B31854BD1700378361 /* ios */, ); name = notification; path = ../../..; sourceTree = ""; }; 9AA937B31854BD1700378361 /* ios */ = { isa = PBXGroup; children = ( 9AA937B41854BD1700378361 /* inc */, 9AA937F21854BD1700378361 /* src */, ); path = ios; sourceTree = ""; }; 9AA937B41854BD1700378361 /* inc */ = { isa = PBXGroup; children = ( 9AA937B51854BD1700378361 /* alljoyn */, ); path = inc; sourceTree = ""; }; 9AA937B51854BD1700378361 /* alljoyn */ = { isa = PBXGroup; children = ( 9AA937B61854BD1700378361 /* notification */, ); path = alljoyn; sourceTree = ""; }; 9AA937B61854BD1700378361 /* notification */ = { isa = PBXGroup; children = ( 9AA937B71854BD1700378361 /* AJNSNotificationReceiverAdapter.h */, 9AA937B91854BD1700378361 /* AJNSNotification.h */, 9AA937BA1854BD1700378361 /* AJNSNotificationEnums.h */, 9AA937BB1854BD1700378361 /* AJNSNotificationReceiver.h */, 9AA937BC1854BD1700378361 /* AJNSNotificationSender.h */, 9AA937BD1854BD1700378361 /* AJNSNotificationService.h */, 9AA937BE1854BD1700378361 /* AJNSNotificationText.h */, 9AA937C01854BD1700378361 /* AJNSPropertyStore.h */, 9AA937C11854BD1700378361 /* AJNSRichAudioUrl.h */, ); path = notification; sourceTree = ""; }; 9AA937F21854BD1700378361 /* src */ = { isa = PBXGroup; children = ( 9AA937F31854BD1700378361 /* AJNSNotificationReceiverAdapter.mm */, 9AA937F51854BD1700378361 /* AJNSNotification.mm */, 9AA937F61854BD1700378361 /* AJNSNotificationEnums.mm */, 9AA937F71854BD1700378361 /* AJNSNotificationSender.mm */, 9AA937F81854BD1700378361 /* AJNSNotificationService.mm */, 9AA937F91854BD1700378361 /* AJNSSNotificationText.mm */, 9AA937FB1854BD1700378361 /* AJNSRichAudioUrl.mm */, ); path = src; sourceTree = ""; }; 9AABD3F018ACFBA50026304D /* samples_common */ = { isa = PBXGroup; children = ( 9AABD3F118ACFBA50026304D /* AJSCCommonBusListener.h */, 9AABD3F218ACFBA50026304D /* AJSCCommonBusListener.mm */, ); name = samples_common; path = ../../../../sample_apps/ios/samples_common; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 9AA935E81854BC2B00378361 /* alljoyn_notification_objc */ = { isa = PBXNativeTarget; buildConfigurationList = 9AA9360C1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_notification_objc" */; buildPhases = ( 9AA935E51854BC2B00378361 /* Sources */, 9AA935E61854BC2B00378361 /* Frameworks */, 9AA93A981855CC8E00378361 /* CopyFiles */, 9AA93AA91855CD0F00378361 /* CopyFiles */, ); buildRules = ( ); dependencies = ( ); name = alljoyn_notification_objc; productName = alljoyn_services_objc; productReference = 9AA935E91854BC2B00378361 /* liballjoyn_notification_objc.a */; productType = "com.apple.product-type.library.static"; }; 9AA935F81854BC2B00378361 /* alljoyn_notification_objcTests */ = { isa = PBXNativeTarget; buildConfigurationList = 9AA9360F1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_notification_objcTests" */; buildPhases = ( 9AA935F51854BC2B00378361 /* Sources */, 9AA935F61854BC2B00378361 /* Frameworks */, 9AA935F71854BC2B00378361 /* Resources */, ); buildRules = ( ); dependencies = ( 9AA936001854BC2B00378361 /* PBXTargetDependency */, ); name = alljoyn_notification_objcTests; productName = alljoyn_services_objcTests; productReference = 9AA935F91854BC2B00378361 /* alljoyn_notification_objcTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 9AA935E11854BC2B00378361 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = AllJoyn; }; buildConfigurationList = 9AA935E41854BC2B00378361 /* Build configuration list for PBXProject "alljoyn_notification_objc" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 9AA935E01854BC2B00378361; productRefGroup = 9AA935EA1854BC2B00378361 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 9AA935E81854BC2B00378361 /* alljoyn_notification_objc */, 9AA935F81854BC2B00378361 /* alljoyn_notification_objcTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 9AA935F71854BC2B00378361 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AA936071854BC2B00378361 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 9AA935E51854BC2B00378361 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AA939491854BD1800378361 /* AJNSNotificationReceiverAdapter.mm in Sources */, 9AA939511854BD1800378361 /* AJNSRichAudioUrl.mm in Sources */, 9AABD3F318ACFBA50026304D /* AJSCCommonBusListener.mm in Sources */, 9AA9394B1854BD1800378361 /* AJNSNotification.mm in Sources */, 9AA9394D1854BD1800378361 /* AJNSNotificationSender.mm in Sources */, 9AA9394F1854BD1800378361 /* AJNSSNotificationText.mm in Sources */, 9AA9394C1854BD1800378361 /* AJNSNotificationEnums.mm in Sources */, 9AA9394E1854BD1800378361 /* AJNSNotificationService.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 9AA935F51854BC2B00378361 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9AA936091854BC2B00378361 /* alljoyn_services_objcTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 9AA936001854BC2B00378361 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9AA935E81854BC2B00378361 /* alljoyn_notification_objc */; targetProxy = 9AA935FF1854BC2B00378361 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 9AA936051854BC2B00378361 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 9AA936061854BC2B00378361 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 9AA9360A1854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 9AA9360B1854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 9AA9360D1854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; DSTROOT = /tmp/alljoyn_services_objc.dst; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_notification_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc/alljoyn/notification/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/ios/inc\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_notification_objc; SKIP_INSTALL = YES; }; name = Debug; }; 9AA9360E1854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; DSTROOT = /tmp/alljoyn_services_objc.dst; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_notification_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc/alljoyn/notification/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/cpp/inc\"", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/services_common/ios/inc\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", "-DUSE_SAMPLE_LOGGER", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = alljoyn_notification_objc; SKIP_INSTALL = YES; }; name = Release; }; 9AA936101854BC2B00378361 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_services_objc-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); HEADER_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)\"/**", "\"$(SRCROOT)/../../../../../common/inc\"", "\"$(SRCROOT)/../../../../../alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(SRCROOT)/../../../../../applications\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)/notification/cpp/inc/alljoyn/notification/", ); INFOPLIST_FILE = "alljoyn_services_objcTests/alljoyn_notification_objcTests-Info.plist"; PRODUCT_NAME = alljoyn_notification_objcTests; WRAPPER_EXTENSION = xctest; }; name = Debug; }; 9AA936111854BC2B00378361 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "alljoyn_services_objc/alljoyn_services_objc-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(SRCROOT)/../../../../../build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"/**", "\"$(ALLSEEN_BASE_SERVICES_ROOT)\"/**", "\"$(SRCROOT)/../../../../../common/inc\"", "\"$(SRCROOT)/../../../../../alljoyn_objc/AllJoynFramework/AllJoynFramework\"", "\"$(SRCROOT)/../../../../../applications\"/**", ); INFOPLIST_FILE = "alljoyn_services_objcTests/alljoyn_notification_objcTests-Info.plist"; PRODUCT_NAME = alljoyn_notification_objcTests; WRAPPER_EXTENSION = xctest; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 9AA935E41854BC2B00378361 /* Build configuration list for PBXProject "alljoyn_notification_objc" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA9360A1854BC2B00378361 /* Debug */, 9AA9360B1854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AA9360C1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_notification_objc" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA9360D1854BC2B00378361 /* Debug */, 9AA9360E1854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 9AA9360F1854BC2B00378361 /* Build configuration list for PBXNativeTarget "alljoyn_notification_objcTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 9AA936101854BC2B00378361 /* Debug */, 9AA936111854BC2B00378361 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 9AA935E11854BC2B00378361 /* Project object */; } base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objc/000077500000000000000000000000001272147170000303035ustar00rootroot00000000000000alljoyn_notification_objc-Prefix.pch000077500000000000000000000020151272147170000373670ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objc/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #ifdef __OBJC__ #import #endif base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/000077500000000000000000000000001272147170000313265ustar00rootroot00000000000000alljoyn_notification_objcTests-Info.plist000077500000000000000000000032731272147170000414630ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier org.alljoyn.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType BNDL CFBundleShortVersionString 00.01 CFBundleSignature ???? CFBundleVersion 1 alljoyn_services_objcTests.m000077500000000000000000000027321272147170000370270ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import @interface alljoyn_services_objcTests : XCTestCase @end @implementation alljoyn_services_objcTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); } @end base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/en.lproj/000077500000000000000000000000001272147170000330555ustar00rootroot00000000000000InfoPlist.strings000077500000000000000000000000551272147170000363230ustar00rootroot00000000000000base-16.04/notification/ios/samples/alljoyn_services_objc/alljoyn_services_objcTests/en.lproj/* Localized versions of Info.plist keys */ base-16.04/notification/ios/src/000077500000000000000000000000001272147170000165065ustar00rootroot00000000000000base-16.04/notification/ios/src/AJNSNotification.mm000066400000000000000000000352251272147170000221520ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotification.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJNSNotification () /** notificationHandler */ @property (nonatomic) ajn::services::Notification *handle; @end @implementation AJNSNotification - (id)initWithHandle:(const ajn::services::Notification *)handle { self = [super init]; if (self) { self.handle = (ajn::services::Notification *)handle; } return self; } /** * Constructor for Notification * @param messageId * @param messageType * @param deviceId * @param deviceName * @param appId * @param appName * @param sender * @param customAttributes * @param notificationText * @param richIconUrl * @param richAudioUrl * @param richIconObjectPath * @param richAudioObjectPath * @param controlPanelServiceObjectPath */ - (AJNSNotification *)initWithMessageId:(int32_t)messageId messageType:(AJNSNotificationMessageType)messageType deviceId:(NSString *)deviceId deviceName:(NSString *)deviceName appId:(NSString *)appId appName:(NSString *)appName sender:(NSString *)sender customAttributes:(NSMutableDictionary *)customAttributes notificationText:(NSMutableArray *)notificationText richIconUrl:(NSString *)richIconUrl richAudioUrl:(NSMutableArray *)richAudioUrl richIconObjectPath:(NSString *)richIconObjectPath richAudioObjectPath:(NSString *)richAudioObjectPath controlPanelServiceObjectPath:(NSString *)controlPanelServiceObjectPath { self = [super init]; if (self) { self.handle = new ajn::services::Notification::Notification(messageId, [self convertAJNSNMessageType:messageType], [AJNConvertUtil convertNSStringToConstChar:deviceId], [AJNConvertUtil convertNSStringToConstChar:deviceName], [AJNConvertUtil convertNSStringToConstChar:appId], [AJNConvertUtil convertNSStringToConstChar:appName], [AJNConvertUtil convertNSStringToConstChar:sender], [self convertAJNSCustomAttributes:customAttributes], [self convertAJNSNotificationText:notificationText], [AJNConvertUtil convertNSStringToConstChar:richIconUrl], [self convertAJNSRichAudioUrl:richAudioUrl], [AJNConvertUtil convertNSStringToConstChar:richIconObjectPath], [AJNConvertUtil convertNSStringToConstChar:richAudioObjectPath], [AJNConvertUtil convertNSStringToConstChar:controlPanelServiceObjectPath], NULL); } return self; } /** * Construct for Notification * @param messageType * @param notificationText */ - (AJNSNotification *)initWithMessageType:(AJNSNotificationMessageType)messageType andNotificationText:(NSMutableArray *)notificationText { //covert parameters from obj-c to cpp NSMutableDictionary *tmpCustomAttributesDictionary = [[NSMutableDictionary alloc] init]; NSMutableArray *tmpRichAudioUrlArr = [[NSMutableArray alloc] init]; self = [self initWithMessageId:-1 messageType:messageType deviceId:@"" deviceName:@"" appId:@"" appName:@"" sender:@"" customAttributes:tmpCustomAttributesDictionary notificationText:notificationText richIconUrl:@"" richAudioUrl:tmpRichAudioUrlArr richIconObjectPath:@"" richAudioObjectPath:@"" controlPanelServiceObjectPath:@""]; return self; } //Retreival methods /** * Get the Version * @return version */ - (int16_t)version { return (self.handle->getVersion()); } /** * Get the device Id * @return deviceId */ - (NSString *)deviceId { return self.handle->getDeviceId() ? ([AJNConvertUtil convertConstCharToNSString:(self.handle->getDeviceId())]) : nil; } /** * Get the Device Name * @return deviceName */ - (NSString *)deviceName { return self.handle->getDeviceName() ? ([AJNConvertUtil convertConstCharToNSString:(self.handle->getDeviceName())]) : nil; } /** * Get the app Id * @return appId */ - (NSString *)appId { return self.handle->getAppId() ? ([AJNConvertUtil convertConstCharToNSString:self.handle->getAppId()]) : nil; } /** * Get the app Name * @return appName */ - (NSString *)appName { return [AJNConvertUtil convertConstCharToNSString:self.handle->getAppName()]; } /** * Get the map of customAttributes @return customAttributes */ - (NSMutableDictionary *)customAttributes { std::map customAttributesMap; std::map ::iterator cIt; NSMutableDictionary *customAttributesDictionary = [[NSMutableDictionary alloc] init]; //call cpp getCustomAttributes(returns map) //returns const std::map customAttributesMap = self.handle->getCustomAttributes(); //translate cpp returned value to obj-c (map to dictionary) for (cIt = customAttributesMap.begin(); cIt != customAttributesMap.end(); ++cIt) { //insert key/value into the dictionary [customAttributesDictionary setValue:[AJNConvertUtil convertQCCStringtoNSString:cIt->second] forKey:[AJNConvertUtil convertQCCStringtoNSString:cIt->first]]; } return customAttributesDictionary; } /** * Get the Message Id * @return notificationId */ - (int32_t)messageId { return self.handle->getMessageId(); } /** * Get the Sender * @return Sender */ - (NSString *)senderBusName { return self.handle->getSenderBusName() ? [AJNConvertUtil convertConstCharToNSString:self.handle->getSenderBusName()] : nil; } /** * Get the MessageType * @return MessageType */ - (AJNSNotificationMessageType)messageType { return (AJNSNotificationMessageType)(self.handle->getMessageType()); } /** * Get the Notification Text * @return notificationText */ - (NSArray *)text { return self.ajnsntArr; } /** * Get the Rich Icon Url * @return RichIconUrl */ - (NSString *)richIconUrl { return self.handle->getRichIconUrl() ? [AJNConvertUtil convertConstCharToNSString:self.handle->getRichIconUrl()] : nil; } /** * Get the Rich Icon Object Path * @return richIconObjectPath */ - (NSString *)richIconObjectPath { return self.handle->getRichIconUrl() ? [AJNConvertUtil convertConstCharToNSString:self.handle->getRichIconObjectPath()] : nil; } /** * Get the Rich Audio Object Path * @return richAudioObjectPath */ - (NSString *)richAudioObjectPath { return self.handle->getRichIconUrl() ? [AJNConvertUtil convertConstCharToNSString:self.handle->getRichAudioObjectPath()] : nil; } /** * Get the Rich Audio Urls * @return RichAudioUrl - NSMutableArray of AJNSRichAudioUrl objects */ - (void)richAudioUrl:(NSMutableArray *)inputArray { std::vector nRichAudioUrlVect; //call cpp getRichAudioUrl (returns std::vector) nRichAudioUrlVect = self.handle->getRichAudioUrl(); //for ( size_t &i : nRichAudioUrl ) for (size_t i = 0; i < nRichAudioUrlVect.size(); i++) { AJNSRichAudioUrl *ajnsRau = [[AJNSRichAudioUrl alloc] init]; ajnsRau.richAudioUrlHandler = &nRichAudioUrlVect.at(i); [inputArray addObject : (ajnsRau)]; } } /** * Get the ControlPanelService object path * @return ControlPanelServiceObjectPath */ - (NSString *)controlPanelServiceObjectPath { return self.handle->getControlPanelServiceObjectPath() ? [AJNConvertUtil convertConstCharToNSString:self.handle->getControlPanelServiceObjectPath()] : nil; } //Methods which set information /** * Set the App Id of the Notification * @param appId */ - (void)setAppId:(NSString *)appId { self.handle->setAppId([AJNConvertUtil convertNSStringToConstChar:appId]); } /** * Set the App Name of the Notification * @param appName */ - (void)setAppName:(NSString *)appName { self.handle->setAppName([AJNConvertUtil convertNSStringToConstChar:appName]); } /** * Set the Control Panel Service Object Path of the Notification * @param controlPanelServiceObjectPath */ - (void)setControlPanelServiceObjectPath:(NSString *)controlPanelServiceObjectPath { self.handle->setControlPanelServiceObjectPath([AJNConvertUtil convertNSStringToConstChar:controlPanelServiceObjectPath]); } /** * Set the Custom Attributed of the Notification * @param customAttributes */ - (void)setCustomAttributes:(NSMutableDictionary *)customAttributes { self.handle->setCustomAttributes([self convertAJNSCustomAttributes:customAttributes]); } /** * Set the deviceId of the Notification * @param deviceId */ - (void)setDeviceId:(NSString *)deviceId { self.handle->setDeviceId([AJNConvertUtil convertNSStringToConstChar:deviceId]); } /** * Set the deviceName of the Notification * @param deviceName */ - (void)setDeviceName:(NSString *)deviceName { self.handle->setDeviceName([AJNConvertUtil convertNSStringToConstChar:deviceName]); } /** * Set the messageId of the Notification * @param messageId */ - (void)setMessageId:(int32_t)messageId { self.handle->setMessageId(messageId); } /** * Set the richAudioUrl of the Notification * @param richAudioUrl */ - (void)setRichAudioUrl:(NSMutableArray *)richAudioUrl { self.handle->setRichAudioUrl([self convertAJNSRichAudioUrl:richAudioUrl]); } /** * Set the richIconUrl of the Notification * @param richIconUrl */ - (void)setRichIconUrl:(NSString *)richIconUrl { self.handle->setRichIconUrl([AJNConvertUtil convertNSStringToConstChar:richIconUrl]); } /** * Set the richIconObjectPath of the Notification * @param richIconObjectPath */ - (void)setRichIconObjectPath:(NSString *)richIconObjectPath { self.handle->setRichIconObjectPath([AJNConvertUtil convertNSStringToConstChar:richIconObjectPath]); } /** * Set the richAudioObjectPath of the Notification * @param richAudioObjectPath */ - (void)setRichAudioObjectPath:(NSString *)richAudioObjectPath { self.handle->setRichAudioObjectPath([AJNConvertUtil convertNSStringToConstChar:richAudioObjectPath]); } /** * Set the sender of the Notification * @param sender */ - (void)setSender:(NSString *)sender { self.handle->setSender([AJNConvertUtil convertNSStringToConstChar:sender]); } /** * Convert AJNSNMessageType to NotificationMessageType * @param ajnsnMessageType */ - (ajn::services::NotificationMessageType)convertAJNSNMessageType:(AJNSNotificationMessageType)ajnsnMessageType { return (ajn::services::NotificationMessageType)ajnsnMessageType; } /** * Convert AJNSCustomAttributes NSMutableDictionary to CustomAttributes std::map * @param ajnsCustomAttributes */ - (std::map )convertAJNSCustomAttributes:(NSMutableDictionary *)ajnsCustomAttributes { std::map nmap; NSEnumerator *enumerator = [ajnsCustomAttributes keyEnumerator]; //use NSFastEnumeration? id key; while ((key = [enumerator nextObject])) { /* put key and value in the map */ // nmap.insert(std::make_pair([key UTF8String],[[ajnsCustomAttributes objectForKey:(key)] UTF8String])); nmap.insert(std::make_pair([key cStringUsingEncoding:NSUTF8StringEncoding], [[ajnsCustomAttributes objectForKey:key] cStringUsingEncoding:NSUTF8StringEncoding])); } return nmap; } /** * Convert AJNSNotificationText NSMutableArray to NotificationText std::vector * @param ajnsnTextArr */ - (std::vector )convertAJNSNotificationText:(NSMutableArray *)ajnsnTextArr { std::vector nNotificationTextVect; //for ( auto &i : ajnsnTextArr ) for (AJNSNotificationText *t_AJNSNotificationText in ajnsnTextArr) { nNotificationTextVect.push_back(*(t_AJNSNotificationText.handle)); } return nNotificationTextVect; } /** * Convert AJNSRichAudioUrl NSMutableArray to RichAudioUrl std::vector * @param ajnsRichAudioUrlArr */ - (std::vector )convertAJNSRichAudioUrl:(NSMutableArray *)ajnsRichAudioUrlArr { std::vector nRichAudioUrlVect; //convert ajnsRichAudioUrlArr(NSString)to AJNSRichAudioUrl object for (AJNSRichAudioUrl *t_AJNSRichAudioUrl in ajnsRichAudioUrlArr) { nRichAudioUrlVect.push_back(*(t_AJNSRichAudioUrl.richAudioUrlHandler)); } return nRichAudioUrlVect; } - (void)createAJNSNotificationTextArray { self.ajnsntArr = [[NSMutableArray alloc] init]; std::vector ntVect; //cpp vector ntVect = self.handle->getText(); for (size_t i = 0; i < ntVect.size(); i++) { // ajnsNt.notificationTextHandler = &(ntVect.at(i)); //cpp //get lang and text from the object at i qcc::String cppl = ntVect.at(i).getLanguage(); NSString *ocl = [AJNConvertUtil convertQCCStringtoNSString:cppl]; qcc::String cppt = ntVect.at(i).getText(); NSString *oct = [AJNConvertUtil convertQCCStringtoNSString:cppt]; AJNSNotificationText *ajnsNt = [[AJNSNotificationText alloc] initWithLang:ocl andText:oct]; [self.ajnsntArr addObject:ajnsNt]; } } -(QStatus) dismiss { return self.handle->dismiss(); } @end base-16.04/notification/ios/src/AJNSNotificationEnums.mm000066400000000000000000000025231272147170000231550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotificationEnums.h" @implementation AJNSNotificationEnums + (NSString *)AJNSMessageTypeToString:(AJNSNotificationMessageType)msgType { switch (msgType) { case 0: return @"EMERGENCY"; break; case 1: return @"WARNING"; break; case 2: return @"INFO"; break; default: return @"UNSET"; break; } } @end base-16.04/notification/ios/src/AJNSNotificationReceiverAdapter.mm000066400000000000000000000036541272147170000251410ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotificationReceiverAdapter.h" #import "AJNSNotificationReceiver.h" #import "alljoyn/about/AJNConvertUtil.h" AJNSNotificationReceiverAdapter::AJNSNotificationReceiverAdapter(id notificationReceiverHandler) { ajnsNotificationReceiverHandler = notificationReceiverHandler; } void AJNSNotificationReceiverAdapter::Receive(ajn::services::Notification const& notification) { AJNSNotification *t_ajnsNotification = [[AJNSNotification alloc] initWithHandle:(new ajn::services::Notification(notification))]; [t_ajnsNotification createAJNSNotificationTextArray]; [ajnsNotificationReceiverHandler receive:t_ajnsNotification]; } void AJNSNotificationReceiverAdapter::Dismiss(const int32_t msgId, const qcc::String appId) { NSLog(@"Got Dissmiss of msgId %d and appId %@",msgId, [AJNConvertUtil convertQCCStringtoNSString:appId]); [ajnsNotificationReceiverHandler dismissMsgId:msgId appId:[AJNConvertUtil convertQCCStringtoNSString:appId]]; }base-16.04/notification/ios/src/AJNSNotificationSender.mm000066400000000000000000000041451272147170000233100ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotificationSender.h" @interface AJNSNotificationSender () @property (nonatomic) ajn::services::AboutPropertyStoreImpl *propertyStore; @end @implementation AJNSNotificationSender - (AJNSNotificationSender *)initWithPropertyStore:(AJNAboutPropertyStoreImpl *)propertyStore { self = [super init]; if (self) { self.propertyStore = [propertyStore getHandle]; if (self.propertyStore) { self.senderHandle = new ajn::services::NotificationSender(self.propertyStore); return self; } } return nil; } /** * Send notification * @param notification * @param ttl message ttl * @return status */ - (QStatus)send:(AJNSNotification *)ajnsNotification ttl:(uint16_t)ttl { return (self.senderHandle->send(*ajnsNotification.handle, ttl)); } /** * Delete last message that was sent with given MessageType * @param messageType MessageType of message to be deleted * @return status */ - (QStatus)deleteLastMsg:(AJNSNotificationMessageType)messageType { return(self.senderHandle->deleteLastMsg((ajn::services::NotificationMessageType)messageType)); } - (ajn::services::AboutPropertyStoreImpl *)getPropertyStore { return self.propertyStore; } @end base-16.04/notification/ios/src/AJNSNotificationService.mm000066400000000000000000000122511272147170000234650ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotificationService.h" #import "alljoyn/services_common/AJSVCGenericLogger.h" #import "alljoyn/services_common/AJSVCGenericLoggerDefaultImpl.h" @interface AJNSNotificationService () @property AJSVCGenericLoggerAdapter *genericLoggerAdapter; @property id currentLogger; @property (strong, nonatomic) AJNSNotificationSender *ajnsSender; //@property QLogLevel currentLogLevel; @end @implementation AJNSNotificationService /** * Get Instance of NotificationServiceImpl - singleton implementation * @return instance */ + (id)sharedInstance { static AJNSNotificationService *ajnsNotificationService; static dispatch_once_t donce; dispatch_once(&donce, ^{ ajnsNotificationService = [[self alloc] init]; }); return ajnsNotificationService; } - (id)init { if (self = [super init]) { } return self; } /** * Initialize Producer side via Transport. Create and * return NotificationSender. * @param bus * @param store * @return NotificationSender instance */ - (AJNSNotificationSender *)startSendWithBus:(AJNBusAttachment *)bus andPropertyStore:(AJNAboutPropertyStoreImpl *)store { self.ajnsSender = [[AJNSNotificationSender alloc] initWithPropertyStore:store]; //NotificationSender* NotificationService::initSend(BusAttachment* bus, PropertyStore* store) if (self.ajnsSender) { self.ajnsSender.senderHandle = ajn::services::NotificationService::getInstance()->initSend((ajn::BusAttachment *)bus.handle, [self.ajnsSender getPropertyStore]); } return self.ajnsSender.senderHandle ? self.ajnsSender : nil; } /** * Initialize Consumer side via Transport. * Set NotificationReceiver to given receiver * @param bus * @param notificationReceiver * @return status */ - (QStatus)startReceive:(AJNBusAttachment *)bus withReceiver:(id )ajnsNotificationReceiver { if (!bus) { return ER_BAD_ARG_1; } if (!ajnsNotificationReceiver) { return ER_BAD_ARG_2; } AJNSNotificationReceiverAdapter *notificationReceiverAdapter = new AJNSNotificationReceiverAdapter(ajnsNotificationReceiver); if (!notificationReceiverAdapter) { if (self.logger) [self.logger warnTag:[NSString stringWithFormat:@"%@", [[self class] description]] text:@"Failed to create adapter."]; return ER_FAIL; } return (ajn::services::NotificationService::getInstance()->initReceive((ajn::BusAttachment *)bus.handle, notificationReceiverAdapter)); } /** * Stops sender but leaves bus and other objects alive */ - (void)shutdownSender { ajn::services::NotificationService::getInstance()->shutdownSender(); } /** * Stops receiving but leaves bus and other objects alive */ - (void)shutdownReceiver { ajn::services::NotificationService::getInstance()->shutdownReceiver(); } /** * Cleanup and get ready for shutdown */ - (void)shutdown { ajn::services::NotificationService::getInstance()->shutdown(); } /** @deprecated SuperAgent was deprecated in May 2015 for 15.04 * release * Disabling superagent mode. * Needs to be called before * starting receiver * @return status */ - (QStatus)disableSuperAgent { return ER_OK; } #pragma mark *** Logger methods *** /** * Get the currently-configured logger implementation * @return logger Implementation of GenericLogger */ - (id )logger { return self.currentLogger; } /** * Set log level filter for subsequent logging messages * @param newLogLevel enum value * @return logLevel enum value that was in effect prior to this change */ - (void)setLogLevel:(QLogLevel)newLogLevel; { [self.currentLogger setLogLevel:newLogLevel]; } /** * Get log level filter value currently in effect * @return logLevel enum value currently in effect */ - (QLogLevel)logLevel; { return [self.currentLogger logLevel]; } #pragma mark *** *** /** * Virtual method to get the busAttachment used in the service. */ - (AJNBusAttachment *)busAttachment { AJNBusAttachment *ajnBusAttachment; ajnBusAttachment = [[AJNBusAttachment alloc] initWithHandle:ajn::services::NotificationService::getInstance()->getBusAttachment()]; return ajnBusAttachment; } /** * Get the Version of the NotificationService * @return the NotificationService version */ - (uint16_t)version { return ajn::services::NotificationService::getInstance()->getVersion(); } @end base-16.04/notification/ios/src/AJNSRichAudioUrl.mm000066400000000000000000000042371272147170000220550ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSRichAudioUrl.h" #import "alljoyn/about/AJNConvertUtil.h" @implementation AJNSRichAudioUrl /** * Constructor for RichAudioUrl * @param language Language of Audio Content * @param text Text of Audio Content */ - (AJNSRichAudioUrl *)initRichAudioUrlWithLang:(NSString *)language andUrl:(NSString *)url { self = [super init]; if (self) { self.richAudioUrlHandler = new ajn::services::RichAudioUrl([AJNConvertUtil convertNSStringToQCCString:language], [AJNConvertUtil convertNSStringToQCCString:(url)]); } return self; } - (void)setRichAudioUrlHandler:(ajn::services::RichAudioUrl *)richAudioUrlHandler { _richAudioUrlHandler = richAudioUrlHandler; _language = [AJNConvertUtil convertQCCStringtoNSString:richAudioUrlHandler->getLanguage()]; _url = [AJNConvertUtil convertQCCStringtoNSString:richAudioUrlHandler->getUrl()]; } /** * Set Language for Audio Content * @param language */ - (void)setLanguage:(NSString *)language { self.richAudioUrlHandler->setLanguage([AJNConvertUtil convertNSStringToQCCString:language]); } /** * Set URL for Audio Content * @param url */ - (void)setUrl:(NSString *)url { self.richAudioUrlHandler->setUrl([AJNConvertUtil convertNSStringToQCCString:url]); } @end base-16.04/notification/ios/src/AJNSSNotificationText.mm000066400000000000000000000042641272147170000231410ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJNSNotificationText.h" #import "alljoyn/about/AJNConvertUtil.h" @interface AJNSNotificationText () /** cpp notificationText Handler*/ @property (nonatomic) ajn::services::NotificationText *handle; @end @implementation AJNSNotificationText - (AJNSNotificationText *)initWithLang:(NSString *)language andText:(NSString *)text { self = [super init]; if (self) { self.handle = new ajn::services::NotificationText([AJNConvertUtil convertNSStringToQCCString:language], [AJNConvertUtil convertNSStringToQCCString:text]); } return self; } /** * Set Language for Notification * @param language */ - (void)setLanguage:(NSString *)language { self.handle->setLanguage([AJNConvertUtil convertNSStringToQCCString:language]); } /** * Get Language for Notification * @return language */ - (NSString *)getLanguage { return [AJNConvertUtil convertQCCStringtoNSString:self.handle->getLanguage()]; } /** * Set Text for Notification * @param text the text to set */ - (void)setText:(NSString *)text { self.handle->setText([AJNConvertUtil convertNSStringToQCCString:text]); } /** * Get Text for Notification * @return text */ - (NSString *)getText { return [AJNConvertUtil convertQCCStringtoNSString:(self.handle->getText())]; } @end base-16.04/notification/java/000077500000000000000000000000001272147170000160465ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/000077500000000000000000000000001272147170000220155ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/.classpath000066400000000000000000000011101272147170000237710ustar00rootroot00000000000000 base-16.04/notification/java/NotificationService/.project000066400000000000000000000005721272147170000234700ustar00rootroot00000000000000 NotificationService org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature base-16.04/notification/java/NotificationService/.settings/000077500000000000000000000000001272147170000237335ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000011511272147170000307130ustar00rootroot00000000000000#Thu Feb 07 08:47:42 IST 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 base-16.04/notification/java/NotificationService/build.xml000066400000000000000000000047441272147170000236470ustar00rootroot00000000000000 base-16.04/notification/java/NotificationService/src/000077500000000000000000000000001272147170000226045ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/000077500000000000000000000000001272147170000233735ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/000077500000000000000000000000001272147170000250435ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/000077500000000000000000000000001272147170000254635ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/Notification.java000066400000000000000000000243171272147170000307630ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; import java.util.List; import java.util.Map; import java.util.UUID; import org.alljoyn.ns.transport.consumer.NotificationFeedback; /** * The Notification that is sent over the network */ public class Notification { /** * version */ private int version; /** * Notification message Id */ private int messageId; /** * Notification message type */ private NotificationMessageType messageType; /** * App name */ private String appName; /** * App Id */ private UUID appId; /** * Device name */ private String deviceName; /** * Device Id */ private String deviceId; /** * Sender Id - name of the bus that the {@link Notification} was received from */ private String sender; /** * The sender Id of the Bus that originally sent the {@link Notification} message. * If the {@link Notification} was received from a Super Agent, the sender field of the object is of the Super Agent, * and this field is the value of the {@link Notification} producer that has originally sent the message. */ private String origSender; /** * Map of customized array variable */ private Map customAttributes; /** * list of NotificationText objects */ private List text; /** * Rich notification icon URL */ private String richIconUrl; /** * Rich notification audio url */ private List richAudioUrl; /** * Rich notification icon object path */ private String richIconObjPath; /** * Rich notification audio object path */ private String richAudioObjPath; /** * Control Panel Service object path */ private String responseObjectPath; /** * Constructor * @param messageType The type of the sent or received Notification * @param text The list of text messages to be sent or received */ public Notification(NotificationMessageType messageType, List text) throws NotificationServiceException { setMessageType(messageType); setText(text); }//Notification /** * @return The protocol version */ public int getVersion() { return version; } /** * @return Notification message type */ public NotificationMessageType getMessageType() { return messageType; } /** * @return Returns the application name */ public String getAppName() { return appName; } /** * @return The application identifier */ public UUID getAppId() { return appId; } /** * The device name that has sent the {@link Notification} */ public String getDeviceName() { return deviceName; } /** * The device id that has sent the {@link Notification} */ public String getDeviceId() { return deviceId; } /** * Sender Id - name of the bus that the {@link Notification} was received from */ public String getSenderBusName() { return sender; } /** * The sender Id of the Bus that originally sent the {@link Notification} message. * If the {@link Notification} was received from a Super Agent, the sender field of the object is of the Super Agent, * and this field is the value of the {@link Notification} producer that has originally sent the message. * @return Bus name of the original {@link Notification} sender */ public String getOriginalSenderBusName() { return origSender; } /** * Map of customized array variable */ public Map getCustomAttributes() { return customAttributes; } /** * List of {@link NotificationText} objects */ public List getText() { return text; } /** * {@link Notification} message id */ public int getMessageId() { return messageId; } /** * @see org.alljoyn.ns.Notification#getRichIconUrl() */ public String getRichIconUrl() { return richIconUrl; } /** * Rich notification icon URL */ public List getRichAudioUrl() { return richAudioUrl; } /** * Rich notification icon object path */ public String getRichIconObjPath() { return richIconObjPath; } /** * Rich notification audio object path */ public String getRichAudioObjPath() { return richAudioObjPath; } /** * The object identifier to be used to invoke methods of the sender. * Usually used for Notification with action. */ public String getResponseObjectPath() { return responseObjectPath; } /** * Set notification message type * @param messageType * @throws NotificationServiceException Is thrown if the message type is NULL */ public void setMessageType(NotificationMessageType messageType) throws NotificationServiceException { if ( messageType == null ) { throw new NotificationServiceException("MessageType must be set"); } this.messageType = messageType; }//setMessageType /** * Set customAttributes map * @param customAttributes */ public void setCustomAttributes(Map customAttributes) { this.customAttributes = customAttributes; } /** * Set list of NotificationText * @param text Is thrown if the text is NULL or is empty */ public void setText(List text) throws NotificationServiceException { if ( text == null || text.size() == 0 ) { throw new NotificationServiceException("The text argument must be set and may not be an empty list"); } this.text = text; }//setText /** * Set the icon url for displaying rich content * @param richIconUrl */ public void setRichIconUrl(String richIconUrl) { this.richIconUrl = richIconUrl; } /** * Set audio url to send rich content * @param richAudioUrl - A list of url per language */ public void setRichAudioUrl(List richAudioUrl) { this.richAudioUrl = richAudioUrl; } /** * Set the icon Object Path for displaying rich content * @param richIconObjPath */ public void setRichIconObjPath(String richIconObjPath) { this.richIconObjPath = richIconObjPath; } /** * Set audio Object Path to send rich content * @param richAudioObjPath - An object path for the rich audio object */ public void setRichAudioObjPath(String richAudioObjPath) { this.richAudioObjPath = richAudioObjPath; } /** * Set Control Panel Service Object Path * @param responseObjectPath */ public void setResponseObjectPath(String responseObjectPath) { this.responseObjectPath = responseObjectPath; } //=======================================// /** * When the notification message is dismissed, it is first of all deleted by the Notification Producer * and then a dismiss signal is sent to update other Notification Consumers that the {@link Notification} * has been dismissed */ public void dismiss() { try { new NotificationFeedback(this).dismiss(); } catch (NotificationServiceException nse) { System.out.println("Failed to call the dismiss method, Error: '" + nse.getMessage() + "'"); } }//dismiss /** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder("Notification: "); sb.append("Id: '").append(messageId).append("'") .append(", MsgType: '").append(messageType).append("'") .append(", DeviceId: '").append(deviceId).append("'") .append(", DeviceName: '").append(deviceName).append("'") .append(", Version: '").append(version).append("'") .append(", Sender: '").append(sender).append("'") .append(", OrigSender: '").append(origSender).append("'") .append(", AppId: '").append(appId).append("'") .append(", AppName: '").append(appName).append("'") .append(", CustomAttributes: '").append(customAttributes).append("'") .append(", TextMessage: '").append(text).append("'"); if ( richIconUrl != null && richIconUrl.length() > 0 ) { sb.append(", RichIconURL: '").append(richIconUrl).append("'"); } if ( richIconObjPath != null && richIconObjPath.length() > 0 ) { sb.append(", RichIconObjPath: '").append(richIconObjPath).append("'"); } if ( richAudioUrl != null && richAudioUrl.size() > 0 ) { sb.append(", RichAudioUrl: '").append(richAudioUrl).append("'"); } if ( richAudioObjPath != null && richAudioObjPath.length() > 0 ) { sb.append(", RichAudioObjPath: '").append(richAudioObjPath).append("'"); } if ( responseObjectPath != null && responseObjectPath.length() > 0 ) { sb.append(", ResponseObjPath: '").append(responseObjectPath).append("'"); } return sb.toString(); }//toString //=======================================// /** * Set message signature version * @param version */ void setVersion(int version) { this.version = version; } /** * Set message Id * @param messageId */ void setMessageId(int messageId) { this.messageId = messageId; } /** * Set app name * @param appName */ void setAppName(String appName) { this.appName = appName; } /** * Set app Id * @param appId */ void setAppId(UUID appId) { this.appId = appId; } /** * Set device name * @param appName */ void setDeviceName(String deviceName) { this.deviceName = deviceName; } /** * Set device Id * @param deviceId */ void setDeviceId(String deviceId) { this.deviceId = deviceId; } /** * Set sender Id * @param sender */ void setSender(String sender) { this.sender = sender; } /** * Set the original sender name * @param origSender */ void setOrigSender(String origSender) { this.origSender = origSender; } }//NotificationImpl base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/NotificationMessageType.java000066400000000000000000000035061272147170000331270ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; /** * Notification message types */ public enum NotificationMessageType { EMERGENCY ((short)0), WARNING((short)1), INFO((short)2); /** * Type Id */ private short typeId; /** * Constructor * @param typeId */ private NotificationMessageType(short typeId) { this.typeId = typeId; } /** * @return Returns type id */ public short getTypeId() { return typeId; } /** * Search for message type with the given Id. * If not found returns NULL * @param msgTypeId type id * @return Notification message type */ public static NotificationMessageType getMsgTypeById(short msgTypeId) { NotificationMessageType retType = null; for (NotificationMessageType type : NotificationMessageType.values()) { if ( msgTypeId == type.getTypeId() ) { retType = type; break; } } return retType; }//getMsgTypeById } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/NotificationReceiver.java000066400000000000000000000032601272147170000324420ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; import java.util.UUID; /** * An interface to be implemented in order to receive notification messages */ public interface NotificationReceiver { /** * Receive a {@link Notification} * @param notification */ public void receive(Notification notification); /** * The appId with the msgId uniquely identifies the {@link Notification} that should be dismissed, since * the msgId alone identifies the {@link Notification} only in the scope of the Notification sender service * @param msgId The message id of the {@link Notification} that should be dismissed * @param appId The appId of the Notification sender service */ public void dismiss(int msgId, UUID appId); }//NotificationReceiver base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/NotificationSender.java000066400000000000000000000132321272147170000321160ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; import java.util.List; import java.util.Map; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.commons.NativePlatformFactory; import org.alljoyn.ns.commons.NativePlatformFactoryException; import org.alljoyn.ns.transport.Transport; /** * The class is used to trigger sending a notification */ public class NotificationSender { private static final String TAG = "ioe" + NotificationSender.class.getSimpleName(); /** * The TTL low limit in seconds */ public static final int MESSAGE_TTL_LL = 30; /** * The TTL upper limit in seconds */ public static final int MESSAGE_TTL_UL = 43200; /** * Reference to native platform object */ private NativePlatform nativePlatform; /** * Constructor * @throws NotificationServiceException */ public NotificationSender() throws NotificationServiceException { try { nativePlatform = NativePlatformFactory.getPlatformObject(); GenericLogger logger = nativePlatform.getNativeLogger(); logger.info(TAG, "Notification Sender created"); } catch (NativePlatformFactoryException npfe) { throw new NotificationServiceException("Failed to create Notification Service: " + npfe.getMessage()); } } /** * Send the Notification message * @param notification The notification object to be sent */ public void send(Notification notification, int ttl) throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); if ( ttl < MESSAGE_TTL_LL || ttl > MESSAGE_TTL_UL ) { logger.error(TAG, "The allowed TTL range is between '" + MESSAGE_TTL_LL + "' and '" + MESSAGE_TTL_UL + "'"); throw new NotificationServiceException("The allowed TTL range is between '" + MESSAGE_TTL_LL + "' and '" + MESSAGE_TTL_UL + "'"); } Transport transport = Transport.getInstance(); //get a map of the PropertyStore properties Map props = transport.readAllProperties(); UUID appId = transport.getAppId(props); String deviceId = (String)props.get(AboutKeys.ABOUT_DEVICE_ID); if ( deviceId == null || deviceId.length() == 0 ) { logger.error(TAG, "The DeviceId is NULL or empty"); throw new NotificationServiceException("The DeviceId is not set in the PropertyStore"); } String deviceName = (String)props.get(AboutKeys.ABOUT_DEVICE_NAME); if ( deviceName == null || deviceName.length() == 0 ) { logger.error(TAG, "The DeviceName is NULL or empty"); throw new NotificationServiceException("The DeviceName is not set in the PropertyStore"); } String appName = (String)props.get(AboutKeys.ABOUT_APP_NAME); if ( appName == null || appName.length() == 0 ) { logger.error(TAG, "The AppName is NULL or empty"); throw new NotificationServiceException("The AppName is not set in the PropertyStore"); } NotificationMessageType messageType = notification.getMessageType(); List text = notification.getText(); List richAudioUrl = notification.getRichAudioUrl(); Map customAttributes = notification.getCustomAttributes(); String richIconUrl = notification.getRichIconUrl(); String richIconObjPath = notification.getRichIconObjPath(); String richAudioObjPath = notification.getRichAudioObjPath(); String responseObjectPath = notification.getResponseObjectPath(); String audioUrl = null; if (richAudioUrl != null && richAudioUrl.size() > 0) { audioUrl = richAudioUrl.get(0).getUrl(); } logger.debug(TAG, "Sending message with message type: " + messageType + ", TTL: " + ttl + ", message: " + text.get(0).getText() + ", richIconUrl: '" + richIconUrl + "' RichAudioUrl: '" + audioUrl + ", richIconObjPath: '" + richIconObjPath + "' RichAudioObjPath: '" + richAudioObjPath + "'"); PayloadAdapter.sendPayload(deviceId, deviceName, appId, appName, messageType, text, customAttributes, ttl, richIconUrl, richAudioUrl, richIconObjPath, richAudioObjPath, responseObjectPath); }//send /** * Delete the last message by a given message type * @param messageType * @throws NotificationServiceException if message type was not defined */ public void deleteLastMsg(NotificationMessageType messageType) throws NotificationServiceException { if(messageType == null ) { throw new NotificationServiceException("MessageType parameter must be set"); } Transport.getInstance().deleteLastMessage(messageType); }//deleteLastMsg }//NotificationSenderImpl base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/NotificationService.java000066400000000000000000000136221272147170000323010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; import org.alljoyn.bus.BusAttachment; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.commons.NativePlatformFactory; import org.alljoyn.ns.commons.NativePlatformFactoryException; import org.alljoyn.ns.transport.Transport; import org.alljoyn.services.common.PropertyStore; /** * The entry point of the Notification service
* The class is a singleton */ public class NotificationService { private static final String TAG = "ioe" + NotificationService.class.getSimpleName(); /** * Initialize the class object */ private static final NotificationService SELF = new NotificationService(); /** * The protocol version that is sent in the {@link Notification} message */ public static final int PROTOCOL_VERSION = 2; /** * Reference to transport object */ private Transport transport; /** * Reference to native platform object */ private NativePlatform nativePlatform; /** * Constructor */ private NotificationService() {}//constructor /** * @return Returns the {@link NotificationService} object */ public static NotificationService getInstance() { return SELF; }//getInstance /** * Establishes the notification sender service to later allow sending notifications * See {@link NotificationSender} * @param bus The {@link BusAttachment} to be used by the service * @param propertyStore Service configuration {@link PropertyStore} * @return {@link NotificationSender} * @throws NotificationServiceException Is thrown if an error occurred during the sender initialization */ public NotificationSender initSend(BusAttachment bus, PropertyStore propertyStore) throws NotificationServiceException { init(); GenericLogger logger = nativePlatform.getNativeLogger(); if ( propertyStore == null ) { throw new NotificationServiceException("PropertyStore is NULL"); } logger.debug(TAG, "Init Send invoked, calling Transport"); transport.startSenderTransport(bus, propertyStore); logger.debug(TAG, "Creating and returning NotificationSender"); return new NotificationSender(); }//initSend /** * Establishes the notification receiver service to later receive notifications. * See {@link NotificationReceiver} * @param bus The {@link BusAttachment} to be used by the service * @param receiver * @throws NotificationServiceException if a malfunction occurred on building NotificationService */ public void initReceive(BusAttachment bus, NotificationReceiver receiver) throws NotificationServiceException { init(); GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Init Receive called, calling Transport"); if ( receiver == null ) { throw new NotificationServiceException("NotificationReceiver interface should be implemented in order to receive notifications, received null pointer"); } transport.startReceiverTransport(bus, receiver); }//initReceive /** * Set a logger Object to enable logging capabilities * @param logger GenericLogger object * @throws NotificationServiceException Is thrown if failed to set a logger */ public void setLogger(GenericLogger logger) throws NotificationServiceException { init(); if ( logger == null ) { throw new NullPointerException("Provided logger is NULL"); } nativePlatform.setNativeLogger(logger); }//setLogger /** * Shutdown notification service * @throws NotificationServiceException */ public void shutdown() throws NotificationServiceException { init(); transport.shutdown(); }//shutdown /** * Stops notification sender service * @throws NotificationServiceException Throws if the service wasn't started previously */ public void shutdownSender() throws NotificationServiceException { init(); transport.shutdownSender(); }//stopSender /** * Stops notification receiver service * @throws NotificationServiceException Throws if the service wasn't started previously */ public void shutdownReceiver() throws NotificationServiceException { init(); transport.shutdownReceiver(); }//stopReceiver //=========================================================// /** * Initializes the {@link NotificationService} object * @throws NotificationServiceException Is thrown if failed to initialized the object */ private void init() throws NotificationServiceException { if ( nativePlatform != null && transport != null ) { return; } try { nativePlatform = NativePlatformFactory.getPlatformObject(); GenericLogger logger = nativePlatform.getNativeLogger(); logger.info(TAG, "Notification Service created"); transport = Transport.getInstance(); } catch (NativePlatformFactoryException npfe) { throw new NotificationServiceException("Failed to create Notification Service: " + npfe.getMessage()); } catch (Exception e) { throw new NotificationServiceException("Failed to create Notification Service: General Error"); } }//init }//NotificationServiceImpl NotificationServiceException.java000066400000000000000000000030161272147170000340750ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; /** * The exception is thrown if a {@link NotificationService} failure has occurred */ public class NotificationServiceException extends Exception { private static final long serialVersionUID = -4596126694105018269L; public NotificationServiceException() { super(); } public NotificationServiceException(String message, Throwable throwable) { super(message, throwable); } public NotificationServiceException(String message) { super(message); } public NotificationServiceException(Throwable throwable) { super(throwable); } } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/NotificationText.java000066400000000000000000000056121272147170000316250ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; /** * NotificationText. Creates object of the NotificationText class */ public class NotificationText { /** * Reference to language string
* The language must comply with the IETF standard */ private String language; /** * Notification text */ private String text; /** * Constructor */ public NotificationText() {} /** * Constructor * @param language The language must comply with the IETF standard * @param text the notification text * @throws NotificationServiceException Thrown if language is null text is null or empty */ public NotificationText(String language, String text) throws NotificationServiceException { setLanguage(language); setText(text); } /** * @return String Returns notification language. The language must comply with the IETF standard */ public String getLanguage() { return language; } /** * Set the language * @param language The language must comply with the IETF standard * @throws NotificationServiceException Thrown if language is null */ public void setLanguage(String language) throws NotificationServiceException { if ( language == null || language.length() == 0 ) { throw new NotificationServiceException("Language is undefined"); } this.language = language; }//setLanguage /** * @return the notification text */ public String getText(){ return text; } /** * Set the notification text * @param text the notification text * @throws NotificationServiceException Thrown if text is null or is empty */ public void setText(String text) throws NotificationServiceException { if ( text == null || text.length() == 0 ) { throw new NotificationServiceException("Text is undefined"); } this.text = text; }//setText /** * @see java.lang.Object#toString() */ @Override public String toString() { return "NotificationText [language='" + language + "', text='" + text + "']"; } }//NotificationText base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/PayloadAdapter.java000066400000000000000000000325661272147170000312340ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.UUID; import org.alljoyn.bus.Variant; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatformFactory; import org.alljoyn.ns.commons.NativePlatformFactoryException; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.TransportRichAudioUrl; import org.alljoyn.ns.transport.interfaces.NotificationTransport; /** * Mediate between variables structure sent over AJ network to Notification object structure and vice versa */ public class PayloadAdapter { private enum ArgumentKey { RICH_NOTIFICATION_ICON_URL(0), RICH_NOTIFICATION_AUDIO_URL(1), RICH_NOTIFICATION_ICON_OBJECT_PATH(2), RICH_NOTIFICATION_AUDIO_OBJECT_PATH(3), RESPONSE_OBJECT_PATH(4), ORIGINAL_SENDER_NAME(5) ; /** * The argument key id */ public final int ID; /** * Constructor * @param id The key id */ private ArgumentKey(int id) { ID = id; } /** * Returns Argument key by id or null if not found * @param id Id to look for * @return */ public static ArgumentKey getArgumentKeyById(int id) { ArgumentKey[] args = ArgumentKey.values(); ArgumentKey retVal = null; for (ArgumentKey arg : args) { if ( arg.ID == id ) { retVal = arg; break; } } return retVal; }//getArgumentKeyById }//ArgumentKeys //========================================== private static final String TAG = "ioe" + PayloadAdapter.class.getSimpleName(); /** * Random number to start msg Id */ private static int msgId = (int)(Math.random()*10000); /** * Convert the sent data into the format of {@link NotificationTransport#notify(int, int, short, String, String, byte[], String, Map, Map, TransportNotificationText[])} * @param deviceId device Id * @param deviceName device name * @param appId app Id * @param appName app name * @param messageType Notification message type * @param text list of NotificationText objects * @param customAttributes map of customized array variables * @param ttl Notification message TTL * @param richIconUrl may be null * @param richAudioUrl list by language may be null * @param richIconObjPath may be null * @param richAudioObjPath list by language may be null * @param responseObjectPath CPS object path * @throws NotificationServiceException */ public static void sendPayload(String deviceId, String deviceName, UUID appId, String appName, NotificationMessageType messageType, List text, Map customAttributes, int ttl, String richIconUrl, List richAudioUrl, String richIconObjPath, String richAudioObjPath, String responseObjectPath) throws NotificationServiceException { GenericLogger logger; try { logger = NativePlatformFactory.getPlatformObject().getNativeLogger(); } catch (NativePlatformFactoryException npfe) { throw new NotificationServiceException(npfe.getMessage()); } logger.debug(TAG, "Preparing message for sending..."); //Prepare attributes Map Map attributes = new HashMap(); if ( richIconUrl != null ) { logger.debug(TAG, "Preparing to send richIconUrl..."); attributes.put(ArgumentKey.RICH_NOTIFICATION_ICON_URL.ID, new Variant(richIconUrl, "s")); }//if :: richIconUrl if ( richAudioUrl != null ) { logger.debug(TAG, "Preparing to send richAudioUrl..."); //Prepare TransportRichAudioUrl array int u = 0; TransportRichAudioUrl[] audioUrl = new TransportRichAudioUrl[richAudioUrl.size()]; for ( RichAudioUrl au : richAudioUrl ) { audioUrl[u] = TransportRichAudioUrl.buildInstance(au); ++u; } attributes.put(ArgumentKey.RICH_NOTIFICATION_AUDIO_URL.ID, new Variant(audioUrl, "ar")); }//if :: richAudioUrl if ( richIconObjPath != null ) { logger.debug(TAG, "Preparing to send richIconObjPath..."); attributes.put(ArgumentKey.RICH_NOTIFICATION_ICON_OBJECT_PATH.ID, new Variant(richIconObjPath, "s")); }//if :: richIconUrl if ( richAudioObjPath != null ) { logger.debug(TAG, "Preparing to send richAudioObjPath..."); attributes.put(ArgumentKey.RICH_NOTIFICATION_AUDIO_OBJECT_PATH.ID, new Variant(richAudioObjPath, "s")); }//if :: richAudioUrl if ( responseObjectPath != null ) { logger.debug(TAG, "Preparing to sendCPS Ocject Path..."); attributes.put(ArgumentKey.RESPONSE_OBJECT_PATH.ID, new Variant(responseObjectPath, "s")); }//if :: responseObjectPath //Add the notification producer sender name to the sent attributes String sender = Transport.getInstance().getBusAttachment().getUniqueName(); attributes.put(ArgumentKey.ORIGINAL_SENDER_NAME.ID, new Variant(sender, "s")); //Process customAttributes if ( customAttributes != null ) { logger.debug(TAG, "Preparing customAttributes..."); for(String key : customAttributes.keySet()) { if (key == null) { throw new NotificationServiceException("The key of customAttributes can't be null"); } String customVal = customAttributes.get(key); if (customVal == null) { throw new NotificationServiceException("The value of customAttributes for key: '" + key + "' can't be null"); } }//for :: customAttributes }//if :: customAttributes else { // Create an empty customAttributes to prevent sending NULL customAttributes = new HashMap(); } //Prepare TransportNotificationText array int i = 0; TransportNotificationText[] sentText = new TransportNotificationText[text.size()]; for ( NotificationText nt : text ) { sentText[i] = TransportNotificationText.buildInstance(nt); ++i; } Transport.getInstance().sendNotification(NotificationService.PROTOCOL_VERSION, genMsgId(), messageType, deviceId, deviceName, uuidToByteArray(appId), appName, attributes, customAttributes, sentText, ttl ); }//sendPayload /** * Convert the received data into the format of {@link Notification} object * @param version The version of the message signature * @param msgId notifId notification Id * @param sender The unique name of the sender end point, may be used for session establishment * @param messageType Message type id * @param deviceId Device Id * @param deviceName Device Name * @param bAppId app id * @param appName app Name * @param attributes Notification metadata * @param customAttributes customAttributes * @param text List of NotificationText objects * @throws NotificationServiceException if failed to parse the received notification */ public static void receivePayload(int version, int msgId, String sender, short messageType, String deviceId, String deviceName, byte[] bAppId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text) throws NotificationServiceException { try { GenericLogger logger = NativePlatformFactory.getPlatformObject().getNativeLogger(); logger.debug(TAG, "Received notification Id: '" + msgId + "', parsing..."); // Decode message type NotificationMessageType msgType = NotificationMessageType.getMsgTypeById(messageType); if ( msgType == null ) { throw new NotificationServiceException("Received unknown message type id: '" + messageType + "'"); } //Build List of NotificationText List textList = new LinkedList(); for (TransportNotificationText trNt : text) { textList.add(new NotificationText(trNt.language, trNt.text)); } // Create the Notification object Notification notif = new Notification(msgType, textList); //convert appId received as a byte[] to a string UUID appId = byteArrayToUUID(bAppId); if ( appId == null ) { String msg = "Received a bad length of byte array that doesn't represent UUID of an appId"; logger.error(TAG, msg); throw new NotificationServiceException(msg); } notif.setVersion(version); notif.setMessageId(msgId); notif.setDeviceId(deviceId); notif.setDeviceName(deviceName); notif.setSender(sender); notif.setAppId(appId); notif.setAppName(appName); //parse attributes for ( Integer key : attributes.keySet() ) { Variant vObj = attributes.get(key); ArgumentKey attrKey = ArgumentKey.getArgumentKeyById(key); if ( attrKey == null ) { logger.warn(TAG, "An unknown attribute key: '" + key + "' received, ignoring the key"); continue; } switch(attrKey) { case RICH_NOTIFICATION_ICON_URL: { String iconUrl = vObj.getObject(String.class); logger.debug(TAG, "Received rich icon url: '" + iconUrl + "'"); notif.setRichIconUrl(iconUrl); break; }//RICH_NOTIFICATION_ICON_URL case RICH_NOTIFICATION_AUDIO_URL: { TransportRichAudioUrl[] audioUrl = vObj.getObject(TransportRichAudioUrl[].class); if (audioUrl.length != 0) { List audioUrlList = new ArrayList(audioUrl.length); logger.debug(TAG, "Received rich audio url"); for (TransportRichAudioUrl trRichAudioUrl : audioUrl) { audioUrlList.add(new RichAudioUrl(trRichAudioUrl.language, trRichAudioUrl.url)); } notif.setRichAudioUrl(audioUrlList); } break; }//RICH_NOTIFICATION_AUDIO_URL case RICH_NOTIFICATION_ICON_OBJECT_PATH: { String iconObjPath = vObj.getObject(String.class); logger.debug(TAG, "Received rich icon object path: '" + iconObjPath + "'"); notif.setRichIconObjPath(iconObjPath); break; } case RICH_NOTIFICATION_AUDIO_OBJECT_PATH: { String audioObjPath = vObj.getObject(String.class); logger.debug(TAG, "Received rich audio object path"); notif.setRichAudioObjPath(audioObjPath); break; } case RESPONSE_OBJECT_PATH: { String responseObjectPath = vObj.getObject(String.class); logger.debug(TAG, "Received a Response ObjectPath object path: '" + responseObjectPath + "'"); notif.setResponseObjectPath(responseObjectPath); break; } case ORIGINAL_SENDER_NAME: { String origSender = vObj.getObject(String.class); logger.debug(TAG, "Received an original sender: '" + origSender + "'"); notif.setOrigSender(origSender); break; } }//switch }//for :: attributes logger.debug(TAG, "Set the custom attributes"); // set the custom attributes notif.setCustomAttributes(customAttributes); Transport.getInstance().onReceivedNotification(notif); }//try catch (Exception e) { throw new NotificationServiceException("Failed to parse received notification payload, Error: " + e.getMessage()); } }//receivePayload /** * Generate a notification id string using random string and msgIdAI * @return Notification id in format: random number concatenated to msgAI(Auto incremented) */ public static int genMsgId() { if ( msgId == Integer.MAX_VALUE ) { msgId = 0; } return ++msgId; } /** * Convert the byte array to a UUID * @param bAppId Byte Array to be converted to {@link UUID} * @return UUID {@link UUID} object or NULL if failed to create */ public static UUID byteArrayToUUID(byte[] bAppId) { long msUuid = 0; long lsUuid = 0; if ( bAppId.length != 16) { return null; } for (int i = 0; i < 8; i++) { msUuid = (msUuid << 8) | (bAppId[i] & 0xff); } for (int i = 8; i < 16; i++) { lsUuid = (lsUuid << 8) | (bAppId[i] & 0xff); } UUID result = new UUID(msUuid, lsUuid); return result; }//byteArrayToUUID /** * Convert from UUID object into a byte array * @param uuid * @return byte array */ public static byte[] uuidToByteArray(UUID uuid) { long msUuid = uuid.getMostSignificantBits(); long lsUuid = uuid.getLeastSignificantBits(); byte[] byteArrayUuid = new byte[16]; for (int i = 0; i < 8; i++) { byteArrayUuid[i] = (byte) (msUuid >>> 8 * (7 - i)); } for (int i = 8; i < 16; i++) { byteArrayUuid[i] = (byte) (lsUuid >>> 8 * (7 - i)); } return byteArrayUuid; }//uuidToByteArray }//PayloadAdapter base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/RichAudioUrl.java000066400000000000000000000055711272147170000306700ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns; /** * RichNotificationAudioUrl. Creates object of the RichNotificationAudioUrl class */ public class RichAudioUrl { /** * Reference to language string
* The language must comply IETF standard */ private String language; /** * RichNotification Audio Url */ private String url; /** * Constructor */ public RichAudioUrl() {} /** * Constructor * @param language - The language must comply IETF standard * @param url - rich notification audio url * @throws NotificationServiceException Thrown if language is null url is null or empty */ public RichAudioUrl(String language, String url) throws NotificationServiceException { setLanguage(language); setUrl(url); } /** * @return String Returns audio url language. The language must comply IETF standard */ public String getLanguage() { return language; } /** * Set the language * @param language The language must comply IETF standard * @throws NotificationServiceException Thrown if language is null */ public void setLanguage(String language) throws NotificationServiceException { if (language == null || language.length() == 0 ) { throw new NotificationServiceException("Language is undefined"); } this.language = language; }//setLanguage /** * @return the rich notification audio url */ public String getUrl(){ return url; } /** * Set the notification url * @param url the notification url * @throws NotificationServiceException Thrown if url is null or is empty */ public void setUrl(String url) throws NotificationServiceException { if ( url == null || url.length() == 0 ) { throw new NotificationServiceException("audio url is undefined"); } this.url = url; }//setUrl /** * @see java.lang.Object#toString() */ @Override public String toString() { return "RichAudioUrl [language= '" + language + "', url='" + url + "']"; } }//RichNotificationAudioUrl base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/package-info.java000066400000000000000000000022001272147170000306440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * The package includes API classes of the Notification service which are used to * send and receive notification messages */ package org.alljoyn.ns;base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/000077500000000000000000000000001272147170000275175ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/DismissEmitter.java000066400000000000000000000103061272147170000333270ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport; import java.util.UUID; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.SignalEmitter; import org.alljoyn.bus.SignalEmitter.GlobalBroadcast; import org.alljoyn.bus.Status; import org.alljoyn.ns.NotificationSender; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.PayloadAdapter; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.transport.interfaces.NotificationDismisser; /** * The class provides a functionality of sending Dismiss session-less-signals */ public class DismissEmitter implements NotificationDismisser { private static final String TAG = "ioe" + DismissEmitter.class.getSimpleName(); private static final String OBJ_PATH_PREFIX = "/notificationDismisser/"; /** * Send the Dismiss signal * @param msgId The notification id * @param appId The application id */ public static void send(int msgId, UUID appId) { Transport transport = Transport.getInstance(); BusAttachment bus = transport.getBusAttachment(); GenericLogger logger; try { logger = transport.getLogger(); } catch (NotificationServiceException nse) { System.out.println(TAG + ": Unexpected error occured: " + nse.getMessage()); return; } if ( bus == null ) { logger.error(TAG, "Can't call Dismiss signal, BusAttachment isn't defined, returning..."); return; } logger.debug(TAG, "Sending the Dismiss signal notifId: '" + msgId + "', appId: '" + appId + "'"); DismissEmitter dismissSenderBusObj = new DismissEmitter(); String objPath = buildObjPath(msgId, appId); Status status = bus.registerBusObject(dismissSenderBusObj, objPath); if ( status != Status.OK ) { logger.error(TAG, "Failed to register a BusObject, ObjPath: '" + objPath + "', Error: '" + status + "'"); return; } SignalEmitter emitter = new SignalEmitter(dismissSenderBusObj, GlobalBroadcast.Off); emitter.setSessionlessFlag(true); emitter.setTimeToLive(NotificationSender.MESSAGE_TTL_UL); byte[] bappId = PayloadAdapter.uuidToByteArray(appId); try { logger.debug(TAG, "Sending the Dismiss signal from ObjPath: '" + objPath + "'"); emitter.getInterface(NotificationDismisser.class).dismiss(msgId, bappId); } catch (BusException be) { logger.error(TAG, "Failed to send the Dismiss signal notifId: '" + msgId + "', appId: '" + appId + "', Error: '" + be.getMessage() + "'"); } bus.unregisterBusObject(dismissSenderBusObj); }//send /** * @see org.alljoyn.ns.transport.interfaces.NotificationDismisser#dismiss(int, byte[]) */ @Override public void dismiss(int msgId, byte[] appId) throws BusException { } /** * @see org.alljoyn.ns.transport.interfaces.NotificationDismisser#getVersion() */ @Override public short getVersion() throws BusException { return VERSION; } /** * Creates the object path: OBJ_PATH_PREFIX/[APPID]/msgId * @param msgId * @param appId * @return The object path */ private static String buildObjPath(int msgId, UUID appId) { String appIdStr = appId.toString().replace("-", ""); return OBJ_PATH_PREFIX + appIdStr + "/" + Math.abs(msgId); }//buildObjPath } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/TaskManager.java000066400000000000000000000134111272147170000325570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.alljoyn.ns.NotificationService; import org.alljoyn.ns.commons.NativePlatform; /** * The thread pool manager is used to handle different {@link NotificationService} tasks.
* The tasks can be executed instantly by invoking the {@link TaskManager#execute(Runnable)} method, or * they may be enqueued and executed later, by calling the {@link TaskManager#enqueue(Runnable)} method */ public class TaskManager implements RejectedExecutionHandler { private static final String TAG = "ioe" + TaskManager.class.getSimpleName(); /** * Self reference for singleton */ private static final TaskManager SELF = new TaskManager(); /** * Gets TRUE if the object is valid, which means it has been initialized */ private volatile boolean isValid; /** * The platform dependent object */ private NativePlatform nativePlatform; /** * The thread TTL time */ private static final long THREAD_TTL = 3; /** * The thread TTL time unit */ private static final TimeUnit TTL_TIME_UNIT = TimeUnit.SECONDS; /** * Amount of the core threads */ private static final int THREAD_CORE_NUM = 4; /** * The maximum number of threads that may be spawn */ private static final int THREAD_MAX_NUM = 10; /** * Thread pool object */ private ThreadPoolExecutor threadPool; /** * The queue of tasks to be handled sequentially */ private ExecutorService taskQueue; /** * Constructor */ private TaskManager() {} /** * @return {@link TaskManager} instance */ public static TaskManager getInstance() { return SELF; } /** * Initializes the thread pool * @param nativePlatform The reference to the platform dependent object */ public void initPool(NativePlatform nativePlatform) { nativePlatform.getNativeLogger().debug(TAG, "Initializing TaskManager"); this.nativePlatform = nativePlatform; initThreadPool(); initTaskQueue(); isValid = true; } /** * @param task Executes the given {@link Runnable} task if there is a free thread worker * @throws IllegalStateException if the object has not been initialized */ public void execute(Runnable task) { checkValid(); nativePlatform.getNativeLogger().debug(TAG,"Executing task, Current Thread pool size: '" + threadPool.getPoolSize() + "', 'Number of currently working threads: '" + threadPool.getActiveCount() + "'"); threadPool.execute(task); } /** * Enqueue the given {@link Runnable} task to be executed later * @param task to executed * @throws IllegalStateException if the object has not been initialized */ public void enqueue(Runnable task){ checkValid(); nativePlatform.getNativeLogger().debug(TAG, "Enqueueing task to be executed"); taskQueue.execute(task); } /** * @return TRUE if the {@link TaskManager} has been initialized and it is running */ public boolean isRunning() { return isValid; } /** * Tries to stop the thread pool and all its threads * @throws IllegalStateException if the object has not been initialized */ public void shutdown() { nativePlatform.getNativeLogger().debug(TAG, "Shutting down TaskManager"); isValid = false; if ( threadPool != null && !threadPool.isShutdown() ) { threadPool.shutdown(); threadPool = null; } if ( taskQueue != null && !taskQueue.isShutdown() ) { taskQueue.shutdown(); taskQueue = null; } } /** * The callback is called, when there are no free threads to execute the given task */ @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { throw new RejectedExecutionException("Failed to execute the given task, all the worker threads are busy"); } //=================================================// /** * Checks the object validity * @throws IllegalStateException if the object hasn't been initialized */ private void checkValid() { if ( !isValid ){ throw new IllegalStateException("The WorkPoolManager has not been initialized. " + "The initPool mathod should have been invoked"); } } /** * Initialize the threadpool */ private void initThreadPool() { threadPool = new ThreadPoolExecutor( THREAD_CORE_NUM, THREAD_MAX_NUM, THREAD_TTL, TTL_TIME_UNIT, new SynchronousQueue(true) // The fair order FIFO ); threadPool.setRejectedExecutionHandler(this); } /** * Initialize the task queue */ private void initTaskQueue() { taskQueue = Executors.newSingleThreadExecutor(); } } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/Transport.java000066400000000000000000000405561272147170000323700ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.ns.Notification; import org.alljoyn.ns.NotificationMessageType; import org.alljoyn.ns.NotificationReceiver; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.commons.NativePlatformFactory; import org.alljoyn.ns.commons.NativePlatformFactoryException; import org.alljoyn.ns.transport.consumer.ReceiverTransport; import org.alljoyn.ns.transport.producer.SenderTransport; import org.alljoyn.services.common.PropertyStore; import org.alljoyn.services.common.PropertyStore.Filter; import org.alljoyn.services.common.PropertyStoreException; /** * The main transport controller class * Manages {@link SenderTransport} and {@link ReceiverTransport} objects */ public class Transport { private static final String TAG = "ioe" + Transport.class.getSimpleName(); /** * Reference to Transport object */ private static final Transport transport = new Transport(); /** * {@link SenderTransport} logic */ private SenderTransport senderTransport; /** * {@link ReceiverTransport} logic */ private ReceiverTransport receiverTransport; /** * Reference to native platform object */ private NativePlatform nativePlatform; /** * Service configuration properties */ private PropertyStore propertyStore; /** * Reference to BusAttachment object */ private BusAttachment busAttachment; /** * Received TRUE if sender transport was already called */ private boolean isSenderTransportCalled = false; /** * Receives TRUE if receiver transport was called */ private boolean isReceiverTransportCalled = false; /** * @return Return the {@link Transport} object */ public static Transport getInstance() { return transport; }//getInstance /** * Constructor * private constructor - to avoid creation of Transport object by other classes */ private Transport() {}//Constructor /** * @return Reference to the {@link BusAttachment} */ public BusAttachment getBusAttachment() { return busAttachment; } /** * @return All properties read from the {@link PropertyStore} * @throws If failed to read the properties from the {@link PropertyStore} */ public Map readAllProperties() throws NotificationServiceException { Map props = new HashMap(); try { propertyStore.readAll("", Filter.READ, props); } catch (PropertyStoreException pse) { throw new NotificationServiceException("Failed to read properties from the PropertyStore, Error: '" + pse.getMessage() + "'", pse); } return props; }//readAllProperties /** * Retrieve AppId from the given properties * @param props {@link PropertyStore} properties Map object * @return AppId * @throws NotificationServiceException if failed to retrieve the AppId parameter */ public UUID getAppId(Map props) throws NotificationServiceException { if ( props == null ) { throw new NotificationServiceException("props can't be NULL"); } Object appIdObj = props.get(AboutKeys.ABOUT_APP_ID); if ( !(appIdObj instanceof UUID) ) { throw new NotificationServiceException("The AppId is NULL or not an instance of UUID"); } return (UUID) appIdObj; }//getAppId /** * Starts the service in the Sender mode * @param propertyStore The reference to the application {@link PropertyStore} object * @param bus The {@link BusAttachment} to be used by this {@link Transport} object * @throws NotificationServiceException Is thrown if failed to start the SenderTransport */ public synchronized void startSenderTransport(BusAttachment bus, PropertyStore propertyStore) throws NotificationServiceException { GenericLogger logger; logger = getLogger(); if ( isSenderTransportCalled ) { logger.debug(TAG, "Sender transport was previously started, returning"); return; } //Store the received busAttachment or verify if already exists saveBus(bus); TaskManager taskManager = TaskManager.getInstance(); if ( !taskManager.isRunning() ) { taskManager.initPool(nativePlatform); } this.propertyStore = propertyStore; senderTransport = new SenderTransport(nativePlatform); try { senderTransport.startSenderTransport(); //Delegate the starting sender transport logic } catch(NotificationServiceException nse) { stopSenderTransport(logger); throw nse; } isSenderTransportCalled = true; }//startSenderTransport /** * Starts the Receiver Transport * @param bus The {@link BusAttachment} to be used by this {@link Transport} object * @param receiver {@link NotificationReceiver} * @throws NotificationServiceException Is thrown if failed to start the ReceiverTransport */ public synchronized void startReceiverTransport(BusAttachment bus, NotificationReceiver receiver) throws NotificationServiceException { GenericLogger logger; logger = getLogger(); if ( isReceiverTransportCalled ) { logger.debug(TAG, "Receiver transport was previously started, returning"); return; } saveBus(bus); TaskManager taskManager = TaskManager.getInstance(); if ( !taskManager.isRunning() ) { taskManager.initPool(nativePlatform); } receiverTransport = new ReceiverTransport(nativePlatform, receiver); try { receiverTransport.startReceiverTransport(); } catch(NotificationServiceException nse) { stopReceiverTransport(logger); throw nse; } isReceiverTransportCalled = true; }//startReceiverTransport /** * Called when we need to send a signal * @param version The version of the message signature * @param msgId notification Id the id of the sent signal * @param messageType The message type of the sent message * @param deviceId Device id * @param deviceName Device name * @param appId App id * @param appName App name * @param attributes All the notification metadata * @param customAttributes The customAttributes * @param text Array of texts to be sent * @param ttl Notification message TTL * @throws NotificationServiceException */ public void sendNotification(int version, int msgId, NotificationMessageType messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes,TransportNotificationText[] text, int ttl) throws NotificationServiceException { GenericLogger logger; try { logger = getLogger(); } catch (NotificationServiceException nse) { throw nse; } if (!isSenderTransportCalled){ logger.error(TAG,"Notification service is not running, can't send message"); throw new NotificationServiceException("Notification service is not running, can't send message"); } senderTransport.sendNotification(version, msgId, messageType, deviceId, deviceName, appId, appName, attributes, customAttributes, text, ttl); }//sendNotification /** * Cancel the last message sent for the given messageType * @param messageType * @throws NotificationServiceException */ public void deleteLastMessage(NotificationMessageType messageType) throws NotificationServiceException { GenericLogger logger; try { logger = getLogger(); } catch (NotificationServiceException nse) { throw nse; } if ( !isSenderTransportCalled ) { logger.error(TAG,"Notification service is not running, can't delete message"); throw new NotificationServiceException("Notification service is not running, can't delete message"); } senderTransport.deleteLastMessage(messageType); }//deleteLastMessage /** * Received notification, call the notification receiver callback to pass the notification * @param notification */ public void onReceivedNotification(final Notification notification) { GenericLogger logger; try { logger = getLogger(); } catch (NotificationServiceException nse) { System.out.println("Could not get logger in receive notification error: " + nse.getMessage()); return; } synchronized (this) { if ( !isReceiverTransportCalled ) { logger.error(TAG, "Received a Notification message, but the Notification Receiver transport is stopped"); return; } receiverTransport.onReceivedNotification(notification); }//synchronized }//onReceivedNotification /** * Handle the received Dismiss signal * @param msgId The message id of the {@link Notification} that should be dismissed * @param appId The appId of the Notification sender service */ public void onReceivedNotificationDismiss(int msgId, UUID appId) { receiverTransport.onReceivedNotificationDismiss(msgId, appId); }//onDismissReceived /** * Stop Notification Service * @throws NotificationServiceException */ public synchronized void shutdown() throws NotificationServiceException { GenericLogger logger = getLogger(); if ( busAttachment == null ) { logger.warn(TAG,"No BusAttachment defined, sender and receiver must be down, returning"); return; } logger.debug(TAG, "Shutdown called, stopping sender and receiver transports"); stopSenderTransport(logger); stopReceiverTransport(logger); }//shutdown /** * Verifies that sender transport was started, then calls stopSenderTransport() * @throws NotificationServiceException */ public synchronized void shutdownSender() throws NotificationServiceException { GenericLogger logger = getLogger(); if ( !isSenderTransportCalled ) { logger.error(TAG, "Sender service wasn't started"); throw new NotificationServiceException("Sender service wasn't started"); } logger.debug(TAG, "Stopping sender transport"); stopSenderTransport(logger); }//stopSender /** * Verifies that receiver transport was started, then calls stopReceiverTransport() * @throws NotificationServiceException */ public synchronized void shutdownReceiver() throws NotificationServiceException { GenericLogger logger = getLogger(); if ( !isReceiverTransportCalled ) { logger.error(TAG, "Receiver service wasn't started"); throw new NotificationServiceException("Receiver service wasn't started"); } logger.debug(TAG, "Stopping receiver transport"); stopReceiverTransport(logger); }//stopReceiver /** * Uses setNativePlatform to receive the GenericLogger * @return GenericLogger Returns GenericLogger * @throws NotificationServiceException thrown if no native platform object is defined */ public GenericLogger getLogger() throws NotificationServiceException { setNativePlatform(); return nativePlatform.getNativeLogger(); }//getLogger //********************* PRIVATE METHODS *********************// /** * Stores the {@link BusAttachment} if it's not already exists and is connected to the Bus
* If the {@link BusAttachment} already exists, checks whether the received {@link BusAttachment} is the same * as the existent one. If not the {@link NotificationServiceException} is thrown * @param bus * @throws NotificationServiceException */ private void saveBus(BusAttachment bus) throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); if ( bus == null ) { logger.error(TAG, "Received a NULL BusAttachment"); throw new NotificationServiceException("Received a not initialized BusAttachment"); } if ( this.busAttachment == null ) { if ( !bus.isConnected() ) { logger.error(TAG, "Received a BusAttachment that is not connected to the AJ Bus"); throw new NotificationServiceException("Received a BusAttachment that is not connected to the AJ bus"); } logger.info(TAG, "BusAttachment is stored successfully"); this.busAttachment = bus; } else if ( !this.busAttachment.getUniqueName().equals(bus.getUniqueName()) ) { logger.error(TAG, "NotificationService received a new BusAttachment: '" + bus.getUniqueName() + "', while previously initialized with a BusAttachment: '" + busAttachment.getUniqueName() + "'"); throw new NotificationServiceException("BusAttachment already exists"); } }//saveBus /** * Uses NativePlatformFactory to receive NativePlatform object * @throws NotificationServiceException thrown if failed to receive native platform factory */ private void setNativePlatform() throws NotificationServiceException { if ( nativePlatform == null ) { try { nativePlatform = NativePlatformFactory.getPlatformObject(); } catch (NativePlatformFactoryException npfe) { throw new NotificationServiceException(npfe.getMessage()); } } }//setNativePlatform /** * Register bus object that is intended to be a signal handler * @param logger * @param ifName Interface name that signal handler object belongs to * @param signalName * @param handlerMethod The reflection of the method that is handling the signal * @param toBeRegistered The object to be registered on the bus and set to be signal handler * @param servicePath The identifier of the object * @return TRUE on success and FALSE on fail */ public boolean registerObjectAndSetSignalHandler(GenericLogger logger, String ifName, String signalName, Method handlerMethod, BusObject toBeRegistered, String servicePath) { logger.debug(TAG, "Registering BusObject and setting signal handler, IFName: '" + ifName + ", method: '" + handlerMethod.getName() + "'"); Status status = busAttachment.registerBusObject(toBeRegistered, servicePath); if ( status != Status.OK ) { logger.error(TAG, "Failed to register bus object, status: " + status); return false; } status = busAttachment.registerSignalHandler(ifName, signalName, toBeRegistered, handlerMethod); if ( status != Status.OK ) { logger.error(TAG, "Failed to register signal handler, status: " + status); return false; } return true; }//registerObjectAndSetSignalHandler /** * Sender Transport cleanup * @param logger */ private void stopSenderTransport(GenericLogger logger) { if ( senderTransport != null ) { senderTransport.stopSenderTransport(); senderTransport = null; } // clear the resources that are generic between sender and receiver if ( !isReceiverTransportCalled ) { logger.debug(TAG, "Receiver is not running, clearing common resources"); TaskManager taskManager = TaskManager.getInstance(); if ( taskManager.isRunning() ) { taskManager.shutdown(); } busAttachment = null; } propertyStore = null; isSenderTransportCalled = false; }//cleanTransportProducerChannel /** * Receiver Transport cleanup * @param logger */ private void stopReceiverTransport(GenericLogger logger) { if ( receiverTransport != null ) { receiverTransport.stopReceiverTransport(); receiverTransport = null; } // clear the resources that are generic between sender and receiver if ( !isSenderTransportCalled ) { logger.debug(TAG, "Sender is not running, clearing common resources"); TaskManager taskManager = TaskManager.getInstance(); if ( taskManager.isRunning() ) { taskManager.shutdown(); } busAttachment = null; } isReceiverTransportCalled = false; }//stopReceiverTransport }//Transport TransportNotificationText.java000066400000000000000000000041021272147170000355100ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport; import org.alljoyn.bus.annotation.Position; import org.alljoyn.ns.NotificationText; /* * The utility class used to wrap NotificationText object into format of TransportNotificationText that * is sent over AJ network */ public class TransportNotificationText { /** * Text language */ @Position(0) public String language; /** * Message text */ @Position(1) public String text; /** * Constructor */ public TransportNotificationText() {} /** * Constructor * @param language * @param text */ public TransportNotificationText(String language, String text) { this.language = language; this.text = text; } /** * Creates object of TransportNotificationText from NotificationText object * @param notifText reference to NotificationText object * @return TransportNotificationText */ public static TransportNotificationText buildInstance(NotificationText notifText) { TransportNotificationText trNotTxt = new TransportNotificationText(notifText.getLanguage(), notifText.getText() ); return trNotTxt; }//buildInstance } TransportRichAudioUrl.java000066400000000000000000000037431272147170000345610ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport; import org.alljoyn.bus.annotation.Position; import org.alljoyn.ns.RichAudioUrl; /* * The utility class used to wrap RichAudioUrl object into format of TransportRichAudioUrl that * is sent over AJ network */ public class TransportRichAudioUrl { /** * Url language */ @Position(0) public String language; /** * Message url */ @Position(1) public String url; /** * Constructor */ public TransportRichAudioUrl() {} /** * Constructor * @param language * @param url */ public TransportRichAudioUrl(String language, String url) { this.language = language; this.url = url; } /** * Creates object of TransportRichAudioUrl from RichAudioUrl object * @param richAudioUrl reference to TransportRichAudioUrl object * @return TransportRichAudioUrl */ public static TransportRichAudioUrl buildInstance(RichAudioUrl richAudioUrl) { return new TransportRichAudioUrl(richAudioUrl.getLanguage(), richAudioUrl.getUrl() ); }//buildInstance } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/000077500000000000000000000000001272147170000313525ustar00rootroot00000000000000DismissConsumer.java000066400000000000000000000053561272147170000352760ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.consumer; import java.util.UUID; import org.alljoyn.bus.BusException; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.PayloadAdapter; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.interfaces.NotificationDismisser; /** * The class provides a functionality of receiving AllJoyn Dismiss session-less-signals */ class DismissConsumer implements NotificationDismisser { private static final String TAG = "ioe" + DismissConsumer.class.getSimpleName(); public static final String OBJ_PATH = "/dismissReceiver"; /** * @see org.alljoyn.ns.transport.interfaces.NotificationDismisser#dismiss(int, byte[]) */ @Override public void dismiss(int msgId, byte[] bAppId) throws BusException { Transport transport = Transport.getInstance(); transport.getBusAttachment().enableConcurrentCallbacks(); GenericLogger logger; try { logger = transport.getLogger(); } catch(NotificationServiceException nse) { System.out.println(TAG + ": Unexpected error occured: " + nse.getMessage()); return; } UUID appId = PayloadAdapter.byteArrayToUUID(bAppId); if ( appId == null ) { logger.error(TAG, "Received the Dismiss signal for the notifId: '" + msgId + "' with an invalid ApplicationId"); return; } logger.debug(TAG, "Received a dismiss signal for notifId: '" + msgId + "', from appId: '" + appId + "', handling..."); transport.onReceivedNotificationDismiss(msgId, appId); }//dismiss /** * @see org.alljoyn.ns.transport.interfaces.NotificationDismisser#getVersion() */ @Override public short getVersion() throws BusException { return VERSION; }//getVersion } NotificationFeedback.java000066400000000000000000000223241272147170000361740ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.consumer; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.ErrorReplyBusException; import org.alljoyn.bus.Mutable; import org.alljoyn.bus.OnJoinSessionListener; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.SessionListener; import org.alljoyn.bus.Status; import org.alljoyn.ns.Notification; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.transport.DismissEmitter; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.interfaces.NotificationProducer; import org.alljoyn.ns.transport.producer.SenderSessionListener; /** * The class implements the functionality of sending feedback about the received * {@link Notification}.
* Feedback types:
* 1) dismiss - Notification Producer deletes the {@link Notification} message * and then sends a Dismiss session-less-signal to update Notification Consumers * that this {@link Notification} message has been dismissed.
* * If there is a failure in reaching the Notification Producer to dismiss the * {@link Notification}, the dismiss session-less-signal is sent by the * {@link NotificationFeedback}. */ public class NotificationFeedback extends OnJoinSessionListener { private static final String TAG = "ioe" + NotificationFeedback.class.getSimpleName(); private class NFSessionListener extends SessionListener { /** * @see org.alljoyn.bus.SessionListener#sessionLost(int, int) */ @Override public void sessionLost(int sessionId, int reason) { if (logger != null) { logger.debug(TAG, "Received session lost for sid: '" + sessionId + "', reason: '" + reason + "'"); } }// sessionLest } // ============================================// /** * Handles sequentially the ack | dismiss tasks */ private static ExecutorService taskDispatcher = Executors.newSingleThreadExecutor(); /** * {@link Transport} object */ private final Transport transport; /** * The logger */ private final GenericLogger logger; /** * Session target */ private final String origSender; /** * The notification id */ private final int notifId; /** * The application */ private final UUID appId; /** * Notification version */ private final int version; /** * Constructor * * @param notification * The {@link Notification} to send feedback * @throws NotificationServiceException * If failed to create the {@link NotificationFeedback} */ public NotificationFeedback(Notification notification) throws NotificationServiceException { super(); transport = Transport.getInstance(); logger = transport.getLogger(); version = notification.getVersion(); origSender = notification.getOriginalSenderBusName(); notifId = notification.getMessageId(); appId = notification.getAppId(); } /** * Call the dismiss */ public void dismiss() { taskDispatcher.execute(new Runnable() { @Override public void run() { // Version 1 doesn't support the NotificationProducer interface // and the original sender if (version < 2 || origSender == null) { logger.debug(TAG, "The notification sender version: '" + version + "', doesn't support the NotificationProducer interface, notifId: '" + notifId + "'; appId: '" + appId + "', can't call the Dismiss method, sending the Dismiss signal"); DismissEmitter.send(notifId, appId); return; } invokeDismiss(); }// run }); }// dismiss /** * Calls the remote dismiss method.
* If fails, send the Dismiss signal. The signal should be sent by the * consumer if the producer is not reachable. * * @param status * Session establishment status */ private void invokeDismiss() { BusAttachment bus = transport.getBusAttachment(); if (bus == null) { logger.error(TAG, "Failed to call Dismiss for notifId: '" + notifId + "'; appId: '" + appId + "', BusAttachment is not defined, returning..."); return; } Mutable.IntegerValue sid = new Mutable.IntegerValue(); Status status = establishSession(bus, sid); if (status != Status.OK) { logger.error(TAG, "Failed to call Dismiss method for notifId: '" + notifId + "'; appId: '" + appId + "', session is not established, Error: '" + status + "', Sending a Dismiss signal"); DismissEmitter.send(notifId, appId); return; } logger.debug(TAG, "Handling Dismiss method call for notifId: '" + notifId + "'; appId: '" + appId + "', session: '" + sid.value + "', SessionJoin status: '" + status + "'"); NotificationProducer notifProducer = getProxyObject(bus, sid.value); try { notifProducer.dismiss(notifId); } catch (ErrorReplyBusException erbe) { logger.error(TAG, "Failed to call Dismiss for notifId: '" + notifId + "'; appId: '" + appId + "', ErrorName: '" + erbe.getErrorName() + "', ErrorMessage: '" + erbe.getErrorMessage() + "', sending Dismiss signal"); DismissEmitter.send(notifId, appId); } catch (BusException be) { logger.error(TAG, "Failed to call Dismiss method for notifId: '" + notifId + "'; appId: '" + appId + "', Error: '" + be.getMessage() + "', Sending Dismiss signal"); DismissEmitter.send(notifId, appId); } finally { logger.debug(TAG, "Handled Dismiss for notifId: '" + notifId + "'; appId: '" + appId + "'"); leaveSession(bus, sid.value); } }// invokeDismiss /** * Calls to establish a session with a NotificationProducer * * @param bus * {@link BusAttachment} * @param sessionId * The sessionId that has been created following the request * @return Status The session establish status */ private Status establishSession(BusAttachment bus, Mutable.IntegerValue sessionId) { return bus.joinSession(origSender, SenderSessionListener.PORT_NUM, sessionId, SenderSessionListener.getSessionOpts(), new NFSessionListener()); }// establishSession /** * Leave the session if the sessionId isn't NULL and not zero
* * @param bus * {@link BusAttachment} * @param sid */ private void leaveSession(BusAttachment bus, int sid) { Status status = Status.OK; if (sid == 0) { return; } if (origSender.equals(bus.getUniqueName())) { bus.leaveHostedSession(sid); } else { bus.leaveSession(sid); } if (status == Status.OK) { logger.debug(TAG, "The session: '" + sid + "' was disconnected successfully"); } else { logger.error(TAG, "Failed to disconnect the session: '" + sid + "', Error: '" + status + "'"); } }// leaveSession /** * Create {@link ProxyBusObject} * * @param bus * {@link BusAttachment} * @return Creates and returns the {@link ProxyBusObject}, casted to the * {@link NotificationProducer} object */ private NotificationProducer getProxyObject(BusAttachment bus, int sid) { logger.debug(TAG, "Creating ProxyBusObject with sender: '" + origSender + "', SID: '" + sid + "'"); ProxyBusObject proxyObj = bus.getProxyBusObject(origSender, NotificationProducer.OBJ_PATH, sid, new Class[] { NotificationProducer.class }); return proxyObj.getInterface(NotificationProducer.class); }// getProxyObject } NotificationTransportConsumer.java000066400000000000000000000074001272147170000402160ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.consumer; import java.util.Map; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.Variant; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.PayloadAdapter; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatformFactory; import org.alljoyn.ns.commons.NativePlatformFactoryException; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.interfaces.NotificationTransport; /** * The class is used to receive AllJoyn notify session-less-signals */ class NotificationTransportConsumer implements NotificationTransport { private static final String TAG = "ioe" + NotificationTransportConsumer.class.getSimpleName(); /** * Identify object that receives signals arrived from producer */ public static final String FROM_PRODUCER_RECEIVER_PATH = "/producerReceiver"; /** * The service path identifying the object */ private String servicePath; /** * The object service path * @param objServicePath */ public NotificationTransportConsumer(String objServicePath) { servicePath = objServicePath; } /** * Return the object service path * @return */ public String getServicePath() { return servicePath; } /** * This method will be called by the AJ bus when a notification is received * @see org.alljoyn.ns.transport.interfaces.NotificationTransport#notify(int, int, short, String, String, byte[], String, Map, Map, TransportNotificationText[]) */ @Override public void notify(int version, int msgId, short messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text) { Transport transport = Transport.getInstance(); BusAttachment busAttachment = transport.getBusAttachment(); busAttachment.enableConcurrentCallbacks(); try { GenericLogger logger = NativePlatformFactory.getPlatformObject().getNativeLogger(); try { String sender = busAttachment.getMessageContext().sender; logger.debug(TAG, "Received notification from: '" + sender + "' by '" + servicePath + "' object, notification id: '" + msgId + "', handling"); logger.debug(TAG, "Forwarding the received notification id: '" + msgId + "' to PayloadAdapter"); PayloadAdapter.receivePayload(version, msgId, sender, messageType, deviceId, deviceName, appId, appName, attributes, customAttributes, text); } catch (NotificationServiceException nse) { logger.error(TAG, "Failed to read the received notification, Error: " + nse.getMessage()); } } catch (NativePlatformFactoryException npfe) { System.out.println(TAG + ": Unexpected error occured: " + npfe.getMessage()); } }//notify } ReceiverTransport.java000066400000000000000000000377641272147170000356400ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.consumer; import java.lang.reflect.Method; import java.util.Map; import java.util.UUID; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import org.alljoyn.bus.AboutObjectDescription; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusListener; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ns.Notification; import org.alljoyn.ns.NotificationReceiver; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.transport.TaskManager; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.interfaces.NotificationDismisser; import org.alljoyn.ns.transport.interfaces.NotificationTransport; /** * The class manages NotificationReceiver transport logic */ public class ReceiverTransport { private static final String TAG = "ioe" + ReceiverTransport.class.getSimpleName(); /** * The reference to the platform dependent object */ private final NativePlatform nativePlatform; private static final String SESSION_LESS_RULE = "sessionless='t'"; /** * addMatch rule to receive {@link NotificationTransport} * session-less-signals */ private static final String NOTIF_TRANS_MATCH_RULE = "type='signal',interface='" + NotificationTransport.IF_NAME + "'," + SESSION_LESS_RULE; /** * addMatch rule to receive {@link NotificationDismisser} * session-less-signals */ private static final String DISMISSER_MATCH_RULE = "type='signal',interface='" + NotificationDismisser.IF_NAME + "'," + SESSION_LESS_RULE; /** * The name of the notification signal */ private static final String NOTIF_SIGNAL_NAME = "notify"; /** * The name of the Dismiss signal */ private static final String DISMISS_SIGNAL_NAME = "dismiss"; /** * TRUE means stop forwarding notification messages to notificationReceiver */ private final boolean stopReceiving = false; /** * A BusListener object to handle lostAdvertisedName callbacks */ private BusListener lostAdvertisedNameBusListener; /** * Notification transport producer Receives and handles session less signals * from a regular producers */ private NotificationTransport fromProducerChannel; /** * Receives the Dismiss signals */ private DismissConsumer dismissSignalHandler; /** * Reference to NotificationReceiver object */ private final NotificationReceiver notificationReceiver; /** * Constructor * * @param nativePlatform * The reference to the platform dependent object */ public ReceiverTransport(NativePlatform nativePlatform, NotificationReceiver receiver) { this.notificationReceiver = receiver; this.nativePlatform = nativePlatform; } /** * Starts the service in the Notification Receiver mode * * @throws NotificationServiceException * Is thrown if failed to start the SenderTransport */ public void startReceiverTransport() throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Starting receiver transport"); // Register to receive Notification signals directly from Producers // Additionally calls AddMatch(NOTIF_SLS_BASIC_RULE) registerReceivingProducerNotifications(); // Register to receive Dismiss signals dismissSignalHandler = new DismissConsumer(); boolean regDismissHandler = registerDismissSignalHandler(dismissSignalHandler); if (!regDismissHandler) { logger.error(TAG, "Failed to register Dismiss signal handler"); throw new NotificationServiceException("Failed to register Dismiss signal handler"); } // Add match to receive notification signals from producers addMatchRule(NOTIF_TRANS_MATCH_RULE); // Add Match rule to receive dismiss signals addMatchRule(DISMISSER_MATCH_RULE); }// startReceiverTransp /** * ReceiverTransport cleanups */ public void stopReceiverTransport() { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Stopping ReceiverTransport"); Method notifConsumerMethod = getNotificationConsumerSignalMethod(); if (fromProducerChannel != null) { logger.debug(TAG, "Unregister Producer signal handler"); if (notifConsumerMethod != null) { busAttachment.unregisterSignalHandler(fromProducerChannel, notifConsumerMethod); } busAttachment.unregisterBusObject(fromProducerChannel); fromProducerChannel = null; removeMatchRule(NOTIF_TRANS_MATCH_RULE); }// if :: producer if (dismissSignalHandler != null) { logger.debug(TAG, "Unregister Dismiss signal handler"); Method dismisSignalMethod = getDismissSignalMethod(); if (dismisSignalMethod == null) { busAttachment.unregisterSignalHandler(dismissSignalHandler, dismisSignalMethod); } busAttachment.unregisterBusObject(dismissSignalHandler); dismissSignalHandler = null; removeMatchRule(DISMISSER_MATCH_RULE); }// if :: dismiss }// stopReceiverTransport /** * Received notification, call the notification receiver callback to pass * the notification * * @param notification */ public void onReceivedNotification(final Notification notification) { GenericLogger logger = nativePlatform.getNativeLogger(); if (stopReceiving) { logger.debug(TAG, "In stopSending mode NOT delivering notifications!!!"); return; } try { TaskManager.getInstance().execute(new Runnable() { @Override public void run() { notificationReceiver.receive(notification); } }// runnable ); } catch (RejectedExecutionException ree) { logger.error(TAG, "Failed to return a received notification, id: '" + notification.getMessageId() + "', Error: '" + ree.getMessage() + "'"); } }// onReceivedNotification /** * Handle the received Dismiss signal * * @param msgId * The message id of the {@link Notification} that should be * dismissed * @param appId * The appId of the Notification sender service */ public void onReceivedNotificationDismiss(final int msgId, final UUID appId) { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Received the Dismiss signal notifId: '" + msgId + "', from the appId: '" + appId + "', delivering to the NotificationReceiver"); try { TaskManager.getInstance().execute(new Runnable() { @Override public void run() { notificationReceiver.dismiss(msgId, appId); } }// runnable ); } catch (RejectedExecutionException ree) { logger.error(TAG, "Failed to deliver the Dismiss event of the notifId: '" + msgId + "', from the appId:'" + appId + "', Error: '" + ree.getMessage() + "'"); } }// onReceivedNotificationDismiss /** * Register receiving {@link Notification} messages directly from * Notification producers Additionally calls AddMatch(NOTIF_SLS_BASIC_RULE) * * @throws NotificationServiceException */ private void registerReceivingProducerNotifications() throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); // Register to receive signals directly from Producers logger.debug(TAG, "Registering to receive signals from producers"); fromProducerChannel = new NotificationTransportConsumer(NotificationTransportConsumer.FROM_PRODUCER_RECEIVER_PATH); boolean regProducerHandler = registerNotificationSignalHandlerChannel(fromProducerChannel, NotificationTransportConsumer.FROM_PRODUCER_RECEIVER_PATH, NotificationTransport.IF_NAME); if (!regProducerHandler) { logger.error(TAG, "Failed to register a Producer signal handler"); throw new NotificationServiceException("Failed to register a Producer signal handler"); } }// regReceivingProducerNotifications /** * Register channel object to receive Notification signals * * @param receiverChannel * Receiver channel object * @param receiverChannelServicePath * The service path of the receiver channel object * @param signalHandlerIfName * The interface name the receiver channel is listening * @param signalName * The signal name that belongs to the interface name * @return TRUE on success or FALSE on fail */ private boolean registerNotificationSignalHandlerChannel(NotificationTransport receiverChannel, String receiverChannelServicePath, String signalHandlerIfName) { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Registering signal handler for interface: '" + signalHandlerIfName + "' servicePath: " + receiverChannelServicePath); Method handlerMethod = getNotificationConsumerSignalMethod(); if (handlerMethod == null) { return false; } boolean regRes = Transport.getInstance().registerObjectAndSetSignalHandler(logger, signalHandlerIfName, NOTIF_SIGNAL_NAME, handlerMethod, receiverChannel, receiverChannelServicePath); if (!regRes) { stopReceiverTransport(); // Stop receiver transport to allow later // recovery return false; } return true; }// registerSignalHandlerChannel /** * Registers Dismiss signal receiver * * @param dismissConsumer * @return TRUE on success or FALSE on fail */ private boolean registerDismissSignalHandler(DismissConsumer dismissConsumer) { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Registering signal handler for interface: '" + DismissConsumer.IF_NAME + "' servicePath: '" + DismissConsumer.OBJ_PATH + "'"); Method handlerMethod = getDismissSignalMethod(); if (handlerMethod == null) { return false; } String allJoynName = handlerMethod.getAnnotation(BusSignal.class).name(); boolean regRes = Transport.getInstance().registerObjectAndSetSignalHandler(logger, DismissConsumer.IF_NAME, allJoynName, handlerMethod, dismissConsumer, DismissConsumer.OBJ_PATH); if (!regRes) { stopReceiverTransport(); // Stop receiver transport to allow later // recovery return false; } return true; }// registerDismissSignalReceiver /** * Call the method {@link BusAttachment#addMatch(String)} with the given * rule * * @param rule * The rule to add * @throws NotificationServiceException * is throws if the AddMatch return status wasn't OK */ private void addMatchRule(String rule) throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Call AddMatch rule: '" + rule + "'"); BusAttachment bus = Transport.getInstance().getBusAttachment(); Status status = bus.addMatch(rule); if (status != Status.OK) { logger.error(TAG, "Failed to call AddMatch rule: '" + rule + "', Error: '" + status + "'"); throw new NotificationServiceException("Failed to call AddMatch rule: '" + rule + "', Error: '" + status + "'"); } logger.debug(TAG, "Status from AddMatch rule: '" + rule + "', status: '" + status + "'"); }// addMathcRule /** * Call the method {@link BusAttachment#removeMatch(String)} with the given * rule * * @param rule * The rule to add * @return The result status */ private Status removeMatchRule(String rule) { BusAttachment bus = Transport.getInstance().getBusAttachment(); Status status = bus.removeMatch(rule); nativePlatform.getNativeLogger().debug(TAG, "RemoveMatch rule: '" + rule + "' result: '" + status + "'"); return status; }// removeMatchRule /** * Returns reflection of {@link NotificationTransport#notify} method Used to * register signal handler dynamically (without signal annotation on the * method) * * @return Method object or NULL if failed to retrieve */ private Method getNotificationConsumerSignalMethod() { Method retMethod; try { retMethod = NotificationTransport.class.getMethod(NOTIF_SIGNAL_NAME, Integer.TYPE, // version Integer.TYPE, // msgId, Short.TYPE, // messageType, String.class, // deviceId, String.class, // deviceName, byte[].class, // appId, String.class, // appName, Map.class, // attributes Map.class, // customAttributes TransportNotificationText[].class); // text } catch (Exception ex) { nativePlatform.getNativeLogger().error(TAG, "Failed to get a reflection of the signal method: '" + NOTIF_SIGNAL_NAME + "', Error: " + ex.getMessage()); retMethod = null; } return retMethod; }// getNotificationTransportSignalMethod /** * Returns reflection of the {@link DismissConsumer#dismiss(int, byte[])} * * @return Method object or NULL if failed to retrieve */ private Method getDismissSignalMethod() { Method retMethod; try { retMethod = NotificationDismisser.class.getMethod(DISMISS_SIGNAL_NAME, int.class, byte[].class); } catch (Exception ex) { nativePlatform.getNativeLogger().error(TAG, "Failed to get a reflection of the signal method: '" + DISMISS_SIGNAL_NAME + "', Error: " + ex.getMessage()); retMethod = null; } return retMethod; }// getDismissSignalMethod } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/interfaces/000077500000000000000000000000001272147170000316425ustar00rootroot00000000000000NotificationDismisser.java000066400000000000000000000041401272147170000367360ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.interfaces; import org.alljoyn.bus.BusException; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; /** * The interface provides the functionality to send and receive Dismiss session-less-signals */ @BusInterface(name = NotificationDismisser.IF_NAME) public interface NotificationDismisser extends BusObject { /** * The AllJoyn interface name */ public static final String IF_NAME = "org.alljoyn.Notification.Dismisser"; /** * The interface version */ public static final short VERSION = 1; /** * The Dismiss signal to be sent * @param msgId The notification id the Dismiss signal belongs * @param appId The application id of the Notification Sender */ @BusSignal(signature="iay", name="Dismiss") public void dismiss(int msgId, byte[] appId) throws BusException; /** * @return The interface version * @throws BusException */ @BusProperty(signature="q") public short getVersion() throws BusException; } NotificationProducer.java000066400000000000000000000045731272147170000365710ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.interfaces; import org.alljoyn.bus.BusException; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.ns.Notification; /** * The interface provides to a notification receiver the functionality to dismiss * the received {@link Notification}. */ @BusInterface(name = NotificationProducer.IFNAME) public interface NotificationProducer extends BusObject { /** * The AllJoyn interface name */ public static final String IFNAME = "org.alljoyn.Notification.Producer"; /** * Notification producer object */ public static final String OBJ_PATH = "/notificationProducer"; /** * The interface version */ public static final short VERSION = 1; /** * When the notification message is dismissed, it's first of all deleted and then a dismiss signal is sent * to all notification consumers to update them that the {@link Notification} has been dismissed * @param msgId The notification message identifier * @throws BusException */ @BusMethod(name="Dismiss", signature="i") public void dismiss(int msgId) throws BusException; /** * @return The interface version * @throws BusException */ @BusProperty(signature="q") public short getVersion() throws BusException; } NotificationTransport.java000066400000000000000000000052151272147170000367740ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/interfaces/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.interfaces; import java.util.Map; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ns.transport.TransportNotificationText; /** * The interface used to send and receive "session less" notification signals */ @BusInterface(name = NotificationTransport.IF_NAME, announced = "true") public interface NotificationTransport extends BusObject { /** * AllJoyn interface name */ public static final String IF_NAME = "org.alljoyn.Notification"; /** * The interface version */ public static final short VERSION = 1; /** * Use the method to send or receive AJ session less signal * * @param version * The version of the message signature * @param msgId * The notification message id * @param messageType * Notification message type id * @param deviceId * Device Id * @param deviceName * Device Name * @param appId * App Id * @param appName * App Name * @param attributes * Attributes key-value pair * @param customAttributes * customAttributes * @param text * Array of NotificationText objects */ @BusSignal(signature = "qiqssaysa{iv}a{ss}ar") public void notify(int version, int msgId, short messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text); } base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/000077500000000000000000000000001272147170000313425ustar00rootroot00000000000000NotificationProducerImpl.java000066400000000000000000000103751272147170000371100ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.producer; import org.alljoyn.bus.BusException; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.Status; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.transport.TaskManager; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.interfaces.NotificationProducer; /** * The class implements the {@link NotificationProducer} interface and by this * realizes the Notification producer proprietary logic */ class NotificationProducerImpl implements NotificationProducer { private static final String TAG = "ioe" + NotificationProducerImpl.class.getSimpleName(); /** * The Sender transport */ private SenderTransport senderTransport; /** * The reference to the platform dependent object */ private NativePlatform nativePlatform; /** * Constructor * * @param senderTransport * The Sender transport * @param nativePlatform * The reference to the platform dependent object */ public NotificationProducerImpl(SenderTransport senderTransport, NativePlatform nativePlatform) { this.senderTransport = senderTransport; this.nativePlatform = nativePlatform; } /** * Initializes the object
* Register {@link BusObject}, if failed to register the * {@link NotificationServiceException} is thrown * * @throws NotificationServiceException */ public void init() throws NotificationServiceException { Status status = Transport.getInstance().getBusAttachment().registerBusObject(this, OBJ_PATH); nativePlatform.getNativeLogger().debug(TAG, "NotificationProducer BusObject: '" + OBJ_PATH + "' was registered on the bus, Status: '" + status + "'"); if (status != Status.OK) { throw new NotificationServiceException("Failed to register BusObject: '" + OBJ_PATH + "', Error: '" + status + "'"); } }// init /** * @see org.alljoyn.ns.transport.interfaces.NotificationProducer#dismiss(int) */ @Override public void dismiss(final int msgId) throws BusException { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Received Dismiss for notifId: '" + msgId + "', delegating to be executed"); Transport.getInstance().getBusAttachment().enableConcurrentCallbacks(); TaskManager.getInstance().enqueue(new Runnable() { @Override public void run() { senderTransport.dismiss(msgId); } }); }// dismiss /** * @see org.alljoyn.ns.transport.interfaces.NotificationProducer#getVersion() */ @Override public short getVersion() throws BusException { return VERSION; }// getVersion /** * Cleans the object resources */ public void clean() { nativePlatform.getNativeLogger().debug(TAG, "Cleaning the NotificationProducerImpl"); Transport.getInstance().getBusAttachment().unregisterBusObject(this); senderTransport = null; nativePlatform = null; }// clean } NotificationTransportProducer.java000066400000000000000000000050351272147170000402000ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.producer; import java.util.EnumMap; import java.util.Map; import org.alljoyn.bus.Variant; import org.alljoyn.ns.Notification; import org.alljoyn.ns.NotificationMessageType; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.interfaces.NotificationTransport; /** * The class is used to send {@link Notification} session less signals */ class NotificationTransportProducer implements NotificationTransport { /** * Stores AJ BusObject identifiers * Maps from Message type to ServicePath string */ private static Map servicePath; static { servicePath = new EnumMap(NotificationMessageType.class); servicePath.put(NotificationMessageType.EMERGENCY, "/emergency"); servicePath.put(NotificationMessageType.WARNING, "/warning"); servicePath.put(NotificationMessageType.INFO, "/info"); } /** * Returns the servicePath for each of the transport objects * @return */ public static Map getServicePath() { return servicePath; } /** * Use this method to send session less signals * @see org.alljoyn.ns.transport.interfaces.NotificationTransport#notify(int, int, short, String, String, byte[], String, Map, Map, TransportNotificationText[]) */ @Override public void notify(int version, int msgId, short messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text) {} } SenderSessionListener.java000066400000000000000000000122311272147170000364170ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.producer; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.Mutable.ShortValue; import org.alljoyn.bus.SessionOpts; import org.alljoyn.bus.SessionPortListener; import org.alljoyn.bus.Status; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.transport.Transport; /** * Prepares the Notification sender to receive incoming connections
* - Bind session port
* - Register session port listener
* - Handle incoming connections */ public class SenderSessionListener extends SessionPortListener { private static final String TAG = "ioe" + SenderSessionListener.class.getSimpleName(); /** * The reference to the platform dependent object */ private NativePlatform nativePlatform; /** * The port number to listen for incoming connections */ public static final short PORT_NUM = 1010; /** * Constructor * @param nativePlatform The reference to the platform dependent object */ public SenderSessionListener(NativePlatform nativePlatform) { super(); this.nativePlatform = nativePlatform; } /** * Initializes the object
* - Bind session port
* - Register session port listener
* @throws NotificationServiceException */ public void init() throws NotificationServiceException { BusAttachment bus = Transport.getInstance().getBusAttachment(); Status status = bus.bindSessionPort(new ShortValue(PORT_NUM), getSessionOpts(), this); nativePlatform.getNativeLogger().debug(TAG, "Session port: '" + PORT_NUM + "' was bound on the bus: '" + status + "'"); if ( status != Status.OK ) { throw new NotificationServiceException("Failed to bind session port: '" + PORT_NUM + "', Error: '" + status + "'"); } }//init /** * Cleans the object resources */ public void clean() { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Cleaning the SenderSessionListener"); BusAttachment bus = Transport.getInstance().getBusAttachment(); Status status = bus.unbindSessionPort(PORT_NUM); if ( status != Status.OK ) { nativePlatform.getNativeLogger().error(TAG, "Failed to unbind the port number: '" + PORT_NUM + "', Error: '" + status + "'"); } nativePlatform = null; }//clean /** * @see org.alljoyn.bus.SessionPortListener#acceptSessionJoiner(short, java.lang.String, org.alljoyn.bus.SessionOpts) */ @Override public boolean acceptSessionJoiner(short sessionPort, String joiner, SessionOpts opts) { if ( nativePlatform == null ) { // Protection - this may happens if the clean has been called, but daemon had some events in its stack return false; } GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Received SessionJoiner request from: '" + joiner + "', requested port: '" + sessionPort + "'"); if ( sessionPort == PORT_NUM ) { return true; } return false; }//acceptSessionJoiner /** * @see org.alljoyn.bus.SessionPortListener#sessionJoined(short, int, java.lang.String) */ @Override public void sessionJoined(short sessionPort, int id, String joiner) { if ( nativePlatform == null ) { return; } GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "The session was established with: '" + joiner + "', SID: '" + id + "'"); }//sessionJoined /** * @return {@link SessionOpts} */ public static SessionOpts getSessionOpts() { SessionOpts sessionOpts = new SessionOpts(); sessionOpts.traffic = SessionOpts.TRAFFIC_MESSAGES; // Use reliable message-based communication to move data between session endpoints sessionOpts.isMultipoint = false; // A session is multi-point if it can be joined multiple times sessionOpts.proximity = SessionOpts.PROXIMITY_ANY; // Holds the proximity for this SessionOpt sessionOpts.transports = SessionOpts.TRANSPORT_ANY; // Holds the allowed transports for this SessionOpt return sessionOpts; }//getSessionOpts } SenderTransport.java000066400000000000000000000250771272147170000352760ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.producer; import java.util.EnumMap; import java.util.Map; import java.util.UUID; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.Variant; import org.alljoyn.ns.NotificationMessageType; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.transport.DismissEmitter; import org.alljoyn.ns.transport.Transport; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.interfaces.NotificationProducer; /** * The class manages NotificationProducer transport logic */ public class SenderTransport { private static final String TAG = "ioe" + SenderTransport.class.getSimpleName(); /** * The reference to the platform dependent object */ private final NativePlatform nativePlatform; /** * TRUE means to stop sending notification messages */ private final boolean stopSending = false; /** * Map NotificationMessageType to transport object */ private Map transportSenderChannels; /** * The object implements the {@link NotificationProducer} interface */ private NotificationProducerImpl notifProducerBusObj; /** * Prepares the AllJoyn daemon to receive incoming session requests */ private SenderSessionListener sessionListener; /** * Constructor * * @param nativePlatform * The reference to the platform dependent object */ public SenderTransport(NativePlatform nativePlatform) { this.nativePlatform = nativePlatform; } /** * Starts the service in the Notification Sender mode * * @throws NotificationServiceException * Is thrown if failed to start the SenderTransport */ public void startSenderTransport() throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Starting a sender transport"); // Creating transportChannel objects transportSenderChannels = new EnumMap(NotificationMessageType.class); try { for (NotificationMessageType messageType : NotificationMessageType.values()) { transportSenderChannels.put(messageType, new TransportChannelObject(messageType, busAttachment, nativePlatform)); } } catch (NotificationServiceException nse) { logger.error(TAG, nse.getMessage()); throw nse; } // Initialize the NotificationProducer BusObject notifProducerBusObj = new NotificationProducerImpl(this, nativePlatform); notifProducerBusObj.init(); // Create session listener to be ready to handle incoming connections sessionListener = new SenderSessionListener(nativePlatform); sessionListener.init(); // //Send the Announce signal with all the NotificationService related // BusObjectDescription objects // if ( aboutObj != null ) { // aboutObj.announce(); // } }// startSenderTransport /** * SenderTransport cleanups */ public void stopSenderTransport() { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Stopping SenderTransport"); if (transportSenderChannels != null) { for (NotificationMessageType pr : transportSenderChannels.keySet()) { transportSenderChannels.get(pr).clean(busAttachment); } transportSenderChannels = null; } if (sessionListener != null) { sessionListener.clean(); sessionListener = null; } if (notifProducerBusObj != null) { notifProducerBusObj.clean(); notifProducerBusObj = null; } // if ( aboutObj != null ) { // //Send the Announce signal after removing NotificationService related // BusObjectDescription objects // aboutObj.announce(); // } }// stopSenderTransport /** * Called when we need to send a signal * * @param version * The version of the message signature * @param msgId * notification Id the id of the sent signal * @param messageType * The message type of the sent message * @param deviceId * Device id * @param deviceName * Device name * @param appId * App id * @param appName * App name * @param attributes * All the notification metadata * @param customAttributes * The customAttributes * @param text * Array of texts to be sent * @param ttl * Notification message TTL * @throws NotificationServiceException */ public void sendNotification(int version, int msgId, NotificationMessageType messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text, int ttl) throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); if (stopSending) { logger.debug(TAG, "In stopSending mode NOT sending notification!!!"); return; } TransportChannelObject senderChannel = transportSenderChannels.get(messageType); if (senderChannel == null) { throw new NotificationServiceException("Received an unknown message type: '" + messageType + "', can't find a transport channel to send the notification"); } // send this notification to the correct object based on messageType senderChannel.sendNotification(version, msgId, messageType.getTypeId(), deviceId, deviceName, appId, appName, attributes, customAttributes, text, ttl); }// sendNotification /** * Cancel the last message sent for the given messageType * * @param messageType * @throws NotificationServiceException */ public void deleteLastMessage(NotificationMessageType messageType) throws NotificationServiceException { TransportChannelObject senderChannel = transportSenderChannels.get(messageType); if (senderChannel == null) { throw new NotificationServiceException("Received an unknown message type: '" + messageType + "', can't find a transport channel to delete the notification"); } // delete the last message of this messageType senderChannel.deleteNotification(); }// deleteLastMessage /** * Try to find and delete the notification by the given notifId, and then * send dismiss session-less-signal * * @param notifId */ public void dismiss(int notifId) { GenericLogger logger = nativePlatform.getNativeLogger(); Transport transport = Transport.getInstance(); logger.debug(TAG, "Dismiss method has been called, trying to find and delete the notification by its id: '" + notifId + "'"); deleteNotificationById(notifId); // Sending dismiss signal try { UUID appId = transport.getAppId(transport.readAllProperties()); DismissEmitter.send(notifId, appId); } catch (NotificationServiceException nse) { logger.error(TAG, "Unable to send the Dismiss signal for notifId: '" + notifId + "', Error: '" + nse.getMessage() + "'"); } }// dismiss /** * @param notifId * The notification id of the notification message to be deleted */ private void deleteNotificationById(int notifId) { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Trying to delete the notification by id: '" + notifId + "', searching for the relevant object"); boolean isObjFound = false; for (TransportChannelObject channelObj : transportSenderChannels.values()) { channelObj.acquireLock(); // Lock the object to prevent changing its // state Integer chanObjNotifId = channelObj.getNotificationId(); if (chanObjNotifId != null && chanObjNotifId == notifId) { // Found // the // object // to be // cancelled logger.debug(TAG, "Found the object with notifId: '" + notifId + "' to be cancelled"); channelObj.deleteNotification(); isObjFound = true; channelObj.releaseLock(); // release the lock break; } else { channelObj.releaseLock(); // release the lock and continue // iterating } } if (!isObjFound) { logger.debug(TAG, "Failed to find the Notification with Id: '" + notifId + "'"); } } } TransportChannelObject.java000066400000000000000000000204361272147170000365470ustar00rootroot00000000000000base-16.04/notification/java/NotificationService/src/org/alljoyn/ns/transport/producer/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.transport.producer; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.SignalEmitter; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.ns.NotificationMessageType; import org.alljoyn.ns.NotificationServiceException; import org.alljoyn.ns.commons.GenericLogger; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.transport.TransportNotificationText; import org.alljoyn.ns.transport.interfaces.NotificationTransport; /** * Utility class used to store and manage sending notification messages */ class TransportChannelObject { private static final String TAG = "ioe" + TransportChannelObject.class.getSimpleName(); /** * The object thread lock */ private final ReentrantLock LOCK; /** * Notification message type */ private final NotificationMessageType messageType; /** * The object path of the BusObject that is used to send the Notification * signals */ private final String servicePath; /** * Signal emitter that generated the transportChannel */ private SignalEmitter emitter; /** * NotificationTransport object that is registered on the bus */ private NotificationTransport transportObj; /** * Reference to Native platform object */ private final NativePlatform nativePlatform; /** * The serialId of the last sent message */ private volatile Integer lastMsgSerialId; /** * The notification id of the last sent message */ private volatile Integer lastNotifId; /** * Constructor * * @param messageType * @param busAttachment * @throws NotificationServiceException */ public TransportChannelObject(NotificationMessageType messageType, BusAttachment busAttachment, NativePlatform nativePlatform) throws NotificationServiceException { this.messageType = messageType; this.nativePlatform = nativePlatform; GenericLogger logger = nativePlatform.getNativeLogger(); this.LOCK = new ReentrantLock(true); this.transportObj = new NotificationTransportProducer(); this.lastMsgSerialId = null; servicePath = NotificationTransportProducer.getServicePath().get(messageType); // Perform registerBusObject with a given messageType Status status = busAttachment.registerBusObject(transportObj, servicePath); if (status != Status.OK) { logger.debug(TAG, "Failed to registerBusObject status: '" + status + "'"); throw new NotificationServiceException("Failed to prepare sending channel"); } // Initializing sessionless signal manager for sending signals later. logger.debug(TAG, "Initializing signal emitter for sessionless signal, MessageType: '" + messageType + "'"); emitter = new SignalEmitter(transportObj, SignalEmitter.GlobalBroadcast.Off); emitter.setSessionlessFlag(true); }// Constructor /** * Acquires the lock of the object
* Very important to call the releaseLock method to release the lock */ public void acquireLock() { LOCK.lock(); }// acquireLock /** * Releases the lock of the object */ public void releaseLock() { LOCK.unlock(); }// releaseLock /** * Returns the notification id of the last sent message */ public Integer getNotificationId() { return lastNotifId; }// getNotificationId /** * Called when we need to send a signal * * @param version * The version of the message signature * @param msgId * Notification Id the id of the sent signal * @param messageType * Message type id * @param deviceId * Device id * @param deviceName * Device name * @param appId * App id * @param appName * App name * @param attributes * All the notification metadata * @param customAttributes * The customAttributes * @param text * Array of texts to be sent * @param ttl * Notification message TTL * @throws NotificationServiceException */ public void sendNotification(int version, int msgId, short messageType, String deviceId, String deviceName, byte[] appId, String appName, Map attributes, Map customAttributes, TransportNotificationText[] text, int ttl) throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); logger.debug(TAG, "Sending notification message for messageType: '" + messageType + "' message id: '" + msgId + "', ttl: '" + ttl + "'"); emitter.setTimeToLive(ttl); NotificationTransport transportChannel = emitter.getInterface(NotificationTransport.class); LOCK.lock(); // The lock protects the lastMsgSerialId try { transportChannel.notify(version, msgId, messageType, deviceId, deviceName, appId, appName, attributes, customAttributes, text); lastMsgSerialId = emitter.getMessageContext().serial; lastNotifId = msgId; logger.debug(TAG, "The message was sent successfully. messageType: '" + messageType + "' message id: '" + msgId + "' SerialId: '" + lastMsgSerialId + "'"); } catch (Exception e) { logger.error(TAG, "Failed to call notify to send notification"); throw new NotificationServiceException("Failed to send notification", e); } finally { LOCK.unlock(); } }// sendNotification /** * Called when we need to delete a signal */ public void deleteNotification() { GenericLogger logger = nativePlatform.getNativeLogger(); LOCK.lock(); // The lock protects the lastMsgSerialId try { if (lastMsgSerialId == null) { logger.warn(TAG, "Unable to delete last message for messageType: '" + messageType + "'. No message was previously sent from this object, lastMsgSerialId is NULL"); return; } logger.debug(TAG, "Deleting last notification message for messageType: '" + messageType + "', MsgSerialId: '" + lastMsgSerialId + "'"); Status status = emitter.cancelSessionlessSignal(lastMsgSerialId); if (status == Status.OK) { logger.debug(TAG, "The notification message deleted successfully, messageType: '" + messageType + "', MsgSerialId: '" + lastMsgSerialId + "', lastNotifId: '" + lastNotifId + "'"); lastMsgSerialId = null; lastNotifId = null; } else { logger.warn(TAG, "Failed to delete last message for messageType: '" + messageType + "'. Status: '" + status + "'"); } } finally { LOCK.unlock(); } }// deleteNotification /** * Unregister bus object from AJ bus, Set to null emitter, transportChannel, * transportObj */ public void clean(BusAttachment busAttachment) { deleteNotification(); busAttachment.unregisterBusObject(transportObj); transportObj = null; emitter = null; lastMsgSerialId = null; lastNotifId = null; }// clean } base-16.04/notification/java/NotificationServiceCommons/000077500000000000000000000000001272147170000233515ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/.classpath000066400000000000000000000004471272147170000253410ustar00rootroot00000000000000 base-16.04/notification/java/NotificationServiceCommons/.project000066400000000000000000000006011272147170000250150ustar00rootroot00000000000000 NotificationServiceCommons org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature base-16.04/notification/java/NotificationServiceCommons/.settings/000077500000000000000000000000001272147170000252675ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000011511272147170000322470ustar00rootroot00000000000000#Thu Feb 07 09:41:55 IST 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 base-16.04/notification/java/NotificationServiceCommons/build.xml000066400000000000000000000040161272147170000251730ustar00rootroot00000000000000 base-16.04/notification/java/NotificationServiceCommons/src/000077500000000000000000000000001272147170000241405ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/000077500000000000000000000000001272147170000247275ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/000077500000000000000000000000001272147170000263775ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/000077500000000000000000000000001272147170000270175ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/000077500000000000000000000000001272147170000304725ustar00rootroot00000000000000GenericLogger.java000066400000000000000000000037551272147170000340040ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.commons; /** * Implement this interface to provide logging functionality for the Notification service */ public interface GenericLogger { /** * Debug level message * @param TAG Tag to be added to the message, i.e. class that writes the message * @param msg */ public void debug(String TAG, String msg); /** * Info level message * @param TAG Tag to be added to the message, i.e. class that writes the message * @param msg */ public void info(String TAG, String msg); /** * Warn level message * @param TAG Tag to be added to the message, i.e. class that writes the message * @param msg */ public void warn(String TAG, String msg); /** * Error level message * @param TAG Tag to be added to the message, i.e. class that writes the message * @param msg */ public void error(String TAG, String msg); /** * Fatal level message * @param TAG Tag to be added to the message, i.e. class that writes the message * @param msg */ public void fatal(String TAG, String msg); } NativePlatform.java000066400000000000000000000025261272147170000342160ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.commons; /** * Implement this interface to provide platform dependent functionality for the Notification service */ public interface NativePlatform { /** * Returns reference to GenericLogger object */ public GenericLogger getNativeLogger(); /** * Set a GenericLogger object * @param logger */ public void setNativeLogger(GenericLogger logger); } NativePlatformAbstrImpl.java000066400000000000000000000033571272147170000360370ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.commons; /** * The abstract parent class for all the classes implementing platform dependent logic */ public abstract class NativePlatformAbstrImpl implements NativePlatform { /** * Reference to logger */ protected GenericLogger logger; /** * Constructor */ public NativePlatformAbstrImpl() { createLogger(); } /** * Creates and set logger object */ protected abstract void createLogger(); /** * @see org.alljoyn.ns.commons.NativePlatform#getNativeLogger() */ @Override public GenericLogger getNativeLogger() { return logger; } /** * @see org.alljoyn.ns.commons.NativePlatform#setNativeLogger(org.alljoyn.ns.commons.GenericLogger) */ @Override public void setNativeLogger(GenericLogger logger) { this.logger = logger; } } NativePlatformFactory.java000066400000000000000000000113571272147170000355500ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.commons; /** * The factory class for the classes extending {@link NativePlatformAbstrImpl}
* According to the platform that the service is running on, the appropriate platform dependent class is * instantiated and returned */ public class NativePlatformFactory { /** * Supported OS platforms */ private static enum OSPlatform { WINDOWS ("Windows",""), ANDROID ("Android","org.alljoyn.ns.nativeplatform.NativePlatformAndroid"), LINUX ("Linux", ""); /** * Name of the platform to look for in System properties */ public final String NAME; /** * Class name to load the native platform implementation class dynamically */ public final String CLASS_NAME; /** * Constructor * @param name * @param className */ private OSPlatform(String name, String className) { NAME = name; CLASS_NAME = className; } }//enum :: Platform //=====================================================// /** * Reference to native platform object */ private static volatile NativePlatform nativePlatform = null; /** * Sytem.os.name */ private static String osPlatform; /** * System.java.vm.vendor */ private static String vmVendor; /** * Constructor * We want to prevent possibility to create objects of this class */ private NativePlatformFactory(){} /** * Returns reference to the native platform object * @return reference to the NativePlatform object * @throws NativePlatformFactoryException throws exception if failed to recognize the platform or * to instantiate the native platform object */ public static NativePlatform getPlatformObject() throws NativePlatformFactoryException { if ( nativePlatform != null ) { return nativePlatform; } OSPlatform osPlatformType = identifyPlatform(); if ( osPlatformType == null || osPlatformType.CLASS_NAME.isEmpty() ) { throw new NativePlatformFactoryException("Failed to find NativePlatform class for os: '" + osPlatformType + "', vmVendor: '" + vmVendor + "'"); } synchronized (NativePlatformFactory.class) { if ( nativePlatform == null ) { nativePlatform = getClassInstance(osPlatformType.CLASS_NAME); }//if :: nativePlatform == null }//synchronized return nativePlatform; }//getPlatformObject /** * Uses reflection to load class dynamically and create its instance * @param className */ private static NativePlatform getClassInstance(String className) throws NativePlatformFactoryException { NativePlatform nativePlatformObj; try { @SuppressWarnings("unchecked") Class nativePlatformClass = (Class) Class.forName(className); nativePlatformObj = nativePlatformClass.newInstance(); } catch (ClassNotFoundException e) { throw new NativePlatformFactoryException("Failed to load class: '" + className + "'",e); } catch(IllegalAccessException ilae) { throw new NativePlatformFactoryException(ilae); } catch (InstantiationException ie) { throw new NativePlatformFactoryException(ie); } return nativePlatformObj; }//getClassInstance /** * Identifies the platform this code is executed on * @return if platform isn't recognized, return NULL */ private static OSPlatform identifyPlatform() { osPlatform = System.getProperty("os.name", ""); vmVendor = System.getProperty("java.vm.vendor", ""); if ( osPlatform.isEmpty() ) { return null; } if ( osPlatform.indexOf(OSPlatform.WINDOWS.NAME) > -1 ) { return OSPlatform.WINDOWS; }//if :: windows if ( osPlatform.indexOf(OSPlatform.LINUX.NAME) > -1 ) { //Check Android if ( !vmVendor.isEmpty() && vmVendor.indexOf(OSPlatform.ANDROID.NAME) > -1 ) { return OSPlatform.ANDROID; } return OSPlatform.LINUX; }//if :: linux return null; }//identifyPlatform }//NativePlatformFactory NativePlatformFactoryException.java000066400000000000000000000031611272147170000374210ustar00rootroot00000000000000base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.commons; /** * The exception is thrown if there was a failure in loading and instantiating the class * implementing platform dependent logic */ public class NativePlatformFactoryException extends Exception { /** * Serializable id */ private static final long serialVersionUID = 8554726459608620712L; public NativePlatformFactoryException() { super(); } public NativePlatformFactoryException(String message, Throwable throwable) { super(message, throwable); } public NativePlatformFactoryException(String message) { super(message); } public NativePlatformFactoryException(Throwable throwable) { super(throwable); } } base-16.04/notification/java/NotificationServiceCommons/src/org/alljoyn/ns/commons/package-info.java000066400000000000000000000021571272147170000336660ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * The package includes generic classes that are used by other packages of the Notification service */ package org.alljoyn.ns.commons;base-16.04/notification/java/native_platform/000077500000000000000000000000001272147170000212405ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/000077500000000000000000000000001272147170000313645ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/.classpath000066400000000000000000000011571272147170000333530ustar00rootroot00000000000000 base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/.project000066400000000000000000000015131272147170000330330ustar00rootroot00000000000000 NotificationServiceNativePlatformAndroid com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/.settings/000077500000000000000000000000001272147170000333025ustar00rootroot00000000000000org.eclipse.jdt.core.prefs000066400000000000000000000011511272147170000402030ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/.settings#Wed Feb 27 15:25:55 IST 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 AndroidManifest.xml000066400000000000000000000033011272147170000350730ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/build.xml000066400000000000000000000274421272147170000332160ustar00rootroot00000000000000 AllJoyn™ Notification Service Version 15.04.00]]> AllJoyn™ Notification Service Java API Reference Manual Version 15.04.00
Copyright AllSeen Alliance, Inc. All Rights Reserved.

AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
]]>
ic_launcher-web.png000066400000000000000000001546771272147170000350660ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroidPNG  IHDRxIDATxXg6pM&d7EcED(M;bv VDĂ ,("HAA H?gê33=fw98s;4jDP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( BP( B+RSбEP(tPآP(:IS(tlQ( ):( uU7y>L |w> :ISL|J9f&/UAMxN'JPD'P`'Mիt1,1,5/r/sĊb-my^1J96R(jT^1cGFGDD#ycl[s6xM~Rc'=NU&wa_yɵV&Mry"fxA97ngo=бJP$'Y푨.PoM,.kO7\4zG8*|>x\֛]k&!&t=RT?qdpW Z-n#ObC_r1:sP(*TPP(*TPP(*TPP(zUB6[ =e OEwxq^(ү)S) /z[U;]_~.[ s՛lCBi"-PyJwQEFx;.Vd*<+L8yx'¬g)]LFA ^xt_ 0 6B՛EW8U1"l_MxxBW=%n7' ܦk;y. B * B * B * ;d+.t( %Fm5z4~GblAhLX۽{L[<}1(ޯ\(}-b EHBC~_a!*W7Z?f-Zsyì4-'3"LI~RTNHb/$`H-UOMJKP=4/f"JFZ ͻtOL*[`'SYЄm\y'y鋷xJXe`S( E /Hr \N\h<ΰ?}ugOܙ4 <6WyT_+e-eW 2XȮ"b > xz^JGJ 3"΀H:gIfG=/'[q AwCo/r[3$O\\7+T7; zBjӍ]/pFޅqgҺo9JoȹMLڧP(*TPP(*TP( * ByA׋9͟U-١z >{_}UT^~͢؂RXX) _l 6i0B2VJ!WX?}Ŕ>f09 F#Y#3Ƥ@$@"8!>pK"Vpb4XTZF:g=֧6lcލᅑcn:իbUe~̔U/FmƲweoD[R(x{;>zt׿nշ_&=`Sw.AS\+^-#X"%0Wbs~*بGzH .Aa4&XX %Bgī{YHd}7TxVUV^6Q> LEiL` y+xR^D5xCjVFXI݇ldTVaJ@</ bCwbC?QG&qOBp6y]Ky=/I?Хw8+΃'VoM'܂~PAWe O6쥜o٪\12{LUjVS .+aW0 0U({̆;|90Ja9Htվ(\{x-+{nTV~]͐ w{exHgE c$Rp^0ni !nQO&̵HpIwvo\y K[Dg2p2r4bB{^N<7q *T( *T( *T( IWr`z^ t+՞O)8;!GnZh5ju x/^t8Q#qs;Ł<* wU>OpaT?^>,.lє6$ F!?IQ`WEg@& lI`lpi/Hdki(SeMSںT /gMERYaIa#/Dqc[1W?  ÑʡxV D=+p~wbȹځwIHb1xK𾅉pSa_ 5 4Rv\2|L<^kw;;WTJQ P( ]/?>Ӛ7?px0W'Bߧ-wl63Ig.F %`P#i[f iZ K@^&ioeCW ҵ+1qcJmqsXՋWjv_5x<nT AB ԕ^H`~O l{NW8Id9howB "|)6V+F ՛v?A{-q+@g& B * B * B * axy&,7x }o'e Rsa[!s[3ZS^z rS= ЙH3@Ñ Zrsn4$MEBL0GHЌ#s[-ce#Yaa2 Th I;If<ī!qc?O^LMâ?^c6+"a3'$A_/\ @ā&9j'$89ohc84g,PSduSpb,v^6\uD6h鼵,ٯ=OeWG ًB @4J #Փjr=XҌb΀c77IoS7j 5c v[3Võ{5d0F& ~Ia([}s%kWcI ā/奢t}6yquc v4S#D<7ʇ"b-\+v>RW;yrX9emk8q9$9!'nuc7mQ?y`$l=tCxk[ȳMʳ{ OBP@ BP@ BP@ B(ś x7jY9xv>i<5,φH0KHbY«z!Q $f ]3 nW-B2jvB6R΀jM>RVEuHJ:Ո !7G0#8V -rGIb4rA.W?N&v ƊSt($G|<eÐGC؀\+vࢁHPaR]G^ȅlG8pHD [?N|2 *U25Oa^7GW Ko~}[* *TP(*TP@P vݨ2j^b "n T"2HD$z8$UBjcu&Rφ~)R΂8$z3VNAU;- EY77-aȕmX8"GUl?Bʫsdz-j {p:o> R6lc  Q^y'zy#GTO/O/I+$jf#15c!j8r7/P6yŁ_< ~ W  ā)S\&v6'!⢿ˑ)A?Z]-7ǃöNF$`%.j"oI)=6r E1c} ,Up ލG|c/f_7S͋,DW@?WmnH%>&WGHT؁O7e#dA.Z2!ȵlB:ȕ| {?_f3iةnp,9 2f"LjQkjD$$o۫ _ [.@\/Sd%cp=|A[w!ګ`WX޼::ZS)x:Q(*TPP(*TPP(TP@B1]H)w> ޕ~;{n \$?ڥK!HOV:$ G[bdˆ(&W!>Q>\DP ScA |ޓϻ~$~r^_xr>Nb;3SF#^P]WԫYIc p6|Sְ)"+: Q*K;TMdvP(R׈dŧ ߆ |dct6G樑 fmi`چƩ ޖvvj,EgC *TP(*TP@PP@ Bc?YHtz\~ { )ƣ^XX6xW \γK\oZCHh,xXWkWyԕPU[V?$ltG>8I >8# `\]+ VaK]) \'$|E6/dEzˈ;e`gӺS/s2+rvWCƱmOY;EXDkKeτ9)C`~g؃>l7B7!OG7 do;Y.-6+ ".%:q4/ a .)\/]{0B#(s{…{]{][.2s 9vp*HvQ(u((?!w rz +\B'yqP.W D n~L@. s)`scWJþFe {|d|սԉ..p,;k ^QXa\M^ #qu=`7D빎ȓ+~Sl4DyWhwd=aԅ} ?`>'r6Q6OtS)o°ee9 @dg`Dg8f~7'!AWAHd҇>K7' 1 M4kyK<[o\&ѪV)o:CR(?Ks]x;Xu "^Kl:k†)l1G{ lkxKYXx37(y}+[ج)O\R5zUΐ *TPP(TP@BP@  5^s(<-N:fΦʽ5V_ \fL-`6p: 9a#3NH؂orW ;M邜bN!gҺt/;I ݞ^:,[_YlhKQڂWaWt%ȓ|R1$q5=r;~K\i_\d3?\,G"n+s=g̖2N!Yp9=f S\1SI&J9Z'!ꂜN]Xb`}="~LlX0i!rT ֽ^2@aWRQa˝Ni=mORO>x|W|"^x/!|_}ab΄` 켄3S,f37G66ybXuQ7ݥ0uwj6mV8ʿl£@P@  B *T( *TPP(TWuYسd㰓jOlZow:Q.$0ɖ2> |Std##.i?VB\ h's*+r:k@ {m1x2s/g%wDdIT9%+v}ao]SGbmeG[#wFa/n<'\v_iXyv\\ϙH+. |t\| 'ŝG`! ^=oFV}Yۏ4S,ލ. OXN&ct8ǮIY1IK颽c C\;cm0`հ<-eI_s=w6w/ |lE#6౭ e(qa֟7`[}Vj,ۯKCj# y0yu3dج*Ly=}sN(,:S(t -^T _|~l'T(*TP@B@ *T(?\hx,0ņ?',,q/_t/a׭HJȆSTpSZ)˹闼?@ZRZPzt7ToEt;n /T-n S84Rb %XE+$9RћJwZDϽ>k#J$)]?RJ]i+8%[=RWM|l;.a/6\GMg:l`9)Zl#+e%{Bȼ`֖ԵäU!g|vx}Vo |..TM0C yA`Dʛ}M hC *TP@P@ * *TP@`?Qt/yoz'(q<ȁN ºaւg/TJ^C0CJHsR`ѝC1aG,ZVR)PJЖ HO|JG* vaOv)n~ U t_e iyXXu,m`;+-k l#0Hw禦J MjC _8/\krүX: | E2Ph۶M c)'}zƘ/xG#yGn ݾ/K`S5ff H1nxi C8840Q,20/:xEu93KFi+_[ʈC[J[t%`"'"wpld?g;$. U~aYl2;ak>0ynZIz/n_AU895jx7j[^evcaoCWjhQP@  *TPP@ *T(Hu9"qϔqH.qzw8lp&PlyC_#! ( 50LZ LN(Ȱ!w ;(IKQ |`:K_5+;L8v\2fy2yڡ3 .l?[}T,XCx象 FM[J=um do4f~tq϶rT5j |$^fbX0 bXчxtG^z}Lc^z9Nz,!!}oa&}Pn. g4ЩY?gWu9=.Mlʼn_\vBZk$T;L_rY0і 3 srnX& nC@N2:vmy\F^V>97q~)~%6/#ۙm-~-~7AfY}=H{X-?О }}dG;Xݪ6IaZ#6G:ϪB`qnp+!lO*/6/ `M& Sa grrfM^ztDLͰ!_vd@ *TPP@ **TP@ uqUG`ӷXe~u7^1,Q aɌBX:3s4 iNȨKV,#|N%sK.zM{4“qiaKv]_0*hXr nA`#s `ttd' 3ݰ"ۯ3 96T1 ) h>u0؟r_q%0d>{"-ÌǴ_Hm ׭6IH*/lka"^زd]cvUiܟUoa㗶ƳSZ(ŁϋS>e̳֫Ջr5K6_^!,.)<4W0f\^l̀}x!%]uetYt8ܑuâmY6rWa}rp+ѬY_Y+UXˇEC^fN/K=';vV/f鸊ًyeC } *UTtJ{u90ҁ뽭N ןlࣗr-6֋+t@<P#d_t[a- N=0{yX(PxWٺV<(*})w᮴j-PNi؋bE#D;[JWo=\:m>+z>X;X=mz0ǵ2m])+[&jymyY,>Fۚauk yU la{0x6bXa=(O%  }lWb][T՝Cx"-Fn ;-]T^ J *TPP@ *T(TP@ qul&90-^!,+Ce.@PEKx`W'aEqy c"煗ʸZ s6Ʌw2`^mxB/UPˮþ=0 /UKTͳ %:RNo9:h9l k!Ot '-gŅYt&;T6iUB0 0+u/Lb:]]؎K&`M11l>c[s#9-?`x `{{dne{GdVC4xÄȨKM }+xc淵iIõ>o&\lBystM`0cfh6!0;#vgVzIcd1z3E@qX ╱t++zy_L|Ҷ/MCy9ѥHy- R *o,q`; fx<シ lyo,oK=Xy z{0e12y)L\? "FM"F?=cڱco}!6Q%10w9OX,aU4U?=S9NXKwk=tz;#c5{#yf%ô >xOvTY6=yF*TP@ *TP@@ *TP~+Gøxs[%ϛK}8n]^rݴjl&n&^PȨ],BRk eÑҡB@^obNOnjo}[U}6i[ϙ7>s?Tno+?plW^PO}^<.lٶżkOxw~CMNOĶW b,{|-=8{;9<%2dj+152jnk LXMZWCma7v6u:@l#d.cXf܍A[bwh?ނ`\WCdfQGd )>2~q;-2j~152lz+<%2`B 75986;Y:3ck0N{01n6m.Fн%ҳo^-x}Z&uֻ.=[5oSץl:i;v@exMj^`^MH0$dQ:>&?ԕdW;`>k=W;o9k\[s`1)Z)!c'r',c!S`a/ka^Pk7@,Z^fHKo6_#~6 iSVDZ| &D ̿co3;dӌCX>Z 'f6M>]Fӗ32}LR"SVtWILJ%F/4eLZj_lȾol 洗>]"Ʒ#[!F͑n߳ :9|7'}ZÚ?Xϑo~6WТUSШXY#ݭW.HAv0`(֭ws]z<3pmoIX~Y3n;iMg^`@R91؝䀜 X!#;5S-Xa=oFy[oy8J&NލKѤ@ *TPP@ **TP@ mANO 7hF`BNَj$Qs[5@\F/CE<[w62T=gښ+Ҵ_fo!}&7/ހ?{7O$>fo?>m?grx_/weߛ]{H)|3}(&M{'oc}wዦA~CD#hvtu' 2`BSas8C ,;~o#_|  {wjҸ 8ߘ._>__^{xmŽ|:׬d~߾Aoow`j!ҹ?ǏB ؠ fW5g2rNs> SY۶"n<'ؐոy'Ҽ.br-e܃̑W̴x". ' Gګy 47xc|—y}'}g"TP@ **TP@ *TP@7. l O^?jW=A~T;Ȱ~H~xG^Km d%MO'H^LϏɘ:|b?3,N>>!V.? Ͻ7omv?,asΕ;2{bד -,˖%#+R,ʚ eSB,'I\jIkr`Y, ي7;F$Z0vzhEGg 9y$e@]@PDݻ+2Z@Ew2H܆Yܪ'WGx+"n nrf1cnL"{c@憙o?[ 4vɣwjүi<<+#j+İ\:y2:8,!H~w'}CXɮAH,+Ϙhjq$8 [мsW0jxvYۋK{Cux} ?u=/a|B#to03&"GdG/.@^0|;TvȞ/Ƴ=g[lyw,[*VspRϋom²#5n,.tby-$ YcZ s͙4^l3d<#cvccfcf>fh#ÈjH/eçc#g>F{(2aQ7>б{>،̠l~Ȃ>li9\{eBp"lYtIXÇy8$߁B[Y~?pi:6,#PmoHC~id dfi=I_/5Px{U6 Jm7mv6@vgj%`{V*֟ltf< JF]VE$`wiT(@SK _<ly|7I]W zP$;iֺ1]+S"󝐀4)qֈa\G}{)z" { Fkxx 5^pnLL sA1D IK#|{pfЬ^lA˜>o'قdX!A,4PA@}.P~CB 1By7w@ 691dMr ;VL68 IuZ*;Ydc αd>_4ٷl`Ó!-OECE[A[xʉAY3Fƺ7@AelƷ<٦mxdg؁Ӑ'Ù3?bϝ9BK..c޸B]/Ƚv_Kg!GN/yB칓g+[3c<9pܛ2O}5Mfev}2AfDZq2>l} kwϘ'k>: i<25jƔmwE ׈~HFs5:3]XVVbQd$t!$J͋D< \"}\_ls ͵}/~ Q_3] P<Xk<t*ڟnrA78 Jip4&8衈v 2-\#vPPPPPPPPPPPPPPPPPPPPPPPu@볋k|za0T{B,6 M.Y!jUs{M]k@^jnno*l: m8WωAO9]aϸ1HD@ 1<WM9m'EbGcc<>@f<Ç?A^CȩȋrȽ|vQ>|bg)X /{锰y$?,B~|>a}6rY|OG'/}KM]O#qȶƱA;m~g4m>=YvM/{@>>;>8(UX̦jhA匈Z,a#kmαC"0lY9ע.(Dml6 >xh"bׄʂ! ߐޮnr6վ?V$&N|^qrXZ-Tco3@XoݜоBSCPuCAچ|׮eP a,ݏA{#\YAl͡lX3rJu~a򼒁,LKCPj~S/lݫ#dZ^QkQ^83.#;yO C=,㎭94Dj '"\ie.Wxgj{`7l:uRHO5: ).T>5!sv8|4`;]\FLĢ^i zRZ!Jnmj}^ ;0Mp~EPŎ0(wu|Y뵆6q[rVl;]Wng Y ZYM[k> 5ut^(ke79I_0j_X͙AE.) ߭ap0ÓrOT Nn%T? 1kUO䀻Lŏs)RN()ҥzJH #hM;|H |P~3Jiط9?ώ<1j5%N, [B C'̓ܧ*}\wIԼ e~Sf͠<6`kjk WZ/%>)(B e>kCay 6!X`쓤y ̲*ԚAIuJbn1_J |~xϕ10v@ : f[3 R?J. ~X5Y!DVP/i*Q@Zq(}ǷeG0'[nLXiakb- QWAWUT@='~VJxn)HbϨ.]y#RI1Vrvr@qKɏ~fL: mMxa6ĪheR8 L?]!U.vH (S)q2@6Ís* iQ8vY4afwY`3@nMjo2$Ɏ mV Ӷ?d) lKsH@oCJZymZ-[ A1[il)r׷J1j#AqMr"wPN>;"YYz9Rm+1 i9Rꊈhmz!Z{AH7WJW{ |H:PhKktYhX/C, S A/܋M {>qMԼm3n#Žϵ4; b1su]t=·>$@qˆ\F\zV7Ɣ|.} Hm 8R3F5k- F-Wm»|iN ,ځI@iұJ v?@;7D¶h "-X$z;Rk}yjvu_`|yϞw9kXݾYHծ`(?9] -61-*҅``*r+Z'_'~z3f8 ?AzX_Eʵ,*v`HH# p@Ҭ +,A|!|CÔ iyP@W%|KNyџFhLs Js0T`ˠ9} ߽=9  &Xv >4_!.>F AiM͇>ё(;!bgSP*ZRai zWMloQ#Iȷ>f.Fs``ߜlHˁdײVs${FlE pC (߬_:6/ҁb*  lſRuZ$,ȁ`jh,r^g.[yd(@<B`V1s F(]wbL,h`PWC){S/IN,`i Ϸ5fY2hAT3{MXkҀяD:I^ymr5Rm} EDHuqb Ra[!VKpK${V-lWc8x`q$9n={}߿;?)r֡M]zp;q=/CVC*wMϷn"9X&G$ m/ ,jCbǎ*n+@z8O""- ǂODY"3{2o?3sByR,vZgjejk%׻ >09n@q9 }%`%PHqy-D=1c]lDmb:вR#aAYVȂg> MXs1=@Mo:>!p?[ Q2ةN]n2Jrm>/;' E#4"x=ҡ\Jap[a{^B-`6B2ZXJ9fDz7hv1 -tu  j@+BP iQ g~O ~`V`z ;0.iP)E<ߘl[UEmHR-k4H|=G#Ȃ>g: M\h>9Դg[tÎ#U&Չ~$zGQzw@x`vH/UVcl!95,{ Anr`{",A^p;;g?c.Dt\dCfs{@eҕo?>7e *vLf=[VH:; {LNSl©JpvN֑%%Tw.LPgiLj(ZTɊG"MV,/"JoALN6W0T@B޺X`ۏcbTDl. (((((((h~f U윔Sy׻SlPz<қ49Ȥ6heĪU$@ ): uC8 P b ':"h $g blwQ- ;-P wC\:ſcUZvoXަE\Z,Cd'O N!.5܇B;Vnd%]j%Թw?AĞ})2Yy,KZk)Wo$7;R\?$t$_1jddxUP>,ZVZ 3x0C<yN;?SZVX,dPBƘꈈ]nl+.1|CM;(=059v:*@dYu}PSKd~!c^@ ڱ{gS\tً [ %YbZs$Fmk~6tkxi C`tQPPPPPPE@@@@@@@Jo(oUZ`2[!tU#` Ǿ||Zvne/׆16h85 V*@Fݰ&<'((h{>CAeldR5eE.YA,ѿXR=CPX- ̴BG@41KmWC/Կ >?C*ݿJbPR7H390HD8 $?xゅm @JCG$k Kjdg!|َ#:}nB􆫪ԍ/_ߟB2.H,|n7"7Mf+m*s]09S$d]+I5<ȵX|Cɇ~7oƞ k6ٟZ?IvDs^{NH)6uG,4ƥ6 з~ @;3*vNɹhe@W7! t>*|qk7[bAQ?tHV{:H";F 7'?D 0MP](]D`yG M"vT e@w7V]׍5}(]16l,TsZNar &{ZSG*@\-cѫP*ֈo {t5k׮毭+ h+%q0H3Z$"@rnMy[C\(]*"3^c(@槛Ͽ{>ragX{Rsp2fo#t*Gɦ6[: :ZOP 3_*liI6GyLC4lٟZ}ZPm'vU!qܲ)N(*>, C N$c˴H ܷtsGR )tQPPPPPPE@@@@@@@Ml$Dx1Pb{HẆ>66tRj` Rmq@L  D?ǎkeukMaJ'Q Ҩp䎉L5/c;ؖH,PIy$TسUX蟆*,藢kneVK4;Q3φ(]mυ*vO-lΠ)z(l7+ʤ$GB5b1@ʲAD=~a)hfM'_9% {J,w(ʊA 61p0 F鮈V-<nX&r[ jb@ $gxGj-a#>_e҂|ѷz]. O]իsȑL$l .聈-OR:(Rj (p`yNHhv?K5t:s<xtl  o??Aq" 1.fЌ>ç?2؃t>EvM*?sX]26 ?_}Ǹ5ГOCPW>T>T+ФUm*`-lwfE`[#:i\̞<yW_|\t La҂?l4uco!/}! ,,a&?%VDRg$N>hT$2,D };ЉE"w?͞}kD)Ї:?A~:-V$[ u*`@pTűV ߛN}6lTkZFH@jJ D)RHNDHwĔڱ(>@xtx_k焞NЮ]Mb_QCJ*-rd N YH`* vH#%7jUY՞H'XHb6j!bO,rD+ul |HywON#;w'XMc! (俘ߑ@'+oArF7$IЩCtu2v0 |(_(z5_Abwp$-;oL#<vghyQ@: Yl29ˆvFۊnS f'DӬ( Ƹ(ƒAEL#pwlǴd> CJJmW t^Ȅ=xM}ԴXeX1[RR6+D,|h!H,{]ålU1-ϢR# mlˮzÏa}1fv;߃\zUw_C^{VY&-, Ƽ ~Yj?ag1{He"Y? 't\cj%PZ(:*LJ$`89zi>=ix*V>:ӲRVuJMlTj2h9O *vLK,X3@.KDNm탈pB»Bj7$TOd‡YNlI'BKO h靽^_S5.\d_@6!kؤyȨ>d,$iR.ݗ~.]ϲ֎F~"u@ |HlD9b#y,*w⟪5&[!+=cG@c-u Gg~:}M|N J/>$v(tJP`2eZ(Ƈ>D@@@@@@@@@@@@@@@@@@@@@@@@p rԤz({!S)IO3[bmEZ# "g4@S^6ʻwH"@Ϗb+,_eZ H0PBzPڟD Ǒ>~=6nT.Ehg$4y4 O۲ټ}GǿRP-r~҈Q:͏^KHMs6+KFEAF f Bq,<kb/݇3gOs cXrHt[nCR(+A@$@$R<` 88!Ab.6I8Q?_+PFBlp1- %!]MJS8,gOB? )6~c=O ,Ծۿ]26CaP?t#k.yZUMo`W;.#ivFDt52b_ذYDB'#+3糗_yyT]v9'j: ȳ/gwG`s nCzH$*[,x?{`BC~~-ܪ)/ko4mX"ءl^YeKbd8ƻ }t:-riU3gO!"yy!Q%,&V;"S' RL$|#0O7$Y"O(g=hQuhˋJD%+my;@,Vl S49!"'@\"@dNMΰI3{H@|9 ,jf- Νפ5Hr`9rՊ[;~HVKϲO"{+g["W! bQ 2# o8--j? Av@">z? I `KCs`C,`l]Gpr7R3N#k"Y*O$r-,@naDD``7TW8`W 7[ ҁٸ| 2'&s<&PPPPPPPPPPPPPPPPPPPPPPPPu[F로P18S7UX]SjDkXD α5[!j@$@e>V  t8Yzk;d 3`& gh|j r" d(w)v#U"u3آ^hs6?DD?V!>3ŋBAzToWQ Μ9^{edzY&.6Cfa#͑%zc{{p p窫tQU#YT0$І#+d-(C*?)ܑa|{!kf>Ç>`qe7Yq<RPz#}'$[,W] I]C[ꂘgfZ ~{)wtL  _6r ȁ x[=)X8tb67!;_lF `IپȮ}G}\p^ݖG9GFj бȤ}ɿGx͋ꅬ6? ccUnRTC*p`(!x;7i*!2n"B 2eȄ((((((((((((((((((((((((Op*wzG>eṡ>4<%}e#UN\}IBO'wab+ɭvbJ+%@9"%AEJp3UF}Nr7 O?o*rٽ,(f2ϓ+2|lz@$p}kK*Jwl诇KMTFaHX5 ++ {2,td B,ЕE"s,O/َ$Y OOY?iI/X(pb+שG#$ Q$MN,2ZMyHwR%f p6,sAf[?7j+W//y96v{r{"1 Mo$,a:ȋ@^e#JGeYzIDAT"baSK2C<;$Of;tțd9"> R7^<n(ፈU"*~m_!ށx|HKEw#Cҫ&1fGب"!+#.=wp:qgA;e!2C{-F*粍{=˾?%r 7ZJp7.^J5{yl=dUV>$nEZ%+ЉXZhL?HP\.|;#mk HAvLXd 3eeǛ1|CqF]^  Nm"b'さH @J9"tjNO~ t!+m] gdnlȲ 'duK3'Ͽ!Fφ' ̉շ'"՞H{n]ZU}q_|Wn/#>-V"8Yʢ "9,L|"4lY2m~X~ Ҏ ,{=>̡lv48"7Qy-g2\ Kc<((((((((((((((((((((((((3R0qQ#?6g)^vCIFGQd2K6y߃- nP91d̞lIͶ(C^zsgU.3(r knn8~pHw1J`u :>%@qؓPW й_$%VˉTu|(ܖ@ E3ly}D0h^x X/Dz}@@\EP?X8h Q M}uZָo r&n'j?d}yɭb ɀ?\7r_Xz|9}{ T ?v 5%gz V,("8&v) Hd>=Ȑѽ!q|C> WaΝPZ|`5>k\F";"uJ':.H`qI&y؇!g $㏷N:mбG@j @Vv` N CAevo_䙯LUo`!}gcIj6$ >t.nu^xehU.T+[V>Q'i¢ːoBh6BE\@?$0E*qA&>_w./&h5{fow pIW?\Q JP%m fDLɠiK#'Ռ*}KJv!@zUwWCax K3Hekl@@>!qoLQ c#0qo9CYh櫳Cc2d=$ $nԣВh \|kPZ#yuB9"]*s\ޤn@\#);Y~Q^C#ﻟ=rr4=3A }F aBT*@-C,eay$(fIwz(E@䖢RHޠCiБl2daƒlN߯[0{aG@C4hL?~d 9Oot|_3wq_BYl$@W1@I|KuO"VFb"@>kdX|S!EDNi>R ]٨Pbѥ -Pcj 4@Hz2R٦ÐriG\t Jjbmۋ9dvݼ؇["~0;]\sϰ?D@P9b >̯3 x;1" 5HdE:a<=lw>IaK"Xb  M Zm7iAT+B>rCQ EH@j?(tBwUY=sIɖq@9NVFY9& B@5naMSxCR 1G!]p2P ȢPcۊYdO?: 3gN'@,g>N\  E/%r8ce2}h@ݘВX7iA$)rDPPPPPPPPPPPPPPPPPPPPPPPPPP={->[LaXo@x$V2L$R[a[nG gX*@o rQHW1@tR-rx4EvP4u|C3#`BzݜeCǿɫ blk$D#" 4ByHg F'ڰ%+"< !c접5aIS, xY Qd SiFGluVrbK)|'<SD8w@+#]<@`yX7H@/a<L#b+-6j @]X`hT@DB+U0EE l|c]o|, t_(A#)((((((((((((((((((((((`k=sHCRklJ FJ |(D9dw`Ơ<F)b%|e@vz{U5esB2>Hz=}'@a_> ]|C? ‚! =4h%4rUt$;/17Y9t|C$fGDiidg8ˤk,BcDJy!<:F8]9yw_㾿()Nu[+o4@8/pN j@/ הHHQ7 ( ~Wпyػ7ԋ;bCU-,:#(u|3L ?YY%Oz]bCαFw2z1Hm$uLP͇>fTh`A`< j=JG M us"do}x9ٽ ƇHtF-Yp9"pq "{$Ўkµ,}1(m L9𡏸yZt'iz'M|\/2C>IB>E <ΝPRjIEcbKхP= ' (n˻A{,(:_=EpcL@@o!Y\|o 3дeVzD@@@@@@@@@@@@@@@@@@@@@@@@o{1vd?َKLynu?<MCHX`Mר>FF)" ;T|Z(a Έ._>52_kyHx#ȼA,< Jw3 @&X}ͮL^2;HA.H`(`>̣Ї  Ϸcay$/DbHdpcxhǖ@.52iQː4fςie[e:.|1ʆ}\lX/=7Ȇ@X#<2-|CC{7B\>T6셨Ֆ )⏇CB1(e>_ERy욃{9W@@@:Q: X)f=wGHN|WkFk3D$(ۚZ"ny((p=,addec|TdfW&,~rd:Mp(\biP2ҕiM"#N* 1@YYeZ#1p(<Ԣ0Ϡy{;X8~h͞ʶ=qi<4iWڪ 29(LGc!*E*RGLoHovp`+D,\yv0};w?|._\L:d~ł2f݁<ɣK{`Ͻ? "ĉ27|EF H\$clddE $ i,A"f>04䣳^`Š2[#HZcJ# ]M4*@-{Rj)2BCO,64?h$[[?AwTI)=YU5t Pvϒjfbտ2@-ԼWZU,?7@Bc2,e3cE"CJZ5\1+ŔZWVuHcȏ;ZhT3 E4HNHֲ-9&w_#.SI^ᓂ_? n&>Y<>< W(WN}{H"Y愛!!g [J)M $L*[D@L;VbG#ѹQ9lY2qq] aXee:.}Z`؉E; ]֐\k@M.2|K%uBtu=WaoZmw.rcPpcK<z qD. (((((((M@ב^EAC?P*lq⤿(@٭ 3,Or_҄>zhfPώͮBw(4fL?Kک/H,ƔS;$dxBWZ:)^m)F=+'eW^ANS xgoPFRtp }D>?tDS. (((((((m/1!J&yPB٠WMGx,裊쑈B[aaFUVX10dZlaqnnMY1szA ` SXRܺx?4JW7&T9u`@H^Nu( Hk"+0^҄lNȲh0ɫf-/eo""]zQ0P rHbAշ>Z"FYv SgGG<V"I9K vlܼȄݐ}DBrlXh95?OU) "tD$$e4 ҍD&.{y잗  Yxu~X hqe+Z,+^Z;6yVL7"2Y S)ƤHBHCD`=;rx戓Ph= ߸!3giz@"W8IN?^J5%V>?VxɴeˠUyNW\>8 ̲4HdX oI/K<$$$EJ{zתjWJw[ӋBp$.G.;qpw#ؑv~9ߙ1^'gy^=H~3Fϝ2bR6qY5N J-{&Ai3 %[qxRhD3hL7p; ވfʕUtY#MXBɧ:gVGN?4>Yw-{뭷og7[F+wO Kccvidj Jy;X4"GVwEX06-|7 9?aY̤K}$ !瓋 &ƒ 5Foǚ*e4lT/!zNW GjW5`%2@A2YT{m$'v(z|럞g_9d|k`孁Hڗ5:"J+#ezGVmtAj{]Y}qg1L @]@l!C a>LiHz'/(0FqLq>(" *^;y<0Z;T u/%N >QE߆f,C?&ϖ ٷOPj7&4s-Cj tZث<ñ^Ykw ̀*{7odz &! H^RD*/`ZVԄ)Xv}3n ϱuv$pHЩj m= {DəCw'$oiȃޒ߇X׊3,aCɨ%U|օ:}77( 3g!+~:@{x/+8v[gg|f )Gj}XtHb=Hcw8OlГ5 y`<7D=Z'<D? ĸBV*V^7Ox8O);fBʹOeS?Sht[Ͻ+)B=I4PiE=ǠZݝ^3 DF@@@@@@@P\)h% <nӯLHJ5^ZYR*}+.UA_Ai:O_rk3+ݚr\;(Fy!?oILCrsϵµ@N)}@z6(FkެkaUG껑̺CL۟,4o|ko|ײgwC"7+{S>p<+_g|/B,.Tof[B;$:!!<4v=@xoQ̿(uw|'Qai(Ƙn hjy?F@@@@@@@}pS5nr*72+y_f`9d48_免!.DCT dc) #o={|JJ?ZN`]"@[ =jt1pFjA łb=G :nޓUC*Xi4хFm7]iǟ^D:O  yg( @~O %dQW"~,)hd\8G@*5#p"HZ m~لzwM=FۯKCAtV˞1+S qqVPrPJ>Hխ}C9> ֿc0K|ò9vf5R)D|򝗐-N ?f_FmK@2*Y.$Ou"16ݬ9/ q\t_ ' m߄n0}ܒG((((((h4 2#B\"@jv @[|| #H0˨=is9{_@7y]{k  ;;o#?|)dvqw#|l N?C`5bBwkZUOp,s, `IM?DU P]hTY|pUJ{q\/f !>g<2X|G>萋$# S}#>H=̊"CH1O gُWΰs_XDʺB=^}+k^? • ʹI~G>Bg};P;$ Kg;Dd~~=O8d`>;Kf2]ٻ?k>8|3Qi<$Bگ((((((h4 F)/)DlӴ#O,=VAs  Y8e@&z6H聯loC i\XEP{eEQk`!==r컗vWD^x3_<Гˬ^6HFaVA]v WQ|vKWp# ]/kJ@K_(h($o{_@b^3M^} 3W^&+|{`+ osW ɡ("g,[ , Yg w[ćm"]++aOۚAk*gB˪y7_tlƣ`uͻ%C-6䉴 rW*c _SlY( O.gC?MbөdnDTZVПTxT R*>A_i4 F@@@@@(((((h4!kӳxAH~mȰ۵`PBzu;w @rQ#lspe=pDiwx"y~zgہUt#+y]!44;.ϝ?}nUsYx5uITφϓ~Mw |>&nIb>)wN!SMe;'rw `*ܓȠś9NGxB@QPPPPh4 F@@@@@>0uӣjȴV0ӳP\fBs޻fsœZc޻k ٻXPL톥!}VY$6Etuive C.HpwD8Mpvi5pw, ¡*j_zأ;W_(L FB|H?:390i֏fBͽq\]g8rr[RZ,{ Fha|M BABlΩ_G:cLy <Ogn^濠I߳%!{ؖg,dA\-LǨ{] Z8 X8&z}jڻ_|/UL^ڐ'Cck||V?D7+:% D7ɿڟNǦΉ|3>iM 1rZ3Tf(juI:W-4Fh41'@x 5BG|1hAQ߷T#z}N!AA]+t@D8ۼj~!>e𻶰^^&w`>&]OQ ˾Òt 3uKlHmʐy'nt?e)Ò?3,b9? /e->"u44\hҎ$[8Hmn Cj:^.ms*Ѻ')nnRqULjEh+~W@+| ֶ@3fnv݁4ݶi/cgX bPJq{1ʾҔvI-MuM[8Ȼ>Ɨ{ ;x7M n[g=[ ` ֵ:1BgWӘz_yO$ E!)by rj 1v3{6TVQwKi4Fh4'wQ$ )o^':5z$dqi@7345 aqu81 sHJ [bk"a{kAHzڒ96 )oK+TwSdC&ѿ.#8yQWտ-'zEjҽŌˑHb$G L?M2 T 3k 搁 / om/sU]#j0BV_^& }W`fvB=U>5{םA..t$[IAWS6⑾X0DWyaHZ+J!$֥z7-'g+۔*ѿ.%s`[QW5p* NJN1ӶxS R2ֱ޵st1R,ҹ ~:sh#f ST[>?V%n!=DHe <,+i4F((((h4FDOڻ_,GM۠([ppjR C ^/+^C4͚|.>8UH"=,ldp5sDzϮ'#}$Pj,/YEGoPFDFfԩx wI ө$tNN RmAvZm3V2(6DVY ֳƺS#gk>If$D?(6õMDK;ͩGB M_|iQojML*rOFѮw1`GcBt1PӀ>oA5=nqaP+ьd{6 .+B6Q oк dw%Ag5Vj%ZjM}1oIȽz`ߓ"!9C|x;;!)u:Kbh+[$cp#Kb` _b}XRYD2qtΤ!^2+t^5<:i4FQPPPh4F]s!1ҫ;fNnS/C6/Tq [%Ej 5|2taHt4KBzC``)1P I  5>>VDrZ \׳̐i#[jS >+#94nrE S,R`gxę 2$ؖ;]*e#[{yHJ:׳OT4U;K4ajA:pH5 >5L%Fx?vc%R>ٻʣ @?Hm%J-t䠪.'N&ӌ@0#11~ 2^FĆK$L"BZgZ3CCyfa.U("%v).D^zOW-FF5vyGWӹޕǶHD3K_MWCmSm G |>K&DD>Fh4 Fh> O&b&/o[ѬodTrK,]v\Rae9ʁ\NV녨z>%5lb\H` Hj2Cg[EV18]*\Jdr?@`Sgj}u6s?6@Cld15[}B*rNkAhbKc "ְʐlh+X`$D?ZGÐVBʴ'e]HYW2(.AnzIIq ԰p8C'oWNG2J*:%dPL=G!%aYH~+:!7V4?m2O!]q|#ch T #xW!BLAzdFVGl{RFbIb "8[$}Pxpcp~pRc⠥G[PK=!–kfK" K>\<}Ev xD;ɚNVubU.W*  Fj/flo!dh*sPJ!..brX~zH;EH(HJ1ZeK79#*WVF۽YGH7ulW \Ks1/cq횏>Խ;B=K?K:Π0 EY]OReeǑ6/VŔMH~ˬvD2*;,eHlQz?\X$IiN/@rJYnY$lx(ђC0bn4F((((h4F>0^Ї 8ʆ]l2pPZa. _ QXdA{y?G5Tb˒KJ;$ʎe8"9uάPZDf˅D <%HNY8HDñ%$yF}t2~cp5? #WcPچ Zlze#Hj ,p I$,wh >t?HyccuBiu `uq1ϩ2zAH(KO1//f?N. N&͂ARJDɶFbsWyHB-KT*E\\$̋˭:W_q Mro@??P Bh4 Fh4 F__ѹ3gTmt*%͖pq $-GQuaIG?rQiG#,40|E;")Ǹ;PPa?Xy&c2)oyG@-Ƙ@)J_ΠOsqw BpEd!$&Qga@P*sdp蟇s F`A|߿7߼}ntΏ!sɉATe;T~"*[]odT۰ ,Ԇ%`'xXV".F":(NHl=zt O"42iΝ+r7SR*QEɻ\h3vHn]=p5XrDJ ; ?wКKPA2˽#U" 3 Fh4F>?'3y_?CH5jnvfP]9N{VCǘmߋeTٲ ,Ex_ &w@@gw@1P*YEHp_ K9`"p/ ~l&'-ي9Yj2RJ퐤bdQ$›՜@/Ph4uv/L} jp3]4AN\#p@*:X+ngX^˩2!={jݻU < ˱"ӎ@Yd2}\L.^x{ ^Ľ e)~|7Rq~ 2'<=#⏭@O+wcr%HN7Sb5Ց! Fh4 Fh4IM=^f͔+{פ+SOpP˸3'P^'>GVڎ:,aR-}z]R3kEeX@9p "Dz;KrOSaH~](* -\wY<'( IEEyHjDFDfejc\Z W ڈ 硽8Khk<:0͸1H;A| ՘ krFY]V*;2=:@Ȕ*,ցe`);:#\tKkwNt&%(0(2c?.}/s/ރJ)x%Va'U:z':HV1.Q6 >Ba]y(,F((((h4F((((h4O?|/( ͺqP](kte-|@Q4Z>*308!%:'VŔ*j{$nB@(Ȏ '\Lag}@plH}ʩR(:kBqr Tt#,V(ɮskrB gf'$ў˩ETY:)nPTuhK ~уAn2Gn{'\j "aPޙcE!\bR]G.6fɔ@?5Rkb_rogPtsLC\bң,ɬc5X^DADQ )3TsyMǐ/+#%C4F@@@@h4F@@@@hW g/|\Q;<_pywN7ΐً ne krCqC+kwe.ordvXK/sER(6*E䈺:70(>9>](0RvA6,kr`XQDI+Rs??)8rj;͟U"e͑CQq!'_xFѮ5(|!!  Or \΀;tgjb@}n|`|豂'D΀*Q;q;Plrwz3";^^o>ל< *2(?s!m-XEBppr^AZG}R@q4F@@@@h4F@@@@h:>dqܵ޵ KXǢ L. tHیXkÚn|4u&7T|A)ͩGw { R)msb:gTRm`5ݞ"Fwc\6`H:B? FbI^{ǚ/FTP"@itbHFōf7K1(숙 ep *hcj{D8ŷYVvIXm R@B;"5BtE 4F@@@@h4F@@@@h~}ٵ _׽5 /Πvʃi&1'k=$Vv#&<¶ ɩu㒋vJ$g$E>͉Ux#ƚAYu]H [1THe z%<%$H}'@.\ 3ƞHJ}BG(..."u%4 N! u6h vi*4F@@@@h4`gC5/.…kPBЇrkݥPĸ;hm0EZkeFs9FWitSh4?rvV*{g׸ 7Ky0hme,x"s|`m3 ͤN`#y@W%mNʕiTmN+s9%:FtKa%1KwRay{#ٞAJ13Bmv\i=Xu3R&4)-<4xq媌HCokDۢ/TFS\?F((((h4F(((h4@߂zn  $ؘ("w@-P|νɷ\tB+;h4 Fh4 F ?W?Sw ]><aQ- 6P[gp*tH|fb)`CO}`Pgo\9qT`L81Wbq/  HWbZLQ G{e[/'/ LQ"F :-y%XcA}~onˎ3Êێ (~AX@lPM or2אǮP۠gL17A)?!9yƩIHU f`6ThsbPɕ,hL$ Ƽ%6 ]w j0ۃBm(c]8Xy5nh4F((((h4FnJ&f̭~8W`\ݽgXVxAKܓ- /fm3>fp94 ysȠ7Wӭ؁*;=v ծO2n!|HIuJk/ԃ!z8_ 5 xL D5 OQþmWď<8!\L;Z8H5hA }Tt(Ii&Kcn?TA?FNx ѐ~wy aɛم: m~y ȥ Y_ 픿j 5z.@]>o0HrV1 f&XZ}\|{:XσhLKcPBL> fD°vUPN7l4рכ6*T栶\bq Z 1O sA\(/ 3шf k{v*T=T⼚Yc{ʭOB^n6- iCPˈ -/třDw$zV9fTi+J7dθOE3JMחr{R*[E4vs>&U2p@z$@{Iˈ_j؛ZG YLWRPRa.rφτ p^b#])T}"Amcɬ; VSPQ{^A~෕YrfTn&0NLd\cJ:N3<\dLE"Ż!S'Ζr5A@Q c^1W4F@@@h4 FQPPh4E31ՠsx%M&Aiz8'׆$N楈$?s&terƹ,kFJ;zf$Ơ`L|C̒K)SCPۄOfxԵq! FoMWh<[AsWI,>V/(6pyh+iCqN4{{C:mKh45{Upses&T^_ 4#X"'R,LgKgrxH\>OtMJ' jAu2*ů/ n}W@?z}7g4m?hbnR-= VϵH,?ތ,)n܆6L@各LѴ4r7,چ(ܜ:[0 -ʬD3Rz}!l]x~uFɽRi.I NU5=aaJ)Ae$aH#XbH4\X)u66ܚݫ=j u.d #4pdșAd;{TJ=4׾C-yKoOh4F(((h4F@@@h' 䮖~d+Ts{CW]P`-b:_)Hq? 9[ MW?o"}iA)wMn%|-h2)nEkF8p~q>, K@h4F@@@h4 Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4Fh4  AʎIENDB`project.properties000066400000000000000000000010631272147170000350710ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/000077500000000000000000000000001272147170000321555ustar00rootroot00000000000000drawable-hdpi/000077500000000000000000000000001272147170000346015ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/resic_launcher.png000066400000000000000000000200311272147170000375570ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/drawable-hdpiPNG  IHDRHHUGIDATxTUM&L2M^*MʥDD@TTH;Hol 5DFcI4{)rfEc2ɛ"oސs=>ammmCu'g7!bā^ 6?6s9#Y:EoyCƶ6d-ӔC$ZlӰfa쳐{uސMMs>63|4kgƫ}>oIHUFɭ{-{,0|wCHƩQԋ^,F#]A?ɔr䩷ƦS.48 {sH FK\=&^U&}Ewϐ =A泇ADuw_Gc1w#e.$<ǗWVo1}^-i} w|o{/{ !{1ׅ$*3ʝ #x'z|߶]wg/jkSY!}Ѕ#UK=>t&'\H)Q ]H9)x0犃}]]ܮ-eoCU=/j}>Aɷ,B h.ZcIsn![u;o:Jzѡ.!ʮ o pixB*nRz]'W)Dއ=l1_\ÚQ7 JS|0p?{p>])ttn^N>Xrvjߩ[ܬ!Z{"gsNp1OJϦaWE߅v` Ƒ~_8{q?7]4-W$ׁ璧x}_ pγQ{ǰ׳hp}} }䅝?M;θsUW\МI5g&cͩIXy+~,xZX~$GF,\oN#>Y_P~^^Iz1O8p֙_sӬ9cg ֞@m P/PW@Kc9GXsrVg6Xv1G^3,e/Pe Q+ A)ƅɟIzTlSڏ^ ˭8jc,y+[RXQ;a''2XP>5` hձXK0˿neo u]ƨ[ Q>eeHizEq{f4?:pZv`%{6E3 s`AbIaE񃭐>,ڏPF֤+jaNv0mE*mR2Z5Pqܴwa*+לҿ @_q#y!Z5B~cZ$AXߙbwf ҇҃,,Tbi!0ͤkC :ʿC:BN&qI]fo/K3v1&=Eէ9NXBbo%>@]Ϲ.I<gQćL=,qjrњmzu;hT># cgBga:fg&2i%SL9H9[0oBROZԩH]U.xF*ͽؿ]Amd|uiWNr?u;]TA?7A2ކ }o/ι.jp=X\^z}rŤr+d4!g.=Tm1EӢM,H]ȺS~),O^􍉠Vwwz( pқu_BC$^8!~{Yy޽%Hpi܁3%T#Tnkt!gt%wߏ;pl~ͩ\^KI2M UuhŨKf~FpH%O3ƟBsM GYL n0Sg0i?yظ}Vf#)pSc?XO$p iz ū~h;l%xg XLK*[4}I-] ~1jÒVhk$o].BfPΊNs]ѽln)[-Z2 `8{(M 6@P7a4s5awX~C`4>d>_sbb^ p<$"H6j^vBՅu/MP͈<rkj#dP{޶ VkIF6UM$׫Ab3BL9%TmgzG-KKvu*9q;ϤY_WW< l\֜DnBg]q)u3,"M-WGp 'AY?TzJm@&zzt:Xɇ9e_2P;4GۮI5>0UrveNa4+6RУESѧBk LݍS}ZD5eЭZ{fu™#ŠsZ6Zh#{R`t,,D`<+; XN~_ ;Abc$K@;3bsչ([ASO +lsY\x6_^Hr]Wh+a/ @8af6'?a*"Q񕚈(D@O}ڏg`}KQYЦcBsz[`n;S20APӐ#4;RhA3c*4^&s \AERgǸ7M֨ޛB/Ԥ3 ,tk4Pq&t><^l9-8 [f#-|VsKk[!S?Yw/NlAc2-"@tTYBȇP5jq:Ĝ7p]@ҍҮKй-wmteiSPan R 8R'N9$[AL]7SOL`;7UŻ#p%VӚ'ԓTBVAxx:aډH!'ʵ[4T+x%w|4B2YQSFTyf+*$9-gPPcuwG 3E.RԓXK*TV4H6,% VșgH?pa7 g.]= UDROBy;zʦ$x(lfd0xaD`#m>TftXaIJ/>1$ԨЙS4i>,~KbZƱB<K3@vD hPTJkqsd@ TD&eBha [g>^EPO|22+p "?$p(_C zى~k*"!@,QEB3D d/W1sZRa$}ws{%v):eLZL  QVdi ov_X?$u\~ !YDPb-K9 ,($bil&@Xf ]>(芜;$Vn_J*XL]YH6{FJ挝1Z>[ 3Tf,bCŋ+ @mb/gOvD!(]ATYL]qEyhunLWhnzm.k>ĀhգŖI&Zu p0H 7XgY&,υ*!9%%@1z3~Ji 31iI9 *:ǐ_7eFHүY!ǚpvdc HV /Ud_l:ǖZgZ56ӾM0;Z%/0rP(Yv9}Yf}  3 C*b?( 8u4g͋SfH(Ҥ&}}8Jc1#D!(M 2,DQY#p2k7M&xXV/LkhJs*0OTg[?܃Lf9_#=H8vݨa}UEMqI_HDFU[>RDYX_@DpnݹErkϘ/T U,A= rzlF CznvBO R덑RgSzS$TXafz\P/:2ōSBA|+\l ;/M?Y޼tuDX" jgV#IH2E!)5HFZ-vHoGF29"^[jG$OX {Eh:Vvq8,]F}4&L i jU$VKC.X2p3G}\Fq$#"OpsxGŔOhWf a?s4k wWڀN/,υ)`n|0+r,掅 &LՔ]V8'3c;ٸI;fqBL=Jfq-l( E+"@VE(Cۼ9n2]F7smd43B1+B0}8+X4UU_E/TIf(vd<R0;RSa1 Kr4q P=ci9;RqJKToxDJxq@իgfĔ)Q #XYƒ3iJUOV#G7Mfv ͎C`1dn*7)dʜ 荊I54.Re#ThUA`29=HE}ؐls|oAFST^oBs.@Ud$)³%1ǧɛzɂlM<)jg.эKqsMQ-ǰ17e[NF;)p: æ;J[w]06Tk|REnnΒ>KIs*23/.#($T+4h{Gg *o'l(QbS8mmm7р\ 'IENDB`drawable-ldpi/000077500000000000000000000000001272147170000346055ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/resic_launcher.png000066400000000000000000000047751272147170000376040ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/drawable-ldpiPNG  IHDR$$ IDATxyPTW1ˤ2,SfI\)}ieqCEQٛ i}kiQYZ݀EѨcLY'jf$!lvXɘL&5Tͭuss{oNT׻~ꥯ `0E@mETpF\jJf?`o7n-h 8 ǾvőcN29:+s0; c~4 [=荮f ߉ԽQ.HfoVuuݵ;|?g!Bu8`N}끎{8~g=}h3(nE~ iRۡ~׷;}4`6ha/o$ ~8=j/byK(;Vpa}.yO^̚њ>s.Y5hlGF;ۡ-kY@yj)J"iDK!}r^?w|k#6P\{Uۮ KὓUދX΃XeNO;{p~:ClhD p+l @r&u\5Zy5:5}hM;u΀+ZƁ.hV`ϧ6 4CN \gҩ E*֐+ek]}ӧ [-d4p,qqWf#O['Pve'ʎ[;(:,$27En H"4:0,529lboє@gBe5 4:6RhڈtK?H`rulO߀txmVkd6-#"`ZXP?h:i"q\)x/AIeS 0֊̼d{ٚ\8 =7C"D 60=P8+a#( 2&U,5QLL >+kf0.4E-f?lWptv'*Kquj5ԉBe-!b L$(['q>Kc~,~vFx&>dQ!ɦ>뉼o06>ΞZIUŵ>Agw=Ɵ#Jb1H[Be0AF=P>O|;S{]ҷpr5<#q%kLF>A}2H|v #?ƦDILqƒGb.{~"syߞfZ%*vI0~HHu7zܤM@,1 & yr`2jyؙ˛9 'ULYB8~IJX^HI=ߞB@tlQ "7r0xmJ̾KTI! ِ"Y75"$;cjzB%1S DHdJϟL!:O=T%Jӫ1tdi7p$LjZRa2},ȪqxF~@#CkQ 1B$չ,ves$J+]Du#YV1-VW3r-o _Y<\̀-e/ 1bsmp(jlh||G;k&5'gDoΞO ޹k|^Ţ_ }Qc|ϱav}j{&Z2YX@9F5-.T=Tu9iȮʛH^Wgzv*j3,<2i1|1waGI!d6#{HQA_9ʳd˯>p}EtnIO{~ʯ2!w9,owG6zI*b޸mV^'}UbBA$.82\]W9SpIꤐ߿"+0XxQda ]Z|!f3{3㉒`2"nԸ'ΎX,>Q CYzN ء"캰 GMQWj./+x)ݕj¯8vF=p7*|4{a;>8s+ƃ!|pN^=dmƖf?(_[ڡ[+ޫ6wWGUg쿾n2:_}.se v|ݟ-3 ո;r(.AV.S"h}"u{p狅LE t_a5l]ёsɁۢSZ@@aSl7T~mY.~x SG[NS1#ZAǧT]YY`kznO,J?14oTퟍY(ئ zHmEdi>T;`C#Əɫ&h:aF |'>,9y Qe{ QC"VmjDVg"Sfm$Vi]Pc| قA˴~l#lA~i}}*CVeM8aw`dtބhMߠ*4$7 _u}&vom, |%xFb¢̦(;rD„dN9Nc~%hVd6w̻M6]ʪ;bLZ7C:o٣3G2'\pF9GtcsQ;`Nr2FnC}* Vǀ{=A HS&PԷZLz>D>9=&)sp.w顴W{ HY+5DNCǀր;U'[&U^IJT>4^-UCrN@ GpZIk҂N {ĴNyMPjHݮn ztQCmhn2Gסj#.STub. cTs5jӚ DVn tݼ?QĤ4h!ܺ"!#v$Y' bt od,.=4'_nT 14zοK'Fm$ՊI>Z!PNUFŒե3>qyv[ߗ$7zYD^`yK2EL FQ )h?Ͽ=8^ `8}i;jv$iPߤ mbB{w5ے뵸eI{x#fo<*}N^$ QH^0ç&XyKik!{6Gk7t[ב[ %ǕG9D-'Uݳ*nA[۷^zl}/(6%0!$jd6+㩍"2hԥN ؊,gD;wnrGh7#BRS`硚4#V:T]dHO@OOПswT&Y\>]h͊O 0v^cت֤ÕR"L tҧme <&GӒ&fdU=NaẾ 9Xy=G7\8K ,GH0D$/{HN/On3M@*>yO*fMͤnQu j*<_F7p˳f2˧Ky+z=FI¬+WĚDF,צ odAᚣvD7Uj( uBJrMJuPߞ7rDkOܵo$+f[8D 4يtQ G;n5YͫcMLx"3bE8oG^IJ/VtQksNlewj/JA&ز #t.|_td&G ,#Tnx뼈,Ӥ%R/cS*RdOVnjavo*EݭٜHH"R!΄=:y=QQX*sW?lwf8aq ,} n0Y_CX:MPK ,W{?g:<&b{M.bK#yT.vC^fboƂcC.k2+cߣٗ?)0ɕP̘b`D&5!&/y_B@~ W)R4SBI%^, 4e̞ J2,XEd> /wPflredeÁ2l70<$e!sWIVui&B/eMb '7?xN#IENDB`drawable-xhdpi/000077500000000000000000000000001272147170000347715ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/resic_launcher.png000066400000000000000000000323731272147170000377630ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/drawable-xhdpiPNG  IHDR``w84IDATx|TgvW !M\ $!ĕM @-ŭC ̽=Ͻ3$o߷t-~N'$3s#&?n7x ~pG{bO'y~ {VW qmVÜFJ0ǁ糂?,Xrҽr@>ػ={8s_㹇j515kJ|m^(za-_~(|vetl3~0ŏsjY(xUt `ޓ!F7~=s{P:s.3×+yOoQ{Qد+[`a6u0QoE @Х2&l]CShv{fڵ@1 A Xs=⭽tiZυ}: k 5}ֻ[ղEKV-AJPgPJ?hCGPt>܃B;6λ y72HI=(l[ٻlߩ<8SIIz{oTT2_'e]&7k{>~\aD>‡Oz hER IELxPg:>|z=wZSw [k/s}'U RGS]s7=]ؐ|CȽr)@B<,>d '>Nph{8,pp[d/CPx K'Ϡ~BO p9NAЏO@[?p4 OvG`;޳7߱]0?d=ctet)7!a(iCOAQw ~^}bDP9h ia>E5N@IQ(nsEEc<<v8>*{z!wylg:l +[SgT ͍TVQ82 B5ȣ~q1p @ F St8gI cC"bg1(>pö.z4Xy7Շ:TjMdz{R'ˢ,j7w?tJ8}?EE`\ >_#(?Q`Hc'Ўap ?J|_ vݟ ΰ` :K|8x 6fеKZ@ZMl>YYgͧ4i*:4E;~Vag-8>uIAC  s _?CÁp?=`Oz X^t3r<~~ qt2:wC@RM*EI& ^RЖ[.懞]>&H? 0?߳fgGFl0OI1D|Sb$~(} zBn2*B|<-Im=&KЫ' ٿ}k˳0~#z9󀜱@;7]ս;:Rus'1=ڭg>&ӻ K#B n)"'³)ڶ =:kc܏2԰BN p J˓xDOZk$!'*-߅;gW 9 mY:;.M7 %Pj|roANe*-Ït*׎^moX{aռY ڷk3 vpz>c={ XmC#b3^.tR`1mz= |"ZUg/@v 41JJO[:I#rQ? A֒[w&d:I>lƥww,;kݻHn sJ{( } -(|zr$ɾ3ol}ى&!ov5ϳ[^=(J2ڱ]5@}F"#&։|Qi٤Ǵktwa3 5 ] R4 Rbg(|qf? ^1{{=9 K]CϼwS.ZPmڨQT]_`c)R^$|{ċXiYGN#nW-ӭN,U@y/HaaM"(gO=tTS{i)`*>2"^ |%(P25Hրzl Yh֮ mժ M:R I5ZP EZxp'Y9%j2I,q`vq:,1w"]Ps&{x~+ unߦK-x-lxB_}v }u7^xk/8k/<wQ kFr{T%p[Z7[WYj+m5k|>?q?/_||1|#xOɟ)> E70~ҧOz˯?}> _k=> _80-8Nh9?I[LWRՂ Ub {Xg bAe)SAS;fK 癒ݼ{wVbڷP$]t{; 47AQIuCr[vjӭ׽i<-lʬ?l7P2_xp7A$)`2L x0q mƁ՗ecږ_g} \q`=ƃ*17EB]* 5 ެ.eSew*CjP@$O`4Q1@96QN"5M`J[Kh-P U#Zj7\د;?5;uCsRm| EZ8b-nb:N*֤HK?t]7|r :#];ui9`dgjY"ú=daQ^/fj:83$C*UЋc3;T.oGOnf ^݇sK`Da4*P|W/&L?lP|"'4?Lv(O [L!VT #J Di^T 뿿5٥t\%_&*N5#8)ݪk0>eFD +Y$0ݽo쁡w@ ]c=|hƼǼ9JꌑKEB@@:d L/)y׫L'O^V2Y }fZ2 *3-hz ` NmjS~H(]FAe(XABSBy(ǃNµGL&A@> ?^ T@;R.9V>a`$ 50j46AH7#Q8&̲zt eb%9D?b|NEqf+qT05 ̦:|_"p9x>9ME' h>\} v՞ve@PƁ;Sh _Tay7w]G-\cK(>ڤdQ `>#\O"mZIYE=4F:,`{׏CY[0Xy~ ` tb##ݻKWG6Xp4> ru"Rm%Ƙ,SEtE-f @ YBJakc1^Ez΁F$ilye 0jzفDXȁ5pAF,r %yՁx@a&rݛn"rl%! ?%݇!^ Wv@,|UFG EȼФ%tUdHoV 5iroTnQB')5 %:(SQ|!Q%ye8#LI "ǷaFH44w>ֈACu:lٹJ}+F*lax( |CT XLPm qF,EKpU LoGܬC#@6UO~ `Amkܣ Gr, V3bSޤ<ݩDhaS1Y,P~)>-,z,X)fe Ype*ȫ H*eƝ (6BXX### $k0B&Py ؐ7q,@'&F "Щ\?~#;bc?h[\INcĖ+bL]9KNiA>[JЀi|o8we?[͇M5|ظuU0mɱepQLEc@/_q`JT0p! k$WCL8ԕb"eNj"~v &OZ ABe,1@6"cȷ( Zjx'X<33= jyHEIIUP$jR2L .Ҋ/4" f%A_C$f-D@~қ fi)BSbhc=XrSx|MmRa /@p. AΨNWl3B,k_8xNe oGhc''^jY@XN0țCXbd>WbR,UbWФe+l*韌d _HzT]:u)@.{\&y<")s*3)9-։mEz8/P◧B <%&YDփRfXBl 1Y9 !ZO]]0 &[nb4R" iɔs *HG H ;)@b 8wm翷6/{~tO$Diu\HB. ELd#@^r  тj5,݇u_ICL]KNk^I<UAx4:z) HDW@Tva}ud<I|5x&Dsq ,.]XnvFTJ Di7BWVM}(,ü9X@üOVҤ˓Rd(^6,-9sd30D@7*)'CtYTgc^_Zx->~hhpq({ h J[H,N$ lfNrU?B|P0JAH\t3]mGg4Q eg1{R ]?{|'/!J[BՆlM:8]OV=cT(`6&5YLJRW~۹Vh aӐ( JȔ\V4_faņnc"Ȓé?@׼rO)!S!$[@BR*l!؎L4rhחw`gBTN`Vc} ;.X)4 ֳk[|NG> 1J.hߚy[&m${UBmK#CnwFQbj9v;8ܽ!JgK$:@R)$N\{0c3[^1 W&ߠk*#IuLhM@찉,Klg`' қ1˂_f!mveBt ;P"8%dˑ#0sj 8R ŗb5H,GA`c ZQ*oΉ4©9@k(HnPx($֬ĜKH`jE;祑r9$ÈTG>E6CT* *KŚsOT1*( ĕ+c7Q_lISᙦ#1r[ݢ$@^mLiWHAT"Pc@ZRz9ZdkAk%Xz Z:J51y(>O-e4AF\$Bb.ĕiAfг3u}7݈͊?JWaa) e< QiՖYo V`ƅzC?kCaY#bf4@fdCv ޛ,! ֐b Y֐Vg)Xnq&]hDGS5e( HSlP\E1Fw*ʒ mfQc.o YvfK8IJ&:ٖifO9yΐCs67ksV7mq~+3H*bхz#5s5]q?$n :ƃsD;U :, z:d9"ȃ&ٝkI΢ <oӗ.{/*0V1'ā'~+3 ix!Yjv eq|.?o޲&!zl q`V4oqpT ҃<.Fg/d78_m]ku~!d:b:C%c!zn ' Ӽ>:tw&C+o^ D9^q紘G!B Lc813g M{I͝ך[gXab\e2-|ZRęy3O@p'23&xuuFqodwBe^ɕwR'g8FLo[t~<M┮"%*V\hO0r\ԲZ ``a*\zXMΈL u'_E 27Bpʚ)aV$! $CX88HPTGudE=Q/iIi($L;(y:{ -Oxk5䷘ވ.v*Ε"%gG1{ N$H`DN`EmŦh1mwlM^`7JC$p J =r7d!\J!PBr_xI[8Obؒ72P} D[@\/Qh`'.!S5\ ܣOB,&C{ |5vݖ7j @2Y*\OA ^, 6S(̴Wuzum31p"M/>QV3F6VYHjYԏ)#9Kt$3Beb*Q'y'ЮO|dC@&_h__F Wq(KiS_}#N)Y$_?'(]i_AHGkBlĕk2T_Yz5R\xIy m|Etr-:ƘNҥ5}AB Ԕ5ծMMxZ΢,,RW^_4Κl`VMV;*͑nv*~I1[y#i\c38[rvʒBI6tR-\6NpKG"rLKV%ga|M^+V/ej :y9tͼ`?.xZm)2_g3qC"$5! U1$K4"hqLʘ\LM^Z=U?)}XY m^R=%=6\ base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/menu/000077500000000000000000000000001272147170000331215ustar00rootroot00000000000000activity_main.xml000066400000000000000000000020441272147170000364240ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/menu values-v11/000077500000000000000000000000001272147170000340025ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/resstyles.xml000066400000000000000000000021561272147170000360530ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/values-v11 values-v14/000077500000000000000000000000001272147170000340055ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/resstyles.xml000066400000000000000000000022471272147170000360570ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/values-v14 base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/values/000077500000000000000000000000001272147170000334545ustar00rootroot00000000000000strings.xml000066400000000000000000000020371272147170000356120ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/values NotificationServiceNativePlatformAndr Hello world! Settings styles.xml000066400000000000000000000027221272147170000354450ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/res/values base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/000077500000000000000000000000001272147170000321535ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/com/000077500000000000000000000000001272147170000327315ustar00rootroot00000000000000example/000077500000000000000000000000001272147170000343055ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/comnotificationservicenativeplatformandr/000077500000000000000000000000001272147170000441755ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/com/exampleMainActivity.java000066400000000000000000000027661272147170000474540ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/com/example/notificationservicenativeplatformandr/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package com.example.notificationservicenativeplatformandr; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/000077500000000000000000000000001272147170000327425ustar00rootroot00000000000000alljoyn/000077500000000000000000000000001272147170000343335ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/orgns/000077500000000000000000000000001272147170000347535ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/alljoynnativeplatform/000077500000000000000000000000001272147170000400065ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/alljoyn/nsAndroidLogger.java000066400000000000000000000040641272147170000433750ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/alljoyn/ns/nativeplatform/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.nativeplatform; import org.alljoyn.ns.commons.GenericLogger; import android.util.Log; /** * Android implementation of the {@link GenericLogger} interface */ public class AndroidLogger implements GenericLogger { /** * @see org.alljoyn.ns.commons.GenericLogger#debug(java.lang.String, java.lang.String) */ @Override public void debug(String TAG, String msg) { Log.d(TAG, msg); } /** * @see org.alljoyn.ns.commons.GenericLogger#info(java.lang.String, java.lang.String) */ @Override public void info(String TAG, String msg) { Log.i(TAG, msg); } /** * @see org.alljoyn.ns.commons.GenericLogger#warn(java.lang.String, java.lang.String) */ @Override public void warn(String TAG, String msg) { Log.w(TAG, msg); } /** * @see org.alljoyn.ns.commons.GenericLogger#error(java.lang.String, java.lang.String) */ @Override public void error(String TAG, String msg) { Log.e(TAG, msg); } /** * @see org.alljoyn.ns.commons.GenericLogger#fatal(java.lang.String, java.lang.String) */ @Override public void fatal(String TAG, String msg) { Log.wtf(TAG, msg); } } NativePlatformAndroid.java000066400000000000000000000027541272147170000451150ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/alljoyn/ns/nativeplatform/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ns.nativeplatform; import org.alljoyn.ns.commons.NativePlatform; import org.alljoyn.ns.commons.NativePlatformAbstrImpl; /** * Android implementation of the {@link NativePlatform} interface */ public class NativePlatformAndroid extends NativePlatformAbstrImpl { /** * Constructor */ public NativePlatformAndroid() { super(); } /** * @see org.alljoyn.ns.commons.NativePlatformAbstrImpl#createLogger() */ @Override protected void createLogger() { logger = new AndroidLogger(); }//createLogger } package-info.java000066400000000000000000000023471272147170000432030ustar00rootroot00000000000000base-16.04/notification/java/native_platform/NotificationServiceNativePlatformAndroid/src/org/alljoyn/ns/nativeplatform/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ /** * The package includes classes with the platform dependent logic. * The Notification service is written in pure java v1.6.
* This package provides platform dependent logic, e.g. logs for Android platform */ package org.alljoyn.ns.nativeplatform;base-16.04/notification/java/sample_applications/000077500000000000000000000000001272147170000220755ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/000077500000000000000000000000001272147170000235155ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/000077500000000000000000000000001272147170000310645ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/.classpath000066400000000000000000000024621272147170000330530ustar00rootroot00000000000000 base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/.project000066400000000000000000000014761272147170000325430ustar00rootroot00000000000000 NotificationServiceUISample com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/.settings/000077500000000000000000000000001272147170000330025ustar00rootroot00000000000000org.eclipse.jdt.core.prefs000066400000000000000000000011511272147170000377030ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/.settings#Wed Mar 06 10:29:27 IST 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 AndroidManifest.xml000066400000000000000000000046021272147170000346000ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/assets/000077500000000000000000000000001272147170000323665ustar00rootroot00000000000000Config.xml000066400000000000000000000053621272147170000342440ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/assets 000000 en Thermostat 4564545455454 service tester Thermostat on second floor Thermostat sur le deuxième étage טרמוסטט בקומה שנייה الحرارة على الطابق الثاني BestThermostat 1.1.12.4 10/10/2014 2.2.2.2 3.3.3.3 http://www.alljoyn.org 00.01 base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/build.xml000066400000000000000000000121561272147170000327120ustar00rootroot00000000000000 ic_launcher-web.png000066400000000000000000000030601272147170000345410ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISamplePNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`project.properties000066400000000000000000000011411272147170000345660ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 #android.library.reference.1=../gridlayout_v7 base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/000077500000000000000000000000001272147170000316555ustar00rootroot00000000000000drawable-hdpi/000077500000000000000000000000001272147170000343015ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/resic_launcher.png000066400000000000000000000022661272147170000372710ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/drawable-hdpiPNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`drawable-ldpi/000077500000000000000000000000001272147170000343055ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/resic_launcher.png000066400000000000000000000022661272147170000372750ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/drawable-ldpiPNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`drawable-mdpi/000077500000000000000000000000001272147170000343065ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/resic_launcher.png000066400000000000000000000022661272147170000372760ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/drawable-mdpiPNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`drawable-xhdpi/000077500000000000000000000000001272147170000344715ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/resic_launcher.png000066400000000000000000000030601272147170000374520ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/drawable-xhdpiPNG  IHDR``motRNSn pHYs  IDATx[KKIBZ5M5B@DZȭ(j6f\1:n||,u۟5)NkHeO[M)i(sżԅF i80CL4УqnzV L ?xϡdQYHӊq3[Z8QU峨Zp lvD8!IhA YY>rE}s҅Y;`h@*΂T@Z Vu˷B V~'@%Dˏ@ \kgAN FU5l<^HZZ*V,ŀfH ΂J'kN e>X Uu Uu-_@R}u2o,ְz2|EhZFt4]|kgAj E F^#M2 ,%N6I{'߿$N wXy4^6I2~߿aYLznCEUB|dT3gkSĉ4L}|4WE32>lc \3{wC;Y4>[ 7lme-@u3cqw+Ϛ@wB(@rX %Д% {n!fÒ6C 0Dއiͅ-n6W^C+52 iIm d`{ Ɩ,J.@<1fVE;``_ДQ^_剉`( NAa3 ~Aa32Ƃf'8fVS yu#bd ˦IENDB`base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/layout/000077500000000000000000000000001272147170000331725ustar00rootroot00000000000000activity_control_panel.xml000066400000000000000000000050651272147170000404160ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/layout activity_main.xml000066400000000000000000000236241272147170000365040ustar00rootroot00000000000000base-16.04/notification/java/sample_applications/android/NotificationServiceUISample/res/layout base-16.04/onboarding/ios/samples/sampleApp/MainViewController.h000066400000000000000000000026741272147170000247060ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusListener.h" #import "alljoyn/about/AJNAnnouncementListener.h" @interface MainViewController : UIViewController @property (weak, nonatomic) IBOutlet UIButton *connectButton; @property (weak, nonatomic) IBOutlet UITableView *servicesTable; - (IBAction)connectButtonDidTouchUpInside:(id)sender; @property (weak, nonatomic) IBOutlet UILabel *instructionsLabel; @end base-16.04/onboarding/ios/samples/sampleApp/MainViewController.m000066400000000000000000000673161272147170000247170ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "MainViewController.h" #import "SystemConfiguration/CaptiveNetwork.h" #import "AJNStatus.h" #import "alljoyn/about/AJNAnnouncement.h" #import "alljoyn/about/AJNAnnouncementReceiver.h" #import "alljoyn/about/AJNAboutDataConverter.h" #import "ClientInformation.h" #import "AnnounceTextViewController.h" #import "GetAboutCallViewController.h" #import "OnboardingViewController.h" #import "AuthenticationListenerImpl.h" #include static bool ALLOWREMOTEMESSAGES = true; // About Client - allow Remote Messages flag static NSString * const APPNAME = @"AboutClientMain"; // About Client - default application name static NSString * const DAEMON_QUIET_PREFIX = @"quiet@"; // About Client - quiet advertising static NSString * const ONBOARDING_OBJECT_PATH = @"/Onboarding"; static NSString * const ONBOARDING_INTERFACE_NAME = @"org.alljoyn.Onboarding"; static NSString * const DEFAULT_REALM_BUS_NAME = @"org.alljoyn.BusNode.onboardingClient"; static NSString * const SSID_NOT_CONNECTED = @"SSID:not connected"; @interface MainViewController () @property NSString *className; // About Client properties @property (strong, nonatomic) AJNBusAttachment *clientBusAttachment; @property (strong, nonatomic) AJNAnnouncementReceiver *announcementReceiver; @property (strong, nonatomic) NSString *realmBusName; @property (nonatomic) bool isAboutClientConnected; @property (strong, nonatomic) NSMutableDictionary *clientInformationDict; // Store the client related information // Announcement @property (strong, nonatomic) NSString *announcementButtonCurrentTitle; // The pressed button's announcementUniqueName @property (strong, nonatomic) dispatch_queue_t annBtnCreationQueue; // About Client strings @property (strong, nonatomic) NSString *ajconnect; @property (strong, nonatomic) NSString *ajdisconnect; @property (strong, nonatomic) NSString *annSubvTitleLabelDefaultTxt; // About Client alerts @property (strong, nonatomic) UIAlertView *disconnectAlert; @property (strong, nonatomic) UIAlertView *announcementOptionsAlert; @property (strong, nonatomic) UIAlertView *onboardingOptionsAlert; @property (strong, nonatomic) AuthenticationListenerImpl *authenticationListenerImpl; @end @implementation MainViewController #pragma mark - Built In methods - (void)viewDidLoad { [super viewDidLoad]; [self loadNewSession]; [self updateSSIDinTitle]; [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateSSIDinTitle) userInfo:nil repeats:YES]; } -(void)updateSSIDinTitle { static BOOL executing; if(executing) return; executing = YES; // this code does not work in the simulator NSArray *supportedInterfaces = (__bridge_transfer id)CNCopySupportedInterfaces(); // NSLog(@"supportedInterfaces: %@", supportedInterfaces); id interfaceInformation = nil; for (NSString *interfaceName in supportedInterfaces) { interfaceInformation = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName); // NSLog(@" %@:%@", interfaceName, interfaceInformation); NSDictionary *dict = interfaceInformation; NSString *title = [NSString stringWithFormat:@"Devices on: %@",dict[@"SSID"]]; // Set the instructions Label text according to the network type if ([dict[@"SSID"] hasPrefix:AJ_AP_PREFIX] || [dict[@"SSID"] hasSuffix:AJ_AP_SUFFIX]) { self.instructionsLabel.text = @"You are currently connected to a device Access Point.\n\nPress \"Connect to AllJoyn\" to see the device in the list above.\n\nPress on the device name->onboarding to start onboarding."; } else { self.instructionsLabel.text = @"To onboard a new device:\nConnect to the device's Wi-Fi Access Point by going to Settings -> Wi-Fi\n\nTo see the devices on this network:\nPress \"Connect to AllJoyn\""; } if (![self.title isEqualToString:title]) { if ((![dict[@"SSID"] hasPrefix:AJ_AP_PREFIX] && ![dict[@"SSID"] hasSuffix:AJ_AP_SUFFIX]) && ![dict[@"SSID"] isEqualToString:[[NSUserDefaults standardUserDefaults]valueForKey:@"lastVisitedNetwork"]]) { NSLog(@"setting lastVisitedNetwork to: %@", dict[@"SSID"]); [[NSUserDefaults standardUserDefaults] setValue:dict[@"SSID"] forKey:@"lastVisitedNetwork"]; [[NSUserDefaults standardUserDefaults] synchronize]; } self.title = title; if (self.isAboutClientConnected) { NSLog(@"changing network to %@ trigger a restart", dict[@"SSID"]); [[[UIAlertView alloc]initWithTitle:@"Wi-Fi network changed" message:@"Please reconnect to AllJoyn" delegate:Nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; [self.navigationController popViewControllerAnimated:YES]; [self stopAboutClient]; } } if (interfaceInformation && [interfaceInformation count]) { break; } } if ([self.title isEqualToString:@""]) { self.title = SSID_NOT_CONNECTED; } executing = NO; } // Get the user's input from the alert dialog - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (alertView == self.announcementOptionsAlert) { [self performAnnouncementAction:buttonIndex]; } else if (alertView == self.onboardingOptionsAlert) { [self performAnnouncementAction:buttonIndex]; } else { NSLog(@"[%@] [%@] alertView.tag is wrong", @"ERROR", [[self class] description]); } } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // GetAboutCallViewController if ([segue.destinationViewController isKindOfClass:[GetAboutCallViewController class]]) { GetAboutCallViewController *getAboutCallView = segue.destinationViewController; getAboutCallView.clientInformation = (self.clientInformationDict)[self.announcementButtonCurrentTitle]; getAboutCallView.clientBusAttachment = self.clientBusAttachment; } // AnnounceTextViewController else if ([segue.destinationViewController isKindOfClass:[AnnounceTextViewController class]]) { AnnounceTextViewController *announceTextViewController = segue.destinationViewController; announceTextViewController.ajnAnnouncement = [(ClientInformation *)(self.clientInformationDict)[self.announcementButtonCurrentTitle] announcement]; } else if ([segue.destinationViewController isKindOfClass:[OnboardingViewController class]]) { OnboardingViewController *onboardingViewController = segue.destinationViewController; onboardingViewController.clientBusName = self.clientBusAttachment; onboardingViewController.clientInformation = (self.clientInformationDict)[self.announcementButtonCurrentTitle]; } } #pragma mark - IBAction Methods - (IBAction)connectButtonDidTouchUpInside:(id)sender { // Connect to the bus with the default realm bus name if (!self.isAboutClientConnected) { [self startAboutClient]; } else { [self stopAboutClient]; } } #pragma mark - AJNAnnouncementListener protocol method // Here we receive an announcement from AJN and add it to the client's list of services avaialble - (void)announceWithVersion:(uint16_t)version port:(uint16_t)port busName:(NSString *)busName objectDescriptions:(NSMutableDictionary *)objectDescs aboutData:(NSMutableDictionary **)aboutData { NSString *announcementUniqueName; // Announcement unique name in a format of ClientInformation *clientInformation = [[ClientInformation alloc] init]; // Save the announcement in a AJNAnnouncement clientInformation.announcement = [[AJNAnnouncement alloc] initWithVersion:version port:port busName:busName objectDescriptions:objectDescs aboutData:aboutData]; // Generate an announcement unique name in a format of announcementUniqueName = [NSString stringWithFormat:@"%@ %@", [clientInformation.announcement busName], [AJNAboutDataConverter messageArgumentToString:[clientInformation.announcement aboutData][@"DeviceName"]]]; NSLog(@"[%@] [%@] Announcement unique name [%@]", @"DEBUG", [[self class] description], announcementUniqueName); AJNMessageArgument *annObjMsgArg = [clientInformation.announcement aboutData][@"AppId"]; uint8_t *appIdBuffer; size_t appIdNumElements; QStatus status; status = [annObjMsgArg value:@"ay", &appIdNumElements, &appIdBuffer]; // Add the received announcement if (status != ER_OK) { NSLog(@"[%@] [%@] Failed to read appId for key [%@]", @"DEBUG", [[self class] description], announcementUniqueName); return; } // Dealing with announcement entries should be syncronized, so we add it to a queue dispatch_sync(self.annBtnCreationQueue, ^{ bool isAppIdExists = false; uint8_t *tmpAppIdBuffer; size_t tmpAppIdNumElements; QStatus tStatus; int res; // Iterate over the announcements dictionary for (NSString *key in self.clientInformationDict.allKeys) { ClientInformation *clientInfo = [self.clientInformationDict valueForKey:key]; AJNAnnouncement *announcement = [clientInfo announcement]; AJNMessageArgument *tmpMsgrg = [announcement aboutData][@"AppId"]; tStatus = [tmpMsgrg value:@"ay", &tmpAppIdNumElements, &tmpAppIdBuffer]; if (tStatus != ER_OK) { NSLog(@"[%@] [%@] Failed to read appId for key [%@]", @"DEBUG", [[self class] description], key); return; } res = 1; if (appIdNumElements == tmpAppIdNumElements) { res = memcmp(appIdBuffer, tmpAppIdBuffer, appIdNumElements); } // Found a matched appId - res=0 if (!res) { isAppIdExists = true; // Same AppId and the same announcementUniqueName if ([key isEqualToString:announcementUniqueName]) { // Update only announcements dictionary NSLog(@"[%@] [%@] Got an announcement from a known device - updating the announcement object", @"DEBUG", [[self class] description]); (self.clientInformationDict)[announcementUniqueName] = clientInformation; // Same AppId but *different* announcementUniqueName } else { NSLog(@"[%@] [%@] Got an announcement from a known device(different bus name) - updating the announcement object and UI ", @"DEBUG", [[self class] description]); // Cancel advertise name if the bus name has changed NSString *prevBusName = [announcement busName]; if (!([busName isEqualToString:prevBusName])) { tStatus = [self.clientBusAttachment cancelFindAdvertisedName:prevBusName]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelAdvertisedName for %@. status:%@", @"DEBUG", [[self class] description],prevBusName, [AJNStatus descriptionForStatusCode:tStatus]); } } // Remove existed record from the announcements dictionary [self.clientInformationDict removeObjectForKey:key]; // Add new record to the announcements dictionary [self.clientInformationDict setValue:clientInformation forKey:announcementUniqueName]; [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } break; } //if } //for //appId doesn't exist and there is no match announcementUniqueName if (!(self.clientInformationDict)[announcementUniqueName] && !isAppIdExists) { // Add new pair with this AboutService information (version,port,bus name, object description and about data) [self.clientInformationDict setValue:clientInformation forKey:announcementUniqueName]; [self addNewAnnouncemetEntry]; // AppId doesn't exist and BUT there is no match announcementUniqueName } // else No OP }); // Register interest in a well-known name prefix for the purpose of discovery (didLoseAdertise) [self.clientBusAttachment enableConcurrentCallbacks]; status = [self.clientBusAttachment findAdvertisedName:busName]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to findAdvertisedName for %@. status:%@", @"ERROR", [[self class] description],busName, [AJNStatus descriptionForStatusCode:status]); } } #pragma mark AJNBusListener protocol methods - (void)didFindAdvertisedName:(NSString *)name withTransportMask:(AJNTransportMask)transport namePrefix:(NSString *)namePrefix { NSLog(@"didFindAdvertisedName %@", name); } - (void)didLoseAdvertisedName:(NSString *)name withTransportMask:(AJNTransportMask)transport namePrefix:(NSString *)namePrefix { NSLog(@"didLoseAdvertisedName"); QStatus status; // Find the button title that should be removed for (NSString *key in[self.clientInformationDict allKeys]) { if ([[[[self.clientInformationDict valueForKey:key] announcement] busName] isEqualToString:name]) { // Cancel advertise name for that bus status = [self.clientBusAttachment cancelFindAdvertisedName:name]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelFindAdvertisedName for %@. status:%@", @"DEBUG", [[self class] description],name, [AJNStatus descriptionForStatusCode:status]); } // Remove the anouncement from the dictionary [self.clientInformationDict removeObjectForKey:key]; } } [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } #pragma mark - util methods - (void)loadNewSession { // About flags self.isAboutClientConnected = false; self.annBtnCreationQueue = dispatch_queue_create("org.alljoyn.announcementbuttoncreationQueue", NULL); // Set About Client strings self.ajconnect = @"Connect to AllJoyn"; self.ajdisconnect = @"Disconnect from AllJoyn"; self.realmBusName = DEFAULT_REALM_BUS_NAME; self.annSubvTitleLabelDefaultTxt = @"Announcement of "; // Set About Client connect button // self.connectButton.backgroundColor = [UIColor darkGrayColor]; //button bg color // [self.connectButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; //button font color [self.connectButton setTitle:self.ajconnect forState:UIControlStateNormal]; //default text [self prepareAlerts]; } // Initialize alerts - (void)prepareAlerts { // announcementOptionsAlert.tag = 3 self.announcementOptionsAlert = [[UIAlertView alloc] initWithTitle:@"Choose option:" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Show Announce", @"About", nil]; self.announcementOptionsAlert.alertViewStyle = UIAlertViewStyleDefault; // onboardingOptionsAlert.tag = 4 self.onboardingOptionsAlert = [[UIAlertView alloc] initWithTitle:@"Choose option:" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Show Announce", @"About", @"Onboarding", nil]; self.onboardingOptionsAlert.alertViewStyle = UIAlertViewStyleDefault; } - (void)performAnnouncementAction:(NSInteger)opt { switch (opt) { case 0: // "Cancel" break; case 1: // "Show Announce" { [self performSegueWithIdentifier:@"AboutShowAnnounceSegue" sender:self]; } break; case 2: // "About" { [self performSegueWithIdentifier:@"AboutClientSegue" sender:self]; // get the announcment object } break; case 3: // "OnBoarding" { [self performSegueWithIdentifier:@"OnboardingClientSegue" sender:self]; // get the announcment object } break; default: break; } } - (void)AlertAndLog:(NSString *)level message:(NSString *)message status:(QStatus)status { NSString *alertText = [NSString stringWithFormat:@"%@ (%@)",message, [AJNStatus descriptionForStatusCode:status]]; NSLog(@"[%@] [%@] %@", level, [[self class] description], alertText); [[[UIAlertView alloc] initWithTitle:@"Startup Error" message:alertText delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; } #pragma mark - AboutClient #pragma mark start AboutClient - (void)startAboutClient { QStatus status; // Create a dictionary to contain announcements using a key in the format of: "announcementUniqueName + announcementObj" self.clientInformationDict = [[NSMutableDictionary alloc] init]; NSLog(@"[%@] [%@] Start About Client", @"DEBUG", [[self class] description]); // Init AJNBusAttachment self.clientBusAttachment = [[AJNBusAttachment alloc] initWithApplicationName:APPNAME allowRemoteMessages:ALLOWREMOTEMESSAGES]; // Start AJNBusAttachment status = [self.clientBusAttachment start]; if (status != ER_OK) { [self AlertAndLog:@"FATAL" message:@"Failed AJNBusAttachment start" status:status]; [self stopAboutClient]; return; } // Connect AJNBusAttachment status = [self.clientBusAttachment connectWithArguments:@""]; if (status != ER_OK) { [self AlertAndLog:@"FATAL" message:@"Failed AJNBusAttachment connectWithArguments" status:status]; [self stopAboutClient]; return; } NSLog(@"[%@] [%@] Create aboutClientListener", @"DEBUG", [[self class] description]); NSLog(@"[%@] [%@] Register aboutClientListener", @"DEBUG", [[self class] description]); [self.clientBusAttachment registerBusListener:self]; self.announcementReceiver = [[AJNAnnouncementReceiver alloc] initWithAnnouncementListener:self andBus:self.clientBusAttachment]; const char* interfaces[] = { [ONBOARDING_INTERFACE_NAME UTF8String] }; status = [self.announcementReceiver registerAnnouncementReceiverForInterfaces:interfaces withNumberOfInterfaces:1]; if (status != ER_OK) { [self AlertAndLog:@"FATAL" message:@"Failed to registerAnnouncementReceiver" status:status]; [self stopAboutClient]; return; } NSUUID *UUID = [NSUUID UUID]; NSString *stringUUID = [UUID UUIDString]; self.realmBusName = [NSString stringWithFormat:@"%@-%@", DEFAULT_REALM_BUS_NAME, stringUUID]; // Advertise Daemon for tcl status = [self.clientBusAttachment requestWellKnownName:self.realmBusName withFlags:kAJNBusNameFlagDoNotQueue]; if (status == ER_OK) { // Advertise the name with a quite prefix for TC to find it status = [self.clientBusAttachment advertiseName:[NSString stringWithFormat:@"%@%@", DAEMON_QUIET_PREFIX, self.realmBusName] withTransportMask:kAJNTransportMaskAny]; if (status != ER_OK) { [self AlertAndLog:@"FATAL" message:@"Failed to advertise name" status:status]; NSLog(@"[%@] [%@] Failed advertising: %@%@", @"ERROR", [[self class] description], DAEMON_QUIET_PREFIX, self.realmBusName); [self stopAboutClient]; return; } else { NSLog(@"[%@] [%@] Successfully advertised: %@%@", @"DEBUG", [[self class] description], DAEMON_QUIET_PREFIX, self.realmBusName); } } else { [self AlertAndLog:@"FATAL" message:@"Failed to requestWellKnownName" status:status]; [self stopAboutClient]; return; } // Enable Client Security self.authenticationListenerImpl = [[AuthenticationListenerImpl alloc] init]; status = [self enableClientSecurity]; if (ER_OK != status) { [self AlertAndLog:@"ERROR" message:@"Failed to enable security. Please uninstall the application and reinstall." status:status]; } else { NSLog(@"Successfully enabled security for the bus"); } [self.connectButton setTitle:self.ajdisconnect forState:UIControlStateNormal]; //change title to "Disconnect from AllJoyn" self.isAboutClientConnected = true; } - (QStatus)enableClientSecurity { QStatus status; status = [self.clientBusAttachment enablePeerSecurity:@"ALLJOYN_SRP_KEYX ALLJOYN_ECDHE_PSK" authenticationListener:self.authenticationListenerImpl keystoreFileName:@"Documents/alljoyn_keystore/s_central.ks" sharing:YES]; if (status != ER_OK) { //try to delete the keystore and recreate it, if that fails return failure NSError *error; NSString *keystoreFilePath = [NSString stringWithFormat:@"%@/alljoyn_keystore/s_central.ks", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]]; [[NSFileManager defaultManager] removeItemAtPath:keystoreFilePath error:&error]; if (error) { NSLog(@"ERROR: Unable to delete keystore. %@", error); return ER_AUTH_FAIL; } status = [self.clientBusAttachment enablePeerSecurity:@"ALLJOYN_SRP_KEYX ALLJOYN_ECDHE_PSK" authenticationListener:self.authenticationListenerImpl keystoreFileName:@"Documents/alljoyn_keystore/s_central.ks" sharing:YES]; } return status; } - (void)addNewAnnouncemetEntry { [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } // announcementGetMoreInfo is an IBAction triggered by pressing a dynamic announcement button - (void)announcementGetMoreInfo:(NSInteger)requestedRow { // set the announcementButtonCurrentTitle self.announcementButtonCurrentTitle = [self.clientInformationDict allKeys][requestedRow]; NSLog(@"[%@] [%@] Requested: [%@]", @"DEBUG", [[self class] description],self.announcementButtonCurrentTitle); // Check if announcement has icon object path if (![self announcementSupportsInterface:self.announcementButtonCurrentTitle]) { [self.announcementOptionsAlert show]; // Event is forward to alertView: clickedButtonAtIndex: } else { [self.onboardingOptionsAlert show]; // Event is forward to alertView: clickedButtonAtIndex: } } // Return true if an announcement supports icon interface - (bool)announcementSupportsInterface:(NSString *)announcementKey { bool supportInterface = false; AJNAnnouncement *announcement = [(ClientInformation *)[self.clientInformationDict valueForKey:announcementKey] announcement]; NSMutableDictionary *announcementObjDecs = [announcement objectDescriptions]; //Dictionary of ObjectDescriptions NSStrings // iterate over the object descriptions dictionary for (NSString *key in announcementObjDecs.allKeys) { if ([key hasPrefix:ONBOARDING_OBJECT_PATH]) { // Iterate over the NSMutableArray for (NSString *intf in[announcementObjDecs valueForKey:key]) { if ([intf isEqualToString:(NSString *)ONBOARDING_INTERFACE_NAME]) { supportInterface = true; } } } } return supportInterface; } #pragma mark stop AboutClient - (void)stopAboutClient { QStatus status; NSLog(@"[%@] [%@] Stop About Client", @"DEBUG", [[self class] description]); // Bus attachment cleanup status = [self.clientBusAttachment cancelAdvertisedName:[NSString stringWithFormat:@"%@%@", DAEMON_QUIET_PREFIX, self.realmBusName] withTransportMask:kAJNTransportMaskAny]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully cancel advertised name", @"DEBUG", [[self class] description]); } else { NSLog(@"[%@] [%@] Failed cancel advertised name, error:%@", @"DEBUG", [[self class] description],[AJNStatus descriptionForStatusCode:status]); } status = [self.clientBusAttachment releaseWellKnownName:self.realmBusName]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully release WellKnownName", @"DEBUG", [[self class] description]); } else { NSLog(@"[%@] [%@] Failed release WellKnownName, error:%@", @"DEBUG", [[self class] description],[AJNStatus descriptionForStatusCode:status]); } status = [self.clientBusAttachment removeMatchRule:@"sessionless='t',type='error'"]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully remove MatchRule", @"DEBUG", [[self class] description]); } else { NSLog(@"[%@] [%@] Failed remove MatchRule, error:%@", @"DEBUG", [[self class] description],[AJNStatus descriptionForStatusCode:status]); } // Cancel advertise name for each announcement bus for (NSString *key in[self.clientInformationDict allKeys]) { ClientInformation *clientInfo = (self.clientInformationDict)[key]; status = [self.clientBusAttachment cancelFindAdvertisedName:[[clientInfo announcement] busName]]; if (status != ER_OK) { NSLog(@"[%@] [%@] failed to cancelAdvertisedName for %@. status:%@", @"ERROR", [[self class] description],key, [AJNStatus descriptionForStatusCode:status]); } } self.clientInformationDict = nil; const char* interfaces[] = { [ONBOARDING_INTERFACE_NAME UTF8String] }; status = [self.announcementReceiver unRegisterAnnouncementReceiverForInterfaces:interfaces withNumberOfInterfaces:1]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully unregistered AnnouncementReceiver", @"DEBUG", [[self class] description]); } else { NSLog(@"[%@] [%@] Failed unregistered AnnouncementReceiver, error:%@", @"DEBUG", [[self class] description],[AJNStatus descriptionForStatusCode:status]); } self.announcementReceiver = nil; // Stop bus attachment status = [self.clientBusAttachment stop]; if (status == ER_OK) { NSLog(@"[%@] [%@] Successfully stopped bus", @"DEBUG", [[self class] description]); } else { NSLog(@"[%@] [%@] Failed stopping bus, error:%@", @"DEBUG", [[self class] description],[AJNStatus descriptionForStatusCode:status]); } self.clientBusAttachment = nil; // Set flag self.isAboutClientConnected = false; // UI cleanup [self.connectButton setTitle:self.ajconnect forState:UIControlStateNormal]; [self.servicesTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; NSLog(@"[%@] [%@] About Client is stopped", @"DEBUG", [[self class] description]); } #pragma mark UITableView delegates - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.clientInformationDict count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"AnnouncementCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel.text = [self.clientInformationDict allKeys][indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self announcementGetMoreInfo:indexPath.row]; } - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { [self announcementGetMoreInfo:indexPath.row]; } @end base-16.04/onboarding/ios/samples/sampleApp/OnBoardingService.xcodeproj/000077500000000000000000000000001272147170000263005ustar00rootroot00000000000000base-16.04/onboarding/ios/samples/sampleApp/OnBoardingService.xcodeproj/project.pbxproj000066400000000000000000000676361272147170000313760ustar00rootroot00000000000000// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 19C40C2918B24A8100D3F62B /* OnboardingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19C40C2818B24A8100D3F62B /* OnboardingViewController.m */; }; 19E2F04317E87CE10005851F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04217E87CE10005851F /* UIKit.framework */; }; 19E2F04517E87CE10005851F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04417E87CE10005851F /* Foundation.framework */; }; 19E2F04717E87CE10005851F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F04617E87CE10005851F /* CoreGraphics.framework */; }; 19E2F06917E88AF20005851F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06817E88AF20005851F /* SystemConfiguration.framework */; }; 19E2F06D17E88B030005851F /* libstdc++.6.0.9.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */; }; 19E2F06E17E88B030005851F /* libstdc++.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06B17E88B030005851F /* libstdc++.6.dylib */; }; 19E2F06F17E88B030005851F /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F06C17E88B030005851F /* libstdc++.dylib */; }; 19E2F07417E88B120005851F /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07117E88B120005851F /* libc++.dylib */; }; 19E2F07517E88B120005851F /* libc++abi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07217E88B120005851F /* libc++abi.dylib */; }; 49838F67189930CE0007FCC6 /* AuthenticationListenerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */; }; 87B941181A76B1E200DED7C3 /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 19E2F07017E88B120005851F /* libc++.1.dylib */; }; 9A0118C5187402B400975CE6 /* CommonBusListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0118BF187402B400975CE6 /* CommonBusListener.m */; }; 9A3DB0BC183A0D2A0063D6BE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */; }; 9A3DB0BD183A0D2A0063D6BE /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFE183A0D290063D6BE /* Default.png */; }; 9A3DB0BE183A0D2A0063D6BE /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DAFFF183A0D290063D6BE /* Default@2x.png */; }; 9A3DB0BF183A0D2A0063D6BE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DB000183A0D290063D6BE /* InfoPlist.strings */; }; 9A3DB0C1183A0D2A0063D6BE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB004183A0D290063D6BE /* main.m */; }; 9A3DB0C2183A0D2A0063D6BE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB009183A0D290063D6BE /* AppDelegate.m */; }; 9A3DB0C3183A0D2A0063D6BE /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */; }; 9A3DB0C4183A0D2A0063D6BE /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A3DB00C183A0D290063D6BE /* MainViewController.m */; }; 9A3DB315183A19CB0063D6BE /* libc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A3DB314183A19CB0063D6BE /* libc.dylib */; }; 9A5CC10C183D04AA002327C0 /* alljoynicon.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */; }; 9A5CC10F183D073E002327C0 /* GetAboutCallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */; }; 9A5EFF7D187044BC002833C1 /* ClientInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A5EFF7C187044BC002833C1 /* ClientInformation.m */; }; 9AD3D2DE187191AC00D15544 /* AnnounceTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 19C40C2718B24A8100D3F62B /* OnboardingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnboardingViewController.h; sourceTree = ""; }; 19C40C2818B24A8100D3F62B /* OnboardingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnboardingViewController.m; sourceTree = ""; }; 19E2F03F17E87CE10005851F /* OnBoardingService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OnBoardingService.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19E2F04217E87CE10005851F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 19E2F04417E87CE10005851F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 19E2F04617E87CE10005851F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 19E2F06817E88AF20005851F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.0.9.dylib"; path = "usr/lib/libstdc++.6.0.9.dylib"; sourceTree = SDKROOT; }; 19E2F06B17E88B030005851F /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; }; 19E2F06C17E88B030005851F /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; }; 19E2F07017E88B120005851F /* libc++.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.1.dylib"; path = "usr/lib/libc++.1.dylib"; sourceTree = SDKROOT; }; 19E2F07117E88B120005851F /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; 19E2F07217E88B120005851F /* libc++abi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++abi.dylib"; path = "usr/lib/libc++abi.dylib"; sourceTree = SDKROOT; }; 49838F65189930CE0007FCC6 /* AuthenticationListenerImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationListenerImpl.h; sourceTree = ""; }; 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthenticationListenerImpl.m; sourceTree = ""; }; 9A0118BE187402B400975CE6 /* CommonBusListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonBusListener.h; sourceTree = ""; }; 9A0118BF187402B400975CE6 /* CommonBusListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommonBusListener.m; sourceTree = ""; }; 9A3DAFFB183A0D290063D6BE /* OnBoardingService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OnBoardingService-Info.plist"; sourceTree = ""; }; 9A3DAFFC183A0D290063D6BE /* OnBoardingService-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OnBoardingService-Prefix.pch"; sourceTree = ""; }; 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 9A3DAFFE183A0D290063D6BE /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 9A3DAFFF183A0D290063D6BE /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 9A3DB001183A0D290063D6BE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9A3DB004183A0D290063D6BE /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 9A3DB008183A0D290063D6BE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../AppDelegate.h; sourceTree = ""; }; 9A3DB009183A0D290063D6BE /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ../AppDelegate.m; sourceTree = ""; }; 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 9A3DB00B183A0D290063D6BE /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 9A3DB00C183A0D290063D6BE /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 9A3DB314183A19CB0063D6BE /* libc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libc.dylib; path = usr/lib/libc.dylib; sourceTree = SDKROOT; }; 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = alljoynicon.jpeg; sourceTree = ""; }; 9A5CC10D183D073E002327C0 /* GetAboutCallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetAboutCallViewController.h; sourceTree = ""; }; 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetAboutCallViewController.m; sourceTree = ""; }; 9A5EFF7B187044BC002833C1 /* ClientInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClientInformation.h; sourceTree = ""; }; 9A5EFF7C187044BC002833C1 /* ClientInformation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClientInformation.m; sourceTree = ""; }; 9AD3D2DC187191AC00D15544 /* AnnounceTextViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnnounceTextViewController.h; sourceTree = ""; }; 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnnounceTextViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 19E2F03C17E87CE10005851F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB315183A19CB0063D6BE /* libc.dylib in Frameworks */, 19E2F07417E88B120005851F /* libc++.dylib in Frameworks */, 87B941181A76B1E200DED7C3 /* libc++.1.dylib in Frameworks */, 19E2F07517E88B120005851F /* libc++abi.dylib in Frameworks */, 19E2F06F17E88B030005851F /* libstdc++.dylib in Frameworks */, 19E2F06E17E88B030005851F /* libstdc++.6.dylib in Frameworks */, 19E2F06D17E88B030005851F /* libstdc++.6.0.9.dylib in Frameworks */, 19E2F06917E88AF20005851F /* SystemConfiguration.framework in Frameworks */, 19E2F04317E87CE10005851F /* UIKit.framework in Frameworks */, 19E2F04517E87CE10005851F /* Foundation.framework in Frameworks */, 19E2F04717E87CE10005851F /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 19E2F03617E87CE10005851F = { isa = PBXGroup; children = ( 9A3DAFF9183A0D290063D6BE /* ViewControllers */, 9AB8994218758EB400BC53DA /* Utils */, 9AB8994118758EA800BC53DA /* StoryBoards */, 9A3DAFFA183A0D290063D6BE /* Resources */, 19E2F04117E87CE10005851F /* Frameworks */, 19E2F04017E87CE10005851F /* Products */, ); sourceTree = ""; }; 19E2F04017E87CE10005851F /* Products */ = { isa = PBXGroup; children = ( 19E2F03F17E87CE10005851F /* OnBoardingService.app */, ); name = Products; sourceTree = ""; }; 19E2F04117E87CE10005851F /* Frameworks */ = { isa = PBXGroup; children = ( 9A3DB314183A19CB0063D6BE /* libc.dylib */, 19E2F07117E88B120005851F /* libc++.dylib */, 19E2F07017E88B120005851F /* libc++.1.dylib */, 19E2F07217E88B120005851F /* libc++abi.dylib */, 19E2F06C17E88B030005851F /* libstdc++.dylib */, 19E2F06B17E88B030005851F /* libstdc++.6.dylib */, 19E2F06A17E88B030005851F /* libstdc++.6.0.9.dylib */, 19E2F06817E88AF20005851F /* SystemConfiguration.framework */, 19E2F04217E87CE10005851F /* UIKit.framework */, 19E2F04417E87CE10005851F /* Foundation.framework */, 19E2F04617E87CE10005851F /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 9A3DAFF9183A0D290063D6BE /* ViewControllers */ = { isa = PBXGroup; children = ( 9A5CC10D183D073E002327C0 /* GetAboutCallViewController.h */, 9A5CC10E183D073E002327C0 /* GetAboutCallViewController.m */, 9A3DB00B183A0D290063D6BE /* MainViewController.h */, 9A3DB00C183A0D290063D6BE /* MainViewController.m */, 9AD3D2DC187191AC00D15544 /* AnnounceTextViewController.h */, 9AD3D2DD187191AC00D15544 /* AnnounceTextViewController.m */, 19C40C2718B24A8100D3F62B /* OnboardingViewController.h */, 19C40C2818B24A8100D3F62B /* OnboardingViewController.m */, ); name = ViewControllers; sourceTree = ""; }; 9A3DAFFA183A0D290063D6BE /* Resources */ = { isa = PBXGroup; children = ( 9A3DB008183A0D290063D6BE /* AppDelegate.h */, 9A3DB009183A0D290063D6BE /* AppDelegate.m */, 9A5CC10B183D04AA002327C0 /* alljoynicon.jpeg */, 9A3DAFFB183A0D290063D6BE /* OnBoardingService-Info.plist */, 9A3DAFFC183A0D290063D6BE /* OnBoardingService-Prefix.pch */, 9A3DAFFD183A0D290063D6BE /* Default-568h@2x.png */, 9A3DAFFE183A0D290063D6BE /* Default.png */, 9A3DAFFF183A0D290063D6BE /* Default@2x.png */, 9A3DB000183A0D290063D6BE /* InfoPlist.strings */, 9A3DB004183A0D290063D6BE /* main.m */, ); name = Resources; path = OnboardingService; sourceTree = ""; }; 9AB8994118758EA800BC53DA /* StoryBoards */ = { isa = PBXGroup; children = ( 9A3DB00A183A0D290063D6BE /* MainStoryboard_iPhone.storyboard */, ); name = StoryBoards; sourceTree = ""; }; 9AB8994218758EB400BC53DA /* Utils */ = { isa = PBXGroup; children = ( 49838F65189930CE0007FCC6 /* AuthenticationListenerImpl.h */, 49838F66189930CE0007FCC6 /* AuthenticationListenerImpl.m */, 9A0118BE187402B400975CE6 /* CommonBusListener.h */, 9A0118BF187402B400975CE6 /* CommonBusListener.m */, 9A5EFF7B187044BC002833C1 /* ClientInformation.h */, 9A5EFF7C187044BC002833C1 /* ClientInformation.m */, ); name = Utils; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 19E2F03E17E87CE10005851F /* OnBoardingService */ = { isa = PBXNativeTarget; buildConfigurationList = 19E2F06517E87CE10005851F /* Build configuration list for PBXNativeTarget "OnBoardingService" */; buildPhases = ( 19E2F03B17E87CE10005851F /* Sources */, 19E2F03C17E87CE10005851F /* Frameworks */, 19E2F03D17E87CE10005851F /* Resources */, ); buildRules = ( ); dependencies = ( ); name = OnBoardingService; productName = ControlPanelService; productReference = 19E2F03F17E87CE10005851F /* OnBoardingService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 19E2F03717E87CE10005851F /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; ORGANIZATIONNAME = AllJoyn; TargetAttributes = { 19E2F03E17E87CE10005851F = { SystemCapabilities = { com.apple.BackgroundModes = { enabled = 0; }; }; }; }; }; buildConfigurationList = 19E2F03A17E87CE10005851F /* Build configuration list for PBXProject "OnBoardingService" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 19E2F03617E87CE10005851F; productRefGroup = 19E2F04017E87CE10005851F /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 19E2F03E17E87CE10005851F /* OnBoardingService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 19E2F03D17E87CE10005851F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB0C3183A0D2A0063D6BE /* MainStoryboard_iPhone.storyboard in Resources */, 9A3DB0BD183A0D2A0063D6BE /* Default.png in Resources */, 9A3DB0BF183A0D2A0063D6BE /* InfoPlist.strings in Resources */, 9A5CC10C183D04AA002327C0 /* alljoynicon.jpeg in Resources */, 9A3DB0BE183A0D2A0063D6BE /* Default@2x.png in Resources */, 9A3DB0BC183A0D2A0063D6BE /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 19E2F03B17E87CE10005851F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 9A3DB0C4183A0D2A0063D6BE /* MainViewController.m in Sources */, 49838F67189930CE0007FCC6 /* AuthenticationListenerImpl.m in Sources */, 9AD3D2DE187191AC00D15544 /* AnnounceTextViewController.m in Sources */, 19C40C2918B24A8100D3F62B /* OnboardingViewController.m in Sources */, 9A3DB0C2183A0D2A0063D6BE /* AppDelegate.m in Sources */, 9A5EFF7D187044BC002833C1 /* ClientInformation.m in Sources */, 9A3DB0C1183A0D2A0063D6BE /* main.m in Sources */, 9A0118C5187402B400975CE6 /* CommonBusListener.m in Sources */, 9A5CC10F183D073E002327C0 /* GetAboutCallViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 9A3DB000183A0D290063D6BE /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 9A3DB001183A0D290063D6BE /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 19E2F06317E87CE10005851F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 19E2F06417E87CE10005851F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.1; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 19E2F06617E87CE10005851F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OnboardingService/OnBoardingService-Prefix.pch"; GCC_SYMBOLS_PRIVATE_EXTERN = NO; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", ); INFOPLIST_FILE = "$(SRCROOT)/OnboardingService/OnBoardingService-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_onboarding_objc", "-lalljoyn_onboarding_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = OnBoardingService; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = 1; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Debug; }; 19E2F06717E87CE10005851F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OnboardingService/OnBoardingService-Prefix.pch"; HEADER_SEARCH_PATHS = ( "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc\"", "\"$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/inc/alljoyn\"", "\"$(ALLJOYN_SDK_ROOT)/common/inc\"", "\"$(ALLJOYN_SDK_ROOT)/alljoyn_objc/AllJoynFramework/AllJoynFramework/\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/ios/inc\"", "\"$(ALLJOYN_SDK_ROOT)/services/about/cpp/inc\"", "\"$(SRCROOT)/../../inc\"", "\"$(SRCROOT)/../../../cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/cpp/inc\"", "\"$(SRCROOT)/../../../../services_common/ios/inc\"", ); INFOPLIST_FILE = "$(SRCROOT)/OnboardingService/OnBoardingService-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(OPENSSL_ROOT)/build/$(CONFIGURATION)-$(PLATFORM_NAME)", "$(ALLJOYN_SDK_ROOT)/build/darwin/$(CURRENT_ARCH)/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/cpp/lib", "$(ALLJOYN_SDK_ROOT)/build/darwin/arm/$(PLATFORM_NAME)/$(CONFIGURATION)/dist/about/lib", "\"$(SRCROOT)/../alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_cpp/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", "\"$(SRCROOT)/../../../../services_common/ios/samples/alljoyn_services_objc/build/$(CONFIGURATION)-$(PLATFORM_NAME)\"", ); ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ( "-DNS_BLOCK_ASSERTIONS=1", "-DQCC_OS_GROUP_POSIX", "-DQCC_OS_DARWIN", ); OTHER_LDFLAGS = ( "-lalljoyn", "-lajrouter", "-lssl", "-lcrypto", "-lalljoyn_services_common_objc", "-lalljoyn_services_common_cpp", "-lalljoyn_onboarding_objc", "-lalljoyn_onboarding_cpp", "-lalljoyn_about_objc", "-lalljoyn_about_cpp", "-lAllJoynFramework_iOS", ); PRODUCT_NAME = OnBoardingService; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = 1; VALID_ARCHS = "armv7 i386 arm64"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 19E2F03A17E87CE10005851F /* Build configuration list for PBXProject "OnBoardingService" */ = { isa = XCConfigurationList; buildConfigurations = ( 19E2F06317E87CE10005851F /* Debug */, 19E2F06417E87CE10005851F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 19E2F06517E87CE10005851F /* Build configuration list for PBXNativeTarget "OnBoardingService" */ = { isa = XCConfigurationList; buildConfigurations = ( 19E2F06617E87CE10005851F /* Debug */, 19E2F06717E87CE10005851F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 19E2F03717E87CE10005851F /* Project object */; } base-16.04/onboarding/ios/samples/sampleApp/OnBoardingService.xcodeproj/project.xcworkspace/000077500000000000000000000000001272147170000322765ustar00rootroot00000000000000contents.xcworkspacedata000066400000000000000000000002421272147170000371570ustar00rootroot00000000000000base-16.04/onboarding/ios/samples/sampleApp/OnBoardingService.xcodeproj/project.xcworkspace base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/000077500000000000000000000000001272147170000243445ustar00rootroot00000000000000base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/Default-568h@2x.png000066400000000000000000000442421272147170000275060ustar00rootroot00000000000000PNG  IHDRpz$iCCPICC Profile8UoT>oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 1136 2012-07-27T15:07:06 Pixelmator 2.0.5 )q?7IDATx=eQqÙ87;;' RBR(JWw^8w<漏7 @^~:;;>9O @F{}w~|}}ޣ#@~<=9G p;*O_8>^#@ ƻZjLZ9:\oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 320 1 480 2012-07-27T15:07:80 Pixelmator 2.0.5 X="IDATxICQDDKIq/L {nov}y>(oR? XGůUS[IJ*$:7鶪O{7@Hkk?<kktq݋m6nƶد-mR;`zv x#=\% oYRڱ#&?>ҹЪn_;j;$}*}+(}'}/LtY"$].9⦅%{_a݊]hk5'SN{<_ t jM{-4%TńtY۟R6#v\喊x:'HO3^&0::m,L%3:qVE t]~Iv6Wٯ) |ʸ2]G4(6w‹$"AEv m[D;Vh[}چN|3HS:KtxU'D;77;_"e?Yqxl+ pHYs  iTXtXML:com.adobe.xmp 1 5 72 1 72 640 1 960 2012-07-27T15:07:37 Pixelmator 2.0.5 PF5IDATx1e HH܎;qoV..Vb&a^p s3;i^;ޟy!@ <>_{x}~\_Wg @܆vW=̻o]yoλ͇ @vU>yO7ן}* p|W}w}5蛿CaW] @>FmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@0  0" GmM @@W>0  @nVjLJޞy @ܞxޝ<x| @7$pߧ:yOߜ' @~y7O/> @!p[_4lIENDB`base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/OnBoardingService-Info.plist000066400000000000000000000031521272147170000316560ustar00rootroot00000000000000 CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier org.alljoyn.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 00.01 CFBundleSignature ???? CFBundleVersion 0110 LSRequiresIPhoneOS UIMainStoryboardFile MainStoryboard_iPhone UIMainStoryboardFile~ipad MainStoryboard_iPhone UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/OnBoardingService-Prefix.pch000066400000000000000000000022571272147170000316440ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #ifndef __IPHONE_5_0 #warning "This project uses features only available in iOS SDK 5.0 and later." #endif #ifdef __OBJC__ #import #import #endif base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/alljoynicon.jpeg000066400000000000000000000031641272147170000275400ustar00rootroot00000000000000JFIF     "" $(4,$&1'-=-157:::#+?I?8C49:7 8$ $7,57377.,647,,+77/45,,--..7708400,,7,/,,,7.77,54,7775!A12Qa"$Bq#Rr3 !1AQ"2aq#3Bb ?p!LKo+{$lY^pwauēt4<ݙ&ZaY[n',Ga ^e_)ruE)<~m{텺T6Lwy~{S.J`B3z5Ty}vlZֺg"dV>g-7Zln;9^#|ʹzcw6V cRx"SkhH\C~lK7nl :]*Uזԑ34"AIN ņ]f5ۅZ/F)qTK$փO{bD{nv])LHuHo:JCKhBu  HtaA,j~0ݭJ[bƋ5J EylzhʷK9ڑ31XҗÝ!cƆ}N.ž0f<0sܮJTEjRlEOYPX0!!ȓ x?~AGZ  -K1ZTT/ẰhWf*{]13қӿa#_u%«~q s|]ZEtOGrk>I.j_ ߫4odɭXg5m-)JE5sΫ6o^P.YI;'`pcg'!V"`jjJ4r$zbх3l;%B&ns^d7?U"Y}*GăOnlHflrw$_B˒MB⮑!:\TFDkrZ)7ү{rLMu^xȝ-N?\eBok% kZߙQfEG=uB 8t A¤ݟ'ppw!e(h\x;YP<Mпbase-16.04/onboarding/ios/samples/sampleApp/OnboardingService/en.lproj/000077500000000000000000000000001272147170000260735ustar00rootroot00000000000000base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/en.lproj/InfoPlist.strings000066400000000000000000000000541272147170000314140ustar00rootroot00000000000000// Localized versions of Info.plist keys base-16.04/onboarding/ios/samples/sampleApp/OnboardingService/main.m000066400000000000000000000027371272147170000254570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AppDelegate.h" #import "AJNInit.h" int main(int argc, char *argv[]) { @autoreleasepool { if ([AJNInit alljoynInit] != ER_OK) { return 1; } if ([AJNInit alljoynRouterInit] != ER_OK) { [AJNInit alljoynShutdown]; return 1; } int ret = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); [AJNInit alljoynRouterShutdown]; [AJNInit alljoynShutdown]; return ret; } } base-16.04/onboarding/ios/samples/sampleApp/OnboardingViewController.h000066400000000000000000000043541272147170000261010ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import #import "AJNBusAttachment.h" #import "ClientInformation.h" static NSString * const AJ_AP_PREFIX = @"AJ_"; static NSString * const AJ_AP_SUFFIX = @"_AJ"; @interface OnboardingViewController : UIViewController @property (strong, nonatomic) AJNBusAttachment *clientBusName; @property (weak, nonatomic) ClientInformation *clientInformation; @property (weak, nonatomic) IBOutlet UITextField *ssidTextField; @property (weak, nonatomic) IBOutlet UITextField *ssidPassTextField; @property (weak, nonatomic) IBOutlet UIButton *configureBtn; @property (weak, nonatomic) IBOutlet UIButton *connectBtn; @property (weak, nonatomic) IBOutlet UIButton *offBoardingBtn; @property (weak, nonatomic) IBOutlet UILabel *onboardTitleLbl; @property (weak, nonatomic) IBOutlet UILabel *ssidLbl; @property (weak, nonatomic) IBOutlet UILabel *ssidPassLbl; @property (weak, nonatomic) IBOutlet UILabel *statusLbl; @property (weak, nonatomic) IBOutlet UILabel *instructLbl; @property (weak, nonatomic) IBOutlet UITextField *authTextField; @property (strong, nonatomic) UIPickerView *authType; - (IBAction)configureBtnDidTouchUpInside:(id)sender; - (IBAction)connectBtnDidTouchUpInside:(id)sender; - (IBAction)offBoardingBtnDidTouchUpInside:(id)sender; @end base-16.04/onboarding/ios/samples/sampleApp/OnboardingViewController.m000066400000000000000000000321441272147170000261040ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "OnboardingViewController.h" #import "alljoyn/onboarding/AJOBSOnboardingClient.h" #import "SystemConfiguration/CaptiveNetwork.h" #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) @interface OnboardingViewController () @property (strong, nonatomic) AJOBSOnboardingClient *onboardingClient; @property (nonatomic) AJNSessionId sessionId; @property (strong, nonatomic) NSString *onboardeeBus; @property (strong, nonatomic) NSArray *pickerData; @end @implementation OnboardingViewController - (void)viewDidLoad { [super viewDidLoad]; // UI [self.statusLbl setText:@" "]; [self.instructLbl setText:@" "]; [self displayPreOnbordingElements:0]; self.offBoardingBtn.alpha = 0; [self updateStatusLabel:@"Loading Onboarding client"]; QStatus status = [self startOnboardingClient]; if (ER_OK != status) { [[[UIAlertView alloc] initWithTitle:@"Error" message:@"Failed to start onboarding client" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; } self.authType = [[UIPickerView alloc]init]; self.authType.delegate = self; self.authType.dataSource = self; self.authType.showsSelectionIndicator = YES; self.authType.hidden = NO; self.pickerData = @[@"OPEN", @"WEP", @"WPA_AUTO", @"WPA_CCMP", @"WPA_TKIP", @"WPA2_AUTO", @"WPA2_CCMP", @"WPA2_TKIP", @"WPS"]; if ([self.authTextField.text length] <= 0){ self.authTextField.text = self.pickerData[0]; } self.authTextField.inputView = self.authType; } -(void)displayPreOnbordingElements:(CGFloat) alpha { //text self.ssidTextField.alpha = alpha; self.ssidPassTextField.alpha = alpha; //buttons self.connectBtn.alpha = alpha; self.configureBtn.alpha = alpha; //labels self.onboardTitleLbl.alpha = alpha; self.ssidLbl.alpha = alpha; self.ssidPassLbl.alpha = alpha; } - (BOOL)isSimulatorDevice { if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")){ #ifdef TARGET_OS_SIMULATOR return (TARGET_OS_SIMULATOR != 0); #endif #ifdef TARGET_IPHONE_SIMULATOR return (TARGET_IPHONE_SIMULATOR != 0); #endif } else{ NSString *deviceModel = [[UIDevice currentDevice] model]; return ([deviceModel isEqualToString:@"iPhone Simulator"] || [deviceModel isEqualToString:@"iPad Simulator"]); } } -(QStatus)startOnboardingClient { self.onboardeeBus = [self.clientInformation.announcement busName]; QStatus status = ER_FAIL; if (!self.onboardeeBus) { [self updateStatusLabel:@"Bus attachment hasn't been initialized"]; return status; } self.onboardingClient = [[AJOBSOnboardingClient alloc] initWithBus:self.clientBusName listener:self]; if (!self.sessionId) { status = [self createNewSession]; if (ER_OK != status) { return ER_FAIL; } } if ([self isSimulatorDevice]) { NSString *simulatorMessage = @"NOTE: Using the simulator does not support network detection - all possible actions are displayed"; [self updateStatusLabel:[NSString stringWithFormat:simulatorMessage]]; [self displayPreOnbordingElements:1]; self.offBoardingBtn.alpha = 1; self.connectBtn.enabled = NO; } else { if ([self isOnSAPNetwork]) { [self.instructLbl setText:@"Press Configure after filling in the WiFi network details"]; [self displayPreOnbordingElements:1]; self.connectBtn.enabled = NO; [self.ssidTextField setText:[[NSUserDefaults standardUserDefaults] objectForKey:@"lastVisitedNetwork"]]; } else { [self.instructLbl setText:@"To offboard the device - press Offboard"]; [self displayPreOnbordingElements:0]; //device already onboarded self.offBoardingBtn.alpha = 1; } } return status; } -(QStatus)createNewSession { //create sessionOptions [self updateStatusLabel:[NSString stringWithFormat:@"Create a new session with %@", [self.clientInformation.announcement busName]]]; AJNSessionOptions *opt = [[AJNSessionOptions alloc] initWithTrafficType:kAJNTrafficMessages supportsMultipoint:false proximity:kAJNProximityAny transportMask:kAJNTransportMaskAny]; //call joinSession self.sessionId = [self.clientBusName joinSessionWithName:[self.clientInformation.announcement busName] onPort:[self.clientInformation.announcement port] withDelegate:(nil) options:opt]; if (self.sessionId == 0 || self.sessionId == -1) { [self updateStatusLabel:[NSString stringWithFormat:@"Failed to join session. sid=%u",self.sessionId]]; return ER_FAIL; } return ER_OK; } -(bool)isOnSAPNetwork { NSString *currentSSID; // this code does not work in the simulator NSArray *supportedInterfaces = (__bridge_transfer id)CNCopySupportedInterfaces(); id interfaceInformation = nil; for (NSString *interfaceName in supportedInterfaces) { interfaceInformation = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName); NSDictionary *dict = interfaceInformation; currentSSID = dict[@"SSID"]; NSLog(@"Current SSID: %@", currentSSID); } return [currentSSID hasPrefix:AJ_AP_PREFIX] | [currentSSID hasSuffix:AJ_AP_SUFFIX]; } -(void)updateStatusLabel:(NSString *)status { NSLog(@"%@",status); [self.statusLbl setText:status]; } -(void)stopOnboardingClient { QStatus status; NSLog(@"Calling leaveSession"); status = [self.clientBusName leaveSession:self.sessionId]; if (ER_OK != status) { NSLog(@"Failed to leave session %u, %@",self.sessionId, [AJNStatus descriptionForStatusCode:status]); } self.onboardingClient = nil; } #pragma marks - event methods - (IBAction)configureBtnDidTouchUpInside:(id)sender { QStatus status; [self updateStatusLabel:@"Calling ConfigureWiFi"]; AJOBInfo obInfo; obInfo.SSID = self.ssidTextField.text; obInfo.passcode = self.ssidPassTextField.text; obInfo.authType = [self pickerAuthStringToInt]; NSLog(@"input SSID:%@ passcode:%@",obInfo.SSID,obInfo.passcode); if (![obInfo.SSID length]) { [self updateStatusLabel:@"Error: SSID is empty"]; [[[UIAlertView alloc] initWithTitle:@"Error" message:@"SSID can't be empty" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; return; } bool shouldConvert = false; if ([AJOBSOnboarding isValidWPAKey:obInfo.passcode]) { [self updateStatusLabel:@"Input passcode is a valid WPA - will convert to Hex"]; shouldConvert = true; } else if([AJOBSOnboarding isValidWEPKey:obInfo.passcode]) { if ([obInfo.passcode length] % 2) { [self updateStatusLabel:@"Input passcode is valid WEP - converting to Hex"]; shouldConvert = true; } else { [self updateStatusLabel:@"Input passcode is valid WEP - Hex conversion is not required"]; } } else { [self updateStatusLabel:@"Input passcode is none of the following: WPA, WEP"]; } if (shouldConvert) { NSString *tPasscode = [AJOBSOnboarding passcodeToHex:obInfo.passcode]; obInfo.passcode = tPasscode; NSLog(@"Passcode has been converted to:%@",obInfo.passcode); } short resultStatus; status = [self.onboardingClient configureWiFi:self.onboardeeBus obInfo:obInfo resultStatus:resultStatus sessionId:self.sessionId]; if (status == ER_OK) { [self updateStatusLabel:[NSString stringWithFormat:@"Call to configureWiFi succeeded.\nResult status is %hd",resultStatus]]; [self.instructLbl setText:@"Press Connect to complete the onboarding."]; if (resultStatus == 1) { self.connectBtn.enabled = YES; } if (resultStatus == 2) { [self updateStatusLabel:@"Waiting for connectionResult signal"]; } } else { [[[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Call to configureWiFi failed: %@ ", [AJNStatus descriptionForStatusCode:status]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; [self updateStatusLabel:[NSString stringWithFormat:@"Call to configureWiFi failed: %@ ", [AJNStatus descriptionForStatusCode:status]]]; } self.configureBtn.enabled = NO; self.ssidTextField.enabled = NO; self.ssidPassTextField.enabled = NO; } - (IBAction)connectBtnDidTouchUpInside:(id)sender { QStatus status; [self updateStatusLabel:@"Calling connect"]; status = [self.onboardingClient connectTo:self.onboardeeBus sessionId:self.sessionId]; if (status == ER_OK) { [self updateStatusLabel:@"Call to connect succeeded"]; [[[UIAlertView alloc] initWithTitle:@"Onboarding succeeded" message:[NSString stringWithFormat:@"Go to Settings -> Wi-Fi to manually connect this device to the '%@' network to complete the onboarding process.", self.ssidTextField.text] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; } else { [self updateStatusLabel:[NSString stringWithFormat:@"Call to connect failed: %@", [AJNStatus descriptionForStatusCode:status]]]; } [self.connectBtn setEnabled:NO]; [self.instructLbl setText:@" "]; } - (IBAction)offBoardingBtnDidTouchUpInside:(id)sender { [self updateStatusLabel:@"Calling offboard"]; QStatus status = [self.onboardingClient offboardFrom:self.onboardeeBus sessionId:self.sessionId]; if (status == ER_OK) { [self updateStatusLabel:@"Call to offboard succeeded"]; } else { [self updateStatusLabel:[NSString stringWithFormat:@"Call to offboard failed %@", [AJNStatus descriptionForStatusCode:status]]]; } [self.offBoardingBtn setEnabled:NO]; [self.instructLbl setText:@" "]; } // Get the user's input from the alert dialog - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { } - (void)viewWillDisappear:(BOOL)animated { [self stopOnboardingClient]; [super viewWillDisappear:animated]; } -(void)connectionResultSignalReceived:(int) connectionResultCode connectionResultMessage:(NSString*) connectionResultMessage { dispatch_async(dispatch_get_main_queue(), ^{ [self updateStatusLabel:[NSString stringWithFormat:@"connectionResultSignal has been received with code:%d message:%@", connectionResultCode,connectionResultMessage]]; if(connectionResultCode == VALIDATED) { [self.connectBtn setEnabled:YES]; } }); } - (int)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } - (int)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [self.pickerData count]; } - (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { return self.pickerData[row]; } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { self.authTextField.text = self.pickerData[row]; [self.authTextField resignFirstResponder]; NSLog(@"%d row selected: %@", row, self.authTextField.text); } -(NSInteger)pickerAuthStringToInt { if([self.authTextField.text isEqualToString:@"OPEN"]) { return OPEN; } else if ([self.authTextField.text isEqualToString:@"WEP"]) { return WEP; } else if ([self.authTextField.text isEqualToString:@"WPA_AUTO"]) { return WPA_AUTO; } else if ([self.authTextField.text isEqualToString:@"WPA_CCMP"]) { return WPA_CCMP; } else if ([self.authTextField.text isEqualToString:@"WPA_TKIP"]) { return WPA_TKIP; } else if ([self.authTextField.text isEqualToString:@"WPA2_AUTO"]) { return WPA2_AUTO; } else if ([self.authTextField.text isEqualToString:@"WPA2_CCMP"]) { return WPA2_CCMP; } else if ([self.authTextField.text isEqualToString:@"WPA2_TKIP"]) { return WPA2_TKIP; } else if ([self.authTextField.text isEqualToString:@"WPS"]) { return WPS; } } @end base-16.04/onboarding/ios/src/000077500000000000000000000000001272147170000161425ustar00rootroot00000000000000base-16.04/onboarding/ios/src/AJOBOnboardingClientListenerAdapter.mm000066400000000000000000000034021272147170000253600ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJOBOnboardingClientListenerAdapter.h" #import "alljoyn/about/AJNConvertUtil.h" AJOBOnboardingClientListenerAdapter::AJOBOnboardingClientListenerAdapter(id onboardingClientListener) { ajOnboardingClientListener = onboardingClientListener; } AJOBOnboardingClientListenerAdapter::~AJOBOnboardingClientListenerAdapter() { } void AJOBOnboardingClientListenerAdapter::ConnectionResultSignalReceived(short connectionResultCode, const qcc::String& connectionResultMessage) { NSString* connectionResultMessageString; connectionResultMessageString = [AJNConvertUtil convertQCCStringtoNSString:connectionResultMessage]; [ajOnboardingClientListener connectionResultSignalReceived: connectionResultCode connectionResultMessage: connectionResultMessageString]; } base-16.04/onboarding/ios/src/AJOBSOnboarding.mm000066400000000000000000000056521272147170000213460ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJOBSOnboarding.h" #import "alljoyn/about/AJNConvertUtil.h" static NSString * const PASSCODE_FORMAT = @"%02X"; @implementation AJOBSOnboarding +(bool)isValidWEPKey:(NSString *) key { size_t size = [key length]; return (size == 5 || // 40-bit ascii size == 10 || // 40 bit hex size == 13 || // 104 bit ascii size == 26 || // 104 bit hex size == 16 || // 152 bit ascii size == 32 || // 152-bit hex size == 29 || // 256-bit ascii size == 64); // 256-bit hex } +(bool)isValidWPAKey:(NSString *) key { return [key length] >= MIN_PSK_SIZE && [key length] <= MAX_PSK_SIZE; } +(NSString*)passcodeToHex:(NSString*) passcode { const char *pass = [passcode UTF8String]; NSMutableString *passcodeHex = [NSMutableString string]; while (*pass) { [passcodeHex appendFormat:PASSCODE_FORMAT, *pass++ & BIT_MASK]; } return passcodeHex; } +(ajn::services::OBInfo)toOBInfo:(AJOBInfo) ajOBInfo { ajn::services::OBInfo obInfo; obInfo.SSID = [AJNConvertUtil convertNSStringToQCCString:ajOBInfo.SSID]; obInfo.state = (ajn::services::OBState)ajOBInfo.state; obInfo.authType = (ajn::services::OBAuthType)ajOBInfo.authType; obInfo.passcode = [AJNConvertUtil convertNSStringToQCCString:ajOBInfo.passcode]; return obInfo; } +(AJOBInfo)toAJOBInfo:(ajn::services::OBInfo) obInfo { AJOBInfo ajOBInfo; ajOBInfo.SSID = [AJNConvertUtil convertQCCStringtoNSString:obInfo.SSID]; ajOBInfo.state = obInfo.state; ajOBInfo.authType = obInfo.authType; ajOBInfo.passcode = [AJNConvertUtil convertQCCStringtoNSString:obInfo.passcode]; return ajOBInfo; } +(AJOBLastError)toAJOBLastError:(ajn::services::OBLastError) obLastError { AJOBLastError ajOBLastError; ajOBLastError.validationState = obLastError.validationState; ajOBLastError.message = [AJNConvertUtil convertQCCStringtoNSString:obLastError.message]; return ajOBLastError; } @end base-16.04/onboarding/ios/src/AJOBSOnboardingClient.mm000066400000000000000000000116361272147170000225040ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ #import "AJOBSOnboardingClient.h" #import "alljoyn/onboarding/OnboardingClient.h" #import "alljoyn/onboarding/Onboarding.h" #import "alljoyn/about/AJNConvertUtil.h" #import "AJOBOnboardingClientListenerAdapter.h" @interface AJOBSOnboardingClient () @property ajn::services::OnboardingClient *handle; @property (nonatomic) AJOBOnboardingClientListenerAdapter * onboardingListenerAdapter; @end @implementation AJOBSOnboardingClient - (void)dealloc { delete self.handle; delete self.onboardingListenerAdapter; } -(id)initWithBus:(AJNBusAttachment*) bus listener:(id ) listener { self = [super init]; if (self) { self.onboardingListenerAdapter = new AJOBOnboardingClientListenerAdapter(listener); self.handle = new ajn::services::OnboardingClient((ajn::BusAttachment&)(*bus.handle), *self.onboardingListenerAdapter); } return self; } -(QStatus)configureWiFi:(NSString*) busName obInfo:(AJOBInfo&) ajOBInfo resultStatus:(short&) resultStatus sessionId:(AJNSessionId) sessionId { // prepare OBInfo ajn::services::OBInfo obInfo; obInfo = [AJOBSOnboarding toOBInfo:ajOBInfo]; QStatus status = self.handle->ConfigureWiFi([AJNConvertUtil convertNSStringToConstChar:busName], obInfo, resultStatus, sessionId); return status; } -(QStatus)configureWiFi:(NSString*) busName obInfo:(AJOBInfo&)obInfo resultStatus:(short&) resultStatus { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return [self configureWiFi:busName obInfo:obInfo resultStatus:resultStatus sessionId:0]; } -(QStatus)connectTo:(NSString*) busName sessionId:(AJNSessionId) sessionId { return self.handle->ConnectTo([AJNConvertUtil convertNSStringToConstChar:busName], sessionId); } -(QStatus)connectTo:(NSString*) busName { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return[self connectTo:busName sessionId:0]; } -(QStatus)offboardFrom:(NSString*) busName sessionId:(AJNSessionId) sessionId { return self.handle->OffboardFrom([AJNConvertUtil convertNSStringToConstChar:busName], sessionId); } -(QStatus)offboardFrom:(NSString*) busName { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return [self offboardFrom:busName sessionId:0]; } -(QStatus)version:(NSString*) busName version:(int&) version sessionId:(AJNSessionId) sessionId { return self.handle->GetVersion([AJNConvertUtil convertNSStringToConstChar:busName], version, sessionId); } -(QStatus)version:(NSString*) busName version:(int&) version { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return [self version:busName version:version sessionId:0]; } -(QStatus)state:(NSString*) busName state:(short&) state sessionId:(AJNSessionId) sessionId { return self.handle->GetState([AJNConvertUtil convertNSStringToConstChar:busName], state, sessionId); } -(QStatus)state:(NSString*) busName state:(short&) state { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return [self state:busName state:state sessionId:0]; } -(QStatus)lastError:(NSString*) busName lastError:(AJOBLastError&) lastError sessionId:(AJNSessionId) sessionId { ajn::services::OBLastError obLastError; QStatus status = self.handle->GetLastError([AJNConvertUtil convertNSStringToConstChar:busName], obLastError, sessionId); lastError = [AJOBSOnboarding toAJOBLastError:obLastError]; return status; } -(QStatus)lastError:(NSString*) busName lastError:(AJOBLastError&) lastError { NSLog(@"No sessionId has been specified - the service will find an existing route to end point rather than access directly."); return [self lastError:busName lastError:lastError sessionId:0]; } @end base-16.04/onboarding/java/000077500000000000000000000000001272147170000155025ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/000077500000000000000000000000001272147170000210575ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/000077500000000000000000000000001272147170000224775ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/.classpath000066400000000000000000000007221272147170000244630ustar00rootroot00000000000000 base-16.04/onboarding/java/OnboardingManager/android/.project000066400000000000000000000014641272147170000241530ustar00rootroot00000000000000 OnboardingManager com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature base-16.04/onboarding/java/OnboardingManager/android/AndroidManifest.xml000066400000000000000000000025051272147170000262720ustar00rootroot00000000000000 base-16.04/onboarding/java/OnboardingManager/android/build.xml000066400000000000000000000063751272147170000243330ustar00rootroot00000000000000 base-16.04/onboarding/java/OnboardingManager/android/project.properties000066400000000000000000000011101272147170000262540ustar00rootroot00000000000000# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 android.library=true base-16.04/onboarding/java/OnboardingManager/android/res/000077500000000000000000000000001272147170000232705ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/res/.gitignore000066400000000000000000000001061272147170000252550ustar00rootroot00000000000000# Ignore everything in this directory * # Except this file !.gitignorebase-16.04/onboarding/java/OnboardingManager/android/src/000077500000000000000000000000001272147170000232665ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/000077500000000000000000000000001272147170000240555ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/000077500000000000000000000000001272147170000255255ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/000077500000000000000000000000001272147170000276475ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/000077500000000000000000000000001272147170000304305ustar00rootroot00000000000000OffboardingConfiguration.java000066400000000000000000000036641272147170000361750ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; /** *Holder of offboarding data: service name ,port */ public class OffboardingConfiguration { /** * The service name of the device */ private final String serviceName; /** * The port of the onboarding service */ private final short port; /** * Constructor of OffboardingConfiguration * * @param serviceName * {@link #serviceName} * @param port * {@link #port} * */ public OffboardingConfiguration(String serviceName, short port) { this.serviceName = serviceName; this.port = port; } /** * Get {@link #serviceName} * * @return the device's service name {@link #serviceName} */ public String getServiceName() { return serviceName; } /** * Get {@link #port} * * @return the devices's port {@link #port} */ public short getPort() { return port; } } OnboardingConfiguration.java000066400000000000000000000123311272147170000360260ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; /** * Holder of onboarding data: onboardee, target, and timeouts */ public class OnboardingConfiguration { /** * Stores the onboardee WIFI credentials. */ private WiFiNetworkConfiguration onboardee = null; /** * Stores the target WIFI credentials. */ private WiFiNetworkConfiguration target = null; /** * Stores the timeout of establishing WIFI connection with the onboardee in * msec. */ private long onboardeeConnectionTimeout = OnboardingManager.DEFAULT_WIFI_CONNECTION_TIMEOUT; /** * Stores the timeout of waiting for announcement from the onboardee after * establishing WIFI connection with the onboardee in msec. */ private long onboardeeAnnoucementTimeout = OnboardingManager.DEFAULT_ANNOUNCEMENT_TIMEOUT; /** * Stores the timeout of establishing WIFI connection with the target in * msec. */ private long targetConnectionTimeout = OnboardingManager.DEFAULT_WIFI_CONNECTION_TIMEOUT; /** * Stores the timeout of waiting for announcement from the onboardee after * establishing WIFI connection with the target in msec. */ private long targetAnnoucementTimeout = OnboardingManager.DEFAULT_ANNOUNCEMENT_TIMEOUT; /** * Constructor of OnboardingConfiguration that receives all parameters * including WIFI credentials and timeouts. * * @param onboardee * {@link #onboardee} * @param onboardeeConnectionTimeout * {@link #onboardeeConnectionTimeout} * @param onboardeeAnnoucementTimeout * {@link #onboardeeAnnoucementTimeout} * @param target * {@link #target} * @param targetConnectionTimeout * {@link #targetConnectionTimeout} * @param targetAnnoucementTimeout * {@link #targetAnnoucementTimeout} */ public OnboardingConfiguration(WiFiNetworkConfiguration onboardee, long onboardeeConnectionTimeout, long onboardeeAnnoucementTimeout, WiFiNetworkConfiguration target, long targetConnectionTimeout, long targetAnnoucementTimeout) { this.onboardee = onboardee; this.target = target; this.onboardeeConnectionTimeout = onboardeeConnectionTimeout; this.onboardeeAnnoucementTimeout = onboardeeAnnoucementTimeout; this.targetConnectionTimeout = targetConnectionTimeout; this.targetAnnoucementTimeout = targetAnnoucementTimeout; } /** * Constructor of OnboardingConfiguration that receives WIFI credentials and * uses default timeout values * * @param onboardee * {@link #onboardee} * @param target * {@link #target} */ public OnboardingConfiguration(WiFiNetworkConfiguration onboardee, WiFiNetworkConfiguration target) { this.onboardee = onboardee; this.target = target; } /** * Get {@link #onboardee} * * @return the onboardee of the configuration {@link #onboardee} */ public WiFiNetworkConfiguration getOnboardee() { return onboardee; } /** * Get {@link #target} * * @return the target of the configuration {@link #target} */ public WiFiNetworkConfiguration getTarget() { return target; } /** * Get {@link #onboardeeConnectionTimeout} * * @return the onboardee Wi-Fi timeout {@link #onboardeeConnectionTimeout} */ public long getOnboardeeConnectionTimeout() { return onboardeeConnectionTimeout; } /** * Get {@link #onboardeeAnnoucementTimeout} * * @return the onboardee announcement timeout * {@link #onboardeeAnnoucementTimeout} */ public long getOnboardeeAnnoucementTimeout() { return onboardeeAnnoucementTimeout; } /** * Get {@link #targetConnectionTimeout} * * @return the target Wi-Fi timeout {@link #targetConnectionTimeout} */ public long getTargetConnectionTimeout() { return targetConnectionTimeout; } /** * Get {@link #targetAnnoucementTimeout} * * @return the target announcement timeout {@link #targetAnnoucementTimeout} */ public long getTargetAnnoucementTimeout() { return targetAnnoucementTimeout; } } OnboardingIllegalArgumentException.java000066400000000000000000000025451272147170000401600ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; /** * Thrown to indicate that a method has been passed an illegal or inappropriate * argument. */ @SuppressWarnings("serial") public class OnboardingIllegalArgumentException extends Exception { public OnboardingIllegalArgumentException(String message) { super(message); } public OnboardingIllegalArgumentException() { super(); } } OnboardingIllegalStateException.java000066400000000000000000000025351272147170000374550ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; /** * Thrown to indicate that a m method has been invoked at an illegal or * inappropriate state. */ @SuppressWarnings("serial") public class OnboardingIllegalStateException extends Exception { public OnboardingIllegalStateException(String message) { super(message); } public OnboardingIllegalStateException() { super(); } }OnboardingManager.java000066400000000000000000002712331272147170000346010ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.UUID; import org.alljoyn.about.AboutKeys; import org.alljoyn.bus.AboutListener; import org.alljoyn.bus.AboutObj; import org.alljoyn.bus.AboutObjectDescription; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Status; import org.alljoyn.bus.Variant; import org.alljoyn.onboarding.OnboardingService.AuthType; import org.alljoyn.onboarding.client.OnboardingClient; import org.alljoyn.onboarding.client.OnboardingClientImpl; import org.alljoyn.onboarding.sdk.OnboardingManager.DeviceResponse.ResponseCode; import org.alljoyn.onboarding.transport.ConnectionResult; import org.alljoyn.onboarding.transport.ConnectionResultListener; import org.alljoyn.onboarding.transport.OnboardingTransport; import org.alljoyn.onboarding.transport.OnboardingTransport.ConfigureWifiMode; import org.alljoyn.services.common.ClientBase; import org.alljoyn.services.common.ServiceAvailabilityListener; import org.alljoyn.services.common.utils.TransportUtil; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.WifiConfiguration; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.util.Log; import android.util.Pair; /** * Streamlines the process of onboarding for Android application developers.
* The SDK encapsulates the Wi-Fi and AllJoyn sessions that are part of the * process.
* The Onboarding SDK API provides the following : * *
    *
  • Discovery of potential target networks,Discovery of potential * onboardees,by calling {@link #scanWiFi()} *
  • A single call, {@link #runOnboarding(OnboardingConfiguration)}, for start * the flow of onboarding process *
  • A single call ,{@link #runOffboarding(OffboardingConfiguration)}, for * starting the flow of offboarding process *
* *

* The onboarding flow works as follows: *

* The SDK uses a state machine handled by Andorid's handler * {@link #stateHandler} using the {@link #onHandleCommandMessage} function to * handle state changes. *

    *
  • IDLE state moves to CONNECTING_TO_ONBOARDEE when starting the onboarding * process *
  • CONNECTING_TO_ONBOARDEE state moves to WAITING_FOR_ONBOARDEE_ANNOUNCEMENT * after Wi-Fi connection has been established with onboardee device. *
  • WAITING_FOR_ONBOARDEE_ANNOUNCEMENT state moves to state * ONBOARDEE_ANNOUNCEMENT_RECEIVED after a valid announce message has been * received. *
  • ONBOARDEE_ANNOUNCEMENT_RECEIVED state moves to CONFIGURING_ONBOARDEE if * the onboardee supports onboarding service. *
  • CONFIGURING_ONBOARDEE state moves to CONNECTING_TO_TARGET_WIFI_AP if * passing the target credentials to the onboardee was successful. *
  • CONFIGURING_ONBOARDEE_WAITING_FOR_SIGNAL_TIMEOUT state moves to * CONNECTING_TO_TARGET_WIFI_AP if passing the target credentials to the * onboardee was successful. *
  • CONNECTING_TO_TARGET_WIFI_AP moves to WAITING_FOR_TARGET_ANNOUNCE after * Wi-Fi connection has been established with target . *
  • WAITING_FOR_TARGET_ANNOUNCE moves to TARGET_ANNOUNCEMENT_RECEIVED after * after a valid announce message has been received. *
* *

* The SDK receives events from external resources *

    *
  • OnboardingSDKWifiManager {@link #onboardingClient} that broadcasts Wi-Fi * success and failure to connect to a desired Wi-Fi device. *
  • onAnnouncement callback which handles AllJoyn AboutService announcements. *
* *

* The SDK uses intents to report status changes and errors during * onboarding/offboarding process. *

    *
  • {@link #STATE_CHANGE_ACTION} action with extra *
      *
    • {@link #EXTRA_ONBOARDING_STATE} extra information of enum * {@link OnboardingState} *
    *
  • {@link #ERROR} action with extra *
      *
    • {@link #EXTRA_ERROR_DETAILS} extra information of enum * {@link OnboardingErrorType} *
    *
* *

* View sample code for SDK usage */ public class OnboardingManager implements AboutListener { /** * Activity Action:WIFI has been connected */ public static final String WIFI_CONNECTED_BY_REQUEST_ACTION = "org.alljoyn.onboardingsdk.wifi.connection_by_request"; /** * Activity Action:WIFI connection has timed out */ public static final String WIFI_TIMEOUT_ACTION = "org.alljoyn.onboardingsdk.wifi.time_out"; /** * Activity Action:WIFI authentication has occurred */ public static final String WIFI_AUTHENTICATION_ERROR = "org.alljoyn.onboardingsdk.wifi.authentication_error"; /** * The lookup key for WifiConfiguration details after connection request. */ public static final String EXTRA_WIFI_WIFICONFIGURATION = "org.alljoyn.intent_keys.WifiConfiguration"; /** * The lookup key for list of onboardee access points */ public static final String EXTRA_ONBOARDEES_AP = "org.alljoyn.onboardingsdk.intent_keys.onboardeesAP"; /** * The lookup key for list of target access points */ public static final String EXTRA_TARGETS_AP = "org.alljoyn.onboardingsdk.intent_keys.targetsAP"; /** * The lookup key for list of all access points */ public static final String EXTRA_ALL_AP = "org.alljoyn.onboardingsdk.intent_keys.allAP"; /** * The lookup key for Onboarding state reported by the SDK */ public static final String EXTRA_ONBOARDING_STATE = "org.alljoyn.onboardingsdk.intent_keys.onboardingState"; /** * The lookup key for ERROR details reported by the SDK */ public static final String EXTRA_ERROR_DETAILS = "org.alljoyn.onboardingsdk.intent_keys.error"; /** * The lookup key for EXTRA_DEVICE_BUS_NAME reported by the SDK ,used to * report device service name during call * {@link #offboardDevice(String, short)} */ public static final String EXTRA_DEVICE_BUS_NAME = "org.alljoyn.onboardingsdk.intent_keys.device_bus_name"; /** * The lookup key for EXTRA_DEVICE_ONBOARDEE_SSID reported by the SDK after * successful onboarding process ,reports the onboardee ssid name */ public static final String EXTRA_DEVICE_ONBOARDEE_SSID = "org.alljoyn.onboardingsdk.intent_keys.device_onboardee_ssid"; /** * The lookup key for EXTRA_DEVICE_TARGET_SSID reported by the SDK after * successful onboarding process ,reports the target ssid name */ public static final String EXTRA_DEVICE_TARGET_SSID = "org.alljoyn.onboardingsdk.intent_keys.device_target_ssid"; /** * The lookup key for EXTRA_DEVICE_APPID reported by the SDK after * successful onboarding process ,reports the application id */ public static final String EXTRA_DEVICE_APPID = "org.alljoyn.onboardingsdk.intent_keys.device_appid"; /** * The lookup key for EXTRA_DEVICE_DEVICEID reported by the SDK after * successful onboarding process ,reports the device id */ public static final String EXTRA_DEVICE_DEVICEID = "org.alljoyn.onboardingsdk.intent_keys.device_deviceid"; /** * Activity Action: indicates that the WIFI scan has been completed */ public static final String WIFI_SCAN_RESULTS_AVAILABLE_ACTION = "org.alljoyn.onboardingsdk.scan_result_available"; /** * Activity Action: indicates state changes in the SDK */ public static final String STATE_CHANGE_ACTION = "org.alljoyn.onboardingsdk.state_change"; /** * Activity Action: indicates error encountered by the SDK */ public static final String ERROR = "org.alljoyn.onboardingsdk.error"; /** * Activity Action: indicates that the user is connecting to the softAP via android Marshmallow and some features may be unavailable. */ public static final String MARSHMALLOW_SOFTAP_CONNECT = "org.alljoyn.onboardingsdk.marshmallow_softap_connect"; /** * These enumeration values are used to indicate possible errors * * see also {@link #EXTRA_ERROR_DETAILS} */ public static enum OnboardingErrorType { /** * Wi-Fi is disabled. */ WIFI_DISABLED(0), /** * Onboardee Wi-Fi authentication error. */ ONBOARDEE_WIFI_AUTH(10), /** * Target Wi-Fi authentication error. */ TARGET_WIFI_AUTH(11), /** * Onboardee Wi-Fi connection timeout. */ ONBOARDEE_WIFI_TIMEOUT(12), /** * Target Wi-Fi connection timeout. */ TARGET_WIFI_TIMEOUT(13), /** * Timeout while searching for onboardee. */ FIND_ONBOARDEE_TIMEOUT(14), /** * Error while establishing AllJoyn session. */ JOIN_SESSION_ERROR(15), /** * Timeout while establishing AllJoyn session. */ JOIN_SESSION_TIMEOUT(16), /** * Error while configuring onboardee with target credentials. */ ERROR_CONFIGURING_ONBOARDEE(17), /** * Timeout while waiting for signal in two state configuring. */ CONFIGURING_ONBOARDEE_WAITING_FOR_SIGNAL_TIMEOUT(18), /** * Timeout while waiting to receive announcement from onboardee on * target network. */ VERIFICATION_TIMEOUT(19), /** * Failed ot offboard a device from target. */ OFFBOARDING_FAILED(20), /** * Announce data is inavalid. */ INVALID_ANNOUNCE_DATA(21), /** * Wi-Fi connection timeout * {@link OnboardingManager#connectToNetwork(WiFiNetworkConfiguration, long)} */ OTHER_WIFI_TIMEOUT(30), /** * Wi-Fi authentication error * {@link OnboardingManager#connectToNetwork(WiFiNetworkConfiguration, long)} */ OTHER_WIFI_AUTH(31), /** * Wi-Fi connection timeout {@link OnboardingManager#abortOnboarding()} */ ORIGINAL_WIFI_TIMEOUT(32), /** * Wi-Fi authentication error * {@link OnboardingManager#abortOnboarding()} */ ORIGINAL_WIFI_AUTH(33), /** * SDK internal error */ INTERNAL_ERROR(40); private int value; private OnboardingErrorType(int value) { this.value = value; } public int getValue() { return value; } public static OnboardingErrorType getOnboardingErrorTypeByValue(int value) { OnboardingErrorType retType = null; for (OnboardingErrorType type : OnboardingErrorType.values()) { if (value == type.getValue()) { retType = type; break; } } return retType; } public static OnboardingErrorType getOnboardingErrorTypeByString(String str) { OnboardingErrorType retType = null; for (OnboardingErrorType type : OnboardingErrorType.values()) { if (type.name().equals(str)) { retType = type; } } return retType; } @Override public String toString() { return this.name(); } }; /** * These enumeration values are used to indicate the current onboarding * state * * see also {@link #EXTRA_ONBOARDING_STATE} {@link #STATE_CHANGE_ACTION} */ public static enum OnboardingState { /** * Connecting to onboardee Wi-Fi */ CONNECTING_ONBOARDEE_WIFI(0), /** * Connected to onboardee Wi-Fi */ CONNECTED_ONBOARDEE_WIFI(1), /** * Waiting for announcement from onboardee */ FINDING_ONBOARDEE(2), /** * Announcement received from onboardee */ FOUND_ONBOARDEE(3), /** * Creating AllJoyn session with onboardee */ JOINING_SESSION(4), /** * AllJoyn session established with onboardee */ SESSION_JOINED(5), /** * Sending target credentials to onboardee */ CONFIGURING_ONBOARDEE(6), /** * Waiting for signal from onboardee with two stage configuring */ CONFIGURING_ONBOARDEE_WITH_SIGNAL(7), /** * Onboardee received target credentials */ CONFIGURED_ONBOARDEE(8), /** * Connecting to WIFI target */ CONNECTING_TARGET_WIFI(9), /** * Wi-Fi connection with target established */ CONNECTED_TARGET_WIFI(10), /** * Wait for announcement from onboardee over target WIFI */ VERIFYING_ONBOARDED(11), /** * Announcement from onboardee over target WIFI has been received */ VERIFIED_ONBOARDED(12), /** * Connecting to the original network before calling * {@link OnboardingManager#runOnboarding(OnboardingConfiguration)}. */ CONNECTING_ORIGINAL_WIFI(13), /** * Connected to the original network before calling * {@link OnboardingManager#runOnboarding(OnboardingConfiguration)}. */ CONNECTED_ORIGINAL_WIFI(14), /** * Connecting to the selected network * {@link OnboardingManager#connectToNetwork(WiFiNetworkConfiguration, long)} * . */ CONNECTING_OTHER_WIFI(15), /** * Connected to the selected network * {@link OnboardingManager#connectToNetwork(WiFiNetworkConfiguration, long)} * . */ CONNECTED_OTHER_WIFI(16), /** * Aborting has been started. */ ABORTING(20), /** * Aborting has been completed. */ ABORTED(21); private int value; private OnboardingState(int value) { this.value = value; } public int getValue() { return value; } public static OnboardingState getOnboardingStateByValue(int value) { OnboardingState retType = null; for (OnboardingState type : OnboardingState.values()) { if (value == type.getValue()) { retType = type; break; } } return retType; } public static OnboardingState getOnboardingStateByString(String str) { OnboardingState retType = null; for (OnboardingState type : OnboardingState.values()) { if (type.name().equals(str)) { retType = type; break; } } return retType; } @Override public String toString() { return this.name(); } } /** * These enumeration values are used to filter Wi-Fi scan result * {@link OnboardingManager#scanWiFi()} */ public static enum WifiFilter { /** * Wi-Fi access point name that contains the following prefix * {@link OnboardingSDKWifiManager#ONBOARDABLE_PREFIX} or suffix * {@link OnboardingSDKWifiManager#ONBOARDABLE_SUFFIX} */ ONBOARDABLE, /** * Wi-Fi access point name that doesn't contain the following prefix * {@link OnboardingSDKWifiManager#ONBOARDABLE_PREFIX} or suffix * {@link OnboardingSDKWifiManager#ONBOARDABLE_SUFFIX} */ TARGET, /** * Wi-Fi access point name . */ ALL } /** * DeviceResponse is a class used internally to encapsulate possible errors * that may occur during AllJoyn transactions carried by the SDK */ static class DeviceResponse { /** * enumeration of possible ResponseCodes */ public enum ResponseCode { /** * AllJoyn transaction successful */ Status_OK, /** * AllJoyn transaction general error */ Status_ERROR, /** * AllJoyn session creation error */ Status_ERROR_CANT_ESTABLISH_SESSION, /** * AllJoyn transaction successful */ Status_OK_CONNECT_SECOND_PHASE, } /** * holds the response code. */ private final ResponseCode status; /** * holds the description of the error. */ private String description = null; /** * DeviceResponse Constructor * * @param status * {@link #status} * */ public DeviceResponse(ResponseCode status) { this.status = status; } /** * DeviceResponse Constructor * * @param status * {@link #status} * @param description * {@link #description} * */ public DeviceResponse(ResponseCode status, String description) { this.status = status; this.description = description; } /** * Get {@link #status} * * @return the status code {@link #status} */ public ResponseCode getStatus() { return status; } /** * Get {@link #description} * * @return the error description {@link #description} */ public String getDescription() { return description; } } /** * TAG for debug information */ private final static String TAG = "OnboardingManager"; /** * Default timeout for Wi-Fi connection * {@value #DEFAULT_WIFI_CONNECTION_TIMEOUT} msec */ public static final int DEFAULT_WIFI_CONNECTION_TIMEOUT = 20000; /** * Default timeout for waiting for * {@link AboutObj#announce(short, org.alljoyn.bus.AboutDataListener)} * {@value #DEFAULT_ANNOUNCEMENT_TIMEOUT} msec */ public static final int DEFAULT_ANNOUNCEMENT_TIMEOUT = 25000; /** * OnboardingManager singleton */ private static volatile OnboardingManager onboardingManager = null; /** * Application context */ private Context context = null; /** * HandlerThread for the state machine looper */ private static HandlerThread stateHandlerThread; /** * Handler for OnboardingManager state changing messages. */ private static Handler stateHandler = null; /** * Stores the OnboardingsdkWifiManager object */ private OnboardingSDKWifiManager onboardingSDKWifiManager = null; /** * Stores the OnboardingConfiguration object */ private OnboardingConfiguration onboardingConfiguration = null; /** * IntentFilter used to filter out intents of WIFI messages received from * OnboardingsdkWifiManager */ private final IntentFilter wifiIntentFilter = new IntentFilter(); /** * BroadcastReceiver for intents from OnboardingSDKWifiManager while running * the onboarding process. */ private BroadcastReceiver onboardingWifiBroadcastReceiver = null; /** * BroadcastReceiver for intents from OnboardingsdkWifiManager while running * {@link #connectToNetwork(WiFiNetworkConfiguration, long)} */ private BroadcastReceiver connectToNetworkWifiBroadcastReceiver = null; /** * Stores the OnboardingClient object used to communicate with * OnboardingService. */ private OnboardingClient onboardingClient = null; /** * Stores the BusAttachment needed for accessing Alljoyn framework. */ private BusAttachment bus = null; /** * Timer used for managing announcement timeout */ private Timer announcementTimeout = new Timer(); /** * Indicates a special case when {@link #abortOnboarding()} is in state * {@link State#JOINING_SESSION} */ private final int ABORTING_INTERRUPT_FLAG = 0x100; /** * Indicator flag to listen to incoming Announcements */ private static volatile boolean listenToAnnouncementsFlag; /** * Stores the OnboardingManager state machine state */ private State currentState = State.IDLE; /** * Stores the original network name before starting onboarding process. */ private String originalNetwork; /** * Handles About Service announcements */ @Override public void announced(final String serviceName, final int version, final short port, final AboutObjectDescription[] objectDescriptions, final Map serviceMetadata) { synchronized (TAG) { if (!listenToAnnouncementsFlag) { Log.w(TAG, "AnnouncementHandler not in listeneing mode"); return; } } Log.d(TAG, "onAnnouncement: received state " + currentState.toString()); Map announceDataMap = null; try { announceDataMap = TransportUtil.fromVariantMap(serviceMetadata); if (announceDataMap == null) { // ignoring error. will be handled by announcement timeout Log.e(TAG, "onAnnouncement: invalid announcement"); return; } } catch (BusException e) { // ignoring error. will be handled by announcement timeout Log.e(TAG, "onAnnouncement: invalid announcement", e); return; } UUID uniqueId = (UUID) announceDataMap.get(AboutKeys.ABOUT_APP_ID); if (uniqueId == null) { Log.e(TAG, "onAnnouncement: received null device uuid!! ignoring."); return; } else { Log.d(TAG, "onAnnouncement: UUID=" + uniqueId + ", busName=" + serviceName + ", port=" + port); } switch (currentState) { case CONNECTING_TO_ONBOARDEE: context.unregisterReceiver(onboardingWifiBroadcastReceiver); // no need for break case WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: if (isSeviceSupported(objectDescriptions, OnboardingTransport.INTERFACE_NAME)) { setState(State.ONBOARDEE_ANNOUNCEMENT_RECEIVED, new AnnounceData(serviceName, port, objectDescriptions, serviceMetadata)); } else { Log.e(TAG, "onAnnouncement: for device UUID " + deviceData.getAppUUID() + " doesn't support onboarding interface"); } break; case ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: if (isSeviceSupported(objectDescriptions, OnboardingTransport.INTERFACE_NAME)) { setState(State.ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT, new AnnounceData(serviceName, port, objectDescriptions, serviceMetadata)); } else { Log.e(TAG, "onAnnouncement: for device UUID " + deviceData.getAppUUID() + " doesn't support onboarding interface"); } break; case CONNECTING_TO_TARGET_WIFI_AP: context.unregisterReceiver(onboardingWifiBroadcastReceiver); // no need for break case WAITING_FOR_TARGET_ANNOUNCE: if (deviceData != null && deviceData.getAnnounceData() != null && deviceData.getAppUUID() != null) { if (deviceData.getAppUUID().compareTo(uniqueId) == 0) { setState(State.TARGET_ANNOUNCEMENT_RECEIVED, new AnnounceData(serviceName, port, objectDescriptions, serviceMetadata)); } } break; case ERROR_WAITING_FOR_TARGET_ANNOUNCE: if (isSeviceSupported(objectDescriptions, OnboardingTransport.INTERFACE_NAME)) { setState(State.ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT, new AnnounceData(serviceName, port, objectDescriptions, serviceMetadata)); } else { Log.e(TAG, "onAnnouncement: for device UUID " + deviceData.getAppUUID() + " doesn't support onboarding interface"); } break; default: break; } } /** * Stores information about the device to be onboarded */ private DeviceData deviceData = null; /** * Internal class that stores information about the device to be onboarded * AnnounceData,appUUID */ private static class DeviceData { public AnnounceData getAnnounceData() { return announceData; } public void setAnnounceData(AnnounceData announceData) throws BusException { this.announceData = announceData; Map announceDataMap = TransportUtil.fromVariantMap(announceData.getServiceMetadata()); appUUID = (UUID) announceDataMap.get(AboutKeys.ABOUT_APP_ID); deviceID = (String) announceDataMap.get(AboutKeys.ABOUT_DEVICE_ID); } private AnnounceData announceData = null; public UUID getAppUUID() { return appUUID; } public String getDeviceID() { return deviceID; } private UUID appUUID = null; private String deviceID = null; } /** * An internal class to store the Announcement received by the AboutService. */ private static class AnnounceData { private final String serviceName; private final short port; private final AboutObjectDescription[] objectDescriptions; private final Map serviceMetadata; public String getServiceName() { return serviceName; } public AboutObjectDescription[] getObjectDescriptions() { return objectDescriptions; } public Map getServiceMetadata() { return serviceMetadata; } public short getPort() { return port; } public AnnounceData(String serviceName, short port, AboutObjectDescription[] objectDescriptions, Map serviceMetadata) { this.serviceName = serviceName; this.port = port; this.objectDescriptions = objectDescriptions; this.serviceMetadata = serviceMetadata; } } /** * These enumeration values are used to indicate the current internal state * of the OnboardingManager state machine. */ private static enum State { /** * Start state */ IDLE(0), /** * Connecting to onboardee device Wi-Fi */ CONNECTING_TO_ONBOARDEE(10), /** * Waiting for announcement on onboardee Wi-Fi */ WAITING_FOR_ONBOARDEE_ANNOUNCEMENT(11), /** * Announcement received on onboardee Wi-Fi */ ONBOARDEE_ANNOUNCEMENT_RECEIVED(12), /** * Join session with onboardee */ JOINING_SESSION(13), /** * Configuring onboardee with target credentials */ CONFIGURING_ONBOARDEE(14), /** * Configuring onboardee with target credentials */ CONFIGURING_ONBOARDEE_WITH_SIGNAL(15), /** * Connecting to target Wi-Fi AP */ CONNECTING_TO_TARGET_WIFI_AP(20), /** * Waiting for announcement on target Wi-Fi from onboardee */ WAITING_FOR_TARGET_ANNOUNCE(21), /** * Announcement received on target Wi-Fi from onboardee */ TARGET_ANNOUNCEMENT_RECEIVED(22), /** * Aborting state ,temporary state used to Abort the onboarding process. */ ABORTING(30), /** * Error connecting to onboardee device Wi-Fi */ ERROR_CONNECTING_TO_ONBOARDEE(110), /** * Error waiting for announcement on onboardee Wi-Fi */ ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT(111), /** * Error annnouncemnet has been received from onboardee after timeout * expired */ ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT(112), /** * Error announcement received on onboardee Wi-Fi */ ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED(113), /** * Error joining AllJoyn session */ ERROR_JOINING_SESSION(114), /** * Error configuring onboardee with target credentials */ ERROR_CONFIGURING_ONBOARDEE(115), /** * Error waiting for configure onboardee signal */ ERROR_WAITING_FOR_CONFIGURE_SIGNAL(116), /** * Error connecting to target Wi-Fi AP */ ERROR_CONNECTING_TO_TARGET_WIFI_AP(120), /** * Error waiting for announcement on target Wi-Fi from onboardee */ ERROR_WAITING_FOR_TARGET_ANNOUNCE(121), /** * Error annnouncemnet has been received from target after timeout * expired */ ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT(122); private int value; private State(int value) { this.value = value; } public int getValue() { return value; } public static State getStateByValue(int value) { State retType = null; for (State type : State.values()) { if (value == type.getValue()) { retType = type; break; } } return retType; } } /** * @return instance of the OnboardingManager */ public static OnboardingManager getInstance() { if (onboardingManager == null) { synchronized (TAG) { if (onboardingManager == null) { onboardingManager = new OnboardingManager(); } } } return onboardingManager; } private OnboardingManager() { wifiIntentFilter.addAction(WIFI_CONNECTED_BY_REQUEST_ACTION); wifiIntentFilter.addAction(WIFI_TIMEOUT_ACTION); wifiIntentFilter.addAction(WIFI_AUTHENTICATION_ERROR); stateHandlerThread = new HandlerThread("OnboardingManagerLooper"); stateHandlerThread.start(); stateHandler = new Handler(stateHandlerThread.getLooper()) { @Override public void handleMessage(Message msg) { onHandleCommandMessage(msg); } }; } /** * Initialize the SDK singleton with the current application configuration. * Registers AnnouncementHandler to receive announcements * * @param context * The application context. * @param aboutService * The user application's About service. * @param bus * The user application's bus attachment. * @throws OnboardingIllegalArgumentException * if either of the parameters is null. * @throws OnboardingIllegalStateException * if already initialized. */ public void init(Context context, BusAttachment bus) throws OnboardingIllegalArgumentException, OnboardingIllegalStateException { synchronized (TAG) { if (context == null || bus == null) { throw new OnboardingIllegalArgumentException(); } if (this.context != null || this.bus != null) { throw new OnboardingIllegalStateException(); } synchronized (TAG) { listenToAnnouncementsFlag = false; } this.bus = bus; this.bus.registerAboutListener(this); this.bus.whoImplements(new String[] { OnboardingTransport.INTERFACE_NAME }); this.context = context; this.onboardingSDKWifiManager = new OnboardingSDKWifiManager(this.context); } } /** * Terminate the SDK . * * @throws OnboardingIllegalStateException * if not in IDLE state ,need to abort first. */ public void shutDown() throws OnboardingIllegalStateException { synchronized (TAG) { if (currentState == State.IDLE) { this.context = null; this.bus.cancelWhoImplements(new String[] { OnboardingTransport.INTERFACE_NAME }); this.bus.unregisterAboutListener(this); this.bus = null; this.onboardingSDKWifiManager = null; } else { throw new OnboardingIllegalStateException("Not in IDLE state ,please Abort first"); } } } /** * Handle the CONNECT_TO_ONBOARDEE state. Listen to WIFI intents from * OnboardingsdkWifiManager. Requests from OnboardingsdkWifiManager to * connect to the Onboardee. If successful moves to the next state otherwise * sends an error intent and returns to IDLE state. */ private void handleConnectToOnboardeeState() { final Bundle extras = new Bundle(); onboardingWifiBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d(TAG, "handleConnectToOnboardeeState onReceive action=" + action); if (action == null) { return; } if (WIFI_CONNECTED_BY_REQUEST_ACTION.equals(action)) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTED_ONBOARDEE_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.WAITING_FOR_ONBOARDEE_ANNOUNCEMENT); } if (WIFI_TIMEOUT_ACTION.equals(action)) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ONBOARDEE_WIFI_TIMEOUT.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONNECTING_TO_ONBOARDEE); } if (WIFI_AUTHENTICATION_ERROR.equals(action)) { extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ONBOARDEE_WIFI_AUTH.toString()); sendBroadcast(ERROR, extras); context.unregisterReceiver(onboardingWifiBroadcastReceiver); setState(State.ERROR_CONNECTING_TO_ONBOARDEE); } } }; context.registerReceiver(onboardingWifiBroadcastReceiver, wifiIntentFilter); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTING_ONBOARDEE_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); onboardingSDKWifiManager.connectToWifiAP(onboardingConfiguration.getOnboardee().getSSID(), onboardingConfiguration.getOnboardee().getAuthType(), onboardingConfiguration.getOnboardee() .getPassword(), onboardingConfiguration.getOnboardee().isHidden(), onboardingConfiguration.getOnboardeeConnectionTimeout()); } /** * Handle the WAIT_FOR_ONBOARDEE_ANNOUNCE state. Set a timer using * {@link #startAnnouncementTimeout()} Wait for an announcement which should * arrive from the onAnnouncement handler. */ private void handleWaitForOnboardeeAnnounceState() { Bundle extras = new Bundle(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.FINDING_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); if (!startAnnouncementTimeout()) { extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.INTERNAL_ERROR.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT); } } /** * Handle the ERROR_TARGETR_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT state. * Verifies that Announcement is valid if so stay on * ERROR_TARGER_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT state ,otherwise moves * to state ERROR_WAITING_FOR_TARGET_ANNOUNCE. This state is only for * continuing from state ERROR_WAITING_FOR_TARGET_ANNOUNCEMENT if the * Announcement has been received while the timer has expired. * * @param announceData * contains the information of the Announcement . */ private void handleErrorTargetAnnouncementReceivedAfterTimeoutState(AnnounceData announceData) { deviceData = new DeviceData(); try { Log.d(TAG, "handleErrorTargetAnnouncementReceivedAfterTimeoutState" + announceData.getServiceName() + " " + announceData.getPort()); deviceData.setAnnounceData(announceData); } catch (BusException e) { Log.e(TAG, "handleErrorTargetAnnouncementReceivedAfterTimeoutState DeviceData.setAnnounceObject failed with BusException. ", e); Bundle extras = new Bundle(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.INVALID_ANNOUNCE_DATA.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_TARGET_ANNOUNCE); } } /** * Handle the ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT state. * Verifies that Announcement is valid if so stay on * ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT state ,otherwise * moves to state ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED. This state is only * for continuing from state ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT if the * Announcement has been received while the timer has expired. * * @param announceData * contains the information of the Announcement . */ private void handleErrorOnboardeeAnnouncementReceivedAfterTimeoutState(AnnounceData announceData) { Bundle extras = new Bundle(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.FOUND_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); deviceData = new DeviceData(); try { deviceData.setAnnounceData(announceData); } catch (BusException e) { Log.e(TAG, "handleOnboardeeAnnouncementReceivedState DeviceData.setAnnounceObject failed with BusException. ", e); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.INVALID_ANNOUNCE_DATA.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED); } } /** * Handle the ONBOARDEE_ANNOUNCEMENT_RECEIVED state. Stop the announcement * timeout timer, Verifies that Announcement is valid if so moves to state * JOINING_SESSION,otherwise moves to state * ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED * * @param announceData * contains the information of the Announcement . */ private void handleOnboardeeAnnouncementReceivedState(AnnounceData announceData) { stopAnnouncementTimeout(); Bundle extras = new Bundle(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.FOUND_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); deviceData = new DeviceData(); try { deviceData.setAnnounceData(announceData); setState(State.JOINING_SESSION, announceData); } catch (BusException e) { Log.e(TAG, "handleOnboardeeAnnouncementReceivedState DeviceData.setAnnounceObject failed with BusException. ", e); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.INVALID_ANNOUNCE_DATA.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED); } } /** * Handle the JOINING_SESSION state. Handle AllJoyn session establishment * with the device. * * @param announceData * contains the information of the announcement */ private void handleJoiningSessionState(AnnounceData announceData) { Bundle extras = new Bundle(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.JOINING_SESSION.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); ResponseCode response = establishSessionWithDevice(announceData).getStatus(); if (response == ResponseCode.Status_OK) { extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.SESSION_JOINED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.CONFIGURING_ONBOARDEE); } else { extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.JOIN_SESSION_ERROR.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_JOINING_SESSION); } } /** * Handle the CONFIGURE_ONBOARDEE state. Call onboardDevice to send target * information to the board. in case successful moves to next step else move * to ERROR_CONFIGURING_ONBOARDEE state. */ private void handleConfigureOnboardeeState() { Bundle extras = new Bundle(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURING_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); ResponseCode responseCode = onboardDevice().getStatus(); if (responseCode == ResponseCode.Status_OK) { extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURED_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.CONNECTING_TO_TARGET_WIFI_AP); } else if (responseCode == ResponseCode.Status_OK_CONNECT_SECOND_PHASE) { extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURING_ONBOARDEE_WITH_SIGNAL.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.CONFIGURING_ONBOARDEE_WITH_SIGNAL); } else { extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ERROR_CONFIGURING_ONBOARDEE.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONFIGURING_ONBOARDEE); } } /** * Handle the CONFIGURING_ONBOARDEE_WITH_SIGNAL state. Register to receive * oboarding siganl , start timeout if signal arrives in time call * {@link OnboardingClient#connectWiFi()} otherwise move to * ERROR_WAITING_FOR_CONFIGURE_SIGNAL state . */ private void handleConfigureWithSignalOnboardeeState() { final Bundle extras = new Bundle(); final Timer configWifiSignalTimeout = new Timer(); final ConnectionResultListener listener = new ConnectionResultListener() { @Override public void onConnectionResult(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionResult recevied " + connectionResult.getConnectionResponseType() + " " + connectionResult.getMessage()); configWifiSignalTimeout.cancel(); configWifiSignalTimeout.purge(); try { onboardingClient.unRegisterConnectionResultListener(this); if (connectionResult.getConnectionResponseType() == ConnectionResult.ConnectionResponseType.VALIDATED) { onboardingClient.connectWiFi(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURED_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.CONNECTING_TO_TARGET_WIFI_AP); } else { extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ERROR_CONFIGURING_ONBOARDEE.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONFIGURING_ONBOARDEE); return; } } catch (Exception e) { Log.e(TAG, "onConnectionResult error", e); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ERROR_CONFIGURING_ONBOARDEE.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONFIGURING_ONBOARDEE); } } }; try { configWifiSignalTimeout.schedule(new TimerTask() { @Override public void run() { Log.e(TAG, "configWifiSignalTimeout expired"); onboardingClient.unRegisterConnectionResultListener(listener); configWifiSignalTimeout.cancel(); configWifiSignalTimeout.purge(); onboardingClient.unRegisterConnectionResultListener(listener); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.CONFIGURING_ONBOARDEE_WAITING_FOR_SIGNAL_TIMEOUT.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_CONFIGURE_SIGNAL); } }, 30 * 1000); onboardingClient.registerConnectionResultListener(listener); } catch (Exception e) { Log.e(TAG, "registerConnectionResultListener", e); configWifiSignalTimeout.cancel(); configWifiSignalTimeout.purge(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ERROR_CONFIGURING_ONBOARDEE.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONFIGURING_ONBOARDEE); // send error } } /** * Handle the CONNECT_TO_TARGET state. Listen to WIFI intents from * OnboardingsdkWifiManager Requests from OnboardingsdkWifiManager to * connect to the Target. if successful moves to the next state otherwise * send error intent and returns to IDLE state. */ private void handleConnectToTargetState() { final Bundle extras = new Bundle(); onboardingWifiBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d(TAG, "onReceive action=" + action); if (action != null) { if (WIFI_CONNECTED_BY_REQUEST_ACTION.equals(action)) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTED_TARGET_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.WAITING_FOR_TARGET_ANNOUNCE); } if (WIFI_TIMEOUT_ACTION.equals(action)) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.TARGET_WIFI_TIMEOUT.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONNECTING_TO_TARGET_WIFI_AP); } if (WIFI_AUTHENTICATION_ERROR.equals(action)) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.TARGET_WIFI_AUTH.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_CONNECTING_TO_TARGET_WIFI_AP); } } } };// receiver context.registerReceiver(onboardingWifiBroadcastReceiver, wifiIntentFilter); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTING_TARGET_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); onboardingSDKWifiManager.connectToWifiAP(onboardingConfiguration.getTarget().getSSID(), onboardingConfiguration.getTarget().getAuthType(), onboardingConfiguration.getTarget().getPassword(), onboardingConfiguration.getTarget().isHidden(), onboardingConfiguration.getTargetConnectionTimeout()); } /** * Handle the WAIT_FOR_TARGET_ANNOUNCE state. Set a timer with using * startAnnouncementTimeout. waits for an announcement which should arrive * from the onAnnouncement handler. */ private void handleWaitForTargetAnnounceState() { Bundle extras = new Bundle(); extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.VERIFYING_ONBOARDED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); if (!startAnnouncementTimeout()) { extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.INTERNAL_ERROR.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_TARGET_ANNOUNCE); } } /** * Handls the TARGET_ANNOUNCEMENT_RECEIVED state. *

    *
  • Call {@link #stopAnnouncementTimeout()} *
  • Send a success broadcast. *
  • Move state machine to IDLE state (onboarding process finished) *
  • Enable all Wi-Fi access points that were disabled in the onboarding * process. *
* * @param announceData * contains the information of the announcement . */ private void handleTargetAnnouncementReceivedState(AnnounceData announceData) { stopAnnouncementTimeout(); Bundle extras = new Bundle(); extras.putString(EXTRA_DEVICE_ONBOARDEE_SSID, onboardingConfiguration.getOnboardee().getSSID()); extras.putString(EXTRA_DEVICE_TARGET_SSID, onboardingConfiguration.getTarget().getSSID()); deviceData = new DeviceData(); try { deviceData.setAnnounceData(announceData); extras.putSerializable(EXTRA_DEVICE_APPID, deviceData.getAppUUID()); extras.putString(EXTRA_DEVICE_DEVICEID, deviceData.getDeviceID()); } catch (BusException e) { Log.e(TAG, "handleTargetAnnouncementReceivedState unable to retrieve AppID/DeviceID ", e); } extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.VERIFIED_ONBOARDED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); synchronized (TAG) { listenToAnnouncementsFlag = false; } setState(State.IDLE); onboardingSDKWifiManager.enableAllWifiNetworks(); onboardingSDKWifiManager.removeWifiAP(onboardingConfiguration.getOnboardee().getSSID()); } /** * Handle the the ABORTING state. Due to the implementation of the state * machine via hander. Messages are received into the handler's queue ,and * are handled serially , when ABORTING message is received * handleAbortingState deletes all messages in the handlers queue .In case * there are any messages there . Due to the blocking nature of * JOINING_SESSION state the ABORTING message can be handled only after it * has completed!. */ private void handleAbortingState() { // store current State in initalState State initalState = currentState; // set state to State.ABORTING currentState = State.ABORTING; // in case State.JOINING_SESSION push ABORTING_INTERRUPT_FLAG into the // stateHandler queue. if (initalState == State.JOINING_SESSION) { stateHandler.sendMessageDelayed(stateHandler.obtainMessage(ABORTING_INTERRUPT_FLAG), 60 * 60 * 10000); return; } // remove all queued up messages in the stateHandler for (State s : State.values()) { stateHandler.removeMessages(s.value); } // note ABORTING state can't be handled during JOINING_SESSION it is // blocking! switch (initalState) { case CONNECTING_TO_ONBOARDEE: context.unregisterReceiver(onboardingWifiBroadcastReceiver); abortStateCleanUp(); break; case WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: stopAnnouncementTimeout(); abortStateCleanUp(); break; case ONBOARDEE_ANNOUNCEMENT_RECEIVED: abortStateCleanUp(); break; case CONFIGURING_ONBOARDEE: case CONFIGURING_ONBOARDEE_WITH_SIGNAL: abortStateCleanUp(); break; case ERROR_CONNECTING_TO_ONBOARDEE: case ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED: case ERROR_JOINING_SESSION: case ERROR_CONFIGURING_ONBOARDEE: case ERROR_WAITING_FOR_CONFIGURE_SIGNAL: case ERROR_CONNECTING_TO_TARGET_WIFI_AP: abortStateCleanUp(); break; case WAITING_FOR_TARGET_ANNOUNCE: stopAnnouncementTimeout(); // no need for break case ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: // no need for break case ERROR_WAITING_FOR_TARGET_ANNOUNCE: Bundle extras = new Bundle(); onboardingSDKWifiManager.enableAllWifiNetworks(); synchronized (TAG) { listenToAnnouncementsFlag = false; } setState(State.IDLE); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.ABORTED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); break; default: break; } } /** * Handle the state machine transition. * * @param msg */ private void onHandleCommandMessage(Message msg) { if (msg == null) { return; } // in case ABORTING_INTERRUPT_FLAG has been found in the queue remove it // and call abortStateCleanUp if (stateHandler.hasMessages(ABORTING_INTERRUPT_FLAG)) { stateHandler.removeMessages(ABORTING_INTERRUPT_FLAG); abortStateCleanUp(); return; } State stateByValue = State.getStateByValue(msg.what); if (stateByValue == null) { return; } Log.d(TAG, "onHandleCommandMessage " + stateByValue); switch (stateByValue) { case IDLE: currentState = State.IDLE; break; case CONNECTING_TO_ONBOARDEE: currentState = State.CONNECTING_TO_ONBOARDEE; handleConnectToOnboardeeState(); break; case WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: currentState = State.WAITING_FOR_ONBOARDEE_ANNOUNCEMENT; handleWaitForOnboardeeAnnounceState(); break; case ONBOARDEE_ANNOUNCEMENT_RECEIVED: currentState = State.ONBOARDEE_ANNOUNCEMENT_RECEIVED; handleOnboardeeAnnouncementReceivedState((AnnounceData) msg.obj); break; case JOINING_SESSION: currentState = State.JOINING_SESSION; handleJoiningSessionState((AnnounceData) msg.obj); break; case CONFIGURING_ONBOARDEE: currentState = State.CONFIGURING_ONBOARDEE; handleConfigureOnboardeeState(); break; case CONFIGURING_ONBOARDEE_WITH_SIGNAL: currentState = State.CONFIGURING_ONBOARDEE_WITH_SIGNAL; handleConfigureWithSignalOnboardeeState(); break; case CONNECTING_TO_TARGET_WIFI_AP: currentState = State.CONNECTING_TO_TARGET_WIFI_AP; handleConnectToTargetState(); break; case WAITING_FOR_TARGET_ANNOUNCE: currentState = State.WAITING_FOR_TARGET_ANNOUNCE; handleWaitForTargetAnnounceState(); break; case TARGET_ANNOUNCEMENT_RECEIVED: currentState = State.TARGET_ANNOUNCEMENT_RECEIVED; handleTargetAnnouncementReceivedState((AnnounceData) msg.obj); break; case ERROR_CONNECTING_TO_ONBOARDEE: currentState = State.ERROR_CONNECTING_TO_ONBOARDEE; break; case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: currentState = State.ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT; handleErrorOnboardeeAnnouncementReceivedAfterTimeoutState((AnnounceData) msg.obj); break; case ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: currentState = State.ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT; break; case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED: currentState = State.ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED; break; case ERROR_JOINING_SESSION: currentState = State.ERROR_JOINING_SESSION; break; case ERROR_CONFIGURING_ONBOARDEE: currentState = State.ERROR_CONFIGURING_ONBOARDEE; break; case ERROR_WAITING_FOR_CONFIGURE_SIGNAL: currentState = State.ERROR_WAITING_FOR_CONFIGURE_SIGNAL; break; case ERROR_CONNECTING_TO_TARGET_WIFI_AP: currentState = State.ERROR_CONNECTING_TO_TARGET_WIFI_AP; break; case ERROR_WAITING_FOR_TARGET_ANNOUNCE: currentState = State.ERROR_WAITING_FOR_TARGET_ANNOUNCE; break; case ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: currentState = State.ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT; handleErrorTargetAnnouncementReceivedAfterTimeoutState((AnnounceData) msg.obj); break; case ABORTING: handleAbortingState(); break; default: break; } } /** * Move the state machine to a new state. * * @param state */ private void setState(State state) { Message msg = stateHandler.obtainMessage(state.getValue()); stateHandler.sendMessage(msg); } /** * Move the state machine to a new state. * * @param state * @param data * metadata to pass to the new state * */ private void setState(State state, Object data) { Message msg = stateHandler.obtainMessage(state.getValue()); msg.obj = data; stateHandler.sendMessage(msg); } /** * Establish an AllJoyn session with the device. * * @param announceData * the Announcement data. * @return status of operation. */ private DeviceResponse establishSessionWithDevice(final AnnounceData announceData) { try { if (announceData.serviceName == null) { return new DeviceResponse(ResponseCode.Status_ERROR, "announceData.serviceName == null"); } if (announceData.getPort() == 0) { return new DeviceResponse(ResponseCode.Status_ERROR, "announceData.getPort() == 0"); } if (onboardingClient != null) { onboardingClient.disconnect(); onboardingClient = null; } synchronized (TAG) { onboardingClient = new OnboardingClientImpl(announceData.getServiceName(), bus, new ServiceAvailabilityListener() { @Override public void connectionLost() { // expected. we are onboarding the device, hence sending // it the another network. Log.d(TAG, "establishSessionWithDevice connectionLost"); } }, announceData.getPort()); } } catch (Exception e) { Log.e(TAG, "establishSessionWithDevice Exception: ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } try { ResponseCode connectToDeviceStatus = connectToDevice(onboardingClient).getStatus(); if (connectToDeviceStatus != ResponseCode.Status_OK) { return new DeviceResponse(ResponseCode.Status_ERROR_CANT_ESTABLISH_SESSION, connectToDeviceStatus.name()); } return new DeviceResponse(ResponseCode.Status_OK); } catch (Exception e) { Log.e(TAG, "establishSessionWithDevice ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } } /** * Call the OnboardingService API for passing the onboarding configuration * to the device. * * @return status of operation. */ private DeviceResponse onboardDevice() { try { AuthType authType = onboardingConfiguration.getTarget().getAuthType(); boolean isPasswordHex = false; String passForConfigureNetwork = onboardingConfiguration.getTarget().getPassword(); if (authType == AuthType.WEP) { Pair wepCheckResult = OnboardingSDKWifiManager.checkWEPPassword(passForConfigureNetwork); isPasswordHex = wepCheckResult.second; } Log.d(TAG, "onBoardDevice OnboardingClient isPasswordHex " + isPasswordHex); if (!isPasswordHex) { passForConfigureNetwork = toHexadecimalString(onboardingConfiguration.getTarget().getPassword()); Log.i(TAG, "convert pass to hex: from " + onboardingConfiguration.getTarget().getPassword() + " -> to " + passForConfigureNetwork); } Log.i(TAG, "before configureWiFi networkName = " + onboardingConfiguration.getTarget().getSSID() + " networkPass = " + passForConfigureNetwork + " selectedAuthType = " + onboardingConfiguration.getTarget().getAuthType().getTypeId()); ConfigureWifiMode res = onboardingClient.configureWiFi(onboardingConfiguration.getTarget().getSSID(), passForConfigureNetwork, onboardingConfiguration.getTarget().getAuthType()); Log.i(TAG, "configureWiFi result=" + res); switch (res) { case REGULAR: onboardingClient.connectWiFi(); return new DeviceResponse(ResponseCode.Status_OK); case FAST_CHANNEL_SWITCHING: // wait for a ConnectionResult signal from the device before // calling connectWifi return new DeviceResponse(ResponseCode.Status_OK_CONNECT_SECOND_PHASE); default: Log.e(TAG, "configureWiFi returned an unexpected result: " + res); return new DeviceResponse(ResponseCode.Status_ERROR); } } catch (BusException e) { Log.e(TAG, "onboarddDevice ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } catch (Exception e) { Log.e(TAG, "onboarddDevice ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } } /** * Call the offboardDevice API for offboarding the device. * * @param serviceName * device's service name * @param port * device's application port * @return result of action */ private DeviceResponse offboardDevice(String serviceName, short port) { Log.d(TAG, "offboardDevice serviceName:[" + serviceName + "] port:[" + port + "]"); Bundle extras = new Bundle(); extras.putString(EXTRA_DEVICE_BUS_NAME, serviceName); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.JOINING_SESSION.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); if (onboardingClient != null) { onboardingClient.disconnect(); onboardingClient = null; } try { synchronized (TAG) { onboardingClient = new OnboardingClientImpl(serviceName, bus, new ServiceAvailabilityListener() { @Override public void connectionLost() { // expected. we are offboarding the device... Log.d(TAG, "offboardDevice connectionLost"); } }, port); } } catch (Exception e) { Log.e(TAG, "offboardDevice Exception: ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } try { ResponseCode connectToDeviceStatus = connectToDevice(onboardingClient).getStatus(); if (connectToDeviceStatus != ResponseCode.Status_OK) { return new DeviceResponse(ResponseCode.Status_ERROR_CANT_ESTABLISH_SESSION, connectToDeviceStatus.name()); } extras.clear(); extras.putString(EXTRA_DEVICE_BUS_NAME, serviceName); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.SESSION_JOINED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); extras.clear(); extras.putString(EXTRA_DEVICE_BUS_NAME, serviceName); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURING_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); onboardingClient.offboard(); extras.clear(); extras.putString(EXTRA_DEVICE_BUS_NAME, serviceName); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONFIGURED_ONBOARDEE.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); return new DeviceResponse(ResponseCode.Status_OK); } catch (BusException e) { Log.e(TAG, "offboardDevice ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } catch (Exception e) { Log.e(TAG, "offboardDevice ", e); return new DeviceResponse(ResponseCode.Status_ERROR); } } /** * Start an AllJoyn session with another Alljoyn device. * * @param client * @return status of operation. */ private DeviceResponse connectToDevice(ClientBase client) { if (client == null) { return new DeviceResponse(ResponseCode.Status_ERROR, "fail connect to device, client == null"); } if (client.isConnected()) { return new DeviceResponse(ResponseCode.Status_OK); } Status status = client.connect(); switch (status) { case OK: Log.d(TAG, "connectToDevice. Join Session OK"); return new DeviceResponse(ResponseCode.Status_OK); case ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED: Log.d(TAG, "connectToDevice: Join Session returned ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED. Ignoring"); return new DeviceResponse(ResponseCode.Status_OK); case ALLJOYN_JOINSESSION_REPLY_FAILED: case ALLJOYN_JOINSESSION_REPLY_UNREACHABLE: Log.e(TAG, "connectToDevice: Join Session returned ALLJOYN_JOINSESSION_REPLY_FAILED."); return new DeviceResponse(ResponseCode.Status_ERROR_CANT_ESTABLISH_SESSION, "device unreachable"); default: Log.e(TAG, "connectToDevice: Join session returned error: " + status.name()); return new DeviceResponse(ResponseCode.Status_ERROR, "Failed connecting to device"); } } /** * Convert a string in ASCII format to HexAscii. * * @param pass * password to convert * @return HexAscii of the input. */ private static String toHexadecimalString(String pass) { char[] HEX_CODE = "0123456789ABCDEF".toCharArray(); byte[] data; try { data = pass.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { Log.e(TAG, "Failed getting bytes of passcode by UTF-8", e); data = pass.getBytes(); } StringBuilder r = new StringBuilder(data.length * 2); for (byte b : data) { r.append(HEX_CODE[(b >> 4) & 0xF]); r.append(HEX_CODE[(b & 0xF)]); } return r.toString(); } /** * Start a wifi scan. Sends the following possible intents *
    *
  • {@link #WIFI_SCAN_RESULTS_AVAILABLE_ACTION} action with this extra *
      *
    • {@link #EXTRA_ONBOARDEES_AP} extra information containg ArrayList of * {@link WiFiNetwork} *
    • {@link #EXTRA_TARGETS_AP} extra information containg ArrayList of * {@link WiFiNetwork} *
    • {@link #EXTRA_ALL_AP} extra information containg ArrayList of * {@link WiFiNetwork} *
    *
      * * @throws WifiDisabledException * if Wi-Fi is not enabled. */ public void scanWiFi() throws WifiDisabledException { if (!onboardingSDKWifiManager.isWifiEnabled()) { throw new WifiDisabledException(); } onboardingSDKWifiManager.scan(); } /** * Retrieves list of access points after scan was complete. * * @param filter * of Wi-Fi list type {@link WifiFilter} * @return list of Wi-Fi access points {@link #scanWiFi()} */ public List getWifiScanResults(WifiFilter filter) { if (filter == WifiFilter.ALL) { return onboardingSDKWifiManager.getAllAccessPoints(); } else if (filter == WifiFilter.TARGET) { return onboardingSDKWifiManager.getNonOnboardableAccessPoints(); } else { return onboardingSDKWifiManager.getOnboardableAccessPoints(); } } /** * @return the current Wi-Fi network that the Android device is connected * to. * @throws WifiDisabledException * in case Wi-Fi is disabled. */ public WiFiNetwork getCurrentNetwork() throws WifiDisabledException { if (!onboardingSDKWifiManager.isWifiEnabled()) { throw new WifiDisabledException(); } return onboardingSDKWifiManager.getCurrentConnectedAP(); } /** * Connect the Android device to a WIFI network. Sends the following * possible intents *
        *
      • {@link #STATE_CHANGE_ACTION} action with this extra *
          *
        • {@link #EXTRA_ONBOARDING_STATE} extra information of enum * {@link OnboardingState} *
        *
      • {@link #ERROR} action with this extra *
          *
        • {@link #EXTRA_ERROR_DETAILS} extra information of enum * {@link OnboardingErrorType} *
        *
          * * @param network * contains detailed data how to connect to the WIFI network. * @param connectionTimeout * timeout in Msec to complete the task of connecting to a Wi-Fi * network * @throws WifiDisabledException * in case Wi-Fi is disabled * @throws OnboardingIllegalArgumentException * in case WiFiNetworkConfiguration is invalid or * connectionTimeout is invalid */ public void connectToNetwork(final WiFiNetworkConfiguration network, long connectionTimeout) throws WifiDisabledException, OnboardingIllegalArgumentException { if (!onboardingSDKWifiManager.isWifiEnabled()) { throw new WifiDisabledException(); } if (network == null || network.getSSID() == null || network.getSSID().isEmpty() || (network.getAuthType() != AuthType.OPEN && (network.getPassword() == null || network.getPassword().isEmpty()))) { throw new OnboardingIllegalArgumentException(); } connectToNetworkWifiBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent intent) { Bundle extras = new Bundle(); String action = intent.getAction(); Log.d(TAG, "onReceive action=" + action); if (WIFI_CONNECTED_BY_REQUEST_ACTION.equals(action)) { context.unregisterReceiver(connectToNetworkWifiBroadcastReceiver); if (intent.hasExtra(EXTRA_WIFI_WIFICONFIGURATION)) { WifiConfiguration config = (WifiConfiguration) intent.getParcelableExtra(EXTRA_WIFI_WIFICONFIGURATION); if (OnboardingSDKWifiManager.normalizeSSID(network.getSSID()).equals(OnboardingSDKWifiManager.normalizeSSID(config.SSID))) { extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTED_OTHER_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); return; } extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.OTHER_WIFI_TIMEOUT.toString()); sendBroadcast(ERROR, extras); } } if (WIFI_TIMEOUT_ACTION.equals(action)) { context.unregisterReceiver(connectToNetworkWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.OTHER_WIFI_TIMEOUT.toString()); sendBroadcast(ERROR, extras); } if (WIFI_AUTHENTICATION_ERROR.equals(action)) { context.unregisterReceiver(connectToNetworkWifiBroadcastReceiver); extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.OTHER_WIFI_AUTH.toString()); sendBroadcast(ERROR, extras); } } }; context.registerReceiver(connectToNetworkWifiBroadcastReceiver, wifiIntentFilter); Bundle extras = new Bundle(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTING_OTHER_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); if (connectionTimeout <= 0) { connectionTimeout = DEFAULT_WIFI_CONNECTION_TIMEOUT; } onboardingSDKWifiManager.connectToWifiAP(network.getSSID(), network.getAuthType(), network.getPassword(), network.isHidden(), connectionTimeout); } /** * Validate OnboardingConfiguration . * * @param config * information for onboarding process. * @return true if OnboardingConfiguration is valid else false. */ private boolean validateOnboardingConfiguration(OnboardingConfiguration config) { if (config == null || config.getOnboardee() == null || config.getTarget() == null) { return false; } if (config.getOnboardeeAnnoucementTimeout() <= 0 || config.getOnboardeeConnectionTimeout() <= 0 || config.getTargetAnnoucementTimeout() <= 0 || config.getTargetConnectionTimeout() <= 0) { return false; } // in case authtype isn't OPEN verify that a password exists. if (config.getOnboardee().getAuthType() != AuthType.OPEN && (config.getOnboardee().getPassword() == null || config.getOnboardee().getPassword().isEmpty())) { return false; } // in case authtype isn't OPEN verify that a password exists. if (config.getTarget().getAuthType() != AuthType.OPEN && (config.getTarget().getPassword() == null || config.getTarget().getPassword().isEmpty())) { return false; } if (config.getTarget().getSSID() == null || config.getTarget().getSSID().isEmpty() || config.getOnboardee().getSSID() == null || config.getOnboardee().getSSID().isEmpty()) { return false; } return true; } /** * Start and resume the onboarding process. Send these possible intents *
            *
          • {@link #STATE_CHANGE_ACTION} action with this extra *
              *
            • {@link #EXTRA_ONBOARDING_STATE} extra information of enum * {@link OnboardingState} *
            *
          • {@link #ERROR} action with this extra *
              *
            • {@link #EXTRA_ERROR_DETAILS} extra information of enum * {@link OnboardingErrorType} *
            *
          * * * can resume the onboarding process in case one of the internal errors has * occoured *
            *
          • ERROR_CONNECTING_TO_ONBOARDEE *
          • ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT *
          • ERROR_JOINING_SESSION *
          • ERROR_CONFIGURING_ONBOARDEE *
          • ERROR_CONNECTING_TO_TARGET_WIFI_AP *
          • ERROR_WAITING_FOR_TARGET_ANNOUNCE *
          * * @param config * containing information about onboardee and target networks. * @throws OnboardingIllegalStateException * in case onboarding is arleady running or trying to resume * from internal state ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED. * @throws OnboardingIllegalArgumentException * in case OnboardingConfiguration is invalid. * @throws WifiDisabledException * in case Wi-Fi is disabled. */ public void runOnboarding(OnboardingConfiguration config) throws OnboardingIllegalStateException, OnboardingIllegalArgumentException, WifiDisabledException { if (!onboardingSDKWifiManager.isWifiEnabled()) { throw new WifiDisabledException(); } if (!validateOnboardingConfiguration(config)) { throw new OnboardingIllegalArgumentException(); } synchronized (TAG) { onboardingConfiguration = config; listenToAnnouncementsFlag = true; if (currentState == State.IDLE) { WiFiNetwork currentAP = onboardingSDKWifiManager.getCurrentConnectedAP(); if (currentAP != null) { originalNetwork = currentAP.getSSID(); } setState(State.CONNECTING_TO_ONBOARDEE); } else if (currentState.getValue() >= State.ERROR_CONNECTING_TO_ONBOARDEE.getValue()) { switch (currentState) { case ERROR_CONNECTING_TO_ONBOARDEE: setState(State.CONNECTING_TO_ONBOARDEE); break; case ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: setState(State.WAITING_FOR_ONBOARDEE_ANNOUNCEMENT); break; case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED: throw new OnboardingIllegalStateException("The device doesn't comply with onboarding service"); case ERROR_ONBOARDEE_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: case ERROR_JOINING_SESSION: setState(State.JOINING_SESSION, deviceData.getAnnounceData()); break; case ERROR_CONFIGURING_ONBOARDEE: setState(State.CONFIGURING_ONBOARDEE); break; case ERROR_WAITING_FOR_CONFIGURE_SIGNAL: setState(State.CONFIGURING_ONBOARDEE_WITH_SIGNAL); break; case ERROR_CONNECTING_TO_TARGET_WIFI_AP: setState(State.CONNECTING_TO_TARGET_WIFI_AP); break; case ERROR_WAITING_FOR_TARGET_ANNOUNCE: setState(State.WAITING_FOR_TARGET_ANNOUNCE); break; case ERROR_TARGET_ANNOUNCEMENT_RECEIVED_AFTER_TIMEOUT: setState(State.TARGET_ANNOUNCEMENT_RECEIVED, deviceData.getAnnounceData()); break; default: break; } } else { throw new OnboardingIllegalStateException("onboarding process is already running"); } } } /** * Abort the onboarding process. * *
            *
          • Send the following intents. *
          • {@link #STATE_CHANGE_ACTION} action with this extra *
              *
            • {@link OnboardingState#ABORTING} when starting the abort process. *
            *
          *

          * see also {@link #abortStateCleanUp()} * * @throws OnboardingIllegalStateException * in case the state machine is in state IDLE,ABORTING (No need * to Abort) in case the state machine is in state * CONNECTING_TO_TARGET_WIFI_AP * ,WAITING_FOR_TARGET_ANNOUNCE,TARGET_ANNOUNCEMENT_RECEIVED * (can't abort ,in final stages of onboarding) */ public void abortOnboarding() throws OnboardingIllegalStateException { synchronized (TAG) { if (currentState == State.IDLE || currentState == State.ABORTING) { throw new OnboardingIllegalStateException("Can't abort ,already ABORTED"); } if (currentState == State.CONNECTING_TO_TARGET_WIFI_AP || currentState == State.TARGET_ANNOUNCEMENT_RECEIVED || currentState == State.CONFIGURING_ONBOARDEE || currentState == State.CONFIGURING_ONBOARDEE_WITH_SIGNAL) { throw new OnboardingIllegalStateException("Can't abort"); } Bundle extras = new Bundle(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.ABORTING.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); setState(State.ABORTING); } } /** * Prepare the state machine for the onboarding process after abort has * beeen requested. * * Try restoring the connection to the original Wi-Fi access point prior to * calling {@link OnboardingManager#runOnboarding(OnboardingConfiguration)} *

          * Does the following : *

            *
          • Stop listening to About Service announcements. *
          • Remove onboardee Wi-Fi access point from Android's Wi-Fi configured * netwroks. *
          • Enable Android's Wi-Fi manager to select a suitable Wi-Fi access * point. *
          • Move state maching to IDLE state. *
          • Send the following intents. *
              *
            • {@link #STATE_CHANGE_ACTION} action with this extra *
                *
              • {@link OnboardingState#CONNECTING_ORIGINAL_WIFI} when trying to * connect to orignal network if exists. *
              • {@link OnboardingState#CONNECTING_ORIGINAL_WIFI} when connected to * orignal network if exists. *
              • {@link OnboardingState#ABORTED} when abort process complete. *
              *
            • {@link #ERROR} action with this extra *
                *
              • {@link OnboardingErrorType#ORIGINAL_WIFI_TIMEOUT} when trying to * connect to orignal and get timeout. *
              • {@link OnboardingErrorType#ORIGINAL_WIFI_AUTH} when trying to connect * to orignal and get authentication error. *
              *
            *
          */ private void abortStateCleanUp() { // in case ABORTING_INTERRUPT_FLAG found in stateHandler remove it. if (stateHandler.hasMessages(ABORTING_INTERRUPT_FLAG)) { stateHandler.removeMessages(ABORTING_INTERRUPT_FLAG); } if (onboardingConfiguration != null && onboardingConfiguration.getOnboardee() != null && onboardingConfiguration.getOnboardee().getSSID() != null) { onboardingSDKWifiManager.removeWifiAP(onboardingConfiguration.getOnboardee().getSSID()); } final Bundle extras = new Bundle(); synchronized (TAG) { listenToAnnouncementsFlag = false; } // Try to connect to orginal access point if existed. if (originalNetwork != null) { try { onboardingSDKWifiManager.connectToWifiBySSID(originalNetwork, DEFAULT_WIFI_CONNECTION_TIMEOUT); } catch (OnboardingIllegalArgumentException e) { Log.e(TAG, "abortStateCleanUp " + e.getMessage()); onboardingSDKWifiManager.enableAllWifiNetworks(); setState(State.IDLE); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.ABORTED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); return; } extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTING_ORIGINAL_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); onboardingWifiBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d(TAG, "onReceive action=" + action); if (action != null) { context.unregisterReceiver(onboardingWifiBroadcastReceiver); onboardingSDKWifiManager.enableAllWifiNetworks(); setState(State.IDLE); if (WIFI_CONNECTED_BY_REQUEST_ACTION.equals(action)) { extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.CONNECTED_ORIGINAL_WIFI.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); } if (WIFI_TIMEOUT_ACTION.equals(action)) { extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ORIGINAL_WIFI_TIMEOUT.toString()); sendBroadcast(ERROR, extras); } if (WIFI_AUTHENTICATION_ERROR.equals(action)) { extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ORIGINAL_WIFI_AUTH.toString()); sendBroadcast(ERROR, extras); } extras.clear(); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.ABORTED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); } } };// receiver context.registerReceiver(onboardingWifiBroadcastReceiver, wifiIntentFilter); } else { // Probably onboarding started when the device wasn't connected to a // Wi-Fi. So nothing to restore. // Just return to IDLE and enable all the networks that were // disabled by the onboarding process. onboardingSDKWifiManager.enableAllWifiNetworks(); setState(State.IDLE); extras.putString(EXTRA_ONBOARDING_STATE, OnboardingState.ABORTED.toString()); sendBroadcast(STATE_CHANGE_ACTION, extras); } } /** * * Offboard a device that is on the current Wi-Fi network. * * @param config * contains the offboarding information needed to complete the * task. * @throws OnboardingIllegalStateException * is thrown when not in internal IDLE state. * @throws OnboardingIllegalArgumentException * is thrown when config is not valid * @throws WifiDisabledException * in case Wi-Fi is disabled. */ public void runOffboarding(final OffboardingConfiguration config) throws OnboardingIllegalStateException, OnboardingIllegalArgumentException, WifiDisabledException { if (!onboardingSDKWifiManager.isWifiEnabled()) { throw new WifiDisabledException(); } // verify that the OffboardingConfiguration has valid data if (config == null || config.getServiceName() == null || config.getServiceName().isEmpty() || config.getPort() == 0) { throw new OnboardingIllegalArgumentException(); } synchronized (TAG) { // in case the SDK is in onboarding mode the runOffboarding can't // continue if (currentState != State.IDLE) { throw new OnboardingIllegalStateException("onboarding process is already running"); } Log.d(TAG, "runOffboarding serviceName" + config.getServiceName() + " port" + config.getPort()); new Thread() { @Override public void run() { DeviceResponse deviceResponse = offboardDevice(config.getServiceName(), config.getPort()); if (deviceResponse.getStatus() != ResponseCode.Status_OK) { Bundle extras = new Bundle(); if (deviceResponse.getStatus() == ResponseCode.Status_ERROR_CANT_ESTABLISH_SESSION) { extras.putString(EXTRA_DEVICE_BUS_NAME, config.getServiceName()); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.JOIN_SESSION_ERROR.toString()); } else { extras.putString(EXTRA_DEVICE_BUS_NAME, config.getServiceName()); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.ERROR_CONFIGURING_ONBOARDEE.toString()); } sendBroadcast(ERROR, extras); } } }.start(); } } /** * Check if the device supports the given service. * * @param objectDescriptions * the list of supported services as announced by the device. * @param service * name of the service to check * @return true if supported else false */ private boolean isSeviceSupported(final AboutObjectDescription[] objectDescriptions, String service) { if (objectDescriptions != null) { for (int i = 0; i < objectDescriptions.length; i++) { String[] interfaces = objectDescriptions[i].interfaces; for (int j = 0; j < interfaces.length; j++) { String currentInterface = interfaces[j]; if (currentInterface.startsWith(service)) { return true; } } } } return false; } /** * Start a timeout announcement to arrive from a device. Takes the timeout * interval from the {@link OnboardingConfiguration} that stores the data. * If timeout expires, moves the state machine to idle state and sends * timeout intent. * * @return true if in correct state else false. */ private boolean startAnnouncementTimeout() { long timeout = 0; switch (currentState) { case WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: timeout = onboardingConfiguration.getOnboardeeAnnoucementTimeout(); break; case WAITING_FOR_TARGET_ANNOUNCE: timeout = onboardingConfiguration.getTargetAnnoucementTimeout(); break; default: Log.e(TAG, "startAnnouncementTimeout has been intialized in bad state abort"); return false; } announcementTimeout.schedule(new TimerTask() { Bundle extras = new Bundle(); @Override public void run() { Log.e(TAG, "Time out expired " + currentState.toString()); switch (currentState) { case WAITING_FOR_ONBOARDEE_ANNOUNCEMENT: extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.FIND_ONBOARDEE_TIMEOUT.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_ONBOARDEE_ANNOUNCEMENT); break; case WAITING_FOR_TARGET_ANNOUNCE: extras.clear(); extras.putString(EXTRA_ERROR_DETAILS, OnboardingErrorType.VERIFICATION_TIMEOUT.toString()); sendBroadcast(ERROR, extras); setState(State.ERROR_WAITING_FOR_TARGET_ANNOUNCE); break; default: break; } } }, timeout); return true; } /** * Stop the announcement timeout that was activated by * {@link #startAnnouncementTimeout()} */ private void stopAnnouncementTimeout() { announcementTimeout.cancel(); announcementTimeout.purge(); announcementTimeout = new Timer(); } /** * A wrapper method that sends intent broadcasts with extra data * * @param action * an action for the intent * @param extras * extras for the intent */ private void sendBroadcast(String action, Bundle extras) { Intent intent = new Intent(action); if (extras != null && !extras.isEmpty()) { intent.putExtras(extras); } context.sendBroadcast(intent); } } OnboardingSDKWifiManager.java000066400000000000000000001510211272147170000357520ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Timer; import java.util.TimerTask; import org.alljoyn.onboarding.OnboardingService.AuthType; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.SupplicantState; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.net.wifi.WifiManager.MulticastLock; import android.os.Bundle; import android.util.Log; import android.util.Pair; /** * Wraps the interaction with {@link WifiManager}. */ class OnboardingSDKWifiManager { private final static String TAG = "OnboardingSDKWifiManager"; /** * Android application context. */ private final Context context; /** * WiFi manager instance. */ private final WifiManager wifi; /** * Broadcast receiver for WifiManager intents. */ private BroadcastReceiver wifiBroadcastReceiver; /** * Stores the details of the target Wi-Fi. Uses volatile to verify that the * broadcast receiver reads its content each time onReceive is called, thus * "knowing" if the an API call to connect has been made */ private volatile WifiConfiguration targetWifiConfiguration = null; /** * Stores all Wi-Fi access points that are not considered AllJoyn devices. */ private final ArrayList nonOnboardableAPlist = new ArrayList(); /** * Stores all Wi-Fi access points that are considered onboardee devices. */ private final ArrayList onboardableAPlist = new ArrayList(); /** * Stores all Wi-Fi access points that were found in the scan */ private final ArrayList allAPlist = new ArrayList(); /** * SSID prefix for onboardable devices. */ static final private String ONBOARDABLE_PREFIX = "AJ_"; /** * SSID suffix for onboardable devices. */ static final private String ONBOARDABLE_SUFFIX = "_AJ"; /** * WEP HEX password pattern. */ static final String WEP_HEX_PATTERN = "[\\dA-Fa-f]+"; /** * Timer for checking completion of Wi-Fi tasks. */ private Timer wifiTimeoutTimer = new Timer(); /** * AJ daemon discovery relies on multicast. Normally the Android filters * out packets not explicitly addressed to this device. Acquiring a * MulticastLock will cause the stack to receive packets addressed to * multicast addresses. */ private MulticastLock multicastLock; /** * Initialize the WifiManager and the Wi-Fi BroadcastReceiver. * * @param context * the application Context */ public OnboardingSDKWifiManager(Context context) { this.context = context; wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); registerWifiBroadcastReceiver(); } /** * Register a BroadcastReciver to receive intents from {@link WifiManager}. * *
            *
          • {@link WifiManager#SCAN_RESULTS_AVAILABLE_ACTION} - Wi-Fi scan is complete. handled by {@link #processScanResults(List)} *
          • {@link WifiManager#NETWORK_STATE_CHANGED_ACTION} - the handset connected to a Wi-Fi access point. handled by {@link #processChangeOfNetwork(WifiInfo)} *
          • {@link WifiManager#SUPPLICANT_STATE_CHANGED_ACTION} - authentication error. Will fire a {@link OnboardingManager#WIFI_AUTHENTICATION_ERROR} intent. *
          * using synchronized to protect against concurrent onRecive(..) calls that set targetWifiConfiguration in a non steady state. */ private void registerWifiBroadcastReceiver() { Log.d(TAG, "registerWifiBroadcastReceiver"); wifiBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "WiFi BroadcastReceiver onReceive: " + intent.getAction()); if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(intent.getAction())) { // Wi-Fi scan is complete List scans = wifi.getScanResults(); if (scans != null) { processScanResults(scans); } else { Log.i(TAG, "WiFi BroadcastReceiver onReceive wifi.getScanResults() == null"); } } else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(intent.getAction())) { NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); if (networkInfo != null && networkInfo.getState() != null && networkInfo.isConnected()) { // the state of Wi-Fi connectivity has changed. WiFiNetwork currentConnectedAP = getCurrentConnectedAP(); if (currentConnectedAP != null) { Log.d(TAG, "WiFi BroadcastReceiver onReceive success in connecting to " + currentConnectedAP.getSSID()); } // the wifiInfo extra indicates that the new state is // CONNECTED, and provides the SSID. WifiInfo wifiInfo = intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO); if (wifiInfo == null) { wifiInfo = wifi.getConnectionInfo(); } if (wifiInfo != null) { processChangeOfNetwork(wifiInfo); } } else { Log.i(TAG, "WiFi BroadcastReceiver onReceive not a connected networkInfo: " + networkInfo); } } else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(intent.getAction()) && intent.hasExtra(WifiManager.EXTRA_SUPPLICANT_ERROR) && intent.getIntExtra(WifiManager.EXTRA_SUPPLICANT_ERROR, 0) == WifiManager.ERROR_AUTHENTICATING) { // Wi-Fi authentication error synchronized (this) { if (targetWifiConfiguration != null) { Log.e(TAG, "Network Listener ERROR_AUTHENTICATING when trying to connect to " + normalizeSSID(targetWifiConfiguration.SSID)); // it was the SDK that initiated the Wi-Fi change, // hence the timer should be cancelled stopWifiTimeoutTimer(); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, targetWifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); targetWifiConfiguration=null; } } } } }; IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); context.registerReceiver(wifiBroadcastReceiver, filter); } /** * Handle a list of {@link ScanResult}. * Filter out empty or duplicate access * point names, and normalize access point names, then split the results * between the onboardableAPlist and the nonOnboardableAPlist lists. After * completion send {@link OnboardingManager#WIFI_SCAN_RESULTS_AVAILABLE_ACTION} * intent with onboardableAPlist,nonOnboardableAPlist as extra data. * * @param scans * List of ScanResults */ private void processScanResults(List scans) { Log.d(TAG, "processScanResults"); if (scans != null) { synchronized (wifi) { onboardableAPlist.clear(); nonOnboardableAPlist.clear(); allAPlist.clear(); Set tempset = new HashSet(); // avoid duplicates StringBuffer buff = new StringBuffer(); // for logging for (ScanResult scan : scans) { // remove extra quotes from network SSID scan.SSID = normalizeSSID(scan.SSID); // a scan may contain results with no SSID if (scan.SSID == null || scan.SSID.isEmpty()) { Log.i(TAG, "processScanResults currentScan was empty,skipping"); continue; } // avoid duplicates if (tempset.contains(scan.SSID)) { Log.i(TAG, "processScanResults currentScan " + scan.SSID + " already seen ,skipping"); continue; } // store the new SSID tempset.add(scan.SSID); WiFiNetwork wiFiNetwork = new WiFiNetwork(scan.SSID, scan.capabilities, scan.level); if (scan.SSID.startsWith(ONBOARDABLE_PREFIX) || scan.SSID.endsWith(ONBOARDABLE_SUFFIX)) { onboardableAPlist.add(wiFiNetwork); } else { nonOnboardableAPlist.add(wiFiNetwork); } allAPlist.add(wiFiNetwork); buff.append(scan.SSID).append(","); } Log.i(TAG, "processScanResults " + (buff.length() > 0 ? buff.toString().substring(0, buff.length() - 1) : " empty")); // broadcast a WIFI_SCAN_RESULTS_AVAILABLE_ACTION intent Bundle extras = new Bundle(); extras.putParcelableArrayList(OnboardingManager.EXTRA_ONBOARDEES_AP, onboardableAPlist); extras.putParcelableArrayList(OnboardingManager.EXTRA_TARGETS_AP, nonOnboardableAPlist); extras.putParcelableArrayList(OnboardingManager.EXTRA_ALL_AP, allAPlist); sendBroadcast(OnboardingManager.WIFI_SCAN_RESULTS_AVAILABLE_ACTION, extras); } } } /** * Handle the information that the device has connected to a Wi-Fi network. * It's important to know that {@link WifiManager} API doesn't fully * guarantee that the connected network is the one you asked for. So the new * network is compared with the one that we asked for. * *

          * If the connection was successful the * {@link OnboardingManager#WIFI_CONNECTED_BY_REQUEST_ACTION} intent will be * sent * * @param wifiInfo * WifiInfo of the access point to which we have just switched */ private void processChangeOfNetwork(WifiInfo wifiInfo) { Log.d(TAG, "processChangeOfNetwork"); synchronized (this) { // This is needed so that boards can discover the bundled AJ daemon. // On some devices, the multicast lock must be acquired on every // Wi-Fi network switch. acquireMulticastLock(); if (targetWifiConfiguration != null) { // check if it's the network that we tried to connect to WiFiNetwork currentConnectedAP = getCurrentConnectedAP(); if (((wifiInfo != null) && isSsidEquals(targetWifiConfiguration.SSID, wifiInfo.getSSID())) || (currentConnectedAP != null && isSsidEquals(targetWifiConfiguration.SSID, currentConnectedAP.getSSID()))) { Bundle extras = new Bundle(); // it was the SDK that initiated the Wi-Fi change, hence the // timer should be cancelled stopWifiTimeoutTimer(); String intentAction = OnboardingManager.WIFI_CONNECTED_BY_REQUEST_ACTION; extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, targetWifiConfiguration); sendBroadcast(intentAction, extras); targetWifiConfiguration = null; } } } } /** * Stops the wifiTimeoutTimer */ private void stopWifiTimeoutTimer() { Log.d(TAG, "stopWifiTimeoutTimer"); wifiTimeoutTimer.cancel(); wifiTimeoutTimer.purge(); wifiTimeoutTimer = new Timer(); } /** * @return list of Wi-Fi access points whose SSID starts with "AJ_" or ends * with "_AJ" */ List getOnboardableAccessPoints() { synchronized (wifi) { return onboardableAPlist; } } /** * @return list of Wi-Fi access points whose SSID doesn't start with "AJ_" * and doesn't end with "_AJ". */ List getNonOnboardableAccessPoints() { synchronized (wifi) { return nonOnboardableAPlist; } } /** * @return list of all the access points found by the Wi-Fi scan. */ List getAllAccessPoints() { synchronized (wifi) { return allAPlist; } } /** * @return current connected AP if connected to Wi-Fi else returns null. */ WiFiNetwork getCurrentConnectedAP() { Log.d(TAG, "getCurrentSSID: SupplicantState = " + wifi.getConnectionInfo().getSupplicantState()); synchronized (wifi) { // Check if we're still negotiating with the access point if (wifi.getConnectionInfo().getSupplicantState() != SupplicantState.COMPLETED) { Log.w(TAG, "getCurrentSSID: SupplicantState not COMPLETED, return null"); return null; } if (wifi.getConnectionInfo() == null || wifi.getConnectionInfo().getSSID() == null) { return null; } String currentSSID = normalizeSSID(wifi.getConnectionInfo().getSSID()); Log.d(TAG, "getCurrentSSID =" + currentSSID); for (int i = 0; i < onboardableAPlist.size(); i++) { if (onboardableAPlist.get(i).SSID.equals(currentSSID)) { return onboardableAPlist.get(i); } } for (int i = 0; i < nonOnboardableAPlist.size(); i++) { if (nonOnboardableAPlist.get(i).SSID.equals(currentSSID)) { return nonOnboardableAPlist.get(i); } } return new WiFiNetwork(currentSSID); } } /** * Extracts AuthType from a SSID by retrieving its capabilities via WifiManager. * * @param ssid * @return AuthType of SSID or null if not found */ private AuthType getSSIDAuthType(String ssid) { Log.d(TAG, "getSSIDAuthType SSID = " + ssid); if (ssid == null || ssid.length() == 0) { Log.w(TAG, "getSSIDAuthType given string was null"); return null; } List networks = wifi.getScanResults(); for (ScanResult scan : networks) { if (ssid.equalsIgnoreCase(scan.SSID)) { AuthType res = getScanResultAuthType(scan.capabilities); return res; } } return null; } /** * Parses ScanResult 'capabilities' string into an AuthType object. * * @param capabilities * {@link ScanResult#capabilities} * @return AuthType object. {@link AuthType} */ private AuthType getScanResultAuthType(String capabilities) { Log.d(TAG, "getScanResultAuthType capabilities = " + capabilities); if (capabilities.contains("WPA2")) { return AuthType.WPA2_AUTO; } if (capabilities.contains("WPA")) { return AuthType.WPA_AUTO; } if (capabilities.contains(AuthType.WEP.name())) { return AuthType.WEP; } return AuthType.OPEN; } /** * Use {@link WifiManager} to connect to a Wi-Fi access point. *

            *
          • In case an access point with the same SSID exists, delete it. *
          • Create a new access point with SSID name , *
          • Verify that it is a valid one . *
          • Call {@link #connect(WifiConfiguration, int, long)}. *
          * * @param ssid Wi-Fi access point * @param authType * @param password * @param connectionTimeout in milliseconds * @param isHidden * */ void connectToWifiAP(String ssid, AuthType authType, String password, boolean isHidden,long connectionTimeout) { //21 = android.os.Build.VERSION_CODES.LOLLIPOP if (android.os.Build.VERSION.SDK_INT >= 21 && android.os.Build.VERSION.SDK_INT < 23) { lollipop_connectToWifiAP(ssid, authType, password, isHidden, connectionTimeout); return; } //23 = android.os.Build.VERSION_CODES.MARSHMALLOW else if (android.os.Build.VERSION.SDK_INT >= 23) { marshmallow_connectToWifiAP(ssid, authType, password, isHidden, connectionTimeout); sendBroadcast(OnboardingManager.MARSHMALLOW_SOFTAP_CONNECT, null); Log.d(TAG, "send broadcast message that the marshmallow softAP connect flow has executed"); return; } Log.d(TAG, "connectToWifiAP SSID = " + ssid + " authtype = " + authType.toString()+ " is hidden = "+ isHidden); // if networkPass is null set it to "" if (password == null) { password = ""; } // the configured Wi-Fi networks final List wifiConfigs = wifi.getConfiguredNetworks(); // log the list StringBuffer buff = new StringBuffer(); for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null) { w.SSID = normalizeSSID(w.SSID); if (w.SSID.length() > 1) { buff.append(w.SSID).append(","); } } } Log.i(TAG, "connectToWifiAP ConfiguredNetworks " + (buff.length() > 0 ? buff.toString().substring(0, buff.length() - 1) : " empty")); int networkId = -1; // delete any existing WifiConfiguration that has the same SSID as the // new one for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null && isSsidEquals(w.SSID, ssid)) { networkId = w.networkId; Log.i(TAG, "connectToWifiAP found " + ssid + " in ConfiguredNetworks. networkId = " + networkId); boolean res = wifi.removeNetwork(networkId); Log.i(TAG, "connectToWifiAP delete " + networkId + "? " + res); res = wifi.saveConfiguration(); Log.i(TAG, "connectToWifiAP saveConfiguration res = " + res); break; } } WifiConfiguration wifiConfiguration = new WifiConfiguration(); // check the AuthType of the SSID against the WifiManager // if null use the one given by the API // else use the result from getSSIDAuthType AuthType verrifiedWifiAuthType = getSSIDAuthType(ssid); if (verrifiedWifiAuthType != null) { authType = verrifiedWifiAuthType; } if (isHidden){ wifiConfiguration.hiddenSSID=true; } Log.i(TAG, "connectToWifiAP selectedAuthType = " + authType); // set the WifiConfiguration parameters switch (authType) { case OPEN: wifiConfiguration.SSID = "\"" + ssid + "\""; wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "connectToWifiAP [OPEN] add Network returned " + networkId); break; case WEP: wifiConfiguration.SSID = "\"" + ssid + "\""; // check the validity of a WEP password Pair wepCheckResult = checkWEPPassword(password); if (!wepCheckResult.first) { Log.i(TAG, "connectToWifiAP auth type = WEP: password " + password + " invalid length or charecters"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.i(TAG, "connectToWifiAP [WEP] using " + (!wepCheckResult.second ? "ASCII" : "HEX")); if (!wepCheckResult.second) { wifiConfiguration.wepKeys[0] = "\"" + password + "\""; } else { wifiConfiguration.wepKeys[0] = password; } wifiConfiguration.priority = 40; wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); wifiConfiguration.wepTxKeyIndex = 0; networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "connectToWifiAP [WEP] add Network returned " + networkId); break; case WPA_AUTO: case WPA_CCMP: case WPA_TKIP: case WPA2_AUTO: case WPA2_CCMP: case WPA2_TKIP: { wifiConfiguration.SSID = "\"" + ssid + "\""; // handle special case when WPA/WPA2 and 64 length password that can // be HEX if (password.length() == 64 && password.matches(WEP_HEX_PATTERN)) { wifiConfiguration.preSharedKey = password; } else { wifiConfiguration.preSharedKey = "\"" + password + "\""; } wifiConfiguration.hiddenSSID = true; wifiConfiguration.status = WifiConfiguration.Status.ENABLED; wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "connectToWifiAP [WPA..WPA2] add Network returned " + networkId); break; } default: networkId = -1; break; } if (networkId < 0) { Log.d(TAG, "connectToWifiAP networkId <0 WIFI_AUTHENTICATION_ERROR"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.d(TAG, "connectToWifiAP calling connect"); connect(wifiConfiguration, networkId, connectionTimeout); } /** * Connect to an already configured Wi-Fi access point. * @param SSID * @param timeout * @throws OnboardingIllegalArgumentException in case SSID not found in configured access points. */ void connectToWifiBySSID(String SSID,long timeout) throws OnboardingIllegalArgumentException{ final List wifiConfigs = wifi.getConfiguredNetworks(); WifiConfiguration wifiConfig=null; for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null && isSsidEquals(w.SSID, SSID)) { wifiConfig=w; break; } } if (wifiConfig!=null){ // 21 = android.os.Build.VERSION_CODES.LOLLIPOP if (android.os.Build.VERSION.SDK_INT >= 21) { lollipop_connect(wifiConfig, wifiConfig.networkId, timeout); } else { connect(wifiConfig,wifiConfig.networkId,timeout); } }else{ throw new OnboardingIllegalArgumentException("unable to find "+ SSID +" in list of configured networks"); } } /** * Make the actual connection to the requested Wi-Fi target. * * @param wifiConfig * details of the Wi-Fi access point used by the WifiManger * @param networkId * id of the Wi-Fi configuration * @param timeoutMsec * period of time in Msec to complete Wi-Fi connection task */ private void connect(final WifiConfiguration wifiConfig, final int networkId, final long timeoutMsec) { Log.i(TAG, "connect SSID=" + wifiConfig.SSID + " within " + timeoutMsec); boolean res; synchronized (this) { targetWifiConfiguration = wifiConfig; } // this is the application's Wi-Fi connection timeout wifiTimeoutTimer.schedule(new TimerTask() { @Override public void run() { Log.e(TAG, "Network Listener WIFI_TIMEOUT when trying to connect to " + normalizeSSID(targetWifiConfiguration.SSID)); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfig); sendBroadcast(OnboardingManager.WIFI_TIMEOUT_ACTION, extras); } }, timeoutMsec); if (wifi.getConnectionInfo().getSupplicantState() == SupplicantState.DISCONNECTED) { wifi.disconnect(); } wifi.saveConfiguration(); res = wifi.enableNetwork(networkId, false); Log.d(TAG, "connect enableNetwork [false] status=" + res); res = wifi.disconnect(); Log.d(TAG, "connect disconnect status=" + res); // enabling a network doesn't guarantee that it's the one that Android // will connect to. // Selecting a particular network is achieved by passing 'true' here to // disable all other networks. // the side effect is that all other user's Wi-Fi networks become // disabled. // The recovery for that is enableAllWifiNetworks method. res = wifi.enableNetwork(networkId, true); Log.d(TAG, "connect enableNetwork [true] status=" + res); res = wifi.reconnect(); wifi.setWifiEnabled(true); } /** * Remove the WiFi access point using {@link WifiManager} Api. * * @param ssid name of the Wi-Fi network to remove */ void removeWifiAP(String ssid) { final List wifiConfigs = wifi.getConfiguredNetworks(); // disconnect from Wi-Fi wifi.disconnect(); // delete WifiConfiguration that has the same SSID as the supplied name. for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null && isSsidEquals(w.SSID, ssid)) { int networkId = w.networkId; Log.i(TAG, "connectToWifiAP found " + ssid + " in ConfiguredNetworks. networkId = " + networkId); boolean res = wifi.removeNetwork(networkId); Log.i(TAG, "connectToWifiAP delete " + networkId + "? " + res); res = wifi.saveConfiguration(); Log.i(TAG, "connectToWifiAP saveConfiguration res = " + res); break; } } } /** * Enable all the disabled Wi-Fi access points. This method tries to restore * the Wi-Fi environment that the user had prior to onboarding. Because * While running the onboarding process, the SDK disables all the user's * Wi-Fi networks other than the onboardee access point and the target. */ void enableAllWifiNetworks() { Log.d(TAG, "enableAllWifiNetworks start"); List configuredNetworks = wifi.getConfiguredNetworks(); for (WifiConfiguration wifiConfiguration : configuredNetworks) { if (wifiConfiguration.status == WifiConfiguration.Status.DISABLED) { Log.d(TAG, "enableAllWifiNetworks enabling " + wifiConfiguration.SSID); wifi.enableNetwork(wifiConfiguration.networkId, false); } } wifi.reconnect(); } /** * Start a Wi-Fi scan. */ void scan() { Log.d(TAG, "scan"); wifi.startScan(); } /** * Acquire Android Multicast lock. * AllJoyn daemon discovery relies on multicast ,and Android, by default, filters out multicast packets unless * an application acquires a lock. */ private void acquireMulticastLock() { Log.d(TAG, "acquireMulticastLock"); // On some devices the multicast lock must be renewed every time, // because after Wi-Fi switches, // the lock is still held, but no longer works - multicast packets no // longer come through. if (multicastLock != null) { // keep the environment clean. Dispose the old lock Log.d(TAG, "MulticastLock != null. releasing MulticastLock"); multicastLock.release(); } multicastLock = wifi.createMulticastLock("multicastLock"); multicastLock.setReferenceCounted(false); multicastLock.acquire(); } /** * A wrapper function to send broadcast intent messages. * * @param action * the name of the action * @param extras * contains extra information bundled with the intent */ private void sendBroadcast(String action, Bundle extras) { Intent intent = new Intent(action); if (extras != null && !extras.isEmpty()) { intent.putExtras(extras); } context.sendBroadcast(intent); } /** * A utility method for retrieving Android's Wi-Fi status. * @return true if enabled else false */ boolean isWifiEnabled(){ return wifi.isWifiEnabled(); } /** * A utility method for comparing two SSIDs. Some Android devices return an * SSID surrounded with quotes. For the sake of comparison and readability, * remove those. * * @param ssid1 * @param ssid2 * @return true if equals else false */ static boolean isSsidEquals(String ssid1, String ssid2) { if (ssid1 == null || ssid1.length() == 0 || ssid2 == null || ssid2.length() == 0) { return false; } return normalizeSSID(ssid1).equals(normalizeSSID(ssid2)); } /** * A utility method for removing wrapping quotes from SSID name. Some * Android devices return an SSID surrounded with quotes. For the sake of * comparison and readability, remove those. * * @param ssid * could be AJ_QA but also "AJ_QA" (with quotes). * @return normalized SSID: AJ_QA */ static String normalizeSSID(String ssid) { if (ssid != null && ssid.length() > 2 && ssid.startsWith("\"") && ssid.endsWith("\"")) { ssid = ssid.substring(1, ssid.length() -1); } return ssid; } /** * A utility method that checks if a password complies with WEP password * rules, and if it's in HEX format. * * @param password * @return {@link Pair} of two {@link Boolean} is it a valid WEP password * and is it a HEX password. */ static Pair checkWEPPassword(String password) { Log.d(TAG, "checkWEPPassword"); if (password == null || password.isEmpty()) { Log.w(TAG, "checkWEPPassword empty password"); return new Pair(false, false); } int length = password.length(); switch (length) { // valid ASCII keys length case 5: case 13: case 16: case 29: Log.d(TAG, "checkWEPPassword valid WEP ASCII password"); return new Pair(true, false); // valid hex keys length case 10: case 26: case 32: case 58: if (password.matches(WEP_HEX_PATTERN)) { Log.d(TAG, "checkWEPPassword valid WEP password length, and HEX pattern match"); return new Pair(true, true); } Log.w(TAG, "checkWEPPassword valid WEP password length, but HEX pattern matching failed: " + WEP_HEX_PATTERN); return new Pair(false, false); default: Log.w(TAG, "checkWEPPassword invalid WEP password length: " + length); return new Pair(false, false); } } ////////////////////////////////////////////////////////////////////// //NOTE: The below code was done to allow onboarding to function on // Android Lollipop. The change has been minimally tested for // other Android platforms and although it functions, previous // solution has been stress tested on multiple platforms and // validated avoid complications the code has been explicitly // split in order to avoid regression testing. ////////////////////////////////////////////////////////////////////// /** * Look through the supplicant and find a configuration that matches * the supplied ssid if one exists. * * @param ssid * name of the Wireless SSID that is to be found * @return WiFiConfiguration for supplied ssid if found, else null */ private WifiConfiguration findConfiguration(String ssid) { // the configured Wi-Fi networks final List wifiConfigs = wifi.getConfiguredNetworks(); // for debugging purposes only log the list StringBuffer buff = new StringBuffer(); for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null) { w.SSID = normalizeSSID(w.SSID); if (w.SSID.length() > 1) { buff.append(w.SSID).append(","); } } } Log.i(TAG, "connectToWifiAP ConfiguredNetworks " + (buff.length() > 0 ? buff.toString().substring(0, buff.length() - 1) : " empty")); // find any existing WifiConfiguration that has the same SSID as the // supplied one and return it if found for (WifiConfiguration w : wifiConfigs) { if (w.SSID != null && isSsidEquals(w.SSID, ssid)) { Log.i(TAG, "connectToWifiAP found " + ssid + " in ConfiguredNetworks. networkId = " + w.networkId); return w; } } return null; } /** * Use {@link WifiManager} to connect to a Wi-Fi access point. *
            *
          • In case an access point with the same SSID exists, delete it. *
          • Create a new access point with SSID name , *
          • Verify that it is a valid one . *
          • Call {@link #connect(WifiConfiguration, int, long)}. *
          * * @param ssid Wi-Fi access point * @param authType * @param password * @param connectionTimeout in milliseconds * @param isHidden * */ private void lollipop_connectToWifiAP(String ssid, AuthType authType, String password, boolean isHidden,long connectionTimeout) { Log.d(TAG, "lollipop_connectToWifiAP SSID = " + ssid + " authtype = " + authType.toString() + " is hidden = " + isHidden); // if networkPass is null set it to "" if (password == null) { password = ""; } int networkId = -1; boolean shouldUpdate = false; WifiConfiguration wifiConfiguration = findConfiguration(ssid); if(wifiConfiguration == null) { wifiConfiguration = new WifiConfiguration(); } else { shouldUpdate = true; } // check the AuthType of the SSID against the WifiManager // if null use the one given by the API // else use the result from getSSIDAuthType AuthType verrifiedWifiAuthType = getSSIDAuthType(ssid); if (verrifiedWifiAuthType != null) { authType = verrifiedWifiAuthType; } if (isHidden){ wifiConfiguration.hiddenSSID=true; } Log.i(TAG, "lollipop_connectToWifiAP selectedAuthType = " + authType); // set the priority to something high so that the network we are entering should be used wifiConfiguration.priority = 140; // set the WifiConfiguration parameters switch (authType) { case OPEN: wifiConfiguration.SSID = "\"" + ssid + "\""; wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); networkId = shouldUpdate ? wifi.updateNetwork(wifiConfiguration) : wifi.addNetwork(wifiConfiguration); Log.d(TAG, "lollipop_connectToWifiAP [OPEN] add Network returned " + networkId); break; case WEP: wifiConfiguration.SSID = "\"" + ssid + "\""; // check the validity of a WEP password Pair wepCheckResult = checkWEPPassword(password); if (!wepCheckResult.first) { Log.i(TAG, "lollipop_connectToWifiAP auth type = WEP: password " + password + " invalid length or charecters"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.i(TAG, "lollipop_connectToWifiAP [WEP] using " + (!wepCheckResult.second ? "ASCII" : "HEX")); if (!wepCheckResult.second) { wifiConfiguration.wepKeys[0] = "\"" + password + "\""; } else { wifiConfiguration.wepKeys[0] = password; } wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); wifiConfiguration.wepTxKeyIndex = 0; networkId = shouldUpdate ? wifi.updateNetwork(wifiConfiguration) : wifi.addNetwork(wifiConfiguration); Log.d(TAG, "lollipop_connectToWifiAP [WEP] add Network returned " + networkId); break; case WPA_AUTO: case WPA_CCMP: case WPA_TKIP: case WPA2_AUTO: case WPA2_CCMP: case WPA2_TKIP: { wifiConfiguration.SSID = "\"" + ssid + "\""; // handle special case when WPA/WPA2 and 64 length password that can // be HEX if (password.length() == 64 && password.matches(WEP_HEX_PATTERN)) { wifiConfiguration.preSharedKey = password; } else { wifiConfiguration.preSharedKey = "\"" + password + "\""; } wifiConfiguration.status = WifiConfiguration.Status.ENABLED; wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); networkId = shouldUpdate ? wifi.updateNetwork(wifiConfiguration) : wifi.addNetwork(wifiConfiguration); Log.d(TAG, "lollipop_connectToWifiAP [WPA..WPA2] add Network returned " + networkId); break; } default: networkId = -1; break; } if (networkId < 0) { Log.d(TAG, "lollipop_connectToWifiAP networkId <0 WIFI_AUTHENTICATION_ERROR"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.d(TAG, "lollipop_connectToWifiAP calling connect"); //We will now save the configuration and then look back up the networkId //saveConfiguration may cause networkId to change boolean res = wifi.saveConfiguration(); Log.d(TAG, "lollipop_connectToWifiAP saveConfiguration status=" + res); wifiConfiguration = findConfiguration(ssid); if(wifiConfiguration == null) { Log.d(TAG, "lollipop_connectToWifiAP Could not find configuration after adding"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } lollipop_connect(wifiConfiguration, wifiConfiguration.networkId, connectionTimeout); } /** * Make the actual connection to the requested Wi-Fi target. * * @param wifiConfig * details of the Wi-Fi access point used by the WifiManger * @param networkId * id of the Wi-Fi configuration * @param timeoutMsec * period of time in Msec to complete Wi-Fi connection task */ private void lollipop_connect(final WifiConfiguration wifiConfig, final int networkId, final long timeoutMsec) { Log.i(TAG, "lollipop_connect SSID=" + wifiConfig.SSID + " within " + timeoutMsec); boolean res; synchronized (this) { targetWifiConfiguration = wifiConfig; } // this is the application's Wi-Fi connection timeout wifiTimeoutTimer.schedule(new TimerTask() { @Override public void run() { Log.e(TAG, "lollipop_connect Network Listener WIFI_TIMEOUT when trying to connect to " + normalizeSSID(targetWifiConfiguration.SSID)); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfig); sendBroadcast(OnboardingManager.WIFI_TIMEOUT_ACTION, extras); } }, timeoutMsec); res = wifi.disconnect(); Log.d(TAG, "lollipop_connect disconnect status=" + res); if ( !wifi.isWifiEnabled() ) { wifi.setWifiEnabled(true); } // enabling a network doesn't guarantee that it's the one that Android // will connect to. // Selecting a particular network is achieved by passing 'true' here to // disable all other networks. // the side effect is that all other user's Wi-Fi networks become // disabled. // The recovery for that is enableAllWifiNetworks method. res = wifi.enableNetwork(networkId, true); Log.d(TAG, "lollipop_connect enableNetwork [true] status=" + res); // Wait a few for the WiFi to do something and try again just in case // Android has decided that the network we configured is not "good enough" try{ Thread.sleep(500); } catch(Exception e) {} res = wifi.enableNetwork(networkId, true); Log.d(TAG, "lollipop_connect enableNetwork [true] status=" + res); } /** * Android marshmallow is unable to update or delete existing network configurations from the WifiManager * unless the app itself created the configuration. Therefore, only update the settings if we are creating * a new configuration. * @param ssid * @param authType * @param password * @param isHidden * @param connectionTimeout */ private void marshmallow_connectToWifiAP(String ssid, AuthType authType, String password, boolean isHidden,long connectionTimeout) { Log.d(TAG, "marshmallow_connectToWifiAP SSID = " + ssid + " authtype = " + authType.toString() + " is hidden = " + isHidden); // if networkPass is null set it to "" if (password == null) { password = ""; } int networkId = -1; WifiConfiguration wifiConfiguration = findConfiguration(ssid); if(wifiConfiguration == null) { wifiConfiguration = new WifiConfiguration(); // check the AuthType of the SSID against the WifiManager // if null use the one given by the API // else use the result from getSSIDAuthType AuthType verrifiedWifiAuthType = getSSIDAuthType(ssid); if (verrifiedWifiAuthType != null) { authType = verrifiedWifiAuthType; } if (isHidden) { wifiConfiguration.hiddenSSID = true; } Log.i(TAG, "marshmallow_connectToWifiAP selectedAuthType = " + authType); // set the priority to something high so that the network we are entering should be used wifiConfiguration.priority = 140; // set the WifiConfiguration parameters switch (authType) { case OPEN: wifiConfiguration.SSID = "\"" + ssid + "\""; wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "marshmallow_connectToWifiAP [OPEN] add Network returned " + networkId); break; case WEP: wifiConfiguration.SSID = "\"" + ssid + "\""; // check the validity of a WEP password Pair wepCheckResult = checkWEPPassword(password); if (!wepCheckResult.first) { Log.i(TAG, "marshmallow_connectToWifiAP auth type = WEP: password " + password + " invalid length or charecters"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.i(TAG, "marshmallow_connectToWifiAP [WEP] using " + (!wepCheckResult.second ? "ASCII" : "HEX")); if (!wepCheckResult.second) { wifiConfiguration.wepKeys[0] = "\"" + password + "\""; } else { wifiConfiguration.wepKeys[0] = password; } wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); wifiConfiguration.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); wifiConfiguration.wepTxKeyIndex = 0; networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "marshmallow_connectToWifiAP [WEP] add Network returned " + networkId); break; case WPA_AUTO: case WPA_CCMP: case WPA_TKIP: case WPA2_AUTO: case WPA2_CCMP: case WPA2_TKIP: { wifiConfiguration.SSID = "\"" + ssid + "\""; // handle special case when WPA/WPA2 and 64 length password that can // be HEX if (password.length() == 64 && password.matches(WEP_HEX_PATTERN)) { wifiConfiguration.preSharedKey = password; } else { wifiConfiguration.preSharedKey = "\"" + password + "\""; } wifiConfiguration.status = WifiConfiguration.Status.ENABLED; wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); wifiConfiguration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); wifiConfiguration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.RSN); wifiConfiguration.allowedProtocols.set(WifiConfiguration.Protocol.WPA); networkId = wifi.addNetwork(wifiConfiguration); Log.d(TAG, "marshmallow_connectToWifiAP [WPA..WPA2] add Network returned " + networkId); break; } default: networkId = -1; break; } if (networkId < 0) { Log.d(TAG, "marshmallow_connectToWifiAP networkId <0 WIFI_AUTHENTICATION_ERROR"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } Log.d(TAG, "marshmallow_connectToWifiAP calling connect"); } //We will now save the configuration and then look back up the networkId //saveConfiguration may cause networkId to change boolean res = wifi.saveConfiguration(); Log.d(TAG, "marshmallow_connectToWifiAP saveConfiguration status=" + res); wifiConfiguration = findConfiguration(ssid); if(wifiConfiguration == null) { Log.d(TAG, "marshmallow_connectToWifiAP Could not find configuration after adding"); Bundle extras = new Bundle(); extras.putParcelable(OnboardingManager.EXTRA_WIFI_WIFICONFIGURATION, wifiConfiguration); sendBroadcast(OnboardingManager.WIFI_AUTHENTICATION_ERROR, extras); return; } lollipop_connect(wifiConfiguration, wifiConfiguration.networkId, connectionTimeout); } } base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/WiFiNetwork.java000066400000000000000000000113041272147170000335020ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; import org.alljoyn.onboarding.OnboardingService.AuthType; import android.os.Parcel; import android.os.Parcelable; /** * WiFiNetwork encapsulates information retrieved from a WIFI scan */ public class WiFiNetwork implements Parcelable { /** * WIFI SSID name */ protected String SSID = null; /** * WIFI authentication type @see org.alljoyn.onboarding.OnboardingService.AuthType */ protected AuthType authType; /** * WIFI signal strength */ protected int level = 0; /** * Constructor */ public WiFiNetwork() { } /** * Constructor with SSID * * @param SSID */ public WiFiNetwork(String SSID) { this.SSID = SSID; } /** * Constructor with SSID,capabilities,level * * @param SSID * @param capabilities * @param level */ public WiFiNetwork(String SSID, String capabilities, int level) { this.SSID = SSID; this.authType = capabilitiesToAuthType(capabilities); this.level = level; } /** * Constructor from a Parcel * * @param in */ public WiFiNetwork(Parcel in) { this.SSID = in.readString(); this.authType = AuthType.getAuthTypeById((short) in.readInt()); this.level = in.readInt(); } @Override public int describeContents() { return 0; } @Override /** * write the members to the Parcel */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(SSID); dest.writeInt(authType.getTypeId()); dest.writeInt(level); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public WiFiNetwork createFromParcel(Parcel in) { return new WiFiNetwork(in); } @Override public WiFiNetwork[] newArray(int size) { return new WiFiNetwork[size]; } }; /** * Get {@link #SSID} * * @return the ssid of the Wi-Fi network {@link #SSID} */ public String getSSID() { return SSID; } /** * Set {@link #SSID} * * @param SSID {@link #SSID} */ public void setSSID(String SSID) { this.SSID = SSID; } /** * Get {@link #authType} * * @return the authentication type of the Wi-Fi network {@link #authType} */ public AuthType getAuthType() { return authType; } /** * Get {@link #level} * * @return the signal level of Wi-Fi network {@link #level} */ public int getLevel() { return level; } /** * Converts capabilities string to AuthType * @param capabilities string representing the possible Wi-Fi authentication scheme * @return authentication type complies to @see org.alljoyn.onboarding.OnboardingService.AuthType */ private AuthType capabilitiesToAuthType(String capabilities) { if (capabilities.contains("WPA2")) { if (capabilities.contains("TKIP")) { return AuthType.WPA2_TKIP; } else if (capabilities.contains("CCMP")) { return AuthType.WPA2_CCMP; } else { return AuthType.WPA2_AUTO; } } if (capabilities.contains("WPA")) { if (capabilities.contains("TKIP")) { return AuthType.WPA_TKIP; } else if (capabilities.contains("CCMP")) { return AuthType.WPA_CCMP; } else { return AuthType.WPA_AUTO; } } if (capabilities.contains(AuthType.WEP.name())) { return AuthType.WEP; } return AuthType.OPEN; } } WiFiNetworkConfiguration.java000066400000000000000000000064571272147170000361700ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; import org.alljoyn.onboarding.OnboardingService.AuthType; import android.os.Parcel; import android.os.Parcelable; /** * WiFiNetwork encapsulates information how to connect to a WIFI network * */ public class WiFiNetworkConfiguration extends WiFiNetwork implements Parcelable { /** * WIFI password */ private String password = null; /** * WIFI SSID hidden */ private boolean hidden = false; /** * Constructor with SSID,authType,password,cipher * * @param SSID * @param authType * @param password */ public WiFiNetworkConfiguration(String SSID, AuthType authType, String password) { super.setSSID(SSID); this.password = password; this.authType = authType; } public WiFiNetworkConfiguration(String SSID, AuthType authType, String password, boolean isHidden) { super.setSSID(SSID); this.password = password; this.authType = authType; this.hidden = isHidden; } /** * Constructor from a Parcel * * @param in */ public WiFiNetworkConfiguration(Parcel in) { SSID = in.readString(); password = in.readString(); authType = AuthType.getAuthTypeById((short) in.readInt()); hidden = (in.readByte() != 0); } @Override public int describeContents() { return 0; } @Override /** * write the members to the Parcel */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(SSID); dest.writeString(password); dest.writeInt(authType.getTypeId()); dest.writeByte((byte) (hidden ? 1 : 0)); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public WiFiNetworkConfiguration createFromParcel(Parcel in) { return new WiFiNetworkConfiguration(in); } @Override public WiFiNetworkConfiguration[] newArray(int size) { return new WiFiNetworkConfiguration[size]; } }; /** * Get {@link #password} * * @return the password of the network {@link #password} */ public String getPassword() { return password; } public boolean isHidden() { return hidden; } } WifiDisabledException.java000066400000000000000000000024161272147170000354240ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingManager/android/src/org/alljoyn/onboarding/sdk/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.sdk; /** * Thrown to indicate that Wi-Fi is disabled. */ @SuppressWarnings("serial") public class WifiDisabledException extends Exception { public WifiDisabledException(String message) { super(message); } public WifiDisabledException() { super(); } } base-16.04/onboarding/java/OnboardingService/000077500000000000000000000000001272147170000211055ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/.classpath000066400000000000000000000005641272147170000230750ustar00rootroot00000000000000 base-16.04/onboarding/java/OnboardingService/.project000066400000000000000000000005701272147170000225560ustar00rootroot00000000000000 OnboardingService org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature base-16.04/onboarding/java/OnboardingService/build.xml000066400000000000000000000062171272147170000227340ustar00rootroot00000000000000 AllJoyn™ OnBoarding Service Version 15.04.00]]> AllJoyn™ OnBoarding Service Java API Reference Manual Version 15.04.00
          Copyright AllSeen Alliance, Inc. All Rights Reserved.

          AllSeen, AllSeen Alliance, and AllJoyn are trademarks of the AllSeen Alliance, Inc in the United States and other jurisdictions.

          THIS DOCUMENT AND ALL INFORMATION CONTAIN HEREIN ARE PROVIDED ON AN "AS-IS" BASIS WITHOUT WARRANTY OF ANY KIND.
          MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION
          ]]>
          base-16.04/onboarding/java/OnboardingService/src/000077500000000000000000000000001272147170000216745ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/000077500000000000000000000000001272147170000224635ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/000077500000000000000000000000001272147170000241335ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/000077500000000000000000000000001272147170000262555ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/OnboardingService.java000066400000000000000000000124371272147170000325320ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding; import org.alljoyn.bus.BusAttachment; import org.alljoyn.onboarding.client.OnboardingClient; import org.alljoyn.services.common.ServiceAvailabilityListener; /** * An interface for both Onboarding client (onboarder) and server (onboardee). */ public interface OnboardingService { /** * SDK version */ public static final int PROTOCOL_VERSION = 1; /** * Enumeration of authentication types * -3 - wpa2_auto, onboardee should try WPA2_TKIP and WPA2_CCMP * -2 - wpa_auto, onboardee should try WPA_TKIP and WPA_CCMP * -1 - any, The onboardee chooses the authentication * 0 - Open Personal AP is open * 1 - WEP * 2 - WPA_TKIP * 3 - WPA_CCMP * 4 - WPA2_TKIP * 5 - WPA2_CCMP * 6 - WPSS */ public static enum AuthType { WPA2_AUTO ((short)-3), WPA_AUTO ((short)-2), ANY ((short)-1), OPEN ((short)0), WEP ((short)1), WPA_TKIP ((short)2), WPA_CCMP ((short)3), WPA2_TKIP ((short)4), WPA2_CCMP ((short)5), WPS ((short)6); /** * Type id */ private short id; /** * Constructor * @param id */ private AuthType(short id) { this.id = id; } /** * Returns the id of authentication type * @return id of authentication type */ public short getTypeId() { return id; } /** * Search for authentication type with the given Id. If not found returns NULL * @param typeId type id * @return authentication type */ public static AuthType getAuthTypeById(short typeId) { AuthType retType = null; for (AuthType type : AuthType.values()) { if ( typeId == type.getTypeId() ) { retType = type; break; } } return retType; } } /** * Enumeration of onboarding state * 0 - Personal AP Not Configured * 1 - Personal AP Configured/Not Validated * 2 - Personal AP Configured/Validating * 3 - Personal AP Configured/Validated * 4 - Personal AP Configured/Error * 5 - Personal AP Configured/Retry */ public static enum OnboardingState { PERSONAL_AP_NOT_CONFIGURED ((short)0), PERSONAL_AP_CONFIGURED_NOT_VALIDATED ((short)1), PERSONAL_AP_CONFIGURED_VALIDATING ((short)2), PERSONAL_AP_CONFIGURED_VALIDATED ((short)3), PERSONAL_AP_CONFIGURED_ERROR ((short)4), PERSONAL_AP_CONFIGURED_RETRY ((short)5); /** * Type id */ private short id; /** * Constructor * @param id */ private OnboardingState(short id) { this.id = id; } /** * Returns the id of state type * @return id of state type */ public short getStateId() { return id; } /** * Search for Onboarding state with the given Id. If not found returns NULL * @param stateId type id * @return onboarding state */ public static OnboardingState getStateById(short stateId) { OnboardingState retState = null; for (OnboardingState state : OnboardingState.values()) { if ( stateId == state.getStateId() ) { retState = state; break; } } return retState; } } /** * Get the onboarding state * @return onboarding state */ public OnboardingState getState(); /** * Start server mode (onboardee). The application creates the BusAttachment * @param busAttachment the AllJoyn bus attachment. * @throws Exception */ public void startOnboardingServer(BusAttachment busAttachment) throws Exception; /** * Stop server mode (onboardee) * @throws Exception */ void stopOnboardingServer() throws Exception; /** * Create an Onboarding client for a peer onboardee. * @param deviceName the remote device * @param serviceAvailabilityListener listener for connection loss * @param port the peer's bound port of the Onboarding server * @return OnboardingClient for running a session with the peer * @throws Exception */ OnboardingClient createOnboardingClient(String deviceName, ServiceAvailabilityListener serviceAvailabilityListener, short port) throws Exception; /** * Start client mode (onboarder). The application creates the BusAttachment * @param bus the AllJoyn bus attachment * @throws Exception */ void startOnboardingClient(BusAttachment bus) throws Exception; /** * Stop client mode (onboarder). */ void stopOnboardingClient(); } base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/client/000077500000000000000000000000001272147170000275335ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/client/OnboardingClient.java000066400000000000000000000120121272147170000336130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.client; import org.alljoyn.bus.BusException; import org.alljoyn.onboarding.OnboardingService.AuthType; import org.alljoyn.onboarding.transport.ConnectionResultListener; import org.alljoyn.onboarding.transport.OBLastError; import org.alljoyn.onboarding.transport.OnboardingTransport.ConfigureWifiMode; import org.alljoyn.onboarding.transport.ScanInfo; import org.alljoyn.services.common.ClientBase; /** * An interface for onboarding a remote IoE device (onboardee). Encapsulates the * OnboardingTransport BusInterface */ public interface OnboardingClient extends ClientBase { /** * Returns the configured state of the onboardee * * @return the onboarding state: 0 - Personal AP Not Configured 1 - Personal * AP Configured/Not Validated 2 - Personal AP Configured/Validating * 3 - Personal AP Configured/Validated 4 - Personal AP * Configured/Error 5 - Personal AP Configured/Retry * @throws BusException */ public short getState() throws BusException; /** * Get the last error. During most of the onboarding process, the onboarder * and onboardee are on different networks so returning a sync result isn't * possible. Especially when there was an error and the onboardee did not * connect to the onboarder's network. The onboardee then opens a soft AP to * which the onboarder connects, and this method is how the onboarder can * query about what happened. * * @return last error * @throws BusException */ public OBLastError GetLastError() throws BusException; /** * Send the personal AP info to the onboardee. The onboardee doesn't try to * connect yet. It waits for {@link #connectWiFi()} When the authType is * equal to "any", the onboardee needs to try out all the possible * authentication types it supports to connect to the AP. * * @param ssid * the personal AP SSID * @param passphrase * the personal AP passphrase * @param authType * the authentication type of the AP * @return Wifi mode regular or fast channel * @throws BusException * If authType parameter is invalid then the AllJoyn error code * org.alljoyn.Error.OutOfRange will be returned */ public ConfigureWifiMode configureWiFi(String ssid, String passphrase, AuthType authType) throws BusException; /** * Tell the onboardee to connect to the Personal AP. The onboardee is * recommended to use channel switching feature if it is available. That is, * keep the soft AP open with the onboarder, while trying to connect to the * personal AP. * * @throws BusException */ public void connectWiFi() throws BusException; /** * Tell the onboardee to disconnect from the personal AP, clear the personal * AP configuration fields, and start the soft AP mode. * * @throws BusException */ public void offboard() throws BusException; /** * Scan all the WiFi access points in the onboardee's proximity, so that the * onboarder can select the proper one. Some devices may not support this * feature. * * @return ScanInfo an array of scan results. * @throws BusException * If device doesn't support the feature, the AllJoyn error code * org.alljoyn.Error.FeatureNotAvailable will be returned in the * AllJoyn response. */ public ScanInfo getScanInfo() throws BusException; /*** * Register to receive ConnectionResult signal data. * This is relevant in fast channel switching mode. * * @param listener callback class to receive data. * @throws BusException if registration fails */ public void registerConnectionResultListener(ConnectionResultListener listener) throws BusException; /** * Unregister from receiving ConnectionResult signal data. * @param listener */ public void unRegisterConnectionResultListener(ConnectionResultListener listener); } OnboardingClientImpl.java000066400000000000000000000177031272147170000343720ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/client/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.client; import org.alljoyn.bus.BusAttachment; import org.alljoyn.bus.BusException; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.ErrorReplyBusException; import org.alljoyn.bus.ProxyBusObject; import org.alljoyn.bus.Status; import org.alljoyn.bus.annotation.BusSignalHandler; import org.alljoyn.onboarding.OnboardingService.AuthType; import org.alljoyn.onboarding.transport.ConnectionResult; import org.alljoyn.onboarding.transport.ConnectionResult.ConnectionResponseType; import org.alljoyn.onboarding.transport.ConnectionResultAJ; import org.alljoyn.onboarding.transport.ConnectionResultListener; import org.alljoyn.onboarding.transport.OBLastError; import org.alljoyn.onboarding.transport.OnboardingTransport; import org.alljoyn.onboarding.transport.OnboardingTransport.ConfigureWifiMode; import org.alljoyn.onboarding.transport.ScanInfo; import org.alljoyn.services.common.ClientBaseImpl; import org.alljoyn.services.common.ServiceAvailabilityListener; /** * A default implementation of the OnboardingClient interface */ public class OnboardingClientImpl extends ClientBaseImpl implements OnboardingClient { /** * Used to register the bus object upon the bus attachment */ private final static String CONNECTION_RESULT_PATH = "/OnboardingTranport/ConnectionResult"; /** * Stores instance of ConnectionResultReceiver */ private ConnectionResultReceiver receiver = null; /** * Stores instance of ConnectionResultListener {@link ConnectionResultListener} */ private ConnectionResultListener connectionResultListener = null; /** * Internal class used for receiving ConnectionResult signal . * Calls onConnectionResult to the CallBack ConnectionResultListener to deliver the signal data. */ private class ConnectionResultReceiver implements BusObject { @BusSignalHandler(iface = OnboardingTransport.INTERFACE_NAME, signal = "ConnectionResult") public void ConnectionResult(ConnectionResultAJ connectionResultAJ) { ConnectionResult.ConnectionResponseType connectionResponseType =ConnectionResult.ConnectionResponseType.getConnectionResponseTypeByValue(connectionResultAJ.code); if (connectionResponseType==null){ connectionResponseType=ConnectionResponseType.ERROR_MESSAGE; } if (connectionResultListener!=null){ connectionResultListener.onConnectionResult(new ConnectionResult(connectionResponseType, connectionResultAJ.message)); } } } @SuppressWarnings("deprecation") public OnboardingClientImpl(String m_deviceName, BusAttachment bus, ServiceAvailabilityListener serviceAvailabilityListener, short port) { super(m_deviceName, bus, serviceAvailabilityListener, OnboardingTransport.OBJ_PATH, OnboardingTransport.class, port); } @Override public short getVersion() throws BusException { ProxyBusObject proxyObj = getProxyObject(); /* * We make calls to the methods of the AllJoyn object through one of its * interfaces. */ OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); return onboardingTransport.getVersion(); } @Override public void connectWiFi() throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); onboardingTransport.Connect(); } @Override public ConfigureWifiMode configureWiFi(String ssid, String passphrase, AuthType authType) throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); short val=onboardingTransport.ConfigureWiFi(ssid, passphrase, authType.getTypeId()); ConfigureWifiMode ret=ConfigureWifiMode.getConfigureWifiModeByValue(val); //in case the result of the ConfigureWiFi is not REGULAR /FAST_CHANNNEL set it to be REGULAR. if (ret==null){ throw new ErrorReplyBusException("org.alljoyn.Error.InvalidValue", "configureWiFi returned an invalid value: " + ret); } return ret; } @Override public void offboard() throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); onboardingTransport.Offboard(); } @Override public ScanInfo getScanInfo() throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); return onboardingTransport.GetScanInfo(); } @Override public short getState() throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); return onboardingTransport.getState(); } @Override public OBLastError GetLastError() throws BusException { ProxyBusObject proxyObj = getProxyObject(); // We make calls to the methods of the AllJoyn object through one of its // interfaces. OnboardingTransport onboardingTransport = proxyObj.getInterface(OnboardingTransport.class); return onboardingTransport.getLastError(); } @Override public void registerConnectionResultListener(ConnectionResultListener listener) throws BusException { if (receiver == null) { receiver = new ConnectionResultReceiver(); } Status status = this.m_bus.registerBusObject(receiver, CONNECTION_RESULT_PATH); if (status != Status.OK) { throw new BusException("registerBusObject " + CONNECTION_RESULT_PATH + " signal handler has failed, Status: '" + status + "'"); } status = this.m_bus.registerSignalHandlers(receiver); if (status != Status.OK) { throw new BusException("registerSignalHandlers " + CONNECTION_RESULT_PATH + " signal handler has failed, Status: '" + status + "'"); } this.connectionResultListener = listener; } @Override public void unRegisterConnectionResultListener(ConnectionResultListener listener) { if (receiver != null) { this.connectionResultListener=null; this.m_bus.unregisterSignalHandlers(receiver); this.m_bus.unregisterBusObject(receiver); } } } base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/000077500000000000000000000000001272147170000303115ustar00rootroot00000000000000ConnectionResult.java000066400000000000000000000066001272147170000343750ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; /** * Wraps the signal that is emitted when the connection attempt against the personal AP is completed. * This signal will be received only if the fast channel switching feature is supported by the device. */ public class ConnectionResult { /** * ConnectionResult message */ private final String message; /** * ConnectionResult response code */ private final ConnectionResponseType connectionResponseType; /** * These enumeration values are returned from a device that supports fast channel switching .It is reported after the device tries to verify * the validity of the Wi-Fi parameters received via {@link OnboardingTransport#ConfigureWiFi(String, String, short)} */ public static enum ConnectionResponseType { /** * Wi-Fi validated */ VALIDATED((short) 0), /** * Wi-Fi unreachable */ UNREACHABLE((short) 1), /** * Wi-Fi AP doesn't support the authentication received */ UNSUPPORTED_PROTOCOL((short) 2), /** * Wi-Fi authentication error */ UNAUTHORIZED((short) 3), /** * Misc error */ ERROR_MESSAGE((short) 4); private short value; /** * * @param value */ private ConnectionResponseType(short value) { this.value = value; } /** * Returns the id of authentication type * * @return id of authentication type */ public short getValue() { return value; } public static ConnectionResponseType getConnectionResponseTypeByValue(short value) { ConnectionResponseType ret = null; for (ConnectionResponseType responseType : ConnectionResponseType.values()) { if (value == responseType.getValue()) { ret = responseType; break; } } return ret; } } public ConnectionResult(ConnectionResponseType connectionResponseType, String message) { this.message = message; this.connectionResponseType = connectionResponseType; } public String getMessage() { return message; } public ConnectionResponseType getConnectionResponseType() { return connectionResponseType; } } ConnectionResultAJ.java000066400000000000000000000023541272147170000346120ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; import org.alljoyn.bus.annotation.Position; /** * Used for passing ConnectionResult signal over the AllJoyn bus. */ public class ConnectionResultAJ { @Position(0) public short code; @Position(1) public String message; } ConnectionResultListener.java000066400000000000000000000023471272147170000361070ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; /** * A callback for receiving ConnectionResult signal data from devices that support fast switching channel */ public interface ConnectionResultListener { public void onConnectionResult(ConnectionResult connectionResutl); } base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/MyScanResult.java000066400000000000000000000034041272147170000335460ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; import org.alljoyn.bus.annotation.Position; import org.alljoyn.onboarding.OnboardingService.AuthType; /** * A struct that represents a WiFi scan result: SSID and authType. */ public class MyScanResult { /** * The personal AP SSID */ @Position(0) public String m_ssid; /** * The personal AP authentication type * -3 - wpa2_auto, onboardee should try WPA2_TKIP and WPA2_CCMP * -2 - wpa_auto, onboardee should try WPA_TKIP and WPA_CCMP * -1 - any, The onboardee chooses the authentication * 0 - Open Personal AP is open * 1 - WEP * 2 - WPA_TKIP * 3 - WPA_CCMP * 4 - WPA2_TKIP * 5 - WPA2_CCMP * 6 - WPS * @see {@link AuthType} */ @Position(1) public short m_authType; } base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/OBLastError.java000066400000000000000000000045201272147170000333130ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; import org.alljoyn.bus.annotation.Position; /** * A class that represents the last onboarding error: The last error code and error message */ public class OBLastError { /** * The error code of the last validation * 0 - Validated * 1 - Unreachable * 2 - Unsupported_protocol * 3 - Unauthorized * 4 - Error_message */ @Position(0) public short m_errorCode; /** * The error message of the last validation * Error_message is the error message received from the underlying Wifi layer. */ @Position(1) public String m_errorMsg; public OBLastError() { } /** * Get the last validation error code * @return the last error code * 0 - Validated * 1 - Unreachable * 2 - Unsupported_protocol * 3 - Unauthorized * 4 - Error_message */ public short getErrorCode() { return m_errorCode; } /** * Set the last validation error code * @param errorCode */ public void setErrorCode(short errorCode) { m_errorCode = errorCode; } /** * Get the last validation error message * @return the error message received from the underlying Wifi layer. */ public String getErrorMessage() { return m_errorMsg; } /** * Set the last validation error message * @param errorMsg */ public void setErrorMessage(String errorMsg) { m_errorMsg = errorMsg; } } OnboardingTransport.java000066400000000000000000000132021272147170000350720ustar00rootroot00000000000000base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; import org.alljoyn.bus.BusException; import org.alljoyn.bus.BusObject; import org.alljoyn.bus.annotation.BusAnnotation; import org.alljoyn.bus.annotation.BusAnnotations; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.bus.annotation.Secure; /** * Definition of the Onboarding BusInterface */ @BusInterface(name = OnboardingTransport.INTERFACE_NAME, announced = "true") @Secure public interface OnboardingTransport extends BusObject { public static final String INTERFACE_NAME = "org.alljoyn.Onboarding"; public final static String OBJ_PATH = "/Onboarding"; /** * These enumeration values are used to indicate the ConfigureWifi possible * modes */ public static enum ConfigureWifiMode { /** * Wi-Fi standard mode */ REGULAR((short) 1), /** * Wi-Fi fast channel switching mode */ FAST_CHANNEL_SWITCHING((short) 2); private final short value; private ConfigureWifiMode(short value) { this.value = value; } public short getValue() { return value; } public static ConfigureWifiMode getConfigureWifiModeByValue(short value) { ConfigureWifiMode retState = null; for (ConfigureWifiMode responseType : ConfigureWifiMode.values()) { if (value == responseType.getValue()) { retState = responseType; break; } } return retState; } } /** * @return the interface version * @throws BusException */ @BusProperty(signature = "q") public short getVersion() throws BusException; /** * @return the state - one of the following values: 0 - Personal AP Not * Configured 1 - Personal AP Configured/Not Validated 2 - Personal * AP Configured/Validating 3 - Personal AP Configured/Validated 4 - * Personal AP Configured/Error 5 - Personal AP Configured/Retry * @throws BusException */ @BusProperty(signature = "n") public short getState() throws BusException; /** * @return the last error 0 - Validated 1 - Unreachable 2 - * Unsupported_protocol 3 - Unauthorized 4 - Error_message * @throws BusException */ @BusProperty(signature = "(ns)") public OBLastError getLastError() throws BusException; /** * Tell the onboardee to connect to the Personal AP. The onboardee is * recommended to use channel switching feature if it is available. * * @throws BusException */ @BusMethod() @BusAnnotations({ @BusAnnotation(name = "org.freedesktop.DBus.Method.NoReply", value = "true") }) public void Connect() throws BusException; /** * Send the personal AP info to the onboardee. When the authType is equal to * "any", the onboardee needs to try out all the possible authentication * types it supports to connect to the AP. If authType parameter is invalid * then the AllJoyn error code org.alljoyn.Error.OutOfRange will be returned * * @param ssid * @param passphrase * @param authType * - one of the following values WPA2_AUTO = -3, WPA_AUTO = -2, * any = -1, Open = 0 , WEP = 1, WPA_TKIP =2, WPA_CCMP = 3, * WPA2_TKIP = 4, WPA2_CCMP = 5, WPS = 6 * @throws BusException */ @BusMethod(signature = "ssn", replySignature = "n") public short ConfigureWiFi(String ssid, String passphrase, short authType) throws BusException; /** * Tell the onboardee to disconnect from the personal AP, clear the personal * AP configuration fields, and start the soft AP mode. */ @BusMethod() @BusAnnotations({ @BusAnnotation(name = "org.freedesktop.DBus.Method.NoReply", value = "true") }) public void Offboard() throws BusException; /** * Scan all the WiFi access points in the onboardee's proximity. Some device * may not support this feature. * * @throws BusException * if feature is unsupported, AllJoyn error code * org.alljoyn.Error.FeatureNotAvailable will be returned in the * AllJoyn response. */ @BusMethod(replySignature = "qa(sn)") public ScanInfo GetScanInfo() throws BusException; /** * Signal received after ConfigureWiFi status is 2 * * @param connectionResultAJ */ @BusSignal(signature = "(ns)") public void ConnectionResult(ConnectionResultAJ connectionResultAJ); } base-16.04/onboarding/java/OnboardingService/src/org/alljoyn/onboarding/transport/ScanInfo.java000066400000000000000000000040361272147170000326570ustar00rootroot00000000000000/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.onboarding.transport; import org.alljoyn.bus.annotation.Position; /** * A class that represents a WiFi scan: an array of SSID and authType, with an age */ public class ScanInfo { /** * age reflects how long ago was the scan procedure performed by the device. The units are in minutes. */ @Position(0) public short m_age; /** * An array of {@link MyScanResult}. Each one represents a potential personal AP: SSID and authType. */ @Position(1) public MyScanResult[] m_scanResults; public ScanInfo() { } /** * Get the age of the scan * @return age in minutes */ public short getAge() { return m_age; } /** * set the age of the scan * @param age in minutes */ public void setAge(short age) { m_age = age; } /** * Get the Scan Result * @return an array of SSID,AuthType pairs */ public MyScanResult[] getScanResults() { return m_scanResults; } /** * Set the scan result * @param result */ public void setScanResult(MyScanResult[] result) { m_scanResults = result; } } base-16.04/onboarding/java/sample_applications/000077500000000000000000000000001272147170000215315ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/000077500000000000000000000000001272147170000231515ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/000077500000000000000000000000001272147170000310275ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/.classpath000066400000000000000000000007221272147170000330130ustar00rootroot00000000000000 base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/.project000066400000000000000000000015001272147170000324720ustar00rootroot00000000000000 Onboarding Manager Sample App com.android.ide.eclipse.adt.ResourceManagerBuilder com.android.ide.eclipse.adt.PreCompilerBuilder org.eclipse.jdt.core.javabuilder com.android.ide.eclipse.adt.ApkBuilder com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature AndroidManifest.xml000066400000000000000000000040171272147170000345430ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/build.xml000066400000000000000000000040121272147170000326450ustar00rootroot00000000000000 project.properties000066400000000000000000000010631272147170000345340ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/000077500000000000000000000000001272147170000316205ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/drawable/000077500000000000000000000000001272147170000334015ustar00rootroot00000000000000error.png000066400000000000000000000064421272147170000351670ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/drawablePNG  IHDR##ٳY pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FMIDATxKHTqϨ9"iD) DVPJtWQDDB6-j5hE/jcch#\EIpQf83̽sN|V̾2e̕S2ôāI2-fSSt:DƯ*0VKkWaۊ q`ޠ3 u-G{380q<|}Pp`ODcBgb ΞyQ[pۻzg7WG.>Łb6dꯧRLNFb)< j漶62/}7B\5)61ĕ@wD׆HV◠] [r p ;5!q/UɴutIs7}%4B0K"3PyrIENDB`icon.png000066400000000000000000000022661272147170000347660ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/drawablePNG  IHDR00`ntRNSn pHYs  VIDATXOgwpx|)0J@IgَڎZq~I))h2uDd_n]ڙ&6I#kfTK41og78O?q}%=<QJEEi%pAO?+Σ9ٺ>*A}")b9Mt"NԴV+LTEg1z7nX:?RJ""s⯄7LwOy=4;17(LUnni齸g h'~A7ɔqi3DT9X%NDl*Exի "|Dt#l 瀛,ì[MD2U\|GIeklۧ4swQIVy#LŽ{xMMF[rQTgob`1 br&Sbw#Wl6Ϯvt0Nڻg #' ;-㻉S>@)1zhiLǣ+. h埛㱼4dɛs/WCi3/_ Ơ+q1AA!@ʪn>rL[Pp Y ]{"ZA}*Ag;ड़c  -~Ѿ Fa%|4b?CgO@+er6J ˳4T&3r-tӗep}B%:W:@!g<0[I~ r30H_a6 =i8F~1?ɳMRl_ )Xٗ;y3x*zRZ㲁27f#GQ,3Jކܠ~+FCuyjtE8 ߋL3e~p"R,ςD[3&àT< “ Z eDfH%p 2NQYVpoq)hA\{y:,TrԧBhz? /63VzgJd͌|1n_Jtz\n l47 })by)2Lg,0>q[[ٴopHIENDB`success.png000066400000000000000000000030701272147170000355000ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/drawablePNG  IHDR@@iqtEXtSoftwareAdobe ImageReadyqe<"iTXtXML:com.adobe.xmp qRIDATxKQgmu3Do% rX6kA_b;" pEĢ7?aH3sf=㬣G1=IT#w@g'\߈FL/UL03Op nF JJ [/._os7@-~ ">0Sro%7*![ \ɷ yb^OS(I>-pn̴&x+@y+k`4+2iszBqFM2M\=y?pL#t]PKs~ x^r,a%ډET $,4(Lg%ZaPO[A+,~B~Qt%Q%W$~+.MՑ<] qGb@J(mOnk{=NKԦ#n*yPN'YJ>1QϪ;`Z$v%<P%#uϷt<] 'vɫ:WO0t:rV:Wi] &? u{(|b b bW`NcIENDB`base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/layout/000077500000000000000000000000001272147170000331355ustar00rootroot00000000000000connect_to_network_layout.xml000066400000000000000000000064321272147170000411060ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/layout main_layout.xml000066400000000000000000000115361272147170000361270ustar00rootroot00000000000000base-16.04/onboarding/java/sample_applications/android/OnboardingManagerSampleClient/res/layout