--- a/build/Makefile.project Fri Apr 30 10:40:48 2010 +0300
+++ b/build/Makefile.project Tue May 11 16:07:20 2010 +0300
@@ -166,16 +166,6 @@
PROJECT_DEFINES += RD_JAVA_NGA_ENABLED
endif
-# Uiaccelerator AlfDrawer is supported since 9.2
-ifndef RD_JAVA_S60_RELEASE_5_0
- ifneq ($(wildcard $(EPOCROOT)epoc32/include/platform/mw/alf/alfdrawer.h),)
- RD_JAVA_UI_ALFDRAWER_ENABLED = 1
- endif
-endif
-ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
- PROJECT_DEFINES += RD_JAVA_UI_ALFDRAWER_ENABLED
-endif
-
# Check if USIF is supported
ifneq ($(wildcard $(EPOCROOT:\=/)epoc32/include/mw/usif/scr/scr.h),)
RD_JAVA_USIF_ENABLED = 1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build/buildutils/checkjavapackages.py Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Checks that all the java source files declare a package and that
+# the directory within a java source file is located corresponds
+# properly to the package.
+
+import sys, os, re
+
+
+def main():
+
+ files = []
+
+ # Create a reg exp matching to "package x.y.z;" with whitespace ignored
+ regex = re.compile("\\s*package\\s*([\\w.]*);.*", re.IGNORECASE)
+
+ def visitFun(arg, dirname, names):
+
+ # Skip SVN directories
+ if dirname.find("\\.svn") != -1:
+ return names
+
+ for f in names:
+ if not f.endswith(".java"):
+ continue
+
+ try:
+ fname = dirname + "\\" + f
+ file = open(fname)
+
+ package = None
+ line = file.readline()
+ while line != "":
+ result = regex.match(line)
+ if result != None:
+ package = result.group(1)
+ break;
+ line = file.readline()
+
+ if package != None:
+ expectedDir = package.replace(".", "\\");
+ if not dirname.endswith(expectedDir):
+ print "Wrong directory:", fname + ", package", package
+ else:
+ print "Package statement missing:", fname
+
+
+ file.close()
+
+ except IOError:
+ print "Error reading the file " + fname
+
+ os.path.walk(sys.argv[1], visitFun, files)
+
+
+if __name__ == "__main__":
+ main()
--- a/build/buildutils/checkwarnings.py Fri Apr 30 10:40:48 2010 +0300
+++ b/build/buildutils/checkwarnings.py Tue May 11 16:07:20 2010 +0300
@@ -33,7 +33,7 @@
# Constants for matching warnings related to deprecation
deprecatedStart = "warning: preprocessor #warning directive"
- deprecatedSecondLine = "warning: #warning This header file has been deprecated. Will be removed in one of the next SDK releases."
+ deprecatedSecondLine = "warning: #warning This header file"
deprecatedOptionalThirdLine = "warning: (included from:"
deprecatedOptionalRest = "warning: "
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/build/buildutils/extractJavaLocFiles_qt.py Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,129 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#!/usr/bin/python
+#
+# This script creates java specific loc zip files from S60 loc zip files
+# and also creates a "resources.jar" file where all the java loc files
+# are collected.
+#
+# Usage: extractJavaLocFiles_qt.py <input_dir> <output_dir> <resources_jar>
+#
+# Script reads S60 loc zip files from <input_dir> directory and writes
+# "resources.jar" to <output_dir> directory.
+#
+# This script uses external "jar" command for handling zip files and
+# thus is not optimized for speed.
+#
+
+import os, re, shutil, sys, glob, codecs
+import traceback
+import xml.etree.ElementTree as et
+from optparse import OptionParser
+
+# Base names for java loc files.
+JAVA_LOC_FILES = [
+ 'javafileconnection',
+ 'javainstallation',
+ 'javasensor',
+ 'javassl',
+ 'javausermessages',
+ 'javaapplicationsettings',
+ 'javaruntimeapplicationsettings'
+ ]
+
+# Path for java loc files inside RESOURCES_FILE.
+RESOURCES_PATH = os.path.join("resources", "com", "nokia", "mj", "impl")
+
+def main():
+ parser = OptionParser(
+ usage = "Usage: %prog [args] <input_dir> <output_dir> <resources_jar>")
+ (opts, args) = parser.parse_args()
+
+ try:
+ inputDir = args[0]
+ outputDir = args[1]
+ resourcesFilename = os.path.join(outputDir, args[2])
+
+ # Use temporary directory
+ tmpDir = "tmpdir"
+ if os.path.exists(tmpDir):
+ shutil.rmtree(tmpDir)
+ locDir = os.path.join(tmpDir, RESOURCES_PATH)
+ os.makedirs(locDir)
+
+ print "Processing loc files from %s to %s" % (inputDir, resourcesFilename)
+ locFileCount = 0;
+
+ # Go through all Java loc file names, converting the .ts to .loc
+ for name in JAVA_LOC_FILES:
+
+ # Find all existing ts-files
+ for ts in glob.glob("%s/%s_*.ts" % (inputDir, name)):
+ path, filename = os.path.split(ts)
+ base, ext = os.path.splitext(filename)
+ loc = os.path.join(locDir, base + ".loc")
+ print "Converting %s" % ts
+ writeLoc(loc, readTs(ts))
+ locFileCount = locFileCount + 1
+
+ # Update the target jar with loc-files
+ if os.path.isfile(resourcesFilename):
+ os.system("jar ufM " + resourcesFilename + " -C " + tmpDir + " .")
+ else:
+ os.system("jar cfM " + resourcesFilename + " -C " + tmpDir + " .")
+
+ print "Processed %d loc files" % (locFileCount)
+ shutil.rmtree(tmpDir)
+
+ except:
+ print "Usage: %s <input_dir> <output_dir>" % sys.argv[0]
+ traceback.print_exc()
+ sys.exit(1)
+
+def readTs(filename):
+ messages = []
+ tree = et.parse(filename).getroot()
+ for message in tree.find("context").findall("message"):
+ id = message.get("id")
+ translation = message.find("translation")
+
+ # Sanity check - we have no good plurality support for qt-localisation
+ if translation.find("numerusform") != None:
+ raise Exception("Conversion error at %s / %s: numerus form (qt plurality) is not supported" % (filename, id))
+
+ lengthvariant = translation.find("lengthvariant")
+ if lengthvariant != None:
+ text = lengthvariant.text
+ else:
+ text = translation.text
+
+ # Sanity check - no newlines in text allowed
+ if "\n" in text:
+ raise Exception("Conversion error in %s / %s: newline found" % (filename, id))
+
+ messages.append((id, text))
+
+ return messages
+
+def writeLoc(filename, messages):
+ loc = codecs.open(filename, "w", "UTF-8")
+ loc.write(u"CHARACTER_SET UTF8\n")
+ for id, message in messages:
+ loc.write(u'#define %s "%s"\n' % (id, message))
+ loc.close()
+
+if __name__ == "__main__":
+ main()
Binary file build/loc/01.zip has changed
Binary file build/loc/02.zip has changed
Binary file build/loc/03.zip has changed
Binary file build/loc/04.zip has changed
Binary file build/loc/05.zip has changed
Binary file build/loc/06.zip has changed
Binary file build/loc/07.zip has changed
Binary file build/loc/08.zip has changed
Binary file build/loc/09.zip has changed
Binary file build/loc/10.zip has changed
Binary file build/loc/102.zip has changed
Binary file build/loc/103.zip has changed
Binary file build/loc/129.zip has changed
Binary file build/loc/13.zip has changed
Binary file build/loc/14.zip has changed
Binary file build/loc/14346.zip has changed
Binary file build/loc/14387.zip has changed
Binary file build/loc/14412.zip has changed
Binary file build/loc/14419.zip has changed
Binary file build/loc/15.zip has changed
Binary file build/loc/157.zip has changed
Binary file build/loc/158.zip has changed
Binary file build/loc/159.zip has changed
Binary file build/loc/16.zip has changed
Binary file build/loc/160.zip has changed
Binary file build/loc/161.zip has changed
Binary file build/loc/17.zip has changed
Binary file build/loc/18.zip has changed
Binary file build/loc/230.zip has changed
Binary file build/loc/25.zip has changed
Binary file build/loc/26.zip has changed
Binary file build/loc/27.zip has changed
Binary file build/loc/28.zip has changed
Binary file build/loc/29.zip has changed
Binary file build/loc/30.zip has changed
Binary file build/loc/31.zip has changed
Binary file build/loc/32.zip has changed
Binary file build/loc/326.zip has changed
Binary file build/loc/327.zip has changed
Binary file build/loc/33.zip has changed
Binary file build/loc/37.zip has changed
Binary file build/loc/39.zip has changed
Binary file build/loc/42.zip has changed
Binary file build/loc/44.zip has changed
Binary file build/loc/45.zip has changed
Binary file build/loc/49.zip has changed
Binary file build/loc/50.zip has changed
Binary file build/loc/51.zip has changed
Binary file build/loc/54.zip has changed
Binary file build/loc/57.zip has changed
Binary file build/loc/58.zip has changed
Binary file build/loc/59.zip has changed
Binary file build/loc/65.zip has changed
Binary file build/loc/67.zip has changed
Binary file build/loc/68.zip has changed
Binary file build/loc/70.zip has changed
Binary file build/loc/76.zip has changed
Binary file build/loc/78.zip has changed
Binary file build/loc/79.zip has changed
Binary file build/loc/83.zip has changed
Binary file build/loc/93.zip has changed
Binary file build/loc/94.zip has changed
Binary file build/loc/96.zip has changed
Binary file build/loc/resources.jar has changed
Binary file build/loc/resources_qt.jar has changed
--- a/build/makefile.javaversion Fri Apr 30 10:40:48 2010 +0300
+++ b/build/makefile.javaversion Tue May 11 16:07:20 2010 +0300
@@ -1,6 +1,6 @@
# Set Java version (must be dot separated, without spaces)
ifdef RD_JAVA_S60_RELEASE_5_0_IAD
- JAVA_VERSION = 2.1.22
+ JAVA_VERSION = 2.1.24
else
- JAVA_VERSION = 2.1.22
+ JAVA_VERSION = 2.1.24
endif
--- a/build/symbian_uids.pri Fri Apr 30 10:40:48 2010 +0300
+++ b/build/symbian_uids.pri Tue May 11 16:07:20 2010 +0300
@@ -29,6 +29,10 @@
}
+contains(TEMPLATE,lib):isEmpty(TARGET.UID3):contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1) {
+ contains(TARGET, javacentrep): TARGET.UID3 = 0x2002DCE1
+}
+
contains(TEMPLATE,lib):isEmpty(TARGET.UID3) {
contains(TARGET, eswt): TARGET.UID3 = 0x2002DC93 # On >= 9.2 only
@@ -109,7 +113,6 @@
contains(TARGET, javaapplicationsettingsview): TARGET.UID3 = 0x2002DCDF
contains(TARGET, javabroadcast): TARGET.UID3 = 0x2002DCE0
contains(TARGET, javastarter): TARGET.UID3 = 0x2002E6A7
-# Free 0x2002DCE1
contains(TARGET, openlcdui): TARGET.UID3 = 0x2002DCE2
contains(TARGET, tckrunner): TARGET.UID3 = 0x2002DCE3
--- a/build/utilities.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/build/utilities.xml Tue May 11 16:07:20 2010 +0300
@@ -316,6 +316,10 @@
debug="${javac.debug.on}"
debuglevel="lines,vars,source"
bootclasspath="${bcp}:${int.bcp}:${platform.api.jar}:${public.api.jar}${eswt.jar}">
+
+ <!-- Uncomment the following line if you want to see Javac warnings. -->
+ <!-- <compilerarg value="-Xlint"/> -->
+
<src path="${jsrc.for.javac}"/>
</javac>
</presetdef>
--- a/inc/build_defines.hrh Fri Apr 30 10:40:48 2010 +0300
+++ b/inc/build_defines.hrh Tue May 11 16:07:20 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-#define RD_JAVA_VERSION 2,1,22
+#define RD_JAVA_VERSION 2,1,24
#define RD_JAVA_SYMBIAN_TARGET
#define RD_JAVA_S60_RELEASE_9_2
#define RD_JAVA_S60_RELEASE_9_2_ONWARDS
@@ -24,7 +24,6 @@
#define RD_JAVA_EPOCALLOWDLLDATA_FIX
#define RD_JAVA_HTTP_EMC_ENABLED
#define RD_JAVA_NGA_ENABLED
-#define RD_JAVA_UI_ALFDRAWER_ENABLED
#define RD_JAVA_PROXIMITY_LISTENER_ENABLED
#define RD_JAVA_OPENC_BETA_PATCH
#define RD_JAVA_INSTALLERUI_ENABLED
--- a/inc/build_defines.pri Fri Apr 30 10:40:48 2010 +0300
+++ b/inc/build_defines.pri Tue May 11 16:07:20 2010 +0300
@@ -13,4 +13,4 @@
#
# Description: Generated file - do not edit manually
#
-PROJECT_DEFINES *= RD_JAVA_SYMBIAN_TARGET RD_JAVA_S60_RELEASE_9_2 RD_JAVA_S60_RELEASE_9_2_ONWARDS RD_JAVA_S60_RELEASE_5_0_ONWARDS RD_JAVA_STDCPPV5 RD_JAVA_EPOCALLOWDLLDATA_FIX RD_JAVA_HTTP_EMC_ENABLED RD_JAVA_NGA_ENABLED RD_JAVA_UI_ALFDRAWER_ENABLED RD_JAVA_PROXIMITY_LISTENER_ENABLED RD_JAVA_OPENC_BETA_PATCH RD_JAVA_INSTALLERUI_ENABLED RD_JAVA_PREWARM RD_JAVA_ADVANCED_TACTILE_FEEDBACK RD_JAVA_MIDPRMS_DB
+PROJECT_DEFINES *= RD_JAVA_SYMBIAN_TARGET RD_JAVA_S60_RELEASE_9_2 RD_JAVA_S60_RELEASE_9_2_ONWARDS RD_JAVA_S60_RELEASE_5_0_ONWARDS RD_JAVA_STDCPPV5 RD_JAVA_EPOCALLOWDLLDATA_FIX RD_JAVA_HTTP_EMC_ENABLED RD_JAVA_NGA_ENABLED RD_JAVA_PROXIMITY_LISTENER_ENABLED RD_JAVA_OPENC_BETA_PATCH RD_JAVA_INSTALLERUI_ENABLED RD_JAVA_PREWARM RD_JAVA_ADVANCED_TACTILE_FEEDBACK RD_JAVA_MIDPRMS_DB
--- a/inc/java.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/inc/java.txt Tue May 11 16:07:20 2010 +0300
@@ -1,1 +1,1 @@
-2.1.22
+2.1.24
--- a/inc/project_defines.hrh Fri Apr 30 10:40:48 2010 +0300
+++ b/inc/project_defines.hrh Tue May 11 16:07:20 2010 +0300
@@ -23,7 +23,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
--- a/java_stubs/javaregistry/clientserver/client/inc/javaregconverter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/java_stubs/javaregistry/clientserver/client/inc/javaregconverter.h Tue May 11 16:07:20 2010 +0300
@@ -209,7 +209,7 @@
* @param aCertChains [out] The method converts the unicode descriptors
* into this RPointerArray<HBufC>.
*/
- IMPORT_C static void JavaRegConverter::GetUnicodeDescriptorsL(
+ IMPORT_C static void GetUnicodeDescriptorsL(
const TDesC& aValue,
RPointerArray<HBufC>& aDescriptors);
/**
@@ -224,7 +224,7 @@
* @param aDes [out] Descriptor parameter, storing, and the returning
* the certificate chains.
*/
- IMPORT_C static void JavaRegConverter::StoreUnicodeDescriptorsL(
+ IMPORT_C static void StoreUnicodeDescriptorsL(
const RPointerArray<HBufC>& aValue,
HBufC*& aDes);
};
--- a/javacommons/comms/build/comms_0x2002DCA6.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/comms/build/comms_0x2002DCA6.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/comms/ipclib/clientserver/build/ipc_0x2002DCB7.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/comms/ipclib/clientserver/build/ipc_0x2002DCB7.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -88,6 +87,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/connectionmanager/build/javaconnectionmanager_0x2002DCA7.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/connectionmanager/build/javaconnectionmanager_0x2002DCA7.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -85,6 +84,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/fileutils/build/fileutils_0x2002DCAD.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/fileutils/build/fileutils_0x2002DCAD.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -103,6 +102,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/fileutils/javasrc/com/nokia/mj/impl/fileutils/FileUtility.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/fileutils/javasrc/com/nokia/mj/impl/fileutils/FileUtility.java Tue May 11 16:07:20 2010 +0300
@@ -1289,6 +1289,35 @@
return _delete(iTarget.getFullPath());
}
+
+ /**
+ * Deletes the file or directory denoted by this pathname. If this pathname
+ * denotes a directory, then the directory must be empty in order to be
+ * deleted. Deletes the file or directory even if it is marked as read-only.
+ * <p>
+ * All open input and output streams are automatically flushed and closed.
+ * Attempts to further use those streams result in an IOException. The
+ * FileUtility instance object remains available for use.
+ *
+ * @return true if and only if the file or directory is successfully
+ * deleted; false otherwise
+ * @throws SecurityException
+ * if access was denied to the file/directory
+ */
+ public boolean forceDelete() throws SecurityException
+ {
+
+ // Close input and output Streams if created.
+ // Found in StreamConnectionBase
+
+ if (iStreamHandler != null)
+ {
+ iStreamHandler.closeInputStreams();
+ iStreamHandler.closeOutputStreams();
+ }
+
+ return _delete(iTarget.getFullPath());
+ }
/**
* Renames the selected file or directory to a new name in the same
--- a/javacommons/gcfbase/build/javagcf_0x2002DCAE.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfbase/build/javagcf_0x2002DCAE.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -90,6 +89,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/file/build/javafile_0x2002DCAC.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/build/javafile_0x2002DCAC.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -82,6 +81,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/file/javasrc.linux/com/nokia/mj/impl/file/FileAccessHelper.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc.linux/com/nokia/mj/impl/file/FileAccessHelper.java Tue May 11 16:07:20 2010 +0300
@@ -25,8 +25,7 @@
*/
public class FileAccessHelper implements FileConstants
{
- public static boolean accessAllowed(String aPath, String aIntent,
- String aDomain, boolean aIsOpening)
+ public static boolean accessAllowed(String aPath, String aDomain)
{
return true;
}
--- a/javacommons/gcfprotocols/file/javasrc.s60/com/nokia/mj/impl/file/FileAccessHelper.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc.s60/com/nokia/mj/impl/file/FileAccessHelper.java Tue May 11 16:07:20 2010 +0300
@@ -20,6 +20,9 @@
import java.util.Hashtable;
import java.util.Vector;
import com.nokia.mj.impl.rt.support.ApplicationInfo;
+import com.nokia.mj.impl.fileutils.DriveInfo;
+import com.nokia.mj.impl.fileutils.DriveUtilities;
+
public class FileAccessHelper implements FileConstants
{
@@ -32,35 +35,14 @@
private static String[] iRestrictedPathList;
private static String[] iForbiddenPathList;
- static
- {
- // Populate forbidden path list.
- Vector forbidden = FileSystemUtils.getForbiddenPaths();
- iForbiddenPathList = new String[forbidden.size()];
- for (int index = 0; index < forbidden.size(); index++)
- {
- iForbiddenPathList[index] = (String) forbidden.elementAt(index);
- }
-
- // Populate restricted path list.
- Vector restricted = FileSystemUtils.getRestrictedPaths();
- iRestrictedPathList = new String[restricted.size() + 1];
- for (int index = 0; index < restricted.size(); index++)
- {
- iRestrictedPathList[index] = (String) restricted.elementAt(index);
- }
- // Add midlet's private directory also to restricted path list.
- iRestrictedPathList[restricted.size()] = FileSystemUtils
- .getAppPrivateDir();
- }
+ // getMidpRoot get the midp private directory such as "/private/102033E6"
+ private static String iMidpRoot = FileSystemUtils.getMidpRoot().toLowerCase();
/**
* Checks to see if the application has access to a specific path.
*
* @param aPath
* path which the application is trying to access.
- * @param aIntent
- * mode in which the application wants to access the target.
* @param aDomain
* domain of the application
* @param aIsOpening
@@ -68,358 +50,33 @@
* connection.
* @return true in case access is allowed. False otherwise
*/
- public static boolean accessAllowed(String aPath, String aIntent,
- String aDomain, boolean aIsOpening)
+ public static boolean accessAllowed(String aPath, String aDomain)
{
FileLogger.Log("FileAccessHelper.accessAllowed: Checking access: \n");
+
+ if(aPath.endsWith("/") == false)
+ aPath += "/";
if (isHomeDir(aPath))
{
return true;
}
- if (isForbidden(aPath))
- {
- return false;
- }
-
- if (isIllegalAccessToRestrictedDir(aPath, aIntent, aIsOpening, aDomain))
- {
- return false;
- }
-
- if (aDomain.equals(ApplicationInfo.MANUFACTURER_DOMAIN))
- {
- return manufacturerDomainChecks(aPath, aIntent, aIsOpening);
- }
- else
- {
- return otherDomainChecks(aPath, aIntent, aIsOpening);
- }
- }
-
- /**
- * To be used in case of list. If list is done on a directory that is equal
- * to, or higher in path hierarchy than one of the restricted paths, then we
- * need to check for access for all files, if not, then no need.
- */
- public static boolean isDirRestricted(String aPath)
- {
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- int matchResult = matchPaths(aPath, iRestrictedPathList[index]);
- if ((matchResult != PATHS_NO_MATCH)
- && (matchResult != PATH_BELOWIN_HIERARCHY))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Checks to see if the path being accessed in forbidden.
- *
- * @param aPath
- * path being accessed
- * @return true in case the path is forbidden, false otherwise
- */
- private static boolean isForbidden(String aPath)
- {
- for (int index = 0; index < iForbiddenPathList.length; index++)
+ // The basic assumption for this check is
+ // always drive name is a single character.
+ if (aPath.substring(2).toLowerCase().startsWith(iMidpRoot))
{
- int matchPathResult = matchPaths(aPath, iForbiddenPathList[index]);
-
- // Forbidden paths should match exactly or should be such that the
- // path must be lower in hierarchy.
- // Example: e:/system is forbidden, e:/ is not.
- // e:/system is forbidden, e:/system/dir is also forbidden
- if ((matchPathResult == PATHS_EQUAL)
- || (matchPathResult == PATH_BELOWIN_HIERARCHY))
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Checks if the access to restricted paths is being made in correct intent
- * based on the domain.
- *
- * @param aPath
- * path of the file/directory being accessed
- * @param aIntent
- * intent with which it is being accessed (read or write)
- * @param aOpening
- * set to true in case it is being used by Connector.open or
- * setFileConnection. Both are considered as open and not as
- * acutal read or write operations.
- * @param aDomain
- * domain of the application.
- * @return true in case there is an access violation, false if the access is
- * allowed.
- */
- public static boolean isIllegalAccessToRestrictedDir(String aPath,
- String aIntent, boolean aOpening, String aDomain)
- {
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- int matchResult = matchPaths(aPath, iRestrictedPathList[index]);
- if ((matchResult != PATHS_NO_MATCH)
- && (matchResult != PATH_BELOWIN_HIERARCHY))
- {
- if (aIntent.equals(INTENT_WRITE)
- || aIntent.equals(INTENT_READ_WRITE))
- {
- if (!aOpening)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Performs manufacturer domain specific checks. Manufacturer domain apps
- * are not allowed to access any path in C:/private apart from its private
- * directory. Other checks are forbidden directories and restricted paths.
- * This is done before (accessAllowed()) So, no need to check once again.
- *
- * @param aPath
- * path which is being accessed
- * @param aIntent
- * intent with which access is being made. read, write
- * @param aIsOpening
- * true in case its an open operation (open, setFileConnection)
- * @return true in case access is allowed. false otherwise.
- */
- public static boolean manufacturerDomainChecks(String aPath,
- String aIntent, boolean aIsOpening)
- {
- // Check if it is private directory.
- if (aPath.indexOf(PATH_PRIVATE) == 3)
- {
- if (matchPaths(aPath, FileSystemUtils.getAppPrivateDir()) == PATHS_NO_MATCH)
+ // Allowed only for Manufacturer domain.
+ if (aDomain.equals(ApplicationInfo.MANUFACTURER_DOMAIN) == false)
{
return false;
}
- }
- return true;
- }
-
- /**
- * Performs domains other than manufacturer domain.
- *
- * @param aPath
- * path which is being accessed
- * @param aIntent
- * intent with which access is being made. read, write
- * @param aIsOpening
- * true in case its an open operation (open, setFileConnection)
- * @return true in case access is allowed. false otherwise.
- */
- private static boolean otherDomainChecks(String aPath, String aIntent,
- boolean aIsOpening)
- {
- if (aPath.length() < 3)
- {
- // Path will be valid. This will be only in case file:///c: is given
- aPath += "/";
- }
-
- String rom = FileSystemUtils.getRomDrive().toLowerCase()
- .substring(0, 2);
- String temp = FileSystemUtils.getTemporaryDrive().toLowerCase()
- .substring(0, 2);
-
- if (aPath.toLowerCase().startsWith(rom)
- || aPath.toLowerCase().startsWith(temp))
- {
- return false;
- }
-
- // Other domains can access only below restricted paths or
- // in other drives.
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- int matchResult = matchPaths(aPath, iRestrictedPathList[index]);
-
- if ((matchResult != PATH_BELOWIN_HIERARCHY)
- && (matchResult != PATHS_NO_MATCH))
- {
- if ((!aIntent.equals(INTENT_READ)) && (!aIsOpening))
- {
- // Anything other than read operation on par or above
- // restricted path hierarchy is not allowed when not opening
- return false;
- }
- }
- }
-
- if (partialMatchWithRestrictedPaths(aPath))
- {
- return false;
+
}
return true;
}
- private static boolean partialMatchWithRestrictedPaths(String aPath)
- {
- String path1 = aPath;
- boolean initialNoMatch = true;
-
- // Partial match is only when path is not a substring initially,
- // but when stripped, becomes a substring of one of the restricted paths
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- int matchResult = matchPaths(aPath, iRestrictedPathList[index]);
- if (matchResult == PATH_BELOWIN_HIERARCHY
- || matchResult == PATH_ABOVEIN_HIERARCHY
- || matchResult == PATHS_EQUAL)
- {
- return false;
- }
- }
-
- if (path1.length() > 3)
- {
- path1 = path1.substring(0, path1.lastIndexOf('/'));
- }
-
- // path1 is stripped to know in case the file is being created inside
- // root.
- while (path1.length() > 3)
- {
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- if (iRestrictedPathList[index].toLowerCase().startsWith(
- path1.toLowerCase()))
- {
- return true;
- }
- }
- path1 = path1.substring(0, path1.lastIndexOf('/'));
- }
-
- // C:/data/somefile should be matched with c:/data/images,c:/data/videos
- // and must return true but c:/data or c:/ must not return as true
- return false;
- }
-
- /**
- * Resolves a path to a one of the following categories:
- *
- * <pre>
- * PUBLIC_DIRS - C:/Data/Images
- * C:/Data/Videos
- * C:/Data/Graphics
- * C:/Data/Sounds
- * C:/Data/Music
- * C:/Data/Recordings and all files therein
- * HOME_DIR - App's private directory
- * PRIVATE_USER_FILES - All files and directories higher in path hierarchy
- * of PUBLIC_DIRS
- * SYSTEM_FILES - Z drive
- * </pre>
- *
- * @param aPath
- * path that has to be mapped to a particular category.
- * @return category of the path specified.<br/> One of the following:
- * SYSTEM_FILES, PRIVATE_USER_FILES, PUBLIC_DIRS, HOME_DIR
- */
- public static String getCategory(String aPath)
- {
- FileLogger.Log("+ FileAccessHelper: getCategory: " + aPath);
- // SYSTEM_FILES, PRIVATE_USER_FILES, PUBLIC_DIRS, HOME_DIR
- if (aPath.equals(SYSTEM_FILES) || aPath.equals(PRIVATE_USER_FILES)
- || aPath.equals(PUBLIC_DIRS) || aPath.equals(HOME_DIR)
- || aPath.equals(RESTRICTED_PUBLIC_FILES))
- {
- // if it is already mapped
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + aPath);
- return aPath;
- }
-
- if (aPath.equals(""))
- {
- // Used in case of FileSystemRegistry
- return PUBLIC_DIRS;
- }
-
- // First check for Home directory. Restricted paths list contains
- // app's private directory too.
- if (isHomeDir(aPath))
- {
- return HOME_DIR;
- }
-
- int matchResult = PATHS_NO_MATCH;
- // Paths below restricted paths in hierarchy are part of Public files
- // Paths above in hierarchy are part of private used files.
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- matchResult = matchPaths(aPath, iRestrictedPathList[index]);
- if (PATH_BELOWIN_HIERARCHY == matchResult)
- {
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + PUBLIC_DIRS);
- return PUBLIC_DIRS;
- }
-
- if (PATHS_EQUAL == matchResult)
- {
- return PUBLIC_DIRS;
- }
-
- // Do we need this at all? Restricted PUBLIC Files can be removed
- if (PATH_ABOVEIN_HIERARCHY == matchResult)
- {
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + PUBLIC_DIRS);
- return PUBLIC_DIRS;
- }
- }
-
- String rom = FileSystemUtils.getRomDrive().toLowerCase()
- .substring(0, 2);
- String temp = FileSystemUtils.getTemporaryDrive().toLowerCase()
- .substring(0, 2);
-
- if (aPath.toLowerCase().startsWith(rom)
- || aPath.toLowerCase().startsWith(temp))
- {
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + SYSTEM_FILES);
- return SYSTEM_FILES;
-
- }
- else if (aPath.toLowerCase().startsWith(
- FileSystemUtils.getDefaultRoot().toLowerCase()))
- {
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + RESTRICTED_PUBLIC_FILES);
- // It is however known that the default root of the device can
- // change.
- return RESTRICTED_PUBLIC_FILES;
- }
- else if ((aPath.toLowerCase().indexOf(PATH_PRIVATE) == 3)
- || (aPath.toLowerCase().indexOf(PATH_SYSTEM) == 3))
- {
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + SYSTEM_FILES);
- return SYSTEM_FILES;
- }
-
- FileLogger.Log("- FileAccessHelper: getCategory: returning: "
- + PUBLIC_DIRS);
- return PUBLIC_DIRS;
- }
-
/**
* Checks to see if the specified path is same as application's private
* directory.
@@ -427,90 +84,12 @@
private static boolean isHomeDir(String aPath)
{
String appPrivateDir = FileSystemUtils.getAppPrivateDir();
- if (aPath.equalsIgnoreCase(appPrivateDir))
- {
- return true;
- }
- if (aPath.startsWith(appPrivateDir))
+
+ if (aPath.toLowerCase().startsWith(appPrivateDir.toLowerCase()))
{
return true;
}
return false;
}
-
- /**
- * Checks to see if a file/directory can be created within the specidied
- * path.
- *
- * @param aPath
- * directory within which the application intends to create a
- * file.
- * @param aDomain
- * domain of the application
- * @return true in case access is allowed, false otherwise.
- */
- public static boolean isCreateAllowedWithinDir(String aPath, String aDomain)
- {
- if (aDomain.equals(ApplicationInfo.MANUFACTURER_DOMAIN))
- {
- return true;
- }
-
- boolean allowed = false;
-
- if (!aPath.startsWith(FileSystemUtils.getDefaultRoot()))
- {
- return true;
- }
-
- for (int index = 0; index < iRestrictedPathList.length; index++)
- {
- String path = iRestrictedPathList[index];
- int matchResult = matchPaths(aPath, path);
- // Domains other than manufacturer are allowed to create content
- // only within restricted directories.
- if ((PATHS_EQUAL == matchResult)
- || (PATH_BELOWIN_HIERARCHY == matchResult))
- {
- allowed = true;
- break;
- }
- }
- return allowed;
- }
-
- /**
- * Tries to match paths. Returns how "path2" is related to "path1". Checks if
- * the path is above or below in path hierarchy. Also checks to see if paths
- * are same or are totally different.
- */
- private static int matchPaths(String aPath1, String aPath2)
- {
- // Strip trailing slash in case its present.
- String path1 = aPath1.endsWith("/") ? aPath1.substring(0, aPath1
- .length() - 1) : aPath1;
-
- String path2 = aPath2.endsWith("/") ? aPath2.substring(0, aPath2
- .length() - 1) : aPath2;
-
- // In case both paths are the same.
- if (path1.equalsIgnoreCase(path2))
- {
- return PATHS_EQUAL;
- }
-
- // Check if path1 is higher in path hierarchy
- if (path2.toLowerCase().startsWith(path1.toLowerCase()))
- {
- return PATH_ABOVEIN_HIERARCHY;
- }
-
- if (path1.toLowerCase().startsWith(path2.toLowerCase()))
- {
- return PATH_BELOWIN_HIERARCHY;
- }
-
- return PATHS_NO_MATCH;
- }
}
--- a/javacommons/gcfprotocols/file/javasrc.s60/com/nokia/mj/impl/file/FileSystemUtils.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc.s60/com/nokia/mj/impl/file/FileSystemUtils.java Tue May 11 16:07:20 2010 +0300
@@ -87,11 +87,7 @@
for (int index = 0; index < drives.length; index++)
{
String toAdd = drives[index].iRootPath.replace('\\', '/');
- if (FileAccessHelper.accessAllowed(toAdd,
- FileConstants.INTENT_READ, getProtectionDomain(), false))
- {
- roots.addElement(toAdd);
- }
+ roots.addElement(toAdd);
}
return roots;
}
@@ -222,11 +218,7 @@
for (int index = 0; index < drives.length; index++)
{
String toAdd = drives[index].iRootPath.replace('\\', '/');
- if (FileAccessHelper.accessAllowed(toAdd,
- FileConstants.INTENT_READ, getProtectionDomain(), false))
- {
- roots.addElement(drives[index]);
- }
+ roots.addElement(drives[index]);
}
Vector rootNames = new Vector();
@@ -327,36 +319,6 @@
return FileConnectionTexts.get(propKey);
}
- public static Vector getForbiddenPaths()
- {
- String pathString = _getForbiddenPaths();
- String[] pathArray = Tokenizer.split(pathString, "*");
- Vector paths = new Vector();
-
- for (int index = 0; index < pathArray.length - 1; index++)
- {
- String toAdd = pathArray[index];
- toAdd = toAdd.replace('\\', '/');
- paths.addElement(toAdd);
- }
- return paths;
- }
-
- public static Vector getRestrictedPaths()
- {
- String pathString = _getRestrictedPaths();
- String[] pathArray = Tokenizer.split(pathString, "*");
- Vector paths = new Vector();
-
- for (int index = 0; index < pathArray.length - 1; index++)
- {
- String toAdd = pathArray[index];
- toAdd = toAdd.replace('\\', '/');
- paths.addElement(toAdd);
- }
- return paths;
- }
-
public static String getAppPrivateDir()
{
String appPrivateDir = iAppInfo.getRootPath();
@@ -365,6 +327,14 @@
return appPrivateDir;
}
+ public static String getMidpRoot()
+ {
+ String midpRoot = _getMidpRoot();
+
+ midpRoot = midpRoot.replace('\\', '/');
+ return midpRoot;
+ }
+
private static native String _getMemoryCardDrivePath();
private static native String _getTemporaryDrivePath();
@@ -375,7 +345,5 @@
private static native String _getPathOfProperty(int value, boolean addRoot);
- private static native String _getForbiddenPaths();
-
- private static native String _getRestrictedPaths();
+ private static native String _getMidpRoot();
}
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java Tue May 11 16:07:20 2010 +0300
@@ -96,7 +96,7 @@
}
// Check access.
- checkAccess(actual, aMode, true);
+ checkAccess(actual);
// Go ahead to prompt the user
checkSecurityPermission(actual, aMode);
@@ -175,22 +175,6 @@
}
}
- /**
- * Checks access to a specified path given its absolute path and the mode in
- * which the connection has been opened.
- *
- * @param aAbsolutePath
- * path of the connection
- * @param aMode
- * mode in which the connection has been opened.
- * @throws SecurityException
- * in case access was allowed for the application for the given
- * intent and target.
- */
- private static void checkAccess(String aAbsolutePath, int aMode)
- {
- checkAccess(aAbsolutePath, aMode, false);
- }
/**
* Checks access to a specified path given its absolute path and the mode in
@@ -198,37 +182,15 @@
*
* @param aAbsolutePath
* path of the connection
- * @param aMode
- * mode in which the connection has been opened.
- * @param aIsOpening
- * specifies if the access check is being made on a method that
- * is considered as open operation (setFileConnection and
- * Connector.open)
* @throws SecurityException
* in case access was allowed for the application for the given
* intent and target.
*/
- private static void checkAccess(String aAbsolutePath, int aMode,
- boolean aIsOpening)
+ private static void checkAccess(String aAbsolutePath)
{
- FileLogger.Log("FileConnectionImpl: Check Access to " + aAbsolutePath
- + " in " + aMode + " mode");
-
- String modeString;
- switch (aMode)
- {
- case Connector.READ:
- modeString = FileAccessHelper.INTENT_READ;
- break;
- case Connector.WRITE:
- modeString = FileAccessHelper.INTENT_WRITE;
- break;
- default:
- modeString = FileAccessHelper.INTENT_READ_WRITE;
- }
-
- if (!(FileAccessHelper.accessAllowed(aAbsolutePath, modeString,
- FileSystemUtils.getProtectionDomain(), aIsOpening)))
+ FileLogger.Log("FileConnectionImpl: Check Access to " + aAbsolutePath );
+
+ if (!FileAccessHelper.accessAllowed(aAbsolutePath,FileSystemUtils.getProtectionDomain()))
{
// Access to the specified path not allowed.
// Throw Security Exception
@@ -257,15 +219,6 @@
String domain = FileSystemUtils.getProtectionDomain();
- // We need to check if we have access to base directory and not the file
- // itself :-)
- if (!FileAccessHelper.isCreateAllowedWithinDir(iFileUtility.getPath(),
- domain))
- {
- throw new SecurityException("Permission denied: "
- + iFileUtility.getAbsolutePath());
- }
-
if (!iFileUtility.createNewFile())
{
FileLogger.WLog("FileConnectionImpl: File Creation failed. "
@@ -284,7 +237,7 @@
checkConnection();
checkConnectionMode(Connector.READ);
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
if (!iFileUtility.rename(aName))
{
@@ -313,7 +266,7 @@
{
checkConnection();
checkConnectionMode(Connector.READ);
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
FileLogger.Log("FileConnectionImpl: mkdir(): "
+ iFileUtility.getAbsolutePath());
@@ -333,7 +286,7 @@
{
checkConnection();
checkConnectionMode(Connector.READ);
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
FileLogger.Log("FileConnectionImpl: delete(): "
+ iFileUtility.getAbsolutePath());
@@ -489,7 +442,7 @@
public void setReadable(boolean aReadable) throws IOException
{
checkConnection();
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
checkConnectionMode(Connector.READ);
iFileUtility.setReadable(aReadable);
}
@@ -500,7 +453,7 @@
public void setWritable(boolean aWritable) throws IOException
{
checkConnection();
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
checkConnectionMode(Connector.READ);
iFileUtility.setWritable(aWritable);
}
@@ -511,7 +464,7 @@
public void setHidden(boolean aHidden) throws IOException
{
checkConnection();
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
checkConnectionMode(Connector.READ);
iFileUtility.setHidden(aHidden);
}
@@ -552,7 +505,6 @@
String domain = FileSystemUtils.getProtectionDomain();
// Check if read access is allowed to all contents in the list.
- boolean accessCheckNeeded = FileAccessHelper.isDirRestricted(parent);
boolean accessAllowed = true;
for (int index = 0; index < fileList.length; index++)
@@ -562,12 +514,8 @@
if (FileUtility.matchString(filter.toLowerCase(), fileList[index]))
{
// If it passes the filter, check if midlet has access.
- // if check access is true, then accessAllowed is not checked.
- if (accessCheckNeeded)
- {
- accessAllowed = FileAccessHelper.accessAllowed(fullPath,
- FileConstants.INTENT_READ, domain, true);
- }
+ accessAllowed = FileAccessHelper.accessAllowed(fullPath,
+ domain);
if (accessAllowed)
{
@@ -585,7 +533,7 @@
{
checkConnection();
checkConnectionMode(Connector.READ);
- checkAccess(iFileUtility.getAbsolutePath(), Connector.WRITE);
+ checkAccess(iFileUtility.getAbsolutePath());
iFileUtility.truncate(aByteOffset);
}
@@ -654,7 +602,7 @@
// See if access is allowed. True because setting to new target is
// as good as opening.
- checkAccess(tempTarget.getAbsolutePath(), iMode, true);
+ checkAccess(tempTarget.getAbsolutePath());
checkSecurityPermission(tempTarget.getAbsolutePath(), iMode);
// if we reach here, it is fine :-)
@@ -701,7 +649,7 @@
// See if access is allowed. True because setting to new target is
// as good as opening.
- checkAccess(tempTarget.getAbsolutePath(), iMode, true);
+ checkAccess(tempTarget.getAbsolutePath());
checkSecurityPermission(tempTarget.getAbsolutePath(), iMode);
// If no exception is thrown, its safe to set connection
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileInternalPermission.java Tue May 11 16:07:20 2010 +0300
@@ -86,24 +86,7 @@
if (PermissionBase.matchActions(per.getActions(), intent))
{
- if (getTarget().equals("*"))
- {
- // IN case all are allowed.
- return true;
- }
-
- if (this.targetName.equalsIgnoreCase(per.getTarget()))
- {
- return true;
- }
- else
- {
- return getCategory().equals(per.getCategory());
- }
- }
- else
- {
- return false;
+ return true;
}
}
@@ -165,11 +148,6 @@
return null;
}
- public String getCategory()
- {
- return FileAccessHelper.getCategory(targetName);
- }
-
public String getTarget()
{
return targetName;
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileSystemRegistryImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileSystemRegistryImpl.java Tue May 11 16:07:20 2010 +0300
@@ -72,12 +72,7 @@
for (int index = 0; index < rootVector.size(); index++)
{
- if (FileAccessHelper.accessAllowed(
- (String) rootVector.elementAt(index),
- FileConstants.INTENT_READ, domain, false))
- {
retValue.addElement(rootVector.elementAt(index));
- }
}
FileLogger.Log("<-- FileSystemRegistry.listRoots()");
--- a/javacommons/gcfprotocols/file/src.s60/filesystemutilsjni.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/file/src.s60/filesystemutilsjni.cpp Tue May 11 16:07:20 2010 +0300
@@ -23,6 +23,7 @@
#include "javasymbianoslayer.h"
#include "s60commonutils.h"
#include "logger.h"
+#include "javaoslayer.h"
#include "systempropertyprovider.h"
#include "com_nokia_mj_impl_file_FileSystemUtils.h"
@@ -108,48 +109,14 @@
/*
* Class: com_nokia_mj_impl_file_FileSystemUtils
- * Method: _getForbiddenPaths
+ * Method: _getMidpRoot
* Signature: ()Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_file_FileSystemUtils__1getForbiddenPaths
-(JNIEnv *aJni, jclass)
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_file_FileSystemUtils__1getMidpRoot
+(JNIEnv *aEnv, jclass)
{
- JELOG2(EJavaFile);
- jstring str = 0;
- HBufC* names = 0;
-
- SystemPropertyProvider::GetForbiddenPaths(names);
- TPtrC namePtr(names->Des());
- if (0 != names)
- {
- str = S60CommonUtils::NativeToJavaString(*aJni, namePtr);
- delete names;
- }
- return str;
-}
+ std::string path;
+ java::util::JavaOsLayer::getMidpRoot(path);
-/*
- * Class: com_nokia_mj_impl_file_FileSystemUtils
- * Method: _getRestrictedPaths
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_file_FileSystemUtils__1getRestrictedPaths
-(JNIEnv *aJni, jclass)
-{
- JELOG2(EJavaFile);
- jstring str = 0;
- HBufC* names = 0;
-
- TRAPD(err, SystemPropertyProvider::GetRestrictedPathsL(names));
-
- if (KErrNone == err)
- {
- TPtrC namePtr(names->Des());
- if (0 != names)
- {
- str = S60CommonUtils::NativeToJavaString(*aJni, namePtr);
- delete names;
- }
- }
- return str;
+ return aEnv->NewStringUTF((const char*)(path.c_str()));
}
--- a/javacommons/gcfprotocols/http/build/javahttp_0x2002DCB1.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/http/build/javahttp_0x2002DCB1.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -98,6 +97,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/http/javasrc.s60/com/nokia/mj/impl/http/HttpConnectionNative.java Tue May 11 16:07:20 2010 +0300
@@ -873,6 +873,7 @@
case CONNECTED:
case REQUEST_HEADERS_SENT:
ensureResponse();
+ break;
default:
// No-op
--- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Tue May 11 16:07:20 2010 +0300
@@ -18,7 +18,13 @@
#include <e32def.h>
#include <centralrepository.h>
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <CUserAgent.h>
+#else
#include <cuseragent.h>
+#endif
+
#include "com_nokia_mj_impl_http_HttpConnectionNative.h"
#include "nativehttptransaction.h"
#include "nativehttpsession.h"
--- a/javacommons/gcfprotocols/https/build/javahttps_0x2002DCB2.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/https/build/javahttps_0x2002DCB2.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -91,6 +90,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/secureconnection/build/javassl_0x2002DCD7.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/secureconnection/build/javassl_0x2002DCD7.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -94,6 +93,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/secureconnection/inc.s60/nativecertificatemanager.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/secureconnection/inc.s60/nativecertificatemanager.h Tue May 11 16:07:20 2010 +0300
@@ -45,7 +45,6 @@
class CX500DistinguishedName;
class CX520AttributeTypeAndValue;
class CPKCS10Request;
-class MPKIDialog;
class CCMSIssuerAndSerialNumber;
using namespace java::util;
--- a/javacommons/gcfprotocols/socket/serverconnection/build/javasocketscplugin_0x2002DCD5.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/socket/serverconnection/build/javasocketscplugin_0x2002DCD5.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/socket/socket/build/javasocket_0x2002DCD4.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/build/javasocket_0x2002DCD4.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -94,6 +93,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/gcfprotocols/socket/socket/src.linux/socketlocalhostinfo.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src.linux/socketlocalhostinfo.cpp Tue May 11 16:07:20 2010 +0300
@@ -20,6 +20,7 @@
#include <netdb.h>
#include <unistd.h>
#include <arpa/inet.h>
+#include <cstring>
#include "socketlocalhostinfo.h"
#include "logger.h"
--- a/javacommons/javaenv/build/javaenv_0x2001B2A5.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/javaenv/build/javaenv_0x2001B2A5.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -81,6 +80,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/javastorage/build/javastorage_0x2002DCD8.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/javastorage/build/javastorage_0x2002DCD8.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -97,6 +96,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/jvms/j9/bld.inf Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Generated bld.inf -file
-*
-*/
-
-PRJ_PLATFORMS
-default
-
-#include "exports.inf"
--- a/javacommons/jvms/j9/exports.inf Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-PRJ_PLATFORMS
-default
-
-#ifndef RD_JAVA_SF_BUILD
-#include "s60/exports.inf"
-#endif
--- a/javacommons/jvms/j9/j9.pro Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-TEMPLATE = subdirs
-
-# Export J9 only when available here (not available here in SF builds)
-# (use indirection through ./exports.inf for pregenerated bld.inf variation)
-exists($${_PRO_FILE_PWD_}/s60/exports.inf): {
- BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"exports.inf\"" \
-}
--- a/javacommons/jvms/j9utils/threaddump/build/javathreaddumper_0x2002DCD9.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/jvms/j9utils/threaddump/build/javathreaddumper_0x2002DCD9.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -82,6 +81,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/jvms/nativeportlayer/build/jvmnativeport_0x2002DCDE.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/jvms/nativeportlayer/build/jvmnativeport_0x2002DCDE.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/security/build/javasecurity_0x2002DCCF.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/build/javasecurity_0x2002DCCF.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -113,6 +112,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/security/data/att_manufacturer.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/att_manufacturer.txt Tue May 11 16:07:20 2010 +0300
@@ -33,4 +33,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/data/att_operator.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/att_operator.txt Tue May 11 16:07:20 2010 +0300
@@ -1,19 +1,18 @@
domain Operator;
-grant user "Net Access" session,blanket,oneshot,no {
+grant user "Net Access" blanket,session,oneshot,no {
permission javax.microedition.io.HttpProtocolPermission "http://*";
permission javax.microedition.io.HttpsProtocolPermission "https://*";
+}
+grant user "Low Level Net Access" blanket,session,oneshot,no {
permission javax.microedition.io.DatagramProtocolPermission "datagram://*";
permission javax.microedition.io.DatagramProtocolPermission "datagram://";
permission javax.microedition.io.SSLProtocolPermission "ssl://*";
-}
-
-grant user "Low Level Net Access" session,blanket,oneshot,no {
permission javax.microedition.io.SocketProtocolPermission "socket://*";
permission javax.microedition.io.SocketProtocolPermission "socket://";
permission javax.microedition.io.Connector.rtsp "*";
}
-grant user "Local Connectivity" session,blanket,oneshot,no {
+grant user "Local Connectivity" blanket,session,oneshot,no {
permission javax.microedition.io.CommProtocolPermission "comm:*";
permission javax.microedition.io.Connector.obex.server "*" "server";
permission javax.microedition.io.Connector.obex.client "*" "client";
@@ -21,43 +20,34 @@
permission javax.microedition.io.Connector.bluetooth.client "*" "client";
}
-grant user "Read User Data Access" session,blanket,oneshot,no {
+grant user "Read User Data Access" blanket,session,oneshot,no {
permission javax.microedition.io.FileProtocolPermission "*" "read";
permission javax.microedition.pim.ContactList "pim://*" "read_contacts";
permission javax.microedition.pim.EventList "pim://*" "read_events";
permission javax.microedition.pim.ToDoList "pim://*" "read_todos";
}
-grant user "Write User Data Access" session,blanket,oneshot,no {
+grant user "Write User Data Access" blanket,session,oneshot,no {
permission javax.microedition.io.FileProtocolPermission "*" "write";
permission javax.microedition.pim.ContactList "pim://*" "write_contacts";
permission javax.microedition.pim.EventList "pim://*" "write_events";
permission javax.microedition.pim.ToDoList "pim://*" "write_todos";
}
-grant user "Messaging" session,blanket,oneshot,no {
+grant user "Messaging" blanket,session,oneshot,no {
permission javax.microedition.io.Connector.sms "sms://*" "send";
permission javax.microedition.io.Connector.mms "mms://*" "send";
}
-grant user "Multimedia Recording" session,blanket,oneshot,no {
+grant user "Multimedia Recording" blanket,session,oneshot,no {
permission javax.microedition.media.control.RecordControl "*" "record";
permission javax.microedition.media.control.VideoControl.getSnapshot "*" "snapshot";
}
-grant user "Application Auto Invocation" session,blanket,oneshot,no {
+grant user "Application Auto Invocation" blanket,session,oneshot,no {
permission javax.microedition.io.PushRegistryPermission "*" "staticregistration,dynamicregistration,autoinvocation";
}
-grant user "Location" session,blanket,oneshot,no {
- permission javax.microedition.location.LocationPermission "location://*" "position,orientation";
- permission javax.microedition.location.LocationPermission "landmarks://*" "read,write,category,management";
-}
-
-grant user "Restricted API Extensions" session,blanket,oneshot,no {
- permission javax.microedition.PropertyPermission "mobinfo.imsi" "read";
-}
-
grant allowed {
permission javax.microedition.io.Connector.sms "sms://*" "open,receive";
permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
--- a/javacommons/security/data/att_operatorextra.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/att_operatorextra.txt Tue May 11 16:07:20 2010 +0300
@@ -33,4 +33,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
\ No newline at end of file
--- a/javacommons/security/data/att_trustedthirdparty.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/att_trustedthirdparty.txt Tue May 11 16:07:20 2010 +0300
@@ -2,9 +2,6 @@
grant user "Net Access" session,oneshot,no {
permission javax.microedition.io.HttpProtocolPermission "http://*";
permission javax.microedition.io.HttpsProtocolPermission "https://*";
- permission javax.microedition.io.DatagramProtocolPermission "datagram://*";
- permission javax.microedition.io.DatagramProtocolPermission "datagram://";
- permission javax.microedition.io.SSLProtocolPermission "ssl://*";
}
grant user "Local Connectivity" session,oneshot,no {
--- a/javacommons/security/data/att_untrusted.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/att_untrusted.txt Tue May 11 16:07:20 2010 +0300
@@ -2,7 +2,4 @@
grant user "Net Access" oneshot,no {
permission javax.microedition.io.HttpProtocolPermission "http://*";
permission javax.microedition.io.HttpsProtocolPermission "https://*";
- permission javax.microedition.io.DatagramProtocolPermission "datagram://*";
- permission javax.microedition.io.DatagramProtocolPermission "datagram://";
- permission javax.microedition.io.SSLProtocolPermission "ssl://*";
}
--- a/javacommons/security/data/msa_manufacturer.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/msa_manufacturer.txt Tue May 11 16:07:20 2010 +0300
@@ -34,4 +34,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/data/msa_operator.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/msa_operator.txt Tue May 11 16:07:20 2010 +0300
@@ -34,4 +34,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/data/msa_trustedthirdparty.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/msa_trustedthirdparty.txt Tue May 11 16:07:20 2010 +0300
@@ -67,3 +67,6 @@
permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
}
+grant assigned {
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+}
--- a/javacommons/security/data/msa_untrusted.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/msa_untrusted.txt Tue May 11 16:07:20 2010 +0300
@@ -60,3 +60,6 @@
permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
}
+grant assigned {
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+}
--- a/javacommons/security/data/s60_manufacturer.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/s60_manufacturer.txt Tue May 11 16:07:20 2010 +0300
@@ -34,4 +34,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/data/s60_operator.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/s60_operator.txt Tue May 11 16:07:20 2010 +0300
@@ -34,4 +34,5 @@
grant assigned {
permission javax.microedition.PropertyPermission "mobinfo.msisdn" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/data/s60_trustedthirdparty.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/s60_trustedthirdparty.txt Tue May 11 16:07:20 2010 +0300
@@ -68,3 +68,6 @@
permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
}
+grant assigned {
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+}
--- a/javacommons/security/data/s60_untrusted.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/data/s60_untrusted.txt Tue May 11 16:07:20 2010 +0300
@@ -37,7 +37,7 @@
permission javax.microedition.io.Connector.mms "mms://*" "send";
}
-grant user "Multimedia Recording" oneshot,session,no {
+grant user "Multimedia Recording" oneshot,session,blanket,no {
permission javax.microedition.media.control.RecordControl "*" "record";
permission javax.microedition.media.control.VideoControl.getSnapshot "*" "snapshot";
}
@@ -60,3 +60,6 @@
permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
}
+grant assigned {
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
+}
--- a/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javasrc.cdc/com/nokia/mj/impl/security/midp/authorization/PermissionGranter.java Tue May 11 16:07:20 2010 +0300
@@ -345,7 +345,8 @@
boolean permissions_from_mutually_exclusive_list_2 = false;
boolean permissions_from_sensitive_combination_list_1 = false;
boolean permissions_from_sensitive_combination_list_2 = false;
- String blanketPermissionsDetails = "settings_inst_query_perm_sec";
+ boolean local_connectivity = false;
+ boolean net_access = false;
Vector blanketPermissions =
new Vector();
for (int i=0; i<grantedPermissions.size(); i++)
@@ -390,20 +391,28 @@
{
permissions_from_mutually_exclusive_list_2 = true;
permissions_from_sensitive_combination_list_1 = true;
- blanketPermissionsDetails = "settings_inst_query_perm_net";
+ net_access = true;
}
else if (settings.getName().equalsIgnoreCase(
- UserSecuritySettings.LOW_LEVEL_NET_ACCESS_SETTINGS)
- || settings.getName().equalsIgnoreCase(
+ UserSecuritySettings.LOW_LEVEL_NET_ACCESS_SETTINGS))
+ {
+ permissions_from_sensitive_combination_list_1 = true;
+ net_access = true;
+ }
+ else if (settings.getName().equalsIgnoreCase(
UserSecuritySettings.MESSAGING_SETTINGS)
|| settings.getName().equalsIgnoreCase(
UserSecuritySettings.RESTRICTED_MESSAGING_SETTINGS)
|| settings.getName().equalsIgnoreCase(
- UserSecuritySettings.CALL_CONTROL_SETTINGS)
- || settings.getName().equalsIgnoreCase(
+ UserSecuritySettings.CALL_CONTROL_SETTINGS))
+ {
+ permissions_from_sensitive_combination_list_1 = true;
+ }
+ else if (settings.getName().equalsIgnoreCase(
UserSecuritySettings.LOCAL_CONNECTIVITY_SETTINGS))
{
permissions_from_sensitive_combination_list_1 = true;
+ local_connectivity = true;
}
else if (settings.getName().equalsIgnoreCase(
UserSecuritySettings.MULTIMEDIA_RECORDING_SETTINGS)
@@ -433,6 +442,9 @@
if (permissions_from_sensitive_combination_list_1
&& permissions_from_sensitive_combination_list_2)
{
+ String blanketPermissionsDetails = ((local_connectivity && !net_access) ?
+ "settings_inst_query_perm_sec" :
+ "settings_inst_query_perm_net");
iBlanketPermissionsDetails.put(msUidKey,
UserSecuritySettingsImpl.getLocalizedString(
blanketPermissionsDetails));
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SigningInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/SigningInfo.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
* - protection domain
* - signing certificate (e.k.a end-entity certificate)
* - root certificate
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class SigningInfo
{
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/packageprotection/PackageNames.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/packageprotection/PackageNames.java Tue May 11 16:07:20 2010 +0300
@@ -41,12 +41,6 @@
"com.nokia.mid.ui.impl.",
"com.nokia.satsa.",
"com.sun.ukit.jaxp.",
- "com.symbian.epoc.",
- "com.symbian.gcf.",
- "com.symbian.j2me.",
- "com.symbian.lcdjava.",
- "com.symbian.midp.",
- "com.symbian.util.",
"java.util.PropertyPermission",
"java.lang.RuntimePermission",
"javax.microedition.io.CommProtocolPermission",
--- a/javacommons/security/javaunicertstoreplugin/data/javausermessages.rss Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/data/javausermessages.rss Tue May 11 16:07:20 2010 +0300
@@ -29,3 +29,4 @@
// ------------------------------------------------------
RESOURCE TBUF r_java_secur_cert_disabling { buf=qtn_java_secur_cert_disabling; }
+RESOURCE TBUF r_java_secur_cert_deleting { buf=qtn_java_secur_cert_deleting; }
--- a/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp Tue May 11 16:07:20 2010 +0300
@@ -18,9 +18,7 @@
#include <e32std.h>
#include <memory>
-#ifndef RD_JAVA_S60_RELEASE_5_0_IAD
#include <javausermessages.rsg>
-#endif
#include <avkon.rsg>
#include <AknGlobalConfirmationQuery.h>
@@ -49,9 +47,7 @@
//_LIT(KMIDP2TrustRoot, "J2ME MIDP2 Trust Root");
_LIT(KMIDP2TrustRoot, "Java Trust Root");
-#ifndef RD_JAVA_S60_RELEASE_5_0_IAD
_LIT(KJavaUserMessagesResourceFileName, "javausermessages.rsc");
-#endif
//_LIT( KRuntimeSecPolicyResourceFileName, "z:midp2runtimesecuritypolicy.rsc" );
//const TUid KCertManUIViewTrustJavaInstallingId = { 0x101F9B28 };
@@ -177,6 +173,10 @@
SendDisableMsg(status);
return;
+ case EPreDeleting:
+ SendDeleteMsg(status);
+ return;
+
default:
//Do nothing.
break;
@@ -230,7 +230,6 @@
*/
void CJavaCertStoreImpl::Remove(const CCTCertInfo& aCertInfo,TRequestStatus& aStatus)
{
-
aStatus = KRequestPending;
TRequestStatus* pRequestStatus = &aStatus;
@@ -252,24 +251,10 @@
User::RequestComplete(pRequestStatus,KErrArgument);
return;
}
-
- CommsMessage commsMsg;
- commsMsg.setReceiver(IPC_ADDRESS_JAVA_CAPTAIN_C);
- commsMsg.setSender(IPC_ADDRESS_JAVA_CAPTAIN_C);
- commsMsg.setModuleId(PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C);
- commsMsg.setMessageId(JAVA_CERT_STORE_MSG_ID_REQUEST);
- commsMsg << JAVA_CERT_STORE_OPERATION_DELETE_CERT;
- commsMsg << certData->mId;
- int err = mComms.send(commsMsg);
- if (0 != err)
- {
- std::string errTxt("Sending a comms request failed: ");
- errTxt.append(java::util::JavaCommonUtils::intToString(err));
- ELOG1(EJavaSecurity, "ERROR!!! %s",errTxt.c_str());
- User::RequestComplete(pRequestStatus,KErrCommsBreak);
- }
- certData->mDeleted = ETrue;
- User::RequestComplete(pRequestStatus,KErrNone);
+
+ mState = EPreDeleting;
+ mTempCertData = certData;
+ HandleDeleteDisableQuery(aStatus, false /* disableCertQuery */);
}
/**
@@ -330,7 +315,7 @@
#else
mState = state;
mTempCertData = certData;
- HandleDisableQuery(aStatus);
+ HandleDeleteDisableQuery(aStatus, true /* disableCertQuery */);
#endif
return;
}
@@ -832,6 +817,32 @@
/**
*
*/
+TBool CJavaCertStoreImpl::SendDeleteCommsMsg(const std::string& aId,
+ TRequestStatus* aRequestStatus)
+{
+ CommsMessage commsMsg;
+ commsMsg.setReceiver(IPC_ADDRESS_JAVA_CAPTAIN_C);
+ commsMsg.setSender(IPC_ADDRESS_JAVA_CAPTAIN_C);
+ commsMsg.setModuleId(PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C);
+ commsMsg.setMessageId(JAVA_CERT_STORE_MSG_ID_REQUEST);
+ commsMsg << JAVA_CERT_STORE_OPERATION_DELETE_CERT;
+ commsMsg << aId;
+ int err = mComms.send(commsMsg);
+ if (0 != err)
+ {
+ std::string errTxt("Sending a comms request failed: ");
+ errTxt.append(java::util::JavaCommonUtils::intToString(err));
+ ELOG1(EJavaSecurity, "ERROR!!! %s",errTxt.c_str());
+ User::RequestComplete(aRequestStatus,KErrCommsBreak);
+ return EFalse;
+ }
+
+ return ETrue;
+}
+
+/**
+ *
+ */
TBool CJavaCertStoreImpl::CheckCapability(const TCapability& aCapability,TRequestStatus* aRequestStatus)
{
RThread thread;
@@ -847,10 +858,19 @@
/**
*
*/
-void CJavaCertStoreImpl::HandleDisableQuery(TRequestStatus &aRequestStatus)
+void CJavaCertStoreImpl::HandleDeleteDisableQuery(TRequestStatus &aRequestStatus, bool disableCertQuery)
{
-
- TRAPD(leaveStatus,ShowQueryL());
+ TInt leaveStatus = KErrNone;
+ if (disableCertQuery)
+ {
+#ifndef RD_JAVA_S60_RELEASE_5_0_IAD
+ TRAP(leaveStatus,ShowQueryL(R_JAVA_SECUR_CERT_DISABLING));
+#endif
+ }
+ else
+ {
+ TRAP(leaveStatus,ShowQueryL(R_JAVA_SECUR_CERT_DELETING));
+ }
if (KErrNone == leaveStatus)
{
mClientStatus = &aRequestStatus;
@@ -866,21 +886,16 @@
/**
*
*/
-void CJavaCertStoreImpl::ShowQueryL()
+void CJavaCertStoreImpl::ShowQueryL(TInt resourceId)
{
-
-#ifndef RD_JAVA_S60_RELEASE_5_0_IAD
-
TFileName resourceFileName = java::util::S60CommonUtils::ResourceLanguageFileNameL(
KJavaUserMessagesResourceFileName);
std::auto_ptr<CStringResourceReader> reader(CStringResourceReader::NewL(resourceFileName));
- std::auto_ptr<HBufC> queryPrompt(reader->ReadResourceString(R_JAVA_SECUR_CERT_DISABLING).AllocL());
+ std::auto_ptr<HBufC> queryPrompt(reader->ReadResourceString(resourceId).AllocL());
mQuery.reset(CAknGlobalConfirmationQuery::NewL());
mQuery->ShowConfirmationQueryL(iStatus,queryPrompt->Des(),R_AVKON_SOFTKEYS_OK_CANCEL);
-
-#endif
}
/**
@@ -903,6 +918,23 @@
/**
*
*/
+void CJavaCertStoreImpl::SendDeleteMsg(TInt aStatus)
+{
+
+ mState = EInitial;
+ delete mQuery.release();
+ mState = EInitial;
+ if (EAknSoftkeyOk != aStatus)
+ {
+ User::RequestComplete(mClientStatus,KErrCancel);
+ return;
+ }
+ HandleSendingDeleteMsg(mClientStatus,*mTempCertData);
+}
+
+/**
+ *
+ */
void CJavaCertStoreImpl::HandleSendingEnableDisableMsg(TRequestStatus* aRequestStatus,
TState aState,CJavaCertData& aCertDataObj)
{
@@ -926,6 +958,25 @@
User::RequestComplete(aRequestStatus,KErrNone);
}
+/**
+ *
+ */
+void CJavaCertStoreImpl::HandleSendingDeleteMsg(TRequestStatus* aRequestStatus,
+ CJavaCertData& aCertDataObj)
+{
+
+ TBool flag = SendDeleteCommsMsg(aCertDataObj.mId,aRequestStatus);
+ if (!flag)
+ {
+ //SendDeleteCommsMsg() operation calls RequestComplete()
+ //operation in the error situation.
+ return;
+ }
+ aCertDataObj.mDeleted = ETrue;
+
+ User::RequestComplete(aRequestStatus,KErrNone);
+}
+
/////////////////////////////////////////////////////////////////////////////////
//
// IMPLEMENTATION OF CJavaCertData CLASS
--- a/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.h Tue May 11 16:07:20 2010 +0300
@@ -129,7 +129,8 @@
EInitial,
EListing,
EPreDisabling,
- EPreEnabling
+ EPreEnabling,
+ EPreDeleting
};
//Datamembers.
@@ -159,12 +160,17 @@
TBool SendDisableEnableCommsMsg(const std::string& aId,
TState aState,
TRequestStatus* aRequestStatus);
+ TBool SendDeleteCommsMsg(const std::string& aId,
+ TRequestStatus* aRequestStatus);
TBool CheckCapability(const TCapability& aCapability,TRequestStatus* aRequestStatus);
- void HandleDisableQuery(TRequestStatus &aRequestStatus);
- void ShowQueryL();
+ void HandleDeleteDisableQuery(TRequestStatus &aRequestStatus, bool disableCertQuery);
+ void ShowQueryL(TInt resourceId);
void SendDisableMsg(TInt aStatus);
+ void SendDeleteMsg(TInt aStatus);
void HandleSendingEnableDisableMsg(TRequestStatus* aRequestStatus,
TState aState,CJavaCertData& aCertDataObj);
+ void HandleSendingDeleteMsg(TRequestStatus* aRequestStatus,
+ CJavaCertData& aCertDataObj);
//Not implemented.
CJavaCertStoreImpl(const CJavaCertStoreImpl &x);
--- a/javacommons/security/src/utils/storagehandler.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/src/utils/storagehandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -86,7 +86,6 @@
std::string& aChain)
{
int i = 1;
- wstring chain = L"";
bool foundPart = true;
const wstring attrPrefix = L"MIDlet-Certificate-";
JavaStorageEntry attr;
@@ -119,7 +118,9 @@
if (entryFinder != (*appIter).end())
{
- chain.append((*entryFinder).entryValue());
+ char* tmp = JavaCommonUtils::wstringToUtf8((*entryFinder).entryValue());
+ aChain.append(JavaCommonUtils::base64decode(tmp));
+ delete [] tmp;
}
found = true;
@@ -135,11 +136,8 @@
i++;
}
while (foundPart);
+}
- char* tempStr = JavaCommonUtils::wstringToUtf8(chain);
- aChain.append(tempStr);
- delete [] tempStr;
-}
void StorageHandler::findEntry(const JavaStorageApplicationList_t& queryResult,
const std::wstring& eName,
std::wstring& eValue)
--- a/javacommons/security/tsrc/build/build.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -50,6 +50,7 @@
<property name="ext2.policies.dir" location="/epoc32/winscw/c/resource/java/security/extensions/ext2/policies/"/>
<property name="jvmargsmodifier.default.dll" location="/epoc32/release/winscw/udeb/javajvmargsmodifier.dll"/>
<property name="jvmargsmodifier.filebased.dll" location="/epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll"/>
+ <property name="external.policy.editor.tool.lib" location="../tmp/engine.jar"/>
<property name="javac.source" value="1.3"/>
<property name="javac.target" value="1.3"/>
@@ -100,7 +101,7 @@
<delete dir="${ext2.policies.dir}"/>
<delete dir="${security.test.data.dir}"/>
</target>
-
+
<target name="clean" depends="init.my.properties,close.ext.dir">
<delete dir="${classes.dir}"/>
<delete file="${dist}/${omjsecuritytests.jar.filename}"/>
@@ -135,6 +136,7 @@
</target>
<target name="init" depends="init.my.properties">
+ <mkdir dir="${test.tmp.dir}"/>
<property name="dist" location="${vm.extension.directory}"/>
<mkdir dir="${security.test.data.dir}/security_tmp"/>
<mkdir dir="${security.test.data.dir}/securitypolicies/testinputdata/validpolicies"/>
@@ -204,6 +206,18 @@
</classpath>
<src path="${src.dir}"/>
</javac>
+ <jar jarfile="${external.policy.editor.tool.lib}" update="true">
+ <fileset dir="${compile.result.root}/javasecurity/classes/collection"
+ includes="com/nokia/mj/impl/security/midp/authorization/SecurityPolicy.class,
+ com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermission.class,
+ com/nokia/mj/impl/security/midp/authorization/SecurityPolicyPermissionSettings.class,
+ com/nokia/mj/impl/security/midp/common/PolicyBasedPermission.class,
+ com/nokia/mj/impl/security/midp/common/MIDPPermission.class,
+ com/nokia/mj/impl/security/midp/common/UserSecuritySettings.class"/>
+ <fileset dir="./javabuild"
+ includes="com/nokia/mj/impl/security/midp/common/PermissionMappingTable.class,
+ com/nokia/mj/impl/security/midp/authorization/TestPermissionMappingTable.class"/>
+ </jar>
<java classname="com.nokia.mj.tools.security.midp.PolicyEditor"
failonerror="true">
<sysproperty key="emma.properties" value="${emma.properties}"/>
@@ -211,10 +225,8 @@
<arg value="${security.test.data.dir}/security/policies/"/>
<classpath>
<!--javabuild as classpath is for the NewPermissionMapping-->
- <pathelement location="./javabuild"/>
+ <pathelement location="${external.policy.editor.tool.lib}"/>
<pathelement location="${policyeditor.jar}"/>
- <pathelement location="${impl.cldc.jar}"/>
- <pathelement location="${impl.cdc.jar}"/>
<pathelement path="${emma.dir}/emma.jar"/>
</classpath>
</java>
@@ -225,10 +237,8 @@
<arg value="${ext1.policies.dir}"/>
<classpath>
<!--javabuild as classpath is for the NewPermissionMapping-->
- <pathelement location="./javabuild"/>
+ <pathelement location="${external.policy.editor.tool.lib}"/>
<pathelement location="${policyeditor.jar}"/>
- <pathelement location="${impl.cldc.jar}"/>
- <pathelement location="${impl.cdc.jar}"/>
<pathelement path="${emma.dir}/emma.jar"/>
</classpath>
</java>
@@ -250,7 +260,7 @@
<target name="deploy" depends="compile, prepare_test_data2, open.ext.dir">
<mkdir dir="${dist}"/>
- <jar destfile="${dist}/${omjsecuritytests.jar.filename}" basedir="${classes.dir}" excludes="com/nokia/mj/impl/security/midp/authentication/OcspUserPreferences.class"/>
+ <jar destfile="${dist}/${omjsecuritytests.jar.filename}" basedir="${classes.dir}" excludes="com/nokia/mj/impl/security/midp/authentication/OcspUserPreferences.class com/nokia/mj/impl/security/midp/common/PermissionMappingTable.class"/>
<jar destfile="${dist}/${omjsecuritystubs.jar.filename}" basedir="${classes.dir}" includes="com/nokia/mj/impl/security/midp/authentication/OcspUserPreferences.class"/>
<copy file="${junit.jar.dir}/${junit.jar.filename}"
tofile="${dist}/${junit.jar.filename}"/>
--- a/javacommons/security/tsrc/data/policies/all.txt Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/data/policies/all.txt Tue May 11 16:07:20 2010 +0300
@@ -3,4 +3,5 @@
grant assigned {
permission java.util.PropertyPermission "microedition.*" "read";
permission javax.microedition.PropertyPermission "mobinfo.publicinfo" "read";
+ permission javax.microedition.PropertyPermission "mobinfo.cellid" "read";
}
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/OMJSecurityTests.java Tue May 11 16:07:20 2010 +0300
@@ -174,7 +174,7 @@
{
// prepare the storage data
allAttributes = new Hashtable();
- SecurityAttributes securityAttributes;
+ SecurityAttributes securityAttributes = new SecurityAttributes();
String appName = "OMJSecurityTests";
ac = AccessControllerFactoryImpl.getAccessController(appUID, appName);
AuthenticationCredentials[] credentials;
@@ -190,7 +190,6 @@
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("", "MIICWDCCAcECBEhQwA0wDQYJKoZIhvcNAQEEBQAwczELMAkGA1UEBhMCZmkxEjAQBgNVBAgTCVBpcmthbm1hYTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9raWExDTALBgNVBAsTBEphdmExHzAdBgNVBAMMFkpQX0RldmljZV9NYW51ZmFjdHVyZXIwHhcNMDgwNjEyMDYxOTU3WhcNMTgwNjEwMDYxOTU3WjBzMQswCQYDVQQGEwJmaTESMBAGA1UECBMJUGlya2FubWFhMRAwDgYDVQQHEwdUYW1wZXJlMQ4wDAYDVQQKEwVOb2tpYTENMAsGA1UECxMESmF2YTEfMB0GA1UEAwwWSlBfRGV2aWNlX01hbnVmYWN0dXJlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApi3ipIPj8O33/rZre1euh7Itd9d6ZVf2mvQ/tLpHEsFJe5XLOsVViMvFskhhKUzmDsRbP4J03L6827/vEDIi/1i8kJGLaoFqJYaLGFWI2Zmxlj6aJV8cfZyOjmQPWJn1IDEe1ZAWbvMSp8xibWRsCLNEGKIkxQvAr/QDK/6iS+kCAwEAATANBgkqhkiG9w0BAQQFAAOBgQCDXt6klAs6yKvdTab3D2wkdoi3Lu4YFsMgLexJOu5HhAUJ/9VYO+Q2+mjd95MRsTa5rWQ2Jjvhn57Z3z/KBOwfHbymmNtMk6Gl14H0vQRoHa31jh3mTuAy5KotDVthaDp30aOizk473NU68wY1WdP4gFk5ZhrpNea9q3st13BxIQ=="));
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME ,new Attribute("", "IcANmLKiOJQF8ABCNDj1PNNH/O8v9jfCVuiGBVm8enXDkM/gLwPjrC65sDKpOCHPqssUlHzjmVN5b9g8aRs4jxUOXNt2b732J7NSIPh97vw/WrP/KHdiooi/1KFUyklMyokK9ZrIv+GW1ttLCfKbuFupT9zmPAmWJQpnuD7J6sE="));
- securityAttributes = new SecurityAttributes();
securityAttributes.addDescriptorAttributes(allAttributes);
credentials = authenticationModule.authenticateJad(appUID,null,securityAttributes.getAuthenticationAttributes());
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), credentials);
@@ -741,6 +740,7 @@
UserSecuritySettings.SESSION_INTERACTION_MODE})),
new PolicyBasedPermissionImpl("java.util.PropertyPermission", "microedition.*", "read", null),
new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.publicinfo", "read", null),
+ new PolicyBasedPermissionImpl(p4.getName(), "mobinfo.cellid", "read", null),
new PolicyBasedPermissionImpl("com.nokia.ext2.internal.Ext2Perm", "ext2.target4", "ext2.action4", null),
}));
// getBlanketPermissions: while installing V1 the permissions are not put to blanket, while installing V2 there are some blanket permissions returned
@@ -952,7 +952,7 @@
permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
permissionGranter.getBlanketPermissions(appUID);
assertTrue(permissionGranter.getBlanketPermissionsDetails(appUID) == null);
- // getBlanketPermissionsDetails for Net Access, Read User Data -> net details
+ // getBlanketPermissionsDetails for Multimedia, Local Connectivity -> privacy details
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -963,21 +963,22 @@
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-1", new Attribute("","cert1"));
allAttributes.put(AuthenticationAttribute.MAIN_ATTRIBUTE_PREFIX + "1-2", new Attribute("","cert2"));
allAttributes.put(AuthenticationAttribute.SECOND_LEGACY_ATTRIBUTE_NAME, new Attribute("","signature"));
- allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.http,javax.microedition.io.Connector.file.read"));
+ allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.media.control.RecordControl,javax.microedition.io.Connector.bluetooth.client"));
securityAttributes.addDescriptorAttributes(allAttributes);
authCredentials = new AuthenticationCredentials[1];
authCredentials[0] = new AuthenticationCredentials("IdentifiedThirdParty", "ITDP");
permissionGranter.grantJadPermissions(appUID, null, securityAttributes.getPermissionAttributes(), authCredentials);
allAttributes.clear();
allAttributes.put(MIDP_PROFILE_ATTRIBUTE_NAME,new Attribute("",MIDP2));
- allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.io.Connector.http,javax.microedition.io.Connector.file.read"));
+ allAttributes.put(PermissionAttribute.MANDATORY_LEGACY_ATTRIBUTE_NAME, new Attribute("","javax.microedition.media.control.RecordControl,javax.microedition.io.Connector.bluetooth.client"));
securityAttributes.addManifestAttributes(allAttributes);
permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
permissionGranter.getBlanketPermissions(appUID);
- assertTrue("qtn_java_settings_inst_query_perm_net".equals(permissionGranter.getBlanketPermissionsDetails(appUID))
- || "Allowing these permissions may result in compromised privacy or increased network usage costs.".equals(
- permissionGranter.getBlanketPermissionsDetails(appUID)));
- // getBlanketPermissionsDetails for Messaging. Multimedia -> privacy details
+ String blanketDetails = permissionGranter.getBlanketPermissionsDetails(appUID);
+ assertTrue("qtn_java_settings_inst_query_perm_sec".equals(blanketDetails)
+ || "Allowing these permissions may result in compromised privacy".equals(
+ blanketDetails));
+ // getBlanketPermissionsDetails for Messaging, Multimedia -> net details
permissionGranter.removeSecurityData(session, appUID);
storage.removeAuthenticationStorageData(appUID);
permissionGranter.removeSecurityData(session, appUID);
@@ -999,9 +1000,10 @@
securityAttributes.addManifestAttributes(allAttributes);
permissionGranter.grantJarPermissions(session, appUID, null, securityAttributes.getPermissionAttributes());
permissionGranter.getBlanketPermissions(appUID);
- assertTrue("qtn_java_settings_inst_query_perm_sec".equals(permissionGranter.getBlanketPermissionsDetails(appUID))
- || "Allowing these permissions may result in compromised privacy.".equals(
- permissionGranter.getBlanketPermissionsDetails(appUID)));
+ blanketDetails = permissionGranter.getBlanketPermissionsDetails(appUID);
+ assertTrue("qtn_java_settings_inst_query_perm_net".equals(blanketDetails)
+ || "Allowing these permissions may result in compromised privacy or increased network usage costs".equals(
+ blanketDetails));
}
private void upgradeTests(boolean legacySuites)
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/InteractiveAccessControllerTests.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/InteractiveAccessControllerTests.java Tue May 11 16:07:20 2010 +0300
@@ -35,7 +35,6 @@
import com.nokia.mj.impl.security.midp.common.AuthenticationAttribute;
import com.nokia.mj.impl.security.midp.common.MIDPPermission;
import com.nokia.mj.impl.security.midp.common.PermissionMappingTable;
-import com.nokia.mj.impl.security.midp.common.TestPermissionMappingTable;
import com.nokia.mj.impl.utils.Attribute;
import com.nokia.mj.impl.security.utils.*;
import java.security.*;
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionGranterTests.java Tue May 11 16:07:20 2010 +0300
@@ -42,7 +42,6 @@
import com.nokia.mj.impl.utils.OtaStatusCode;
import com.nokia.mj.impl.utils.Attribute;
import com.nokia.mj.impl.security.midp.common.PermissionMappingTable;
-import com.nokia.mj.impl.security.midp.common.TestPermissionMappingTable;
import j2meunit.framework.Test;
import j2meunit.framework.TestCase;
@@ -1087,9 +1086,10 @@
private static MIDPPermission[] getDefaultPermissions()
{
- MIDPPermission[] defaultPerms = new MIDPPermission[2];
+ MIDPPermission[] defaultPerms = new MIDPPermission[3];
defaultPerms[0] = new MIDPPermission("java.util.PropertyPermission", "microedition.*", "read");
defaultPerms[1] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.publicinfo", "read");
+ defaultPerms[2] = new MIDPPermission("javax.microedition.PropertyPermission", "mobinfo.cellid", "read");
return defaultPerms;
}
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionMappingTable.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/PermissionMappingTable.java Tue May 11 16:07:20 2010 +0300
@@ -17,6 +17,8 @@
package com.nokia.mj.impl.security.midp.common;
+import com.nokia.mj.impl.security.midp.authorization.TestPermissionMappingTable;
+
import java.util.Hashtable;
import java.util.Enumeration;
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/SecurityPolicyModuleTests.java Tue May 11 16:07:20 2010 +0300
@@ -87,6 +87,7 @@
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
+ new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
};
static final SecurityPolicyPermission[] OPERATOR_PERMS =
{
@@ -138,6 +139,7 @@
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.imsi","read",null),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.msisdn","read",null),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
+ new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
};
static final SecurityPolicyPermission[] IDENTIFIED_THIRD_PARTY_PERMS =
{
@@ -260,6 +262,7 @@
new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
+ new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
};
static final SecurityPolicyPermission[] UNIDENTIFIED_THIRD_PARTY_PERMS =
{
@@ -368,14 +371,15 @@
new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.RecordControl"),"*", "record",
new SecurityPolicyPermissionSettings("Multimedia Recording",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
- new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE})),
+ new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE})),
new SecurityPolicyPermission(getPermissionName("javax.microedition.media.control.VideoControl.getSnapshot"),"*", "snapshot",
new SecurityPolicyPermissionSettings("Multimedia Recording",UserSecuritySettings.ONESHOT_INTERACTION_MODE,
- new int[]{UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE})),
+ new int[]{UserSecuritySettings.BLANKET_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE,UserSecuritySettings.ONESHOT_INTERACTION_MODE})),
new SecurityPolicyPermission(getPermissionName("javax.microedition.io.Connector.rtsp"),"*", null,
new SecurityPolicyPermissionSettings("Net Access",UserSecuritySettings.SESSION_INTERACTION_MODE,
new int[]{UserSecuritySettings.ONESHOT_INTERACTION_MODE,UserSecuritySettings.NO_INTERACTION_MODE,UserSecuritySettings.SESSION_INTERACTION_MODE})),
new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.publicinfo","read",null),
+ new SecurityPolicyPermission(getPermissionName("javax.microedition.PropertyPermission"),"mobinfo.cellid","read",null),
};
// Begin j2meunit test framework setup
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/TestPermissionMappingTable.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authorization/TestPermissionMappingTable.java Tue May 11 16:07:20 2010 +0300
@@ -15,10 +15,11 @@
*
*/
-package com.nokia.mj.impl.security.midp.common;
+package com.nokia.mj.impl.security.midp.authorization;
import java.util.Hashtable;
import java.util.Enumeration;
+import com.nokia.mj.impl.security.midp.common.*;
/**
* Mapping between named permissions and class named permissions
--- a/javacommons/utils/build/javautils_0x2002DCDA.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/build/javautils_0x2002DCDA.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -128,6 +127,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javacommons/utils/functionserver/src/functionserver.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/functionserver/src/functionserver.cpp Tue May 11 16:07:20 2010 +0300
@@ -62,16 +62,24 @@
JELOG2(EUtils);
ScopedLock lock(mMutex);
- mServerTerminating = true;
- if (!mConnectedToClient)
+ if (mOsServer != 0)
{
- mClient.connect(*mOsServer);
- mConnectedToClient = true;
+
+ mServerTerminating = true;
+ if (!mConnectedToClient)
+ {
+ mClient.connect(*mOsServer);
+ mConnectedToClient = true;
+ }
+
+ mClient.sendCloseMessage(this);
+ mClient.Close();
+ mMonitor->wait();
}
-
- mClient.sendCloseMessage(this);
- mClient.Close();
- mMonitor->wait();
+ else
+ {
+ ELOG(EUtils,"FunctionServer::stopServer() called when there was no server running");
+ }
}
@@ -335,10 +343,18 @@
JELOG2(EUtils);
// See stopServerInsideServerThread operation.
// ScopedLock lock(mMutex);
- if (mServerTerminating)
+ if (mServerTerminating || mOsServer == 0)
{
std::string message = "Trying to execute code in non-existing FS: ";
message.append(mServerName);
+ if (mServerTerminating)
+ {
+ message.append(" server closing.");
+ }
+ else
+ {
+ message.append(" server not created.");
+ }
ELOG1(EUtils,"%s", message.c_str());
throw ExceptionBase(message, __FILE__, __FUNCTION__, __LINE__);
}
--- a/javacommons/utils/functionserver/src/methodcall.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/functionserver/src/methodcall.cpp Tue May 11 16:07:20 2010 +0300
@@ -34,7 +34,16 @@
OS_EXPORT void MethodCaller::ExecuteLeavingFunctorL(const Functor& functor, java::util::FunctionServer* functionServer, int* /*res*/)
{
JELOG2(EUtils);
- int error = functionServer->executeInServerThread(functor);
+ int error = KErrNone;
+ try
+ {
+ error = functionServer->executeInServerThread(functor);
+ }
+ catch (std::exception&)
+ {
+ error = KErrServerTerminated;
+ }
+
if (error) // Do not use LeaveIfError(), we want to handle positive error codes as well
{
User::Leave(error);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/utils/functionserver/tsrc/build/testfunctionserver.pro Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE=app
+TARGET=testfunctionserver
+CONFIG += omj no_icon stl
+CONFIG -= qt
+
+LIBS += -lCppUTest
+
+INCLUDEPATH += ../../../../../tools/cpputest/include/CppUTest
+
+INCLUDEPATH += ../../../../../tools/cpputest/include/Platforms/Symbian
+TARGET.CAPABILITY = all -tcb
+
+include(../../../../../build/omj.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/utils/functionserver/tsrc/src/alltests.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AllTests
+*
+*/
+
+#include "Platform.h"
+#include "CommandLineTestRunner.h"
+
+int main(int ac, char** av)
+{
+ return CommandLineTestRunner::RunAllTests(ac, av);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/utils/functionserver/tsrc/src/testfunctionserver.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,2186 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Tests for function server
+*
+*/
+
+#include "functionserver.h"
+#include "fs_methodcall.h"
+
+#include "TestHarness.h"
+#include "exceptionbase.h"
+#include "logger.h"
+using namespace java::util;
+
+int sIvokedMethod = -1;
+int sA = -1;
+int sB = -1;
+int sC = -1;
+int sD = -1;
+int sE = -1;
+int sF = -1;
+int sG = -1;
+int sH = -1;
+int sI = -1;
+int sIndex = 0;
+int sServerSideInitCalled = false;
+int sServerSideCleanCalled = false;
+int sStartServerCalled = false;
+
+void localMethod()
+{sIvokedMethod = 1;}
+void localMethod1(int a)
+ {sIvokedMethod = 2; sA = a;}
+void localMethod2(int a, int b)
+ {sIvokedMethod = 3; sA = a; sB = b;}
+void localMethod3(int a, int b, int c)
+ {sIvokedMethod = 4; sA = a; sB = b; sC = c;}
+void localMethod4(int a, int b, int c, int d)
+ {sIvokedMethod = 5; sA = a; sB = b; sC = c; sD = d;}
+void localMethod5(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 6; sA = a; sB = b; sC = c; sD = d; sE = e;}
+void localMethod6(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 7; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+void localMethod7(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 8; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+void localMethod8(int a, int b, int c, int d, int e, int f, int g, int h)
+ {sIvokedMethod = 9; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h;}
+void localMethod9(int a, int b, int c, int d, int e, int f, int g, int h, int i)
+ {sIvokedMethod = 10; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h; sI = i;}
+
+int localMethodR()
+ {sIvokedMethod = 11;return sIvokedMethod;}
+int localMethodR1(int a)
+ {sIvokedMethod = 12; sA = a;return sIvokedMethod;}
+int localMethodR2(int a, int b)
+ {sIvokedMethod = 13; sA = a; sB = b;return sIvokedMethod;}
+int localMethodR3(int a, int b, int c)
+ {sIvokedMethod = 14; sA = a; sB = b; sC = c;return sIvokedMethod;}
+int localMethodR4(int a, int b, int c, int d)
+ {sIvokedMethod = 15; sA = a; sB = b; sC = c; sD = d;return sIvokedMethod;}
+int localMethodR5(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 16; sA = a; sB = b; sC = c; sD = d; sE = e;return sIvokedMethod;}
+int localMethodR6(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 17; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;return sIvokedMethod;}
+int localMethodR7(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 18; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;return sIvokedMethod;}
+int localMethodR8(int a, int b, int c, int d, int e, int f, int g, int h)
+ {sIvokedMethod = 19; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h;return sIvokedMethod;}
+int localMethodR9(int a, int b, int c, int d, int e, int f, int g, int h, int i)
+ {sIvokedMethod = 20; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h; sI = i;return sIvokedMethod;}
+
+void localMethodTL()
+ {sIvokedMethod = 21; }
+void localMethodT1L(int a)
+ {sIvokedMethod = 22; sA = a;}
+void localMethodT2L(int a, int b)
+ {sIvokedMethod = 23; sA = a; sB = b;}
+void localMethodT3L(int a, int b, int c)
+ {sIvokedMethod = 24; sA = a; sB = b; sC = c;}
+void localMethodT4L(int a, int b, int c, int d)
+ {sIvokedMethod = 25; sA = a; sB = b; sC = c; sD = d;}
+void localMethodT5L(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 26; sA = a; sB = b; sC = c; sD = d; sE = e;}
+void localMethodT6L(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 27; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+void localMethodT7L(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 28; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+void localMethodT8L(int a, int b, int c, int d, int e, int f, int g, int h)
+ {sIvokedMethod = 29; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h;}
+void localMethodT9L(int a, int b, int c, int d, int e, int f, int g, int h, int i)
+ {sIvokedMethod = 30; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h; sI = i;}
+
+void localLeavingMethodTL()
+ {sIvokedMethod = 31; User::Leave(-sIvokedMethod);}
+void localLeavingMethodT1L(int a)
+ {sIvokedMethod = 32; sA = a;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT2L(int a, int b)
+ {sIvokedMethod = 33; sA = a; sB = b;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT3L(int a, int b, int c)
+ {sIvokedMethod = 34; sA = a; sB = b; sC = c;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT4L(int a, int b, int c, int d)
+ {sIvokedMethod = 35; sA = a; sB = b; sC = c; sD = d;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT5L(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 36; sA = a; sB = b; sC = c; sD = d; sE = e;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT6L(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 37; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT7L(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 38; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT8L(int a, int b, int c, int d, int e, int f, int g, int h)
+ {sIvokedMethod = 39; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h;User::Leave(-sIvokedMethod);}
+void localLeavingMethodT9L(int a, int b, int c, int d, int e, int f, int g, int h, int i)
+ {sIvokedMethod = 40; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g; sH = h; sI = i;User::Leave(-sIvokedMethod);}
+
+
+class TestClass
+{
+public:
+ void classMethod()
+ {sIvokedMethod = 41;}
+ void classMethod1(int a)
+ {sIvokedMethod = 42; sA = a;}
+ void classMethod2(int a, int b)
+ {sIvokedMethod = 43; sA = a; sB = b;}
+ void classMethod3(int a, int b, int c)
+ {sIvokedMethod = 44; sA = a; sB = b; sC = c;}
+ void classMethod4(int a, int b, int c, int d)
+ {sIvokedMethod = 45; sA = a; sB = b; sC = c; sD = d;}
+ void classMethod5(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 46; sA = a; sB = b; sC = c; sD = d; sE = e;}
+ void classMethod6(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 47; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+ void classMethod7(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 48; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+
+ int classMethodR()
+ {sIvokedMethod = 51;return sIvokedMethod;}
+ int classMethodR1(int a)
+ {sIvokedMethod = 52; sA = a;return sIvokedMethod;}
+ int classMethodR2(int a, int b)
+ {sIvokedMethod = 53; sA = a; sB = b;return sIvokedMethod;}
+ int classMethodR3(int a, int b, int c)
+ {sIvokedMethod = 54; sA = a; sB = b; sC = c;return sIvokedMethod;}
+ int classMethodR4(int a, int b, int c, int d)
+ {sIvokedMethod = 55; sA = a; sB = b; sC = c; sD = d;return sIvokedMethod;}
+ int classMethodR5(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 56; sA = a; sB = b; sC = c; sD = d; sE = e;return sIvokedMethod;}
+ int classMethodR6(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 57; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;return sIvokedMethod;}
+ int classMethodR7(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 58; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;return sIvokedMethod;}
+
+ void classMethodL()
+ {sIvokedMethod = 61;}
+ void classMethodL1(int a)
+ {sIvokedMethod = 62; sA = a;}
+ void classMethodL2(int a, int b)
+ {sIvokedMethod = 63; sA = a; sB = b;}
+ void classMethodL3(int a, int b, int c)
+ {sIvokedMethod = 64; sA = a; sB = b; sC = c;}
+ void classMethodL4(int a, int b, int c, int d)
+ {sIvokedMethod = 65; sA = a; sB = b; sC = c; sD = d;}
+ void classMethodL5(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 66; sA = a; sB = b; sC = c; sD = d; sE = e;}
+ void classMethodL6(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 67; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+ void classMethodL7(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 68; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+
+ void classMethodWithLeaveL()
+ {sIvokedMethod = 71;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave1L(int a)
+ {sIvokedMethod = 72; sA = a;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave2L(int a, int b)
+ {sIvokedMethod = 73; sA = a; sB = b;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave3L(int a, int b, int c)
+ {sIvokedMethod = 74; sA = a; sB = b; sC = c;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave4L(int a, int b, int c, int d)
+ {sIvokedMethod = 75; sA = a; sB = b; sC = c; sD = d;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave5L(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 76; sA = a; sB = b; sC = c; sD = d; sE = e;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave6L(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 77; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeave7L(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 78; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;User::Leave(-sIvokedMethod);}
+
+ int classMethodRL()
+ {sIvokedMethod = 81;return sIvokedMethod;}
+ int classMethodR1L(int a)
+ {sIvokedMethod = 82; sA = a;return sIvokedMethod;}
+ int classMethodR2L(int a, int b)
+ {sIvokedMethod = 83; sA = a; sB = b;return sIvokedMethod;}
+ int classMethodR3L(int a, int b, int c)
+ {sIvokedMethod = 84; sA = a; sB = b; sC = c;return sIvokedMethod;}
+ int classMethodR4L(int a, int b, int c, int d)
+ {sIvokedMethod = 85; sA = a; sB = b; sC = c; sD = d;return sIvokedMethod;}
+ int classMethodR5L(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 86; sA = a; sB = b; sC = c; sD = d; sE = e;return sIvokedMethod;}
+ int classMethodR6L(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 87; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;return sIvokedMethod;}
+ int classMethodR7L(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 88; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;return sIvokedMethod;}
+
+ int classMethodWithLeaveRL()
+ {sIvokedMethod = 91;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR1L(int a)
+ {sIvokedMethod = 92; sA = a;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR2L(int a, int b)
+ {sIvokedMethod = 93; sA = a; sB = b;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR3L(int a, int b, int c)
+ {sIvokedMethod = 94; sA = a; sB = b; sC = c;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR4L(int a, int b, int c, int d)
+ {sIvokedMethod = 95; sA = a; sB = b; sC = c; sD = d;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR5L(int a, int b, int c, int d, int e)
+ {sIvokedMethod = 96; sA = a; sB = b; sC = c; sD = d; sE = e;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR6L(int a, int b, int c, int d, int e, int f)
+ {sIvokedMethod = 97; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveR7L(int a, int b, int c, int d, int e, int f, int g)
+ {sIvokedMethod = 98; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;User::Leave(-sIvokedMethod);return 0;}
+
+
+
+ void classMethodC() const
+ {sIvokedMethod = 101;}
+ void classMethodC1(int a) const
+ {sIvokedMethod = 102; sA = a;}
+ void classMethodC2(int a, int b) const
+ {sIvokedMethod = 103; sA = a; sB = b;}
+ void classMethodC3(int a, int b, int c) const
+ {sIvokedMethod = 104; sA = a; sB = b; sC = c;}
+ void classMethodC4(int a, int b, int c, int d) const
+ {sIvokedMethod = 105; sA = a; sB = b; sC = c; sD = d;}
+ void classMethodC5(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 106; sA = a; sB = b; sC = c; sD = d; sE = e;}
+ void classMethodC6(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 107; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+ void classMethodC7(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 108; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+
+ int classMethodRC() const
+ {sIvokedMethod = 111;return sIvokedMethod;}
+ int classMethodRC1(int a) const
+ {sIvokedMethod = 112; sA = a;return sIvokedMethod;}
+ int classMethodRC2(int a, int b) const
+ {sIvokedMethod = 113; sA = a; sB = b;return sIvokedMethod;}
+ int classMethodRC3(int a, int b, int c) const
+ {sIvokedMethod = 114; sA = a; sB = b; sC = c;return sIvokedMethod;}
+ int classMethodRC4(int a, int b, int c, int d) const
+ {sIvokedMethod = 115; sA = a; sB = b; sC = c; sD = d;return sIvokedMethod;}
+ int classMethodRC5(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 116; sA = a; sB = b; sC = c; sD = d; sE = e;return sIvokedMethod;}
+ int classMethodRC6(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 117; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;return sIvokedMethod;}
+ int classMethodRC7(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 118; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;return sIvokedMethod;}
+
+ void classMethodCL() const
+ {sIvokedMethod = 121;}
+ void classMethodC1L(int a) const
+ {sIvokedMethod = 122; sA = a;}
+ void classMethodC2L(int a, int b) const
+ {sIvokedMethod = 123; sA = a; sB = b;}
+ void classMethodC3L(int a, int b, int c) const
+ {sIvokedMethod = 124; sA = a; sB = b; sC = c;}
+ void classMethodC4L(int a, int b, int c, int d) const
+ {sIvokedMethod = 125; sA = a; sB = b; sC = c; sD = d;}
+ void classMethodC5L(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 126; sA = a; sB = b; sC = c; sD = d; sE = e;}
+ void classMethodC6L(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 127; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;}
+ void classMethodC7L(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 128; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;}
+
+ void classMethodWithLeaveCL() const
+ {sIvokedMethod = 131;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC1L(int a) const
+ {sIvokedMethod = 132; sA = a;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC2L(int a, int b) const
+ {sIvokedMethod = 133; sA = a; sB = b;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC3L(int a, int b, int c) const
+ {sIvokedMethod = 134; sA = a; sB = b; sC = c;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC4L(int a, int b, int c, int d) const
+ {sIvokedMethod = 135; sA = a; sB = b; sC = c; sD = d;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC5L(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 136; sA = a; sB = b; sC = c; sD = d; sE = e;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC6L(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 137; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;User::Leave(-sIvokedMethod);}
+ void classMethodWithLeaveC7L(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 138; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;User::Leave(-sIvokedMethod);}
+
+ int classMethodRCL() const
+ {sIvokedMethod = 141;return sIvokedMethod;}
+ int classMethodRC1L(int a) const
+ {sIvokedMethod = 142; sA = a;return sIvokedMethod;}
+ int classMethodRC2L(int a, int b) const
+ {sIvokedMethod = 143; sA = a; sB = b;return sIvokedMethod;}
+ int classMethodRC3L(int a, int b, int c) const
+ {sIvokedMethod = 144; sA = a; sB = b; sC = c;return sIvokedMethod;}
+ int classMethodRC4L(int a, int b, int c, int d) const
+ {sIvokedMethod = 145; sA = a; sB = b; sC = c; sD = d;return sIvokedMethod;}
+ int classMethodRC5L(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 146; sA = a; sB = b; sC = c; sD = d; sE = e;return sIvokedMethod;}
+ int classMethodRC6L(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 147; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;return sIvokedMethod;}
+ int classMethodRC7L(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 148; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;return sIvokedMethod;}
+
+ int classMethodWithLeaveRCL() const
+ {sIvokedMethod = 151;User::Leave(-sIvokedMethod); return 0;}
+ int classMethodWithLeaveRC1L(int a) const
+ {sIvokedMethod = 152; sA = a;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC2L(int a, int b) const
+ {sIvokedMethod = 153; sA = a; sB = b;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC3L(int a, int b, int c) const
+ {sIvokedMethod = 154; sA = a; sB = b; sC = c;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC4L(int a, int b, int c, int d) const
+ {sIvokedMethod = 155; sA = a; sB = b; sC = c; sD = d;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC5L(int a, int b, int c, int d, int e) const
+ {sIvokedMethod = 156; sA = a; sB = b; sC = c; sD = d; sE = e;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC6L(int a, int b, int c, int d, int e, int f) const
+ {sIvokedMethod = 157; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f;User::Leave(-sIvokedMethod);return 0;}
+ int classMethodWithLeaveRC7L(int a, int b, int c, int d, int e, int f, int g) const
+ {sIvokedMethod = 158; sA = a; sB = b; sC = c; sD = d; sE = e; sF = f; sG = g;User::Leave(-sIvokedMethod);return 0;}
+};
+
+
+class MyFunctionServer: public java::util::FunctionServer
+{
+public:
+
+ MyFunctionServer() :
+ java::util::FunctionServer("JavaTestFunctionServer")
+ {
+ }
+
+ virtual void doServerSideInit()
+ {
+ java::util::FunctionServer::doServerSideInit();
+ sServerSideInitCalled = ++sIndex;
+ }
+ virtual void doServerSideClean()
+ {
+ sServerSideCleanCalled = ++sIndex;
+ }
+ virtual void startServer()
+ {
+ sStartServerCalled = ++sIndex;
+ java::util::FunctionServer::startServer();
+ }
+};
+class MyFunctionServer2
+{
+ int a;
+};
+
+TEST_GROUP(TestFuncServerInit)
+{
+ TEST_SETUP()
+ {
+ sIvokedMethod = -1;
+ sA = -1;
+ sB = -1;
+ sC = -1;
+ sD = -1;
+ sE = -1;
+ sF = -1;
+ sG = -1;
+ sH = -1;
+ sI = -1;
+ sServerSideInitCalled = 0;
+ sServerSideCleanCalled = 0;
+ sStartServerCalled = 0;
+ sIndex = 0;
+ }
+
+ TEST_TEARDOWN()
+ {
+ }
+};
+
+
+TEST(TestFuncServerInit, startAndStop)
+{
+ MyFunctionServer* fserver = new MyFunctionServer();
+ try
+ {
+ fserver->createServerToNewThread();
+ fserver->stopServer();
+ delete fserver;
+ fserver = 0;
+ }
+ catch(...)
+ {
+ FAIL("Unexpected exp in startAndStop\n");
+ }
+
+ CHECK(sServerSideInitCalled == 1);
+ CHECK(sStartServerCalled == 2);
+ CHECK(sServerSideCleanCalled == 3);
+}
+
+
+
+
+
+
+
+TEST_GROUP(TestFuncServerNotOpened)
+{
+ MyFunctionServer* fserver;
+ TestClass* clazz;
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int g;
+ int h;
+ int i;
+
+ TEST_SETUP()
+ {
+ fserver = new MyFunctionServer();
+
+ sServerSideInitCalled = 0;
+ sServerSideCleanCalled = 0;
+ sStartServerCalled = 0;
+ sIndex = 0;
+ sIvokedMethod = -1;
+ sA = -1;
+ sB = -1;
+ sC = -1;
+ sD = -1;
+ sE = -1;
+ sF = -1;
+ sG = -1;
+ sH = -1;
+ sI = -1;
+ a = -1;
+ b = -1;
+ c = -1;
+ d = -1;
+ e = -1;
+ f = -1;
+ g = -1;
+ h = -1;
+ i = -1;
+ }
+
+ TEST_TEARDOWN()
+ {
+ CHECK(sA == a);
+ CHECK(sB == b);
+ CHECK(sC == c);
+ CHECK(sD == d);
+ CHECK(sE == e);
+ CHECK(sF == f);
+ CHECK(sG == g);
+ CHECK(sH == h);
+ CHECK(sI == i);
+ delete fserver;
+ fserver = 0;
+ }
+};
+
+
+TEST(TestFuncServerNotOpened, closeWithoutOpen)
+{
+ try
+ {
+ fserver->stopServer();
+
+ }
+ catch(...)
+ {
+ FAIL("UNexpected exp in closeWithoutOpen\n");
+ }
+ CHECK(sServerSideInitCalled == 0);
+ CHECK(sStartServerCalled == 0);
+ CHECK(sServerSideCleanCalled == 0);
+}
+
+
+TEST(TestFuncServerNotOpened, sendWithoutOpen)
+{
+ try
+ {
+ CallMethod(localMethod, fserver);
+ }
+ catch (ExceptionBase& e)
+ {
+ CHECK(e.toString().find("Trying to execute code in non-existing FS: ") != std::string::npos)
+ CHECK(e.toString().find(" server not created.") != std::string::npos)
+ }
+ catch(...)
+ {
+ FAIL("UNexpected exp in closeWithoutOpen\n");
+ }
+ CHECK(sIvokedMethod == -1);
+ CHECK(sServerSideInitCalled == 0);
+ CHECK(sStartServerCalled == 0);
+ CHECK(sServerSideCleanCalled == 0);
+}
+
+
+TEST(TestFuncServerNotOpened, sendWithoutOpenL)
+{
+ try
+ {
+ TRAPD(err, CallMethodL(localLeavingMethodTL, fserver));
+ CHECK(err == KErrServerTerminated);
+ }
+ catch(...)
+ {
+ FAIL("UNexpected exp in closeWithoutOpen\n");
+ }
+ CHECK(sIvokedMethod == -1);
+ CHECK(sServerSideInitCalled == 0);
+ CHECK(sStartServerCalled == 0);
+ CHECK(sServerSideCleanCalled == 0);
+}
+
+
+TEST(TestFuncServerNotOpened, sendAfterClose)
+{
+ try
+ {
+ fserver->createServerToNewThread();
+ fserver->stopServer();
+ CallMethod(localMethod, fserver);
+ }
+ catch (ExceptionBase& e)
+ {
+ CHECK(e.toString().find("Trying to execute code in non-existing FS: ") != std::string::npos)
+ CHECK(e.toString().find(" server closing.") != std::string::npos)
+ }
+ catch(...)
+ {
+ FAIL("UNexpected exp in closeWithoutOpen\n");
+ }
+ CHECK(sIvokedMethod == -1);
+}
+
+TEST(TestFuncServerNotOpened, sendAfterCloseL)
+{
+ try
+ {
+ fserver->createServerToNewThread();
+ fserver->stopServer();
+ TRAPD(err, CallMethodL(localLeavingMethodTL, fserver));
+ CHECK(err == KErrServerTerminated);
+ }
+ catch(...)
+ {
+ FAIL("UNexpected exp in closeWithoutOpen\n");
+ }
+ CHECK(sIvokedMethod == -1);
+}
+
+
+
+
+
+
+
+
+
+
+
+TEST_GROUP(TestFuncServer)
+{
+ MyFunctionServer* fserver;
+ TestClass* clazz;
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int g;
+ int h;
+ int i;
+
+ TEST_SETUP()
+ {
+ fserver = new MyFunctionServer();
+ clazz = new TestClass();
+
+ sServerSideInitCalled = 0;
+ sServerSideCleanCalled = 0;
+ sStartServerCalled = 0;
+ sIndex = 0;
+ fserver->createServerToNewThread();
+ sIvokedMethod = -1;
+ sA = -1;
+ sB = -1;
+ sC = -1;
+ sD = -1;
+ sE = -1;
+ sF = -1;
+ sG = -1;
+ sH = -1;
+ sI = -1;
+ a = -1;
+ b = -1;
+ c = -1;
+ d = -1;
+ e = -1;
+ f = -1;
+ g = -1;
+ h = -1;
+ i = -1;
+ }
+
+ TEST_TEARDOWN()
+ {
+ CHECK(sA == a);
+ CHECK(sB == b);
+ CHECK(sC == c);
+ CHECK(sD == d);
+ CHECK(sE == e);
+ CHECK(sF == f);
+ CHECK(sG == g);
+ CHECK(sH == h);
+ CHECK(sI == i);
+ delete clazz;
+ fserver->stopServer();
+ delete fserver;
+ fserver = 0;
+ CHECK(sServerSideInitCalled == 1);
+ CHECK(sStartServerCalled == 2);
+ CHECK(sServerSideCleanCalled == 3);
+ }
+};
+
+// Calling local void methods.
+TEST(TestFuncServer, localVoid0)
+{
+ CallMethod(localMethod, fserver);
+ CHECK(sIvokedMethod == 1);
+}
+
+TEST(TestFuncServer, localVoid1)
+{
+ a = 1;
+ CallMethod(localMethod1, a, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid2)
+{
+ a = 2;
+ b = a + 1;
+ CallMethod(localMethod2, a, b, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid3)
+{
+ a = 3;
+ b = a + 1;
+ c = b + 1;
+ CallMethod(localMethod3, a, b, c, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid4)
+{
+ a = 4;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ CallMethod(localMethod4, a, b, c, d, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid5)
+{
+ a = 5;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ CallMethod(localMethod5, a, b, c, d, e, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid6)
+{
+ a = 6;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ CallMethod(localMethod6, a, b, c, d, e, f, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid7)
+{
+ a = 7;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ CallMethod(localMethod7, a, b, c, d, e, f, g, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid8)
+{
+ a = 8;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ CallMethod(localMethod8, a, b, c, d, e, f, g, h, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localVoid9)
+{
+ a = 9;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ i = h + 1;
+ CallMethod(localMethod9, a, b, c, d, e, f, g, h, i, fserver);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+
+// Calling methods that returns something.
+
+TEST(TestFuncServer, localReturn)
+{
+ int res = CallMethod(localMethodR, fserver);
+ CHECK(res == 11);
+ CHECK(sIvokedMethod == 11);
+}
+
+TEST(TestFuncServer, localReturn1)
+{
+ a = 11;
+ int res = CallMethod(localMethodR1, a, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn2)
+{
+ a = 12;
+ b = a + 1;
+ int res = CallMethod(localMethodR2, a, b, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn3)
+{
+ a = 13;
+ b = a + 1;
+ c = b + 1;
+ int res = CallMethod(localMethodR3, a, b, c, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn4)
+{
+ a = 14;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res = CallMethod(localMethodR4, a, b, c, d, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn5)
+{
+ a = 15;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res = CallMethod(localMethodR5, a, b, c, d, e, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn6)
+{
+ a = 16;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res = CallMethod(localMethodR6, a, b, c, d, e, f, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn7)
+{
+ a = 17;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res = CallMethod(localMethodR7, a, b, c, d, e, f, g, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn8)
+{
+ a = 18;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ int res = CallMethod(localMethodR8, a, b, c, d, e, f, g, h, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localReturn9)
+{
+ a = 19;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ i = h + 1;
+ int res = CallMethod(localMethodR9, a, b, c, d, e, f, g, h, i, fserver);
+ CHECK(res == a + 1);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+
+// Calling methods through TRAP.
+
+TEST(TestFuncServer, localTrap0)
+{
+ int res = CallMethodTrap(localMethodTL, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == 21);
+}
+
+TEST(TestFuncServer, localTrap1)
+{
+ a = 21;
+ int res = CallMethodTrap(localMethodT1L, a, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap2)
+{
+ a = 22;
+ b = a + 1;
+ int res = CallMethodTrap(localMethodT2L, a, b, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap3)
+{
+ a = 23;
+ b = a + 1;
+ c = b + 1;
+ int res = CallMethodTrap(localMethodT3L, a, b, c, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap4)
+{
+ a = 24;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res = CallMethodTrap(localMethodT4L, a, b, c, d, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap5)
+{
+ a = 25;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res = CallMethodTrap(localMethodT5L, a, b, c, d, e, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap6)
+{
+ a = 26;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res = CallMethodTrap(localMethodT6L, a, b, c, d, e, f, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap7)
+{
+ a = 27;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res = CallMethodTrap(localMethodT7L, a, b, c, d, e, f, g, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap8)
+{
+ a = 28;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ int res = CallMethodTrap(localMethodT8L, a, b, c, d, e, f, g, h, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrap9)
+{
+ a = 29;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ i = h + 1;
+ int res = CallMethodTrap(localMethodT9L, a, b, c, d, e, f, g, h, i, fserver);
+ CHECK(res == 0);
+ CHECK(sIvokedMethod == a + 1);
+}
+
+// Calling methods through TRAP. The method will leave.
+TEST(TestFuncServer, localTrapWithLeave)
+{
+ int res = CallMethodTrap(localLeavingMethodTL, fserver);
+ CHECK(res == -31);
+ CHECK(sIvokedMethod == 31);
+}
+
+TEST(TestFuncServer, localTrapWithLeave1)
+{
+ a = 31;
+ int res = CallMethodTrap(localLeavingMethodT1L, a, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave2)
+{
+ a = 32;
+ b = a + 1;
+ int res = CallMethodTrap(localLeavingMethodT2L, a, b, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave3)
+{
+ a = 33;
+ b = a + 1;
+ c = b + 1;
+ int res = CallMethodTrap(localLeavingMethodT3L, a, b, c, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave4)
+{
+ a = 34;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res = CallMethodTrap(localLeavingMethodT4L, a, b, c, d, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave5)
+{
+ a = 35;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res = CallMethodTrap(localLeavingMethodT5L, a, b, c, d, e, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+
+TEST(TestFuncServer, localTrapWithLeave6)
+{
+ a = 36;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res = CallMethodTrap(localLeavingMethodT6L, a, b, c, d, e, f, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave7)
+{
+ a = 37;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res = CallMethodTrap(localLeavingMethodT7L, a, b, c, d, e, f, g, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave8)
+{
+ a = 38;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ int res = CallMethodTrap(localLeavingMethodT8L, a, b, c, d, e, f, g, h, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, localTrapWithLeave9)
+{
+ a = 39;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ h = g + 1;
+ i = h + 1;
+ int res = CallMethodTrap(localLeavingMethodT9L, a, b, c, d, e, f, g, h, i, fserver);
+ CHECK(res == -(a + 1));
+ CHECK(sIvokedMethod == a + 1);
+}
+
+
+// Testing non-const void methods from a class.
+
+TEST(TestFuncServer, classVoid0)
+{
+ CallMethod( clazz, TestClass::classMethod, fserver );
+ CHECK(sIvokedMethod == 41);
+}
+
+TEST(TestFuncServer, classVoid1)
+{
+ a = 41;
+ CallMethod( clazz, TestClass::classMethod1, a, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid2)
+{
+ a = 42;
+ b = a + 1;
+ CallMethod( clazz, TestClass::classMethod2, a, b, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid3)
+{
+ a = 43;
+ b = a + 1;
+ c = b + 1;
+ CallMethod( clazz, TestClass::classMethod3, a, b, c, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid4)
+{
+ a = 44;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ CallMethod( clazz, TestClass::classMethod4, a, b, c, d, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid5)
+{
+ a = 45;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ CallMethod( clazz, TestClass::classMethod5, a, b, c, d, e, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid6)
+{
+ a = 46;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ CallMethod( clazz, TestClass::classMethod6, a, b, c, d, e, f, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+TEST(TestFuncServer, classVoid7)
+{
+ a = 47;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ CallMethod( clazz, TestClass::classMethod7, a, b, c, d, e, f, g, fserver );
+ CHECK(sIvokedMethod == a + 1);
+}
+
+// Testing non-const methods from a class that returns a value.
+
+TEST(TestFuncServer, classReturn0)
+{
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR, fserver );
+ CHECK(sIvokedMethod == 51);
+ CHECK(res == 51);
+
+}
+TEST(TestFuncServer, classReturn1)
+{
+ a = 51;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR1, a, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn2)
+{
+ a = 52;
+ b = a + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR2, a, b, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn3)
+{
+ a = 53;
+ b = a + 1;
+ c = b + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR3, a, b, c, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn4)
+{
+ a = 54;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR4, a, b, c, d, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn5)
+{
+ a = 55;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR5, a, b, c, d, e, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn6)
+{
+ a = 56;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR6, a, b, c, d, e, f, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturn7)
+{
+ a = 57;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodR7, a, b, c, d, e, f, g, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+
+// Testing non-const void leaving methods from a class. Leave is not happening.
+
+TEST(TestFuncServer, classVoidL0)
+{
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL, fserver ));
+ CHECK(sIvokedMethod == 61);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL1)
+{
+ a = 61;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL1, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL2)
+{
+ a = 62;
+ b = a + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL2, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL3)
+{
+ a = 63;
+ b = a + 1;
+ c = b + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL3, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL4)
+{
+ a = 64;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL4, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL5)
+{
+ a = 65;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL5, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL6)
+{
+ a = 66;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL6, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidL7)
+{
+ a = 67;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodL7, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+
+// Testing non-const void leaving methods from a class. Leave is happening.
+TEST(TestFuncServer, classVoidLeavingL0)
+{
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveL, fserver ));
+ CHECK(sIvokedMethod == 71);
+ CHECK(res == -71);
+
+}
+TEST(TestFuncServer, classVoidLeavingL1)
+{
+ a = 71;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL2)
+{
+ a = 72;
+ b = a + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL3)
+{
+ a = 73;
+ b = a + 1;
+ c = b + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL4)
+{
+ a = 74;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL5)
+{
+ a = 75;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL6)
+{
+ a = 76;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingL7)
+{
+ a = 77;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeave7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+
+// Testing non-const value returning leaving methods from a class. Leave is not happening.
+
+TEST(TestFuncServer, classReturnL0)
+{
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRL, fserver ));
+ CHECK(sIvokedMethod == 81);
+ CHECK(res == 81);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL1)
+{
+ a = 81;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL2)
+{
+ a = 82;
+ b = a + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL3)
+{
+ a = 83;
+ b = a + 1;
+ c = b + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL4)
+{
+ a = 84;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL5)
+{
+ a = 85;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL6)
+{
+ a = 86;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnL7)
+{
+ a = 87;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodR7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+
+// Testing non-const value returning leaving methods from a class. Leave is happening.
+
+
+TEST(TestFuncServer, classReturnLeaveL0)
+{
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRL, fserver ));
+ CHECK(sIvokedMethod == 91);
+ CHECK(leaveRes == -91);
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL1)
+{
+ a = 91;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL2)
+{
+ a = 92;
+ b = a + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL3)
+{
+ a = 93;
+ b = a + 1;
+ c = b + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL4)
+{
+ a = 94;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL5)
+{
+ a = 95;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL6)
+{
+ a = 96;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+TEST(TestFuncServer, classReturnLeaveL7)
+{
+ a = 97;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res=123;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveR7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 123);
+}
+
+// Testing const void methods from a class.
+
+TEST(TestFuncServer, classVoidC0)
+{
+ CallMethod( clazz, TestClass::classMethodC, fserver );
+ CHECK(sIvokedMethod == 101);
+
+}
+TEST(TestFuncServer, classVoidC1)
+{
+ a = 101;
+ CallMethod( clazz, TestClass::classMethodC1, a, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC2)
+{
+ a = 102;
+ b = a + 1;
+ CallMethod( clazz, TestClass::classMethodC2, a, b, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC3)
+{
+ a = 103;
+ b = a + 1;
+ c = b + 1;
+ CallMethod( clazz, TestClass::classMethodC3, a, b, c, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC4)
+{
+ a = 104;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ CallMethod( clazz, TestClass::classMethodC4, a, b, c, d, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC5)
+{
+ a = 105;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ CallMethod( clazz, TestClass::classMethodC5, a, b, c, d, e, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC6)
+{
+ a = 106;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ CallMethod( clazz, TestClass::classMethodC6, a, b, c, d, e, f, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+TEST(TestFuncServer, classVoidC7)
+{
+ a = 107;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ CallMethod( clazz, TestClass::classMethodC7, a, b, c, d, e, f, g, fserver );
+ CHECK(sIvokedMethod == a + 1);
+
+}
+
+// Testing const methods from a class retruning a value.
+
+TEST(TestFuncServer, classReturnC0)
+{
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC, fserver );
+ CHECK(sIvokedMethod == 111);
+ CHECK(res == 111);
+
+}
+TEST(TestFuncServer, classReturnC1)
+{
+ a = 111;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC1, a, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC2)
+{
+ a = 112;
+ b = a + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC2, a, b, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC3)
+{
+ a = 113;
+ b = a + 1;
+ c = b + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC3, a, b, c, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC4)
+{
+ a = 114;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC4, a, b, c, d, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC5)
+{
+ a = 115;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC5, a, b, c, d, e, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC6)
+{
+ a = 116;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC6, a, b, c, d, e, f, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+TEST(TestFuncServer, classReturnC7)
+{
+ a = 117;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res;
+ CallMethod(res, clazz, TestClass::classMethodRC7, a, b, c, d, e, f, g, fserver );
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+
+}
+
+// Testing const leaving void methods from a class. No leave.
+
+
+TEST(TestFuncServer, classVoidCL0)
+{
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodCL, fserver ));
+ CHECK(sIvokedMethod == 121);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL1)
+{
+ a = 121;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL2)
+{
+ a = 122;
+ b = a + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL3)
+{
+ a = 123;
+ b = a + 1;
+ c = b + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL4)
+{
+ a = 124;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL5)
+{
+ a = 125;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL6)
+{
+ a = 126;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+TEST(TestFuncServer, classVoidCL7)
+{
+ a = 127;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodC7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == 0);
+
+}
+
+
+
+// Testing const leaving void methods from a class. Leaving.
+
+
+TEST(TestFuncServer, classVoidLeavingCL0)
+{
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveCL, fserver ));
+ CHECK(sIvokedMethod == 131);
+ CHECK(res == -131);
+
+}
+TEST(TestFuncServer, classVoidLeavingCL1)
+{
+ a = 131;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL2)
+{
+ a = 132;
+ b = a + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL3)
+{
+ a = 133;
+ b = a + 1;
+ c = b + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL4)
+{
+ a = 134;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL5)
+{
+ a = 135;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL6)
+{
+ a = 136;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+TEST(TestFuncServer, classVoidLeavingCL7)
+{
+ a = 137;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ TRAPD(res, CallMethodL(clazz, TestClass::classMethodWithLeaveC7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == -(a + 1));
+
+}
+
+
+
+// Testing const leaving value returning methods from a class. Not leaving.
+TEST(TestFuncServer, classReturnLC0)
+{
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRCL, fserver ));
+ CHECK(sIvokedMethod == 141);
+ CHECK(res == 141);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC1)
+{
+ a = 141;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC2)
+{
+ a = 142;
+ b = a + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC3)
+{
+ a = 143;
+ b = a + 1;
+ c = b + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC4)
+{
+ a = 144;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC5)
+{
+ a = 145;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC6)
+{
+ a = 146;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+TEST(TestFuncServer, classReturnLC7)
+{
+ a = 147;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodRC7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(res == a + 1);
+ CHECK(leaveRes == 0);
+}
+
+// Testing const leaving value returning methods from a class. Leaving.
+
+TEST(TestFuncServer, classReturnLeaveCL0)
+{
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRCL, fserver ));
+ CHECK(sIvokedMethod == 151);
+ CHECK(leaveRes == -151);
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL1)
+{
+ a = 151;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC1L, a, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL2)
+{
+ a = 152;
+ b = a + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC2L, a, b, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL3)
+{
+ a = 153;
+ b = a + 1;
+ c = b + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC3L, a, b, c, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL4)
+{
+ a = 154;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC4L, a, b, c, d, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL5)
+{
+ a = 155;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC5L, a, b, c, d, e, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL6)
+{
+ a = 156;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC6L, a, b, c, d, e, f, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+TEST(TestFuncServer, classReturnLeaveCL7)
+{
+ a = 157;
+ b = a + 1;
+ c = b + 1;
+ d = c + 1;
+ e = d + 1;
+ f = e + 1;
+ g = f + 1;
+ int res=456;
+ TRAPD(leaveRes, CallMethodL(res, clazz, TestClass::classMethodWithLeaveRC7L, a, b, c, d, e, f, g, fserver ));
+ CHECK(sIvokedMethod == a + 1);
+ CHECK(leaveRes == -(a + 1));
+ CHECK(res == 456);
+}
+
--- a/javacommons/utils/inc/javainifileutils.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/inc/javainifileutils.h Tue May 11 16:07:20 2010 +0300
@@ -65,7 +65,7 @@
private:
static FileContent readFileContent(bool create=false);
static void writeFileContent(const char* content);
- static char* getPosition(FileContent& content, const std::string& property);
+ static const char* getPosition(FileContent& content, const std::string& property);
};
--- a/javacommons/utils/inc/logger.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/inc/logger.h Tue May 11 16:07:20 2010 +0300
@@ -115,6 +115,7 @@
EDebugApi, // =34
EJavaAppMngrPlugin, // =35
EJavaBroadcast, // =36
+ EJavaAMMS, // =37
// add id of new components here
};
@@ -171,6 +172,7 @@
{"JavaDebugApi.log", "[JavaDebugApi]"}, // EDebugApi
{"JavaAppMngrPlugin.log","[JavaAppMngrPlugin]"}, // EJavaAppMngrPlugin
{"JavaBroadcast.log", "[JavaBroadcast]"}, // EJavaBroadcast
+ {"JavaMMAPI.log", "[ MMAPPI ]"}, // EJavaAMMS
// add new component file name and nickname here
};
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/rt/ui/RuntimeUi.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/rt/ui/RuntimeUi.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -21,16 +21,12 @@
import com.nokia.mj.impl.utils.Logger;
/**
- * Base class for any UI interfaces.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
+ * Base class for RuntimeUI implementation.
*/
public class RuntimeUi
{
/** Id for the log file where log entries are written. */
- private static final int LOG_ID = Logger.EJavaRuntime;
- //private static final int LOG_ID = Logger.EJavaInstaller;
+ protected static int iLogId = Logger.EJavaRuntime;
/** Identified flag. */
private boolean iIdentified = false;
@@ -111,7 +107,7 @@
*/
protected static void log(String aMsg)
{
- Logger.ILOG(LOG_ID, "RuntimeUi: " + aMsg);
+ Logger.ILOG(iLogId, "RuntimeUi: " + aMsg);
}
/**
@@ -122,6 +118,6 @@
*/
protected static void logError(String aMsg, Throwable aThrowable)
{
- Logger.ELOG(LOG_ID, "RuntimeUi: " + aMsg, aThrowable);
+ Logger.ELOG(iLogId, "RuntimeUi: " + aMsg, aThrowable);
}
}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/rt/ui/RuntimeUiFactory.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/rt/ui/RuntimeUiFactory.java Tue May 11 16:07:20 2010 +0300
@@ -21,9 +21,6 @@
/**
* Factory for RuntimeUI interfaces.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class RuntimeUiFactory
{
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/RuntimeInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.mj.impl.runtime.rtport;
-
-/**
- * Interface for getting runtime information.
- *
- * @see RuntimeInfoFactory
- */
-public interface RuntimeInfo
-{
- /**
- * Defined constant for manufacturer domain
- */
- final String MANUFACTURER_DOMAIN = "MFD";
-
- /**
- * Defined constant for identified third party domain
- */
- final String IDENTIFIED_THIRD_PARTY_DOMAIN = "ITPD";
- /**
- * Defined constant for operator domain
- */
- final String OPERATOR_DOMAIN = "OPD";
-
- /**
- * Defined constant for unidentified third party domain
- */
- final String UNIDENTIFIED_THIRD_PARTY_DOMAIN = "UTPD";
-
- /**
- * Gets the UI toolkit register for this runtime environment
- */
- public UiToolkitRegister getUiToolkitRegister();
-
- /**
- * Returns object representing current application of the caller. The
- * meaning of "current application" is specific to the runtime used
- * (e.g. MIDlets, OSGi).
- *
- * The object has correct hashCode and equals method implementations to
- * support usage as Hashtable key. The Id returned for different
- * applications is unique within the same JVM process.
- *
- * The caller should not keep reference to the value after the application
- * has been closed.
- *
- * @return Object representing current application
- */
- public Object getApplicationId();
-
- /**
- * Returns the UID of the caller, or -1 if no UID is associated.
- *
- * @return UID of the caller, or -1 if no UID is associated
- */
- public int getApplicationUid();
-
- /**
- * Returns protection domain of current application as String.
- *
- * Currently there are four defined domains
- *
- * @see #MANUFACTURER_DOMAIN
- * @see #IDENTIFIED_THIRD_PARTY_DOMAIN
- * @see #OPERATOR_DOMAIN
- * @see #UNIDENTIFIED_THIRD_PARTY_DOMAIN
- *
- * @return protection domain as String
- */
- public String getApplicationDomain();
-
- /**
- * Notifies the runtime that exit command has been received.
- * It is runtime's responsibility to ensure that the application
- * exits surely.
- *
- * @param aUid UID of the application to be closed.
- */
- public void notifyExitCmd(int aUid);
-
-}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/RuntimeInfoFactory.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.mj.impl.runtime.rtport;
-
-/**
- * Factory to get the RuntimeInfo implementation.
- *
- * The RuntimeInfo implementation class is searched and dynamically loaded
- * based on the value of "nokia.rt.port" system property.
- *
- * The class named "com.nokia.mj.impl.runtime.rtport.<value>.RuntimeInfoImpl"
- * is tried to be loaded first, and if that is not found the value is tried to
- * be used as a full class name.
- *
- * If the system property does not exist, then the default value "midp" is used.
- */
-public class RuntimeInfoFactory
-{
- /** RuntimeInfo instance */
- private static RuntimeInfo sInstance = new RuntimeInfoImpl();
-
- /**
- * Returns the RuntimeInfo
- *
- * @return RuntimeInfo
- */
- public static RuntimeInfo getRuntimeInfo()
- {
- return sInstance;
- }
-}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/RuntimeInfoImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.mj.impl.runtime.rtport;
-
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
-import com.nokia.mj.impl.rt.support.ApplicationUtils;
-
-import com.nokia.mj.impl.utils.Logger;
-import com.nokia.mj.impl.utils.Uid;
-
-public class RuntimeInfoImpl implements RuntimeInfo
-{
-
- UiToolkitRegisterImpl tk = new UiToolkitRegisterImpl();
-
- public UiToolkitRegister getUiToolkitRegister()
- {
- return tk;
- }
-
- public Object getApplicationId()
- {
-// return ApplicationInfo.getInstance().getName();
- return this;
- }
-
- public int getApplicationUid()
- {
- try
- {
- String u = ApplicationInfo.getInstance().getUid().getStringValue();
- return Integer.parseInt(u.substring(1,u.length()-1), 16);
- }
- catch (Throwable t)
- {
- }
- return 0x2001843A; // The JavaInstaller uid.
- }
-
- public String getApplicationDomain()
- {
- try
- {
- return ApplicationInfo.getInstance().getProtectionDomain();
- }
- catch (Throwable t)
- {
- }
- return RuntimeInfo.MANUFACTURER_DOMAIN;
- }
-
- public void notifyExitCmd(int aUid)
- {
- try
- {
- ApplicationUtils.getInstance().notifyExitCmd();
- }
- catch (Throwable t)
- {
- Logger.ELOG(Logger.EUtils,
- "RuntimeInfoImpl.notifyExitCmd(): Failed",
- t);
- }
- }
-}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/UiToolkitRegister.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.mj.impl.runtime.rtport;
-
-/**
- * Common interface to UI Toolkit Register implementations.
- */
-public interface UiToolkitRegister
-{
- /**
- * Registers given UI toolkit for current application.
- *
- * @param toolkitId ID of the toolkit
- * @throws RuntimeException if given toolkit cannot be registered
- * for current application.
- */
- public void registerUiToolkit(String toolkitId);
-
- /**
- * Clears the registered UI toolkit associated with current application.
- *
- * After this it is possible to register another UI toolkit.
- * It is OK to call this even if a toolkit has not been registered.
- *
- * @param toolkitId ID of the toolkit to unregister
- */
- public void unregisterUiToolkit(String toolkitId);
-
- /**
- * Provides the names of the registered allowed toolkits.
- *
- * @return IDs of the allowed UI toolkits, or empty array if no toolkit
- * has not yet been registered.
- */
- public String[] getRegisteredUiToolkits();
-
- /**
- * Returns true if UI toolkit is foreground.
- *
- * @return true if toolkit is foreground. If toolkit has not set the value,
- * false is returned.
- */
- public boolean isToolkitForeground();
-
- /**
- * Changes the value to be returned from isToolkitForeground.
- *
- * @param foreground true if switched to foreground
- */
- public void setToolkitForeground(boolean foreground);
-}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/runtime/rtport/UiToolkitRegisterImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.mj.impl.runtime.rtport;
-
-import com.nokia.mj.impl.rt.legacy.LegacySupport;
-
-/**
- * Common interface to UI Toolkit Register implementations.
- */
-public class UiToolkitRegisterImpl implements UiToolkitRegister
-{
- private String mRegisteredToolkit;
- private String[] mRegisteredToolkits;
-
- public void registerUiToolkit(String toolkitId)
- {
- if (mRegisteredToolkit != null)
- {
- throw new RuntimeException("Could not register toolkit: "+toolkitId);
- }
- mRegisteredToolkit = toolkitId;
- mRegisteredToolkits = new String[1];
- mRegisteredToolkits[0] = mRegisteredToolkit;
- }
-
- public void unregisterUiToolkit(String toolkitId)
- {
- if (mRegisteredToolkit != null && mRegisteredToolkit.equals(toolkitId))
- {
- mRegisteredToolkit = null;
- mRegisteredToolkits = null;
- }
- }
-
- public String[] getRegisteredUiToolkits()
- {
- if (mRegisteredToolkits == null)
- {
- return new String[0];
- }
- return mRegisteredToolkits;
- }
-
- /**
- * Returns true if UI toolkit is foreground.
- *
- * @return true if toolkit is foreground. If toolkit has not set the value,
- * false is returned.
- */
- public boolean isToolkitForeground()
- {
- return false;
- }
-
- /**
- * Changes the value to be returned from isToolkitForeground.
- *
- * @param foreground true if switched to foreground
- */
- public void setToolkitForeground(boolean foreground)
- {
- // Stop the start screen if exists.
- }
-}
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Base64.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Base64.java Tue May 11 16:07:20 2010 +0300
@@ -17,6 +17,10 @@
package com.nokia.mj.impl.utils;
+/**
+ * Base64 utility class originated from the public domain:
+ * see http://iharder.sourceforge.net/current/java/base64/
+ */
public class Base64
{
private final static byte[] ENCODE_ALPHABET =
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java Tue May 11 16:07:20 2010 +0300
@@ -299,7 +299,7 @@
/**
* Replace first occurrence of the string pattern in the replaced field.
- * Replace only [NN] defined amount of characters.
+ * Replace [N...N] defined amount of characters.
*
* @param pattern string to search for
* @param replacement string to replace patterns
@@ -310,11 +310,10 @@
private boolean replaceWithMax(String pattern, String replacement, int maxIndex)
{
boolean result = false;
- int closingIndex = maxIndex + pattern.length() + 3;
+ int closingIndex = replaced.indexOf("]", maxIndex + pattern.length());
- // Check format [NN] comply. If not skip.
- if (replaced.length() > closingIndex
- && replaced.charAt(closingIndex) == ']')
+ // Check format [N...N] comply. If not skip.
+ if (closingIndex > 0)
{
try
{
@@ -328,7 +327,7 @@
replaced = replaced.substring(0, maxIndex) +
replacement.substring(0, maxLen) +
- replaced.substring(maxIndex + pattern.length() + 4);
+ replaced.substring(closingIndex + 1);
result = true;
}
catch (NumberFormatException nfe)
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java Tue May 11 16:07:20 2010 +0300
@@ -80,6 +80,7 @@
public static final int EDebugApi = 34;
public static final int EJavaAppMngrPlugin = 35;
public static final int EJavaBroadcast = 36;
+ public static final int EJavaAMMS = 37;
// add name of new components here
@@ -136,6 +137,7 @@
false, //EDebugApi = 34;
false, //EJavaAppMngrPlugin = 35;
false, //EJavaBroadcast = 36;
+ false, //EJavaAMMS = 37;
// add new components here
};
--- a/javacommons/utils/src.s60/properties.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/src.s60/properties.cpp Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -15,7 +15,6 @@
*
*/
-
#include <memory>
#include <jni.h>
#include <f32file.h>
@@ -24,19 +23,6 @@
#include <sysutil.h>
#include <hal.h>
-#ifdef RD_JAVA_UI_QT
-
-#include <QLocale>
-
-#else // RD_JAVA_UI_QT
-
-#include <bautils.h>
-#include <barsc.h>
-#include <avkon.rsg>
-#include <AknUtils.h>
-
-#endif // RD_JAVA_UI_QT
-
#include "javaenvinfo.h"
#include "commonproperties.h"
#include "javacommonutils.h"
@@ -46,14 +32,6 @@
using namespace java::util;
-jstring getS60LocaleL(JNIEnv* env);
-
-#ifndef RD_JAVA_UI_QT
-
-HBufC* getS60LocaleTempImplL();
-
-#endif // RD_JAVA_UI_QT
-
HBufC* MicroEditionPlatformL();
TInt getHardwareVersionL(TDes& aHardwareType);
@@ -64,57 +42,244 @@
_LIT(KMicroeditionPlatformVersion, "sw_platform_version=");
_LIT(KMicroeditionPlatformJavaVersion, "java_build_version=");
+_LIT(KMicroeditionLocaleAfrikaans, "af-ZA");
+_LIT(KMicroeditionLocaleAlbanian, "sq-SQ");
+_LIT(KMicroeditionLocaleArabic, "ar");
+_LIT(KMicroeditionLocaleBasque, "eu");
+_LIT(KMicroeditionLocaleIndonesian, "id-ID");
+_LIT(KMicroeditionLocaleMalay, "ms-MY");
+_LIT(KMicroeditionLocaleBulgarian, "bg-BG");
+_LIT(KMicroeditionLocaleCatalan, "ca");
+_LIT(KMicroeditionLocalePrcChinese, "zh-CN");
+_LIT(KMicroeditionLocaleHongKongChinese, "zh-HK");
+_LIT(KMicroeditionLocaleTaiwanChinese, "zh-TW");
+_LIT(KMicroeditionLocaleCroatian, "hr-HR");
+_LIT(KMicroeditionLocaleCzech, "cs-CZ");
+_LIT(KMicroeditionLocaleDanish, "da-DK");
+_LIT(KMicroeditionLocaleDutch, "nl-NL");
+_LIT(KMicroeditionLocaleEnglish, "en");
+_LIT(KMicroeditionLocaleAmerican, "en-US");
+_LIT(KMicroeditionLocaleEstonian, "et-EE");
+_LIT(KMicroeditionLocaleFarsi, "fa");
+_LIT(KMicroeditionLocaleFinnish, "fi-FI");
+_LIT(KMicroeditionLocaleFrench, "fr");
+_LIT(KMicroeditionLocaleCanadianFrench, "fr-CA");
+_LIT(KMicroeditionLocaleGalician, "gl");
+_LIT(KMicroeditionLocaleGerman, "de");
+_LIT(KMicroeditionLocaleGreek, "el-GR");
+_LIT(KMicroeditionLocaleHebrew, "he-IL");
+_LIT(KMicroeditionLocaleHindi, "hi-IN");
+_LIT(KMicroeditionLocaleMarathi, "mr-IN");
+_LIT(KMicroeditionLocaleHungarian, "hu-HU");
+_LIT(KMicroeditionLocaleIcelandic, "is-IS");
+_LIT(KMicroeditionLocaleItalian, "it");
+_LIT(KMicroeditionLocaleJapanese, "ja-JP");
+_LIT(KMicroeditionLocaleKorean, "ko-KR");
+_LIT(KMicroeditionLocaleLatvian, "lv-LV");
+_LIT(KMicroeditionLocaleLithuanian, "lt-LT");
+_LIT(KMicroeditionLocaleNorwegian, "no-NO");
+_LIT(KMicroeditionLocalePolish, "pl-PL");
+_LIT(KMicroeditionLocalePortuguese, "pt-PT");
+_LIT(KMicroeditionLocaleBrazilianPortuguese, "pt-BR");
+_LIT(KMicroeditionLocaleRomanian, "ro-RO");
+_LIT(KMicroeditionLocaleRussian, "ru-RU");
+_LIT(KMicroeditionLocaleSerbian, "sr-YU");
+_LIT(KMicroeditionLocaleSlovak, "sk-SK");
+_LIT(KMicroeditionLocaleSlovenian, "sl-SI");
+_LIT(KMicroeditionLocaleSpanish, "es-ES");
+_LIT(KMicroeditionLocaleLatinAmericanSpanish, "es-US");
+_LIT(KMicroeditionLocaleSwahili, "sw");
+_LIT(KMicroeditionLocaleSwedish, "sv");
+_LIT(KMicroeditionLocaleTagalog, "tl-PH");
+_LIT(KMicroeditionLocaleThai, "th-TH");
+_LIT(KMicroeditionLocaleTurkish, "tr-TR");
+_LIT(KMicroeditionLocaleUkrainian, "uk-UA");
+_LIT(KMicroeditionLocaleUrdu, "ur");
+_LIT(KMicroeditionLocaleVietnamese, "vi-VN");
+_LIT(KMicroeditionLocaleZulu, "zu");
+
jstring java::util::getLocaleImpl(JNIEnv* env)
{
JELOG2(EUtils);
-#ifdef RD_JAVA_UI_QT
+ // microedition.locale
+ switch (User::Language()) {
+ case ELangAfrikaans:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleAfrikaans);
+ case ELangAlbanian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleAlbanian);
+
+ case ELangArabic:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleArabic);
+
+#if defined (__S60_50__)
+ case 327: // Indonesian in Asia-Pacific regions = 327
+#else
+ case ELangIndonesian_Apac:
+#endif
+
+ case ELangIndonesian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleIndonesian);
- QString localeName = QLocale::system().name();
+ case ELangMalay_Apac:
+ case ELangMalay:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleMalay);
+
+ case ELangBasque:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleBasque);
+
+ case ELangBulgarian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleBulgarian);
+
+ case ELangCatalan:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleCatalan);
+
+ case ELangPrcChinese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocalePrcChinese);
+
+ case ELangHongKongChinese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleHongKongChinese);
+
+ case ELangTaiwanChinese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleTaiwanChinese);
- jstring loc = env->NewString(localeName.utf16(), localeName.size());
- if (!loc)
- {
- std::bad_alloc();
- }
- return loc;
+ case ELangCroatian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleCroatian);
+
+ case ELangCzech:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleCzech);
+
+ case ELangDanish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleDanish);
+
+ case ELangDutch:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleDutch);
+
+ case ELangEnglish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleEnglish);
+
+ case ELangAmerican:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleAmerican);
+
+ case ELangEstonian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleEstonian);
+
+ case ELangFarsi:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleFarsi);
+
+ case ELangFinnish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleFinnish);
+
+ case ELangFrench:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleFrench);
+
+ case ELangCanadianFrench:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleCanadianFrench);
+
+ case ELangGalician:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleGalician);
+
+ case ELangGerman:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleGerman);
+
+ case ELangGreek:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleGreek);
+
+ case ELangHebrew:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleHebrew);
-#else // RD_JAVA_UI_QT
- jstring loc = 0;
- HBufC* buf = 0;
- bool usingTempSolution = false;
- TRAPD(err, buf = AknLangUtils::DisplayLanguageTagL());
- if (buf == 0 && err == KErrNotSupported)
- {
- //At the moment DisplayLanguageTagL must be called from
- //UI thread. Once this is fixed by the Avkon, we must
- //use temporary solution.
- usingTempSolution = true;
- TRAP(err, buf = getS60LocaleTempImplL());
+ case ELangHindi:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleHindi);
+
+ case ELangHungarian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleHungarian);
+
+ case ELangIcelandic:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleIcelandic);
+
+ case ELangItalian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleItalian);
+
+ case ELangJapanese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleJapanese);
+
+ case ELangKorean:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleKorean);
+
+ case ELangLatvian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleLatvian);
+
+ case ELangLithuanian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleLithuanian);
+
+ case ELangMarathi:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleMarathi);
+
+ case ELangNorwegian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleNorwegian);
+
+ case ELangPolish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocalePolish);
+
+ case ELangPortuguese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocalePortuguese);
+
+ case ELangBrazilianPortuguese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleBrazilianPortuguese);
+
+ case ELangRomanian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleRomanian);
+
+ case ELangRussian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleRussian);
+
+ case ELangSerbian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSerbian);
+
+ case ELangSlovak:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSlovak);
+
+ case ELangSlovenian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSlovenian);
+
+ case ELangSpanish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSpanish);
+
+ case ELangLatinAmericanSpanish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleLatinAmericanSpanish);
+
+ case ELangSwahili:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSwahili);
+
+ case ELangSwedish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleSwedish);
+
+ case ELangTagalog:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleTagalog);
+
+ case ELangThai:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleThai);
+
+ case ELangTurkish:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleTurkish);
+
+ case ELangUkrainian:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleUkrainian);
+
+ case ELangUrdu:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleUrdu);
+
+ case ELangVietnamese:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleVietnamese);
+
+ case ELangZulu:
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleZulu);
}
- if (buf == 0)
- {
- std::string errorStr = "Could not solve locale when using ";
- if (usingTempSolution)
- {
- errorStr.append("temp");
- }
- else
- {
- errorStr.append("original");
- }
- errorStr.append(" solution. Leave code = ");
- errorStr.append(JavaCommonUtils::intToString(err));
- throw ExceptionBase(errorStr,
- __FILE__,__FUNCTION__,__LINE__);
- }
- const jchar* stringPtr = buf->Ptr();
- const jsize stringLength = buf->Length();
- loc = env->NewString(stringPtr, stringLength);
- delete buf;
- return loc;
-#endif // RD_JAVA_UI_QT
+ // According to MIDP2.0 spec the locale property, if not null, MUST
+ // consist of the language and MAY optionally also contain the country
+ // code, and variant separated by -
+ return S60CommonUtils::NativeToJavaString(*env, KMicroeditionLocaleEnglish);
}
jstring java::util::getPlatformImpl(JNIEnv* aEnv)
@@ -133,31 +298,6 @@
return platform;
}
-#ifndef RD_JAVA_UI_QT
-
-HBufC* getS60LocaleTempImplL()
-{
- JELOG2(EUtils);
- _LIT(KFileName, "z:\\resource\\avkon.rsc");
- TFileName fileName(KFileName);
- RFs iRFs;
- CleanupClosePushL(iRFs);
- User::LeaveIfError(iRFs.Connect());
- BaflUtils::NearestLanguageFile(iRFs, fileName);
- RResourceFile resourceFile;
- CleanupClosePushL(resourceFile);
- resourceFile.OpenL(iRFs, fileName);
- resourceFile.ConfirmSignatureL(0);
- HBufC8* textBuf8 = resourceFile.AllocReadLC(R_QTN_LANGUAGE_RFC3066_TAG);
- const TPtrC16 ptrBuf8((TText16*) textBuf8->Ptr(), (textBuf8->Length() + 1) >> 1);
- HBufC16* tag = ptrBuf8.AllocL();
- CleanupStack::PopAndDestroy(3);
- return tag;
-
-}
-
-#endif // RD_JAVA_UI_QT
-
HBufC* GetPlatformVersionL()
{
VersionInfo::TPlatformVersion platformVersion;
--- a/javacommons/utils/src/javainifileutils.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/src/javainifileutils.cpp Tue May 11 16:07:20 2010 +0300
@@ -19,8 +19,8 @@
#include <iostream>
#include <sstream>
#include <vector>
-
#include <string.h>
+#include <cstdio>
#include "logger.h"
#include "javainifileutils.h"
@@ -118,12 +118,12 @@
#endif // RD_JAVA_INI_FILE_ACCESS_IN_USE
-char* JavaIniFileUtils::getPosition(FileContent& content, const std::string& property)
+const char* JavaIniFileUtils::getPosition(FileContent& content, const std::string& property)
{
const char* data = content.getContent();
if (data)
{
- char* position = strstr(data, property.c_str());
+ const char* position = strstr(data, property.c_str());
if (position)
{
position += property.length()+2;
--- a/javacommons/utils/src/monitor.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/src/monitor.cpp Tue May 11 16:07:20 2010 +0300
@@ -97,7 +97,7 @@
currentTimeVal.tv_usec * 1000 + (timeOut % 1000) * 1000 * 1000;
int err = pthread_cond_timedwait(&mCondVar, &mMutex, &timeOutTime);
- if (err != ETIMEDOUT)
+ if (err != 0 && err != ETIMEDOUT)
{
ELOG1(EUtils, "Monitor: Timed wait failed, err = %d", err);
}
--- a/javacommons/utils/tsrc/localisation/javasrc/com/nokia/mj/test/utils/LocalisationTest.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javacommons/utils/tsrc/localisation/javasrc/com/nokia/mj/test/utils/LocalisationTest.java Tue May 11 16:07:20 2010 +0300
@@ -180,14 +180,14 @@
"Test %U[20",
new Formatter("Test %U[20").arg("testMyTest").toString());
- // Test %U[300] Skip
+ // Test %U[300]
assertEquals(
- "Test %U[300]",
+ "Test testMyTest",
new Formatter("Test %U[300]").arg("testMyTest").toString());
- // Test %U[8] Skip
+ // Test %U[8]
assertEquals(
- "Test %U[8]",
+ "Test testMyTe",
new Formatter("Test %U[8]").arg("testMyTest").toString());
// Test Max is higher than actual string. Expected output: whole string no padding.
--- a/javaextensions/bluetooth/bluecove/build/javabluecove_0x2002DC97.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluecove/build/javabluecove_0x2002DC97.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -76,6 +75,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons_0x2002DC99.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons_0x2002DC99.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -111,6 +110,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/bluetoothcommons/inc.s60/bluetoothclientconnection.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/inc.s60/bluetoothclientconnection.h Tue May 11 16:07:20 2010 +0300
@@ -73,8 +73,8 @@
* connection open, all we do here is to add the object to Active Scheduler.
*/
OS_IMPORT
- void BluetoothClientConnection::initialize(int protocol,
- TInt64 aRemoteAddr, int aReceiveMtu, int aTransmitMtu);
+ void initialize(int protocol, TInt64 aRemoteAddr,
+ int aReceiveMtu, int aTransmitMtu);
/**
* Used to Initialize the protocol specific options of the Bluetooth Socket.
--- a/javaextensions/bluetooth/bluetoothplugins/btgoeppushplugin/build/javabtgoepscplugin_0x2002DC9A.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btgoeppushplugin/build/javabtgoepscplugin_0x2002DC9A.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -94,6 +93,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/bluetoothplugins/btjavacaptainplugin/build/javacaptain_ext_btdeviceclassmanager_0x2002DC9D.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btjavacaptainplugin/build/javacaptain_ext_btdeviceclassmanager_0x2002DC9D.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -88,6 +87,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/build/javabtl2capscplugin_0x2002DC9B.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/build/javabtl2capscplugin_0x2002DC9B.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -96,6 +95,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/build/javabtsppscplugin_0x2002DC9C.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/build/javabtsppscplugin_0x2002DC9C.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -96,6 +95,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/bluetooth/omjbluetooth/build/javabluetooth_0x2002DC98.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/bluetooth/omjbluetooth/build/javabluetooth_0x2002DC98.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -102,6 +101,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/broadcast_stub/build/build.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/broadcast_stub/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -43,6 +43,9 @@
javax/microedition/broadcast/connection/BroadcastConnectionListener.class,
javax/microedition/broadcast/connection/BroadcastDatagramConnection.class,
javax/microedition/broadcast/connection/BroadcastFileConnection.class,
+ javax/microedition/broadcast/control/NTPTimeControl.class,
+ javax/microedition/broadcast/control/TimeShiftControl.class,
+ javax/microedition/broadcast/control/TimerEventsControl.class,
javax/microedition/broadcast/esg/Attribute.class,
javax/microedition/broadcast/esg/BooleanAttribute.class,
javax/microedition/broadcast/esg/CommonMetadataSet.class,
--- a/javaextensions/broadcast_stub/build/javabroadcast_0x2002DCE0.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/broadcast_stub/build/javabroadcast_0x2002DCE0.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -75,6 +74,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/comm/build/javacomm_0x2002DCA5.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/comm/build/javacomm_0x2002DCA5.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -90,6 +89,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/datagram/datagram/build/javadatagram_0x2002DCA9.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/datagram/datagram/build/javadatagram_0x2002DCA9.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -88,6 +87,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/datagram/serverconnection/build/javadatagramscplugin_0x2002DCAA.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/datagram/serverconnection/build/javadatagramscplugin_0x2002DCAA.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/globalindicators/build/javaglobalindicators_0x2002DCAF.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/globalindicators/build/javaglobalindicators_0x2002DCAF.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/iapinfo/build/javaiapinfo_0x2002DCB3.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/iapinfo/build/javaiapinfo_0x2002DCB3.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfoImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/IAPInfoImpl.java Tue May 11 16:07:20 2010 +0300
@@ -31,8 +31,6 @@
/**
* Implementation class of the APNInfo interface
- *
- * @version 0.1 First version of the implementation.
*/
class IAPInfoImpl extends IAPInfo
{
--- a/javaextensions/location/build/javalocation_0x2002DCBC.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/build/javalocation_0x2002DCBC.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -130,6 +129,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/location/common/inc/cleanupresetanddestroy.h Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Cleanup Stack "reset and destroy" push operation.
- *
-*/
-
-
-#ifndef CLEANUPRESETANDDESTROY_H
-#define CLEANUPRESETANDDESTROY_H
-
-// INCLUDE FILES
-#include <e32base.h>
-
-/**
- * An operation for pushing objects to cleanup stack with \c TCleanupItems
- * that will perform a \c ResetAndDestroy() operation on the pushed object
- * if a leave occurs.
- *
- * Note that the object itself will not be deleted.
- *
- * @par Example:
- * Here is an example of using \c CleanupResetAndDestroy with a dynamically
- * allocated \c RPointerArray. \c RPointerArray clears its contents with a
- * \cResetAndDestroy() operation.
- * @code
- *
- * // A function which creates a pointer array with couple of initialized
- * // CThings. The function must return a pointer to the pointer array,
- * // because the array has to be allocated dynamically. CThing is some
- * // simple CBase-derived class.
- *
- * RPointerArray< CThing >* CreateThingArrayL( )
- * {
- * // Create an array of pointers to CThings with granularity of 4
- *
- * RPointerArray< CThing >* things =
- * new( ELeave ) RPointerArray< CThing >( 4 );
- *
- * // Push pointer to the array to the cleanup stack; then push reference
- * // to the array and a ResetAndDestroy operation to the cleanup stack.
- *
- * // (Note that order of these operations matters: the ResetAndDestroy
- * // operation must be performed before the array itself is deleted.)
- *
- * CleanupStack::PushL( things );
- * CleanupResetAndDestroyPushL( *things );
- *
- * // Add couple of CThings with magic numbers to the array.
- * // If any of the NewL() operations leaves, the array will be cleared
- * // with ResetAndDestroy() and the array itself will destroyed.
- *
- * User::LeaveIfError( things->Append( CThing::NewL( 7 ) ) );
- * User::LeaveIfError( things->Append( CThing::NewL( 96 ) ) );
- * User::LeaveIfError( things->Append( CThing::NewL( 999 ) ) );
- *
- * // Pop the array reference with ResetAndDestroy from cleanup stack;
- * // then pop the pointer to the array itself.
- *
- * CleanupStack::Pop(); // *things
- * CleanupStack::Pop(); // things
- *
- * // Now we're ready to return the results (a pointer to the array)
- * return things;
- * }
- *
- * @endcode
- */
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef);
-
-/**
- * <em>See \ref CleanupResetAndDestroyPushL() documentation.</em>
- */
-template<class T>
-class CleanupResetAndDestroy
-{
-public:
- inline static void PushL(T& aRef);
-
-private:
- static void ResetAndDestroy(TAny *aPtr);
-};
-
-template<class T>
-inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
-{
- CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));
-}
-
-template<class T>
-void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
-{
- static_cast<T*>(aPtr)->ResetAndDestroy();
-}
-
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef)
-{
- CleanupResetAndDestroy<T>::PushL(aRef);
-}
-
-#endif // CLEANUPRESETANDDESTROY_H
-// End of File
--- a/javaextensions/location/common/src/lapijnicommon.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/common/src/lapijnicommon.cpp Tue May 11 16:07:20 2010 +0300
@@ -19,7 +19,7 @@
// INTERNAL INCLUDES
#include "lapijnicommon.h"
#include "clapilandmark.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "lapipanics.h"
#include "jstringutils.h"
#include "s60commonutils.h"
--- a/javaextensions/location/landmarks/src/clapilandmarkstore.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/landmarks/src/clapilandmarkstore.cpp Tue May 11 16:07:20 2010 +0300
@@ -23,7 +23,7 @@
#include "clapilandmarksearchfactory.h"
#include "clapilandmark.h"
#include "tlapisearchcriteria.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "lapipanics.h"
#include "logger.h"
--- a/javaextensions/location/landmarks/src/landmark.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/landmarks/src/landmark.cpp Tue May 11 16:07:20 2010 +0300
@@ -24,7 +24,7 @@
#include "logger.h"
#include "clapilandmark.h"
#include "clapiaddressinfo.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "locationfunctionserver.h"
using namespace java::location;
--- a/javaextensions/location/orientation/inc/corientation.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/orientation/inc/corientation.h Tue May 11 16:07:20 2010 +0300
@@ -34,7 +34,7 @@
{
namespace location
{
-
+// re arrange this header file to have more readable format
class COrientation: public CBase, public MSensrvDataListener
{
public:
@@ -44,6 +44,9 @@
// Channel Info
TSensrvChannelInfo ichannelInfo;
+
+ // Location Function Server
+ LocationFunctionServer* mFunctionServer;
public:
// Constructors and destructor
@@ -79,13 +82,9 @@
/**
* Opens the Channel and Starts the Data Listening
- * @return Error number which indicates either sucess or failure
+ * @return
*/
- TInt GetOrientationL();
-
-public:
- // Location Function Server
- LocationFunctionServer* mFunctionServer;
+ void GetOrientationL();
private:
// new methods
@@ -93,7 +92,7 @@
/**
* Opens the the Channel
*/
- TInt OpenChannel();
+ void OpenChannelL();
/**
* Creates the Channel Finder
@@ -108,13 +107,10 @@
/**
* Checks the hardware caliberation
*/
- TInt CheckCalibration();
+ void CheckCalibrationL();
private:
- // JNI Environment Data
- JNIEnv* mJni;
- jobject mPeer;
jclass iOrientationClass;
// Azimuth Data Callback JNI Method ID
--- a/javaextensions/location/orientation/src/corientation.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/orientation/src/corientation.cpp Tue May 11 16:07:20 2010 +0300
@@ -48,7 +48,6 @@
//
void COrientation::NewL(TInt* aHandle)
{
- // CallMethodL(new(ELeave) COrientation(), aserver);
COrientation* self = new(ELeave) COrientation();
*aHandle = reinterpret_cast<TInt>(self);
}
@@ -59,7 +58,7 @@
//
COrientation::~COrientation()
{
- if (iXYZChannel)
+ if (iXYZChannel)
{
delete iXYZChannel;
iXYZChannel = NULL;
@@ -79,105 +78,58 @@
// COrientation::GetOrientation
// ---------------------------------------------------------------------------
//
-TInt COrientation::GetOrientationL()
+void COrientation::GetOrientationL()
{
- mJni = mFunctionServer->getValidJniEnv();
- mPeer = mFunctionServer->getPeer();
-
+
iOrientationClass =
- mJni->FindClass("javax/microedition/location/Orientation");
+ (mFunctionServer->getValidJniEnv())->FindClass(
+ "javax/microedition/location/Orientation");
//Get Method ID of Azimuth Data Callback
- mAzimuthDataMethod = mJni->GetStaticMethodID(iOrientationClass,
- "AzimuthDataCallBack",
- "(I)V");
+ mAzimuthDataMethod = (mFunctionServer->getValidJniEnv())->GetStaticMethodID(
+ iOrientationClass,
+ "AzimuthDataCallBack",
+ "(I)V");
//Check if all the JNI inits have succeeded
if (NULL == mAzimuthDataMethod)
{
- return KErrGeneral;
+ User::Leave( KErrGeneral);
}
- TInt Err = KErrNone;
- TInt result = this->OpenChannel();
-
- if (result == KErrNone)
- {
- TInt CalibErr = CheckCalibration();
-
- if (CalibErr < KErrNone)
- {
- return CalibErr;
- }
+ OpenChannelL();
- TRAP(Err, iXYZChannel->StartDataListeningL(this, 1, 1, 0));
+ CheckCalibrationL();
- if (Err == KErrNotFound)
- {
- return Err;
- }
- else if (Err == KErrAlreadyExists)
- {
- return Err;
- }
- }
+ iXYZChannel->StartDataListeningL(this, 1, 1, 0);
- return result;
}
// ---------------------------------------------------------------------------
// COrientation::OpenChannel
// ---------------------------------------------------------------------------
//
-TInt COrientation::OpenChannel()
+void COrientation::OpenChannelL()
{
- TInt ChnlFindErr = 0;
- TRAP(ChnlFindErr, this->CreateChannelFinderL());
-
- if (ChnlFindErr < 0)
- {
- return ChnlFindErr;
- }
+ CreateChannelFinderL();
iChannelInfoList.Reset();
- TInt FindErr = 0;
- TRAP(FindErr, iChannelFinder->FindChannelsL(iChannelInfoList,
- ichannelInfo));
-
- if (FindErr < KErrNone)
+ iChannelFinder->FindChannelsL(iChannelInfoList,
+ ichannelInfo);
+
+ if (iChannelInfoList.Count() != 1)
{
- return FindErr;
- }
-
- else if (iChannelInfoList.Count() != 1)
- {
- return ERROR;
+ User::Leave( ERROR);
}
else
{
- TInt SensChanlErr = 0;
- TRAP(SensChanlErr, this->CreateSensorChannelL());
-
- if (SensChanlErr < 0)
- {
- return SensChanlErr;
- }
-
- TInt err = 0;
- TRAP(err, iXYZChannel->OpenChannelL());
+
+ CreateSensorChannelL();
- if (err == KErrNotFound)
- {
- return err;
- }
- else if (err == KErrAlreadyExists)
- {
- return err;
- }
+ iXYZChannel->OpenChannelL();
+
}
-
- return KErrNone;
}
// ---------------------------------------------------------------------------
@@ -207,9 +159,8 @@
iXYZChannel->StopDataListening();
iXYZChannel->CloseChannel();
- mJni = mFunctionServer->getValidJniEnv();
-
- (*mJni).CallStaticVoidMethod(iOrientationClass, mAzimuthDataMethod, err);
+ (mFunctionServer->getValidJniEnv())->CallStaticVoidMethod(
+ iOrientationClass, mAzimuthDataMethod, err);
}
}
@@ -227,12 +178,12 @@
iXYZChannel->StopDataListening();
iXYZChannel->CloseChannel();
- mJni = mFunctionServer->getValidJniEnv();
-
if (info.iChannelType == KSensrvChannelTypeIdMagneticNorthData)
{
- (*mJni).CallStaticVoidMethod(iOrientationClass,
- mAzimuthDataMethod, aError);
+ (mFunctionServer->getValidJniEnv())->CallStaticVoidMethod(
+ iOrientationClass,
+ mAzimuthDataMethod,
+ aError);
}
}
@@ -281,28 +232,21 @@
// COrientation::CheckCalibration
// ---------------------------------------------------------------------------
//
-TInt COrientation::CheckCalibration()
+void COrientation::CheckCalibrationL()
{
TSensrvProperty property;
TInt value(0);
TInt maxValue(0);
- TInt LeaveError(KErrNone);
- TRAP(LeaveError, iXYZChannel->GetPropertyL(KSensrvPropCalibrationLevel,
- KSensrvItemIndexNone, property));
-
- if (LeaveError < KErrNone)
- {
- return LeaveError;
- }
+ iXYZChannel->GetPropertyL(KSensrvPropCalibrationLevel,
+ KSensrvItemIndexNone, property);
property.GetValue(value);
property.GetMaxValue(maxValue);
if (value != maxValue)
{
- return CALIBRATIONERROR;
+ User::Leave( CALIBRATIONERROR);
}
- return KErrNone;
}
--- a/javaextensions/location/orientation/src/orientation.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/location/orientation/src/orientation.cpp Tue May 11 16:07:20 2010 +0300
@@ -73,14 +73,9 @@
KSensrvChannelTypeIdMagneticNorthData;
Orientation->mFunctionServer = server;
- TInt error = KErrNone;
- TRAPD(err,CallMethodL(error, Orientation,&COrientation::GetOrientationL,server));
- if (error < KErrNone)
- {
- err = error;
- }
-
+ TRAPD(err,CallMethodL( Orientation,&COrientation::GetOrientationL,server));
+
return err;
}
--- a/javaextensions/midppush/build/javapushregistry_0x2002DCC9.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midppush/build/javapushregistry_0x2002DCC9.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/midppush/pushcontroller/build/javapushcontroller_0x2002DCC8.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midppush/pushcontroller/build/javapushcontroller_0x2002DCC8.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -90,6 +89,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/midppush/pushcontroller/src/pushserverconnpluginmanager.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midppush/pushcontroller/src/pushserverconnpluginmanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -367,7 +367,7 @@
std::string dllNameStr(PREFIX_OF_SRV_CONN_PLUGIN);
dllNameStr.append(schemeStr);
dllNameStr.append(SUFFIX_OF_SRV_CONN_PLUGIN);
- WLOG1(EJavaPush,"Name of the loaded dll: %s",dllNameStr.c_str());
+ ILOG1(EJavaPush,"Name of the loaded dll: %s",dllNameStr.c_str());
return dllNameStr;
}
--- a/javaextensions/midppush/pushregistryplugin/build/javacaptain_ext_pushregistryplugin_0x2002DCA2.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midppush/pushregistryplugin/build/javacaptain_ext_pushregistryplugin_0x2002DCA2.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -95,6 +94,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/midprms_db/build/javarms_0x2002DCCB.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midprms_db/build/javarms_0x2002DCCB.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -80,6 +79,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/midprms_db/rmsplugin/build/javacaptain_ext_ondemand_2_0x2002DD01.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/midprms_db/rmsplugin/build/javacaptain_ext_ondemand_2_0x2002DD01.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/mobinfo/build/mobinfo_0x2002DCC3.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/mobinfo/build/mobinfo_0x2002DCC3.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoPermission.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoPermission.java Tue May 11 16:07:20 2010 +0300
@@ -27,6 +27,7 @@
// the known target names
private static final String IMSI_TARGET_NAME = "mobinfo.imsi";
private static final String MSISDN_TARGET_NAME = "mobinfo.msisdn";
+ private static final String CELLID_TARGET_NAME = "mobinfo.cellid";
private static final String PUBLIC_INFO_TARGET_NAME = "mobinfo.publicinfo";
private String iTarget = null;
@@ -38,6 +39,7 @@
// figure out the target
if (IMSI_TARGET_NAME.equals(aUri)
|| MSISDN_TARGET_NAME.equals(aUri)
+ || CELLID_TARGET_NAME.equals(aUri)
|| PUBLIC_INFO_TARGET_NAME.equals(aUri))
{
// aUri contains a known target name -> save it as such
@@ -56,6 +58,10 @@
{
iTarget = MSISDN_TARGET_NAME;
}
+ else if (MobileInfoProperties.CELLID.equals(aUri))
+ {
+ iTarget = CELLID_TARGET_NAME;
+ }
else
{
iTarget = PUBLIC_INFO_TARGET_NAME;
--- a/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java Tue May 11 16:07:20 2010 +0300
@@ -67,7 +67,7 @@
private static final String EMAIL_SEND_SETTINGS = "com.nokia.mid.settings.email-send-protocol";
- private static final String CELLID = "com.nokia.mid.cellid";
+ static final String CELLID = "com.nokia.mid.cellid";
static final String MSISDN = "com.nokia.mid.msisdn";
--- a/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Tue May 11 16:07:20 2010 +0300
@@ -225,8 +225,7 @@
GetExternalItemModificationsByEntryTypeL(
CCalEntry::TType aEntryType);
- void CPIMAgnListAdapter::DoExternalItemModificationsByEntryTypeL(
- CCalEntry::TType aEntryType);
+ void DoExternalItemModificationsByEntryTypeL(CCalEntry::TType aEntryType);
/**
* Fetches a CAgnEntry from the native Agenda Model.
@@ -268,7 +267,8 @@
*
* @param aEntryType Entry type for change callbacks (ToDo/Event/all).
*/
- void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType);
+ void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType,
+ CCalSession* aCalSession);
void DoClose();
--- a/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Tue May 11 16:07:20 2010 +0300
@@ -73,13 +73,17 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
--- a/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Tue May 11 16:07:20 2010 +0300
@@ -27,6 +27,7 @@
// FORWARD DECLARATIONS
class MPIMEventItem;
class CPIMAgnEventAdapter;
+class CCalSession;
// CLASS DECLARATION
@@ -47,7 +48,8 @@
static CPIMEventListAdapter* NewL(
CCalEntry::TType aEntryType,
CPIMAgnEventAdapter* aEventAdapter,
- java::util::FunctionServer* aFuncServer);
+ java::util::FunctionServer* aFuncServer,
+ CCalSession *aCalSession);
/**
* Destructor.
@@ -137,8 +139,7 @@
*/
void CreateEventItemL(MPIMEventItem& aEventItem);
- void CPIMEventListAdapter::DoCreateEventItemL(
- MPIMEventItem& aEventItem);
+ void DoCreateEventItemL(MPIMEventItem& aEventItem);
/**
* Reads an existing event item from the Agenda File.
@@ -163,8 +164,7 @@
*/
void ReadEventItemL(MPIMEventItem& aEventItem);
- void CPIMEventListAdapter::DoReadEventItemL(
- MPIMEventItem& aEventItem);
+ void DoReadEventItemL(MPIMEventItem& aEventItem);
/**
* Writes an existing event item to the native Agenda File.
@@ -190,8 +190,7 @@
*/
void WriteEventItemL(MPIMEventItem& aEventItem);
- void CPIMEventListAdapter::DoWriteEventItemL(
- MPIMEventItem& aEventItem);
+ void DoWriteEventItemL(MPIMEventItem& aEventItem);
/**
* Removes an existing event from the native Agenda File.
@@ -211,8 +210,7 @@
*/
void RemoveEventItemL(TPIMItemID aItemID);
- void CPIMEventListAdapter::DoRemoveEventItemL(
- TPIMItemID aItemID);
+ void DoRemoveEventItemL(TPIMItemID aItemID);
protected:
@@ -226,7 +224,9 @@
*/
void ConstructL(
CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter);
+
+ CPIMAgnEventAdapter* aEventAdapter,
+ TInt aCalSessionInt);
private: // Member data
--- a/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Tue May 11 16:07:20 2010 +0300
@@ -67,13 +67,17 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
--- a/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,8 @@
/**
* Two-phased constructor.
*/
- static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer);
+ static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer,
+ CCalSession *aCalSession);
/**
* Destructor.
@@ -134,8 +135,7 @@
*/
void CreateToDoItemL(MPIMToDoItem& aToDoItem);
- void CPIMToDoListAdapter::DoCreateToDoItemL(
- MPIMToDoItem& aToDoItem);
+ void DoCreateToDoItemL(MPIMToDoItem& aToDoItem);
/**
* Reads an existing To-Do item from the Agenda File.
@@ -160,8 +160,7 @@
*/
void ReadToDoItemL(MPIMToDoItem& aToDoItem);
- void CPIMToDoListAdapter::DoReadToDoItemL(
- MPIMToDoItem& aToDoItem);
+ void DoReadToDoItemL(MPIMToDoItem& aToDoItem);
/**
* Writes an existing To-Do item to the native Agenda File.
@@ -187,8 +186,7 @@
*/
void WriteToDoItemL(MPIMToDoItem& aToDoItem);
- void CPIMToDoListAdapter::DoWriteToDoItemL(
- MPIMToDoItem& aToDoItem);
+ void DoWriteToDoItemL(MPIMToDoItem& aToDoItem);
/**
* Removes an existing To-Do from the native Agenda File.
@@ -208,8 +206,7 @@
*/
void RemoveToDoItemL(TPIMItemID aItemID);
- void CPIMToDoListAdapter::DoRemoveToDoItemL(
- TPIMItemID aItemID);
+ void DoRemoveToDoItemL(TPIMItemID aItemID);
protected:
@@ -221,7 +218,7 @@
/**
* By default Symbian 2nd phase constructor is private.
*/
- void ConstructL();
+ void ConstructL(TInt aCalSessionInt );
private: // Member data
--- a/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Tue May 11 16:07:20 2010 +0300
@@ -19,7 +19,7 @@
// INCLUDE FILES
#include "cpimagnlistadapter.h"
#include "mpimitemdata.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "cpimagnserverwait.h"
#include "logger.h"
@@ -54,13 +54,15 @@
// -----------------------------------------------------------------------------
//
void CPIMAgnListAdapter::ConstructL(
- MCalChangeCallBack::TChangeEntryType aEntryType)
-{
+
+ MCalChangeCallBack::TChangeEntryType aEntryType,
+ CCalSession* aCalSession)
+ {
JELOG2(EPim);
- iServerWait = CPIMAgnServerWait::NewL();
- iCalSession = CCalSession::NewL();
- iCalSession->OpenL(iCalSession->DefaultFileNameL());
- iCalEntryView = CCalEntryView::NewL(*iCalSession, *iServerWait);
+
+ iServerWait = CPIMAgnServerWait::NewL();
+ iCalSession = aCalSession;
+ iCalEntryView = CCalEntryView::NewL(*iCalSession, *iServerWait);
iServerWait->WaitCompleteL(KServerMaxWait);
iCalSession->StartChangeNotification(this, aEntryType, ETrue, // include undated ToDos, if ToDos are observed
@@ -285,10 +287,9 @@
void CPIMAgnListAdapter::CloseAgendaSession()
{
JELOG2(EPim);
+ iCalSession->StopChangeNotification();
delete iCalEntryView;
- iCalEntryView = NULL;
-
- delete iCalSession;
+ iCalEntryView = NULL;
iCalSession = NULL;
iChangesRead = ETrue;
--- a/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Tue May 11 16:07:20 2010 +0300
@@ -139,7 +139,8 @@
return EFalse;
}
-TBool CPIMEventAdapterAccess::OpenEventListL(const TDesC* aListName,
+TBool CPIMEventAdapterAccess::OpenEventListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData)
@@ -181,9 +182,9 @@
CPIMAgnApptAdapter* adapter = CPIMAgnApptAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt, adapter,
- iFuncServer);
-
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt,adapter,
+ iFuncServer, aCalSession);
+
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -200,8 +201,8 @@
CPIMAgnMemoAdapter* adapter = CPIMAgnMemoAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent, adapter,
- iFuncServer);
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent,adapter,
+ iFuncServer, aCalSession);
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -219,8 +220,8 @@
CPIMAgnAnnivAdapter* adapter = CPIMAgnAnnivAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv, adapter,
- iFuncServer);
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv,adapter,
+ iFuncServer, aCalSession);
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -244,9 +245,11 @@
return ETrue;
}
-TBool CPIMEventAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/,
+TBool CPIMEventAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/,
+ const TDesC* /*aListName*/,
MPIMToDoAdapterManager** /*aRetAdapterManager*/,
- MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/)
+ MPIMToDoListAdapter** /*aRetListAdapter*/,
+ MPIMLocalizationData** /*aRetLocalizationData*/)
{
JELOG2(EPim);
// no ToDo lists
--- a/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Tue May 11 16:07:20 2010 +0300
@@ -48,11 +48,14 @@
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
-void CPIMEventListAdapter::ConstructL(CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter)
-{
+void CPIMEventListAdapter::ConstructL(CCalEntry::TType aEntryType,
+
+ CPIMAgnEventAdapter* aEventAdapter,
+ TInt aCalSessionInt)
+ {
JELOG2(EPim);
- CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent);
+ CCalSession* calSession = reinterpret_cast <CCalSession*> (aCalSessionInt);
+ CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent, calSession);
iEntryType = aEntryType;
iAgnAdapter = aEventAdapter;
}
@@ -62,15 +65,19 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CPIMEventListAdapter* CPIMEventListAdapter::NewL(CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter, java::util::FunctionServer* aFuncServer)
-{
+CPIMEventListAdapter* CPIMEventListAdapter::NewL(CCalEntry::TType aEntryType,
+ CPIMAgnEventAdapter* aEventAdapter,
+ java::util::FunctionServer* aFuncServer, CCalSession *aCalSession
+ )
+ {
JELOG2(EPim);
CPIMEventListAdapter* self = new(ELeave) CPIMEventListAdapter(aFuncServer);
CleanupStack::PushL(self);
+ TInt calSessionInt = reinterpret_cast <TInt> (aCalSession);
CallMethodL(self, &CPIMEventListAdapter::ConstructL, aEntryType,
- aEventAdapter, self->iFuncServer);
- CleanupStack::Pop(self);
+ aEventAdapter, calSessionInt,self->iFuncServer);
+
+ CleanupStack::Pop( self );
return self;
}
--- a/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Tue May 11 16:07:20 2010 +0300
@@ -106,16 +106,20 @@
return EFalse;
}
-TBool CPIMToDoAdapterAccess::OpenEventListL(const TDesC* /*aListName*/,
+TBool CPIMToDoAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/,
+ const TDesC* /*aListName*/,
MPIMEventAdapterManager** /*aRetAdapterManager*/,
- MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/)
+ MPIMEventListAdapter** /*aRetListAdapter*/,
+ MPIMLocalizationData** /*aRetLocalizationData*/
+ )
{
JELOG2(EPim);
// no Event lists
return EFalse;
}
-TBool CPIMToDoAdapterAccess::OpenToDoListL(const TDesC* aListName,
+TBool CPIMToDoAdapterAccess::OpenToDoListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData)
@@ -136,7 +140,7 @@
(*iToDoListNames)[0]);
CleanupDeletePushL(adapterManager);
- MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer);
+ MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer, aCalSession);
CleanupStack::Pop(adapterManager);
MPIMLocalizationData* localizationData = iToDoLocalizationData;
--- a/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Tue May 11 16:07:20 2010 +0300
@@ -49,10 +49,11 @@
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
-void CPIMToDoListAdapter::ConstructL()
-{
+void CPIMToDoListAdapter::ConstructL(TInt aCalSessionInt)
+ {
JELOG2(EPim);
- CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo);
+ CCalSession* calSession = reinterpret_cast <CCalSession*> (aCalSessionInt);
+ CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo, calSession);
iAgnToDoAdapter = CPIMAgnToDoAdapter::NewL(iFuncServer);
}
@@ -61,14 +62,15 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CPIMToDoListAdapter* CPIMToDoListAdapter::NewL(
- java::util::FunctionServer* aFuncServer)
-{
+CPIMToDoListAdapter* CPIMToDoListAdapter::NewL(java::util::FunctionServer* aFuncServer,
+CCalSession *aCalSession)
+ {
JELOG2(EPim);
CPIMToDoListAdapter* self = new(ELeave) CPIMToDoListAdapter(aFuncServer);
CleanupStack::PushL(self);
- CallMethodL(self, &CPIMToDoListAdapter::ConstructL, self->iFuncServer);
- CleanupStack::Pop(self);
+ TInt calSessionInt = reinterpret_cast <TInt> (aCalSession);
+ CallMethodL(self, &CPIMToDoListAdapter::ConstructL,calSessionInt,self->iFuncServer);
+ CleanupStack::Pop( self );
return self;
}
--- a/javaextensions/pim/build/javapim_0x2002DCC5.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/build/javapim_0x2002DCC5.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -199,6 +198,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Tue May 11 16:07:20 2010 +0300
@@ -26,6 +26,7 @@
// FORWARD DECLARATIONS
class MPIMLocalizationManager;
class MPIMLocalizationData;
+class CCalSession;
// CLASS DECLARATION
/**
@@ -63,12 +64,14 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
+ CCalSession* aCalSession,
const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
+ CCalSession* aCalSession,
const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
--- a/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Tue May 11 16:07:20 2010 +0300
@@ -195,7 +195,7 @@
*/
void Close();
- void CPIMContactListAdapter::DoClose();
+ void DoClose();
public: // MPIMContactListAdapter
@@ -223,8 +223,7 @@
*/
void CreateContactItemL(MPIMContactItem& aContactItem);
- void CPIMContactListAdapter::DoCreateContactItemL(
- MPIMContactItem& aContactItem);
+ void DoCreateContactItemL(MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database.
@@ -249,8 +248,7 @@
*/
void ReadContactItemL(MPIMContactItem& aContactItem);
- void CPIMContactListAdapter::DoCallReadContactItemL(
- MPIMContactItem& aContactItem);
+ void DoCallReadContactItemL(MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database
@@ -271,11 +269,9 @@
* native database.
* @li Other - The list adapter is non-functional.
*/
- void ReadMinimalContactItemL(
- MPIMContactItem& aContactItem);
+ void ReadMinimalContactItemL(MPIMContactItem& aContactItem);
- void CPIMContactListAdapter::DoCallReadMinimalContactItemL(
- MPIMContactItem& aContactItem);
+ void DoCallReadMinimalContactItemL(MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database
@@ -315,7 +311,7 @@
void ReadContactFieldL(MPIMContactItem& aContactItem,
TPIMContactField aContactField);
- void CPIMContactListAdapter::DoReadContactFieldL(
+ void DoReadContactFieldL(
MPIMContactItem& aContactItem,
TPIMContactField aContactField);
@@ -343,8 +339,7 @@
*/
void WriteContactItemL(MPIMContactItem& aContactItem);
- void CPIMContactListAdapter::DoWriteContactItemL(
- MPIMContactItem& aContactItem);
+ void DoWriteContactItemL(MPIMContactItem& aContactItem);
/**
* Removes an existing contact from the native database.
@@ -415,7 +410,7 @@
* @param aContactItemViewDef View definition which is used for
* reading the contact item from the database
*/
- void CPIMContactListAdapter::DoReadContactItemL(
+ void DoReadContactItemL(
MPIMContactItem& aContactItem,
const CContactItemViewDef& aContactItemViewDef);
--- a/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Tue May 11 16:07:20 2010 +0300
@@ -75,16 +75,16 @@
return ETrue;
}
-TBool CPIMCMAdapterAccess::OpenEventListL(const TDesC* /*aListName*/,
+TBool CPIMCMAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/,
MPIMEventAdapterManager** /*aRetAdapterManager*/,
- MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */)
+ MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/ )
{
JELOG2(EPim);
// no Event lists
return EFalse;
}
-TBool CPIMCMAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/,
+TBool CPIMCMAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/,
MPIMToDoAdapterManager** /*aRetAdapterManager*/,
MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */)
{
--- a/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Tue May 11 16:07:20 2010 +0300
@@ -31,6 +31,7 @@
class MPIMToDoAdapterManager;
class MPIMToDoListAdapter;
class MPIMLocalizationData;
+class CCalSession;
// CLASS DECLARATION
@@ -129,7 +130,8 @@
* @li \c KErrNotFound - The native database does not exist any more.
* @li Other - The system is non-functional.
*/
- virtual TBool OpenEventListL(const TDesC* aListName,
+ virtual TBool OpenEventListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData) = 0;
@@ -163,7 +165,8 @@
* @li \c KErrNotFound - The native database does not exist any more.
* @li Other - The system is non-functional.
*/
- virtual TBool OpenToDoListL(const TDesC* aListName,
+ virtual TBool OpenToDoListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData) = 0;
--- a/javaextensions/pim/framework/inc.s60/cleanupresetanddestroy.h Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Cleanup Stack "reset and destroy" push operation.
- *
-*/
-
-
-#ifndef CLEANUPRESETANDDESTROY_H
-#define CLEANUPRESETANDDESTROY_H
-
-// INCLUDE FILES
-#include <e32base.h>
-
-/**
- * An operation for pushing objects to cleanup stack with \c TCleanupItems
- * that will perform a \c ResetAndDestroy() operation on the pushed object
- * if a leave occurs.
- *
- * Note that the object itself will not be deleted.
- *
- * @par Example:
- * Here is an example of using \c CleanupResetAndDestroy with a dynamically
- * allocated \c RPointerArray. \c RPointerArray clears its contents with a
- * \cResetAndDestroy() operation.
- * @code
- *
- * // A function which creates a pointer array with couple of initialized
- * // CThings. The function must return a pointer to the pointer array,
- * // because the array has to be allocated dynamically. CThing is some
- * // simple CBase-derived class.
- *
- * RPointerArray< CThing >* CreateThingArrayL( )
- * {
- * // Create an array of pointers to CThings with granularity of 4
- *
- * RPointerArray< CThing >* things =
- * new( ELeave ) RPointerArray< CThing >( 4 );
- *
- * // Push pointer to the array to the cleanup stack; then push reference
- * // to the array and a ResetAndDestroy operation to the cleanup stack.
- *
- * // (Note that order of these operations matters: the ResetAndDestroy
- * // operation must be performed before the array itself is deleted.)
- *
- * CleanupStack::PushL( things );
- * CleanupResetAndDestroyPushL( *things );
- *
- * // Add couple of CThings with magic numbers to the array.
- * // If any of the NewL() operations leaves, the array will be cleared
- * // with ResetAndDestroy() and the array itself will destroyed.
- *
- * User::LeaveIfError( things->Append( CThing::NewL( 7 ) ) );
- * User::LeaveIfError( things->Append( CThing::NewL( 96 ) ) );
- * User::LeaveIfError( things->Append( CThing::NewL( 999 ) ) );
- *
- * // Pop the array reference with ResetAndDestroy from cleanup stack
- * // then pop the pointer to the array itself.
- *
- * CleanupStack::Pop(); // *things
- * CleanupStack::Pop(); // things
- *
- * // Now we're ready to return the results (a pointer to the array)
- * return things;
- * }
- *
- * @endcode
- */
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef);
-
-/**
- * <em>See \ref CleanupResetAndDestroyPushL() documentation.</em>
- */
-template<class T>
-class CleanupResetAndDestroy
-{
-public:
- inline static void PushL(T& aRef);
-
-private:
- static void ResetAndDestroy(TAny *aPtr);
-};
-
-template<class T>
-inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
-{
- CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));
-}
-
-template<class T>
-void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
-{
- static_cast<T*>(aPtr)->ResetAndDestroy();
-}
-
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef)
-{
- CleanupResetAndDestroy<T>::PushL(aRef);
-}
-
-#endif // CLEANUPRESETANDDESTROY_H
-// End of File
--- a/javaextensions/pim/framework/inc.s60/cpimmanager.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/framework/inc.s60/cpimmanager.h Tue May 11 16:07:20 2010 +0300
@@ -43,6 +43,7 @@
class CPIMEventValidator;
class CPIMToDoValidator;
class MPIMAdapterAccess;
+class CCalSession;
// CLASS DECLARATION
@@ -77,7 +78,7 @@
* Destructor.
*/
virtual ~CPIMManager();
-
+ void DeleteSessions();
public: // New functions
/**
@@ -200,13 +201,13 @@
CPIMToDoList* DoOpenToDoListL(
const TDesC* aListName);
- CDesCArray* CPIMManager::DoListPimListsL(
+ CDesCArray* DoListPimListsL(
const TPIMListType& aPimListType);
- pimbaselist* CPIMManager::DoOpenPimListL(
+ pimbaselist* DoOpenPimListL(
const TPIMListType& aPimListType,
const TDesC* aPimListName);
-
+ void CreateCalSessionL();
void dispose();
private: // Constructors
@@ -240,6 +241,13 @@
/** Owned. */
CPIMToDoValidator* iToDoValidator;
+ RLibrary iLocalizationLibrary;
+
+
+ /** Session to calendar server. Owned. */
+ CCalSession* iCalSession;
+
+
};
--- a/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Tue May 11 16:07:20 2010 +0300
@@ -29,7 +29,7 @@
#include "pimjnitools.h"
#include "pimutils.h"
#include "s60commonutils.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "logger.h"
CPIMEventList::CPIMEventList(const CPIMEventValidator& aValidator) :
--- a/javaextensions/pim/framework/src.s60/cpimlist.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimlist.cpp Tue May 11 16:07:20 2010 +0300
@@ -25,7 +25,7 @@
#include "cpimitem.h"
#include "cpimitemmatcher.h"
#include "cpimstringmatcher.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "pimexternalchanges.h"
#include "pimpanics.h"
#include "pimjnitools.h"
@@ -927,9 +927,9 @@
User::LeaveIfError(newAndRemovedItems->Append(
tempRemovedItems[i]));
}
-
+ CleanupStack::Pop(newAndRemovedItems);
CleanupStack::Pop(); // newAndRemovedItems cleanup close
- CleanupStack::Pop(newAndRemovedItems);
+
CleanupStack::PopAndDestroy(); // tempRemovedItems cleanup close
CleanupStack::PopAndDestroy(); // tempNewItems cleanup close
@@ -1187,6 +1187,7 @@
CleanupStack::Pop(newItem);
// Add to list of new items
+ CleanupClosePushL(aTempNewItems);
TInt errAddToNewItems = aTempNewItems.Append(newItem);
if (errAddToNewItems != KErrNone)
{
@@ -1194,6 +1195,7 @@
delete newItem;
User::Leave(errAddToNewItems);
}
+ CleanupStack::Pop(&aTempNewItems);
}
void CPIMList::HandleItemChangeModifiedL(CPIMItem& aModifiedItem)
@@ -1224,6 +1226,7 @@
RPointerArray<CPIMItem>& aTempRemovedItems)
{
JELOG2(EPim);
+ CleanupClosePushL(aTempRemovedItems);
CPIMItem* removedItem = iItems[aRemovedItemIndex];
// Add to list of removed items
@@ -1237,6 +1240,7 @@
// Remove from item list and remove adapter association
iItems.Remove(aRemovedItemIndex);
removedItem->RemoveAdapterAssociation();
+ CleanupStack::Pop(&aTempRemovedItems);
}
void CPIMList::RefreshModifiedItemsL()
--- a/javaextensions/pim/framework/src.s60/cpimmanager.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimmanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -20,6 +20,7 @@
#include "cpimmanager.h"
#include <e32std.h>
#include <badesca.h>
+#include <calsession.h>
#include "pimcommon.h"
#include "mpimcontactadaptermanager.h"
#include "mpimeventadaptermanager.h"
@@ -44,9 +45,14 @@
#include "pimjnitools.h"
#include "pimutils.h"
#include "jstringutils.h"
+#include "fs_methodcall.h"
#include "logger.h"
#include "cpimlocalizationmanager.h"
+#include "s60commonutils.h"
+
+
+
// CONSTANTS
/**
@@ -74,7 +80,23 @@
= (MPIMLocalizationManager*)(CPIMLocalizationManager::NewL());
createServerToNewThread();
-}
+ CallMethodL(this, &CPIMManager::CreateCalSessionL, this);
+ }
+
+void CPIMManager::CreateCalSessionL()
+ {
+ iCalSession = CCalSession::NewL();
+ TRAPD(err, iCalSession->OpenL(iCalSession->DefaultFileNameL()));
+ if ( KErrNotFound == err)
+ {
+ iCalSession->CreateCalFileL(iCalSession->DefaultFileNameL());
+ iCalSession->OpenL(iCalSession->DefaultFileNameL());
+ }
+ else
+ {
+ User::LeaveIfError(err);
+ }
+ }
pimbasemanager* pimbasemanager::getInstance()
{
@@ -134,10 +156,17 @@
iContactValidator = NULL;
delete iEventValidator;
iEventValidator = NULL;
- delete iToDoValidator;
+ delete iToDoValidator;
+ CallMethod(this, &CPIMManager::DeleteSessions, this);
+
iToDoValidator = NULL;
stopServer();
}
+void CPIMManager::DeleteSessions()
+ {
+ delete iCalSession;
+ iCalSession = NULL;
+ }
void CPIMManager::dispose()
{
@@ -335,12 +364,11 @@
MPIMEventAdapterManager* eventAdapterManager = NULL;
MPIMEventListAdapter* eventListAdapter = NULL;
- MPIMLocalizationData* localizationData = NULL;
-
+ MPIMLocalizationData* localizationData = NULL;
const TInt n = iAdapterAccesses.Count();
for (TInt i = 0; i < n; i++)
{
- if (iAdapterAccesses[i]->OpenEventListL(aListName,
+ if (iAdapterAccesses[i]->OpenEventListL(iCalSession,aListName,
&eventAdapterManager, &eventListAdapter, &localizationData))
{
// got one
@@ -369,12 +397,11 @@
MPIMToDoAdapterManager* toDoAdapterManager = NULL;
MPIMToDoListAdapter* toDoListAdapter = NULL;
- MPIMLocalizationData* localizationData = NULL;
-
+ MPIMLocalizationData* localizationData = NULL;
const TInt n = iAdapterAccesses.Count();
for (TInt i = 0; i < n; i++)
{
- if (iAdapterAccesses[i]->OpenToDoListL(aListName, &toDoAdapterManager,
+ if (iAdapterAccesses[i]->OpenToDoListL(iCalSession,aListName, &toDoAdapterManager,
&toDoListAdapter, &localizationData))
{
// got one
--- a/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Tue May 11 16:07:20 2010 +0300
@@ -24,7 +24,7 @@
#include "cpimtodoitem.h"
#include "mpimadaptermanager.h"
#include "pimtodo.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "pimjnitools.h"
#include "pimutils.h"
#include "s60commonutils.h"
--- a/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Tue May 11 16:07:20 2010 +0300
@@ -30,7 +30,7 @@
#include "cpimeventpropertyconverter.h"
#include "fs_methodcall.h"
#include "logger.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
// EXTERNAL INCLUDES
#include <vcal.h>
@@ -242,7 +242,7 @@
RPointerArray<CPIMItem>& aItemArray)
{
JELOG2(EPim);
- CleanupResetAndDestroyPushL(aItemArray);
+
CPIMEventItem* item = CPIMEventItem::NewLC(iEventValidator);
TPIMDate alarm(TInt64(0));
// We don't take the ownership of the propertyArray, so the properties
@@ -269,6 +269,7 @@
item->addInt(EPIMEventAlarm, KPIMAttrNone, interval.Int());
}
}
+ CleanupClosePushL(aItemArray);
User::LeaveIfError(aItemArray.Append(item));
CleanupStack::Pop(item); // item
CleanupStack::Pop(&aItemArray);
@@ -283,7 +284,7 @@
RPointerArray<CPIMItem>& aItemArray)
{
JELOG2(EPim);
- CleanupResetAndDestroyPushL(aItemArray);
+
CPIMToDoItem* item = CPIMToDoItem::NewLC(iToDoValidator);
TPIMDate alarm(TInt64(0));
// We don't take the ownership of the propertyArray, so the properties
@@ -318,6 +319,7 @@
{
item->AddBooleanL(EPIMToDoCompleted, KPIMAttrNone, ETrue);
}
+ CleanupClosePushL(aItemArray);
User::LeaveIfError(aItemArray.Append(item));
CleanupStack::Pop(item); // item
CleanupStack::Pop(&aItemArray);
--- a/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Tue May 11 16:07:20 2010 +0300
@@ -26,7 +26,7 @@
#include "cpimcardpropertyconverter.h"
#include "fs_methodcall.h"
#include "logger.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include <vcard.h>
// ============================ MEMBER FUNCTIONS ===============================
@@ -131,7 +131,7 @@
CArrayPtrFlat<CParserVCard>& aParserArray) // contained vCards here
{
JELOG2(EPim);
- CleanupResetAndDestroyPushL(aItemArray);
+ CleanupClosePushL(aItemArray);
CPIMContactItem* item = CPIMContactItem::NewLC(iContactValidator);
// We don't take the ownership of the propertyArray, so the properties
// are deleted when the parser is
--- a/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Tue May 11 16:07:20 2010 +0300
@@ -27,7 +27,7 @@
#include "cpimitem.h"
#include "cpimeventitem.h"
#include "mpimrepeatruledata.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "logger.h"
// EXTERNAL INCLUDES
--- a/javaextensions/pim/versit/src.s60/cpimversit.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimversit.cpp Tue May 11 16:07:20 2010 +0300
@@ -22,7 +22,7 @@
#include "cpimcardconverter.h"
#include "cpimcalendarconverter.h"
#include "cpimitem.h"
-#include "cleanupresetanddestroy.h"
+#include "javasymbianoslayer.h"
#include "logger.h"
#include <s32mem.h> // RBufWriteStream
#include <vtoken.h>
--- a/javaextensions/satsa/apdu/src.s60/cstsace.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/satsa/apdu/src.s60/cstsace.h Tue May 11 16:07:20 2010 +0300
@@ -24,7 +24,7 @@
#include "cstsprincipal.h"
#include "cstsapdumaskpermission.h"
#include "cstsuserauth.h"
-#include "stscommon.h"
+#include "javasymbianoslayer.h"
namespace java
{
--- a/javaextensions/satsa/build/javasatsa_0x2002DCCE.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/satsa/build/javasatsa_0x2002DCCE.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -190,6 +189,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/satsa/framework/inc/stscommon.h Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
- *
-*/
-
-
-#ifndef STSCOMMON_H
-#define STSCOMMON_H
-
-// Enables pushing a call to ResetAndDestroy into cleanup stack
-
-template<class T>
-class CleanupResetAndDestroy
-{
-public:
- inline static void PushL(T& aRef);
-private:
- static void ResetAndDestroy(TAny *aPtr);
-};
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef);
-template<class T>
-inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
-{
- CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));
-}
-template<class T>
-void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
-{
- (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
-}
-template<class T>
-inline void CleanupResetAndDestroyPushL(T& aRef)
-{
- CleanupResetAndDestroy<T>::PushL(aRef);
-}
-
-#endif // STSCOMMON_H
--- a/javaextensions/satsa/pki/src.s60/tstsdistinguishednameconverter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/tstsdistinguishednameconverter.cpp Tue May 11 16:07:20 2010 +0300
@@ -20,7 +20,7 @@
// INCLUDE FILES
#include "tstsdistinguishednameconverter.h"
#include "tstscharactersetconverter.h"
-#include "stscommon.h" // for CleanupResetAndDestroy
+#include "javasymbianoslayer.h" // for CleanupResetAndDestroy
#include "stspkiconstants.h" // for error constants
#include <x500dn.h>
#include <charconv.h>
--- a/javaextensions/sensor/build/javasensor_0x2002DCD0.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/sensor/build/javasensor_0x2002DCD0.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -101,6 +100,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/webservices/build/javawebservices_0x2002DCDB.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/webservices/build/javawebservices_0x2002DCDB.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -75,6 +74,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/mms/build/javawmamms_0x2002DCDD.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/mms/build/javawmamms_0x2002DCDD.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -102,6 +101,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/mms/pushplugin/build/javammsscplugin_0x2002DCC1.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/mms/pushplugin/build/javammsscplugin_0x2002DCC1.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -90,6 +89,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/sms_cbs/build/javawma_0x2002DCDC.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/build/javawma_0x2002DCDC.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -98,6 +97,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSBinaryMessageImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSBinaryMessageImpl.java Tue May 11 16:07:20 2010 +0300
@@ -37,16 +37,13 @@
* @returns null if not supported
* @see
*/
- public String getPayloadTextData()
+ String getPayloadTextData()
{
return null;
}
- /**
- *Refer About this in JSR-205(Wireless Messaging API 2.0)specification
- */
- public byte[] getPayloadBinaryData()
+ byte[] getPayloadBinaryData()
{
return getPayloadData();
}
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSMessageImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSMessageImpl.java Tue May 11 16:07:20 2010 +0300
@@ -74,8 +74,8 @@
public abstract int getType();
- public abstract String getPayloadTextData();
+ abstract String getPayloadTextData();
- public abstract byte[] getPayloadBinaryData();
+ abstract byte[] getPayloadBinaryData();
}
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSTextMessageImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/sms/SMSTextMessageImpl.java Tue May 11 16:07:20 2010 +0300
@@ -37,7 +37,7 @@
* @return Returns the message payload data as a String
* or null if it is not set
*/
- public String getPayloadTextData()
+ String getPayloadTextData()
{
return getPayloadText();
}
@@ -45,7 +45,7 @@
* Method to get the message payload Data
* @returns null if it is not supported
*/
- public byte[] getPayloadBinaryData()
+ byte[] getPayloadBinaryData()
{
return null;
}
--- a/javaextensions/wma/sms_cbs/pushplugin/cbs/build/javacbsscplugin_0x2002DCA4.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/cbs/build/javacbsscplugin_0x2002DCA4.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -102,6 +101,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp Tue May 11 16:07:20 2010 +0300
@@ -287,11 +287,12 @@
JELOG2(EWMA);
TCBSParametersBuf cbsParametersBuf;
std::wstring path;
+ char* messagePath =0;
path += mMessageStoreDirName;
try
{
path += JavaCommonUtils::intToWstring(mFirstMessageInStore);
- char* messagePath = JavaCommonUtils::wstringToUtf8(path);
+ messagePath = JavaCommonUtils::wstringToUtf8(path);
// Read the CBS file contents
readStream.exceptions(std::ifstream::failbit|std::ifstream::badbit);
@@ -313,12 +314,14 @@
catch (std::ifstream::failure e)
{
ELOG(EWMA,"CBS : Exception while opening/reading file");
+ delete[] messagePath;
readStream.exceptions(std::ofstream::goodbit);
readStream.close();
return KErrGeneral;
}
catch (ExceptionBase ex)
{
+ delete[] messagePath;
return KErrGeneral;
}
return KErrNone;
@@ -689,6 +692,7 @@
catch (std::ofstream::failure e)
{
ELOG(EWMA,"CBS : Exception while creating/writing file");
+ delete[] messagePath;
writeStream.exceptions(std::ofstream::goodbit);
writeStream.close();
User::Leave(KErrGeneral);
--- a/javaextensions/wma/sms_cbs/pushplugin/sms/build/javasmsscplugin_0x2002DCD3.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/sms/build/javasmsscplugin_0x2002DCD3.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -98,6 +97,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaextensions/wma/sms_cbs/pushplugin/sms/src.s60/smsserverconnection.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/sms/src.s60/smsserverconnection.cpp Tue May 11 16:07:20 2010 +0300
@@ -65,7 +65,7 @@
{
JELOG2(EWMA);
// As per internal spec the message store should be removed only when
- // Application is unintalled / UnRegistered from push
+ // Application is uninstalled / UnRegistered from push
removeDir(mMessageStoreDirName);
delete mMessage;
delete mFilterDes;
@@ -109,7 +109,9 @@
if (0 == mMessage)
{
CSmsBuffer* smsBuffer = CSmsBuffer::NewL();
+ CleanupStack::PushL(smsBuffer);
mMessage = CSmsMessage::NewL(mFs, CSmsPDU::ESmsDeliver, smsBuffer);
+ CleanupStack::Pop(smsBuffer);
}
error = pthread_mutex_init(&mMutex, 0);
if (error == 0)
@@ -152,7 +154,6 @@
{
error = pthread_create(&mThreadId, NULL,
SmsServerConnection::listenThread, this);
- mOpenMonitor->wait();
}
}
}
@@ -163,6 +164,7 @@
throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__,
__FUNCTION__,__LINE__);
}
+ mOpenMonitor->wait();
if (mMessagesOnStore > 0)
{
mListener->msgArrived();
@@ -328,6 +330,7 @@
mSocket.CancelIoctl();
mSocket.Close();
mSocketServer.Close();
+ mSocketServerOpened = EFalse;
}
TInt SmsServerConnection::RunError(TInt aError)
@@ -347,12 +350,13 @@
JELOG2(EWMA);
std::wstring path;
path += mMessageStoreDirName;
+ char* messagePath =0;
// Read the SMS file contents
readStream.exceptions(std::ifstream::failbit|std::ifstream::badbit);
try
{
path += JavaCommonUtils::intToWstring(mFirstMessageInStore);
- char* messagePath = JavaCommonUtils::wstringToUtf8(path);
+ messagePath = JavaCommonUtils::wstringToUtf8(path);
readStream.open(messagePath, std::ios::in | std::ios::binary);
readStream.read((char*) aSmsBuf.Ptr(), mSmsParameters.Size());
readStream.read((char*)(aSmsBuf().mData).Ptr(), aSmsBuf().mDataSize * 2);
@@ -364,11 +368,13 @@
catch (std::ifstream::failure e)
{
ELOG(EWMA,"SMS : Exception while opening/reading file");
+ delete[] messagePath;
readStream.close();
return KErrGeneral;
}
catch (ExceptionBase ex)
{
+ delete[] messagePath;
return KErrGeneral;
}
return KErrNone;
@@ -443,6 +449,7 @@
catch (std::ofstream::failure e)
{
ELOG(EWMA,"SMS : Exception while creating/writing file");
+ delete[] messagePath;
writeStream.close();
User::Leave(KErrGeneral);
}
--- a/javaextensions/wma/sms_cbs/pushplugin/src/serverconnectionbase.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/src/serverconnectionbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -133,7 +133,16 @@
{
path += std::wstring(tok);
path += L"\\";
- char *dirName = JavaCommonUtils::wstringToUtf8(path);
+ char *dirName =0;
+ try
+ {
+ dirName = JavaCommonUtils::wstringToUtf8(path);
+ }
+ catch (ExceptionBase ex)
+ {
+ delete[] stringToTokenize;
+ return -1;
+ }
if (ableToOpen)
{
if (0 != lstat(dirName, &temp))
@@ -169,10 +178,11 @@
JELOG2(EWMA);
std::wstring path1;
path1 += aDirPath;
+ char* path =0;
int error = 0;
try
{
- char* path = JavaCommonUtils::wstringToUtf8(path1);
+ path = JavaCommonUtils::wstringToUtf8(path1);
LOG1(EWMA, EInfo, "WMA : Removing Message Store %s",path);
struct stat temp;
if (0 != lstat(path, &temp))
@@ -211,7 +221,9 @@
}
catch (ExceptionBase ex)
{
+ delete[] path;
ELOG(EWMA,"WMA : Cought an exception while removing Dir");
+ return -1;
}
return error;
}
--- a/javaextensions/wma/sms_cbs/src.s60/csmsplatformservices60impl.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaextensions/wma/sms_cbs/src.s60/csmsplatformservices60impl.cpp Tue May 11 16:07:20 2010 +0300
@@ -166,13 +166,16 @@
TRAPD(error,
{
HBufC* smsData = convertToDes(aData,aMsgType,aLength);
+ CleanupStack::PushL(smsData);
std::auto_ptr<HBufC> smsAddress(stringToDes(aHostAddress));
// The sms message takes ownership of the buffer
CSmsBuffer* buffer = CSmsBuffer::NewL();
+ CleanupStack::PushL(buffer);
delete mSendMessage;
mSendMessage = 0;
RFs fileServer;
mSendMessage = CSmsMessage::NewL(fileServer,CSmsPDU::ESmsSubmit,buffer);
+ CleanupStack::Pop(buffer);
if (smsAddress->Length()> 0)
{
// set the destination address
@@ -212,7 +215,7 @@
numberOfSegments = (int)mSendMessage->NumMessagePDUsL();
LOG2(EWMA, EInfo,"SMS :number of segments %d data length %d",
numberOfSegments, aLength);
- delete smsData;
+ CleanupStack::PopAndDestroy(smsData);
});
return (error == KErrNone)? numberOfSegments : error;
}
@@ -234,6 +237,7 @@
TInt nonConvertibleCharacters;
CCnvCharacterSetConverter* cConverter =
CCnvCharacterSetConverter::NewL();
+ CleanupStack::PushL(cConverter);
CCnvCharacterSetConverter::TAvailability cnvAvailable =
cConverter->PrepareToConvertToOrFromL(
KCharacterSetIdentifierSms7Bit, aFs);
@@ -266,8 +270,7 @@
}
(isGSM7Convertible)?msgEncoding = TSmsDataCodingScheme::ESmsAlphabet7Bit
:msgEncoding = TSmsDataCodingScheme::ESmsAlphabetUCS2;
- delete cConverter;
- cConverter = 0;
+ CleanupStack::PopAndDestroy(cConverter);
}
else
{
--- a/javamanager/debugapi/build/debugapi_0x2002DCAB.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/debugapi/build/debugapi_0x2002DCAB.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javaappschemeplugin/inc/javaapphandler.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaappschemeplugin/inc/javaapphandler.h Tue May 11 16:07:20 2010 +0300
@@ -20,9 +20,16 @@
#define JAVAAPPHANDLER_H
// INCLUDES
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <SchemeHandler.h>
+#else
#include <schemehandler.h>
+#endif
+
#include <e32base.h>
+
namespace java
{
--- a/javamanager/javacaptain/build/javacaptain_0x200211DC.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/build/javacaptain_0x200211DC.mmp Tue May 11 16:07:20 2010 +0300
@@ -46,7 +46,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -115,6 +114,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javacaptain/extensionplugins/config/build/javacaptain_ext_config_0x2002DC9E.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/config/build/javacaptain_ext_config_0x2002DC9E.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -85,6 +84,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javacaptain/extensionplugins/javacertstore/build/javacaptain_ext_javacertstore_0x2002DC9F.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/build/javacaptain_ext_javacertstore_0x2002DC9F.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -95,6 +94,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javacaptain/extensionplugins/javacertstore/src.linux/metadatafilehandler.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/src.linux/metadatafilehandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -15,6 +15,7 @@
*
*/
+#include <cstdio>
#include "metadatafilehandler.h"
--- a/javamanager/javacaptain/extensionplugins/preinstallerstarter/build/javacaptain_ext_preinstallerstarter_0x2002DCA0.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/preinstallerstarter/build/javacaptain_ext_preinstallerstarter_0x2002DCA0.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javacaptain/extensionplugins/scrupdater/build/javacaptain_ext_scrupdater.pro Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/scrupdater/build/javacaptain_ext_scrupdater.pro Tue May 11 16:07:20 2010 +0300
@@ -20,6 +20,6 @@
CONFIG -= qt
-LIBS += -lapgrfx -ljavacomms -ljavastorage -lscrclient
-
+LIBS += -lapgrfx -ljavacomms -ljavastorage -lscrclient -lefsrv
+
include(../../../../../build/omj.pri)
--- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp Tue May 11 16:07:20 2010 +0300
@@ -20,9 +20,6 @@
#include <apgcli.h>
#include <e32base.h>
#include <f32file.h>
-#include <javastorage.h>
-#include <javastorageentry.h>
-#include <javastoragenames.h>
#include "javaprocessconstants.h"
#include "javasymbianoslayer.h"
--- a/javamanager/javacaptain/extensionplugins/storageserver/build/javacaptain_ext_storageserverplugin_0x2002DCA3.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/storageserver/build/javacaptain_ext_storageserverplugin_0x2002DCA3.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javacaptain/src/main.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javacaptain/src/main.cpp Tue May 11 16:07:20 2010 +0300
@@ -21,6 +21,7 @@
#include "signalhandler.h"
#endif /* __SYMBIAN32__ */
+#include <cstdio>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
--- a/javamanager/javainstaller/installer/build/javainstaller_0x2002DCB4.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/build/javainstaller_0x2002DCB4.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -114,6 +113,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Tue May 11 16:07:20 2010 +0300
@@ -37,10 +37,6 @@
*
* startSession() must be called before the other methods of this
* class can be used.
- *
- *
- * @author Nokia Corporation
- * @version $Rev: 10289 $
*/
public final class ApplicationRegistrator
{
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Tue May 11 16:07:20 2010 +0300
@@ -48,12 +48,16 @@
private String iGlobalComponentId = null;
/** Component name (i.e. suite name). */
private String iComponentName = null;
- /** Array of pplication names. */
+ /** Application names. */
private String[] iApplicationNames = null;
+ /** Applications icons. */
+ private String[] iApplicationIcons = null;
/** Component initial size. */
private int iComponentSize = 0;
- /** Component icon path. */
- private String iComponentIconPath = null;
+ /** Icon dir. */
+ private String iIconDir = null;
+ /** Component icon. */
+ private String iComponentIcon = null;
/*** ----------------------------- PUBLIC ------------------------------ */
@@ -79,15 +83,17 @@
*/
public void notifyStart(
int aOperation, String aGlobalComponentId, String aComponentName,
- String[] aApplicationNames, int aComponentSize,
- String aComponentIconPath)
+ String[] aApplicationNames, String[] aApplicationIcons,
+ int aComponentSize, String aIconDir, String aComponentIcon)
{
iOperation = aOperation;
iGlobalComponentId = aGlobalComponentId;
iComponentName = aComponentName;
iApplicationNames = aApplicationNames;
+ iApplicationIcons = aApplicationIcons;
iComponentSize = aComponentSize;
- iComponentIconPath = aComponentIconPath;
+ iIconDir = aIconDir;
+ iComponentIcon = aComponentIcon;
}
/**
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/customisationproperties/CustomisationProperties.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/customisationproperties/CustomisationProperties.java Tue May 11 16:07:20 2010 +0300
@@ -25,9 +25,6 @@
/**
* Fetches product program/operator specific customizable settings.
* In Linux platform some of these are fetched from ???
- *
- * @author Nokia Corporation
- * @version $Rev: 10289 $
*/
public final class CustomisationProperties extends CustomisationPropertiesBase
{
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcher.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcher.java Tue May 11 16:07:20 2010 +0300
@@ -26,9 +26,6 @@
* JadJarMatcher offers services for finding Jar when Jad filename is known,
* and finding Jad when Jar filename is known. JadJarMatcher only searches
* files from local folders.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public final class JadJarMatcher extends JadJarMatcherBase
{
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifier.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifier.java Tue May 11 16:07:20 2010 +0300
@@ -29,9 +29,7 @@
* installed / uninstalled or installation / uninstallation
* is rolled back. Linux specific implementation.
*
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
- " @see JsrPluginNotifierBase
+ * @see JsrPluginNotifierBase
*/
public final class JsrPluginNotifier extends JsrPluginNotifierBase
{
--- a/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/utils/SysUtil.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.linux/com/nokia/mj/impl/installer/utils/SysUtil.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* SysUtil provides system utility services.
- *
- * @author Nokia Corporation
- * @version $Rev: 10289 $
*/
public final class SysUtil
{
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java Tue May 11 16:07:20 2010 +0300
@@ -31,9 +31,6 @@
* This version registers MIDlet to Symbian AppArc.
* startSession() must be called before the other methods of this
* class can be used.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public final class ApplicationRegistrator
{
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Tue May 11 16:07:20 2010 +0300
@@ -48,12 +48,20 @@
private String iGlobalComponentId = null;
/** Component name (i.e. suite name). */
private String iComponentName = null;
- /** Array of pplication names. */
+ /** Application names. */
private String[] iApplicationNames = null;
+ /** Applications icons. */
+ private String[] iApplicationIcons = null;
/** Component initial size. */
private int iComponentSize = 0;
- /** Component icon path. */
- private String iComponentIconPath = null;
+ /** Icon dir. */
+ private String iIconDir = null;
+ /** Component icon. */
+ private String iComponentIcon = null;
+
+ /** Sending progress notifications is only allowed between start
+ * and end notifications. */
+ private boolean iNotifyProgressAllowed = false;
/** Native object handle. */
private int iHandle = 0;
@@ -83,15 +91,17 @@
*/
public void notifyStart(
int aOperation, String aGlobalComponentId, String aComponentName,
- String[] aApplicationNames, int aComponentSize,
- String aComponentIconPath)
+ String[] aApplicationNames, String[] aApplicationIcons,
+ int aComponentSize, String aIconDir, String aComponentIcon)
{
iOperation = aOperation;
iGlobalComponentId = aGlobalComponentId;
iComponentName = aComponentName;
iApplicationNames = aApplicationNames;
+ iApplicationIcons = aApplicationIcons;
iComponentSize = aComponentSize;
- iComponentIconPath = aComponentIconPath;
+ iIconDir = aIconDir;
+ iComponentIcon = aComponentIcon;
if (iHandle == 0)
{
@@ -99,8 +109,9 @@
"SifNotifier.notifyStart: notifier has not been initialized");
}
int ret = _notifyStart(
- iHandle, aGlobalComponentId, aComponentName, aApplicationNames,
- aComponentSize, aComponentIconPath);
+ iHandle, aGlobalComponentId, aComponentName,
+ aApplicationNames, aApplicationIcons,
+ aComponentSize, aIconDir, aComponentIcon);
if (ret < 0)
{
Log.logError("Notifying SIF start failed with code " + ret +
@@ -108,6 +119,7 @@
InstallerException.internalError(
"Notifying SIF start failed with code " + ret);
}
+ iNotifyProgressAllowed = true;
}
/**
@@ -123,6 +135,7 @@
InstallerException.internalError(
"SifNotifier.notifyEnd: notifier has not been initialized");
}
+ iNotifyProgressAllowed = false;
int ret = _notifyEnd(
iHandle, iGlobalComponentId, aErrCategory, aErrCode,
aErrMsg, aErrMsgDetails);
@@ -146,6 +159,10 @@
*/
public void notifyProgress(int aSubOperation, int aCurrent, int aTotal)
{
+ if (!iNotifyProgressAllowed)
+ {
+ return;
+ }
if (iHandle == 0)
{
InstallerException.internalError(
@@ -240,15 +257,17 @@
* @param aGlobalComponentId
* @param aComponentName
* @param aApplicationNames
+ * @param aApplicationIcons
* @param aComponentSize
- * @param aComponentIconPath
+ * @param aIconDir
+ * @param aComponentIcon
* @return Symbian error code (negative number) if operation fails,
* otherwise 0
*/
private static native int _notifyStart(
int aHandle, String aGlobalComponentId, String aComponentName,
- String[] aApplicationNames, int aComponentSize,
- String aComponentIconPath);
+ String[] aApplicationNames, String[] aApplicationIcons,
+ int aComponentSize, String aIconDir, String aComponentIcon);
/**
* Notifies SIF about installation/uinstallation completion.
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java Tue May 11 16:07:20 2010 +0300
@@ -654,7 +654,11 @@
{
groupName = ""; // default installation group
}
- String iconFilename = aSuiteInfo.getRegisteredIconPath(aIndex);
+ String iconFilename = null;
+ if (!appInfo.getUseDefaultIcon())
+ {
+ iconFilename = aSuiteInfo.getRegisteredIconPath(aIndex);
+ }
Log.log("SifRegistrator iconFilename " + aIndex + ": " + iconFilename);
int numberOfIcons = 1;
// Initalize localized names for the application.
@@ -736,7 +740,7 @@
{
if (aSuite.getComponentId() == null)
{
- Log.logWarning(
+ Log.log(
"SifRegistrator.registerLocalizedComponentName: cid not present in suite");
return;
}
@@ -749,7 +753,7 @@
(ApplicationInfo)aSuite.getApplications().elementAt(aIndex);
if (app.getComponentId() == null)
{
- Log.logWarning(
+ Log.log(
"SifRegistrator.registerLocalizedComponentName: cid not present in app");
return;
}
@@ -785,7 +789,7 @@
{
if (aSuite.getComponentId() == null)
{
- Log.logWarning(
+ Log.log(
"SifRegistrator.registerLocalizedProperties: cid not present in suite");
return;
}
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/customisationproperties/CustomisationProperties.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/customisationproperties/CustomisationProperties.java Tue May 11 16:07:20 2010 +0300
@@ -32,9 +32,6 @@
* Fetches product program/operator specific customizable settings.
* In S60 platform some of these are fetched from central repository,
* rest are asked from S60 ApplicationShell
- *
- * @author Nokia Corporation
- * @version $Rev: 9381 $
*/
public final class CustomisationProperties extends CustomisationPropertiesBase
{
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcher.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcher.java Tue May 11 16:07:20 2010 +0300
@@ -29,9 +29,6 @@
* JadJarMatcher offers services for finding Jar when Jad filename is known,
* and finding Jad when Jar filename is known. JadJarMatcher only searches
* files from local folders.
- *
- * @author Nokia Corporation
- * @version $Rev: 9457 $
*/
public final class JadJarMatcher extends JadJarMatcherBase
{
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifier.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifier.java Tue May 11 16:07:20 2010 +0300
@@ -28,9 +28,7 @@
* installed / uninstalled or installation / uninstallation
* is rolled back.
*
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
- " @see JsrPluginNotifierBase
+ * @see JsrPluginNotifierBase
*/
public final class JsrPluginNotifier extends JsrPluginNotifierBase
{
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/SysUtil.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/SysUtil.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* SysUtil provides system utility services.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public final class SysUtil
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -89,7 +89,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.started threw exception", t);
+ Log.logError(
+ "InstallationNotifier: InstallerUi.started threw exception", t);
}
}
}
@@ -132,7 +133,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.ended threw exception", t);
+ Log.logError(
+ "InstallationNotifier: InstallerUi.ended threw exception", t);
}
}
if (iSifNotifier != null)
@@ -180,7 +182,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.error threw exception", t);
+ Log.logError(
+ "InstallationNotifier: InstallerUi.error threw exception", t);
}
}
}
@@ -269,7 +272,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.updateProgress threw exception", t);
+ Log.logError(
+ "InstallationNotifier: InstallerUi.updateProgress threw exception", t);
}
}
if (iSifNotifier != null)
@@ -283,7 +287,8 @@
}
catch (Throwable t)
{
- Log.logError("SifNotifier.notifyProgress threw exception", t);
+ Log.logError(
+ "InstallationNotifier: SifNotifier.notifyProgress threw exception", t);
}
}
}
@@ -373,7 +378,8 @@
}
catch (Exception ex)
{
- Log.logError("Deleting property failed", ex);
+ Log.logError(
+ "InstallationNotifier: Deleting property failed", ex);
}
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Tue May 11 16:07:20 2010 +0300
@@ -70,9 +70,6 @@
* JavaInstaller main class. JavaInstaller can be started either with
* #main(String[]) or #mainWithResult(String[]) methods. Negative return
* values indicate that execution has failed.
- *
- * @author Nokia Corporation
- * @version $Rev: 10413 $
*/
public class Installer
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java Tue May 11 16:07:20 2010 +0300
@@ -238,11 +238,19 @@
*/
public void send(int[] aEndpoints) throws InstallerException
{
+ InstallerException installerException = null;
if (aEndpoints != null)
{
- for (int i = 0; i < aEndpoints.length; i++)
+ try
{
- send(aEndpoints[i]);
+ for (int i = 0; i < aEndpoints.length; i++)
+ {
+ send(aEndpoints[i]);
+ }
+ }
+ catch (InstallerException ie)
+ {
+ installerException = ie;
}
}
if (iSifNotifier != null)
@@ -267,6 +275,10 @@
Log.logError("InstallerResultMessage: SifNotifier.notifyEnd failed", t);
}
}
+ if (installerException != null)
+ {
+ throw installerException;
+ }
}
/**
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
/**
* Contains all information needed to register Java application to
* any platform.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public final class AppRegInfo
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesBase.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
/**
* Fetches product program/operator specific customizable settings.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public class CustomisationPropertiesBase
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/DownloadInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/DownloadInfo.java Tue May 11 16:07:20 2010 +0300
@@ -26,9 +26,6 @@
/**
* DownloadInfo contains information of one file download.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
public class DownloadInfo
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/DownloadListener.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/DownloadListener.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
* Downloader will notify DownloadListener about download progress.
* Note that Downloader will ignore all exceptions thrown from
* DownloadListener callback methods.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
public interface DownloadListener
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/Downloader.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/Downloader.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -40,9 +40,6 @@
* Each Downloader instance downloads one file at a time in
* a separate thread. Parallel downloads are possible with
* multiple Downloader instances.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
abstract public class Downloader implements Runnable
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/GcfDownloader.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/GcfDownloader.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -28,9 +28,6 @@
/**
* GcfDownloader implements Downloader using MIDP GCF classes.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
public class GcfDownloader extends Downloader
{
@@ -104,8 +101,20 @@
{
// Open connection.
String url = getUrlWithAccessPoint(iDlInfo.getUrl(), iIap, iSnap);
- Log.log("GcfDownloader: opening " + url);
- HttpConnection connection = (HttpConnection)Connector.open(url);
+ HttpConnection connection = null;
+ synchronized (this)
+ {
+ if (iState != STATE_DOWNLOADING)
+ {
+ Log.log("GcfDownloader: download cancelled before connection opening");
+ return;
+ }
+ // Download may not be stopped during connection opening,
+ // so open connection inside synchronization block.
+ Log.logInfoPrd("GcfDownloader: opening " + url);
+ connection = (HttpConnection)Connector.open(url);
+ Log.logInfoPrd("GcfDownloader: connection opened");
+ }
if (iAuthorizationHeader != null)
{
connection.setRequestProperty("Authorization",
@@ -120,8 +129,8 @@
// Get response code and message.
int status = connection.getResponseCode();
- Log.log("GcfDownloader: got HTTP status: " + status +
- " " + connection.getResponseMessage());
+ Log.logInfoPrd("GcfDownloader: got HTTP status: " + status +
+ " " + connection.getResponseMessage());
// Check if HTTP redirect is needed.
String location = connection.getHeaderField("Location");
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/GcfNotificationPoster.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/GcfNotificationPoster.java Tue May 11 16:07:20 2010 +0300
@@ -30,9 +30,6 @@
/**
* GcfNotificationPoster implements NotificationPoster using
* MIDP GCF classes.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
public class GcfNotificationPoster extends NotificationPoster
{
@@ -98,8 +95,19 @@
String url = getUrlWithTimeout(
GcfDownloader.getUrlWithAccessPoint(
aOtaStatusNotification.getUrl(), iIap, iSnap), 60);
- Log.logInfoPrd("GcfNotificationPoster: opening " + url);
- HttpConnection connection = (HttpConnection)Connector.open(url);
+ HttpConnection connection = null;
+ synchronized (this)
+ {
+ if (iState != STATE_POSTING)
+ {
+ throw new IOException("Posting cancelled before connection opening");
+ }
+ // Posting may not be stopped during connection opening,
+ // so open connection inside synchronization block.
+ Log.logInfoPrd("GcfNotificationPoster: opening " + url);
+ connection = (HttpConnection)Connector.open(url);
+ Log.logInfoPrd("GcfNotificationPoster: connection opened");
+ }
connection.setRequestMethod(connection.POST); // we will post content
connection.setRequestProperty("Content-Type", CONTENT_TYPE);
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPoster.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/downloader/NotificationPoster.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -30,9 +30,6 @@
* NotificationPoster takes care of posting OTA status notifcations.
* It uses a separate thread for posting pending notifications.
* HTTP authentication is not supported for the OTA status notifications.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $ $Date$
*/
abstract public class NotificationPoster implements Runnable
{
@@ -104,6 +101,7 @@
}
try
{
+ iState = STATE_POSTING;
doPost(aOtaStatusNotification, null);
}
catch (Throwable t)
@@ -116,6 +114,12 @@
(System.currentTimeMillis());
iOtaStatusHandler.addNotification(aOtaStatusNotification);
}
+ finally
+ {
+ // Notify that waitForCompletion() can proceed.
+ iState = STATE_STOPPED;
+ this.notify();
+ }
}
/**
@@ -255,7 +259,6 @@
iState = STATE_STOPPED;
this.notify();
}
-
}
/**
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeEngine.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeEngine.java Tue May 11 16:07:20 2010 +0300
@@ -26,9 +26,6 @@
/**
* Execution engine.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public final class ExeEngine
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeProgressListener.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeProgressListener.java Tue May 11 16:07:20 2010 +0300
@@ -20,9 +20,6 @@
/**
* Execution engine progress listener interface.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public interface ExeProgressListener
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeStep.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeStep.java Tue May 11 16:07:20 2010 +0300
@@ -20,9 +20,6 @@
/**
* Base class for execution steps.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public class ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeTable.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/exetable/ExeTable.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
/**
* Execution table contains the steps to be executed in execution engine.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public final class ExeTable
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/integrityservice/FileOps.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/integrityservice/FileOps.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -111,7 +111,7 @@
result = copy(aFrom, aTo);
if (result)
{
- result = fromFile.delete();
+ result = fromFile.forceDelete();
if (!result)
{
Log.logError("FileOps.move: delete failed: " + aFrom);
@@ -144,7 +144,7 @@
}
else
{
- result = file.delete();
+ result = file.forceDelete();
}
if (!result)
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/FileList.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/FileList.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
/**
* FileList is a holder for a list of file related information.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class FileList
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/JadJarFile.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/JadJarFile.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
/**
* JadJarFile contains names of Jad and Jar files and attributes from them.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public class JadJarFile
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcherBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jadjarmatcher/JadJarMatcherBase.java Tue May 11 16:07:20 2010 +0300
@@ -38,9 +38,6 @@
* JadJarMatcher offers services for finding Jar when Jad filename is known,
* and finding Jad when Jar filename is known. JadJarMatcher only searches
* files from local folders.
- *
- * @author Nokia Corporation
- * @version $Rev: 9457 $
*/
public class JadJarMatcherBase
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtension.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtension.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
* JSR Installer Plugin interface. All Java Installer
* JSR plugins must implement this interface and have
* constructor that accepts empty argument list.
- *
- * @author Nokia Corporation
- * @version $Rev: 9337 $ $Date: 2010-01-14 14:27:46 +0200 (Thu, 14 Jan 2010) $
* @see JsrPluginNotifier
*/
public interface InstallerExtension
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Tue May 11 16:07:20 2010 +0300
@@ -25,9 +25,6 @@
/**
* Information passed to JSR plugins when installing or uninstalling
* Java applications
- *
- * @author Nokia Corporation
- * @version $Rev: 10381 $ $Date: 2010-04-06 15:34:34 +0300 (Tue, 06 Apr 2010) $
* @see JsrPluginNotifier
*/
public final class InstallerExtensionInfo
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -66,6 +66,7 @@
Log.log("Choosing default installation drive");
Vector drives = new Vector();
SysUtil.getUserVisibleDrives(drives);
+ logDrives("User visible drives:", drives);
if (ball.iOldSuite == null ||
!SysUtil.isDrivePresent(ball.iInstallationDrive))
{
@@ -131,6 +132,7 @@
Vector aDrives, int aSizeInBytes)
{
sortDrives(aDrives);
+ logDrives("Sorted drives:", aDrives);
for (int i = 0; i < aDrives.size(); i++)
{
DriveInfo drive = (DriveInfo)aDrives.elementAt(i);
@@ -163,14 +165,16 @@
*/
private static void sortDrives(Vector aDrives)
{
- for (int i = 1; i < aDrives.size(); i++)
+ for (int i = 0; i < aDrives.size(); i++)
{
- for (int j = 0; j < i; j++)
+ for (int j = i+1; j < aDrives.size(); j++)
{
- DriveInfo d1 = (DriveInfo)aDrives.elementAt(j);
- DriveInfo d2 = (DriveInfo)aDrives.elementAt(i);
+ DriveInfo d1 = (DriveInfo)aDrives.elementAt(i);
+ DriveInfo d2 = (DriveInfo)aDrives.elementAt(j);
if (hasHigherPriority(d1, d2))
{
+ Log.log(d1.getNumber() + " < " + d2.getNumber() +
+ ", swap [" + i + "] and [" + j + "]");
aDrives.removeElementAt(j);
aDrives.insertElementAt(d2, i);
}
@@ -193,6 +197,23 @@
}
/**
+ * Logs list of drives to info log.
+ */
+ private static void logDrives(String aMsg, Vector aDrives)
+ {
+ StringBuffer sortedDrives = new StringBuffer();
+ for (int i = 0; i < aDrives.size(); i++)
+ {
+ DriveInfo drive = (DriveInfo)aDrives.elementAt(i);
+ sortedDrives.append(" ").append(drive.getNumber())
+ .append(" (").append(drive.getDriveType())
+ .append(", ").append(drive.getFreeSpace()).append(")");
+
+ }
+ Log.log(aMsg + sortedDrives);
+ }
+
+ /**
* Returns the installation drive the user has chosen last.
* If user selection is not available, returns -1.
*/
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Tue May 11 16:07:20 2010 +0300
@@ -40,9 +40,6 @@
/**
* ConfirmInstallation shows installation confirmation dialog to user.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class ConfirmInstallation extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConvertIcons.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConvertIcons.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -53,9 +53,6 @@
* sets path to the converted and renamed icon to suite and application
* icons. [This must be done in S60 because icon cannot be registered
* into AppArc unless it can be opened in write mode and it has unique name.]
- *
- * @author Nokia Corporation
- * @version $Rev: 2259 $ $Date: 2008-09-19 12:27:49 +0300 (Fri, 19 Sep 2008) $
*/
public class ConvertIcons extends ExeStep
{
@@ -161,12 +158,14 @@
{
// Set suite icon
ball.iSuite.setConvertedIconPath(defaultIcon);
+ ball.iSuite.setUseDefaultIcon(true);
// Set application icons
for (int i = 0; i < newApps.size(); i++)
{
- ((ApplicationInfo)newApps.elementAt(i)).setConvertedIconPath(
- defaultIcon);
+ ApplicationInfo app = (ApplicationInfo)newApps.elementAt(i);
+ app.setConvertedIconPath(defaultIcon);
+ app.setUseDefaultIcon(true);
}
}
else
@@ -224,6 +223,7 @@
else
{
ball.iSuite.setConvertedIconPath(defaultIcon);
+ ball.iSuite.setUseDefaultIcon(true);
// Cannot use suite icon file
suiteIconFile = "";
}
@@ -231,6 +231,7 @@
else
{
ball.iSuite.setConvertedIconPath(defaultIcon);
+ ball.iSuite.setUseDefaultIcon(true);
}
// The icon of the application can be specified in two attributes.
@@ -289,6 +290,7 @@
{
// use default icon
newApp.setConvertedIconPath(defaultIcon);
+ newApp.setUseDefaultIcon(true);
}
}
else
@@ -362,6 +364,7 @@
// use default icon
ball.log("Using default icon for midlet number " + (i+1));
newApp.setConvertedIconPath(defaultIcon);
+ newApp.setUseDefaultIcon(true);
}
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CopyAppFiles.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CopyAppFiles.java Tue May 11 16:07:20 2010 +0300
@@ -222,6 +222,10 @@
for (int i = 0; i < apps.size(); i++)
{
appInfo = (ApplicationInfo)apps.elementAt(i);
+ if (appInfo.getUseDefaultIcon())
+ {
+ continue;
+ }
iconFilename = aBall.iSuite.getRegisteredIconPath(i);
iconDir = FileUtils.getParent(iconFilename);
if (!FileUtils.exists(iconDir))
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DlListener.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DlListener.java Tue May 11 16:07:20 2010 +0300
@@ -56,7 +56,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.started threw exception", t);
+ Log.logError(
+ "DlListener: InstallerUi.started threw exception", t);
}
}
}
@@ -74,7 +75,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.updateProgress threw exception", t);
+ Log.logError(
+ "DlListener: InstallerUi.updateProgress threw exception", t);
}
}
if (iBall.iSifNotifier != null)
@@ -90,7 +92,8 @@
}
catch (Throwable t)
{
- Log.logError("SifNotifier.notifyProgress threw exception", t);
+ Log.logError(
+ "DlListener: SifNotifier.notifyProgress threw exception", t);
}
}
}
@@ -107,7 +110,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.ended threw exception", t);
+ Log.logError(
+ "DlListener: InstallerUi.ended threw exception", t);
}
}
if (iBall != null)
@@ -145,7 +149,8 @@
}
catch (Throwable t)
{
- Log.logError("InstallerUi.getUsernamePassword threw exception", t);
+ Log.logError(
+ "DlListener: InstallerUi.getUsernamePassword threw exception", t);
}
}
return result;
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DownloadJad.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DownloadJad.java Tue May 11 16:07:20 2010 +0300
@@ -31,9 +31,6 @@
* This is mostly used in Linux platform because in S60 platform
* either jad or Jar is already present in the device when
* installation is started.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class DownloadJad extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DownloadJar.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/DownloadJar.java Tue May 11 16:07:20 2010 +0300
@@ -31,9 +31,6 @@
/**
* Installation step DownloadJar takes care of downloading Jar file.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class DownloadJar extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/HandleCustomAttributes.java Tue May 11 16:07:20 2010 +0300
@@ -74,14 +74,7 @@
}
else
{
- Log.logError("Invalid " + attrName + " value " + attrValue);
- throw new InvalidAttributeException
- (InstallerErrorMessage.INST_CORRUPT_PKG, null,
- InstallerDetailedErrorMessage.ATTR_UNSUPPORTED,
- new String[] { attrName },
- (aBall.attributeExistsInJad(attrName)?
- OtaStatusCode.INVALID_DESCRIPTOR:
- OtaStatusCode.INVALID_JAR));
+ Log.logWarning("Invalid " + attrName + " value " + attrValue);
}
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Tue May 11 16:07:20 2010 +0300
@@ -289,6 +289,20 @@
super.checkForCancel();
if (isCancelled())
{
+ if (iDownloader != null)
+ {
+ try
+ {
+ Log.log("checkForCancel: User cancelled, stopping downloader...");
+ iDownloader.stop();
+ iDownloader = null;
+ Log.log("checkForCancel: Downloader stopped");
+ }
+ catch (Throwable t)
+ {
+ Log.logWarning("checkForCancel: Stopping downloader failed", t);
+ }
+ }
throw new InstallerException
(InstallerErrorMessage.INST_CANCEL, null,
InstallerDetailedErrorMessage.NO_MSG, null,
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* MIDP installation step NotifyJsrPlugins.
* Added to MIDP2 Install table in com.nokia.mj.impl.installer.Installer
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public class NotifyJsrPlugins extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/OcspListener.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/OcspListener.java Tue May 11 16:07:20 2010 +0300
@@ -72,7 +72,8 @@
}
catch (Throwable t)
{
- Log.logError("Exception from InstallerUi.setOcspIndicator", t);
+ Log.logError(
+ "OcspListener: Exception from InstallerUi.setOcspIndicator", t);
}
}
if (iBall.iSifNotifier != null)
@@ -85,7 +86,8 @@
}
catch (Throwable t)
{
- Log.logError("SifNotifier.notifyProgress threw exception", t);
+ Log.logError(
+ "OcspListener: SifNotifier.notifyProgress threw exception", t);
}
}
}
@@ -101,7 +103,8 @@
}
catch (Throwable t)
{
- Log.logError("Exception from InstallerUi.setOcspIndicator", t);
+ Log.logError(
+ "OcspListener: Exception from InstallerUi.setOcspIndicator", t);
}
}
if (iBall.iSifNotifier != null)
@@ -114,7 +117,8 @@
}
catch (Throwable t)
{
- Log.logError("SifNotifier.notifyProgress threw exception", t);
+ Log.logError(
+ "OcspListener: SifNotifier.notifyProgress threw exception", t);
}
}
// Notify InstallBall so that WaitForOcsp step can proceed.
@@ -123,7 +127,8 @@
}
else
{
- Log.logError("OcspListener.ocspEvent: Unknown event: " + aEventId);
+ Log.logError(
+ "OcspListener.ocspEvent: Unknown event: " + aEventId);
}
}
}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/RegisterApplication.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/RegisterApplication.java Tue May 11 16:07:20 2010 +0300
@@ -31,9 +31,6 @@
/**
* MIDP installation step RegisterApplication.
* Added to MIDP2 Install table in com.nokia.mj.impl.installer.Installer
- *
- * @author Nokia Corporation
- * @version $Rev: 9375 $ $Date: 2010-01-18 12:54:40 +0200 (Mon, 18 Jan 2010) $
*/
public class RegisterApplication extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/SendInstallerResultMessage.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/SendInstallerResultMessage.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Installation step for sending InstallerResultMessage.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class SendInstallerResultMessage extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/SendOtaStatus.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/SendOtaStatus.java Tue May 11 16:07:20 2010 +0300
@@ -35,9 +35,6 @@
* Installation step for sending OTA status notifications.
* This is the first and the last step in installation execution table.
* This execution step may not throw any exceptions.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class SendOtaStatus extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/StartProgressNotifications.java Tue May 11 16:07:20 2010 +0300
@@ -22,6 +22,8 @@
import com.nokia.mj.impl.installer.exetable.ExeBall;
import com.nokia.mj.impl.installer.exetable.ExeStep;
import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo;
+import com.nokia.mj.impl.installer.utils.FileRoots;
+import com.nokia.mj.impl.installer.utils.FileUtils;
import com.nokia.mj.impl.installer.utils.InstallerException;
import com.nokia.mj.impl.installer.utils.Log;
@@ -53,6 +55,11 @@
// Init application names array.
Vector appNamesVector = ball.iSuite.getApplications();
+ if (ball.iOldSuite != null)
+ {
+ // In update get the names of previously installed applications.
+ appNamesVector = ball.iOldSuite.getApplications();
+ }
String[] appNames = new String[appNamesVector.size()];
for (int i = 0; i < appNamesVector.size(); i++)
{
@@ -60,9 +67,26 @@
((ApplicationInfo)appNamesVector.elementAt(i)).getName();
}
- // Use default icon for now.
- String componentIconPath =
- ball.iApplicationRegistrator.getDefaultIconPath();
+ // Initialize icon filenames and icon dir.
+ String iconDir = null;
+ String componentIcon = null;
+ String[] appIcons = null;
+ if (ball.iOldSuite != null)
+ {
+ // In update get the icons of previously installed applications.
+ iconDir = FileRoots.getRegisteredIconDir(
+ FileUtils.getDrive(ball.iOldSuite.getRootDir())) +
+ ball.iOldSuite.getUid().toString();
+ appIcons = ball.iOldSuite.getRegisteredAppIcons();
+ if (appIcons != null)
+ {
+ for (int i = 0; i < appIcons.length; i++)
+ {
+ Log.log("Old app icon " + appIcons[i] +
+ " for "+ appNames[i] + " from " + iconDir);
+ }
+ }
+ }
try
{
@@ -70,8 +94,8 @@
(ball.iOldSuite != null?
ball.iSifNotifier.OP_UPDATE: ball.iSifNotifier.OP_INSTALL),
ball.iSuite.getGlobalId(), ball.iSuite.getName(),
- appNames, ball.iSuite.calculateInitialSize(),
- componentIconPath);
+ appNames, appIcons, ball.iSuite.calculateInitialSize(),
+ iconDir, componentIcon);
}
catch (Throwable t)
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForDownload.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForDownload.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Installation step WaitForDownload blocks and waits until
* donwload gets completed.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class WaitForDownload extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForLaunchAppQuery.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForLaunchAppQuery.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Installation step which waits until user has
* answered to launch application query.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class WaitForLaunchAppQuery extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForOcsp.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/WaitForOcsp.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Installation step WaitForOcsp blocks and waits until
* certificate validation (OCSP) has been completed.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class WaitForOcsp extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/CheckUninstallationAllowed.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/CheckUninstallationAllowed.java Tue May 11 16:07:20 2010 +0300
@@ -33,9 +33,6 @@
/**
* Check if uninstallation is allowed from Nokia-MIDlet-Block-Uninstall
* attribute and protection domain.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class CheckUninstallationAllowed extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/ConfirmUninstallation.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/ConfirmUninstallation.java Tue May 11 16:07:20 2010 +0300
@@ -38,9 +38,6 @@
/**
* ConfirmUninstallation shows uninstallation confirmation dialog to user.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class ConfirmUninstallation extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* MIDP uninstallation step NotifyJsrPlugins.
* Added to MIDP2 Uninstall table in com.nokia.mj.impl.installer.Installer
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public class NotifyJsrPlugins extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/RemoveSecurityData.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/RemoveSecurityData.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Removes application's security data from storage.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class RemoveSecurityData extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/SendInstallerResultMessage.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/SendInstallerResultMessage.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* Installation step for sending InstallerResultMessage.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class SendInstallerResultMessage extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/SendOtaStatus.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/SendOtaStatus.java Tue May 11 16:07:20 2010 +0300
@@ -32,9 +32,6 @@
* Uninstallation step for sending OTA status notifications.
* This is the first and the last step in uninstallation execution table.
* This execution step may not throw any exceptions.
- *
- * @author Nokia Corporation
- * @version $Rev: $ $Date: $
*/
public class SendOtaStatus extends ExeStep
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/StartProgressNotifications.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/StartProgressNotifications.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,14 @@
import com.nokia.mj.impl.installer.exetable.ExeBall;
import com.nokia.mj.impl.installer.exetable.ExeStep;
import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo;
+import com.nokia.mj.impl.installer.utils.FileRoots;
+import com.nokia.mj.impl.installer.utils.FileUtils;
import com.nokia.mj.impl.installer.utils.InstallerException;
import com.nokia.mj.impl.installer.utils.Log;
+import com.nokia.mj.impl.utils.Uid;
+import java.io.IOException;
+import java.util.Enumeration;
import java.util.Vector;
public class StartProgressNotifications extends ExeStep
@@ -60,17 +65,28 @@
((ApplicationInfo)appNamesVector.elementAt(i)).getName();
}
- // Use default icon for now.
- String componentIconPath =
- ball.iApplicationRegistrator.getDefaultIconPath();
+ // Initialize icon filenames and icon dir.
+ String iconDir = FileRoots.getRegisteredIconDir(
+ FileUtils.getDrive(ball.iSuite.getRootDir())) +
+ ball.iSuite.getUid().toString();
+ String componentIcon = null;
+ String[] appIcons = ball.iSuite.getRegisteredAppIcons();
+ if (appIcons != null)
+ {
+ for (int i = 0; i < appIcons.length; i++)
+ {
+ Log.log("App icon " + appIcons[i] +
+ " for "+ appNames[i] + " from " + iconDir);
+ }
+ }
try
{
ball.iSifNotifier.notifyStart(
ball.iSifNotifier.OP_UNINSTALL,
ball.iSuite.getGlobalId(), ball.iSuite.getName(),
- appNames, ball.iSuite.calculateInitialSize(),
- componentIconPath);
+ appNames, appIcons, ball.iSuite.calculateInitialSize(),
+ iconDir, componentIcon);
}
catch (Throwable t)
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/ApplicationInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/ApplicationInfo.java Tue May 11 16:07:20 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -36,6 +36,8 @@
private String iMainClass = null;
private int iAutoStart = AUTOSTART_FALSE;
+ /** Flag telling if default icon should be used. */
+ private boolean iUseDefaultIcon = false;
/** Filename for converted icon. This member is not saved into storage. */
private String iConvertedIconPath = null;
@@ -155,6 +157,22 @@
}
/**
+ * Returns true if default icon should be used, false otherwise.
+ */
+ public boolean getUseDefaultIcon()
+ {
+ return iUseDefaultIcon;
+ }
+
+ /**
+ * Set flag telling if default icon should be used.
+ */
+ public void setUseDefaultIcon(boolean aUseDefaultIcon)
+ {
+ iUseDefaultIcon = aUseDefaultIcon;
+ }
+
+ /**
* Get icon path for converted icon.
*/
public String getConvertedIconPath()
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/OtaStatusHandler.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/OtaStatusHandler.java Tue May 11 16:07:20 2010 +0300
@@ -44,9 +44,6 @@
* Because JavaStorage limits the number of concurrent sessions to
* one for each database, the OtaStatusHandler uses a separate
* JavaOtaStorage database for storing the OTA status notifications.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public class OtaStatusHandler
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/OtaStatusNotification.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/OtaStatusNotification.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* OtaStatusNotification contains information of one Ota status
* notification that needs to be sent.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $ $Date: 2009-12-07 18:36:08 +0200 (Mon, 07 Dec 2009) $
*/
public class OtaStatusNotification
{
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/SuiteInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/storagehandler/SuiteInfo.java Tue May 11 16:07:20 2010 +0300
@@ -18,13 +18,16 @@
package com.nokia.mj.impl.installer.storagehandler;
+import com.nokia.mj.impl.fileutils.FileUtility;
import com.nokia.mj.impl.installer.utils.ComponentId;
import com.nokia.mj.impl.installer.utils.FileRoots;
import com.nokia.mj.impl.installer.utils.FileUtils;
+import com.nokia.mj.impl.installer.utils.Log;
import com.nokia.mj.impl.utils.Attribute;
import com.nokia.mj.impl.utils.Uid;
import com.nokia.mj.impl.utils.Version;
+import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
@@ -71,6 +74,8 @@
// Flag telling if application suite is trusted
private boolean iTrusted = false;
+ /** Flag telling if default icon should be used. */
+ private boolean iUseDefaultIcon = false;
/** Filename for converted icon. This member is not saved into storage. */
private String iConvertedIconPath = null;
/** Application installation group. This member is not saved into storage. */
@@ -384,8 +389,7 @@
}
/**
- * Get icon path for converted icon for speccified
- * application in the suite.
+ * Get registered icon path for specified application in the suite.
*/
public String getRegisteredIconPath(int aAppIndex)
{
@@ -407,6 +411,56 @@
}
/**
+ * Get names of application icon files from the directory where
+ * icons registered to the platform are. This method finds filenames
+ * from the disk, so it can only be used for a suite that has been
+ * installed.
+ */
+ public String[] getRegisteredAppIcons()
+ {
+ String iconDirName =
+ FileRoots.getRegisteredIconDir(FileUtils.getDrive(getRootDir())) +
+ getUid().toString();
+ Vector filenames = new Vector();
+ try
+ {
+ FileUtility iconDir = new FileUtility(iconDirName);
+ if (iconDir.exists())
+ {
+ Enumeration e = iconDir.list();
+ while (e.hasMoreElements())
+ {
+ String filename = (String)e.nextElement();
+ filenames.addElement(filename);
+ }
+ }
+ }
+ catch (IOException ioe)
+ {
+ Log.logWarning(
+ "Cannot list application icons from " + iconDirName, ioe);
+ return null;
+ }
+ Uid[] appUids = getApplicationUids();
+ String[] appIcons = new String[appUids.length];
+ String filename = null;
+ for (int i = 0; i < appUids.length; i++)
+ {
+ appIcons[i] = null;
+ for (int j = 0; j < filenames.size(); j++)
+ {
+ filename = (String)filenames.elementAt(j);
+ if (filename.startsWith(appUids[i].toString()))
+ {
+ appIcons[i] = filename;
+ break;
+ }
+ }
+ }
+ return appIcons;
+ }
+
+ /**
* Tells if application suite is trusted.
*
* @return true if suite is trusted, false otherwise
@@ -417,6 +471,22 @@
}
/**
+ * Returns true if default icon should be used, false otherwise.
+ */
+ public boolean getUseDefaultIcon()
+ {
+ return iUseDefaultIcon;
+ }
+
+ /**
+ * Set flag telling if default icon should be used.
+ */
+ public void setUseDefaultIcon(boolean aUseDefaultIcon)
+ {
+ iUseDefaultIcon = aUseDefaultIcon;
+ }
+
+ /**
* Get icon path for converted icon.
*/
public String getConvertedIconPath()
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/DriveInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/DriveInfo.java Tue May 11 16:07:20 2010 +0300
@@ -23,9 +23,6 @@
/**
* Contains all information about a device drive needed by UI.
- *
- * @author Nokia Corporation
- * @version $Rev: 2572 $
*/
public final class DriveInfo
{
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp Tue May 11 16:07:20 2010 +0300
@@ -520,6 +520,7 @@
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1commitSession
(JNIEnv *, jclass, jint aSessionHandle, jboolean aSynchronous)
{
+ (void)aSynchronous; // suppress compilation warning about unused argument
// Convert session handle to pointer.
RApaLsSession *pApaSession =
reinterpret_cast<RApaLsSession*>(aSessionHandle<<2);
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Tue May 11 16:07:20 2010 +0300
@@ -42,6 +42,8 @@
IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
+// String to be used for icon filenames when icon is not present.
+_LIT(KNoIconFilename, "");
/*
* Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
@@ -61,13 +63,17 @@
void NotifyStartL(
JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier,
jstring aGlobalComponentId, jstring aComponentName,
- jobjectArray aApplicationNames, jint aComponentSize,
- jstring aComponentIconPath)
+ jobjectArray aApplicationNames, jobjectArray aApplicationIcons,
+ jint aComponentSize, jstring aIconDir, jstring /*aComponentIcon*/)
{
__UHEAP_MARK;
HBufC *globalComponentId = CreateHBufCFromJavaStringLC(aEnv, aGlobalComponentId);
HBufC *componentName = CreateHBufCFromJavaStringLC(aEnv, aComponentName);
- HBufC *componentIconPath = CreateHBufCFromJavaStringLC(aEnv, aComponentIconPath);
+ HBufC *iconDir = NULL;
+ if (NULL != aIconDir)
+ {
+ iconDir = CreateHBufCFromJavaStringLC(aEnv, aIconDir);
+ }
RPointerArray<HBufC> applicationNames;
CleanupResetAndDestroyPushL(applicationNames);
@@ -77,16 +83,39 @@
TInt appsCount = aEnv->GetArrayLength(aApplicationNames);
for (TInt i = 0; i < appsCount; i++)
{
- HBufC *appName = CreateHBufCFromJavaStringLC(
- aEnv, (jstring)aEnv->GetObjectArrayElement(aApplicationNames, i));
+ HBufC *appName =
+ CreateHBufCFromJavaStringLC(
+ aEnv, (jstring)aEnv->GetObjectArrayElement(aApplicationNames, i));
applicationNames.AppendL(appName);
CleanupStack::Pop(appName);
}
+ if (NULL != aApplicationIcons)
+ {
+ appsCount = aEnv->GetArrayLength(aApplicationIcons);
+ for (TInt i = 0; i < appsCount; i++)
+ {
+ jstring tmpAppIcon =
+ (jstring)aEnv->GetObjectArrayElement(aApplicationIcons, i);
+ if (NULL != tmpAppIcon)
+ {
+ HBufC *appIcon = CreateHBufCFromJavaStringLC(aEnv, tmpAppIcon);
+ applicationIcons.AppendL(appIcon);
+ CleanupStack::Pop(appIcon);
+ }
+ else
+ {
+ // Add a string indicating that icon is not available
+ // for this application.
+ applicationIcons.AppendL(KNoIconFilename().AllocL());
+ }
+ }
+ }
- CSifOperationStartData *startData = CSifOperationStartData::NewLC(
- *globalComponentId, *componentName, applicationNames, applicationIcons,
- aComponentSize, /*aIconPath=*/ *componentIconPath,
- /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava);
+ CSifOperationStartData *startData =
+ CSifOperationStartData::NewLC(
+ *globalComponentId, *componentName, applicationNames, applicationIcons,
+ aComponentSize, /*aIconPath=*/ (NULL != aIconDir? *iconDir: KNullDesC()),
+ /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava);
User::LeaveIfError(aNotifier->PublishStart(*startData));
@@ -95,7 +124,10 @@
CleanupStack::PopAndDestroy(&applicationIcons);
CleanupStack::PopAndDestroy(&applicationNames);
- CleanupStack::PopAndDestroy(componentIconPath);
+ if (NULL != aIconDir)
+ {
+ CleanupStack::PopAndDestroy(iconDir);
+ }
CleanupStack::PopAndDestroy(componentName);
CleanupStack::PopAndDestroy(globalComponentId);
__UHEAP_MARKEND;
@@ -108,14 +140,15 @@
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart
(JNIEnv *aEnv, jclass, jint aHandle, jstring aGlobalComponentId,
- jstring aComponentName, jobjectArray aApplicationNames, jint aComponentSize,
- jstring aComponentIconPath)
+ jstring aComponentName, jobjectArray aApplicationNames,
+ jobjectArray aApplicationIcons, jint aComponentSize,
+ jstring aIconDir, jstring aComponentIcon)
{
CPublishSifOperationInfo *pNotifier =
reinterpret_cast<CPublishSifOperationInfo*>(aHandle<<2);
TRAPD(err, NotifyStartL(aEnv, pNotifier, aGlobalComponentId, aComponentName,
- aApplicationNames, aComponentSize,
- aComponentIconPath));
+ aApplicationNames, aApplicationIcons,
+ aComponentSize, aIconDir, aComponentIcon));
return err;
}
@@ -272,7 +305,7 @@
* Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;I)I
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart
-(JNIEnv *, jclass, jint, jstring, jstring, jobjectArray, jint, jstring)
+(JNIEnv *, jclass, jint, jstring, jstring, jobjectArray, jobjectArray, jint, jstring, jstring)
{
LOG(EJavaInstaller, EInfo, "SifNotifier.notifyStart");
return KErrNone;
@@ -286,6 +319,8 @@
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyEnd
(JNIEnv *, jclass, jint, jstring, jint aErrCategory, jint aErrCode, jstring, jstring)
{
+ (void)aErrCategory; // suppress compilation warning about unused argument
+ (void)aErrCode; // suppress compilation warning about unused argument
LOG2(EJavaInstaller, EInfo,
"SifNotifier.notifyEnd: errCategory=%d, errCode=%d",
aErrCategory, aErrCode);
@@ -301,6 +336,10 @@
(JNIEnv *, jclass, jint, jstring,
jint aOperation, jint aSubOperation, jint aCurrent, jint aTotal)
{
+ (void)aOperation; // suppress compilation warning about unused argument
+ (void)aSubOperation; // suppress compilation warning about unused argument
+ (void)aCurrent; // suppress compilation warning about unused argument
+ (void)aTotal; // suppress compilation warning about unused argument
LOG4(EJavaInstaller, EInfo,
"SifNotifier.notifyProgress: op=%d, subop=%d, current=%d, total=%d",
aOperation, aSubOperation, aCurrent, aTotal);
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Tue May 11 16:07:20 2010 +0300
@@ -628,22 +628,23 @@
RDesWriteStream writeStream(opaqueDataBuf);
writeStream.WriteInt32L(aAppUid);
writeStream.CommitL();
- COpaqueData *opaqueData =
- COpaqueData::NewLC(opaqueDataBuf, KUnspecifiedLocale);
+ COpaqueData *opaqueData = COpaqueData::NewLC(opaqueDataBuf, KNonLocalized);
opaqueDataArray.AppendL(opaqueData);
CleanupStack::Pop(opaqueData);
RPointerArray<Usif::CLocalizableAppInfo> localizableAppInfoList;
CleanupResetAndDestroyPushL(localizableAppInfoList);
// Add non-localized application name (caption) and icon.
- CCaptionAndIconInfo *captionAndIconInfo = CCaptionAndIconInfo::NewLC(
- /*aCaption=*/ *caption,
- /*aIconFileName=*/ *iconFilename,
- /*aNumOfAppIcons=*/ numberOfAppIcons);
- CLocalizableAppInfo *locAppInfo = CLocalizableAppInfo::NewLC(
- /*aShortCaption=*/ KNullDesC, /*aApplicationLanguage=*/ KNonLocalized,
- /*aGroupName=*/ KNullDesC, /*aCaptionAndIconInfo=*/ captionAndIconInfo,
- /*aViewDataList=*/ viewDataList);
+ CCaptionAndIconInfo *captionAndIconInfo =
+ CCaptionAndIconInfo::NewLC(
+ /*aCaption=*/ *caption,
+ /*aIconFileName=*/ (NULL != aIconFilename? *iconFilename: KNullDesC()),
+ /*aNumOfAppIcons=*/ numberOfAppIcons);
+ CLocalizableAppInfo *locAppInfo =
+ CLocalizableAppInfo::NewLC(
+ /*aShortCaption=*/ KNullDesC, /*aApplicationLanguage=*/ KNonLocalized,
+ /*aGroupName=*/ KNullDesC, /*aCaptionAndIconInfo=*/ captionAndIconInfo,
+ /*aViewDataList=*/ viewDataList);
localizableAppInfoList.AppendL(locAppInfo);
CleanupStack::Pop(locAppInfo);
CleanupStack::Pop(captionAndIconInfo);
@@ -659,8 +660,9 @@
for (TInt i = 0; i < langCount; i++)
{
TLanguage tmpLanguage = (TLanguage)languages[i];
- HBufC *tmpCaption = CreateHBufCFromJavaStringLC(
- aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
+ HBufC *tmpCaption =
+ CreateHBufCFromJavaStringLC(
+ aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
captionsArray.AppendL(tmpCaption);
CleanupStack::Pop(tmpCaption);
//LOG1(EJavaInstaller, EInfo,
@@ -708,7 +710,7 @@
/*aLocalizableAppInfoList=*/ localizableAppInfoList,
/*aAppPropertiesArray=*/ appPropertiesArray,
/*aOpaqueDataArray=*/ opaqueDataArray,
- /*aAppUid=*/ appUid, /*aAppFile=*/ *appFilename,
+ /*aAppUid=*/ appUid, /*aAppFile=*/ appName,
/*aCharacteristics=*/ appCharacteristics,
/*aDefaultScreenNumber=*/ 0);
aScr->AddApplicationEntryL(aComponentId, *appRegData);
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistratorTest.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistratorTest.java Tue May 11 16:07:20 2010 +0300
@@ -30,9 +30,6 @@
/**
* ApplicationRegistrator unit tests.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public class ApplicationRegistratorTest extends TestCase implements InstallerMain
{
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/customisationproperties/CustomisationPropertiesTest.java Tue May 11 16:07:20 2010 +0300
@@ -33,9 +33,6 @@
/**
* ApplicationRegistrator unit tests.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public class CustomisationPropertiesTest extends TestCase implements InstallerMain
{
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/BadTestPlugin.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/BadTestPlugin.java Tue May 11 16:07:20 2010 +0300
@@ -23,8 +23,6 @@
* This plugin does not implement InstallerExtension interface although
* it has all the correct functions.
*
- * @author Nokia Corporation
- * @version $Rev: 9336 $ $Date: 2010-01-14 14:18:29 +0200 (Thu, 14 Jan 2010) $
* @see InstallerExtension
*/
public class BadTestPlugin
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifierTest.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/JsrPluginNotifierTest.java Tue May 11 16:07:20 2010 +0300
@@ -37,9 +37,6 @@
/**
* ApplicationRegistrator unit tests.
- *
- * @author Nokia Corporation
- * @version $Rev: 9041 $
*/
public class JsrPluginNotifierTest extends TestCase implements InstallerMain
{
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/TestPlugin.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/TestPlugin.java Tue May 11 16:07:20 2010 +0300
@@ -21,8 +21,6 @@
/**
* Installer Jsr plugin just for test purposes.
*
- * @author Nokia Corporation
- * @version $Rev: 9336 $ $Date: 2010-01-14 14:18:29 +0200 (Thu, 14 Jan 2010) $
* @see InstallerExtension
*/
public class TestPlugin implements InstallerExtension
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/TestPlugin2.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/TestPlugin2.java Tue May 11 16:07:20 2010 +0300
@@ -21,8 +21,6 @@
/**
* Installer Jsr plugin just for test purposes.
*
- * @author Nokia Corporation
- * @version $Rev: 9336 $ $Date: 2010-01-14 14:18:29 +0200 (Thu, 14 Jan 2010) $
* @see InstallerExtension
*/
public class TestPlugin2 implements InstallerExtension
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000019.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000046.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000058.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000070.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000090.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000150.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000172.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000175.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000182.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000189.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000250.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000305.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000390.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000500.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000582.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000618.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/00000703.jar has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/3DSpaceShooter.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-MIDlet-1: 3DSpaceShooter, /icon.png, Sapce3D
-
-
-MIDlet-Jar-Size: 240229
-
-
-MIDlet-Jar-URL: 3DSpaceShooter.jar
-MIDlet-Name: 3DSpaceShooter
-MIDlet-Vendor: Innovative Ideas From Outer Space Ltd.
-
-
-
-
-
-MIDlet-Version: 1.0.4
-Nokia-MIDlet-Original-Display-Size: 176,208
-Nokia-MIDlet-On-Screen-Keypad: navigationkeys
\ No newline at end of file
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/800_x_N97_64GB_fr_speed_v5_32_01.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-RepositoryContentType: text/plain
-UserAgent: NokiaN95/J2ME-IMPS
-ShowStatusTextInCL: 0
-SpaceBetweenFriendsNameAndHisIcon: 3
-ShowDomain: 0
-MIDlet-Icon: /img/App.png
-NormalPollRate: 12000
-TCPCIREnabled: 1
-Images: http://download.ko.mysite.fr/koi/j2me/enc/1111/
-SpecialKeys: -12
-Host: koi.ko.mysite.fr
-TCPPingRate: 1560000
-EnableCommunitySelector: 1
-BackgoundImgPos: 0
-ScrollBarWidth: 5
-MIDlet-Vendor: Vodafone
-BillingURL: http://koi.ko.mysite.fr/koi/sq.dll/awo_buy
-UseTemplate: 1
-MaxFriendsNumber: 150
-StopTCPCIR: 1
-MIDlet-Version: 4.5.27
-SelectCommand: 1
-KeepAlive: 1500000
-SMSCIREnabled: 1
-MultiTrans: 5
-DefaultDomain: gmaeam1.com
-EnableBackgroundImage: 0
-MicroEdition-Profile: MIDP-2.0
-TermsAndConditions: 1
-SeamlessLogin: 0
-GlobalMsgLength: 600
-MIDlet-Push-1: sms://:3716, ui.Main, *
-RegisterConnection: 1
-ViewType: 0
-HTTPCIREnabled: 1
-IsTabFontBold: 1
-AboutNaming: PrerryLake_h_N97_fr_speed_v4_5_27
-InitMessage: 1
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-Jar-URL: 800€_x_N97_64GB_fr_speed_v5_32_01.jar
-AnimationRate: 300
-Multitask: 0
-EnableSemitransparentHighlight: 0
-CheckContentType: 1
-MaxMsgNumber: 30
-Port: 80
-LoginURL: http:/koi.ko.mysite.fr/koi/sq.dll/dsw_daas
-UseKeepAlive: 0
-MIDlet-Install-Notify: http://download.ko.mysite.fr/InstallNotify?c=
-SelfUpgrade: 1
-MIDlet-Data-Size: 500
-AnimationEnabled: 1
-TitleUpdateRate: 7000
-EnableRenameFriend: 0
-SystemMessageUserTimeout: 25000
-Help: http://download.ko.mysite.fr/koi/j2me/enc/help/fr/
-UseDeviceTimeForIncomingMsg: 1
-TCPCIRReconnectCount: 3
-DefaultLanguage: de
-MIDlet-1: Messenger,/img/App.png,ui.Main
-MsgListHeightTuner: 8
-MIDlet-Name: Messenger
-FontSize: 0
-WVExtension: /web/wv.dll/msn_imgw
-RefreshChoiceOnStateChange: 0
-MIDlet-Permissions: javax.microedition.io.Connector.http,javax.microedition.io.Connector.https,javax.microedition.io.Connector.socket,javax.microedition.io.Connector.sms,javax.wireless.messaging.sms.receive,javax.microedition.io.PushRegistry,javax.microedition.media.control.VideoControl.getSnapshot,javax.microedition.io.Connector.file.read,javax.microedition.io.Connector.file.write
-MaxConversations: 20
-SubscribePresence: 1
-PersistencyEnabled: 1
-RepositoryAlertMessage: Error loading application data. Please try again later.
-GlobalMaxCharCount: 5000
-EnableEmoticonsSelector: 1
-IdleMode: 1
-SpacerHeight: 5
-TCPCIRReconnectRate: 3000
-MIDlet-Jar-Size: 502719
-BackgroundEnabled: 1
-IsCaseInsensitive: 1
-AlertToneMsg: http://download.ko.mysite.fr/koi/j2me/enc/dingdong.mp3
-NormalNoPollTransition: 1800000
-AlertToneContact: http://download.ko.mysite.fr/koi/j2me/enc/alalal.mp3
-NoPollStateEnabled: 0
-Device: 3
-SupportCustomUTF8: 0
-MIDlet-Info-URL: www.koikoikoi.com
-MsgListWidthTuner: 15
-CommandsType: 1;4;2;4;3;8;5;4;6;2;8;2;9;7;10;4;11;8;23;4;24;3;37;2;68;2;69;7;76;4;80;2;86;6;87;1
-IdleModeTimeOut: 900000
-ShowAboutLogo: 1
-TopMarginFriendName: 2
-ContentLanguage: fr
-FastPollRate: 7000
-NokiaTimeOut: 100
-FastNormalTransition: 20000
-EnableShortProfile: 1
-RepositoryVersion: 1
-MIDlet-Jar-RSA-SHA1: QhSjP7F1q3TGmmNC45cUGclVWB537GtcMLpplIJGe+TyDwJ1Mx5VssNHpp3Qs3C1WHLycvcfOkDT0CscStI0lV/5Xy33z192qEHIT5lkGVz1Rd1nfBHqrIBqv77H7dHW1tdU6RiVajx8jrYYXz+Yh/7U2kskmGXd0bLSYq2cuZZgkiT9YDOLa8OJ1Xn2U4/AYzonM1tjGQvkOniCvwqv0DXDW3GAial5w7hzB4txSopBgWiCO7sEPgkssJIvWQ2dsuLnwb3nU8gsUYWuRqidSI5Dm8mSOEA0zjRoREjTJjkqRZXX3r27rtp+omYh+VNCkXDneiNcaihWpkW5TgMhVg==
-MIDlet-Certificate-1-1: MIIEOTCCAyGgAwIBAgILAQAAAAABFIeLkAEwCQYJKoZIhvcNAQEFBQAwUDELNAkGA1UEBhMCVVsxFzAVBgNVBAoIDlZvZGFmb25lIEdyb3VwMSgwJgYDVQQDEx9Wb2RhZm9uZSAoVHJ1c3RlZCBBcHBsaWNhdGlvbnMpMB4XDTA3MDgyMTA4MzA0NFoXDTEyMDgyMTA4MzA0NFowTzELMAkGA1UEBhMCU0cxFDASBgNVBAoTC05ldXN0YXIgTkdNMSowKAYDVQQDEyFNb2JpbGUgSW5zdGFudCBNZXNzYWdpbmcgMjEuMDguMDcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCFfdEngntebK38dtsdODIkNzMiYsngpTwgnDPqV23m/OtsCX1+1E3+ns9v7EPQVqeTuPYUbUiQRXAYE2NpnUjzNd4bKIXBlk18YpXftMxKv4XRvtVa273O/nbKigtR9IuJx2Pz/x/zWbDpc4ZitRQaRTHy0oA1W+htVI1BBzO8cFC3kf4DTNEXjeYHGF5U7deGp/KuN8qfN7QPJ5gtYyUcwYtrV9imc7P2idLFfYGejm7/s/R3qh9o3bIvqLSHUQbwTQNz7bA7QzpBYkSgaQqzif8+ZYRZuLApjbhpoM5XRFUwQCu6KXx7ZPMKoCKVjof20LWlilUiBrVIXMIwHq0tAgMBAAGjggETMIIBDzAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwUgYDVR0fBEswSTBHoEWgQ4ZBaHR0cDovL2NybC52b2RhZm9uZS1wa2kuY29tL2NybC52L1ZvZGFmb25lVHJ1c3RlZEFwcGxpY2F0aW9ucy5jcmwwOAYIKwYBBQUHAQEELDAqMCgGCCsGAQUFBzABhhxodHRwOi8vb2NzcC52b2RhZm9uZS1wa2kuY29tMBoGA1UdIAQTMBEwDwYNKoY6AAHv9U8BAQMBAzAfBgNVHSMEGDAWgBQ7En6Wl4emCf8AlmWvsw/TeSSR9DAdBgNVHQ4EFgQUadzkP7g69+F/NQGoOfvOG1PC6YowDQYJKoZIhvcNAQEFBQADggEBAK2Z4qE4EFlXYL3ELnsbV/Ri6igPgdXgSZalaw8IKorw19TX7ERpL2tCiyDqisEJygNLW2iok9Nn3DUsmJTr0CoSZFGZc88hkJ9mlDTCQnNa9Hx9XQhp3Ig0uo1Eoei+12kF9j1kVlQJl6QkOPrbdmBbGpv7NFTM29zkPN/4wt3uUvoLZ/ZlbB4NjufZ6gVL77Bt2+UNwKLM4wF39Dy3zTD6qcJPuitGGSss0X4SYX6AzTtNRM+CtTPkFby10pHmmr4ClSfGtOZnXmbGizOIUh/lgOgv/nG9Q+dRDUGDTkhnDwMs1b0reQ0rGE1jFayCJ6Rmn/03FIN5N1SKfgkSeBE=
-MIDlet-Certificate-1-2: MIIECjCCAvKgAwIBAgIFAwEAAzANBgkqhkiG9w0BAQUF8DBLMQswCQYDVQQGEwJVSzEXNBUGA1UEChMOVm9kYWXvbmUgR3JvdXAxIzAhBgNVBAMTGlZvZGFmb25lIChPcGVyYXRvciBEb21haW4pMB4XDTA1MDYxMzExMDAwMFoXDTIxMTIzMTEyMDAwMFowUDELMAkGA1UEBhMCVUsxFzAVBgNVBAoTDlZvZGFmb25lIEdyb3VwMSgwJgYDVQQDEx9Wb2RhZm9uZSAoVHJ1c3RlZCBBcHBsaWNhdGlvbnMpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfev7oXJy+WKdRjmc2i+Y8vMI3ey/LggGtOhGhY7w1oH1puYttgAjwPP7Ff2qObaJyfFnX81aCopQWeymGzpJtcIv/Z5sZRayBw9ceNIqI7WrwS3Ht//4uqUIH0p6VtPuRukNAnJewbFGgImowwZI4sizQ5Idqxx14lUoOTw8EaE0ygwXSJefS1w/5vuShyujd22F3wHpQnjo/lf05y14x43Uf+PpfFoVzvKm8q/n4VMtzMwi04vkgPjkflT2yay8WWtEpxU6rw8j32EWM/A2+kd4YbTE50I9/XFmIitHajaPVB3piwsChSt4d89UyIP/a+xGkPMultznEdH23SptQIDAQABo4HwMIHtMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBQ7En6Wl4emCf8AlmWvsw/TeSSR9DAZBgNVHSAEEjAQMA4GDCqGOgAB7/VPAQEDATBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLnZvZGFmb25lLXBraS5jb20vY3JsLnYvVm9kYWZvbmVPcGVyYXRvckRvbWFpbi5jcmwwHQYDVR0lBBYwFAYIKwYBBQUHAwMGCCsGAQUFBwMJMB8GA1UdIwQYMBaAFEjdPe/gPJzfErEw/ZHhwen7l9wIMA0GCSqGSIb3DQEBBQUAA4IBAQCaehJEHzna6onjE8bCCsi7A5NxcQ2Cx85PYs67yxQZ0wMQq1khzxsOJPB7H4SoXlceNMvIxpgPFm/ZcLNdeyjoYOQccH+aS6GRSerYX3COdbtWA4Gjq/sB6ghoUZ74+VbXD3t9Rhrnt7fOMe1llWOcf/eoMmvOrJOrBPrC3ZxZEwyHAgyqEJDn2Z8KXTMUr41jge3KyhxRehflRcYhdXzwmE+8LOHaN7xLEZauOuafyBEVpjVN5UaaOm/v8mTn0TymV2j9R7D8Nycbz1gVeMrOhNW2GODxjvu5IoEHQh/myul28EecKGx05Xprcodr0a8Q6LKJg+ihJMxMrS3YEylp
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-MIDlet-Jar-URL: https://uljava.gjmptw.de/midlets/harmonized/Local%20Connectivity%20(BT%20and%20IrDa)/BCExchanger/BCExchanger.jar
-MIDlet-Install-Notify: https://uljava.gjmptw.de/Index/Index.php/BCExchanger.jad?installed=BCExchanger_harmony
-MIDlet-1: BCExchangerMIDlet, /icon.png, bcexchanger.BCExchangerMIDlet
-MIDlet-Description: Demonstrates the usage of the JSR-82 Bluetooth OBEX API by exchanging business cards between devices.
-MIDlet-Jar-Size: 29967
-MIDlet-Name: BCExchanger
-MIDlet-Vendor: Forum Nokia
-MIDlet-Version: 1.0.0
-MicroEdition-Configuration: CLDC-1.1
-MicroEdition-Profile: MIDP-2.0
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/BCExchanger.zip has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/DevCertTestMIDlet.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-MIDlet-1: DevCertTestMIDlet, , com.nokia.midp.test.devcerttests.DevCertTestMIDlet
-MIDlet-Jar-Size: 3152
-MIDlet-Jar-URL: DevCertTestMIDlet.jar
-MIDlet-Name: DevCertTestMIDlet
-MIDlet-Permissions: javax.microedition.pim.ContactList.read,javax.microedition.pim.ContactList.write,javax.microedition.io.Connector.http
-MIDlet-Permissions-Opt: javax.microedition.io.Connector.https
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-httpUrl: http://www.google.com
-httpsUrl: https://www.google.com
-MIDlet-Certificate-1-1: MIJs7jCCbFegAwIBAgIJAPNUaScSr5cxMA0GCSqGSIb3DQEBBQUAMHMxCzAJBgNVBAYTAmZpMRIwEAYDVQQIEwlQaXJrYW5tYWExEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQ0wCwYDVQQLEwRKYXZhMR8wHQYDVQQDDBZKUF9EZXZpY2VfTWFudWZhY3R1cmVyMB4XDTA5MDkxNjExNDk1M1oXDTEwMDkxNjExNDk1M1owNTELMAkGA1UEBhMCRkkxEDAOBgNVBAcTB1RhbXBlcmUxFDASBgNVBAMTC0phdmFEZXZDZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXZ/GCV/N8foAkCQJfoiwGlwHO+f1lV9zloo0r0zosGtVqItLXKrvXEKylpOVWBygRVVrkl30Y1Cxess4aS1UmZ1rcvwL0jcvwlkZGacJazjtHE4UQuYJz9WRbYOaQxR2SVS/wU2Ptu/mr0ZgqFhgaJ1FzCuBdNaWzx2mGV9az/QIDAQABo4JqxjCCasIwKQYDVR0gBCIwIDAOBgwrBgEEAV4BMQEBAwQwDgYMKwYBBAEqAm4CAgICMA4GA1UdDwEB/wQEAwIHgDAXBgNVHSUEEDAOBgwrBgEEAV4BMQECAgMwgmpqBgwrBgEEAV4BMQECAgcBAf8EgmpVMIJqUQwPMDA0NDAxMDE1MDc2OTU5DA8xNDM3MjU3ODc0MDc3MzAMDzAwNDQwMTEwNDIzNjk4NQwPODUxODA4MzAxNzgwMzcwDA84MzYwMTU2MDMxNDY4MjgMDzM2ODYxNzM4NzAzNzM4MAwPNzY2NjI2NTYyMDM3MzI4DA84NjgwMjIwNjUxODczMTgMDzQ3NTEzNTQ0MzEwMzQwNAwPNDY0NTI4NzEzODY1MDY1DA84NjEyMTU3NzIwMDczODUMDzQwNzQ3NTAzMTI1NjYxOAwPNzQxMDY1MDUxNDE1ODI2DA81MzI1MTM4NTc4MzM1NTMMDzA4ODQ1NDM0Mjg4ODg2NQwPMTY1MTEwMDA3ODE1NTE2DA83NzYwMTU4NDUzNDgyODgMDzIyNTUzNTY4NjA4ODYwNQwPNDUzNTUyMTc2Mzc2MjcyDA8zNTAwNTM1MjQxMzMyMDYMDzg4NzU3ODg4NzM2MTM0NwwPNzgxODA1MjY0ODE0MzQyDA8yNTM4ODg2NzUzNzUxMjgMDzMyODczMzE2Nzc1MDg1OAwPMjA2Mzg1NDYyMTM4MjUyDA82NTA1NTIwNDcyMjIzNDMMDzA2MjQ4NzM2NTAxMzMyNgwPMzM4NjAxODY2NTcwMzcwDA8yNzcwMTgyMTEyODYzMzYMDzA3MDE2MzQ1MzQ3MzExMwwPMDM3MDI1ODcxMzE3ODc3DA81MjMyNDMzODgyMDA0NDIMDzg1NTcwODIzMzAyNjQzMQwPNTQzNDU4MzEzMzc1ODI1DA80MDgwMzUwNTQxODIxNzcMDzcxNjYyMjEzMzMzMjEzNAwPMTAzNzY1NTEwNDcwODQ3DA80NjAxNzgwODEwMTQ0NjYMDzMxMDYxMTQzNzY2NDUyMAwPMDQwMjM1MTMxMDE3NjI0DA8xNTIyMzUzNjA1MDg1NDQMDzc1NjU3Mjc2NDI1ODE3NQwPNjcwNjcyMTIyMzAzMjU3DA83NzUyNjU0NzQ3MjgwMjMMDzQyMTgwMzg1MjE0MjE2NQwPODE0MTcxODU0NjQ4MjcyDA80Mzg2MTIwNDczMDY2MzUMDzY2ODA4ODQ1MjM3NDAxNAwPMjMwMDgyNjEzNDYzNTM2DA8yODA4MTYyMjMyMTExMTYMDzc4MjM3MzE2NzgwMTgwMwwPMDYyNjU3NTgwODMxODMxDA82NzI0Njg2NDc0NTUwNTYMDzgyNTUyODAzMjY0NzQ0MwwPNDU2MzAxNTA4NzEwMDMzDA8xODgzMTg4MjAzNjI0NTcMDzQ4NDM3NjExMDUzNDQyMgwPMjMyMzU0MTQzNDE1NTU4DA84NDc2NzAxNzc3MDI0MTAMDzc4NDIzMTY3MDE3NDY1NQwPNDc2Nzg0NDI1MDE1MTMyDA81MTEzMTU3ODA1NjcxNDMMDzA1MDUxNjgyNDg1Mzc3NQwPNDUxNTA1NjA0MTE3NjQ3DA8wNzc3MzU0MTc0NzcwNzcMDzQ4ODQ3NzYzNTE3MTU1NgwPMTQ4NjM0MzM1MDgzNTgzDA8yMjMxMzE0NzI1Mzc0NzcMDzY1ODQ4ODQ2NzI0MjA1NQwPMzYwMTU2NDYwODU1ODM1DA8zNDc1MTczMjM2NDMwNDYMDzMwNTE3MDA0NDQyNjQ4MQwPMDg4NzMzMjAyMzUzNzQwDA8zNDY2NzY1MjY4MDA1MDMMDzUwODQ1MDEwNjM3MzY1NgwPMjAxNzM2NzEyMDUwNDg3DA80MDMwMDg1ODMwMzE1NTIMDzM4NTUyMDQ2ODA2ODAxMgwPNzIwNDc3Njc4NjM2NDg3DA84MTM4MTc1NDQzNTY3MzAMDzgyNzIyMzc3MzY1NTEzNQwPNjQ3MDEwNTUyMDA3ODY2DA8xODAzMjExMTg4ODY2NzIMDzc0MjEzMzg4MzgxNDIzNQwPNTc1MzU1NzQ4NTMwODgwDA8zMTAzNzAxMTY1NDcyNDMMDzQ0NDQ4NTU1Mzg0NTE3NQwPNzQzNzc1NzA4MjM2NDM3DA8yMzc1MjQxNTg3MTUxMTMMDzI3NzQwNTUzMDE2MzAyMAwPMTgyMzA3MTU2Mzg3MzM2DA8xMDMwMzA2NjIyNjA0NzAMDzE0MTYyMTU3MDI1MzI0NAwPNDY0MDcyMjc2NjQ1ODM3DA80NTUxNzc3NDczMDQ1NTcMDzI2NzYwODgyNjY3ODY0NgwPMzQwNjM1NjMyNTc3NDg0DA8wMTUxNzcwMzI2NjM4MDUMDzgwNzI2ODcwNzY3NjQwNQwPMjA1NzQ2NTE1NTQzMDIzDA82NDU3MzA4MTUxNjcwMzUMDzAzNDEzNjM0Mjc3NTAxNwwPNTc4ODAyODAyNDYzMzYyDA84NDA1MDUzMjE4MjM2MjcMDzA3NzEyNzYxMTEyNjUyNgwPMDE4NzU0NDgwMDM3NDM4DA8wMjEyNTgwNzAzNDE1NzgMDzg2MzAyNjcxNDcwMDYyNAwPMDU2NjQ0MjQ2NjA1MTEzDA8xMjIyMDMxNTcwNTg2MjEMDzgxMDY3NjQ2MjU0MDU1MwwPMTUxMzM1NzUyNTI3NDc0DA8wNjA3MzQyODg0MTgzNTQMDzEyNzYxMjI2NjE0MjUxMAwPODY2MTI0NDU3NzE2NDQxDA8zNDAwNjI0ODY3ODE2NjYMDzA1NzcyMjMwNTE4MzQ4MgwPODMzMzU2NTI3NDI3ODc2DA8zMTA2MjI0NjI0MTM0MzQMDzQ3NDYwODY1MzEyNjA2NAwPMDQzMzIyNzg1MDgxNzM2DA8zNzY0MTAzNzcyODQ2NTIMDzYxNDg3MzQxNDY4MTA3NQwPNjM2NDc1NTgzMDgxNTE4DA8zNzIzODAxMjgzNDAwMzUMDzcxMzEwNzAyNzIwNDcwMQwPNTU2MDA4MTY1MDg4MDMzDA83MjQ4MzQ4MTgyNjY2NTcMDzA2ODA2MTMwNDcyMzg0NgwPMTMzMzY1MjMwODQ1MDUyDA81NDQ2MDI1NjQzNzU0MjgMDzQ4MTM0ODQ3ODAwMjEwMAwPNDExMzA0MTUzMDA0NjcyDA83NTYyMzUxNzc3MDEzNTAMDzIwMTI3NTg3ODMzMTc0NwwPNTg2MTQ4NTYyMzM2NjgzDA84MDQ3Mzc1MjM0NTgzMjYMDzMyODYxNjI3NzQwMjAwOAwPNjU1ODMwNTExNTEwNTA4DA8wNDgwMDc1Nzg2NzIyODUMDzM1ODM2MTM4NDEyMDcwNQwPNTg1MzA2NzU1MjUwMDI3DA81MDU3NjQ3MjQ2MTExNjcMDzQ2NjU2MTc0NTMxMDU3NAwPNDU1MTUwMjI4NjQ3MTc3DA8yNDM1NDY0NTY1MDI4MzAMDzUyMDI4NjUzNDE0MTQ0MQwPMTUzNDA4MDc0NzAzMDE0DA81NjUwNjE1MTEwMjM2MTAMDzQ4MDExNDMwNzIwMTc1MwwPMjQ1Mjc2ODc3MTg3ODY2DA80MDY3MDgxMjM1NzExODQMDzQxMzU2MTA4NTY2MTAxNgwPNDIyMjI2NjEwMDcyMzgwDA8yMTEwNDE3MjU1MjM2MzYMDzU3ODM1NDE2MjQ3MzIzMwwPMDU4MTExMDQ3NzQxMjEwDA82NDUyMTAyMDAxNzI2NDgMDzA0MzEzMTc1MDE0NDA4MgwPODc3NTIxODg2NjE3NzU4DA80NjYxNTgyNTA2MTUzNjgMDzg3NTY4MzA4NjE2MjExMQwPMDQ4NjQzNjM1NzEwODUwDA8wNzg1NzY2NTYzODE4MzUMDzE4NTQzNTU4NTE3MjU3NAwPNDMxNjYxMjc4NTUwNDU0DA8yNTgwNzQ4NjU3MjM1MzAMDzM0MDc4ODYzODA2NzQ2NQwPNjE4NDIzNjMwMTM0NzczDA8yNjgwODQyNzQ0NzAzMjAMDzI4MDgxNDMxMjA2NzM1NQwPNDEyNjUxMTA4MzAxMTYzDA80NTE4ODIxODc4NTcyMjAMDzQ3NTYwODc2ODE0NzY2NgwPMDU3MDAzMjcxMTUyODI3DA8yNjAwMDYzODg2MjExNjYMDzM1MDg3NDQxMDUyMTMwOAwPODM1MDAwMzUzNTcxMTQwDA81MTU3MjAzMDYxMjg3NTYMDzA1ODgzNzY0ODQwNDg1NQwPNDA4NDg2NjQ0NDMzNDM2DA82NTg0ODM0MTIxMjM2NzcMDzU4ODA0NzA1NTM0MDYzOAwPNTA3NDMzMTMwMDY3MDY1DA8yNjQwNjcxNzc3NDc4NTgMDzQ4NTEwMTM4MTY1NjE1MAwPMzEwNzYzMzY2MjIxNDU1DA83NzIzMjMyMTEyMTQyMjQMDzU0ODg4MTU0Mzg4MTY0NwwPNDc2NTYyNTE3NzIzMTE2DA8wMTAwMTQ0NjEyODE4MDYMDzUwNzM1NzA3MDM4MDUyNwwPNTg3NDQ3ODIyMTExNTA2DA81MzY2NTExMjI2ODc0NzIMDzIxNDc0NTAwNjU0NTcyOAwPMjg2MTY2NzUxMTA2MzA4DA8xNjg3NzA1NDQ1MTIyMTcMDzM1MjU3MzcwMzQxMzU0MwwPMzAxNDEwODc4NDI2MjE1DA8zNDY2ODQxODUwNjgxMjMMDzUzMzA2NTMyMzEzNjI0NQwPNjA1MDE3ODUyNzU1NDM1DA80NzcxMzg3NTc0MjM2NjgMDzY2NzA4Mjc1NDUwNTUyMgwPODczMjQ1MTM4MTAwNDAwDA81NTc1MDI0ODczMjQ1NzEMDzI1MTEwNDAzMTcyNjI1NAwPNjI4MTA0NTEyMTU0MDAxDA80NzQzMDM1MTExMjI1NDUMDzQ4NDY4ODc1MDg2MTI4MgwPNTMxNjY0ODAxMjA3NjY0DA80NDc3NjA0MDUzMjM1NDcMDzgxODA2NjQ0MjgyMzQxMQwPNDg0NzQ1NzUzNTcxNTAyDA83MDM1NDE4Mjg3NjUwNzgMDzA0NDAwODczMTEyNTY0NAwPNTM0NTAzNjE4NTA3MDczDA83MDQ0NzE4NTE4MzQ1NDYMDzM0ODEwNjMzMTUyMDg0MgwPNzY0MDY3NTYyMjM1MjA0DA80NzQwMzEyNTI1ODE3NDUMDzU2NzQzNzQ4MzY2MjQ0NgwPNTIyNzM0NTg4MTY2NjE4DA8zNDU1NTQ0NzA0ODgwMjIMDzAzMjMzMjAyMzYyNjQzMAwPNjUwMDg0NDc1NTU1ODYyDA82ODE0ODA1NTM3NzM0NzcMDzM0NzMyMDI1NjE3NDg3MgwPMTA0NTIxNjY2Njg2NjI4DA81Njc2NDg1MTM3MjMzNzMMDzU4NzUxNzg4NDA2MzAzNAwPMjI1NTI3MDAxMTYyNDU1DA8zNTc2MjQzNDc1Nzc0NTAMDzY3NjQyNjQzODc2NzI0MAwPNDg2ODM0MTAwODA4NzU3DA8xNTg1NjY0NDM3MDA2ODUMDzY0NDY2ODE4MDU0NzY0MwwPMDQyMzU3MTQ3MTgyNjY0DA80NTA3NTQzODQyMzA2MzEMDzA1ODA3Mjc4MjIyODI4MwwPNTY1NjE1NjEwMzQxNzYwDA84NzIzNzIyODc0ODIzNTIMDzYzMDE2NzY0ODE1Njg4NgwPNjEwNDAzMzg2MDUzMTY4DA8zODA1ODQyMTE0ODEwNjUMDzExMzg0NTM0NDY3MjI1NgwPMjY2NDY1MzEzNTUzMjg4DA80MDExNTc2NzMyODAyMDcMDzc2NzI3NTQ2NjM0MzA3MgwPNDczMjY2NDY3MTU3NjA3DA8wMjY2NTQ2MzA1MzEyMjUMDzYxMzU2NjgxNjExMzg0MgwPNzE1MTE2MjE2NDI1NzcxDA8wMjY4MzcyMTQ2MDMyMzMMDzE2NjM2MzY1MzE3ODUwNAwPNjgyNDAwNjExMzQ0NTM3DA80MDE3NDM0MzMwNDI1NDYMDzY0MDc0MDMyNDg4MDgzNQwPNDU2MTQ0ODM1MTg2MTYyDA8xODI0NTYyNjI0NTcwMjQMDzQwMzEzNjc4ODY1NzI0NgwPNzUyMjE3NjI3NTQxMTIxDA8zMTcyMTQxNTgyMTYxMzgMDzM2MDI3ODA3MjA3MTA0OAwPMDU4MjA4MDgzMjg4NzIwDA80MTgxNDgwMDUyNzc2NTgMDzM0MTg1ODQyMjgwODYzNwwPNTU1MzIxMDI3MjMyNTE3DA83MjYyNjY3NTQ2Mjc2MzUMDzQwODc2NTg0NDExMzQ1NAwPMzAzMzc2ODIyODg0MTc4DA80MDE3MDI0NTMyMDYyNzQMDzIxMTcwNDc2NTE3MTIzNAwPMTg0NzEwMDY3NzgyMjAzDA8yNjIwMDAyMDQ1MjI1NjQMDzg4NDI0Nzg4NDI3Mzg4MAwPMTIzODAyMTI0Njc1NDA4DA8zMTczMDYyMjY4ODIwODQMDzQxMzc2NzQ4MzEyMjQ2MwwPMjc3MDU0NDI0MDQ3MzgyDA8xMTYwODA4NzU2NjE0NzEMDzE2MzY3MTIzNzg4NzIyMwwPODc0ODI1NjYxMTczNTU2DA80MjU1MTg0NjA2NTI2NzIMDzA1NzMyNzU0NTgxNTE2MAwPNDIwMzU0MzA3MzI2MzQwDA83NjQzMjYxMTc0MTQxMzcMDzQxNDEzODIyNzQ1MTc3OAwPNDE0MjE4MjQ3MzI4NzEzDA81NTAwNzE0MjIyMTE1MTAMDzE2MjcxODUwNzQ1NjYyMQwPNzE0NDc3MjI4MjAzMzE0DA80NzgwODAwMDAwNTg0MzcMDzI1NjQ4MTY1ODQzMzQ0MAwPNjYyODU0MzU2NjY4MzQ1DA8yNDE2ODY2NzY1NzI1NzgMDzUwMzIxNDE1MDU1MTU1MgwPNjAwNDU0MTI1MDU4MTc3DA83MjYxNjQ2NzY3MjMyMTgMDzUyNjMxMDMwMjMyNDA4MgwPNjgwNTEwMzE1NzI3ODgyDA80MjY4NzgzODE1MTcxMjgMDzQ3MzQ3NzI2MzM1NjAyNwwPNDgxODE4MDg3NTMxNjE4DA82NTIzMTY3NjY1MDg1MzIMDzM0NjgxNTI1NTcxNjc4MgwPNTcyNTY1ODQ4ODM2MzA2DA81MzMzNjQ3MzAyNjM3MzcMDzAwNTI1MjQ2ODEyODA2MAwPNzYxODIzNjM0NjA2NTQ0DA8yMDY4NDA1MzQ1MDE2MjUMDzgyNjg3MDExMTA4NzQ1MAwPNzcwNjUzNDE4MjE3NDU4DA83NjM0MzY4MTI4NDg3MjgMDzA2MjYzMjQyNjM1NTI0MAwPNTUzMDY1MzQ2NTU0MjQ2DA8zMDE3NjQyMjQ3MzA2MDEMDzM3MTUxMTM2MjQxMjA3MwwPMDgyMDg3MTc0MDA2NjA4DA8zMTg1NzQwNjA4NjA1MTgMDzQ4MjQ1MjIxMTUwNzIxMQwPNTQwNTAwNTQ2NzcyMDI2DA8xNjczNTAwMDQ2NzAzNDYMDzQzNTExMzIyMjE2NTExNgwPNjY3ODMzMTY0MTM0MTYwDA81MTI2MzYxNDEyNjIyNjcMDzcxMjA2ODA3NzUyMzMzNQwPNjY4MDMxMDc1MzU1NzU2DA82NTM3ODgxMzI1MDUxNjgMDzg2NjIyNTgxNzI3ODMzNgwPMjg2NTg3NDc2NjM0NzMzDA80NTQ2MTQ0MzU2MzY2NjIMDzQxMzU3ODEzMjMyNzgyMAwPNjMxMzQ1MzA2Nzc1NTQ0DA81ODA0NDczNDUzMjgzNTgMDzY1NTI1NTU4NzYxMzQ4NwwPMjUwMjAzODUyMTM3Mjg0DA81Mjg3NDYzNjg1MjAwNDgMDzIxNjE1NzQzODM0ODA3NgwPMjEzMzAzMTE1MzEwNzM0DA8zNzUwNzg0NDgwNDcwODAMDzM3Nzc1MTE3MzExMDc3NQwPODE0MDAyNjIxMjIyNDUyDA81NzY0MzM2NjAyNjMyNTAMDzIzNDAyMTI0MDExODA1NgwPODg3NjE1Nzg3NzEyMTAzDA84NTUzNTYxODA3NDE2NjgMDzc3NjA4NzgwNzgyMjE3MwwPNjU3MTg1NjcxMjIwMTI4DA8wNTU2NDAyNTQ4NzU3MTEMDzcyMDMyMDE0MjI3NjU1MAwPNjE2NTgzMDcxODIyNTc0DA81MTEwNDQ0MzEwNjg0MTAMDzgzMDg1NTM2MTAwMTQ1NwwPODAwMjA0NDAzMzAxMDI2DA8wNDM0NjIxNjg3NTE3NzUMDzI2MjYyMTc4NzgxNjQzMgwPNTc1NTU1MTQ2MTIwODY4DA8zNDEzODI1MTYwMjI0MzUMDzE2NTgzNzE2NDM2ODAyMgwPNzY3Njg0NzI2MTE3NDA1DA8yNjM1MzU4NDExNTEzNzAMDzAyMzAyMDE3NjM4MTI2NwwPNTg1MTI2MjgyMzgwMDQ3DA81MzgxNDI2MTgyMDM2MzQMDzczNDM1NjA1NTEwODIwNwwPNjA2NTA3MzE1MTE2NjE3DA8xMTgyMjA2MzYxNjEzODUMDzQ2NjY4MjE1NzIzNjg4MQwPNDUwNTc3MzI0Nzc4NzQ3DA80NjE1MzAwNTIxMDAzMjUMDzM1MTc4NjY1MzQ2NTYyOAwPNjIwMDE0NDM4NzMzNTM0DA8yODQ1MjA2NTE4NjM3MjAMDzUwODA1NTQwMzM3MDEzMgwPMzIzMjI2NzM3NzY4MTY1DA8wMTQyNDcyMTM2NDA0ODEMDzI0MDYxNzgzMDc4MjU3NQwPNDc2Mzc2NTY4NTQ4MDcwDA8yMzY4MzI4ODMwMTYzMDcMDzIzODYzODI3NjIzNzA2OAwPNTA3NzYxNDc1NDQ4MzUwDA83MjgxMDAwMzAzNzY3NzgMDzU2NjMxNDU3MDU1NTA2MAwPODY4NzExNjIzMTc0MzMwDA84MTQxMDgxNzU2NTI3MjMMDzIyMTc0MjQzMjY1NzM2MQwPNjA3NjgxMzYxNTgxMDU1DA83MzMwMDE0MDE2NzQ4MzgMDzY0MDQwMDUwMzA2MjI1NwwPMTI3NDI0MjQ0NTc4MzMwDA8xMDcwNjM1MTc3NzIwMjUMDzQ1MDUyODE3MzU1Mzg4NwwPNzE1NTExNDYyMDE2NzczDA8zNjQ4NzcxMzAzODExMjgMDzEzNDAwMTQ3MDI0MTE2MAwPODAzNjQ2NTE1NTIzMTUwDA8wODcxNDI3ODc1MTA3NjAMDzM0MjI3ODcxMjM3MjEwNgwPMzc0MDA3ODMwNjcxNzU2DA83NDY1MzE1MDAzMDU4NjcMDzEyNjM2MjQ4MzUzMzA1OAwPMjMzMjIwMDI3MTE1NTE1DA80MTQzNjMwMzc3NzA1NjYMDzM1NTE1MjEyNDAwMDg2MgwPODQwNzczNDU1Nzg1MTgwDA80NTc2NDQyMDExMjIzNDYMDzEzMzg3ODMyMjgyODU4MQwPNzM0NDQ3NTMyNTAzNTIwDA8zMTAwNDQyODYyNzczMTEMDzI4MTY3MDY2MTIyMzE0OAwPNTAyMDI2ODE1NzE4NDI3DA8wMzA3Njg1ODE1ODI2NDEMDzI4MjQ4MDYxNDU1NzMxMwwPNDU3Njc0NTU0MzI0NDA1DA84MTc0MTc2ODI4NTcwODEMDzMwNDE0ODI1MjEyMDY2NQwPNTEzMzExNDMzNzA1Njc2DA83NzUzNDI0Njg0MTI3ODEMDzM0NzgyNTczODc3NzA0OAwPNzIzODQ3NDYzMDQwNTI4DA8zNTI0MzA3MDc2MDYxNTIMDzc3ODgzNDU4MTI0NzQxMQwPMzQwNjIyMjMxMDg1MjM4DA83MzQyODIwMzU1NjA4MjEMDzgxMzgxMjY2NTI4NzQwMQwPMjI4MDI4NTExODUwMzI1DA8yNzgwNzE0ODE4MDIzODAMDzM4ODg0NTU0NTcwMzIzMgwPMDgwMDE0MzUxNDM1NTEzDA8wNzQzODUxNjcwNTUwMDcMDzQ2MzQxODM0MTUyNzAwMgwPODAzMDcyMTM2NDI0ODg3DA80NjAxMjMwNjgzNTIyMTcMDzMxNzAwNjU1MDE0Njg1MwwPMTcwMzIyODAxMTY2NTgwDA83MTM2NDU4MjI2Mjg4ODMMDzA3NTA0ODc2NzgyNjg3OAwPMDQ2MjA2ODYyNDY4NTgzDA8wMjc3ODM2MjgzMzgyNDYMDzIzMTY3MjA0NzAzNjc1NQwPMTUzMzIxMTQ1MzAwODQwDA83MTIyNTMyODQyNTExNTMMDzYzMDMyNjcyMjU3MzQzNwwPNzY0MTIwMjEyNTc2NzUwDA82MzUyMjczNzYxMTU2ODYMDzI3NDc2NDYzMzc3MTcyMAwPMzM0ODIzMjM0NTY2MjE4DA8yODYwNTg1NDAyNzM4NjQMDzA3NTg2MDMxODE3ODIyNgwPMTE3MzY3MzIzNTg0NjgwDA80MjI2ODg0MDc2NTE0MjQMDzQyODgxNjA2MjE0MzI0NQwPNjEyMDY3NTU1NzUxMjMzDA8yMTcyODM3MDg4NDY4NDYMDzc4MzgwMDI2NzcyMzE0MwwPNTc3NzY1MTI2MDI3ODU2DA8wODAwMDM3ODIzMjA3MDcMDzM3MzM3NTA1MzY1MDQzMAwPMzg1MjI0MDY0MDU3MzUzDA84ODQ4MjMxMzg0MDA4NzAMDzA3NzQ0NjYwNDEwMjMwNgwPNzM4MjgwMjM1NzYxNjg4DA83NzM2ODAxODU1NjIzMzMMDzU3MDY1MjYwMDQyNTMzMQwPMjQyNjQxNTcwMjg3MTMwDA8wNTc0NjczNDc3NDc1NjUMDzczODIzNjU3MzgwNDU0MAwPMDU1MzIxMzE3ODgzNDgzDA8zNTEzMjc1MDMwMzQwNDYMDzA2MjMxNTQ4NjY3NzI1NwwPMDc0MDEwNDMwMTI2MTY0DA83MDQ4MDE1NDI1ODI1NDQMDzE2Mjc3MjQyNTg2MTgzOAwPNTY4ODgyNzI1NzY3MTcxDA8wNzgyNTQ1NDE2NDM2NDYMDzY3MzE3NzI3ODM4MTgyNwwPNzEwNzU0Mzg0Mzg3MDg1DA8yMzEyNjg1NjA0NzIzNTYMDzIzMDYyNjgzODQxNTg2OAwPODcxMjIyMzI4MDY4NTQwDA80NTg3ODUxMTIyMzY4MjAMDzQxMjQyMzYyNTE1MDYyMAwPMjUwODUzNzExMjAzNDQ3DA82MDExNTcwMzg3NzUzMjcMDzM2NTQ2NDM3MjE2Nzg4NAwPMTU2MjAyMDgyMjQyMTQzDA84MjYwMDQwMzc3NTcyODAMDzIxNTQ1MDIzMjA4NjE1NAwPNTY3MDE4NTI3MDc2NjI1DA8yNDUyMjc0NjUxNjYzMDQMDzc4ODI4MTAyMDQ0MDQ1MQwPNDc2ODQ3MDI4ODg0MTYwDA83NzE0NDY1MjY1NTA3MzUMDzc1NDIyMzg1NTYzNjAxNwwPMTQ0NjE1NTA4MzQwMjA4DA83MjcxNjUwODMwNzgwMDUMDzEyNjQ1MzIyMjMwNjY3NwwPMjU3NTExNzY3ODQwMjgwDA8yNTg4MTA3MzYzNTAwNjAMDzE1Mjg1MjM0ODcxNjU0MgwPMzE0NDE1NzcyODc1NzA0DA83NjE3NzU3MDUwNjg4MzgMDzA0MzU2NzE4NjI0ODI4OAwPMDMzNTc0MjI3NzE3Mzc0DA81MDIyMDY4NjM1NTY0MzcMDzgxODM3ODMzNzE2NDQzMwwPMzExNDI4ODQyNTQxNDEwDA83ODYxNzQyNTE0MDc1NDMMDzM1NDg2ODQxNTAwNzQyNAwPNzg4Njg0Njc4Nzc4NTc0DA8wODc3MjAyMDUyMjA2NzQMDzIzNzQyMTcxODA2NTU2NAwPNjQzNjIwNzU1Mjc0MzM1DA81MTg0MDMyMDY0NzIxNzgMDzA1NzIzMzQ3MjUwNDQyNQwPNTgxMzI2NDY1MjY3NjYxDA8yNzc3ODM1NzM1MDc3NTUMDzg4NTAwMjA0ODc3MDAxMAwPNDczNzIzNjcxMjgzMzE3DA8yMTQzMTgxMjcwODE4MTAMDzA4NDU2ODg2NTAwMjcxMAwPNDc2NjE1MTg4NjAzNjMxDA83MDcwMDcxNzQ1ODM3MTAMDzYxMTUyNjcwMTEzNzEwMwwPMjEyMTczNzM1MDI3ODA2DA8wODgyMzgzMzEzMjA1NDUMDzU1NjEzODEyMjYyNjU4NgwPNTU4NDQyNzQ1ODI4NDI4DA8wNDQwMDIxNDUzMTAwNDMMDzU4MjQ1NzM0Mzc3MTY0NgwPMDg3NTM3NTY4NTMyNTQ4DA81MDI0NjU3NjA4ODg0NDcMDzE1MTUwMzYyMjE2NjM4NwwPMzQ0NzQxMjI2NDU3MTIyDA8yODIzMDU3ODI0NjY2MzQMDzYyNDMwNjE1NTAxMTU2MAwPMzA2NTE2NDUyNjI3NzUyDA81NDMxODc4MTg0Mjc1NDgMDzQwMTE4NzA2NTgxMDcxMgwPODc4MTgzNjE3NDUyMDE3DA8xNTI0NzgzMjY3NjUyNTUMDzEwNDIzNjgyMDY3NzEyMgwPMjM2MDM4MDczNTU3ODU1DA84NjAwMDI2NTczODQ1MzcMDzcxMjQ2NjAzMzAxMzI0NgwPNjU4NDcyMzM0NzgyNDUyDA82Mzg3ODY0MjMzMzg1NDIMDzUyODA4NzA0NjYxNzQxNAwPMjM4NjMwMTM2NzY1ODczDA80NjM1NTc0MTM2Nzg1MjUMDzAxMTQzODU3NzQxMTUxMgwPODYwNzQwMTg0Mjg0MDc1DA8xNzQyNTgzMDEwMzU0MDMMDzc0NzYyNjI3NDg2MzA2MwwPMTcxMDY2NTMwNTg1NjEzDA8zMDYyNDU0MTcwMzUyNDUMDzQ2ODUwMTA2MjEwNzUxNwwPODQ3Mzc1NjUxNzcwNTMxDA8zMDM2NjM3MzY4MzAxNjYMDzc3MDQ2MjY0MTMwNzg4MAwPMDcxNTUxNTMxNDYzMzIwDA81NzAxNTgyMjMyODcwMzgMDzE4NzA4NDUyNTUyNjM4MAwPMjY2NTE1MzAxODgzNTc2DA8yNDc2ODY4NjcxMzYzNjEMDzcxODM2ODAyMTIzNjQwMAwPMDIyNzUzMjcwMDAyODg1DA82MDMxMTgxNjA2NzY2ODQMDzY1Nzg2Njc1NDU2NTM2OAwPMDgyMjE1MjQyMDcyMzEwDA8wMDYwMDM1NDQyMDA1MzcMDzMwNzU2NTUxMzEzNzYxMAwPNTY0MjIyMTA3MjI1MzE1DA82ODQyODIxODg0NTYzNzIMDzQ4NzY1MDYwMTQ4NDMwMAwPNTU4MDYyMjgwMzE4NzQ1DA82NDM0ODMzNjE0NjI0MzIMDzY4MTY4MDExODUwNzg2NAwPMjU3MDMwMjQxNTA0ODY4DA82ODg0MDQ2NDU0NDEyMjMMDzMyMjQ4ODIyMzI1MTA1NAwPMTQ1MzcxODMyMDUxMDQ0DA8yNjQ2MDYzMDMzNjAxMDEMDzg4NDgyMzQ0ODM0ODgwNAwPMTQxMzgzODEyNDU0NTIwDA8wNjA2MTU3NzUwNTM2MjUMDzc3NDQwNjAzMzQ1NjI0NgwPMTQ4MzM3MzE2MTQwNTA0DA81MDU0MzI3NDU3MzY1ODMMDzQwMjEzNzU1MTI0NzY2MgwPNzQwNjI1NDg4NDcwNjYxDA80NDIxMjc2MjQ4ODc2MTgMDzA4NDgxNDgxODMyMTg1MgwPMTg1MDg2MjEwNTY3ODE2DA8xMjUwMjQxMzUwNTcxNzEMDzQwMzg2ODQ2NzMyNjQ0NgwPMjY1MTgyNzQyNjM1ODU4DA80ODczODUxNDczNjA4NTcMDzIwMzU2MjQzMTQ3NzQ1NgwPMzA3NzA2NTg3MTY2ODU0DA80NzQ3NTI3MzE3MzEzNjUMDzQzNjQwNzgxNTgwNTI1OAwPNjYxNjI0MTQ2NDI4NDMxDA80MTI2MjE0NjU2MTMyNTgMDzQ1ODc1NTI2NDY1MDM3MAwPMjcxODczNDE3MTU0NTMwDA83NjM0NTMyMzE2NTA0MTMMDzU3ODYxMzM2MjM1NDI3NQwPMDcyMjc1MzUyNjcyMDU0DA83NzM0NjE1MTQ1NzQyMzQMDzI3MDQ4Njg2MjIyNzI3MAwPNjE3NTYxNDA2NzcyNjQ0DA83NDc3MDc3NjIyMzg1NjEMDzA3NDYwMzA4NzE0NzA0MgwPODU1Njg1NDA1MjQ0NTQ0DA80NTM0NzMyODM1NDU3NzgMDzQ4NTU2Mzc0NTIxNTI0MAwPODEyMDg4MTM2NTY3NDA3DA8xMTU2NzEyMDgzODcwNzUMDzgxMTI0MjE0ODczMDA1MAwPODIyNzU4MTEwNjYxMzUwDA8xNzcxNjU0NTIxNzIyMDEMDzczODM3MjIxMDYyNDc1NgwPMzUzNzY4NjE1NzY3NDM0DA84NTg4NzMwMzU0MTA4NTYMDzcxMDYwMTc1MzczNzMwNAwPMTU4ODAzMTA2NjU4MTIzDA84NTc3MDY4MzQwNzc3MjAMDzI2ODI2Nzc1NjQ2Mzg2NgwPODgxMzUyNjE0NzU4MDgwDA80ODc2MzQwNDE3NTg3NDgMDzQ2MzAxODU2MjQwNzEwNAwPNzg2NTA1ODQ3MzY0NDM2DA8wNzg4MTE3MzEwNTUwNTEMDzQwMjYxNjQyNDAzNzg3NQwPMjMzMDMxNTMzMDE3NDA2DA8xNzMxNTE4NjYzNzc2ODIMDzE1MTc0MzE1MzExNjc0NwwPNTIyNjE2NzM1MzMwMTMzDA82NTQ3MjAwODc2NjA1MTgMDzQ3NTgwMDM1MTIyNzMwNwwPNzExMjYxNTgwMjAxMjQzDA80ODYwODMwMjAyNjQ4NjAMDzE1NjIyMTAzNTIxMDc3NAwPNjEyNjMyNTgxMDQyMDY2DA84MDU2NjM3MzUwMTQ0MDMMDzc2MTQ1MzcwODU0MzI2NgwPMTI4NjE1NDg1NzI0NDIxDA81MjExNDY3NDU1Mzg2NTMMDzAwODM1MzAxNzE2NDgwNgwPNTgxNDQyMTIzMTAyODU0DA8zNjIxMTYxNTcxNjAyMTAMDzMwMzg3MzUxNTAzODc0NQwPNDU4NDU3NzQ2MjIxNjQ0DA81NTIyMjA0NDAxMDY1MzcMDzgxNDI3NDcwNTI4MDMzNAwPMDQ4NjA1NjI2NjU3MDg3DA82NjMwNTUyNzc1MTg0NDIMDzg3NTAxNDA3MTc2NzYwMwwPMzI3ODUyMTgyNzc0NTQ1DA8wNDQ4NzU0MjM2NTE4MTcMDzI4MTExNTcxNDMwNjAzNQwPNDgxNTY1MzU3NTE3NjgwDA8wMTEyMzE3NDI3NTQzMDgMDzIyMTg0MjY4MTUzNTEwMAwPMDYyNzQyMDMzODgwNzUzDA81ODUxMzAzMDUwNzEwNjcMDzM1MTI4Nzg1MDA1NjcwNQwPMjcyODEwODQ1MzI4MDYyDA8zNTg1MzQ4MTAzMzgyMjMMDzQzMDM1NjY2MjAyMzIxNAwPMzY1NjM1NDY4ODM1NjM2DA81MDA0MzY3NjMwMzQ2NTQMDzAyMTE0MDg0MDQwMDYwOAwPMzEzMTMzNjg0ODM1NDgyDA81MTA0NjI3MTgyMjU3NzQMDzc3NTE2MjMzMTY4MTIwNwwPNjQ2MTU0NDQzNzU1ODM4DA8wODUzNzAzMTAzODI0NTUMDzU3Nzc2ODM1NDc2ODg3NwwPMjQ4ODQyNzIzNDU2Mjc0DA8yMDU4NjY2NjE4ODA2MjYMDzE3NTI4ODQxMzU3MjE2MAwPNTA0MzQyMTU1NjIyMzcxDA81ODY2MDE4NzY4MjY1NjYMDzEzMjUxODYyNTgxMTUxMwwPNDIzMDc4NDIzNjcyMzUyDA8xMTQ0NzczMTI1ODY2NDEMDzU2NDU4NTM0MTgyNDgyOAwPMjU0MTE4NzY1NjQzNjI0DA81NjA1MjAxNDUwNTUwNzAMDzg4ODQyODI0NTcwODIwNgwPNDM1NzY2MTE0MTc3NTQxDA8zNjY4MDQwODQ3Njc0MzMMDzE2NTgzODY2NTU2NDU0OAwPNzA1NjgzMTg4NzU1MTczDA84Njc3MzEwODMwNDAwMDIMDzA0MTg2MTg2MTQ3NDA4MwwPODIxODQ1NDAzNDA3MTUzDA81MzExNTQ4NTcxNDMzNjEMDzA0MTgwMTUwNDQ1MTAxNgwPMDAzNDUyNDc2MDYyNzc2DA82ODE1MjMwMTAwODYwODYMDzMyNTAzMTUyNDM1NTY1MgwPMTczMTI2NDAyODQ3MzAzDA8yMDMzNzc2MTU0ODM0NjEMDzUzMDIzODA3MDQ3NTQwNwwPNjYwNDUxODIwNTMwNDE4DA83Mzc0NzQ1NTQ2NjQyNzgMDzAyNjAzNjc2ODgzMzMzMgwPNjA1NDIxNjg2MDYzODAxDA8wMTYwNzI3MjUyNTIyNDQMDzg3MDYzMDQ3MjMwNTQzNAwPMDMyODAwMzQ3MzE0MTgzDA8wNDg0NzY3Njc2NDY4MTIMDzM1MDMxMjEwMDE2MDA0NgwPMTU3MzM0NTg3NTQzNjUwDA8zMjExMTExNjQxODQ0MDUMDzI3NTU3MDA1MzI1MjA2NAwPMjU3NjMwMTAyNDg1NjE3DA82NDU3NDYzNTgxMDYwNzAMDzM3NzgzMjIxMjM3NjQ2MAwPMjE2MTc2MTE0MTUyNjM1DA80NjgyNDMwNTQ4NTM4MTMMDzc4MTM2MDEzNTI1NTU2NQwPODcwNDEzMTcwMjg1NzU2DA83MTE3NDQ0NDE2MzQwNzEMDzEzNjE0MDAwNDU2MDIxNgwPNDA4MjQ4MjEyNDg4MTUwDA8yMjY1MDU3NTE1MjgyODgMDzY0NzU4MzcwNTAzMjYyNwwPNjUzMjQ1NDMwMzg4MDUzDA8wMTQ4NjUwMDMwNDUxMjAMDzIwNDA2MDA0MjY0NDAzNAwPMDM0MjM4MTUzMTg4MjQ0DA8yMjg1MjQyNjcyMTU4NjAMDzQ0MzE4MDgwNDI2ODUxMAwPMzM0ODA1NzUxMzg4MjU3DA81ODAyNDA1NzY2MDY4ODcMDzg0MzAwMDQ1ODY4NTA1MAwPNTY4Nzc4NjY3ODExMjcyDA8zMTUxMTcxNTIxMzQ2NjEMDzg0NTQ3NDMxMjQyMTYxNwwPNDYxMDIzNjQyMDgzODMyDA8yMTQ3MDM2MTg0NjM2NTIMDzM0NTQyNTIyMDU1MjQ3NwwPODMwMDUzODczMTA2NjcyDA8wMDUyMjEwMjc4NTE2NDgMDzE1MjY0Nzc1MTE1MTM2NAwPNzI2NDQxNjM2MDYwNzMzDA82ODU3MTgzMTIwNTA1MzEMDzI2NDM1MDIzODI0NjI4MAwPNTA0NDU0MzYwMTMyNDUyDA84Mzg0Mzc1NDI1NzA2MjQMDzQyNzQ2MDQ2NTE1NDAwMwwPMDQzODExMjEzNTM3NzYxDA84MTE4NDc3MzA4NjE0NjgMDzUxNTI1Mzc0ODEzMTQwOAwPMDQ1NDU0MDg4NDYyMTUwDA82MzE2Nzc4MTYwNTE2MjUMDzU4MzI4MjcwMTEyMTY0NAwPMzgzNTg0NzQ3NTM0MDE2DA8xMDIwNDY0MjUwMjU0MjQMDzU3MDA2NjIxNDQ4NTE1NwwPNDU4ODY4MTg1NjI4NDA4DA81ODUyNTg4NjYzNDY3NzgMDzUyNzQwNTYxODY2NDc0MAwPMjc0MjY4MTczODA3MTE3DA83NzY2MzcwNDY2NDA3NTQMDzUzNTEzMzMzMTM2NDA1MwwPMTA1MDYzMDAxMjIxNjUwDA81ODMzMTY2MjA2NDc3NzcMDzQzMzM3NDYzMDMyMTU2NAwPNDcxMjA0MzgzODAxODg3DA81NjUwNTIxMjU1MzUxMDYMDzM2NTMxODEzNzA2NzMwNgwPMjQzMjg4NzgzMjY3NzI3DA8zNzQxMDg2MjYxMDAxMjQMDzc4MjA4NDIyNzUwMDM3MQwPMzU0NzU3MjYzNjAzMzg1DA83NDM3MTU2MzAwODAwODYMDzM4MzIzNzc3NzMzMTE3NwwPMzU2MjIyMzUwMDc2MTE3DA84MDIwMzQxNjcwMjU1NzcMDzU1ODE1NTI1MjM0NDQzMwwPODE4ODcxMTQ0MDQxNDY3DA8yODQzNDI1NjAyMjg1NzcMDzA0NTQyMDcxNjEzODAwMAwPNzQ4MzgxMDQyMzIxMzgxDA8zNzE1MjA4NjI3MzMyODgMDzMxMjgzMjQwNjYxMzA1NQwPODA1ODgzMDUzNDIzMzUzDA8zODEzNzQ0NzI1MDQ4MjYMDzU2Mzc0ODE0NDI3MjU0NgwPNjE2MTA3Nzg1MTcwMjg1DA8wODQ4NjY2MzI1MTEyODAMDzMxNjEyNzE4NjUxNzgzMwwPMTAwMjQ2MTE1MDU0NzgzDA84NzQ3MTgwNzEzMzc0NDcMDzA1MzQ3NzgwMTEyNDEzNQwPNzcwNjM0MjQ1MzM4MTM0DA82MTQ2NzUyMjY1MzcwNDYMDzU1NjA4MTM4MDMzMTQ0NgwPNTgyMzI1NzU1MjU0MjM2DA8zMzAyMTI1NDcyNjQ0MTMMDzE1NDg3MDE0ODcwNzMyMQwPNTI3Njc3ODIyNTUxNjE1DA82ODY0MDgzNDE2MTQzNTAMDzQyNTAyNzM4NjAxMTc4OAwPMDg0MDExNDg4NzQ4ODY1DA81NTgxMjUyNjg0MzYwNzYMDzE0NzEyODE3NjczNzUwNgwPMzEwNzAzMjI2MTQwODE3DA8yNjA2NjAwODQ0NzQ2MjYMDzEyMjMxNjgzNjUwODE4MQwPNTAzMjA2ODI0MTc1NDY1DA8xMDY3MzIzNDE1NTg0ODcMDzgyMzI4NDcxMjIwMjg0NgwPNTIwMjUxMTIyMTU0MDM3DA80NzE2NTIyMTMxMTgyMTEMDzYwNzAzMjU4MzAxNTM4NQwPNzM4NjU2NjUwMzYyNTQwDA81NjQyNzUwMTg0MTI4MzUMDzU4MDIwNDM4NDg2NzM1MQwPMzYxNjA2NTgxNDU4NzczDA84MTAwNTg0NjA0MDY3MzgMDzA1ODA0MDAyMzMxMjE0MgwPNjg0NDY0MzQzNzg0MjQ3DA8xNjU1NTgxNjIzODQwNzEMDzU0ODA1MDgzMTY0NDczNQwPODU1NjY2NTI4ODM2NTUyDA82NjE0NjcyNjMwNDYwNDgMDzYwMzUzNTMxODEyNjAxOAwPMDE0MjM2MjU1MDM2NzEzDA84NDQ1MjQyNzYzNDc1MTQMDzY3MDc4MzY3MjYyMzYxMAwPMjY4MjU1NjgzMDcyNDc3DA8xNzUyMTY1MzgyODg4MDEMDzg2NjQxMTI0MDc1MzM4MgwPNDg1Mzc4MDgyNTQ4NTY3DA84ODU3Nzc2NTcxNzc1MzAMDzgxNzQyMjcwMjQwNDYyMwwPMzI2MzcxMzYwODcxNDAwDA8yNDcyNDg1MDA0MDY4MzcMDzA2MDE1NzIwNTQwMTIzMgwPNjgxNDMwNDEyMTA4MDE3DA82ODQwNzM0Mzg4MjgxNTgMDzU0MTI4MzQ3ODQyMTE4OAwPNjM2NDI1ODYyNTgxODg0DA84NzM4NjQ4MTc2MDA3NDcMDzM2MTg4MTcyNjQwMTUwNAwPMTM4NTY3ODI4ODAwNjEzDA8wNDE2NDI1MDM2MjUzNzUMDzUxODEzMTQwODg3MDgxMgwPMjcxNTM4ODc2NTEzNzM4DA8xODY4Mjc2MzU0MTEyODEMDzUyMzU4MjQ0ODU4MDUwOAwPMzg1MTg1MTg2ODE1NTMxDA84MjU4MzUzMTc2NDMwNDIMDzU4MzAzNTY0NTgwMzg2NwwPODQ1NTMxMzQ3MTg4ODMxDA84MDUyNzYyODA0MzI0ODIMDzQyMzcwMjAxMDQ4NjUyOAwPMjEwODIwMDA1ODU4MTQ4DA83MzQ3MTA3MjMzNTAwNTYMDzc1NjA2NDYyNTA3NDQzNwwPMjcwMjY1MDMyMTQzMDcyDA8wNjY2NDcxNTQ4MjA2NzQMDzU2NTAxNTE3MzQ3NTMxNQwPNjQ1MjQ3NDEyNTM3NTUwDA81MDY3MjAwODY2NTY4MjgMDzc2MTEwNTQ3NTUxMDYyMgwPNjY4NjMyODg2NzMxNTA4DA82NDE2NzI1ODQxNDUzNjAMDzY2NjcxMjIxODQwNzQ2NQwPNTg0MTIyMTM3MDAxMzIxDA84NDgyMzc1NTQzODgwMjcMDzc1NTg4NzI3MzYxMzI4NgwPMjY1MjI0NDAyNDM2ODExDA83MzMyNjMwMzg3NzAxMzUMDzE4Mjc1MDExMDE0Njc3MwwPNTgwNTUzMzA2MDgxMjA1DA80NzQ2MzMwNTIyMzUzNTYMDzg4NTgxMDYyMjIxNjQzMQwPMjQ1Mzc4ODQ2MzE0MjgwDA8zMzEwODIzNjg2MTM3MDYMDzA4MzQzMTA0NjYyNzE0OAwPMTc3NzgwNTQ2MjQyNzI1DA84NTIyNjYyMDU3MjI0NzYMDzM2NTgxMjg3ODMyMzQ1MQwPNzAzNDA3MTU1MzEzMDcyDA84NzgyODIxMjQwMTAwNjMMDzI1MjU4ODA0Mjc2NDYwNQwPMDIzODAyNjg2NzUyNjI1DA82NDQyMDI4MDUxMjA2ODEMDzE1NzAxMjU1ODU4NjU2MQwPMDM4ODAzNDUyNTU1MTI4DA82Mzc1MjMzNTUxNjUwMTAMDzQ2MjQxNjg3NTI2MjI3MQwPMDEzNjUzODAzODc0MjI0DA8wMTUyNzE0NDI0MzQ4MDcMDzI3NTc4NjcxNjc3MzYwMgwPODA2NDM0MTQ0MzEzMDczDA81NjMzMDEzNTY3NTIwMjMMDzcyMTc3NDI4NzAwMjIzNgwPMTg4ODQzNjEwMzQ2MDEyDA8zNTMyMTE1ODYxNTA2MDMMDzQxMDQyMDA0MzcxNTg2NAwPNTAzODY0NDIxMTg4MDEzDA83NTUwNDI3ODE4MTA2MTQMDzAxODQ4NzI0NjYyMzQwMgwPMDg2MDUxMzIwNDI4MTM1DA84ODcyMDc1NDU1NjA3NDMMDzg4NDQwNTIxMjExNzA2OAwPMDg2MjY4NDY0Mzg3NjA2DA8zODIwMzY2MzQ4NDEyNDYMDzI0NzI1MDExMTI2NTQ2NAwPNDA0ODQzNTIxNjg3NzAwDA8zNjg3MDEwNjcxNDM0ODMMDzgwODA3MjY0NDI2MTE4MwwPNTYzNTEzMDgwNTIzODI3DA82ODExMjczODg0NzY1NzUMDzY3MjI3MTcwMzQxNTcyMAwPMTA3NzcxNzAyMjU1NDY4DA8yMzc1MTQxNzY0MjMwMjYMDzQ4ODgxMzM2MjcyNjMwMgwPMzYwMDAyNTUyNzYwMzE4DA8yMTA0MzgxMDAwNzM0ODYMDzUzNjU2NDY2MDIyNTEwMwwPNDU3NjcxMjM0MDUwNjYxDA84Njg2NjY3Nzc3MDAyNjUMDzI2NzExNTEwMzQ0MjY4NgwPODc2MjYwMzUwNDExNzE2DA8wNjY2MjUxNTExNDMyMTcMDzIzNTI3MTMyMzM0MzUwOAwPMjg1MTgxNjI2NTU2NDAyDA82MDA0NzAwNzE2NzcxMzYMDzE3NDc3Njg0MDA1MTc3MgwPODY4ODczODUyNDI4NjgyDA81NjE2ODQ3ODYyNjczODYMDzMzNTI4MDA0NzMxNjg4MgwPMDM4Mzg3ODMzMzY1NjU4DA8wMzc1MDMxMjc3NTU3NzcMDzc4NzA2NTAwNzE1MDI0NAwPMzcyMjUxMzEyNzYwNjI3DA8wMTcxMjIxMTc0Mzc3MjIMDzM3ODMwMjA0NDU0MDc3NQwPNDgyNzY2NDYyNTYxNzE3DA8xMDY4MDY4MTE3MTg2NjgMDzEyODM3NzQ4NDA3MDE2MgwPMzE1ODUwNDYzMDY1MzIxDA84MjAxNTEwMzQxNjcyNTcMDzY3NzQ0NTQ1NjAzNTcxNAwPNTY0MTQwMjY2Mzc4NzM2DA84ODc3NTc4MzU1NTMxMTQMDzQzMTUyNTcxODI0MjYxNAwPMTAxNTIyNjEzMTIwNTg4DA83MzUyNTczODcyMzIwMzQMDzAyMzQ4NTg2MDQyNzE2OAwPMjUyNDUwNDgzNzU4NjU0DA83MzQ4MjE4MTQzNzcwNjUMDzg4MDgzMTA3ODU3Mjg1MwwPNzUyMDE1MDgxMTQxNTcwDA8zNzc4ODYxMTU4NzMzNTcMDzEwNTgzODcxNDI4NjY0MQwPMjg3NzEzMzE4ODE4NzEyDA8wMzUwODg3NDU4MDI1MTAMDzc2NTU4NTMxMzM0MzI4MAwPNzg1NzAzNjExMjczNjgzDA80MjQ2ODcxMDc0NTM4NTcMDzQ3MTc2MTQ3NzUyMjQwOAwPMTIxODY4NzM3NzY2MTAxDA8zNzg2NzAwMTY1MTQ2NjQMDzg4MDE1MDY2ODIyNzA2MwwPMzQ3NjM2MzI1NzI2MDYxDA83NzUzMTY0ODQ0MzU3ODAMDzU3MjMxODI1ODY2NTcyMAwPNzQzODI2MzIxODg0NjE1DA84ODU4MjQ1NjQ0ODczNDYMDzc1NjA0NjYwODU3NDE2OAwPMjIzNTI2Nzg0MDI0ODM2DA82NjQzMDA3NzQxODA1ODYMDzYwNDAxMDcyNTUwNDQ2NQwPNzY0MDE4Nzg3NjAyNTUxDA8xNDI1MzMyNTQyODczMjAMDzEzNDU3ODYxMTgzODU0MAwPNzM3NDU1MDcxMzEwMDU1DA8zMDMwMDg4MTI0MjU3MzMMDzc0ODU3MzU3MDIwNjcwMAwPNDIxNTAxMjA2MjU0MTE2DA80ODMzNjg0Njc1NDgwNjQMDzUyMTIyMzU4ODYwNzAzMgwPNTUyNjg3NTAxODI2MTY1DA80MTM2MjQwMjUwNzYyNDUMDzU2NjI3NzYwNjMwNzUzMgwPNzgwNTc4MzMzMjgwODA2DA84ODIxNjMwODc1MzIwMjUMDzI1ODI0NTc4NjU3NTcyNQwPNjMwNjIxNzEzMzQxNDU4DA83MjQxMjA1NTU2MzY2ODgMDzUwNzE4MDUwODU1NzA1NwwPNDQzMTY1MTc4ODA2ODMyDA84NDYzNTE2NTc1MDgzMTgMDzM0MDEyNTIwMDQ4ODY2NgwPNzg4MjcwODE2MDEwNjQ4DA82ODEyMjczMDQ2MzE2NTcMDzU0ODYxMDEzODMxNDgyMAwPNDI4NjA0Mzg2MTc2MTIyDA8wNDU2ODQ2MzU1NzcyNTgMDzU3MTEzNTMyMjg4NzIzNAwPNTQ2MzMzMjYzMzU3ODc4DA8zMDgyNzY2NTY0NzM0MDUMDzU0ODQ3MTMzNTM2NTYxOAwPNjY3NjM0MjIyMDE0MTQzDA8yNTMwNTcwMDI2ODY2MDcMDzc0NDUxNDgzNDc3NTA0NAwPNzMxODY2MzA0MDgxNTc1DA82MjU3NjcxNDgwNTc2MjcMDzY4NjQ2NzI4NDI4Mjc3MwwPNDAzMDUwMDM4NTQwMjAzDA8xNTQ3NDYzNzIyNzY1ODcMDzEzMTY1NTc3Nzg2MTE0NgwPMzY4Njc2MDMwMjQyMDMyDA8zMDY2MjM4MzYzNDY1MzMMDzUzNDgxMDc2NzI4MjI2NQwPNjYwMDEyNDA0MjI1NDU0DA8zMTg0MDc1ODYwNzgwMzYMDzMzMjQzMzc1MDg0NDUxMgwPNTA1MjMyMTE0NjgyMDA0DA8xMjYyNjcyNDM2NzQ0NTIMDzQ3NDQzNDYyNjAwMDA4NgwPNTY1MzI1NjMzNjcyNTQyDA8zMjc3MjMwNjUxNDcyMTgMDzcxNjQ2NzEzMDg2Mzg1MwwPMDQ1MDI3ODgzMzQ0NDYwDA8wNDQ3Mjg1MTA0MDE2MzUMDzU4ODgxNDYwNDg1Mjc1MwwPNDgzMzY0ODIzMzYyNjUwDA82NDMzMTUzMTcwMDgxNjQMDzAzNzQwNjEzNjM3Njc1MwwPODYzMjg2MjQ0MzgwMzQzDA80NjMyNzUzODMxNDMwMzcMDzM2NTQ3MzU2MDc0NjMyMgwPODc4MzM2NjY3NzI3NTQ3DA8zMDU2NDYzMzcwNjczNzEMDzM3MDA4MzE1MjY4NjE1NwwPODg4NTM1NzY3ODg3MzAwDA8zMzYwNzUyMTIxMjI3NjIMDzUwMDgzNTM0MTExMTQwNAwPMDQzNjg4NDg4Njc3MTE3DA82NDY0MzIyODM2MTAyNzQMDzE3MTIyMjA3ODIyNDgwMAwPMjUzMDEyMjg0NTg2MjUyDA80MzYyODIxMTg0NzU3MDQMDzgzMDQxNDU4NDM2MjQzMAwPNzY2ODIzNjYzMTI1MDI4DA8xMjAzODEyNjI3ODE3MTEMDzAxNjM1Nzg2NTg3MTQ3MQwPMDMyNzM3Nzg2MjgyMzY4DA8wMjYzMzAwMzcxNDUzMjEMDzgwODcyMzU1ODQ0MTgxMgwPNDI4MjMzMzI1MjQ1MDgyDA8xODgwMzAyMTczODA4MjcMDzI1MjYwMzI0NzcxNjg0MgwPMDE4MzM1MjA4NDAyMDczDA8zODgzNDQxMzMwNjU4ODgMDzAxODUxMjAwMTE1MTY2MQwPMDgzMjgzMTM2NjY1NjcyDA84NjMzODU3ODU0MTIwODgMDzgxNzg0MjQ2MjUxNTA3MQwPNTM2ODA1ODIyNzgxODU1DA8xNDA0NjYzNzY3MzQyMjQMDzMxNDUxMjgwODQzNjEzNgwPNzUzNjY3NTAxMjgzNTE1DA8zMjQ4MzM1MTMyMzEyMDcMDzc0NTMwMTY4NjI1MTg2NwwPMjE2NjMwNzM3NjEzNjM2DA81NzgxODUxNjY2Nzg1NzUMDzc0MjI0MDQ1NjI2MzU3NQwPODA2NDUyMDQyMzI1NDg2DA81NTAwMTExMDgyNzg4MjMMDzQxNTIwNzM3MjM4NDc1NAwPNjIwNTA4NTUxNTMyNDEwDA80NTM4NTYwNzA1NjgyNDAMDzE1NzY1MDIwNDM2NjUyOAwPMjcwNDUyNjc3Mjc1MDc1DA8wMTgyNzE2NTIwMDU1MjMMDzU2Nzg0NjA0NDI0MDEyNQwPNDYwNTgxMDUwNDg1MjM3DA80NjM1NTQwNzgxNjMxMzYMDzQ3ODAwMTAyNTAxMzU4NAwPNDc3NzUwMzEyMDg4NzYwDA84MDU1MzQwMTYwNzUyMDEMDzg1Mjg2MTcxNjQyNzExOAwPNzU2NjA3MzEyMzcwNTg2DA81NTQ3MTQ4NTAwNTQ2NTAMDzEzMzI2ODQ2MzMwMDMwNQwPMjYyNTU0MTYyNTU3NTMyDA80Mjg3NjI4NTc2NDE0MDMMDzg1MzQ1MzEyMTgzNDY0MAwPNDAzMTgyMjU4MDU0NDQ2DA84MzYzODAwNTczODY4MjgMDzIzNDAwODQxMzIzMDIzMQwPNDg4MzE1NzA2MDQ0ODAyDA82MzY4MjI3ODQzMTczNjUMDzg2ODg1MTU3NTA1Njg3NgwPNjY0NDAzMzA4NDIxNzMwDA8zMzI4MTQyNjA0NDExNTEMDzYyNTY3NjcyMjI4MjM1NwwPNTc1NzYwNDAyNjE2NzQyDA8xODQ1NTg4MzE4MzI4MzYMDzg3MDIxMDMxNjM0MjczMwwPNjg1NzQyMDg1MjYwNDExDA83NTY4ODU3NjUzMjczMzYMDzA0NjU3MzQ4MzU2MzYwOAwPNjE3MDQyMTU1ODEwMDgyDA84NTU4NDU4NzIxMjExNTgMDzc1MzYzNzI4MDgyNDIyNwwPNTM3MzAzNzU0MzYzMTI3DA81MzYyNjU4NjQ0MzcwMjIMDzc3MjcxODU4ODcxNDI0MwwPMDUwNjY2MDAwNTgyMzE3DA81MjE1NDY3MDYwMzYzMTAMDzczODQ1ODcyNzU1NTY1MgwPMTE1NTUwNzYxNjcwNzQ4DA82NzcwMDcyNjgwMTQzNTEMDzI4ODU3NTgzNTA1NzI1NwwPMzcxNjIzMjQyMjgwNzQ3DA8zNTU2Njg2NDAwMzgwNzQMDzQxNzExMzQ4ODQ0MDc1NAwPNzY2MzAwMjU4MTI2NzcyDA8xODU1ODE0NDUwMTM2NzMMDzg1ODIzMDY1NjYxNzY2NQwPMzIyNjQ2NzA3Njc3NjU3DA83ODg4ODU2MTAxODczNzIMDzc2MDgyNDcyMDI4NzcxNwwPNTc4Mjc0MTMzNDM3MTgwDA8yNDEyMzMzNDE4NzEyNTIMDzcyMjg3MjQ4MzY4MjA1MwwPNTQ0MDQyNDIzMzU2NDQ3DA83MjI2MDg3NTUwNjQ4MTEMDzM1NTE2NDU4NTcxMzcyNQwPNTE1NDI4NTQwNTQ0NzU0DA8yODUyNzU4NTE3MDc4NDcMDzY0Njc0NjUwMTEwNzQ2MAwPMDA3MDczMTQ1NjU1NTgwDA8wNTIzMTc1ODA0MDQ2NjQMDzUwNTAwMTY3NTg2MjU2MAwPMzEwMzQ4ODA0NDQxNzM1DA8wNzE0NzI1NzA4MTYyNTAMDzYzMjA4Mjg0NDY4MzE3NQwPNjUxNjY2MTgzNDY3MDI4DA8zNDgxMjA0ODI1NzM2NDgMDzE3MjUwODIxMDUxMTg2NgwPMzg2MTI2NTYxMzM3NzMzDA81NjAxMzU2MDYwMjE2ODcMDzI4MjY2NzgzNDUwMTI1MgwPMDIzMjY4NzIxODYxNDEwDA8xNDE4NjgyODg1MTQyNjgMDzcwNjMyMDQ4MDYyNTQ2NQwPNTA0NDMwNzE1MTA4NzQxDA8xNTQ4MTAwMjU4NDMzNTAMDzgxMTY4NjYyMTEwNTY0NwwPODY4NDM0MzU4MDY0MTA2DA82MzE2ODQ2MjMzMDA3NjgMDzgxODc0MzgxMDc2NjY3OAwPMTE0MzQyNDI0NTYwMzE2DA8wODU0MDQ3NjM4NTc4NjEMDzM1MTAyMjcyMjE4NzI0NgwPNzc2Njc4MzE3NDMyNDAwDA82MzIwNDE4Mjc2NzEyMzEMDzc2NDA3MjEzODMxNjEyMAwPNjMxNTUxODMzMTc2NjA2DA8yMzIwNDA4NzQ1NDc1MzcMDzI2NTA2MjExMjEyNjEyOAwPMjc0NDM1MDgyNzIzODYyDA80MDI0NjA0MjAwMzIyNzgMDzgwODg0MTI0ODExODYwMwwPMzAxMDM0NDE0NjUwNjcxDA8wNTc4NTM0ODc1NTg2MDIMDzc2MDYxNTMxNjU4MzAxNgwPNzgxMTgyNDIxNzUwNTA4DA8yMTEzNzY3MDczNDExNjYMDzc0MzM0NzQxNDgxNzI4NwwPMjg4NjE3NTM4MDQ0MjY2DA80MDMwODExMjE0MzE2MDEMDzc3NDU1MDgxNDQwMjYzNwwPNjc2NDQ2NDEyMjUzMzUxDA80NjE4ODQwNDgyMjI0MTMMDzQ2ODcwNDc1MDEyMzM1MwwPNTA4MzM0Njc3NjI1ODYyDA82NTY2MzEzNjQzMDE3MzIMDzcxMzI2NTgyNTUyMDIwMgwPNjIzMTQ2ODM0Mjg3NzI0DA8zODIwNTg3Mjc2Njg4NjcMDzA3MjcwNjYwNzc1MTUyMAwPNDg1NzY3NDI2NDU0MDE4DA84NTI0MDAzNTE2NDY1MjIMDzIyODEwNTgzMDY0MTM3NgwPMDAzNDczMTIzNTYwODcyDA8yMDA1ODA0Njg1NzY0NDIMDzc2MDg3MTc2NzUzNDUyNAwPNzg2MDI4Mzg2NTAyNDE4DA8xMzY4NTAwMTg1NDA4MzMMDzIyMzY1MzA3Nzg0MjQ1OAwPMTI4NzM4MDg3MjcxMzQyDA8xMjA4Mzc2MjQwMjQ0MzIMDzA3NTE3NTgxMzA2MDc0NAwPNjM4NTY0MTAyNTEyMzMzDA8wMjE4MjcyMzA3NDQ3MzUMDzAzMjAyNTQzMjc1ODUwMgwPMDY3Nzc1MTc1MDAzMjMwDA8wNzc1NDc0ODgwMTg0NzIMDzc0NjcwNjczNTAwMzMyMQwPODQ4MzgwODA0MjAxNDExDA8zMTQ4NTYwNTI0MzQ4NjAMDzI4ODAzNDUyNDI4MjQ0NQwPMDIyNTI4NTExNzg2NDQwDA82MDQwNjgxMDg1NzA1MjMMDzY1NTYyMjY3ODcwNTE2MgwPNTY0NDIxMDIyNTI3NzQzDA8wMjE1MjE3MDI1MDI4ODQMDzYzNzgwMTY1NTA0MDc2NwwPMzA3MTE4NDExMTc2NTU3DA8wMDYxNzI3NTM0NDQxMjAMDzU1MzgxNzI4Nzg4MDA3OAwPMzI2MjU2NjQ0MTIyNDc3DA8zNTgyNjQ0NDI2NzQ1NzcMDzQyMTg3MDg3MjMyNDIwNQwPNTE3NTMzMzE4ODY1NTE1DA81MDQ1Mjc3NjI1ODQ3NzAMDzcxNDAyNDQxMjEyNzgzOAwPNTIzMTYxODE4Mzg1NTEwDA8wMDI3Nzg2MzEyMDQ0ODQMDzMzNTUxMDcxMTYxODAwOAwPNDU1MDYwODMzMzMyMjM4DA80NTM4NzExNjE1MDg1MDMMDzQ0MzQ3MjUxNzM4MDU2NwwPNjIwMDM1MDg1MzU0NDcxDA81NjE4NjMzNTE2MjU0MDUMDzE1Mzc4NjYwMDgxNDM2NAwPNzgwMDgyNjEzODc2MzgzDA81Njc0Nzg1NTg0ODczMjcMDzM1NTIwNDg4NTMwMTM3NAwPNDA4MDAwNzU3MDQzODYxDA81NjgxNjQ1ODcyMzIwMTgMDzQ4MTUzMjMxODUyNzM0MAwPMzE0NDI0NjY4Mjc4NDg2DA81NDc3NzIwODcwMDU4NjMMDzMzMjExMTUwODMzODI2MgwPNDU3MjI4MzM3NjAzNzAwDA80ODQyODAzODQyNjg1NTYMDzEzMjMxMjQ3Nzc3ODQ2NAwPNjI3NjQyMDY2NTA0MzUzDA82NTAwNjEyMTIxNjY2MzcMDzE1MTA3ODY0MTc3NDUwMAwPNDEwODIyNDIwNzcyMDg0DA83NjEyMjY3ODYxODU4MjcMDzcxMDMyNTE1MjcwNDIxNAwPODY2NjU4MzA4MjEwMjcyDA80MjI3ODc4NDg1NTg3NDcMDzgzNzcxNDQ4MTI2MTg1NwwPNjM1ODY2MTA1MTIxMTcxDA83NDU2MDExNTM2MzAzNzUMDzg1MjUyNjE3MjM1MDUyOAwPNjI1MDM3NzY2MTc1MDc0DA84NzAyNDIyMjMyMjAyMzUMDzQ0MzQwMDMxNTYyNTY0NAwPODUzNDUyNzgyODAwMzcxDA8xMDM1MTY3NTY0NDgzNTYMDzQyMzUxMzYwNjcwMjUzOAwPMTcyMTAxNDg2MjcyNDUxDA80MzIzNDI0NDg3NjUwMDUMDzc1NjI4MDAxNDU1ODQxNAwPMTE1NjU2ODE2NzAwMDM0DA8wMjc4MjQ0MDc3MzU4NTIMDzM1NzYxNTgxMDYyNTA4MAwPMTIwNTQ4NjUzNTgwNTgxDA80MTI2MDg3NzAzMjI4NzMMDzYwMzgwNjQ4NjIxNTY0NQwPODQxNzE1NjIyMzQ4NjczDA82ODI0MjQ0MDIzNjUwMzcMDzQ0NzQwNTU0ODI1NjI3MgwPMTEwNDQwMTMwMjIyODM0DA8xNTQ0NDMzNzU1NjgzMTYMDzI3MTExNDU4MTYwNjM3OAwPNDIyNjU0MzI0MzM2NjA3DA83NjQ0MTQ1MDcyNDg0NDYMDzE3MzU3NzgxMjE1NDQ2MwwPNzcwNjAwMzAxMzgwNzAxDA80NTM0MzYzNjQwNzIwMjEMDzgzNzIyNTQ1NTUyMjAyMgwPNjAyMzQ2MjIwMjUyODA3DA84MzAyMDExMDQwNjA2MjIMDzUyODQ4NTgzMzg2MDI4MwwPMTc1NDc2NTA0NDQxMDQwDA83MTM1NDE2Njc3NDE2NzYMDzIwODU2NDcwMzYyNDU3NwwPMDA4NDcwMDIxMjg4MDU3DA8zMDAwMDA1ODIwODQ4NzYMDzE4MzI0NzEwNDIwNTQxNQwPMzEzODY2NTA3NTM0NjI1DA8zNzcwMDcyMDgxMjgzMTMMDzIyNzQ2ODIyMjE0MDIzMAwPODE2MjU3MDEyMDI0MjE3DA83NjAyMDMwMDY4MTM3MTEMDzQxMjgyNTE0NTQzMzIzOAwPMzI2MzU2MTE4Njg2NjQ3DA82NTM2NDIwMTcwMzI0MzMMDzEwODQ3MjYzMDAxODc1MAwPNzM3MDI3ODI4NDUzNzQzDA8xODQ4NzI1MjI1NDg1NzIMDzgxNTQ3NTA1MzYxNDEzNwwPNzUyMTg2ODY3MzYzMzMwDA82NTM0MzgyNjU0MTQyODUMDzIwMjQyMjI1MTA1NzQ1MQwPNzE1MzQ1MDI2MDY0MTIwDA8xNTcwNjc0MzM4MzA1NjUMDzcxNDcyNjIzODQ4MTA2NwwPMjg0NjM4NTY3MjM1MDYwDA8yNzQ3NjAzNDc3NTMwMzEMDzIyMTYzNjgwNTE3NDAzNQwPNjgzMjI2MTEzMTUxODA1DA82NTgwMzE2NDIyMzU0NzQMDzYyNjQwNzYyODAyMjAzMwwPMjIxMzgxNDgzMTMyMzI3DA8xNjU2NzEwNTI3ODI1NDgMDzY1ODgyMTU2ODU2ODY2NAwPMzY3MTU3NDUxMjIxNzU3DA8zNzMzMzUyNTE0MDgzODYMDzcwNDYwNjYwNTEyNzA3MwwPMjgzODg0ODU2ODI1MzA3DA8wODQzNzIyMzgwMTYxNzMMDzM3ODAyODExNzgyMjE3MgwPMzU3MjQ1MDI3MDQ1MDM2DA82NDUxNzAzNjg2NDQ3NzUMDzE1MDQyNTY0MDAxMTUwMQwPODYyMDMzNDQwNDgxNDcwDA82NzE4MDgwMTU1MDUxNDUMDzQ0NDI1NjQ3MjA1MTQ1MQwPNTU0MjM1MzI1NTg2MTIzDA84MzQ1NDUwODgyMjA3MjEMDzc4NjU1MjIxODYwODIxNQwPMzgyMDU1NjIyNTE0ODMwDA81MDMyNTMzMzExNDcyNjcMDzAxNDc2ODA4MzA0MDgzMQwPNTE0MzY4ODgxNDQxNTI0DA84ODMyMTUzMDMyNTQxMjUMDzAyNDQyNzE2MTIyMjg0MQwPNjI1NTYyMTQ3NDc2NDA2DA84NzM4NTA2MTgxNzc3MTMMDzIyNjM2NzU0MDczNjAxMQwPMzYzNjA4NDQ0Njg4MDEyDA80NzMzNzYzNTAwNzc2ODUMDzY3NTA1ODUxMDY3NDgwOAwPNTc1MDM1NDYxMzg2NDEyDA80NjU4Mjg0Mzg0NjY4MTgMDzIwNjE2NTg4NjU1NTczMAwPMjUzNjQxNDQzMTEyMjA0DA8xODE1MTE0MDI3NTA4MzMMDzU2NDYxNDQ1MTAxNTM3MgwPMDEyODQ2MzI2NjM2MjUxDA8zNjUzMDg2ODgwNTY3MjYMDzg4Njg2NjA2ODEzNDQ1MwwPNjM4ODMwMzEyNDA4MzgwDA81NTUzNzA4MDc2NTI0MDcMDzE2NDY0MTI3NzE1MjM2MwwPMzg3MTA2NTg4NDQ2NjEwDA8xNTIxMTc4ODY2NjI1MjYMDzU0MTU3ODIyMzQ1MjEwNAwPMDQ3MTMwODYwMzU0NDA2DA84MzQ2NDA3NTI4MDQ1NTcMDzExMDc4NjcxNDQ0NjI1NwwPMzUwMjEyMzAzNjgwMTQ0DA8xODc4ODI4ODQ3NDIyNzYMDzg1MzU1NDg4NTg0NTMxMgwPMTQ2NzY3MjI0Njc1MTY1DA84MTY1MjEwMjU0MjIwMTUMDzM1Nzg2NzMzNTczMTc1OAwPNzQwMjUwNTgyMDI3MzM0DA84MDcwNzA0NzUyNDA3MTQMDzcyMDA0MDI1MTgwMzczNwwPMDMyMjI4NzU1ODA3NDcwDA8zNDY0NTQyNzA1NDIxNTEMDzQ0MTMxODAyNzA4NzMzMAwPNjg2NjEyMDgyNjEwODg3DA8wMzUwNTY4NDQwNjA4NzMMDzUzMTc1NTQ4NDg4MTQ2MwwPNTc0ODA4NDUyMzU0MjU0DA8zODQyMDUwMjU1MTUwNTEMDzgxNTU1NDAwMjg4ODgyMwwPNjg0MDMzMDYwMTc4MzYzDA8yNTE3NDc3MjU2MTEwMTIMDzUzODQ0NDcwNDgzMjUwNAwPMDY2MzUyNTQzNjQwNTI2DA8xNjY0NzU1MTAzNjAwMjIMDzMwODE3ODA0NjI3MDQ2NgwPNTEyODQwMTI2MzUzMjYzDA82NTU3NjY3NzE0NDU2NDYMDzIyNDc3NjQ4MDE3NTc1NQwPNDc2MTAwMjYyMDMwNzQzDA8xMjE1NTExMDc3MjYxNDcMDzExNDc2NTMyMDU0MDEyNQwPNzY1Mjc2Njg0MTE1MjQ1DA80NDc1Nzg1NDgwMzEwODAMDzQ0MzgyMDY0ODQ0MDYwNgwPMDg3MDAwMDgzNjIyMDMwDA8yNjg4NDM3MzYxNDM2MDUMDzgzMjMxNTM4MTQ3MzE0NgwPMzI2Njg1MjI4MjYzNDM3DA81ODgxODAxMzUwNTEwNTAMDzQ0NTEzNDYwMDUxMDA1OAwPMzI3NzQxNjUxNjU3MTU1DA80MTYwMTgyNTQwMjg1NDUMDzQ3MDE2MDE3MTE0Mzc3OAwPNzYwNjAxMjU3NzgwNjgwDA80NjE1MzQ4NDU1NTU3NjcMDzU2MjIzMzYxMzAxMTcyNgwPMTQzNzE2ODMxMTg4MjI0DA8wNDM3ODQ3MzU2NDYzMzEMDzg1MDU3MzQ4ODEyMTYwMAwPMzEzMTA3MjIwMjM0MjMxDA83NTczMDcyNjE2NTMzODIMDzE2MTEwODYyNjY1Nzg2NAwPNTUyNzUxMzAyNDA3ODg1DA8yNDA2MTg2MDc1NjEwMzgMDzA0NTA2MzcwNzQyODQ0MgwPODUzNzA1NTIwNTYwNzY2DA8yNTI4NTI3NDU2NTQ4NDUMDzMyNzE3ODIxMjMwMjc1NAwPMjMxMzA4MTE0MzU3MjE3DA8zNDQ3NDU3ODY4MzIxNzQMDzI0NzM0NDc3MTI4ODE4NwwPMzM2ODEzODAxMTUxMzg3DA8xMTU4MjU1MDAxMzg2MjIMDzQxMTcxNDQ4MjAwMjAyNQwPMjQ0NDU1MjYyNjA4NjIyDA8wMDUzNDgzMzg3MjI1NzYMDzY1NzM2NzExMTc4NjYyMQwPMDE2MDU0MTIxODY3NDcwDA8xNDU2ODcwNDY4MDEzMjAMDzIwNTg1MjYyODE1NzA4NwwPNTIyNDY4MjQxMTQ2MTU1DA8zMzY2MjMyNTY4MzczMjUMDzAxMTMzNzg3Nzc0ODU3MgwPMTE0ODU4MDEzMjE4NTIzDA84Nzg1MDc0MjYwMDgwMTIMDzQ2MzM2NDE4NzE1NjYyMQwPNTcwMzMyMDYxMzI1MDUzDA83Nzg1MzA4ODQ2NTMyNjgMDzMzNjgxMjIxNDQ0Mjg3NwwPNjIxODI1MjYxMzMxODQzDA8yNTc1NzU3MTc3MzI1MDIMDzYyNDQ4MjU3NTI4NTAyMAwPMzQ4NDA1NjU2MTUyMjI3DA83NjY3MDAxMzU1MTQ1NzIMDzYzODM0NDE1MjUzMTcyNgwPNjAzMjEwODA1NzIyNzU1DA84NzAxNjcxMTM2ODU3MzYMDzYyMjI4NjQ0NjIyNTM4NgwPODcwNTgyNzYyNTg1MzUzDA8wNDMzNTg2MzAzMjU2ODcMDzc1ODI2NTA4NDQzNTA0MQwPMDM4MjM4NzI3ODUwNTQ2DA83MjYxMzQyMDgzMzYyMTEMDzU2ODM3NTIxMjU1MDgxMwwPNzM0MDQyMzExNDMwNzQ2DA83MDU3NDIwNTcyODU3MDQMDzg4NTA3NzAxNDYxMDc0MQwPODExNDI3NTA4NDgxMTIyDA80MzM2MzQ0NjQxNDU3NjQMDzc0MDAxMzY3NTc4MzE2MwwPODg1MzUwMzI2MTcwMDc4DA84NDQwMzY3MDI4MzYxMzQMDzc0ODA4NzY4NjA2NTcxMAwPODA3NDg3MTU2NzcyNjg3DA82NDY4NzIzNzU1MDU2NjcMDzI4NTE2Nzc0NTgyMDY1MwwPNDY2ODczNDUxODI0MzE4DA81NDg2NzIzMzA3MDgxODQMDzcyNjQ1NjgwMzI2MDI3NwwPMzE1MDM4ODAyMDY1NDgzDA83NjEzMjczNjM2NjM4ODEMDzQ2NjUzMzYyMzg1MjcwNAwPMTQ4ODE4MTQ4ODcxODE1DA82ODQzMDIzNDc2ODU4MDYMDzUzNjEyODQzMzMwMDgzNwwPNDAxMzQ4Njc0ODg3NzE0DA84NjQ1NzU4MDI4MTg4ODYMDzc2NTQ3NzIwMzIzMDEwMQwPMDA4MTI2MjA1Mzc2NzA0DA8wNjM4NjAwNTI4MjY0MTQMDzY4MDg0MTc0Mzc3MTQ2MwwPNDUyMzg3ODU4NjEzNzA4DA80MjYyMjA2NTMwNTIwNTMMDzc3NzM1NDE1ODQzMzg1NQwPODcyNDc2ODQyMzY4NjI3DA82NTQ3NDQ3NjMwNTMyNzUMDzg0NjU2MjMxMTYxNjYwOAwPNzEzMTUzNzM3MTE1MDMwDA8yMDQ2Nzg2MjczMTEzNjUMDzU4MTYwNDcxNzIwNjY0MQwPMTYxODIzMDIzMTUzNjEyDA83MTgwMDM4MDEwMzc4NjAMDzA2ODQyNDc0NTQwNjIzMQwPMzU0NzQyMzc2NDQ4MDU4DA8wODc4MzUyMjc4MTc3MTcMDzQ4ODYzNDEyNjExNjMxNAwPMDA0NDAxMDE1MDc2OTc1DA8wMDQ0MDEwMTE0Mzg0MDEMDzAwNDQwMTAxMTQxOTc0MAwPNjUxODAxNjc4NjQ1MDA0DA8zNjgyMDMwMDY0MDIzMjgMDzAwMDAwNTA2MTY2NTYwMAwPMzczNjczMTAyMjE1ODY3DA81NTAwNjE2NjQzNDcxNzAMDzI3MjgzODQ4NDUzNjcxNgwPMTUyMTM4MDIxNTg0MTAxDA8yMDMxMTA1NjM2MzM3MTgMDzQzNDI3MDYyNzMzODEwOAwPMzY4MTUxODcyMjE0Mzg0DA80NzI3MjI4NzExNTg4ODQMDzYxMzMxMjMwNjQ2MTA1MAwPODgxODgxNzEwNjI2NzI0DA8xNTIxNTE3MjA2MzEyMTcMDzA0MzUwNzIyNzU1NjQyNQwPMTY3ODAxMzIwNjIwMDQ4DA83MDQwMzU4MzEyNTQzMjIMDzQ3Mzg4MDM2MDg3ODE2MgwPMTE3NTQxODEwMDM2NTg1DA83NDIxMjQyMDUxNzYxMzIMDzEzMzg4MTI4NDM1MTUxMQwPNDE1ODcyMjUwNDg4MjYwDA8yMzUwNjIzNjcyODMzMzYMDzQyMTU3Mzc4MjMxMzcxNwwPODU2MjIxNjM2NTQyODM4DA82Mzc1NDI2MTI3MDUxMTcMDzg4ODU2NDAyODYzMTA3MQwPNzg4NDc3MjM1Njg0MjEzDA8zMzA0MjQxMjQ0ODM0MTgMDzI3NTQzNzExMTQ0NzIzNgwPNTMwNjQwNjM3ODIzMjQyDA8xMjExNDIzMjE1ODI0NDUMDzMxNDY2MzMzNjQxMDUzMgwPNzI1NzE2NDI4NDIzNTIwDA8zNjM4NTYyMDI0MjYxMTQMDzIzNTUxNTY2MzI0NDMwMwwPNjI4NzYxMjE4MDA4MjY4DA8xMzg0MDcxNzM0ODY3MTYMDzYzNjYxMzI2MTM3NjU4MgwPNTg3MTE2MjcyMDcxMTEwDA8yNDA1NDAzMDQzMjc3NDgMDzM0MTYxNDI2MDMxMDI3NAwPNDQwNTc4NzE0NDM1NjI0DA82MTc3NzY0MTYwNzUwMTMMDzA1NDE1MTAzNzI3NzYxNgwPNjMzNDU2MzM0NTQ0NjE2DA8wNjU3NzY1NTE4NDQzODIMDzIxMzMzMTU4NTY2ODE1NgwPNTgxNTAwMjY2ODY3NTIwDA81NDMzNDI4NDYwNzc0MzcMDzAzNjM3NTcyNzgwNjc1MAwPMDcyMzQ2ODg0NTU3MDg0DA8yMjcyNzYzNzIzODcyODYMDzEwNDg3NjUwNzUxNTU4MAwPODIxMDY1MTIzNjM4MjU1DA83MjMwNzc1ODA2MTE1MzEMDzI2MDYxNjMzNDIwNzU0NAwPMzU2NTY0NjM4MDYxNzQxDA8yNDY4NzMzNTA3MjgyODAMDzIyNTgwMjIwODI0NzcxMwwPNDQ4MTQ3MzEzNzAwODM0DA82MTYwMzg4NTgzODYxMDMMDzc4NjcyODgzODg2MjA3NQwPNjgwMTczNTYxNzgwMjg0DA81NjA4MzA4NDcyMDgxMDAMDzYyMjM0ODI0NjIzNTY3NAwPNDA3NDc4Mzg0MTExMzQxDA8xNDgxMDI1NzU3MzA3MjEMDzY1MDY1ODI2MTQ1MzE3MQwPMDgyMzU0MjIwNzQ2NzU3DA82MjQ4MjY2NDc4MTE1ODIMDzI3MjI2MTI3Mjc0NDA0NAwPNTIwMjIwNzgwMTc2MTY2DA81MDE1MzI4MDE0MDgxMjUMDzI1NDMwMzcwMDQyODgyOAwPNjc0NDc4ODY4MzQ4MjgxDA80NjMzMTY3NDU1MjcyNzUMDzQ3MTE4NTQ1MDIwMzEyMgwPNjM1NDgwMjg2MTEzNjUyDA82MTM0MzE4MjI4NTI3NzMMDzIyMTYzNDczNDg2MTA4NgwPNjE4NjU3NDcxNzUyMTE0DA8zMjg1MjU1MTIzMTgwNzAMDzQ2MTAzMTQ0NDAzMDMyNAwPNTc2ODU4NDI3MjE0MTg2DA82NjU0MDAwNjgwMjgxMzEMDzMwNTcyMzIxODQ0MTgxMwwPNTQ1MTg0NDYwMDg4NTQ2DA82ODExMDczNDM4Njg3MzgwDQYJKoZIhvcNAQEFBQADgYEAQq6zHN8SP8w71Yyq+cwwNQ2VZ4UMPRw/9JkW8ZUJWC4gae2lOfeyyjtN3akXaT+p+vETtfoPuCpPjvzPYoN1RZieyJnpSVzUrNw/lM6kSP5DjGg5K/WKWYad0VkQg56Kynp2YVX4yKUhBydd7iBeSGP900LAHRWCR++xq+r98mI=
-MIDlet-Jar-RSA-SHA1: PRpjLFh81oAjHdPSZ/9lTe64ICSSHOk/MQMdRSqwsoGMSPID91mBRFEYOIQ/5nocEscacSi81o089Y0gMpEIP8V/EWBD7WDP6xqjC0gSyac+QjZm1Bu7Pzav+JC5J3KEkKOGy4wgQKJx02bArR/P9LhYAe7T6LVVFbfFyw2lhJA=
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/EmptyLines.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/FL_Rocks.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-MIDlet-Version: 1.0
-MIDlet-Vendor: Standing Still Limited
-MIDlet-Jar-URL: http://195.114.231.97:7001/dls/delivery/ds/01AAvJ1WX3jmZsurMwoC/1/FL_Rocks.dm
-MIDlet-Install-Notify: http://195.114.231.97:7001/dls/delivery/ds/01AAvJ1WX3jmZsurMwoC/2/FL_Rocks/status
-MIDlet-Name: Rocks
-MIDlet-Jar-Size: 28196
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/MIDPTestIcons.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-MIDlet-1: Icon PNG, /Duke.png, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-10: Icon WMF, /AN04369_.WMF, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-11: Icon WMF2, /TR00232_.WMF, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-12: Icon WBMP, /happy.wbmp, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-2: Icon GIF, /gs_98x98.gif, com.nokia.midp.test.midptest.NoUIMIDlet
-MIDlet-3: Icon GIF2, /gs_16x16.gif, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-4: Icon BMP, /logo.bmp, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-5: Icon JPG, /j_131x155.jpg, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-6: Icon JPG2, /j_29x29.jpg, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-7: Icon MNG, /MNGTERM3-0-0-1.mng, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-8: Icon TIF, /Sample_UPC_TIF.tif, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-9: Icon ICO, /favicon.ico, com.nokia.midp.test.midptest.MIDPTest
-MIDlet-Data-Size: 0
-MIDlet-Delete-Confirm: This is delete confirm text....
-MIDlet-Description: Testing support for several icon formats
-MIDlet-Icon: /Duke.png
-MIDlet-Jar-Size: 182559
-MIDlet-Jar-URL: MIDPTestIcons.jar
-MIDlet-Name: MIDP Test Icon
-MIDlet-Vendor: Nokia - OMJ Testing
-MIDlet-Version: 3.91.2
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-1.0
-Nokia-MIDlet-no-exit: true
-UserDefined1: Foo value
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/MIDPTestIcons.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/MIDPTestMisc.jar has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/NDRM.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-MIDlet-Jar-URL: NDRM.jar
-MIDlet-Install-Notify: http://uljava.gjmptw.de:8080/Index/Index/NDRM.jad?nstalled=NDRM_harmony
-MIDlet-Name: DRMonitor
-MIDlet-Vendor: m-internet.com Limited
-MIDlet-Version: 1.0
-MIDlet-Jar-Size: 24472
-MIDlet-Icon: /icon.png
-MIDlet-1: NDRM, /icon.png, ndrm.NDRMMIDlet
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/PlatformReqHTTP.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-MIDlet-1: PlatformReqHTTP, , com.nokia.midp.test.securitytests.PlatformReqHTTP
-MIDlet-Jar-Size: 2272
-MIDlet-Jar-URL: PlatformReqHTTP.jar
-MIDlet-Name: PlatformReqHTTP
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-URL: http://tcktest3.extra.wirelessfuture.com:8080/axis/servlet/marika.GetServlet
-MIDlet-Certificate-1-1: MIICPDCCAaUCBD+zblMwDQYJKoZIhvcNAQEEBQAwZTELMAkGA1UEBhMCZmkxEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQwwCgYDVQQLEwNKQ0YxFDASBgNVBAMTC01hcmlrYSBGYWJlMB4XDTAzMTExMzExNDMxNVoXDTEzMTExMDExNDMxNVowZTELMAkGA1UEBhMCZmkxEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1RhbXBlcmUxDjAMBgNVBAoTBU5va2lhMQwwCgYDVQQLEwNKQ0YxFDASBgNVBAMTC01hcmlrYSBGYWJlMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsUJbYMb9GlP99Ax9n6m2AIAg+b2zC0u6h7OuLP+ls9OpI0sLtE1uBABCePloS0uKwmjtsdFc1zLyA/bpbi644xDw3PMIEhppeuKbLrog5uMk5wD1bFk5kJXYwYEorWVrFpLDmqFwEMig2a+Uhf7eTq1Ze/JgMHoUDXRo0eVsnFwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBACuTqh37N34NnVzziuj66gmiE3rt7fKDTUCiqoHGfv7dpr4M0e8+y6FvtXtUXEajxX/DZbZuy0E9mZqmXsYyP2DDKbCg4cBJ23uOCffuYYVQFSnv4RQFVrQr4jMUHgX7wT5Ox4Ee8xcpsvWWfOgTY4zyEznOBUj6Uw4Xj7F+1yk8
-MIDlet-Jar-RSA-SHA1: UfQMdprNMMmJOk9INrJXe+Y06tnuL+zOJz4gJNEKnLPOzb6UwR2zczNddwfdBxENKbhw2RVp3GBQD2OZjB6UEU4kiw2S956RMlk5OVfqwXB5wvYPCePX6/8qgKSUmsBjNiEpXBGE2UT7MqbRApxmsf/OaDnzzd9Tlr9jUw+YU3w=
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/SimpleRMS8.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-Name: SimpleRMS
-Created-By: 1.5.0_12 (Sun Microsystems Inc.)
-MIDlet-Vendor: Unknown
-MIDlet-1: SimpleRMS, SimpleRMS.png, SimpleRMS
-MIDlet-Version: 1.0
-MicroEdition-Profile: MIDP-2.0
-
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/SimpleRMS8.jar has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-IGP-BS: MP3D=MP3D_BS;SCDA=SCDA_BS;ASP3=ASP3_BS;PSDK=PSDK_BS;
-IGP-CATEGORIES: WN=WN;BS=BS;PROMO=0;OP=OP;
-IGP-DEMOS: DEMOPG=DEL;
-IGP-PROMOS: MB3D=MB3D;PB07=PB07;BBRK=BBRK;
-IGP-VERSION: 2.5.0
-IGP-WN: RBPF=RBPF_WN;MMN=MMN_WN;BRBO=BRBO_WN;ASCR=ASCR_WN;
-MIDLET-FULLVERSION-URL: http://advers.bestgamfts.com/redir/?from=D725&game=MD3D&op=GONG&game_type=DM&lg=EN
-MIDlet-1: Sun Shines 3D Demo, /icon.png, HightS3D
-MIDlet-Data-Size: 8192
-MIDlet-Description: Sun Shines 3D, Emulated sun shine in full 3D!
-MIDlet-Icon: /icon.png
-MIDlet-Jar-Size: 754864
-MIDlet-Jar-URL: SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.jar
-MIDlet-Name: Sun Shines 3D Demo
-MIDlet-Vendor: Celedons Two
-MIDlet-Version: 1.0.4
-Nokia-MIDlet-Block-Uninstall: true
-Nokia-MIDlet-Category: Applications
-Nokia-MIDlet-UID-1: 0x20012293
-Nokia-Scalable-Icon: /icon.svg
-Nokia-Scalable-Icon-MIDlet-1: /icon.svg
-URL-OPERATOR: http://bestgamfts.hereis.com/redir/?from=D725&op=GONG&game_type=DM&lg=EN&ver=2.5.0
-URL-PT: 0
-URL-TEMPLATE-GAME: http://bestgamfts.hereis.com/redir/?from=D725&op=GONG&game=XXXX&game_type=DM&lg=EN&emb=1&ver=2.5.0
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/SunShines3D_DEMO_nokia_N900_EN_IGP_ATandT_901.zip has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-MIDlet-1: TestMidlet, TestMidlet.png, TestMidlet
-MIDlet-Jar-Size: 3674
-MIDlet-Jar-URL: TestMidlet.jar
-MIDlet-Name: TestMidlet
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-: Empty attribute name
- : White space only attribute name
- : White space only attribute name 2
-a<>: separators in attribute name
-bo: control characters in attribute name
-c:
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet2.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-a<>: separators in attribute name
-bo: control characters in attribute name
-c:
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/TestMidlet3.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-MIDlet-1: TestMidlet, TestMidlet.png, TestMidlet
-MIDlet-Jar-Size: 3674
-MIDlet-Jar-URL: TestMidlet.jar
-MIDlet-Name: TestMidlet
-MIDlet-Vendor: Nokia
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-o: attribute name starts with CTL characters
-MIDlet-Version: 1.0
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-MIDlet-1: Calculator, i.png,common.control.CalculatorMIDlet
-MIDlet-Name: Calculator
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.5
-MIDlet-Jar-Size: 123
-Nokia-MIDlet-Category: Application
-Nokia-UI-Enhancement: CanvasHasBackground
-MIDlet-Data-Size: 150
-Vertical-Move-Delta: 10
-Vertical-Move-Period: 2
-Inline-Editing-Supported: true
-Nokia-Platform: Nokia*
-Nokia-MIDlet-Category: Games
-Nokia-MIDlet-Name-en: Calculator
-Nokia-MIDlet-Name-de: Rechner
-Nokia-MIDlet-Name-es-ES: Calculadora
-Nokia-MIDlet-Name-fr: Calculatrice
-Nokia-MIDlet-Name-it: Calcolatrice
-Nokia-MIDlet-Name-tr-TR: Hesaplamalar
-Nokia-MIDlet-Name-nl-NL: Rekenmachine
-Nokia-MIDlet-Name-pt-PT: Calculadora
-Nokia-MIDlet-1-en: Calculator
-Nokia-MIDlet-1-de: Rechner
-Nokia-MIDlet-1-es-ES: Calculadora
-Nokia-MIDlet-1-fr: Calculatrice
-Nokia-MIDlet-1-it: Calcolatrice
-Nokia-MIDlet-1-tr-TR: Hesaplamalar
-Nokia-MIDlet-1-nl-NL: Rekenmachine
-Nokia-MIDlet-1-pt-PT: Calculadora
-MIDlet-Jar-Size: 84713
-MIDlet-Jar-URL: calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.jar
-Nokia-MIDlet-Category: Best-Sellers
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/calc2_en_de_es_ES_fr_it_tr_TR_nl_NL_pt_PT.zip has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/ceac00.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ASCII
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceac00/bin/CEAC00.jar
-MIDlet-Jar-Size: 1494
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ASCII,,USASCII.CEAC00_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=9F732D83F3B6AF98EB6577EA92366D95&tID=ceac00
-
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/cecn02.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ùÓùÔùÕ
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cecn02/bin/CECN02.jar
-MIDlet-Jar-Size: 1417
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ùÓùÔùÕ, ,Big5.CECN02_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=C9EABB544D0A47788C684D71A5A1C8C9&tID=cecn02
-
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/cecn06.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ‚X‚Y‚Z‚[
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cecn06/bin/CECN06.jar
-MIDlet-Jar-Size: 1415
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ‚X‚Y‚Z‚[,,GBK.CECN06_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=79CD95B6352F8388513D6DDB699817CF&tID=cecn06
-
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis00.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-MIDlet-Name: ÷ùø
-
-MIDlet-Vendor: Nokia
-
-MIDlet-Version: 1.0
-
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis00/bin/CEIS00.jar
-
-MIDlet-Jar-Size: 1450
-
-MIDlet-1: ÷ùø, , ISO8859_1.CEIS00_01
-
-MicroEdition-Configuration: CLDC-1.0
-
-MicroEdition-Profile: MIDP-2.0
-
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=1D11AB7B2A1E2BC200165EB4CF554232&tID=ceis00
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis09.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-MIDlet-Name: ¢£¤
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis09/bin/CEIS09.jar
-MIDlet-Jar-Size: 1457
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ¢£¤, ,ISO8859_15.CEIS09_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=7F914DE931B9D04E5F731F1ADCD163F6&tID=ceis09
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/ceis14.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ??»
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceis14/bin/CEIS14.jar
-MIDlet-Jar-Size: 1456
-MIDlet-1: ??», ,ISO8859_16.CEIS14_01
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=336AA79A2E085DC20583865B841DBE6B&tID=ceis14
-
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/cejp04.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-MIDlet"DNa"De:"D"D@!"D"D"D"D"D"D"DMIDlet"DVe"Ddo"D"D"DNoki"D"D"DMIDlet"DVe"D"Dio"D"D"D1."D"D"DMIDlet"DJa"D"DURL:"DCEJP04"Dja"D"D"DMIDlet"DJa"D"DSi"De:"D1439"D"DMIDlet"D1:"D"D@!"D"D"D"D"D"D"D"DJISX0208"DCEJP04_0"D"D"DMicr"DEditio"D"DCo"Dfigu"Datio"D"D"DCLDC"D1."D"D"DMicr"DEditio"D"DPr"Dfile"D"DMIDP"D2."D"D"D
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=CF0B99F53572032690A4D26E0CB83D02&tID=cejp04
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/ceko01.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-MIDlet-Name: ÍÎÏÐ
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/ceko01/bin/CEKO01.jar
-MIDlet-Jar-Size: 1429
-MIDlet-1: ÍÎÏÐ, ,KOI8_R.CEKO01_01
-MicroEdition-Configuration: CLDC-1.0
-MicroEdition-Profile: MIDP-2.0
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=64E5A88BE41622497EDF05039C15F26C&tID=ceko01
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/cems01.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ýþ€
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cems01/bin/CEMS01.jar
-MIDlet-Jar-Size: 1465
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ýþ€, ,windows_1250.CEMS01_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=3F627BEFBC6E8A0FB9510BA4EB42AE6F&tID=cems01
-
-
-
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/cems11.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-MIDlet-Name: ýþÿ
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: http://195.134.231.83:7070/java-server/resources/man_jam/cems11/bin/CEMS11.jar
-MIDlet-Jar-Size: 1467
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ýþÿ, ,windows_1256.CEMS11_01
-MIDlet-Install-Notify: http://195.134.231.83:7070/java-server/getresult.jsp?phone=3EBDFC736561D6876CF9ED93D3BF1B36&tID=cems11
-
-
-
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut03.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut04.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut08.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/ceut09.jad has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/einstein_EN_FR_IT_DE_ES_N97_v2942.jar has changed
Binary file javamanager/javainstaller/installer/tsrc/testdata/utils/javahelper.mif has changed
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/mine_en_fr_de_it_es_ES_pt_PT.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-MIDlet-Name: HecticMine
-MIDlet-1: HecticMine,/images/icon.png,com.nokia.mid.appl.mine.common.MineMIDlet
-Nokia-MIDlet-Category: Game
-MIDlet-Icon: /images/icon.png
-MIDlet-Vendor: Nokia
-MIDlet-Version: 3.0.4
-MIDlet-Description: HecticMine
-Period-Speed-ms: 100
-Vertical-Text-Offset: -2
-Nokia-Platform: Nokia*
-Nokia-MIDlet-Name-en:
-Nokia-MIDlet-Name-fr: Hectic Mine
-Nokia-MIDlet-Name-de: Hectic Mine
-Nokia-MIDlet-Name-it: Hectic Mine
-Nokia-MIDlet-Name-es-ES: Hectic Mine
-Nokia-MIDlet-Name-pt-PT: Hectic Mine
-MIDlet-Jar-Size: 233616
-MIDlet-Jar-URL: mine_en_fr_de_it_es-ES_pt-PT.jar
-MIDlet-Certificate-1-1: MIIDhDCCAmygAwIBAgIEQhnyeTANBgkqhkiG9w0BAQUFADAzMQ4wDAYDVQQKEwVOb2tpYTEhMB8
- GA1UEAxMYTm9raWEgQ29udGVudCBTaWduaW5nIENBMB4XDTA1MDIyMTE0Mzg0OVoXDTE2MDEwMjExMDUwNFowKDEOMAwGA1UEC
- hMFTm9raWExFjAUBgNVBAMTDU5va2lhIENvbnRlbnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAK2PV8KLVSZ9OePe4k
- 78GeQ0MiujbMd1wU9/xqhUFPst50drxhKzH+fMxvXgQOJ7viReolqWyq+ZmKpikGa+6SdqHysnVBhAqo9SLMNjlMfoOXVJ/lvM
- gOk9k5oyVhBqFonw/FDDHmINC6w9o83e3gRq1C1m2T368yHbZtKifiVdAgMBAAGjggEtMIIBKTAOBgNVHQ8BAf8EBAMCB4AwEw
- YDVR0lBAwwCgYIKwYBBQUHAwMwggEABgNVHSAEgfgwgfUwgfIGCysGAQQBXgExAQMBMIHiMIHRBggrBgEFBQcCAjCBxBqBwVJl
- bGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgc3RhbmRhcm
- QgdGVybXMgYW5kIGNvbmRpdGlvbnMgYW5kIGxpbWl0YXRpb25zIG9mIHVzZSwgYXMgZGV0YWlsZWQgaW4gdGhlIENlcnRpZmlj
- YXRlIFByYWN0aWNlIFN0YXRlbWVudCBhdmFpbGFibGUgZnJvbSBOb2tpYS4wDAYIKwYBBQUHAgEWADANBgkqhkiG9w0BAQUFAA
- OCAQEAvXtgKSffVjD52zHgUEFBBmXFq3QjgWNh8+cQTD23wnPYgfA4GBomMmznLiV3X03SOOI42DUUenQ9baPb78iU8AngF6xd
- oOpFYlNtVka9YdD9mA0jtkoe4YEmykxPabSKDS50xVYgQG+5Y9H8nO9EyIiviP6drFmpRv635mf8Trlao63XIx4geoCMb9v8vS
- dfs0louKB9DrjwFki/uHAQvRcVYnFNtAwHdri22UMx+GMppuY4/oPVvQqxgzfP+1AX/w2lgG7pi3lbVVUB4MLhG36kZIk8/J7B
- lmATAL1/G5t19HR3+9doz5H94y3WQG7ClWN1eoQtjLlvLfZO/iu20g==
-MIDlet-Jar-RSA-SHA1: ncuy0soEPUB4OPGHNyLn1ldXU2FvKvs0bUKGn/aPQefKI15aOlrczlapIWreUukE3ArQImU/xwxWh0
- Q8LROEULJKXRIYyoGCCblM6o6EPYn+YT+CDd/HV8JlHS6OO+sAV//9vWuo9orIwSwdKN8wGl0g1JmPl8LF8V5/MjSmyh8=
\ No newline at end of file
--- a/javamanager/javainstaller/installer/tsrc/testdata/utils/utf8bom.jad Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-MIDlet-Name: ışÿ
-MIDlet-Vendor: Nokia
-MIDlet-Version: 1.0
-MIDlet-Jar-URL: utf8bom.jar
-MIDlet-Jar-Size: 1417
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.0
-MIDlet-1: ışÿ, ,UTF8BOM.UTF8BOM
--- a/javamanager/javainstaller/installerui/build/javainstallerui_0x2002DCB6.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/build/javainstallerui_0x2002DCB6.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -75,6 +74,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/InstallerUi.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/InstallerUi.java Tue May 11 16:07:20 2010 +0300
@@ -372,17 +372,21 @@
}
/**
+ * Hides or unhides InstallerUi.
+ */
+ public void hide(boolean aHide)
+ {
+ }
+
+ /**
* Writes an info log entry to JavaInstaller log.
*
* @param aMsg message to be logged
*/
public static void log(String aMsg)
{
- if (Logger.Activated[Logger.EJavaInstaller])
- {
- String msg = iThisClassName + ": " + aMsg;
- Logger.LOG(Logger.EJavaInstaller, Logger.EInfo, msg);
- }
+ String msg = iThisClassName + ": " + aMsg;
+ Logger.ILOG(Logger.EJavaInstaller, msg);
}
/**
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallDetailsView.java Tue May 11 16:07:20 2010 +0300
@@ -258,9 +258,6 @@
addSoftKeyListenerFor(certLink);
}
}
- /*
- // Uncomment this to enable "application not certified"
- // warning in installation details view.
else
{
// Add not certified application link.
@@ -281,7 +278,6 @@
certLink.setLayoutData(gridData);
addSoftKeyListenerFor(certLink);
}
- */
}
/**
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java Tue May 11 16:07:20 2010 +0300
@@ -56,9 +56,6 @@
/**
* JavaInstaller eSWT UI.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class InstallerUiEswt extends InstallerUi
{
@@ -663,7 +660,7 @@
{
return;
}
- if (iDlProgressView != null)
+ if (iDlProgressView != null && !iDlProgressView.isDisposed())
{
iDlProgressView.dispose();
iDlProgressView = null;
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/MinimalUi.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/MinimalUi.java Tue May 11 16:07:20 2010 +0300
@@ -28,9 +28,6 @@
/**
* Minimal UI for JavaInstaller. This UI will only show simplified
* confirmation dialogs using RuntimeUi.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class MinimalUi extends InstallerUi
{
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/PermissionDetailsView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/PermissionDetailsView.java Tue May 11 16:07:20 2010 +0300
@@ -77,7 +77,6 @@
}
}
- /*
// Add permissions details message.
if (iPermissionInfo.getPermissionsDetails() != null)
{
@@ -86,7 +85,6 @@
iPermissionInfo.getPermissionsDetails(),
horizontalSpan, labelStyle);
}
- */
}
/**
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java Tue May 11 16:07:20 2010 +0300
@@ -174,8 +174,11 @@
{
public void run()
{
- log(className + ": disposing view container");
- iContainer.dispose();
+ if (!isDisposed())
+ {
+ log(className + ": disposing view container");
+ iContainer.dispose();
+ }
}
});
}
@@ -212,11 +215,14 @@
}
}
// UI updates must be executed in UI thread.
- iParent.getDisplay().syncExec
- (new Runnable()
+ iParent.getDisplay().syncExec(new Runnable()
{
public void run()
{
+ if (isDisposed())
+ {
+ return;
+ }
if (iVisible)
{
updateSize();
@@ -421,10 +427,10 @@
{
Label label = createLabel((Image)null, 1, SWT.NONE);
Image securityIcon = null;
- if (iInstallerUi instanceof InstallerUiEswt)
+ if (iInstallerUi != null)
{
- securityIcon = ((InstallerUiEswt)iInstallerUi).getSecurityIcon
- (getDisplay(), aIdentified);
+ securityIcon = iInstallerUi.getSecurityIcon(
+ getDisplay(), aIdentified);
}
if (securityIcon != null)
{
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/CertificateDetailsView.java Tue May 11 16:07:20 2010 +0300
@@ -81,6 +81,17 @@
horizontalSpan, labelStyle);
detailsLabel.setFont(iInstallerUi.getBoldFont());
+ // Add domain category label.
+ createLabel("", horizontalSpan, labelStyle);
+ Label domainLabel = createLabel(
+ InstallerUiTexts.get(
+ InstallerUiTexts.DOMAIN,
+ new String[] {
+ InstallerUiTexts.get(InstallerUiTexts.DOMAIN_UTP)
+ }),
+ horizontalSpan, labelStyle);
+ createLabel("", horizontalSpan, labelStyle);
+
// Add warning label.
Label warningLabel = createLabel(
InstallerUiTexts.get(InstallerUiTexts.NOT_CERTIFIED_WARNING),
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ConfirmationViewBase.java Tue May 11 16:07:20 2010 +0300
@@ -57,15 +57,15 @@
}
/** Constructor */
- protected ConfirmationViewBase(InstallerUiEswt aInstaller, Composite aParent, int aColumns)
+ protected ConfirmationViewBase(InstallerUiEswt aInstallerUi, Composite aParent, int aColumns)
{
- this(aInstaller, aParent, aColumns, false);
+ this(aInstallerUi, aParent, aColumns, false);
}
/** Constructor */
- protected ConfirmationViewBase(InstallerUiEswt aInstaller, Composite aParent, int aColumns, boolean aScrollable)
+ protected ConfirmationViewBase(InstallerUiEswt aInstallerUi, Composite aParent, int aColumns, boolean aScrollable)
{
- super(aInstaller, aParent, aColumns, aScrollable);
+ super(aInstallerUi, aParent, aColumns, aScrollable);
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorDetailsView.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.ui.eswt2;
+
+import com.nokia.mj.impl.utils.exception.ExceptionBase;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Displays error message details.
+ */
+public class ErrorDetailsView extends ConfirmationViewBase
+{
+ private ExceptionBase iException = null;
+
+ /** Constructor */
+ protected ErrorDetailsView()
+ {
+ super();
+ }
+
+ /** Constructor */
+ protected ErrorDetailsView(InstallerUiEswt aInstallerUi, Composite aParent)
+ {
+ super(aInstallerUi, aParent, 8);
+ setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED));
+ setCommands(InstallerUiTexts.get(InstallerUiTexts.OK), null);
+ }
+
+ /**
+ * Synchoronous method for displaying error message details.
+ */
+ public boolean error(ExceptionBase aException)
+ {
+ iException = aException;
+ boolean result = confirm();
+ if (result)
+ {
+ log("ErrorDetailsView confirmed");
+ }
+ else
+ {
+ log("ErrorDetailsView cancelled");
+ }
+ return result;
+ }
+
+ /**
+ * This method is called once before view is opened.
+ */
+ protected void createView()
+ {
+ // Add title.
+ //String title = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED);
+ String title = "Installation failed";
+ if (iInstallerUi.getInstallInfo() != null)
+ {
+ if (iInstallerUi.getInstallInfo().getOldVersion() != null)
+ {
+ title = "Update failed";
+ }
+ Label titleLabel = createLabel(title, getColumns() - 1, SWT.WRAP);
+ titleLabel.setFont(iInstallerUi.getBoldFont());
+ // Add security icon.
+ iCertificates = iInstallerUi.getInstallInfo().getCertificates();
+ createSecurityButton();
+ }
+ else
+ {
+ Label titleLabel = createLabel(title, getColumns(), SWT.WRAP);
+ titleLabel.setFont(iInstallerUi.getBoldFont());
+ }
+
+ int horizontalSpan = getColumns();
+ int labelStyle = SWT.WRAP;
+
+ // Begin widgets creation.
+ Label errorLabel = createLabel(
+ iException.getDetailedMessage(), horizontalSpan, labelStyle);
+ // End of widgets creation.
+ }
+
+ /**
+ * This method is called after user has answered
+ * to confirmation.
+ * Inheriting class must implement this method.
+ */
+ protected void getDataFromView()
+ {
+ // nop
+ }
+
+ /**
+ * Returns SWT style for this view.
+ */
+ protected int getStyle()
+ {
+ return SWT.V_SCROLL;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ErrorView.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.ui.eswt2;
+
+import com.nokia.mj.impl.utils.exception.ExceptionBase;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Displays error message.
+ */
+public class ErrorView extends ConfirmationViewBase
+{
+ private ExceptionBase iException = null;
+
+ /** Constructor */
+ protected ErrorView()
+ {
+ super();
+ }
+
+ /** Constructor */
+ protected ErrorView(InstallerUiEswt aInstallerUi, Composite aParent)
+ {
+ super(aInstallerUi, aParent, 8);
+ setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED));
+ setCommands("Show",
+ InstallerUiTexts.get(InstallerUiTexts.CLOSE));
+ }
+
+ /**
+ * Synchoronous method for displaying error message.
+ */
+ public boolean error(ExceptionBase aException)
+ {
+ iException = aException;
+ boolean result = confirm();
+ if (result)
+ {
+ log("ErrorView confirmed");
+ }
+ else
+ {
+ log("ErrorView cancelled");
+ }
+ return result;
+ }
+
+ /**
+ * This method is called once before view is opened.
+ */
+ protected void createView()
+ {
+ // Add header.
+ //String title = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED);
+ String title = "Installation failed";
+ if (iInstallerUi.getInstallInfo() != null)
+ {
+ if (iInstallerUi.getInstallInfo().getOldVersion() != null)
+ {
+ title = "Update failed";
+ }
+ addHeader(title, iInstallerUi.getInstallInfo(), null);
+ }
+ else
+ {
+ Label titleLabel = createLabel(title, getColumns(), SWT.WRAP);
+ titleLabel.setFont(iInstallerUi.getBoldFont());
+ }
+
+ int horizontalSpan = getColumns();
+ int labelStyle = SWT.WRAP;
+
+ // Begin widgets creation.
+ Label errorLabel = createLabel(
+ iException.getShortMessage(), horizontalSpan, labelStyle);
+ // End of widgets creation.
+
+ if (iInstallerUi.getInstallInfo() != null)
+ {
+ // After other widgets have been added, add content to
+ // application info Composite.
+ addAppInfo(iInstallerUi.getInstallInfo(), true);
+ }
+ }
+
+ /**
+ * This method is called after user has answered
+ * to confirmation.
+ * Inheriting class must implement this method.
+ */
+ protected void getDataFromView()
+ {
+ // nop
+ }
+
+ /**
+ * Returns SWT style for this view.
+ */
+ protected int getStyle()
+ {
+ return SWT.V_SCROLL;
+ }
+}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallConfirmationView.java Tue May 11 16:07:20 2010 +0300
@@ -55,9 +55,10 @@
}
/** Constructor */
- protected InstallConfirmationView(InstallerUiEswt aInstaller, Composite aParent)
+ protected InstallConfirmationView(
+ InstallerUiEswt aInstallerUi, Composite aParent)
{
- super(aInstaller, aParent, 8);
+ super(aInstallerUi, aParent, 8);
setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALL));
setCommands(InstallerUiTexts.get(InstallerUiTexts.OK),
InstallerUiTexts.get(InstallerUiTexts.CANCEL));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerRuntimeUi.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.installer.ui.eswt2;
+
+import com.nokia.mj.impl.rt.ui.ConfirmData;
+import com.nokia.mj.impl.rt.ui.RuntimeUi;
+import com.nokia.mj.impl.utils.exception.ExceptionBase;
+import com.nokia.mj.impl.utils.exception.InstallerExceptionBase;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * Implementation for JavaInstaller specific RuntimeUI.
+ */
+public class InstallerRuntimeUi extends RuntimeUi
+{
+ private static InstallerUiEswt iInstallerUi = null;
+
+ /**
+ * Initializes static members of this class.
+ */
+ static void init(InstallerUiEswt aInstallerUi)
+ {
+ iInstallerUi = aInstallerUi;
+ iLogId = Logger.EJavaInstaller;
+ }
+
+ /**
+ * Constructor
+ */
+ public InstallerRuntimeUi()
+ {
+ super();
+ }
+
+ /**
+ * Seeks confirmation from the user.
+ *
+ * @param aAppName the name of the application on behalf of which the
+ * confirmation is requested
+ * @param aConfirmData the data to be confirmed. Unless the user has
+ * canceled the confirmation, this data will be filled
+ * in with user's answer upon return
+ * @return true if the user has answered, false if the user has
+ * canceled the confirmation
+ */
+ public boolean confirm(String aAppName, ConfirmData aConfirmData)
+ {
+ boolean result = super.confirm(aAppName, aConfirmData);
+ if (iInstallerUi != null)
+ {
+ result = iInstallerUi.confirm(aAppName, aConfirmData);
+ }
+ return result;
+ }
+
+ /**
+ * Notifies the user that an error has occurred.
+ * This method must return quickly.
+ *
+ * @param aAppName the name of the application which generated the error
+ * situation
+ * @param aException exception indicating the error reason
+ */
+ public void error(String aAppName, ExceptionBase aException)
+ {
+ super.error(aAppName, aException);
+ if (iInstallerUi != null &&
+ aException instanceof InstallerExceptionBase)
+ {
+ iInstallerUi.error((InstallerExceptionBase)aException);
+ }
+ else
+ {
+ logError("Unexpected exception from " + aAppName, aException);
+ }
+ }
+}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Tue May 11 16:07:20 2010 +0300
@@ -28,6 +28,7 @@
import com.nokia.mj.impl.installer.ui.PermissionInfo;
import com.nokia.mj.impl.installer.ui.UninstallInfo;
import com.nokia.mj.impl.installer.ui.eswt.MinimalUi;
+import com.nokia.mj.impl.rt.ui.ConfirmData;
import com.nokia.mj.impl.rt.ui.RuntimeUi;
import com.nokia.mj.impl.rt.ui.RuntimeUiFactory;
import com.nokia.mj.impl.utils.ResourceUtil;
@@ -58,9 +59,6 @@
/**
* JavaInstaller eSWT UI.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class InstallerUiEswt extends InstallerUi
{
@@ -78,6 +76,9 @@
private PermissionConfirmationView iPermissionConfirmationView = null;
private UsernamePasswordView iUsernamePasswordView = null;
private LaunchAppQueryView iLaunchAppQueryView = null;
+ private ErrorView iErrorView = null;
+ private ErrorDetailsView iErrorDetailsView = null;
+ private RuntimeConfirmationView iRuntimeConfirmationView = null;
/** Synchronization object for waiting for the UI initialization. */
private Object iInitWaitObject = new Object();
/** Synchronization object for waiting for the UI termination. */
@@ -131,6 +132,7 @@
{
super.init(aMode, aListener);
StartUpTrace.doTrace("InstallerUiEswt init");
+ InstallerRuntimeUi.init(this);
// Create a hashtable for icons.
iImageTable = new Hashtable();
// Create a new thread to be the UI main thread.
@@ -271,6 +273,18 @@
{
iLaunchAppQueryView.confirmCancel();
}
+ if (iErrorView != null)
+ {
+ iErrorView.confirmCancel();
+ }
+ if (iErrorDetailsView != null)
+ {
+ iErrorDetailsView.confirmCancel();
+ }
+ if (iRuntimeConfirmationView != null)
+ {
+ iRuntimeConfirmationView.confirmCancel();
+ }
// Remove download progress bar if it visible.
if (iDlProgressView != null && !iDlProgressView.isDisposed())
{
@@ -686,7 +700,7 @@
{
return;
}
- if (iDlProgressView != null)
+ if (iDlProgressView != null && !iDlProgressView.isDisposed())
{
iDlProgressView.dispose();
iDlProgressView = null;
@@ -803,7 +817,6 @@
/**
* Notify user that an error has occurred.
- * This method must return quickly.
*
* @param aInstallerException exception indicating the error reason
*/
@@ -812,17 +825,59 @@
super.error(aInstallerException);
waitForUi();
- // InstallerUi does not have to be ready as long as
- // RuntimeUi is used to display error messages.
- //if (!isUiReady()) {
- // return;
- //}
+ if (!isUiReady()) {
+ showRuntimeUiError(aInstallerException);
+ return;
+ }
+
+ // Use ErrorView to display error message.
+ if (iErrorView == null)
+ {
+ final Display display = iParent.getDisplay();
+ final InstallerUiEswt self = this;
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ iErrorView = new ErrorView(self, iDialog);
+ }
+ });
+ }
+ boolean result = iErrorView.error(aInstallerException);
+ iErrorView.dispose();
+ iErrorView = null;
+ if (result)
+ {
+ // Display error details.
+ if (iErrorDetailsView == null)
+ {
+ final Display display = iParent.getDisplay();
+ final InstallerUiEswt self = this;
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ iErrorDetailsView = new ErrorDetailsView(self, iDialog);
+ }
+ });
+ }
+ result = iErrorDetailsView.error(aInstallerException);
+ iErrorDetailsView.dispose();
+ iErrorDetailsView = null;
+ }
+ }
+
+ /**
+ * Notify user that an error has occurred using RuntimeUI.
+ *
+ * @param aInstallerException exception indicating the error reason
+ */
+ private void showRuntimeUiError(InstallerExceptionBase aInstallerException)
+ {
boolean identified = false;
- //String tmpAppName = null;
if (iInstallInfo != null)
{
- //tmpAppName = iInstallInfo.getName();
if (iInstallInfo.getCertificates() != null)
{
identified = true;
@@ -830,7 +885,6 @@
}
else if (iUninstallInfo != null)
{
- //tmpAppName = iUninstallInfo.getName();
if (iUninstallInfo.getCertificates() != null)
{
identified = true;
@@ -853,67 +907,50 @@
{
iProgressView.setVisible(false);
}
- // Use RuntimeUi to display error message.
+ // Use RuntimeUi to display uninstallation error message.
RuntimeUi runtimeUi = RuntimeUiFactory.getRuntimeUi(identified);
runtimeUi.error(tmpTitle, aInstallerException);
runtimeUi.destroy();
+ }
- /*
- // Display error message using eSWT MessageBox.
- final String appName = tmpAppName;
- final String title = tmpTitle;
- final String shortMsg = aInstallerException.getShortMessage();
- final String detailedMsg = aInstallerException.getDetailedMessage();
- // UI updates must be executed in UI thread.
- iParent.getDisplay().syncExec
- (new Runnable() {
- public void run() {
- if (detailedMsg == null || detailedMsg.length() == 0) {
- // No detailed msg, display only short msg.
- MessageBox messageBox = new MessageBox
- (iParent, SWT.ICON_ERROR | SWT.OK);
- messageBox.setText(title);
- messageBox.setMessage
- (getMessage(title, appName, shortMsg, false));
- messageBox.open();
- } else {
- // Display both short and detailed msgs.
- MessageBox messageBox = new MessageBox
- (iParent, SWT.ICON_ERROR | SWT.YES | SWT.NO);
- messageBox.setText(title);
- messageBox.setMessage
- (getMessage(title, appName, shortMsg, true));
- int answer = messageBox.open();
- if ((answer & SWT.YES) != 0) {
- // User wants to see details, display them.
- messageBox = new MessageBox
- (iParent, SWT.ICON_ERROR | SWT.OK);
- messageBox.setText(title);
- messageBox.setMessage
- (getMessage(title, appName, detailedMsg, false));
- messageBox.open();
- }
- }
- }
- private String getMessage(String aTitle, String aAppName,
- String aMsg, boolean aDetailsQuery) {
- //String result = aTitle + "\n\n";
- String result = "";
- if (aAppName == null) {
- result += aMsg;
- } else {
- result += aAppName + "\n\n" + aMsg;
- }
- if (aDetailsQuery) {
- result += "\n\n";
- result += InstallerUiTexts.get
- (InstallerUiTexts.DETAILS_QUERY);
- }
- return result;
- }
- });
+ /**
+ * Seeks confirmation from the user.
+ *
+ * @param aAppName the name of the application on behalf of which the
+ * confirmation is requested
+ * @param aConfirmData the data to be confirmed. Unless the user has
+ * canceled the confirmation, this data will be filled
+ * in with user's answer upon return
+ * @return true if the user has answered, false if the user has
+ * canceled the confirmation
+ */
+ public boolean confirm(String aAppName, ConfirmData aConfirmData)
+ {
+ waitForUi();
+ if (!isUiReady()) {
+ return true;
+ }
- */
+ if (iRuntimeConfirmationView == null)
+ {
+ final Display display = iParent.getDisplay();
+ final InstallerUiEswt self = this;
+ final String appName = aAppName;
+ final ConfirmData confirmData = aConfirmData;
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ iRuntimeConfirmationView = new RuntimeConfirmationView(
+ self, iDialog, appName, confirmData);
+ }
+ });
+ }
+ boolean result = iRuntimeConfirmationView.confirm();
+ iRuntimeConfirmationView.dispose();
+ iRuntimeConfirmationView = null;
+ log("Runtime confirmation returns " + result);
+ return result;
}
/**
@@ -1020,7 +1057,7 @@
/**
* Hides or unhides InstallerUi.
*/
- protected void hide(boolean aHide)
+ public void hide(boolean aHide)
{
iParent.setMinimized(aHide);
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
/**
* Class defining InstallerUi texts.
- *
- * @author Nokia Corporation
- * @version 1.0
*/
public class InstallerUiTexts
{
@@ -40,6 +37,7 @@
public static final String INSTALL = "progress";
public static final String UNINSTALL = "uninstalling_progress";
public static final String START = "start";
+ public static final String SHOW = "show";
public static final String CLOSE = "close";
public static final String INSTALL_QUERY = "query";
public static final String UPDATE_QUERY = "update_query";
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/LaunchAppQueryView.java Tue May 11 16:07:20 2010 +0300
@@ -41,9 +41,10 @@
}
/** Constructor */
- protected LaunchAppQueryView(InstallerUiEswt aInstaller, Composite aParent)
+ protected LaunchAppQueryView(
+ InstallerUiEswt aInstallerUi, Composite aParent)
{
- super(aInstaller, aParent, 8);
+ super(aInstallerUi, aParent, 8);
setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALLATION_COMPLETE));
setCommands("Show", //InstallerUiTexts.get(InstallerUiTexts.SHOW),
InstallerUiTexts.get(InstallerUiTexts.CLOSE));
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java Tue May 11 16:07:20 2010 +0300
@@ -59,9 +59,10 @@
}
/** Constructor */
- protected PermissionConfirmationView(InstallerUiEswt aInstaller, Composite aParent)
+ protected PermissionConfirmationView(
+ InstallerUiEswt aInstallerUi, Composite aParent)
{
- super(aInstaller, aParent, 8, true);
+ super(aInstallerUi, aParent, 8, true);
setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALL));
setCommands(null, null);
}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java Tue May 11 16:07:20 2010 +0300
@@ -39,11 +39,11 @@
}
/** Constructor */
- protected PermissionDetailsView(InstallerUiEswt aInstaller, Composite aParent,
- String aTitle,
- PermissionInfo aPermissionInfo)
+ protected PermissionDetailsView(
+ InstallerUiEswt aInstallerUi, Composite aParent,
+ String aTitle, PermissionInfo aPermissionInfo)
{
- super(aInstaller, aParent, 1, true);
+ super(aInstallerUi, aParent, 1, true);
iPermissionInfo = aPermissionInfo;
setTitle(aTitle);
setCommands(null, InstallerUiTexts.get(InstallerUiTexts.OK));
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java Tue May 11 16:07:20 2010 +0300
@@ -58,29 +58,29 @@
}
/** Constructor */
- protected ProgressView(InstallerUiEswt aInstaller, Composite aParent)
+ protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent)
{
- this(aInstaller, aParent, "");
+ this(aInstallerUi, aParent, "");
}
/** Constructor */
- protected ProgressView(InstallerUiEswt aInstaller, Composite aParent, String aMsg)
+ protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg)
{
- this(aInstaller, aParent, aMsg, false);
+ this(aInstallerUi, aParent, aMsg, false);
}
/** Constructor */
- protected ProgressView(InstallerUiEswt aInstaller, Composite aParent, String aMsg,
+ protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg,
boolean aIndeterminate)
{
- super(aInstaller, aParent, 8);
+ super(aInstallerUi, aParent, 8);
iMsg = aMsg;
// Add header.
if (iInstallerUi != null && iInstallerUi.getInstallInfo() != null)
{
// Add header.
- addHeader(aMsg, iInstallerUi.getInstallInfo(), null);
+ addHeader(aMsg, iInstallerUi.getInstallInfo(), null, false);
}
else
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/RuntimeConfirmationView.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.ui.eswt2;
+
+import com.nokia.mj.impl.rt.ui.ConfirmData;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Displays error message.
+ */
+public class RuntimeConfirmationView extends ConfirmationViewBase
+{
+ private String iAppName = null;
+ private ConfirmData iConfirmData = null;
+ private Button[] iAnswerButtons = null;
+
+ /** Constructor */
+ protected RuntimeConfirmationView()
+ {
+ super();
+ }
+
+ /** Constructor */
+ protected RuntimeConfirmationView(InstallerUiEswt aInstallerUi,
+ Composite aParent, String aAppName,
+ ConfirmData aConfirmData)
+ {
+ super(aInstallerUi, aParent, 8);
+ iAppName = aAppName;
+ iConfirmData = aConfirmData;
+ setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED));
+ String[] answerOptions = iConfirmData.getAnswerOptions();
+ switch (answerOptions.length)
+ {
+ case 1: setCommands(answerOptions[0], null); break;
+ case 2: setCommands(answerOptions[0], answerOptions[1]); break;
+ default: setCommands(null, null); break;
+ }
+ }
+
+ /**
+ * This method is called once before view is opened.
+ */
+ protected void createView()
+ {
+ // Add title.
+ if (iInstallerUi.getInstallInfo() != null)
+ {
+ Label titleLabel = createLabel(iAppName, getColumns() - 1, SWT.WRAP);
+ titleLabel.setFont(iInstallerUi.getBoldFont());
+ // Add security icon.
+ iCertificates = iInstallerUi.getInstallInfo().getCertificates();
+ createSecurityButton();
+ }
+ else
+ {
+ Label titleLabel = createLabel(iAppName, getColumns(), SWT.WRAP);
+ titleLabel.setFont(iInstallerUi.getBoldFont());
+ }
+
+ GridData gridData = null;
+ int horizontalSpan = getColumns();
+ int labelStyle = SWT.WRAP;
+
+ // Begin widgets creation.
+
+ // Add question label.
+ Label errorLabel = createLabel(
+ iConfirmData.getQuestion(), horizontalSpan, labelStyle);
+
+
+ // Add user answer buttons.
+ String[] answerOptions = iConfirmData.getAnswerOptions();
+ if (answerOptions.length > 2)
+ {
+ iAnswerButtons = new Button[answerOptions.length];
+ for (int i = 0; i < iAnswerButtons.length; i++)
+ {
+ final int answerIndex = i;
+ iAnswerButtons[i] = new Button(getComposite(), SWT.PUSH);
+ iAnswerButtons[i].setText(answerOptions[i]);
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = horizontalSpan;
+ iAnswerButtons[i].setLayoutData(gridData);
+ iAnswerButtons[i].addDisposeListener(new DisposeListener ()
+ {
+ public void widgetDisposed(DisposeEvent aEvent)
+ {
+ answer(answerIndex);
+ }
+ });
+ iAnswerButtons[i].addSelectionListener(new SelectionListener ()
+ {
+ public void widgetDefaultSelected(SelectionEvent aEvent)
+ {
+ widgetSelected(aEvent);
+ }
+ public void widgetSelected(SelectionEvent aEvent)
+ {
+ answer(answerIndex);
+ }
+ });
+ }
+ // Set the default answer option.
+ iParent.setDefaultButton(
+ iAnswerButtons[iConfirmData.getAnswerSuggestion()]);
+ iAnswerButtons[iConfirmData.getAnswerSuggestion()].setFocus();
+ }
+
+ // End of widgets creation.
+ }
+
+ /**
+ * This method is called when user answers to the dialog.
+ */
+ protected void answer(int aAnswerIndex)
+ {
+ iConfirmData.setAnswer(aAnswerIndex);
+ super.confirmOk();
+ }
+
+ /**
+ * This method is called when user accepts the dialog.
+ */
+ protected void confirmOk()
+ {
+ iConfirmData.setAnswer(0);
+ super.confirmOk();
+ }
+
+ /**
+ * This method is called when user cancels the dialog.
+ */
+ protected void confirmCancel()
+ {
+ iConfirmData.setAnswer(1);
+ super.confirmCancel();
+ }
+
+ /**
+ * This method is called after user has answered
+ * to confirmation.
+ */
+ protected void getDataFromView()
+ {
+ // nop
+ }
+
+ /**
+ * Returns SWT style for this view.
+ */
+ protected int getStyle()
+ {
+ return SWT.V_SCROLL;
+ }
+}
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UninstallConfirmationView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UninstallConfirmationView.java Tue May 11 16:07:20 2010 +0300
@@ -46,9 +46,10 @@
}
/** Constructor */
- protected UninstallConfirmationView(InstallerUiEswt aInstaller, Composite aParent)
+ protected UninstallConfirmationView(
+ InstallerUiEswt aInstallerUi, Composite aParent)
{
- super(aInstaller, aParent, 8);
+ super(aInstallerUi, aParent, 8);
setTitle(InstallerUiTexts.get(InstallerUiTexts.UNINSTALL));
setCommands(InstallerUiTexts.get(InstallerUiTexts.OK),
InstallerUiTexts.get(InstallerUiTexts.CANCEL));
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java Tue May 11 16:07:20 2010 +0300
@@ -18,6 +18,7 @@
package com.nokia.mj.impl.installer.ui.eswt2;
+import org.eclipse.ercp.swt.mobile.Screen;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -44,9 +45,10 @@
}
/** Constructor */
- protected UsernamePasswordView(InstallerUiEswt aInstaller, Composite aParent)
+ protected UsernamePasswordView(
+ InstallerUiEswt aInstallerUi, Composite aParent)
{
- super(aInstaller, aParent, 1);
+ super(aInstallerUi, aParent, 1);
setTitle(InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO));
setCommands(InstallerUiTexts.get(InstallerUiTexts.OK),
InstallerUiTexts.get(InstallerUiTexts.CANCEL));
@@ -86,8 +88,11 @@
}
iUrl = aUrl;
+ // UsernamePasswordView is always displayed in portrait mode.
+ //forceScreenOrientation(Screen.PORTRAIT);
// Use confirm() from super class to display the view.
boolean confirmation = confirm();
+ //forceScreenOrientation(SWT.DEFAULT);
// And return the result to the client.
String[] result = null;
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java Tue May 11 16:07:20 2010 +0300
@@ -25,6 +25,8 @@
import java.io.InputStream;
+import org.eclipse.ercp.swt.mobile.MobileDevice;
+import org.eclipse.ercp.swt.mobile.Screen;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionEvent;
@@ -75,7 +77,7 @@
/** Certificate details view. */
private CertificateDetailsView iCertificateDetailsView = null;
/** Certificates for this application. */
- private SigningCertificate[] iCertificates = null;
+ protected SigningCertificate[] iCertificates = null;
/** Constructor */
protected ViewBase()
@@ -83,15 +85,15 @@
}
/** Constructor */
- protected ViewBase(InstallerUiEswt aInstaller, Composite aParent, int aColumns)
+ protected ViewBase(InstallerUiEswt aInstallerUi, Composite aParent, int aColumns)
{
- this(aInstaller, aParent, aColumns, false);
+ this(aInstallerUi, aParent, aColumns, false);
}
/** Constructor */
- protected ViewBase(InstallerUiEswt aInstaller, Composite aParent, int aColumns, boolean aScrollable)
+ protected ViewBase(InstallerUiEswt aInstallerUi, Composite aParent, int aColumns, boolean aScrollable)
{
- iInstallerUi = aInstaller;
+ iInstallerUi = aInstallerUi;
// Each view gets a shell to be used as a parameter.
iParent = (Shell)aParent;
@@ -229,8 +231,11 @@
{
public void run()
{
- log(className + ": disposing view container");
- iContainer.dispose();
+ if (!isDisposed())
+ {
+ log(className + ": disposing view container");
+ iContainer.dispose();
+ }
}
});
}
@@ -267,11 +272,14 @@
}
}
// UI updates must be executed in UI thread.
- iParent.getDisplay().syncExec
- (new Runnable()
+ iParent.getDisplay().syncExec(new Runnable()
{
public void run()
{
+ if (isDisposed())
+ {
+ return;
+ }
if (iVisible)
{
updateSize();
@@ -386,6 +394,20 @@
}
/**
+ * Forces screen orientation. Valid values are
+ * Screen.PORTRAIT, Screen.LANDSCAPE, and SWT.DEFAULT.
+ */
+ protected void forceScreenOrientation(int aOrientation)
+ {
+ Screen[] screens = MobileDevice.getMobileDevice().getScreens();
+ for (int i = 0; i < screens.length; i++)
+ {
+ screens[i].setOrientation(aOrientation);
+ }
+ log(this.toString() + ": screen orientation set to " + aOrientation);
+ }
+
+ /**
* Returns true if the View should have focus after it has been opened.
*/
protected boolean forceFocusToView()
@@ -412,11 +434,21 @@
}
/**
- * Adds header used in installation and uninstallation views.
+ * Adds header used in installation views.
*/
protected void addHeader(
String aTitle, InstallInfo aInstallInfo, UninstallInfo aUninstallInfo)
{
+ addHeader(aTitle, aInstallInfo, aUninstallInfo, true);
+ }
+
+ /**
+ * Adds header used in installation views.
+ */
+ protected void addHeader(
+ String aTitle, InstallInfo aInstallInfo, UninstallInfo aUninstallInfo,
+ boolean aSecurityButton)
+ {
// Add title.
String title = "Install?";
if (aInstallInfo != null)
@@ -435,8 +467,16 @@
Label titleLabel = createLabel(aTitle, getColumns() - 1, SWT.WRAP);
titleLabel.setFont(iInstallerUi.getBoldFont());
- // Add security icon.
- createSecurityButton();
+ if (aSecurityButton)
+ {
+ // Add security icon.
+ createSecurityButton();
+ }
+ else
+ {
+ // Add security icon.
+ createSecurityLabel(iCertificates != null);
+ }
// Add suite icon.
InputStream iconInputStream = null;
@@ -628,10 +668,10 @@
{
Label label = createLabel((Image)null, 1, SWT.NONE);
Image securityIcon = null;
- if (iInstallerUi instanceof InstallerUiEswt)
+ if (iInstallerUi != null)
{
- securityIcon = ((InstallerUiEswt)iInstallerUi).getSecurityIcon
- (getDisplay(), aIdentified);
+ securityIcon = iInstallerUi.getSecurityIcon(
+ getDisplay(), aIdentified);
}
if (securityIcon != null)
{
@@ -654,11 +694,10 @@
gridData.verticalAlignment = SWT.CENTER;
button.setLayoutData(gridData);
Image securityIcon = null;
- if (iInstallerUi instanceof InstallerUiEswt)
+ if (iInstallerUi != null)
{
- securityIcon =
- ((InstallerUiEswt)iInstallerUi).getSecurityIcon(
- getDisplay(), iCertificates != null);
+ securityIcon = iInstallerUi.getSecurityIcon(
+ getDisplay(), iCertificates != null);
}
if (securityIcon != null)
{
--- a/javamanager/javainstaller/installerui/javasrc/org/eclipse/swt/custom/ScrolledComposite.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,764 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.custom;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A ScrolledComposite provides scrollbars and will scroll its content when the user
- * uses the scrollbars.
- *
- *
- * <p>There are two ways to use the ScrolledComposite:
- *
- * <p>
- * 1) Set the size of the control that is being scrolled and the ScrolledComposite
- * will show scrollbars when the contained control can not be fully seen.
- *
- * 2) The second way imitates the way a browser would work. Set the minimum size of
- * the control and the ScrolledComposite will show scroll bars if the visible area is
- * less than the minimum size of the control and it will expand the size of the control
- * if the visible area is greater than the minimum size. This requires invoking
- * both setMinWidth(), setMinHeight() and setExpandHorizontal(), setExpandVertical().
- *
- * <code><pre>
- * public static void main (String [] args) {
- * Display display = new Display ();
- * Color red = display.getSystemColor(SWT.COLOR_RED);
- * Color blue = display.getSystemColor(SWT.COLOR_BLUE);
- * Shell shell = new Shell (display);
- * shell.setLayout(new FillLayout());
- *
- * // set the size of the scrolled content - method 1
- * final ScrolledComposite sc1 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- * final Composite c1 = new Composite(sc1, SWT.NONE);
- * sc1.setContent(c1);
- * c1.setBackground(red);
- * GridLayout layout = new GridLayout();
- * layout.numColumns = 4;
- * c1.setLayout(layout);
- * Button b1 = new Button (c1, SWT.PUSH);
- * b1.setText("first button");
- * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- *
- * // set the minimum width and height of the scrolled content - method 2
- * final ScrolledComposite sc2 = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- * sc2.setExpandHorizontal(true);
- * sc2.setExpandVertical(true);
- * final Composite c2 = new Composite(sc2, SWT.NONE);
- * sc2.setContent(c2);
- * c2.setBackground(blue);
- * layout = new GridLayout();
- * layout.numColumns = 4;
- * c2.setLayout(layout);
- * Button b2 = new Button (c2, SWT.PUSH);
- * b2.setText("first button");
- * sc2.setMinSize(c2.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- *
- * Button add = new Button (shell, SWT.PUSH);
- * add.setText("add children");
- * final int[] index = new int[]{0};
- * add.addListener(SWT.Selection, new Listener() {
- * public void handleEvent(Event e) {
- * index[0]++;
- * Button button = new Button(c1, SWT.PUSH);
- * button.setText("button "+index[0]);
- * // reset size of content so children can be seen - method 1
- * c1.setSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- * c1.layout();
- *
- * button = new Button(c2, SWT.PUSH);
- * button.setText("button "+index[0]);
- * // reset the minimum width and height so children can be seen - method 2
- * sc2.setMinSize(c2.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- * c2.layout();
- * }
- * });
- *
- * shell.open ();
- * while (!shell.isDisposed ()) {
- * if (!display.readAndDispatch ()) display.sleep ();
- * }
- * display.dispose ();
- * }
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles:</b><dd>H_SCROLL, V_SCROLL
- * </dl>
- *
- * @see <a href="http://www.eclipse.org/swt/snippets/#scrolledcomposite">ScrolledComposite snippets</a>
- * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
- */
-public class ScrolledComposite extends Composite
-{
-
- Control content;
- Listener contentListener;
- Listener filter;
-
- int minHeight = 0;
- int minWidth = 0;
- boolean expandHorizontal = false;
- boolean expandVertical = false;
- boolean alwaysShowScroll = false;
- boolean showFocusedControl = false;
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#H_SCROLL
- * @see SWT#V_SCROLL
- * @see #getStyle()
- */
- public ScrolledComposite(Composite parent, int style)
- {
- super(parent, checkStyle(style));
- super.setLayout(new ScrolledCompositeLayout());
- ScrollBar hBar = getHorizontalBar();
- if (hBar != null)
- {
- hBar.setVisible(false);
- hBar.addListener(SWT.Selection, new Listener()
- {
- public void handleEvent(Event e)
- {
- hScroll();
- }
- });
- }
-
- ScrollBar vBar = getVerticalBar();
- if (vBar != null)
- {
- vBar.setVisible(false);
- vBar.addListener(SWT.Selection, new Listener()
- {
- public void handleEvent(Event e)
- {
- vScroll();
- }
- });
- }
-
- contentListener = new Listener()
- {
- public void handleEvent(Event e)
- {
- if (e.type != SWT.Resize) return;
- layout(false);
- }
- };
-
- filter = new Listener()
- {
- public void handleEvent(Event event)
- {
- if (event.widget instanceof Control)
- {
- Control control = (Control) event.widget;
- if (contains(control)) showControl(control);
- }
- }
- };
-
- addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent e)
- {
- getDisplay().removeFilter(SWT.FocusIn, filter);
- }
- });
- }
-
- static int checkStyle(int style)
- {
- int mask = SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask;
- }
-
- boolean contains(Control control)
- {
- if (control == null || control.isDisposed()) return false;
-
- Composite parent = control.getParent();
- while (parent != null && !(parent instanceof Shell))
- {
- if (this == parent) return true;
- parent = parent.getParent();
- }
- return false;
- }
-
- /**
- * Returns the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- *
- * @return the Always Show Scrollbars flag value
- */
- public boolean getAlwaysShowScrollBars()
- {
- //checkWidget();
- return alwaysShowScroll;
- }
-
- /**
- * Returns <code>true</code> if the content control
- * will be expanded to fill available horizontal space.
- *
- * @return the receiver's horizontal expansion state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.2
- */
- public boolean getExpandHorizontal()
- {
- checkWidget();
- return expandHorizontal;
- }
-
- /**
- * Returns <code>true</code> if the content control
- * will be expanded to fill available vertical space.
- *
- * @return the receiver's vertical expansion state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.2
- */
- public boolean getExpandVertical()
- {
- checkWidget();
- return expandVertical;
- }
-
- /**
- * Returns the minimum width of the content control.
- *
- * @return the minimum width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.2
- */
- public int getMinWidth()
- {
- checkWidget();
- return minWidth;
- }
-
- /**
- * Returns the minimum height of the content control.
- *
- * @return the minimum height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.2
- */
- public int getMinHeight()
- {
- checkWidget();
- return minHeight;
- }
-
- /**
- * Get the content that is being scrolled.
- *
- * @return the control displayed in the content area
- */
- public Control getContent()
- {
- //checkWidget();
- return content;
- }
-
- /**
- * Returns <code>true</code> if the receiver automatically scrolls to a focused child control
- * to make it visible. Otherwise, returns <code>false</code>.
- *
- * @return a boolean indicating whether focused child controls are automatically scrolled into the viewport
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public boolean getShowFocusedControl()
- {
- checkWidget();
- return showFocusedControl;
- }
-
- void hScroll()
- {
- if (content == null) return;
- Point location = content.getLocation();
- ScrollBar hBar = getHorizontalBar();
- int hSelection = hBar.getSelection();
- content.setLocation(-hSelection, location.y);
- }
- boolean needHScroll(Rectangle contentRect, boolean vVisible)
- {
- ScrollBar hBar = getHorizontalBar();
- if (hBar == null) return false;
-
- Rectangle hostRect = getBounds();
- int border = getBorderWidth();
- hostRect.width -= 2*border;
- ScrollBar vBar = getVerticalBar();
- if (vVisible && vBar != null) hostRect.width -= vBar.getSize().x;
-
- if (!expandHorizontal && contentRect.width > hostRect.width) return true;
- if (expandHorizontal && minWidth > hostRect.width) return true;
- return false;
- }
-
- boolean needVScroll(Rectangle contentRect, boolean hVisible)
- {
- ScrollBar vBar = getVerticalBar();
- if (vBar == null) return false;
-
- Rectangle hostRect = getBounds();
- int border = getBorderWidth();
- hostRect.height -= 2*border;
- ScrollBar hBar = getHorizontalBar();
- if (hVisible && hBar != null) hostRect.height -= hBar.getSize().y;
-
- if (!expandVertical && contentRect.height > hostRect.height) return true;
- if (expandVertical && minHeight > hostRect.height) return true;
- return false;
- }
-
- /**
- * Return the point in the content that currently appears in the top left
- * corner of the scrolled composite.
- *
- * @return the point in the content that currently appears in the top left
- * corner of the scrolled composite. If no content has been set, this returns
- * (0, 0).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 2.0
- */
- public Point getOrigin()
- {
- checkWidget();
- if (content == null) return new Point(0, 0);
- Point location = content.getLocation();
- return new Point(-location.x, -location.y);
- }
- /**
- * Scrolls the content so that the specified point in the content is in the top
- * left corner. If no content has been set, nothing will occur.
- *
- * Negative values will be ignored. Values greater than the maximum scroll
- * distance will result in scrolling to the end of the scrollbar.
- *
- * @param origin the point on the content to appear in the top left corner
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content
- * </ul>
- * @since 2.0
- */
- public void setOrigin(Point origin)
- {
- setOrigin(origin.x, origin.y);
- }
- /**
- * Scrolls the content so that the specified point in the content is in the top
- * left corner. If no content has been set, nothing will occur.
- *
- * Negative values will be ignored. Values greater than the maximum scroll
- * distance will result in scrolling to the end of the scrollbar.
- *
- * @param x the x coordinate of the content to appear in the top left corner
- *
- * @param y the y coordinate of the content to appear in the top left corner
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 2.0
- */
- public void setOrigin(int x, int y)
- {
- checkWidget();
- if (content == null) return;
- ScrollBar hBar = getHorizontalBar();
- if (hBar != null)
- {
- hBar.setSelection(x);
- x = -hBar.getSelection();
- }
- else
- {
- x = 0;
- }
- ScrollBar vBar = getVerticalBar();
- if (vBar != null)
- {
- vBar.setSelection(y);
- y = -vBar.getSelection();
- }
- else
- {
- y = 0;
- }
- content.setLocation(x, y);
- }
- /**
- * Set the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- *
- * @param show true to show the scrollbars even when not required, false to show scrollbars only when required
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setAlwaysShowScrollBars(boolean show)
- {
- checkWidget();
- if (show == alwaysShowScroll) return;
- alwaysShowScroll = show;
- ScrollBar hBar = getHorizontalBar();
- if (hBar != null && alwaysShowScroll) hBar.setVisible(true);
- ScrollBar vBar = getVerticalBar();
- if (vBar != null && alwaysShowScroll) vBar.setVisible(true);
- layout(false);
- }
-
- /**
- * Set the content that will be scrolled.
- *
- * @param content the control to be displayed in the content area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setContent(Control content)
- {
- checkWidget();
- if (this.content != null && !this.content.isDisposed())
- {
- this.content.removeListener(SWT.Resize, contentListener);
- this.content.setBounds(new Rectangle(-200, -200, 0, 0));
- }
-
- this.content = content;
- ScrollBar vBar = getVerticalBar();
- ScrollBar hBar = getHorizontalBar();
- if (this.content != null)
- {
- if (vBar != null)
- {
- vBar.setMaximum(0);
- vBar.setThumb(0);
- vBar.setSelection(0);
- }
- if (hBar != null)
- {
- hBar.setMaximum(0);
- hBar.setThumb(0);
- hBar.setSelection(0);
- }
- content.setLocation(0, 0);
- layout(false);
- this.content.addListener(SWT.Resize, contentListener);
- }
- else
- {
- if (hBar != null) hBar.setVisible(alwaysShowScroll);
- if (vBar != null) vBar.setVisible(alwaysShowScroll);
- }
- }
- /**
- * Configure the ScrolledComposite to resize the content object to be as wide as the
- * ScrolledComposite when the width of the ScrolledComposite is greater than the
- * minimum width specified in setMinWidth. If the ScrolledComposite is less than the
- * minimum width, the content will not be resized and instead the horizontal scroll bar will be
- * used to view the entire width.
- * If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
- *
- * @param expand true to expand the content control to fill available horizontal space
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setExpandHorizontal(boolean expand)
- {
- checkWidget();
- if (expand == expandHorizontal) return;
- expandHorizontal = expand;
- layout(false);
- }
- /**
- * Configure the ScrolledComposite to resize the content object to be as tall as the
- * ScrolledComposite when the height of the ScrolledComposite is greater than the
- * minimum height specified in setMinHeight. If the ScrolledComposite is less than the
- * minimum height, the content will not be resized and instead the vertical scroll bar will be
- * used to view the entire height.
- * If expand is false, this behaviour is turned off. By default, this behaviour is turned off.
- *
- * @param expand true to expand the content control to fill available vertical space
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setExpandVertical(boolean expand)
- {
- checkWidget();
- if (expand == expandVertical) return;
- expandVertical = expand;
- layout(false);
- }
- /**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note: No Layout can be set on this Control because it already
- * manages the size and position of its children.
- * </p>
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setLayout(Layout layout)
- {
- checkWidget();
- return;
- }
- /**
- * Specify the minimum height at which the ScrolledComposite will begin scrolling the
- * content with the vertical scroll bar. This value is only relevant if
- * setExpandVertical(true) has been set.
- *
- * @param height the minimum height or 0 for default height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setMinHeight(int height)
- {
- setMinSize(minWidth, height);
- }
- /**
- * Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
- * content with the horizontal scroll bar. This value is only relevant if
- * setExpandHorizontal(true) and setExpandVertical(true) have been set.
- *
- * @param size the minimum size or null for the default size
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setMinSize(Point size)
- {
- if (size == null)
- {
- setMinSize(0, 0);
- }
- else
- {
- setMinSize(size.x, size.y);
- }
- }
- /**
- * Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
- * content with the horizontal scroll bar. This value is only relevant if
- * setExpandHorizontal(true) and setExpandVertical(true) have been set.
- *
- * @param width the minimum width or 0 for default width
- * @param height the minimum height or 0 for default height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setMinSize(int width, int height)
- {
- checkWidget();
- if (width == minWidth && height == minHeight) return;
- minWidth = Math.max(0, width);
- minHeight = Math.max(0, height);
- layout(false);
- }
- /**
- * Specify the minimum width at which the ScrolledComposite will begin scrolling the
- * content with the horizontal scroll bar. This value is only relevant if
- * setExpandHorizontal(true) has been set.
- *
- * @param width the minimum width or 0 for default width
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setMinWidth(int width)
- {
- setMinSize(width, minHeight);
- }
-
- /**
- * Configure the receiver to automatically scroll to a focused child control
- * to make it visible.
- *
- * If show is <code>false</code>, show a focused control is off.
- * By default, show a focused control is off.
- *
- * @param show <code>true</code> to show a focused control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public void setShowFocusedControl(boolean show)
- {
- checkWidget();
- if (showFocusedControl == show) return;
- Display display = getDisplay();
- display.removeFilter(SWT.FocusIn, filter);
- showFocusedControl = show;
- if (!showFocusedControl) return;
- display.addFilter(SWT.FocusIn, filter);
- Control control = display.getFocusControl();
- if (contains(control)) showControl(control);
- }
-
- /**
- * Scrolls the content of the receiver so that the control is visible.
- *
- * @param control the control to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the control is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public void showControl(Control control)
- {
- checkWidget();
- if (control == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (control.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (!contains(control)) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
-
- Rectangle itemRect = getDisplay().map(control.getParent(), this, control.getBounds());
- Rectangle area = getClientArea();
- Point origin = getOrigin();
- if (itemRect.x < 0)
- {
- origin.x = Math.max(0, origin.x + itemRect.x);
- }
- else
- {
- if (area.width < itemRect.x + itemRect.width) origin.x = Math.max(0, origin.x + itemRect.x + Math.min(itemRect.width, area.width) - area.width);
- }
- if (itemRect.y < 0)
- {
- origin.y = Math.max(0, origin.y + itemRect.y);
- }
- else
- {
- if (area.height < itemRect.y + itemRect.height) origin.y = Math.max(0, origin.y + itemRect.y + Math.min(itemRect.height, area.height) - area.height);
- }
- setOrigin(origin);
- }
-
- void vScroll()
- {
- if (content == null) return;
- Point location = content.getLocation();
- ScrollBar vBar = getVerticalBar();
- int vSelection = vBar.getSelection();
- content.setLocation(location.x, -vSelection);
- }
-}
--- a/javamanager/javainstaller/installerui/javasrc/org/eclipse/swt/custom/ScrolledCompositeLayout.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.custom;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * This class provides the layout for ScrolledComposite
- *
- * @see ScrolledComposite
- */
-class ScrolledCompositeLayout extends Layout
-{
-
- boolean inLayout = false;
- static final int DEFAULT_WIDTH = 64;
- static final int DEFAULT_HEIGHT = 64;
-
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
- {
- ScrolledComposite sc = (ScrolledComposite)composite;
- Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
- if (sc.content != null)
- {
- Point preferredSize = sc.content.computeSize(wHint, hHint, flushCache);
- Point currentSize = sc.content.getSize();
- size.x = sc.getExpandHorizontal() ? preferredSize.x : currentSize.x;
- size.y = sc.getExpandVertical() ? preferredSize.y : currentSize.y;
- }
- size.x = Math.max(size.x, sc.minWidth);
- size.y = Math.max(size.y, sc.minHeight);
- if (wHint != SWT.DEFAULT) size.x = wHint;
- if (hHint != SWT.DEFAULT) size.y = hHint;
- return size;
- }
-
- protected boolean flushCache(Control control)
- {
- return true;
- }
-
- protected void layout(Composite composite, boolean flushCache)
- {
- if (inLayout) return;
- ScrolledComposite sc = (ScrolledComposite)composite;
- if (sc.content == null) return;
- ScrollBar hBar = sc.getHorizontalBar();
- ScrollBar vBar = sc.getVerticalBar();
- if (hBar != null)
- {
- if (hBar.getSize().y >= sc.getSize().y)
- {
- return;
- }
- }
- if (vBar != null)
- {
- if (vBar.getSize().x >= sc.getSize().x)
- {
- return;
- }
- }
- inLayout = true;
- Rectangle contentRect = sc.content.getBounds();
- if (!sc.alwaysShowScroll)
- {
- boolean hVisible = sc.needHScroll(contentRect, false);
- boolean vVisible = sc.needVScroll(contentRect, hVisible);
- if (!hVisible && vVisible) hVisible = sc.needHScroll(contentRect, vVisible);
- if (hBar != null) hBar.setVisible(hVisible);
- if (vBar != null) vBar.setVisible(vVisible);
- }
- Rectangle hostRect = sc.getClientArea();
- if (sc.expandHorizontal)
- {
- contentRect.width = Math.max(sc.minWidth, hostRect.width);
- }
- if (sc.expandVertical)
- {
- contentRect.height = Math.max(sc.minHeight, hostRect.height);
- }
-
- if (hBar != null)
- {
- hBar.setMaximum(contentRect.width);
- hBar.setThumb(Math.min(contentRect.width, hostRect.width));
- int hPage = contentRect.width - hostRect.width;
- int hSelection = hBar.getSelection();
- if (hSelection >= hPage)
- {
- if (hPage <= 0)
- {
- hSelection = 0;
- hBar.setSelection(0);
- }
- contentRect.x = -hSelection;
- }
- }
-
- if (vBar != null)
- {
- vBar.setMaximum(contentRect.height);
- vBar.setThumb(Math.min(contentRect.height, hostRect.height));
- int vPage = contentRect.height - hostRect.height;
- int vSelection = vBar.getSelection();
- if (vSelection >= vPage)
- {
- if (vPage <= 0)
- {
- vSelection = 0;
- vBar.setSelection(0);
- }
- contentRect.y = -vSelection;
- }
- }
-
- sc.content.setBounds(contentRect);
- inLayout = false;
- }
-}
--- a/javamanager/javalauncher/build/javalauncher_0x2001E262.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javalauncher/build/javalauncher_0x2001E262.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javaregistry/build/javaregistryclient_0x10282476.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/build/javaregistryclient_0x10282476.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -96,6 +95,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javaregistry/client/src/javaregistry.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/client/src/javaregistry.cpp Tue May 11 16:07:20 2010 +0300
@@ -35,7 +35,6 @@
EXPORT_C CJavaRegistry* CJavaRegistry::NewL()
{
JELOG2(EJavaStorage);
- LOG(EJavaStorage, EInfo, "CJavaRegistry::NewL");
CJavaRegistry* self = CJavaRegistry::NewLC();
CleanupStack::Pop(self);
@@ -49,7 +48,6 @@
EXPORT_C CJavaRegistry* CJavaRegistry::NewLC()
{
JELOG2(EJavaStorage);
- LOG(EJavaStorage, EInfo, "CJavaRegistry::NewLC");
CJavaRegistry* self = new(ELeave) CJavaRegistry();
CleanupStack::PushL(self);
@@ -96,7 +94,7 @@
JELOG2(EJavaStorage);
if (0 == aUid.iUid)
{
- WLOG(EJavaStorage,
+ ILOG(EJavaStorage,
"Can't find entry for uid 0, returning NULL.");
return NULL;
}
@@ -106,7 +104,7 @@
if (writableEntry == NULL)
{
- WLOG(EJavaStorage,
+ ILOG(EJavaStorage,
"Can't find entry for the given uid, returning NULL.");
return NULL;
}
@@ -124,7 +122,7 @@
regEntry = new(ELeave)
CJavaRegistryPackageEntry(writablePackageEntry);
// pointer ownership passed over
- LOG(EJavaStorage, EInfo, "PackageEntry created");
+ ILOG(EJavaStorage, "PackageEntry created");
}
else if (EGeneralApplication <= entryType)
{
@@ -134,7 +132,7 @@
regEntry = new(ELeave)
CJavaRegistryApplicationEntry(writableAppEntry);
// pointer ownership passed over
- LOG(EJavaStorage, EInfo, "ApplicationEntry created");
+ ILOG(EJavaStorage, "ApplicationEntry created");
}
else
{
--- a/javamanager/javaregistry/client/src/javaregistrypackageentry.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/client/src/javaregistrypackageentry.cpp Tue May 11 16:07:20 2010 +0300
@@ -103,7 +103,7 @@
if (writeableEntry == NULL)
{
- WLOG(EJavaStorage,
+ ILOG(EJavaStorage,
"Can't find entry for the given uid, returning NULL.");
return NULL;
}
@@ -119,14 +119,14 @@
entry
= new(ELeave) CJavaRegistryPackageEntry(
(CWriteableJavaRegistryPackageEntry*) writeableEntry);
- LOG(EJavaStorage, EInfo, "PackageEntry created");
+ ILOG(EJavaStorage, "PackageEntry created");
}
else if (EGeneralApplication <= entryType)
{
entry
= new(ELeave) CJavaRegistryApplicationEntry
((CWriteableJavaRegistryApplicationEntry*) writeableEntry);
- LOG(EJavaStorage, EInfo, "ApplicationEntry created");
+ ILOG(EJavaStorage, "ApplicationEntry created");
}
else
{
@@ -167,14 +167,14 @@
entry
= new(ELeave) CJavaRegistryPackageEntry(
(CWriteableJavaRegistryPackageEntry*) writeableEntry);
- LOG(EJavaStorage, EInfo, "PackageEntry created");
+ ILOG(EJavaStorage, "PackageEntry created");
}
else if (EGeneralApplication <= entryType)
{
entry
= new(ELeave) CJavaRegistryApplicationEntry
((CWriteableJavaRegistryApplicationEntry*) writeableEntry);
- LOG(EJavaStorage, EInfo, "ApplicationEntry created");
+ ILOG(EJavaStorage, "ApplicationEntry created");
}
else
{
--- a/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp Tue May 11 16:07:20 2010 +0300
@@ -517,7 +517,7 @@
{
if ((*iter).size() > 0)
{
- string decoded = JavaCommonUtils::base64decode((*iter));
+ string decoded = (*iter);
HBufC8* decodedBuf = HBufC8::New(decoded.size());
TPtr8 decodedBufPtr(decodedBuf->Des());
--- a/javamanager/javaregistry/javasizehelper/client/build/javasizehelperclient_0x2002DCD1.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/javasizehelper/client/build/javasizehelperclient_0x2002DCD1.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javaregistry/javasizehelper/server/build/javasizehelperserver_0x2002DCD2.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/javasizehelper/server/build/javasizehelperserver_0x2002DCD2.mmp Tue May 11 16:07:20 2010 +0300
@@ -45,7 +45,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -87,6 +86,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javamanager/javaregistry/legacy/server/inc/javaregconverter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/legacy/server/inc/javaregconverter.h Tue May 11 16:07:20 2010 +0300
@@ -209,7 +209,7 @@
* @param aCertChains [out] The method converts the unicode descriptors
* into this RPointerArray<HBufC>.
*/
- static void JavaRegConverter::GetUnicodeDescriptorsL(
+ static void GetUnicodeDescriptorsL(
const TDesC& aValue,
RPointerArray<HBufC>& aDescriptors);
/**
@@ -224,7 +224,7 @@
* @param aDes [out] Descriptor parameter, storing, and the returning
* the certificate chains.
*/
- static void JavaRegConverter::StoreUnicodeDescriptorsL(
+ static void StoreUnicodeDescriptorsL(
const RPointerArray<HBufC>& aValue,
HBufC*& aDes);
};
--- a/javamanager/javaregistry/legacy/server/inc/javaregserver.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/legacy/server/inc/javaregserver.h Tue May 11 16:07:20 2010 +0300
@@ -95,7 +95,7 @@
* @param aUid uid of the required entry
* @param[out] aProperties entry are read in this parameter
*/
- void CJavaRegServer::GetEntryL(
+ void GetEntryL(
TUid aUid,
CJavaPropertyArray*& aProperties, TBool aAllEntries = EFalse);
--- a/javamanager/javaregistry/legacy/server/src/javaregconverter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/legacy/server/src/javaregconverter.cpp Tue May 11 16:07:20 2010 +0300
@@ -21,6 +21,7 @@
#include <appversion.h>
#include "javaregconverter.h"
#include "javaregproperty.h"
+#include "javasymbianoslayer.h"
#include "logger.h"
using namespace Java::Manager::Registry;
@@ -262,6 +263,7 @@
const TDesC& aValue,
RPointerArray<HBufC>& aDescriptors)
{
+ CleanupResetAndDestroyPushL(aDescriptors); // If method leaves this will clean leaked memory
TInt32 count;
HBufC8* buf = HBufC8::NewLC(aValue.Length());
@@ -283,6 +285,7 @@
CleanupStack::PopAndDestroy(&stream);
CleanupStack::PopAndDestroy(buf);
+ CleanupStack::Pop(&aDescriptors);
}
// ---------------------------------------------------------------------------
--- a/javamanager/javaregistry/legacy/server/src/javaregstore.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javaregistry/legacy/server/src/javaregstore.cpp Tue May 11 16:07:20 2010 +0300
@@ -17,7 +17,7 @@
#include <s32file.h>
-
+#include <memory>
#include "driveutilities.h"
#include "javaattributes.h"
#include "javacommonutils.h"
--- a/javamanager/javasettings/appmngrplugin/inc/appmngr2midletsettingscontainer.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javasettings/appmngrplugin/inc/appmngr2midletsettingscontainer.h Tue May 11 16:07:20 2010 +0300
@@ -44,8 +44,7 @@
/**
* C++ constructor.
*/
- CAppMngr2MidletSettingsContainer::CAppMngr2MidletSettingsContainer(
- CAppMngr2MidletSettingsView& aView);
+ CAppMngr2MidletSettingsContainer(CAppMngr2MidletSettingsView& aView);
/**
* EPOC default constructor.
--- a/javamanager/javasettings/appmngrplugin/src/appmngr2midletruntime.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/javasettings/appmngrplugin/src/appmngr2midletruntime.cpp Tue May 11 16:07:20 2010 +0300
@@ -205,7 +205,7 @@
//CleanupStack::PushL(entry);
// Entry ownership is taken.
- TRAP_IGNORE(GetInstalledAppL(aApps, aFsSession, entry));
+ GetInstalledAppL(aApps, aFsSession, entry);
//CleanupStack::Pop(aEntry);
}
--- a/javamanager/preinstaller/build/javapreinstaller_0x2002DCC6.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javamanager/preinstaller/build/javapreinstaller_0x2002DCC6.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/installer/starterdll/build/javainstallerstarter_0x2002DCB5.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/installer/starterdll/build/javainstallerstarter_0x2002DCB5.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -81,6 +80,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/installer/starterdll/src/main.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/installer/starterdll/src/main.cpp Tue May 11 16:07:20 2010 +0300
@@ -361,10 +361,21 @@
}
#ifdef RD_JAVA_INSTALLERUI_ENABLED
+#if 0 // Disable 10.1 JavaInstallerUi
+//#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ jvm->appendSystemProperty(
+ L"-Dcom.nokia.mj.impl.installer.ui="
+ L"com.nokia.mj.impl.installer.ui.eswt2.InstallerUiEswt");
+ // Replace RuntimeUi with installer specific implementation.
+ jvm->appendSystemProperty(
+ L"-Dcom.nokia.mj.impl.rt.ui="
+ L"com.nokia.mj.impl.installer.ui.eswt2.InstallerRuntimeUi");
+#else
jvm->appendSystemProperty(
L"-Dcom.nokia.mj.impl.installer.ui="
L"com.nokia.mj.impl.installer.ui.eswt.InstallerUiEswt");
-#endif
+#endif // RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#endif // RD_JAVA_INSTALLERUI_ENABLED
std::wstring extendedBootClassPath;
// This call is platform dependent.
--- a/javaruntimes/installer/starterexe/build/javainstaller_0x2001843A.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/installer/starterexe/build/javainstaller_0x2001843A.mmp Tue May 11 16:07:20 2010 +0300
@@ -46,7 +46,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/jvmargmodifier/default/build/javajvmargsmodifier_0x2002DCB8.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/jvmargmodifier/default/build/javajvmargsmodifier_0x2002DCB8.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -80,6 +79,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/jvmargmodifier/file/build/javajvmargsmodifierfile_0x2002DCB9.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/jvmargmodifier/file/build/javajvmargsmodifierfile_0x2002DCB9.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/midp/runtime/build/javamidpruntime_0x2002DCBF.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/build/javamidpruntime_0x2002DCBF.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -95,6 +94,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/midp/runtime/javasrc.cdc/com/nokia/mj/impl/rt/main/ApplicationInfoImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc.cdc/com/nokia/mj/impl/rt/main/ApplicationInfoImpl.java Tue May 11 16:07:20 2010 +0300
@@ -23,11 +23,8 @@
import com.nokia.mj.impl.rt.support.ApplicationInfo;
/**
- * A Main runtime specific implemetation of ApplicationInfo class of the
+ * A Main runtime specific implementation of ApplicationInfo class of the
* runtime support API.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class ApplicationInfoImpl extends ApplicationInfo
--- a/javaruntimes/midp/runtime/javasrc.cdc/com/nokia/mj/impl/rt/main/ApplicationUtilsImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc.cdc/com/nokia/mj/impl/rt/main/ApplicationUtilsImpl.java Tue May 11 16:07:20 2010 +0300
@@ -29,11 +29,8 @@
/**
- * A Main runtime specific implemetation of ApplicationUtils class of the
+ * A Main runtime specific implementation of ApplicationUtils class of the
* runtime support API.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class ApplicationUtilsImpl extends ApplicationUtils
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/ApplicationInfoImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/ApplicationInfoImpl.java Tue May 11 16:07:20 2010 +0300
@@ -21,11 +21,8 @@
import com.nokia.mj.impl.rt.support.ApplicationInfo;
/**
- * A MIDP runtime specific implemetation of ApplicationInfo class of the
+ * A MIDP runtime specific implementation of ApplicationInfo class of the
* runtime support API.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class ApplicationInfoImpl extends ApplicationInfo
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/ApplicationUtilsImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/ApplicationUtilsImpl.java Tue May 11 16:07:20 2010 +0300
@@ -29,11 +29,8 @@
/**
- * A MIDP runtime specific implemetation of ApplicationUtils class of the
+ * A MIDP runtime specific implementation of ApplicationUtils class of the
* runtime support API.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class ApplicationUtilsImpl extends ApplicationUtils
@@ -49,7 +46,14 @@
*/
public static void doShutdownImpl()
{
- ((ApplicationUtilsImpl)sInstance).doShutdown();
+ try
+ {
+ ((ApplicationUtilsImpl)sInstance).doShutdown();
+ }
+ catch (Throwable t)
+ {
+ Log.logE("Error in doShutdownImpl: " , t);
+ }
}
public static void setStandAloneMode()
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/DrmUtil.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/DrmUtil.java Tue May 11 16:07:20 2010 +0300
@@ -18,10 +18,7 @@
package com.nokia.mj.impl.rt.midp;
/**
- * A utility class for consuming DTM rights.
- *
- * @author Nokia Corporation
- * @version $Rev$
+ * A utility class for consuming DRM rights.
*/
final class DrmUtil
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/LifeCycleTask.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/LifeCycleTask.java Tue May 11 16:07:20 2010 +0300
@@ -23,9 +23,6 @@
/**
* A class to be used to state change request to the state machine of the
* MIDP runtime life cycle.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
class LifeCycleTask extends Task
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Log.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Log.java Tue May 11 16:07:20 2010 +0300
@@ -21,9 +21,6 @@
/**
* A utility class for logging.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
@@ -41,7 +38,7 @@
*/
public static void logI(String msg)
{
- Logger.ILOG(COMPONENT_ID, msg);
+ Logger.ILOG(COMPONENT_ID, Thread.currentThread().getName() + ": " +msg);
}
/**
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Main.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/Main.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
/**
* A Main entry class of the MIDP runtime.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public final class Main
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MainArgs.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MainArgs.java Tue May 11 16:07:20 2010 +0300
@@ -25,9 +25,6 @@
* MIDP runtime. It is assumed that the arguments are provided so that
* there is always a key starting with '-' available and after that the
* value. Keys without value are not supported.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public final class MainArgs
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MemoryLogger.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MemoryLogger.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* A class for storing the heap usage to a file after fixed time period.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class MemoryLogger extends Thread
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletApplicationBase.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletApplicationBase.java Tue May 11 16:07:20 2010 +0300
@@ -44,9 +44,6 @@
* MIDlet instance. During the construction of this class it will give a
* reference to this to the MIDP life cycle, which will store the refernce in
* order to delegate calls to MIDlet.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public abstract class MidletApplicationBase
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletInfo.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletInfo.java Tue May 11 16:07:20 2010 +0300
@@ -28,9 +28,6 @@
* A class for caching important MIDlet specific data. This data
* is used mostly to serve the ApplicationInfo APIs, but to some extent
* this data is used by the life cycle.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class MidletInfo
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java Tue May 11 16:07:20 2010 +0300
@@ -80,9 +80,6 @@
* that will fail if any of the started Java threads dont stop as a result of
* shut down notifications. That is considered a failure in the shut down phase
* and the Java Captain will terminate forcefully the process.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class MidletLifeCycle
{
@@ -100,8 +97,7 @@
private static final int RESUMING = 0x100;
/**
- * A singleton instance of the life cycle. It is singleton for provoding
- * easy access to all other classes of the MIDP runtime.
+ * A singleton instance of the life cycle.
*/
private static MidletLifeCycle mInstance = new MidletLifeCycle();
@@ -251,11 +247,6 @@
{
mRuntimeErrDialog.showDialog();
}
- if (Log.mOn) Log.logI("Sending close indication to runtime starter.");
- _closeInd(mNativeRuntimeStarterHandle);
-
- if (Log.mOn) Log.logI("Sending shutdown notifications to listeners.");
- ApplicationUtilsImpl.doShutdownImpl();
if (!mStandAlone)
{
@@ -267,7 +258,14 @@
mMidpcomms = null;
}
- if (Log.mOn) Log.logI("Short pause before closing dispatchers.");
+ if (Log.mOn) Log.logI("Sending shutdown notifications to listeners.");
+ ApplicationUtilsImpl.doShutdownImpl();
+
+ if (Log.mOn) Log.logI("Sending close indication to runtime starter.");
+ _closeInd(mNativeRuntimeStarterHandle);
+
+
+ if (Log.mOn) Log.logI("Short pause before closing LegacySupport.");
try
{
Thread.sleep(200);
@@ -276,7 +274,7 @@
{
}
- if (Log.mOn) Log.logI("Closing dispatchers.");
+ if (Log.mOn) Log.logI("Closing LegacySupport.");
LegacySupport.close();
// Setting state to closed.
@@ -602,7 +600,7 @@
/**
* Handles the start request task. Allowed to be called only from
* startStateMachine() method. The only intention of this method is
- * to diminish the switch case clause in the diminish startStateMachine()
+ * to diminish the switch case clause in the startStateMachine()
* method.
* @param subTask The sub task provided by the task setter.
*/
@@ -610,8 +608,8 @@
{
if (Log.mOn) Log.logI("MidletLifeCycle.handleStartRequest(), subTask: "
+ subTask);
- if (mState == POST_INIT_DONE || (mState == PRE_INIT_DONE &&
- subTask == LifeCycleTask.PRE_WARM_START))
+ if ((mState == POST_INIT_DONE && subTask != LifeCycleTask.PRE_WARM_START) ||
+ (mState == PRE_INIT_DONE && subTask == LifeCycleTask.PRE_WARM_START))
{
if (subTask == LifeCycleTask.NORMAL_START)
{
@@ -781,6 +779,10 @@
// Check if there are add-on JSRs.
ExtensionUtil.handleExtensions();
}
+ else
+ {
+ ApplicationUtilsImpl.setStandAloneMode();
+ }
mTaskQueue = new TaskQueue();
@@ -919,10 +921,6 @@
_setUids(mMidletUid.toString(),
ApplicationInfoImpl.getMidletInfo().getSuiteUid().toString(),
mNativeRuntimeStarterHandle);
- // The Jvm doesn't know about MIDlet class path - need to set it.
- String classPath = ApplicationInfoImpl.getMidletInfo().getClassPath();
- if (Log.mOn) Log.logI(" Adding to classpath: "+classPath);
- JvmInternal.appendToClassPath(classPath);
}
private void doPostInit()
@@ -946,6 +944,11 @@
// API works ok, the setMidletInfo must be called before
// starting the UI.
CoreUi.createUi(mMidletUid, mBackGroundStart);
+
+ // The Jvm doesn't know about MIDlet class path - need to set it.
+ String classPath = ApplicationInfoImpl.getMidletInfo().getClassPath();
+ if (Log.mOn) Log.logI(" Adding to classpath: "+classPath);
+ JvmInternal.appendToClassPath(classPath);
}
if (!mStandAlone)
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidpComms.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidpComms.java Tue May 11 16:07:20 2010 +0300
@@ -27,9 +27,6 @@
/**
* A class for Comms connection towards Java Captain. This class is used to
* send and receive messages to/from Java Captain.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class MidpComms implements CommsListener
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/RuntimeErrorDialog.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/RuntimeErrorDialog.java Tue May 11 16:07:20 2010 +0300
@@ -40,9 +40,6 @@
* that may be shown in the error cases: Some thread doesn't catch exception,
* application start up fails by throwing some exception or DRM rights has been
* expired.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class RuntimeErrorDialog extends ErrorMessageBase
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/SaMidletInfoProvider.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/SaMidletInfoProvider.java Tue May 11 16:07:20 2010 +0300
@@ -36,9 +36,6 @@
/**
* A utility class for reading the standalone MIDlet specfic data from Jar and
* Jad file (if Jad provided).
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class SaMidletInfoProvider
{
@@ -91,7 +88,6 @@
try
{
InputStream is = midletInfo.getClass().getResourceAsStream("/META-INF/MANIFEST.MF");
- Log.logE("MIKKO is = " + is);
jarAttributes = ManifestReader.getAttributes(is);
is.close();
is = null;
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StartupException.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StartupException.java Tue May 11 16:07:20 2010 +0300
@@ -25,9 +25,6 @@
* an error or the MIDlet start up denied by the user (e.g. auto invocation).
* If it is denied by the user, then this exception is not considered as an
* error.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class StartupException extends RuntimeException
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StorageAccessor.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StorageAccessor.java Tue May 11 16:07:20 2010 +0300
@@ -34,9 +34,6 @@
* created in setMidletStartArguments() is reused in setMidletAttributes()
* method and then closed. If this scenario changes, then the close must
* be done also in setMidletStartArguments() method.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
final class StorageAccessor
{
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/utils/ExtensionUtil.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/utils/ExtensionUtil.java Tue May 11 16:07:20 2010 +0300
@@ -55,9 +55,6 @@
* The J9 JVM is not able to read the system properties from the odc
* file added to boot classpath. This class provides utility for reading
* the system properties from the odc files.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public final class ExtensionUtil
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java Tue May 11 16:07:20 2010 +0300
@@ -36,9 +36,6 @@
/**
* A class to be extended by the MIDlet applcation. See MIDP spec for
* further details.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public abstract class MIDlet
{
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDletStateChangeException.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDletStateChangeException.java Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,6 @@
* An exception for the MIDlet to inform that it doesn't want to do the state
* change requested by the life cycle.
* @see MIDP spec for further details.
- *
- * @author Nokia Corporation
- * @version $Rev$
*/
public class MIDletStateChangeException extends Exception
{
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MidletApplication.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MidletApplication.java Tue May 11 16:07:20 2010 +0300
@@ -24,8 +24,6 @@
* A package private class in javax.microedition.midlet package for
* accessing protected abstract methods of MIDlet class.
* @see com.nokia.mj.impl.rt.midp.MidletApplicationBase.
- * @author Nokia Corporation
- * @version $Rev$
*/
final class MidletApplication extends MidletApplicationBase
{
--- a/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -17,7 +17,13 @@
#include <memory>
-#include <schemehandler.h> // SchemeHandler
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <SchemeHandler.h>
+#else
+#include <schemehandler.h>
+#endif
+
#include <apgcli.h> // for RApaLsSession
#include <apacmdln.h>
#include <sstream>
--- a/javaruntimes/midp/runtimestarter/build/javamidpstarter_0x2002DCC0.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtimestarter/build/javamidpstarter_0x2002DCC0.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp Tue May 11 16:07:20 2010 +0300
@@ -23,6 +23,10 @@
#include <fstream>
#include <unistd.h>
+#ifndef __SYMBIAN32__
+#include <signal.h>
+#endif // __SYMBIAN32__
+
#include "midpruntimestarter.h"
#include "applicationinfosetter.h"
#include "runtimeexception.h"
@@ -59,7 +63,7 @@
MidpRuntimeStarter::MidpRuntimeStarter(): mMidletInfo(new MidletInfo()), // codescanner::nonleavenew
- mRuntimeState(Constructed)
+ mRuntimeState(Constructed), mShudownOk(false)
{
JELOG2(EJavaRuntime);
}
@@ -236,6 +240,14 @@
}
CoreUi::releaseUi(coreUiLoader);
+ // Close the thread that ensures the exit.
+ if (mExitMonitor.get())
+ {
+ mShudownOk = true;
+ LOG(EJavaRuntime, EInfo, "Notifying exit thread.");
+ mExitMonitor->notify();
+ }
+
return status;
}
@@ -489,14 +501,47 @@
}
}
+
+void* MidpRuntimeStarter::ensureExit(void* ptr)
+{
+ JELOG2(EUtils);
+#ifdef __SYMBIAN32__
+ RThread().SetPriority(EPriorityMore);
+#endif // __SYMBIAN32__
+ MidpRuntimeStarter* starter = reinterpret_cast<MidpRuntimeStarter*>(ptr);
+ LOG(EJavaRuntime, EInfo, "Starting to wait for the shutdown.");
+ const int waitTime = 1000; // 1 second.
+ starter->mExitMonitor->wait(waitTime);
+ LOG(EJavaRuntime, EInfo, "woke up from monitor.");
+ if (!starter->mShudownOk)
+ {
+ LOG(EJavaRuntime, EInfo, "Killing process.");
+#ifdef __SYMBIAN32__
+ RProcess().Kill(0);
+#else
+ kill(getpid(), SIGTERM);
+#endif // __SYMBIAN32__
+ }
+ LOG(EJavaRuntime, EInfo, "Clean exit.");
+ return 0;
+}
+
void MidpRuntimeStarter::closeRuntimeInd()
{
JELOG2(EJavaRuntime);
LOG(EJavaRuntime, EInfo, "Starter got close indication from JVM");
+
+ // Create a thread for ensure the exit of the process, if something goes
+ // wrong.
+ pthread_t tid;
+ mExitMonitor.reset(Monitor::createMonitor());
+ pthread_create(&tid, 0, ensureExit, this);
+
if (mMidletInfo->mPushStart)
{
closePush();
}
+
}
void MidpRuntimeStarter::setUids(const Uid& midletUid, const Uid& midletSuiteUid)
--- a/javaruntimes/midp/runtimestarter/src/midpruntimestarter.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/midp/runtimestarter/src/midpruntimestarter.h Tue May 11 16:07:20 2010 +0300
@@ -280,6 +280,13 @@
private: // Methods
/**
+ * A thread entry point for a thread that ensure that the runtime process
+ * will be exited if something goes wrong in shutdown sequence.
+ * @param ptr A pointer to MidpRuntimeStarter.
+ */
+ static void* ensureExit(void* ptr);
+
+ /**
* Parses the arguments provided by Java Captain when creating the
* process. The argument interpretations are stored into a member variable
* mMidletInfo for easy future access. Any Unknown argument
@@ -445,6 +452,11 @@
std::auto_ptr<java::util::Monitor> mMonitor;
/**
+ * A lock for exit case.
+ */
+ std::auto_ptr<java::util::Monitor> mExitMonitor;
+
+ /**
* A library loader for push case.
*/
std::auto_ptr<java::util::DynamicLibLoader> mPushLib;
@@ -454,6 +466,11 @@
*/
std::wstring mPushAdditionalInfo;
+ /**
+ * Did the shutdown go ok.
+ */
+ bool mShudownOk;
+
};
} // end namespace runtime
--- a/javaruntimes/standalone/src/javastarterimpl.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/standalone/src/javastarterimpl.cpp Tue May 11 16:07:20 2010 +0300
@@ -233,7 +233,7 @@
#ifndef RD_JAVA_UI_QT
// In Java 2.x we are using legacy UI.
- mJvmStarter->appendSystemProperty(L"-Dcom.nokia.legacy.support=symbian");
+ mJvmStarter->appendSystemProperty(L"-Dcom.nokia.legacy.support=LegacySymbian");
#endif //RD_JAVA_HYBRID
int result = mJvmStarter->startJvm();
@@ -460,11 +460,6 @@
#ifdef __SYMBIAN32__
TUidToUid(RProcess().Type()[2], mAppUid);
LOG1(EJavaRuntime, EInfo, "PROCESS UID %S", mAppUid.toString().c_str());
-
-// TUid tuid = uidType[1];
- TUid tuid(TUid::Uid(0x10005902));
-// TUidToUid(tuid, mAppUid);
-// LOG1(EJavaRuntime, EInfo, "TEMP UID %S", mAppUid.toString().c_str());
#else // __SYMBIAN32__
// mAppUid = Uid(L"java_standalone");
--- a/javaruntimes/standalone/tsrc/build/javatest.pro Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/standalone/tsrc/build/javatest.pro Tue May 11 16:07:20 2010 +0300
@@ -15,7 +15,7 @@
#
TEMPLATE=app
-TARGET=javastandalone
+TARGET=javatest
CONFIG += omj no_icon stl
CONFIG -= qt
--- a/javaruntimes/starter/build/java_0x102033E6.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/starter/build/java_0x102033E6.mmp Tue May 11 16:07:20 2010 +0300
@@ -47,7 +47,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/starter/build/javamidp_installer.pkg Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/starter/build/javamidp_installer.pkg Tue May 11 16:07:20 2010 +0300
@@ -1,10 +1,11 @@
-; javamidp_installer.pkg generated by qmake at 2010-04-13T17:34:18
+; javamidp_installer.pkg generated by qmake at 2010-04-28T12:41:16
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
+
; SIS header: name, uid, version
#{"javamidp installer"},(0xA000D7CE),1,0,0
@@ -16,6 +17,8 @@
; Manual PKG pre-rules from PRO files
+pkg_depends_webkit
+pkg_depends_qt
; Default HW/platform dependencies
[0x101F7961],0,0,0,{"S60ProductID"}
[0x102032BE],0,0,0,{"S60ProductID"}
--- a/javaruntimes/starter/build/javamidp_template.pkg Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/starter/build/javamidp_template.pkg Tue May 11 16:07:20 2010 +0300
@@ -1,10 +1,11 @@
-; javamidp_template.pkg generated by qmake at 2010-04-13T17:34:18
+; javamidp_template.pkg generated by qmake at 2010-04-28T12:41:16
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
+
; SIS header: name, uid, version
#{"javamidp"},(0x102033E6),1,0,0
@@ -16,6 +17,8 @@
; Manual PKG pre-rules from PRO files
+pkg_depends_webkit
+pkg_depends_qt
; Default HW/platform dependencies
[0x101F7961],0,0,0,{"S60ProductID"}
[0x102032BE],0,0,0,{"S60ProductID"}
--- a/javaruntimes/starterutils/build/javaruntimestarterutils_0x2002DCCC.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/starterutils/build/javaruntimestarterutils_0x2002DCCC.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -91,6 +90,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javaruntimes/starterutils/src.s60/j9starters60.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javaruntimes/starterutils/src.s60/j9starters60.cpp Tue May 11 16:07:20 2010 +0300
@@ -192,7 +192,6 @@
mJvmArgs.push_back(stackSizeStr);
}
-// #define RD_JAVA_VM_EXT_ODC_FEATURE_IN_USE
void J9StarterS60::setInternalOdcFiles()
{
JELOG2(EJavaRuntime);
--- a/javatools/javasecuritycustomization/build/javasecuritycustomization_0x20028786.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javatools/javasecuritycustomization/build/javasecuritycustomization_0x20028786.mmp Tue May 11 16:07:20 2010 +0300
@@ -45,7 +45,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javatools/javasecuritycustomization/policyeditor/lib/readme.txt Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,4 @@
+Policyeditor is a tool for customizing jrt security policy. The tool needs some classes from jrt binaries.
+The required classes are generated when compiling jrt/javacommons/security component.
+This folder is the placeholder for the required jrt classes.
+
\ No newline at end of file
--- a/javatools/tckrunner/runner/build/tckrunner_0x2002DCE3.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javatools/tckrunner/runner/build/tckrunner_0x2002DCE3.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -78,6 +77,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javatools/tckrunner/starter/build/tckrunner_0x2002121E.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javatools/tckrunner/starter/build/tckrunner_0x2002121E.mmp Tue May 11 16:07:20 2010 +0300
@@ -46,7 +46,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -84,6 +83,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/amms_akn/build/build.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/amms_akn/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -52,6 +52,10 @@
com.nokia.amms.ModuleBase"/>
+ <target name="create.public.api.jar">
+ <omj.public.apis includes="javax/microedition/amms/**/*.class"/>
+ </target>
+
<target name="system.properties">
<properties>
audio.samplerates=8000 16000
--- a/javauis/amms_akn/build/javaamms_0x2002DC96.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/amms_akn/build/javaamms_0x2002DC96.mmp Tue May 11 16:07:20 2010 +0300
@@ -47,7 +47,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -223,6 +222,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/amms_akn/src_tuner/javasrc/com/symbian/midp/runtime/properties/Property_tuner_modulations.java Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements tuner.modulations property
-*
-*/
-
-package com.symbian.midp.runtime.properties;
-
-import com.symbian.midp.runtime.PropertyHandler;
-
-public final class Property_tuner_modulations
- implements PropertyHandler
-{
- public String getProperty()
- {
- return "fm";
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammsaudio3dcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for 3D audio controls
+*
+*/
+
+
+#ifndef CAMMSAUDIO3DCONTROLGROUP_H
+#define CAMMSAUDIO3DCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrolgroup.h"
+
+// CLASS DECLARATION
+
+/**
+ * Group for 3D audio controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSAudio3DControlGroup): public CAMMSControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudio3DControlGroup();
+
+protected: // New functions
+
+ /**
+ * Update the controls depending on commit mode
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ void UpdateL(TInt aCommit);
+
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ virtual void CommitL(TInt aCommit) = 0;
+
+public: // From MAMMSControlGroup
+ /**
+ * Sets the mode of the CommitControl.
+ *
+ * @param aMode commit mode
+ */
+ void SetModeL(TCommitMode aMode);
+
+ /**
+ * Commit all the controls in the group
+ * in immediate mode commits, in deferred mode marks what variables
+ * need to be commited later
+ */
+ void CommitGroupL();
+
+protected:
+ /**
+ * Constructor.
+ *
+ * @param aName The name of the corresponding amms control
+ * @param aControlType Special AMMS type of the Control
+ */
+ CAMMSAudio3DControlGroup(
+ const TDesC& aName,
+ TAMMSControlTypes aControlType = EAMMSBaseControl);
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+protected: // Data
+
+ // Commit mode
+ TCommitMode iCommitMode;
+
+private: // Data
+
+ // bit field of variables that have to be commited
+ // (used in CommitL())
+ TInt iCommit;
+};
+
+#endif // CAMMSAUDIO3DCONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammscommitcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for commit controls
+*
+*/
+
+
+#ifndef CAMMSCOMMITCONTROLGROUP_H
+#define CAMMSCOMMITCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsaudio3dcontrolgroup.h"
+#include "cammsmodulecontainer.h"
+#include "cammsmodule.h"
+
+// FORWARD DECLARATIONS
+class CAMMSModule;
+
+// CONSTANTS
+_LIT(KAMMSCommitControlClassName, ".amms.control.audio3d.CommitControl");
+_LIT(KAMMSCommitControl, "CommitControl");
+
+// CLASS DECLARATION
+/**
+ * Group for commit controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSCommitControlGroup): public CAMMSAudio3DControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSCommitControlGroup* NewLC(
+ CAMMSModule& aSpectator,
+ CAMMSModuleContainer& aSoundSource3Ds);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSCommitControlGroup();
+
+public: // New functions
+
+ /**
+ * Transfers all the pending parameters to the audio processing system
+ * for all ControlGroups in this controllable
+ */
+ void CommitAllControlsL();
+
+ /**
+ * Sets the mode of the CommitControl
+ *
+ * @param aDeferred deferred mode flag
+ */
+ void SetDeferredL(TBool aDeferred);
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ void CommitL(TInt aCommit);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSCommitControlGroup(
+ CAMMSModule& aSpectator,
+ CAMMSModuleContainer& aSoundSource3Ds);
+
+private: // Data
+ // Reference to spectator, owned by GlobalManager
+ CAMMSModule& iSpectator;
+
+ // Reference to sound source 3Ds, owned by GlobalManager
+ CAMMSModuleContainer& iSoundSource3Ds;
+
+};
+
+#endif // CAMMSCOMMITCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammsdistanceattenuationcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for distance attenuation controls
+*
+*/
+
+
+#ifndef CAMMSDISTANCEATTENUATIONCONTROLGROUP_H
+#define CAMMSDISTANCEATTENUATIONCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsaudio3dcontrolgroup.h"
+
+// CONSTANTS
+_LIT(KAMMSDistanceAttenuationClassName,
+ ".amms.control.audio3d.DistanceAttenuationControl");
+
+// FORWARD DECLARATIONS
+class CAMMSBaseDistanceAttenuationControl;
+
+// CLASS DECLARATION
+/**
+ * Group for distance attenuation controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSDistanceAttenuationControlGroup): public CAMMSAudio3DControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSDistanceAttenuationControlGroup* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSDistanceAttenuationControlGroup();
+
+public: // New functions
+
+ /**
+ * Returns the maximum distance. At the maximum distance, the gain does
+ * not decrease any more. The exact behavior of the gain at distances
+ * beyond the maximum distance depends on the value of muteAfterMax
+ *
+ * @return the maximum distance
+ */
+ TInt32 MaxDistance() const;
+
+ /**
+ * Returns the distance where the source is loudest.
+ *
+ * @return the minimum distance
+ */
+ TInt32 MinDistance() const;
+
+ /**
+ * Returns how the distance gain behaves for distances beyond the
+ * maximum distance.
+ *
+ * @return true if beyond the maximum distance the source is silent,
+ * or false if beyond the maximum distance the source's gain is held
+ * constant at the level at the maximum distance
+ */
+ TBool MuteAfterMax() const;
+
+ /**
+ * Returns the rolloff factor for the distance gain.
+ *
+ * @return the rolloff factor as an exponent specified in thousandths
+ */
+ TUint32 RolloffFactor() const;
+
+ /**
+ * Sets all the 3D audio distance attenuation parameters simultaneously
+ *
+ * @param aMinDistance the minimum distance, below which the
+ * distance gain is clipped to its maximum
+ * value of 1.0
+ * @param aMaxDistance the maximum distance, beyond which the
+ * distance gain does not decrease any more
+ * @param aMuteAfterMax a boolean determining how the distance
+ * gain behaves at distances greater than
+ * maxDistance
+ * @param aRolloffFactor the rolloff factor
+ */
+ void SetParametersL(TInt32 aMinDistance, TInt32 aMaxDistance,
+ TBool aMuteAfterMax, TUint32 aRolloffFactor);
+
+private: // New functions
+ /**
+ * Gets and casts a control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSBaseDistanceAttenuationControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ virtual void CommitL(TInt aCommit);
+
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSDistanceAttenuationControlGroup();
+
+private: // Data
+
+ class TVariables
+ {
+ public:
+
+ TInt32 iMinDistance;
+ TInt32 iMaxDistance;
+ TBool iMuteAfterMax;
+ TUint32 iRolloffFactor;
+ };
+
+ TVariables iCommited; // holder for variables after commit
+ TVariables iUncommited; // holder for variables before commit
+
+ enum TCommit { EDistance = 1 };
+};
+
+#endif // CAMMSDISTANCEATTENUATIONCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammsdopplercontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for Doppler controls
+*
+*/
+
+
+#ifndef CAMMSDOPPLERCONTROLGROUP_H
+#define CAMMSDOPPLERCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsaudio3dcontrolgroup.h"
+#include "ammsconstants.h"
+
+// FORWARD DECLARATIONS
+class CAMMSDopplerControl;
+
+// CONSTANTS
+_LIT(KAMMSDopplerControl, "DopplerControl");
+_LIT(KAMMSDopplerControlClassName, ".amms.control.audio3d.DopplerControl");
+
+// CLASS DECLARATION
+/**
+ * Group for Doppler controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSDopplerControlGroup): public CAMMSAudio3DControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSDopplerControlGroup* NewLC(
+ TAMMSControlTypes aControlType);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSDopplerControlGroup();
+
+public: // New functions
+ /**
+ * Returns the current velocity, used in calculations for the Doppler
+ * effect
+ *
+ * @param aVelocity the current velocity
+ */
+ void VelocityCartesianL(TInt aVelocity[ KAMMSVectorComponents ]);
+
+ /**
+ * Returns whether this Doppler effect is currently active.
+ *
+ * @return the enabled state of the control
+ */
+ TBool Enabled();
+
+ /**
+ * Specifies if this Doppler effect is active or ignored.
+ *
+ * @param aEnabled new enabled state
+ */
+ void SetEnabledL(TBool aEnabled);
+
+ /**
+ * Sets the velocity, used in calculations for the Doppler effect.
+ *
+ * @param aX the x component of the new velocity
+ * @param aY the y component of the new velocity
+ * @param aZ the z component of the new velocity
+ */
+ void SetVelocityCartesianL(TInt aX, TInt aY, TInt aZ);
+
+ /**
+ * Sets the velocity, used in calculations for the Doppler effect.
+ *
+ * @param aAzimuth the azimuth angle of the new velocity in degrees
+ * @param aElevation the elevation angle of the new velocity in degrees
+ * @param aRadius the magnitude of the new velocity
+ */
+ void SetVelocitySphericalL(TInt aAzimuth, TInt aElevation, TInt aRadius);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSDopplerControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ virtual void CommitL(TInt aCommit);
+
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSDopplerControlGroup(TAMMSControlTypes aControlType);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ class TVariables
+ {
+ public:
+
+ TInt iVelocity[ KAMMSVectorComponents ];
+ TBool iEnabled;
+ };
+
+ TVariables iCommited; // holder for variables after commit
+ TVariables iUncommited; // holder for variables before commit
+
+ enum TCommit { EEnabled = 1, EVelocity = 2 };
+};
+
+#endif // CAMMSDOPPLERCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammslocationcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for location controls
+*
+*/
+
+
+#ifndef CAMMSLOCATIONCONTROLGROUP_H
+#define CAMMSLOCATIONCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsaudio3dcontrolgroup.h"
+#include "ammsconstants.h"
+
+// CONSTANTS
+_LIT(KAMMSLocationControl, "LocationControl");
+_LIT(KAMMSLocationControlClassName, ".amms.control.audio3d.LocationControl");
+
+// FORWARD DECLARATIONS
+class CAMMSLocationControl;
+
+// CLASS DECLARATION
+/**
+ * Group for location controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSLocationControlGroup): public CAMMSAudio3DControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSLocationControlGroup* NewLC(
+ TAMMSControlTypes aControlType);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSLocationControlGroup();
+
+public: // New functions
+ /**
+ * Gets the coordinates of the current location
+ *
+ * @param aLocation the current location
+ */
+ void CartesianL(TInt aLocation[ KAMMSVectorComponents ]);
+
+ /**
+ * Moves the object to the new location
+ *
+ * @param aX the x component of the new location
+ * @param aY the y component of the new location
+ * @param aZ the z component of the new location
+ */
+ void SetCartesianL(TInt aX, TInt aY, TInt aZ);
+
+ /**
+ * Moves the object to the new location
+ *
+ * @param aAzimuth the azimuth angle of the new location in degrees
+ * @param aElevation the elevation angle of the new location in degrees
+ * @param aRadius the magnitude of the new location
+ */
+ void SetSphericalL(TInt aAzimuth, TInt aElevation, TInt aRadius);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSLocationControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ virtual void CommitL(TInt aCommit);
+
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSLocationControlGroup(TAMMSControlTypes aControlType);
+
+private: // Data
+
+ class TVariables
+ {
+ public:
+
+ TInt iLocation[ KAMMSVectorComponents ];
+ };
+
+ TVariables iCommited; // holder for variables after commit
+ TVariables iUncommited; // holder for variables before commit
+
+ enum TCommit { ELocation = 1 };
+};
+
+#endif // CAMMSLOCATIONCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/inc/cammsorientationcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for orientation controls
+*
+*/
+
+
+#ifndef CAMMSORIENTATIONCONTROLGROUP_H
+#define CAMMSORIENTATIONCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsaudio3dcontrolgroup.h"
+#include "ammsconstants.h"
+
+// CONSTANTS
+_LIT(KAMMSOrientationControlClassName,
+ ".amms.control.audio3d.OrientationControl");
+
+// FORWARD DECLARATIONS
+class CAMMSOrientationControl;
+
+
+// CLASS DECLARATION
+/**
+ * Group for location controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSOrientationControlGroup): public CAMMSAudio3DControlGroup
+{
+private:
+
+ class TVariables
+ {
+ public:
+
+ TInt iOrientation[ KAMMSTwoVectorComponents ];
+ TBool iOrientationVector;
+ };
+
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSOrientationControlGroup* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSOrientationControlGroup();
+
+public: // New functions
+ /**
+ * Gets the orientation of the object using two vectors.
+ *
+ * Sets the location using cartesian right-handed coordinates that are
+ * relative to the origin. The measures are defined in units specified
+ * by GlobalManager.getUnitsPerMeter().
+ * Referenced memory of the arguments will contain the coordinate values.
+ *
+ * @param aOrientation the current orientation
+ */
+ void OrientationVectorsL(TInt aOrientation[ KAMMSTwoVectorComponents ]);
+
+ /**
+ * Turns the object to the new orientation.
+ *
+ * The new orientation is given using rotation angles. A zero vector
+ * corresponds to the orientation pointing directly towards the negative
+ * Z-axis. Orientation is applied in the following order: heading,
+ * pitch, and roll. Therefore, notice that heading turns the X-axis and
+ * therefore affects the pitch, and similarly heading and pitch turn the
+ * Z-axis and therefore affect the roll.
+ *
+ * @param aHeading The rotation around the Y-axis in degrees.
+ * @param aPitch The rotation around the X-axis in degrees.
+ * @param aRoll The rotation around the Z-axis in degrees.
+ */
+ void SetOrientationL(TInt aHeading, TInt aPitch, TInt aRoll);
+
+ /**
+ * Turns the object to the new orientation.
+ *
+ * The orientation is specified using two vectors, one specifying the
+ * direction of the front vector of the object in world coordinates, and
+ * another specifying the "above" vector of the object. The right and up
+ * vectors of the object are calculated by first normalizing both source
+ * vectors, then calculating the right vector as the cross product of the
+ * "above" vector and the front vector, and the up vector as a cross
+ * product of the front and right vectors.
+ *
+ * Because both vectors are normalized, they may be of any length.
+ *
+ * @param aFrontVector X, Y and Z value of Front vector
+ * @param aAboveVector X, Y and Z value of Above vector
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - In case any of the parameters is a zero vector
+ * or they are parallel to each other or any of the parameters' lenghts
+ * is not three. In that case, the orientation of the object remains
+ * unchanged.
+ */
+ void SetOrientationVectorsL(
+ TInt aFrontVector[ KAMMSVectorComponents ],
+ TInt aAboveVector[ KAMMSVectorComponents ]);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSOrientationControl* TypeSafeControl(TInt aIndex) const;
+
+ /**
+ * Creates "up" vector by applying cross product operation to
+ * "front" and "above" vectors.
+ *
+ * @param aVariables Used orientation parameters.
+ * @param aUpVector Returned "up" vector.
+ */
+ static void GetUpVectorL(TVariables& aVariables,
+ TInt aUpVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Converts orientation from vectors to angles.
+ *
+ * NOTE: THIS FUNCTION SHOULD BE REMOVED WHEN EFFECT API FIX IS AVAILABLE!
+ * (it is possible to set an orientation as vectors).
+ *
+ * @param aVariables Used orientation parameters.
+ * @param aSphericalOrientation Result vector.
+ */
+ static void ConvertOrientationToAnglesL(
+ TVariables& aVariables,
+ TInt aSphericalOrientation[ KAMMSVectorComponents ]);
+
+ /**
+ * Calculates how much the given vector should be rotated around the
+ * given rotation vector so that the value of the specified vector
+ * component is maximized.
+ *
+ * NOTE: THIS FUNCTION SHOULD BE REMOVED WHEN EFFECT API FIX IS AVAILABLE!
+ *
+ * @param aVector Vector thats components are investigated.
+ * @param aRotationAxelVector Vector for the rotation axel.
+ * @param aMaximizeComponent Index of the vector component to be
+ * maximized.
+ * @return An angle that the vector should be rotated.
+ */
+ static TReal CalculatePartialRotationL(
+ TReal aVector[ KAMMSVectorComponents ],
+ TReal aRotationAxelVector[ KAMMSVectorComponents ],
+ TInt aMaximizeComponent);
+
+ /**
+ * Checks whether two given vectors are similar according to the given
+ * maximum error percentage. The function compares each component in
+ * aA to the corresponding component in aB.
+ *
+ * NOTE: THIS FUNCTION SHOULD BE REMOVED WHEN EFFECT API FIX IS AVAILABLE!
+ *
+ * @param aA A vector
+ * @param aB A vector
+ * @param aMaxComponentErrorPercentage Maximum error percentage between
+ * a component in aA and the corresponding component in aB
+ * @return ETrue if difference between each component pair is lower
+ * than the given error, else ETrue is returned
+ */
+ static TBool AreVectorsSimilar(TReal aA[ KAMMSVectorComponents ],
+ TReal aB[ KAMMSVectorComponents ],
+ TInt aMaxComponentErrorPercentage);
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Transfers all the pending parameters to the audio processing system.
+ *
+ * @param aCommit variable id that need to be commited
+ */
+ virtual void CommitL(TInt aCommit);
+
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSOrientationControlGroup();
+
+private: // Data
+
+ enum TOrientationIndex { EFrontX = 0,
+ EFrontY = 1,
+ EFrontZ = 2,
+ EAboveX = 3,
+ EAboveY = 4,
+ EAboveZ = 5,
+ EHeading = 0,
+ EPitch = 1,
+ ERoll = 2 };
+
+ TVariables iCommited; // holder for variables after commit
+ TVariables iUncommited; // holder for variables before commit
+
+ enum TCommit { EOrientation = 1 };
+};
+
+#endif // CAMMSORIENTATIONCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammsaudio3dcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for 3D audio controls
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsaudio3dcontrolgroup.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSAudio3DControlGroup::~CAMMSAudio3DControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudio3DControlGroup::UpdateL
+// Update the controls depending on commit mode
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudio3DControlGroup::UpdateL(TInt aCommit)
+{
+ // Add new variables that have to be committed to member variable.
+ iCommit |= aCommit;
+
+ if (iCommitMode == EImmediate)
+ {
+ // Commit new values, and remove them from the member variable.
+ CommitL(aCommit);
+ iCommit &= ~aCommit;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudio3DControlGroup::SetModeL
+// Sets the mode of the CommitControl.
+// Can be called only from CAMMSCommitControlGroup
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudio3DControlGroup::SetModeL(TCommitMode aMode)
+{
+ // When switching back from the deferred mode to the immediate mode
+ // (setDeferred(false)) all the pending parameters from the buffer are
+ // transmitted to the audio processing system automatically.
+ if (aMode == EImmediate)
+ {
+ CommitL(iCommit);
+ iCommit = 0;
+ }
+ iCommitMode = aMode;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudio3DControlGroup::CommitGroupL
+// Commits all the controls in the group
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudio3DControlGroup::CommitGroupL()
+{
+ // In case the mode is changed to EImmediate in the middle of commit process,
+ // SetModeL method is implemented so that it takes care of all pending
+ // parameter committing.
+ if (iCommitMode == EDeferred)
+ {
+ CommitL(iCommit);
+ iCommit = 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudio3DControlGroup::CAMMSAudio3DControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSAudio3DControlGroup::CAMMSAudio3DControlGroup(
+ const TDesC& aName,
+ TAMMSControlTypes aControlType) :
+ CAMMSControlGroup(aName, aControlType)
+{
+ // default values
+ iCommitMode = EImmediate;
+ iCommit = 0;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudio3DControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSAudio3DControlGroup::ConstructL()
+{
+ CAMMSControlGroup::ConstructL();
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammscommitcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for commit controls
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include "cammscommitcontrolgroup.h"
+#include "cammsmodule.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSCommitControlGroup* CAMMSCommitControlGroup::NewLC(
+ CAMMSModule& aSpectator,
+ CAMMSModuleContainer& aSoundSource3Ds)
+{
+ CAMMSCommitControlGroup* self = new(ELeave) CAMMSCommitControlGroup(
+ aSpectator,
+ aSoundSource3Ds);
+
+ CleanupStack::PushL(self);
+ // calls base class ConstructL
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSCommitControlGroup::~CAMMSCommitControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::CommitAllControlsL
+// Transfers all the pending parameters to the audio processing system
+// for all ControlGroups in this controllable
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSCommitControlGroup::CommitAllControlsL()
+{
+ TInt groupAmount = 0;
+
+ // Go through every module in SoundSource3D
+ TInt moduleAmount = iSoundSource3Ds.Count();
+ for (TInt i = 0; i < moduleAmount; i++)
+ {
+ CAMMSModule* module = iSoundSource3Ds.At(i);
+
+ // Go through every ControlGroup in Module
+ groupAmount = module->Count();
+ for (TInt j = 0; j < groupAmount; j++)
+ {
+ MAMMSControlGroup* group = module->At(j);
+ group->CommitGroupL();
+ }
+ }
+
+ // And finally go through every ControlGroup in Spectator
+ groupAmount = iSpectator.Count();
+ for (TInt i = 0; i < groupAmount; i++)
+ {
+ MAMMSControlGroup* group = iSpectator.At(i);
+ group->CommitGroupL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::SetDeferredL
+// Sets the mode of the CommitControl
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSCommitControlGroup::SetDeferredL(TBool aDeferred)
+{
+ TInt groupAmount = 0;
+ TCommitMode mode = (aDeferred ? EDeferred : EImmediate);
+
+ // Go through every module in SoundSource3D
+ TInt moduleAmount = iSoundSource3Ds.Count();
+ for (TInt i = 0; i < moduleAmount; i++)
+ {
+ CAMMSModule* module = iSoundSource3Ds.At(i);
+
+ // Go through every ControlGroup in Module
+ groupAmount = module->Count();
+ for (TInt j = 0; j < groupAmount; j++)
+ {
+ MAMMSControlGroup* group = module->At(j);
+ group->SetModeL(mode);
+ }
+ }
+
+ // And finally go through every ControlGroup in Spectator
+ groupAmount = iSpectator.Count();
+ for (TInt i = 0; i < groupAmount; i++)
+ {
+ MAMMSControlGroup* group = iSpectator.At(i);
+ group->SetModeL(mode);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSCommitControlGroup::ClassName()
+{
+ return KAMMSCommitControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::CommitL
+// Transfers all the pending parameters to the audio processing system.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSCommitControlGroup::CommitL(TInt /*aCommit*/)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCommitControlGroup::CAMMSCommitControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSCommitControlGroup::CAMMSCommitControlGroup(
+ CAMMSModule& aSpectator,
+ CAMMSModuleContainer& aSoundSource3Ds):
+// CommitControlGroup has no associated amms controls therefore
+// the name passed as a parameter to the constructor is KNullDesC
+// CHANGED for now, passing actual name here even no associated Controls.
+ CAMMSAudio3DControlGroup(KAMMSCommitControl),
+ iSpectator(aSpectator),
+ iSoundSource3Ds(aSoundSource3Ds)
+{
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammsdistanceattenuationcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for distance attenuation controls
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cammsdistanceattenuationcontrolgroup.h"
+#include "cammsbasedistanceattenuationcontrol.h"
+
+// CONSTANTS
+static const TInt KAMMSMinDistance = 1000;
+static const TInt KAMMSRolloffFactor = 1000;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSDistanceAttenuationControlGroup*
+CAMMSDistanceAttenuationControlGroup::NewLC()
+{
+ CAMMSDistanceAttenuationControlGroup* self =
+ new(ELeave) CAMMSDistanceAttenuationControlGroup;
+
+ CleanupStack::PushL(self);
+ // calls base class ConstructL
+ self->ConstructL();
+
+ return self;
+}
+
+//Destructor
+CAMMSDistanceAttenuationControlGroup::~CAMMSDistanceAttenuationControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::MaxDistance
+// Returns the maximum distance.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt32 CAMMSDistanceAttenuationControlGroup::MaxDistance() const
+{
+ return iCommited.iMaxDistance;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::MinDistance
+// Returns the distance where the source is loudest.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt32 CAMMSDistanceAttenuationControlGroup::MinDistance() const
+{
+ return iCommited.iMinDistance;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::MuteAfterMax
+// Returns how the distance gain behaves for distances beyond
+// the maximum distance.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TBool CAMMSDistanceAttenuationControlGroup::MuteAfterMax() const
+{
+ return iCommited.iMuteAfterMax;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::RolloffFactor
+// Returns the rolloff factor for the distance gain.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TUint32 CAMMSDistanceAttenuationControlGroup::RolloffFactor() const
+{
+ return iCommited.iRolloffFactor;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::SetParametersL
+// Sets all the 3D audio distance attenuation parameters simultaneously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDistanceAttenuationControlGroup::SetParametersL(
+ TInt32 aMinDistance,
+ TInt32 aMaxDistance,
+ TBool aMuteAfterMax,
+ TUint32 aRolloffFactor)
+{
+ // temporary values, moved to the commited variables in CommitL() method
+ iUncommited.iMinDistance = aMinDistance;
+ iUncommited.iMaxDistance = aMaxDistance;
+ iUncommited.iMuteAfterMax = aMuteAfterMax;
+ iUncommited.iRolloffFactor = aRolloffFactor;
+
+ UpdateL(EDistance);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::TypeSafeControl
+// Get and cast a control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSBaseDistanceAttenuationControl*
+CAMMSDistanceAttenuationControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSBaseDistanceAttenuationControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSDistanceAttenuationControlGroup::ClassName()
+{
+ return KAMMSDistanceAttenuationClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::CommitL
+// Transfers all the pending parameters to the audio processing system.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDistanceAttenuationControlGroup::CommitL(TInt aCommit)
+{
+ if (aCommit & EDistance)
+ {
+ TInt controls = ControlCount();
+ for (TInt i = 0; i < controls; i++)
+ {
+ TypeSafeControl(i)->SetParametersL(
+ iUncommited.iMinDistance,
+ iUncommited.iMaxDistance,
+ iUncommited.iMuteAfterMax,
+ iUncommited.iRolloffFactor);
+ }
+ iCommited = iUncommited;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDistanceAttenuationControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSAudio3DControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSBaseDistanceAttenuationControl* control =
+ static_cast<CAMMSBaseDistanceAttenuationControl*>(aControl);
+
+ // set the current parameters
+ control->SetParametersL(
+ iCommited.iMinDistance,
+ iCommited.iMaxDistance,
+ iCommited.iMuteAfterMax,
+ iCommited.iRolloffFactor);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControlGroup::CAMMSDistanceAttenuationControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSDistanceAttenuationControlGroup::CAMMSDistanceAttenuationControlGroup()
+ : CAMMSAudio3DControlGroup(KAMMSBaseDistanceAttenuationControl)
+{
+ iCommited.iMinDistance = KAMMSMinDistance;
+ iCommited.iMaxDistance = KMaxTInt;
+ iCommited.iMuteAfterMax = ETrue;
+ iCommited.iRolloffFactor = KAMMSRolloffFactor;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammsdopplercontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for Doppler controls
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cammsdopplercontrolgroup.h"
+#include "cammsdopplercontrol.h"
+#include "ammsutil.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSDopplerControlGroup* CAMMSDopplerControlGroup::NewLC(
+ TAMMSControlTypes aControlType)
+{
+ CAMMSDopplerControlGroup* self = new(ELeave) CAMMSDopplerControlGroup(
+ aControlType);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSDopplerControlGroup::~CAMMSDopplerControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::VelocityCartesianL
+// Returns the current velocity, used in calculations for the Doppler effect
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::VelocityCartesianL(
+ TInt aVelocity[ KAMMSVectorComponents ])
+{
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ aVelocity[ i ] = iCommited.iVelocity[ i ];
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::Enabled
+// Returns whether this Doppler effect is currently active.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TBool CAMMSDopplerControlGroup::Enabled()
+{
+ return iCommited.iEnabled;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::SetEnabledL
+// Specifies if this Doppler effect is active or ignored.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::SetEnabledL(TBool aEnabled)
+{
+ // If the DopplerControl was fetched from the Spectator,
+ // this method has no effect. So only disable the value for SoundSource3D.
+ if (aEnabled ||
+ (!aEnabled && iControlType == EAMMSSoundSource3DControl))
+ {
+ iUncommited.iEnabled = aEnabled;
+ UpdateL(EEnabled);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::SetVelocityCartesianL
+// Sets the velocity, used in calculations for the Doppler effect.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::SetVelocityCartesianL(
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+ iUncommited.iVelocity[ EComponentX ] = aX;
+ iUncommited.iVelocity[ EComponentY ] = aY;
+ iUncommited.iVelocity[ EComponentZ ] = aZ;
+
+ UpdateL(EVelocity);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::SetVelocitySphericalL
+// Sets the velocity, used in calculations for the Doppler effect.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::SetVelocitySphericalL(
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ TInt sphericalVector[] = { aAzimuth, aElevation, aRadius };
+
+ // Convert to cartesian.
+ AMMSUtil::FromSphericalToCartesianL(sphericalVector,
+ iUncommited.iVelocity);
+
+ UpdateL(EVelocity);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSDopplerControl*
+CAMMSDopplerControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSDopplerControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSDopplerControlGroup::ClassName()
+{
+ return KAMMSDopplerControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::CommitL
+// Transfers all the pending parameters to the audio processing system.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::CommitL(TInt aCommit)
+{
+ TInt controls = ControlCount();
+
+ // first commit enabled state
+ if (aCommit & EEnabled)
+ {
+ for (TInt i = 0; i < controls; i++)
+ {
+ CAMMSDopplerControl* control = TypeSafeControl(i);
+ control->SetEnabledL(iUncommited.iEnabled);
+ }
+ iCommited.iEnabled = iUncommited.iEnabled;
+ }
+
+ // then commit velocity
+ if (aCommit & EVelocity)
+ {
+ for (TInt i = 0; i < controls; i++)
+ {
+ CAMMSDopplerControl* control = TypeSafeControl(i);
+
+ control->SetVelocityCartesianL(
+ iUncommited.iVelocity[ EComponentX ],
+ iUncommited.iVelocity[ EComponentY ],
+ iUncommited.iVelocity[ EComponentZ ]);
+ }
+
+ // Change uncommited velocity to commited
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ iCommited.iVelocity[ i ] = iUncommited.iVelocity[ i ];
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSDopplerControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSAudio3DControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSDopplerControl* control =
+ static_cast<CAMMSDopplerControl*>(aControl);
+
+ // set the current parameters
+
+ control->SetVelocityCartesianL(
+ iCommited.iVelocity[ EComponentX ],
+ iCommited.iVelocity[ EComponentY ],
+ iCommited.iVelocity[ EComponentZ ]);
+
+ control->SetEnabledL(iCommited.iEnabled);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::CAMMSDopplerControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSDopplerControlGroup::CAMMSDopplerControlGroup(
+ TAMMSControlTypes aControlType):
+ CAMMSAudio3DControlGroup(KAMMSDopplerControl, aControlType)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+inline void CAMMSDopplerControlGroup::ConstructL()
+{
+ CAMMSAudio3DControlGroup::ConstructL();
+
+ // The default value for Spectator's DopplerControl is true
+ // (the default value for SoundSource3D's DopplerControl is false)
+ if (iControlType == EAMMSSpectatorControl)
+ {
+ SetEnabledL(ETrue);
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammslocationcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for location controls
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cammslocationcontrolgroup.h"
+#include "cammslocationcontrol.h"
+#include "ammsutil.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSLocationControlGroup* CAMMSLocationControlGroup::NewLC(
+ TAMMSControlTypes aControlType)
+{
+ CAMMSLocationControlGroup* self = new(ELeave) CAMMSLocationControlGroup(
+ aControlType);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+
+}
+
+// Destructor
+CAMMSLocationControlGroup::~CAMMSLocationControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::Cartesian
+// Gets the coordinates of the current location
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSLocationControlGroup::CartesianL(
+ TInt aLocation[ KAMMSVectorComponents ])
+{
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ aLocation[ i ] = iCommited.iLocation[ i ];
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::SetCartesianL
+// Moves the object to the new location
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSLocationControlGroup::SetCartesianL(TInt aX, TInt aY, TInt aZ)
+{
+ iUncommited.iLocation[ EComponentX ] = aX;
+ iUncommited.iLocation[ EComponentY ] = aY;
+ iUncommited.iLocation[ EComponentZ ] = aZ;
+
+ UpdateL(ELocation);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::SetSphericalL
+// Moves the object to the new location
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSLocationControlGroup::SetSphericalL(
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ __ASSERT_DEBUG(aRadius >= 0, User::Invariant());
+
+ TInt sphericalVector[] = { aAzimuth, aElevation, aRadius };
+
+ // Convert to cartesian.
+ AMMSUtil::FromSphericalToCartesianL(sphericalVector,
+ iUncommited.iLocation);
+
+ UpdateL(ELocation);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSLocationControl*
+CAMMSLocationControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSLocationControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSLocationControlGroup::ClassName()
+{
+ return KAMMSLocationControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::CommitL
+// Transfers all the pending parameters to the audio processing system.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSLocationControlGroup::CommitL(TInt aCommit)
+{
+ if (aCommit & ELocation)
+ {
+ TInt controls = ControlCount();
+ for (TInt i = 0; i < controls; i++)
+ {
+ CAMMSLocationControl* control = TypeSafeControl(i);
+
+ control->SetLocationCartesianL(
+ iUncommited.iLocation[ EComponentX ],
+ iUncommited.iLocation[ EComponentY ],
+ iUncommited.iLocation[ EComponentZ ]);
+ }
+
+ iCommited = iUncommited;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSLocationControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSAudio3DControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSLocationControl* control =
+ static_cast<CAMMSLocationControl*>(aControl);
+
+ // set the current parameters
+ control->SetLocationCartesianL(
+ iCommited.iLocation[ EComponentX ],
+ iCommited.iLocation[ EComponentY ],
+ iCommited.iLocation[ EComponentZ ]);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControlGroup::CAMMSLocationControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSLocationControlGroup::CAMMSLocationControlGroup(
+ TAMMSControlTypes aControlType):
+ CAMMSAudio3DControlGroup(KAMMSLocationControl, aControlType)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audio3D/src/cammsorientationcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,600 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for orientation controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsorientationcontrolgroup.h"
+#include "cammsorientationcontrol.h"
+#include "ammsutil.h"
+
+
+// CONSTANTS
+namespace
+{
+// since orientation vectors consist of integers rather than real values,
+// normalized vectors have to be multiplied by a large constant to keep
+// adequate precision
+const TInt KAMMSAxisMultiplier = 1000;
+
+// Some calculations are done with real values and then rounded to integers.
+// Rounding may cause loss of precision. KAMMSMaxOrientationErrorPercentage
+// tells how much error (in percentages) is acceptable when rounding values.
+const TInt KAMMSMaxOrientationErrorPercentage = 5;
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSOrientationControlGroup* CAMMSOrientationControlGroup::NewLC()
+{
+ CAMMSOrientationControlGroup* self =
+ new(ELeave) CAMMSOrientationControlGroup;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+
+}
+
+// Destructor
+CAMMSOrientationControlGroup::~CAMMSOrientationControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::OrientationVectorsL
+// Gets the orientation of the object using two vectors
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::OrientationVectorsL(
+ TInt aOrientation[ KAMMSTwoVectorComponents ])
+{
+ // If the orientation was set by using "front" and "above" vectors,
+ // return "front" and "up" vectors.
+ if (iCommited.iOrientationVector)
+ {
+ // Get "up" vector.
+ TInt upVector[ KAMMSVectorComponents ];
+ GetUpVectorL(iCommited, upVector);
+
+ // Return the "front" and "up" vectors.
+ for (TInt i = 0; i < KAMMSVectorComponents; i ++)
+ {
+ aOrientation[ i ] = iCommited.iOrientation[ i ];
+ aOrientation[ i + KAMMSVectorComponents ] = upVector[ i ];
+ }
+ }
+ // If the orientation was set by using angles, convert set angles
+ // to "front" and "up" vectors.
+ else
+ {
+ // Start rotation from these axis vectors.
+ TReal xAxisVector[ KAMMSVectorComponents ] = { 1, 0, 0 };
+ TReal yAxisVector[ KAMMSVectorComponents ] = { 0, 1, 0 };
+ TReal zAxisVector[ KAMMSVectorComponents ] = { 0, 0, 1 };
+
+ // Result axis vectors after rotation.
+ TReal xAxisVector2[ KAMMSVectorComponents ];
+ TReal yAxisVector2[ KAMMSVectorComponents ];
+ TReal zAxisVector2[ KAMMSVectorComponents ];
+
+ // rotate round y axis
+ AMMSUtil::RotateVectorL(zAxisVector, yAxisVector,
+ iCommited.iOrientation[ EHeading ], zAxisVector2);
+ AMMSUtil::RotateVectorL(xAxisVector, yAxisVector,
+ iCommited.iOrientation[ EHeading ], xAxisVector2);
+
+ // rotate round x axis
+ AMMSUtil::RotateVectorL(yAxisVector, xAxisVector2,
+ iCommited.iOrientation[ EPitch ], yAxisVector2);
+ AMMSUtil::RotateVectorL(zAxisVector2, xAxisVector2,
+ iCommited.iOrientation[ EPitch ], zAxisVector);
+
+ // rotate round z axis
+ AMMSUtil::RotateVectorL(yAxisVector2, zAxisVector,
+ iCommited.iOrientation[ ERoll ], yAxisVector);
+
+ // round and save "front" vector to the given parameter
+ TReal roundedValue;
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ User::LeaveIfError(Math::Round(roundedValue, zAxisVector[ i ] * // CSI: 2 Wrong index means implementation error #
+ KAMMSAxisMultiplier, 0));
+ // "front" vector is opposite to z-axis
+ aOrientation[ i ] = -(TInt)roundedValue; // CSI: 2 Wrong index means implementation error #
+ }
+
+ // round and save "up" vector to the given parameter
+ for (TInt e = 0; e < KAMMSVectorComponents; e++)
+ {
+ User::LeaveIfError(Math::Round(roundedValue, yAxisVector[ e ] * // CSI: 2 Wrong index means implementation error #
+ KAMMSAxisMultiplier, 0));
+ aOrientation[ e + KAMMSVectorComponents ] = (TInt)roundedValue; // CSI: 2 Wrong index means implementation error #
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::SetOrientationL
+// Turns the object to the new orientation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::SetOrientationL(
+ TInt aHeading,
+ TInt aPitch,
+ TInt aRoll)
+{
+ iUncommited.iOrientation[ EHeading ] = aHeading;
+ iUncommited.iOrientation[ EPitch ] = aPitch;
+ iUncommited.iOrientation[ ERoll ] = aRoll;
+ iUncommited.iOrientationVector = EFalse;
+
+ UpdateL(EOrientation);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::SetOrientationVectorsL
+// Turns the object to the new orientation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::SetOrientationVectorsL(
+ TInt aFrontVector[ KAMMSVectorComponents ],
+ TInt aAboveVector[ KAMMSVectorComponents ])
+{
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ iUncommited.iOrientation[ i ] = aFrontVector[ i ];
+ iUncommited.iOrientation[ i + KAMMSVectorComponents ] =
+ aAboveVector[ i ];
+ }
+ iUncommited.iOrientationVector = ETrue;
+
+ UpdateL(EOrientation);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSOrientationControl*
+CAMMSOrientationControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSOrientationControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::GetUpVectorL
+// Calculates and returns "up" vector by using "front" and "above" vectors.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::GetUpVectorL(
+ TVariables& aVariables,
+ TInt aUpVector[ KAMMSVectorComponents ])
+{
+ __ASSERT_DEBUG(aVariables.iOrientationVector, User::Invariant());
+
+ // Calculate first "right" vector and then "up" vector.
+ // The "right" vector is calculated as cross product of the "front"
+ // and "above" vectors.
+ // The "up" vector is calculated as cross product of the "right"
+ // and "front" vectors.
+
+ TReal frontVector[ KAMMSVectorComponents ] =
+ {
+ aVariables.iOrientation[ EFrontX ],
+ aVariables.iOrientation[ EFrontY ],
+ aVariables.iOrientation[ EFrontZ ]
+ };
+
+ TReal aboveVector[ KAMMSVectorComponents ] =
+ {
+ aVariables.iOrientation[ EAboveX ],
+ aVariables.iOrientation[ EAboveY ],
+ aVariables.iOrientation[ EAboveZ ]
+ };
+
+ TReal rightVector[ KAMMSVectorComponents ];
+
+ TReal vectorLength = Min(AMMSUtil::VectorLengthL(frontVector),
+ (TReal)KMaxTInt);
+
+ // Perform cross product with unit vectors.
+ AMMSUtil::ConvertToUnitVectorL(frontVector);
+ AMMSUtil::ConvertToUnitVectorL(aboveVector);
+
+ TReal upVector[ KAMMSVectorComponents ];
+
+ AMMSUtil::CrossProduct(frontVector, aboveVector, rightVector);
+ AMMSUtil::CrossProduct(rightVector, frontVector, upVector);
+
+ AMMSUtil::ConvertToUnitVectorL(upVector);
+
+ // Multiply the unit vector so that the result "up" vector has the same
+ // length as the "front" vector.
+
+ AMMSUtil::MultiplyVector(upVector, vectorLength);
+
+ // Round the vector.
+ AMMSUtil::RoundVectorL(upVector, aUpVector);
+
+ // Check the rounding error. If it is too high, multiply the original
+ // vector before rounding.
+ if (!AMMSUtil::AreVectorsSimilar(upVector,
+ aUpVector,
+ KAMMSMaxOrientationErrorPercentage))
+ {
+ AMMSUtil::MultiplyVector(upVector, (TReal)KAMMSAxisMultiplier);
+
+ // Accept this multiplied vector only if it can be fit into TInt.
+ if ((AMMSUtil::MinVectorComponent(upVector) >= KMinTInt) &&
+ (AMMSUtil::MaxVectorComponent(upVector) <= KMaxTInt))
+ {
+ AMMSUtil::RoundVectorL(upVector, aUpVector);
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::ConvertOrientationToAnglesL
+// Converts orientation from vectors to angles.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::ConvertOrientationToAnglesL(
+ TVariables& aVariables,
+ TInt aSphericalOrientation[ KAMMSVectorComponents ])
+{
+ // Get vector for y-axis.
+ TInt temp[ KAMMSVectorComponents ];
+ GetUpVectorL(aVariables, temp);
+ TReal yAxisVector[] = { temp[ EComponentX ], temp[ EComponentY ],
+ temp[ EComponentZ ]
+ };
+
+ AMMSUtil::ConvertToUnitVectorL(yAxisVector);
+
+
+ // Get vector for z-axis.
+ TReal frontVector[] =
+ {
+ aVariables.iOrientation[ EFrontX ],
+ aVariables.iOrientation[ EFrontY ],
+ aVariables.iOrientation[ EFrontZ ]
+ };
+
+ // Z-axis is opposite to the front vector.
+ AMMSUtil::ConvertToUnitVectorL(frontVector);
+ TReal zAxisVector[ KAMMSVectorComponents ] =
+ {
+ -frontVector[ EFrontX ],
+ -frontVector[ EFrontY ],
+ -frontVector[ EFrontZ ]
+ };
+
+
+ // Calculate orientation vector for the x-axis.
+ // The vector is calculated as cross product of the y-
+ // and z-axis vectors.
+ TReal xAxisVector[ KAMMSVectorComponents ];
+
+ AMMSUtil::CrossProduct(yAxisVector, zAxisVector, xAxisVector);
+ AMMSUtil::ConvertToUnitVectorL(xAxisVector);
+
+
+ // First rotate the object coordinate axels so that the object y-axel is
+ // parallel to the global y-axis (this gives us roll and pitch angles).
+ // Then rotate the object coordinate axels so that x- and z-axels are
+ // parallel to the global x- and z-axels, respectively (this gives the
+ // heading).
+
+
+ // Calculate how much the axels should be rotated round the z-axis.
+ TReal rotateRollDeg = CalculatePartialRotationL(yAxisVector, zAxisVector, EComponentY);
+
+ AMMSUtil::RotateVectorL(xAxisVector, zAxisVector, rotateRollDeg, xAxisVector);
+ AMMSUtil::RotateVectorL(yAxisVector, zAxisVector, rotateRollDeg, yAxisVector);
+
+
+ // Calculate how much the axels should be rotated round the x-axis.
+ TReal rotatePitchDeg = CalculatePartialRotationL(yAxisVector, xAxisVector, EComponentY);
+
+ AMMSUtil::RotateVectorL(yAxisVector, xAxisVector, rotatePitchDeg, yAxisVector);
+ AMMSUtil::RotateVectorL(zAxisVector, xAxisVector, rotatePitchDeg, zAxisVector);
+
+ // Calculate how much the axels should be rotated round the y-axis.
+ TReal rotateHeadingDeg = CalculatePartialRotationL(xAxisVector, yAxisVector, EComponentX);
+
+ TReal resultAngles[] = { -rotateHeadingDeg,
+ -rotatePitchDeg,
+ -rotateRollDeg
+ };
+
+ AMMSUtil::RoundVectorL(resultAngles, aSphericalOrientation);
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::CalculatePartialRotationL
+// Calculates how much the given vector should be rotated around the given
+// rotation vector so that the value of the specified vector component is
+// maximized.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TReal CAMMSOrientationControlGroup::CalculatePartialRotationL(
+ TReal aVector[ KAMMSVectorComponents ],
+ TReal aRotationAxelVector[ KAMMSVectorComponents ],
+ TInt aMaximizeComponent)
+{
+ __ASSERT_DEBUG((aMaximizeComponent >= EComponentX) &&
+ (aMaximizeComponent <= EComponentZ),
+ User::Invariant());
+
+ TReal x = aRotationAxelVector[ EComponentX ];
+ TReal y = aRotationAxelVector[ EComponentY ];
+ TReal z = aRotationAxelVector[ EComponentZ ];
+
+ // calculate the length of the axis vector
+ TReal lengthSquare = x * x + y * y + z * z;
+ TReal length;
+ User::LeaveIfError(Math::Sqrt(length, lengthSquare));
+
+ // check that the vector is long enough
+ __ASSERT_DEBUG(length > 0, User::Invariant());
+
+
+ // Find out the components that are tried to set 0.
+ TInt zeroComponents[ KAMMSVectorComponents - 1 ];
+ TInt counter = 0;
+
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ if (i != aMaximizeComponent)
+ {
+ zeroComponents[ counter ] = i;
+ counter++;
+ }
+ }
+
+ // normalize the axis vector
+ x = x / length;
+ y = y / length;
+ z = z / length;
+
+ // calculate some help variables
+ TReal xx = x * x;
+ TReal yy = y * y;
+ TReal zz = z * z;
+
+ TReal x2 = aVector[ EComponentX ];
+ TReal y2 = aVector[ EComponentY ];
+ TReal z2 = aVector[ EComponentZ ];
+
+ TReal xx2 = x * x2;
+ TReal yy2 = y * y2;
+ TReal zz2 = z * z2;
+
+ TReal xxx2 = xx * x2;
+ TReal yyy2 = yy * y2;
+ TReal zzz2 = zz * z2;
+
+ TReal constants[] =
+ {
+ xxx2 + x *(yy2 + zz2),
+ yyy2 + y *(xx2 + zz2),
+ zzz2 + z *(xx2 + yy2)
+ };
+
+ TReal cosMultipliers[] =
+ {
+ constants[ EComponentX ] - x2,
+ constants[ EComponentY ] - y2,
+ constants[ EComponentZ ] - z2
+ };
+
+ TReal sinMultipliers[] =
+ {
+ z * y2 - y * z2,
+ x * z2 - z * x2,
+ y * x2 - x * y2
+ };
+
+ // The angles where some component of the vector is zero.
+ TReal zeroAngles[ 4 ]; // CSI: 47 Two components may have zero points in 4 angles. #
+ TInt angleCounter = 0;
+
+ // Find rotation angles that makes (at least) one of the vector components
+ // to be 0 (however, dismiss the component to be maximized).
+ for (int i = 0; i < KAMMSVectorComponents - 1; i++)
+ {
+ TInt componentIndex = zeroComponents[ i ];
+
+ TReal cosMultiplier = cosMultipliers[ componentIndex ];
+ TReal sinMultiplier = sinMultipliers[ componentIndex ];
+
+ TReal angleDeg = 0;
+
+ // If both multipliers are zero, this vector is parallel or opposite
+ // to the target vector. Thus, no need to calculate the angle.
+ if ((cosMultiplier != 0) ||
+ (sinMultiplier != 0))
+ {
+ // Calculate the angle that makes this vector element to be 0.
+ TReal temp = cosMultiplier * cosMultiplier +
+ sinMultiplier * sinMultiplier;
+
+ TReal divider = 0;
+ User::LeaveIfError(Math::Sqrt(divider, temp));
+
+ TReal arcTan = 0;
+ User::LeaveIfError(
+ Math::ATan(arcTan, sinMultiplier, cosMultiplier));
+
+ TReal arcCos = 0;
+ User::LeaveIfError(Math::ACos(
+ arcCos, constants[ i ] / divider)); // CSI: 2 Wrong index means implementation error #
+
+ TReal angleRad = arcCos + arcTan;
+
+ // Save the angle in degrees.
+ angleDeg = angleRad * 180 / KPi; // CSI: 47 Value 180 means 180 degrees #
+ }
+
+ zeroAngles[ angleCounter ] = angleDeg;
+
+ zeroAngles[ angleCounter + 1 ] = angleDeg + 180; // CSI: 47 Save also the opposite direction (+ 180 degrees) #
+
+ angleCounter += 2; // CSI: 47 Two angles have been found #
+ }
+
+
+ // Find the angle that gives the maximum value for the component
+ // to be maximized.
+ TReal maxValue = -0xFFFF;
+ TInt maxIndex = KErrNotFound;
+
+ for (TInt i = 0; i < angleCounter; i++)
+ {
+ // Rotate the original vector.
+ TReal rotatedVector[ KAMMSVectorComponents ];
+
+ AMMSUtil::RotateVectorL(aVector, aRotationAxelVector,
+ zeroAngles[ i ], rotatedVector); // CSI: 2 Wrong index means implementation error #
+
+ // Check the value of the component that should be maximized.
+ TReal value = rotatedVector[ aMaximizeComponent ];
+
+ if (value > maxValue)
+ {
+ maxValue = value;
+ maxIndex = i;
+ }
+ }
+
+ return zeroAngles[ maxIndex ];
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSOrientationControlGroup::ClassName()
+{
+ return KAMMSOrientationControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::CommitL
+// Transfers all the pending parameters to the audio processing system.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::CommitL(TInt aCommit)
+{
+ if (aCommit & EOrientation)
+ {
+ TInt controls = ControlCount();
+
+ if (controls > 0)
+ {
+ TInt angleVector[] =
+ {
+ iUncommited.iOrientation[ EHeading ],
+ iUncommited.iOrientation[ EPitch ],
+ iUncommited.iOrientation[ ERoll ]
+ };
+
+ // If the orientation was given in vectors, convert
+ // the vectors to angles because at the moment the Effect API
+ // can handle only angles.
+ if (iUncommited.iOrientationVector)
+ {
+ ConvertOrientationToAnglesL(iUncommited, angleVector);
+ }
+
+ for (TInt i = 0; i < controls; i++)
+ {
+ CAMMSOrientationControl* control = TypeSafeControl(i);
+
+ control->SetOrientationL(
+ angleVector[ EHeading ],
+ angleVector[ EPitch ],
+ angleVector[ ERoll ]);
+ }
+ }
+
+ iCommited = iUncommited;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSAudio3DControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSOrientationControl* control =
+ static_cast<CAMMSOrientationControl*>(aControl);
+
+ // set the current parameters
+ if (iCommited.iOrientationVector)
+ {
+ TInt angleVector[ KAMMSVectorComponents ];
+
+ ConvertOrientationToAnglesL(iCommited, angleVector);
+
+ control->SetOrientationL(
+ angleVector[ EHeading ],
+ angleVector[ EPitch ],
+ angleVector[ ERoll ]);
+ }
+ else
+ {
+ control->SetOrientationL(
+ iCommited.iOrientation[ EHeading ],
+ iCommited.iOrientation[ EPitch ],
+ iCommited.iOrientation[ ERoll ]);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControlGroup::CAMMSOrientationControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSOrientationControlGroup::CAMMSOrientationControlGroup()
+ : CAMMSAudio3DControlGroup(KAMMSOrientationControl)
+{
+ // Default orientation is:
+ // heading = 0
+ // pitch = 0
+ // roll = 0
+ iCommited.iOrientationVector = EFalse;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/inc/cammsaudiovirtualizercontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb controls
+*
+*/
+
+
+#ifndef CAMMSAUDIOVIRTUALIZERCONTROLGROUP_H
+#define CAMMSAUDIOVIRTUALIZERCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrolgroup.h"
+
+// CONSTANTS
+_LIT(KAMMSAudioVirtualizerControlClassName,
+ ".amms.control.audioeffect.AudioVirtualizerControl");
+
+// FORWARD DECLARATIONS
+class CAMMSAudioVirtualizerControl;
+class CStereoWideningUtility;
+
+
+// CLASS DECLARATION
+/**
+ * Group for audio virtualizer controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSAudioVirtualizerControlGroup):
+ public CAMMSEffectControlGroup
+{
+public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSAudioVirtualizerControlGroup* NewLC();
+
+ /**
+ * destructor
+ */
+ ~CAMMSAudioVirtualizerControlGroup();
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected: // Functions from base classes
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+ /**
+ * Called when the current preset changes
+ */
+ void PresetChangedL();
+
+ /**
+ * Finish initialization (after the 1st player is added)
+ */
+ void InitializeL();
+
+ /**
+ * Creates utilities that can be used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utility already exists.
+ */
+ void PrepareEmptyGroupUtilitiesL();
+
+ /**
+ * Deletes utilities that are used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utilities have already been deleted.
+ */
+ void DeleteEmptyGroupUtilities();
+
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ void GetPresetNamesL(CDesCArray& aPresetNames);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSAudioVirtualizerControlGroup();
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+private: // data
+
+ // Needed to get preset names when the group has no controls.
+ CStereoWideningUtility* iEmptyStereoWideningUtility; // Owned.
+
+};
+
+#endif // CAMMSAUDIOVIRTUALIZERCONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/inc/cammseffectcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+#ifndef CAMMSEFFECTCONTROLGROUP_H
+#define CAMMSEFFECTCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <mdaaudiosampleplayer.h> // MMdaAudioPlayerCallback
+#include "cammscontrolgroup.h"
+
+// CONSTANTS
+// Used to get preset names and data when the group is empty.
+_LIT(KAMMSEmptyGroupSoundPath, "Z:\\System\\Sounds\\Digital\\CamcorderJavaStart.wav");
+const TInt KAMMSMaxPresetNameLength = 32;
+const TInt KAMMSPresetGranularity = 5;
+
+// FORWARD DECLARATIONS
+class CAMMSEffectControl;
+
+
+// CLASS DECLARATION
+
+/**
+ * Group for effect controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSEffectControlGroup)
+ : public CAMMSControlGroup, public MMdaAudioPlayerCallback
+{
+public: // Enumerations
+
+ enum TEffectScope {
+ EScopeLiveOnly = 1,
+ EScopeRecordOnly = 2,
+ EScopeLiveAndRecord = 3 };
+
+public: // Constructors and destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSEffectControlGroup();
+
+public: // New functions
+
+ /**
+ * Gets the current preset.
+ *
+ * @return the current preset
+ */
+ void GetPresetL(TDes& aPreset);
+
+ /**
+ * Gets the available preset names
+ *
+ * @return all the available current presets
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Returns the scope in which the effect is present.
+ *
+ * @return SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or SCOPE_LIVE_AND_RECORD
+ */
+ TEffectScope Scope();
+
+ /**
+ * Returns true if the effect is enabled and false otherwise.
+ *
+ * @return true=enable, false=disable
+ */
+ TBool Enabled();
+
+ /**
+ * Returns the current enforced setting of the effect.
+ *
+ * @return true if the effect is an enforced effect, false if not
+ */
+ TBool Enforced();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled true=enabled, false=disabled
+ */
+ void SetEnabledL(TBool aEnabled);
+
+ /**
+ * Enforces the effect to be in use.
+ *
+ * @param aEnforced true if the effect is essential and cannot
+ * be dropped, false if the effect can be dropped
+ * if the system runs out of resources.
+ */
+ void SetEnforcedL(TBool aEnforced);
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Sets the scope of the effect.
+ *
+ * @param aScope SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or
+ * SCOPE_LIVE_AND_RECORD.
+ */
+ void SetScopeL(TEffectScope aScope);
+
+public: // From MMdaAudioPlayerCallback
+
+ /**
+ * Called when file KAMMSEmptyGroupSoundPath has been opened.
+ */
+ void MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration);
+
+ /**
+ * Called when KAMMSEmptyGroupSoundPath has been played,
+ * no implementation needed in this class.
+ */
+ void MapcPlayComplete(TInt aError);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSEffectControl* TypeSafeControl(TInt aIndex) const;
+
+protected: // New functions
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+ /**
+ * Called when the current preset changes
+ */
+ virtual void PresetChangedL();
+
+ /*
+ * Finish initialization (after the 1st player is added)
+ */
+ virtual void InitializeL();
+
+ /**
+ * Creates utilities that can be used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utility already exists.
+ */
+ virtual void PrepareEmptyGroupUtilitiesL();
+
+ /**
+ * Deletes utilities that are used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utilities have already been deleted.
+ */
+ virtual void DeleteEmptyGroupUtilities();
+
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ virtual void GetPresetNamesL(CDesCArray& aPresetNames) = 0;
+
+protected:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSEffectControlGroup(const TDesC& aName);
+
+protected:
+ /**
+ * 2nd phase constructor.
+ */
+ void BaseConstructL();
+
+protected: // data
+
+ // Available preset names, owned
+ CDesCArrayFlat* iPresetNames;
+
+ // Index of the current preset or -1 if no preset is set
+ TInt iPresetIndex;
+
+ TBool iInitialized; // Flag to store whether effect is initialized
+
+ // Used to get preset names and data when the group is empty
+ // (there are no controls in the group, and thus, no actual
+ // control can be used for that purpose).
+ CMdaAudioPlayerUtility* iEmptyPlayerUtility; // Owned.
+
+private: //data
+
+ TEffectScope iScope; // Scope of the effect
+ TBool iEnabled; // Flag to store whether effect is enabled
+ TBool iEnforced; // Flag to store whether effect is enforced
+
+ // Flag to store whether enforce was set before the group was initialized
+ TBool iInitialEnforceSet;
+ // Flag to store whether scope was set before the group was initialized
+ TBool iInitialScopeSet;
+
+ // Used to wait for opening KAMMSEmptyGroupSoundPath.
+ CActiveSchedulerWait* iActiveSchedulerWait; // Owned.
+
+ // Error code occured when creating a player for empty group.
+ TInt iEmptyPlayerUtilityError;
+
+};
+
+#endif // CAMMSEFFECTCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/inc/cammsequalizercontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for equalizer controls
+*
+*/
+
+
+#ifndef CAMMSEQUALIZERCONTROLGROUP_H
+#define CAMMSEQUALIZERCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrolgroup.h"
+#include <AudioEqualizerData.h>
+
+// CONSTANTS
+_LIT(KAMMSEqualizerControlClassName,
+ ".amms.control.audioeffect.EqualizerControl");
+
+
+// FORWARD DECLARATIONS
+class CAMMSBaseEqualizerControl;
+class CAudioEqualizerUtility;
+
+
+// CLASS DECLARATION
+/**
+ * Group for equalizer controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSEqualizerControlGroup): public CAMMSEffectControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSEqualizerControlGroup* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEqualizerControlGroup();
+
+public: // New functions
+ /**
+ * Gets the band that has the most effect on the given frequency
+ *
+ * @param aFrequency The frequency in milliHertz which is
+ * to be equalized via the returned band
+ *
+ * @return The frequency band that has most effect on the given
+ * frequency or -1 if no band has effect on the given frequency
+ */
+ TInt Band(TInt aFrequency);
+
+ /**
+ * Gets the gain set for the given equalizer band.
+ *
+ * @param aBand The frequency band whose gain is asked.
+ * @param aBandLevel The returned level for the given band in millibels.
+ *
+ */
+ void GetBandLevelL(TInt aBand, TInt& aBandLevel);
+
+ /**
+ * Gets the bass level.
+ *
+ * @return The current level that is set to the bass band. If the
+ * bass level cannot been defined EqualizerControl.UNDEFINED will
+ * be returned
+ */
+ TInt Bass();
+
+ /**
+ * Gets the center frequency of the given band
+ *
+ * @param aBand The frequency band whose center frequency
+ * is asked.
+ * @param aCenterFreq The returned center frequency in milliHertz.
+ */
+ void GetCenterFreqL(TInt aBand, TInt& aCenterFreq);
+
+ /**
+ * Returns the maximum band level supported
+ *
+ * @return the maximum band level supported
+ */
+ TInt MaxBandLevel();
+
+ /**
+ * Returns the minimum band level supported.
+ *
+ * @return the minimum band level supported.
+ */
+ TInt MinBandLevel();
+
+ /**
+ * Gets the number of frequency bands that the equalizer supports.
+ *
+ * @return the number of frequency bands that the equalizer supports.
+ */
+ TInt NumberOfBands();
+
+ /**
+ * Gets the treble level.
+ *
+ * @return The current level that is set to the treble band. If the
+ * treble level cannot been defined EqualizerControl.UNDEFINED will
+ * be returned
+ */
+ TInt Treble();
+
+ /**
+ * Sets the given equalizer band to the given gain value.
+ *
+ * @param aLevel The new gain in millibels that will be set to the
+ * given band
+ * @param aBand The frequency band that will have the new gain
+ */
+ void SetBandLevelL(TInt aLevel, TInt aBand);
+
+ /**
+ * Sets the bass level using a linear point scale with values between
+ * 0 and 100: a value of 0 applies the maximum available attenuation
+ * to frequencies in the bass band; a value of 50 gives a flat
+ * equalization of the bass band; and a value of 100 applies the
+ * maximum available amplification to frequencies in the bass band.
+ *
+ * @param aLevel The new level on a linear point scale that will
+ * be set to the bass band
+ * @param aSetLevel Returned level that was actually set
+ */
+ void SetBassL(TInt aLevel, TInt& aSetLevel);
+
+ /**
+ * Sets the treble level using a linear point scale with values between
+ * 0 and 100: a value of 0 applies the maximum available attenuation to
+ * frequencies in the treble band; a value of 50 gives a flat
+ * equalization of the treble band; and a value of 100 applies the
+ * maximum available amplification to frequencies in the treble band
+ *
+ * @param aLevel The new level on a linear point scale that will
+ * be set to the treble band
+ *
+ * @param aSetLevel Returned level that was actually set
+ */
+ void SetTrebleL(TInt aLevel, TInt& aSetLevel);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSBaseEqualizerControl* TypeSafeControl(TInt aIndex) const;
+
+ /**
+ * Checks whether the band index is between 0 and number of bands -1.
+ * Function leaves with KErrArgument if the band is not between the
+ * limits.
+ */
+ void CheckBandIndexL(TInt aBand) const;
+
+ /**
+ * Gets bands corresponding to the given preset index.
+ * The data is obtained from controls (or from empty group utility, if the
+ * group has no controls).
+ * @param aPresetIndex Index of the preset whose bands are asked
+ * @param aBands Returned bands
+ */
+ void GetPresetBandsL(TUint aPresetIndex,
+ RArray< TEfAudioEqualizerBand >& aBands);
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected: // Functions from base classes
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+ /**
+ * Called when the current preset changes
+ */
+ void PresetChangedL();
+
+ /**
+ * Finish initialization (after the 1st player is added)
+ */
+ void InitializeL();
+
+ /**
+ * Creates utilities that can be used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utility already exists.
+ */
+ void PrepareEmptyGroupUtilitiesL();
+
+ /**
+ * Deletes utilities that are used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utilities have already been deleted.
+ */
+ void DeleteEmptyGroupUtilities();
+
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ void GetPresetNamesL(CDesCArray& aPresetNames);
+
+protected:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSEqualizerControlGroup();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // data
+
+ // Needed to get preset names when the group has no controls.
+ CAudioEqualizerUtility* iEmptyAudioEqualizerUtility; // Owned.
+
+ RArray< TEfAudioEqualizerBand > iBands;
+ TInt iBass; // bass level
+ TInt iTreble; // treble level
+ TInt iMaxBandLevel;
+ TInt iMinBandLevel;
+};
+
+#endif // CAMMSEQUALIZERCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/inc/cammsreverbcontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb controls
+*
+*/
+
+
+#ifndef CAMMSREVERBCONTROLGROUP_H
+#define CAMMSREVERBCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrolgroup.h"
+#include <EnvironmentalReverbData.h>
+
+// CONSTANTS
+_LIT(KAMMSReverbControlClassName, ".amms.control.audioeffect.ReverbControl");
+
+// FORWARD DECLARATIONS
+class CAMMSBaseReverbControl;
+class CEnvironmentalReverbUtility;
+
+
+// CLASS DECLARATION
+/**
+ * Group for reverb controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSReverbControlGroup): public CAMMSEffectControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSReverbControlGroup* NewLC();
+
+ /**
+ * destructor
+ */
+ ~CAMMSReverbControlGroup();
+
+public: // New functions
+
+ /**
+ * Gets the gain level of the reverberation
+ *
+ * @return the gain level of the reverberation
+ */
+ TInt ReverbLevel();
+
+ /**
+ * Gets the reverberation time, as set either explicitly via
+ * setReverbTime or implicitly via setPreset (whichever was called last).
+ *
+ * @return the reverberation time
+ */
+ TInt ReverbTime();
+
+ /**
+ * Sets the gain level of the reverberation
+ *
+ * @param the gain level of the reverberation to be set
+ */
+ void SetReverbLevelL(TInt aLevel);
+
+ /**
+ * Sets the reverberation time of the reverb
+ *
+ * @param the reverberation time to be set
+ */
+ void SetReverbTimeL(TInt aTime);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSBaseReverbControl* TypeSafeControl(TInt aIndex) const;
+
+ /**
+ * Gets reverb data for the given preset index from the central
+ * repository.
+ * @param aPresetIndex Index of the preset whose reverb is asked.
+ * @param aReverbData Returned data.
+ */
+ void GetReverbDataFromCenRepL(TUint aPresetIndex,
+ TEfEnvReverbDataPckg& aReverbData);
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+ /**
+ * Called when the current preset changes
+ */
+ void PresetChangedL();
+
+ /**
+ * Finish initialization (after the 1st player is added)
+ */
+ void InitializeL();
+
+ /**
+ * Creates utilities that can be used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utility already exists.
+ */
+ void PrepareEmptyGroupUtilitiesL();
+
+ /**
+ * Deletes utilities that are used to obtain preset names
+ * and preset data (needed when the group has no controls).
+ * Does nothing if the utilities have already been deleted.
+ */
+ void DeleteEmptyGroupUtilities();
+
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ void GetPresetNamesL(CDesCArray& aPresetNames);
+
+protected:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSReverbControlGroup();
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+protected: // data
+
+ // Needed to get preset names when the group has no controls.
+ CEnvironmentalReverbUtility* iEmptyEnvironmentalReverbUtility; // Owned.
+
+ TInt iReverbLevel;
+ TInt iReverbTime;
+ TInt iReverbMinLevel;
+ TInt iReverbMaxLevel;
+
+};
+
+#endif // CAMMSREVERBCONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/inc/cammsreverbsourcecontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb source controls
+*
+*/
+
+
+#ifndef CAMMSREVERBSOURCECONTROLGROUP_H
+#define CAMMSREVERBSOURCECONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrolgroup.h"
+
+// CONSTANTS
+_LIT(KAMMSReverbSourceControlClassName,
+ ".amms.control.audioeffect.ReverbSourceControl");
+
+// FORWARD DECLARATIONS
+class CAMMSBaseReverbSourceControl;
+
+
+// CLASS DECLARATION
+/**
+ * Group for reverb controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSReverbSourceControlGroup): public CAMMSControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSReverbSourceControlGroup* NewLC();
+
+ /**
+ * destructor
+ */
+ ~CAMMSReverbSourceControlGroup();
+
+public: // New functions
+
+ /**
+ * Gets the gain level of the reverberation
+ *
+ * @return the gain level of the reverberation
+ */
+ TInt RoomLevel();
+
+ /**
+ * Sets the gain level of the reverberation
+ *
+ * @param the gain level of the reverberation to be set
+ */
+ void SetRoomLevelL(TInt aLevel);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSBaseReverbSourceControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected: // Functions from base classes
+
+ /**
+ * Called by PlayerAddedL when new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSReverbSourceControlGroup();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // data
+
+ // the actual room level for this control group
+ TInt iRoomLevel;
+
+};
+
+#endif // CAMMSREVERBSOURCECONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/src/cammsaudiovirtualizercontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <StereoWideningUtility.h>
+#include <StereoWideningUtilityData.h>
+#include <logger.h>
+#include "cammsaudiovirtualizercontrolgroup.h"
+#include "cammsaudiovirtualizercontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioVirtualizerControlGroup* CAMMSAudioVirtualizerControlGroup::NewLC()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::NewLC +");
+
+ CAMMSAudioVirtualizerControlGroup* self =
+ new(ELeave) CAMMSAudioVirtualizerControlGroup;
+
+ CleanupStack::PushL(self);
+ self->BaseConstructL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::NewLC -");
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioVirtualizerControlGroup::~CAMMSAudioVirtualizerControlGroup()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::~ +");
+
+ delete iEmptyStereoWideningUtility;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::~ -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSAudioVirtualizerControlGroup::ClassName()
+{
+ return KAMMSAudioVirtualizerControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSEffectControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::PresetChangedL
+// Called when the current preset changes
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::PresetChangedL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::InitializeL
+// Finish initialization (after the 1st player is added)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::InitializeL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::PrepareEmptyGroupUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::PrepareEmptyGroupUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::PrepareEmptyGroupUtilitiesL +");
+
+ if (!iEmptyStereoWideningUtility)
+ {
+ CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL();
+
+ iEmptyStereoWideningUtility =
+ CStereoWideningUtility::NewL(*iEmptyPlayerUtility);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::PrepareEmptyGroupUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::DeleteEmptyGroupUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::DeleteEmptyGroupUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::DeleteEmptyGroupUtilities +");
+
+ if (iEmptyPlayerUtility)
+ {
+ delete iEmptyStereoWideningUtility;
+ iEmptyStereoWideningUtility = NULL;
+
+ CAMMSEffectControlGroup::DeleteEmptyGroupUtilities();
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::DeleteEmptyGroupUtilities -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::GetPresetNamesL +");
+
+ // Create empty group utilities for getting preset names.
+ PrepareEmptyGroupUtilitiesL();
+
+ TArray< TEfStereoWideningUtilityPreset > presetNames =
+ iEmptyStereoWideningUtility->Presets();
+
+
+ TInt presetCount = presetNames.Count();
+
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+
+
+ // Delete empty group utilities in order to save memory.
+ DeleteEmptyGroupUtilities();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControlGroup::GetPresetNamesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::CAMMSAudioVirtualizerControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioVirtualizerControlGroup::CAMMSAudioVirtualizerControlGroup()
+ : CAMMSEffectControlGroup(KAMMSAudioVirtualizerControl)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControlGroup::ConstructL()
+{
+ CAMMSEffectControlGroup::BaseConstructL();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/src/cammseffectcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,436 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammseffectcontrolgroup.h"
+#include "cammseffectcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSEffectControlGroup::~CAMMSEffectControlGroup()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::~ +");
+
+ delete iPresetNames;
+ delete iActiveSchedulerWait;
+
+ if (iEmptyPlayerUtility)
+ {
+ iEmptyPlayerUtility->Close();
+ delete iEmptyPlayerUtility;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::~ -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::PresetL
+// Gets the current preset.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::GetPresetL(TDes& aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::GetPresetL +");
+
+ // Return KNullDesC if no preset is set.
+ if (iPresetIndex >= 0)
+ {
+ aPreset = (*iPresetNames)[ iPresetIndex ]; // CSI: 2 Wrong index means implementation error #
+ }
+ else
+ {
+ aPreset = KNullDesC;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::GetPresetL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::PresetNamesL
+// Gets the available preset names
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const CDesCArray& CAMMSEffectControlGroup::PresetNamesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::PresetNamesL");
+
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::Scope
+// Returns the scope in which the effect is present.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSEffectControlGroup::TEffectScope CAMMSEffectControlGroup::Scope()
+{
+ return iScope;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::Enabled
+// Returns true if the effect is enabled and false otherwise.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TBool CAMMSEffectControlGroup::Enabled()
+{
+ return iEnabled;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::EnforcedL
+// Returns the current enforced setting of the effect.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TBool CAMMSEffectControlGroup::Enforced()
+{
+ return iEnforced;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::SetEnabledL
+// Enables/disables the effect.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::SetEnabledL(TBool aEnabled)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetEnabledL +");
+
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetEnabledL(aEnabled);
+ }
+
+ iEnabled = aEnabled;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetEnabledL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::SetEnforcedL
+// Enforces the effect to be in use.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::SetEnforcedL(TBool aEnforced)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetEnforcedL +");
+
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetEnforcedL(aEnforced);
+ }
+
+ iEnforced = aEnforced;
+
+ // remember that enforce was set when the group was not yet initialized
+ if (!iInitialized)
+ {
+ iInitialEnforceSet = ETrue;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetEnforcedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::SetPresetL
+// Sets the effect according to the given preset.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::SetPresetL(const TDesC& aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetPresetL +");
+
+ // Leave if the given preset does not exist.
+ TInt presetIndex = -1;
+ if (!(iPresetNames->Find(aPreset, presetIndex) == 0))
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Set new preset to the controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetPresetL(aPreset);
+ }
+
+ // Change preset.
+ iPresetIndex = presetIndex;
+
+ // Announce a preset change.
+ PresetChangedL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetPresetL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::SetScopeL
+// Sets the scope of the effect.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::SetScopeL(TEffectScope aScope)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetScopeL +");
+
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetScopeL(aScope);
+ }
+
+ iScope = aScope;
+
+ // remember that scope was set when the group was not yet initialized
+ if (!iInitialized)
+ {
+ iInitialScopeSet = ETrue;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::SetScopeL -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::MapcInitComplete
+// Called when file KAMMSEmptyGroupSoundPath has been opened.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds& /*aDuration*/)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::MapcInitComplete +");
+
+ __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant());
+
+ iEmptyPlayerUtilityError = aError;
+
+ // Stop waiting in PrepareEmptyGroupUtilityL() function.
+ iActiveSchedulerWait->AsyncStop();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::MapcInitComplete -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::MapcPlayComplete
+// Called when KAMMSEmptyGroupSoundPath has been played.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::MapcPlayComplete(TInt /*aError*/)
+{
+ // No implementation needed.
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSEffectControl*
+CAMMSEffectControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSEffectControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::NotifyPlayerAddedL +");
+
+ CAMMSControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSEffectControl* control =
+ static_cast<CAMMSEffectControl*>(aControl);
+
+ // set current preset if any
+ if (iPresetIndex >= 0)
+ {
+ control->SetPresetL((*iPresetNames)[ iPresetIndex ]); // CSI: 2 Wrong index means implementation error #
+ }
+
+ // handle default values if this is the first control added into empty and
+ // uninitialized group
+ if (!iInitialized)
+ {
+
+ InitializeL();
+
+ // if parameters, whose default values are not known, have not been set,
+ // ask them from the first control added to the empty group
+ if (!iInitialEnforceSet)
+ {
+
+ iEnforced = control->Enforced();
+
+ }
+
+ if (!iInitialScopeSet)
+ {
+
+ iScope = (TEffectScope) control->Scope();
+
+ }
+
+ iInitialized = ETrue;
+ }
+
+ // set current parameters
+
+ control->SetEnabledL(iEnabled);
+
+ control->SetEnforcedL(iEnforced);
+
+ control->SetScopeL(iScope);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::NotifyPlayerAddedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::PresetChangedL
+// Called when the current preset changes
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::PresetChangedL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::InitializeL
+// Finish initialization (after the 1st player is added)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::InitializeL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL
+// Creates an utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL +");
+
+ if (!iEmptyPlayerUtility)
+ {
+ iEmptyPlayerUtility = CMdaAudioPlayerUtility::NewL(*this,
+ EMdaPriorityMin, EMdaPriorityPreferenceNone);
+
+ iEmptyPlayerUtility->OpenFileL(KAMMSEmptyGroupSoundPath);
+
+ __ASSERT_DEBUG(!iActiveSchedulerWait->IsStarted(), User::Invariant());
+
+ // Wait until MapcInitComplete() has been called.
+ iActiveSchedulerWait->Start(); // CSI: 10 iActiveSchedulerWait cannot be started, also checked in debug build #
+
+ ELOG1( EJavaAMMS,
+ "AMMS::CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL, err=%d",
+ iEmptyPlayerUtilityError);
+
+ // Leave if file opening returned an error.
+ User::LeaveIfError(iEmptyPlayerUtilityError);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::DeleteEmptyGroupUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::DeleteEmptyGroupUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::DeleteEmptyGroupUtilities +");
+
+ if (iEmptyPlayerUtility)
+ {
+ iEmptyPlayerUtility->Close();
+
+ delete iEmptyPlayerUtility;
+ iEmptyPlayerUtility = NULL;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::DeleteEmptyGroupUtilities -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::CAMMSEffectControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSEffectControlGroup::CAMMSEffectControlGroup(const TDesC& aName) :
+ CAMMSControlGroup(aName)
+{
+ iScope = CAMMSEffectControlGroup::EScopeLiveOnly;
+ iEnabled = EFalse;
+ iEnforced = ETrue;
+ iPresetIndex = -1; // no preset set
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEffectControlGroup::BaseConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::BaseConstructL +");
+
+ CAMMSControlGroup::ConstructL();
+
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+ iPresetNames = new(ELeave)CDesCArrayFlat(KAMMSPresetGranularity);
+
+ // If the Effect API implementation does not support the effect,
+ // the function leaves with KErrNotSupported. The leaving can be ignored
+ // in this case, the result is that the list of supported presets
+ // remain empty.
+ TRAPD(err, GetPresetNamesL(*iPresetNames));
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEffectControlGroup::BaseConstructL, err %d", err);
+
+ // In case of an error, delete possible utilities to save memory.
+ if (err != KErrNone)
+ {
+ DeleteEmptyGroupUtilities();
+ }
+
+ // Leave if some error occured (other than KErrNotSupported).
+ if ((err != KErrNone) && (err != KErrNotSupported))
+ {
+ User::Leave(err);
+ }
+
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControlGroup::BaseConstructL -");
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/src/cammsequalizercontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,617 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for equalizer controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <AudioEqualizerUtility.h>
+#include <AudioEqualizerUtilityData.h>
+#include <logger.h>
+
+#include "cammsequalizercontrolgroup.h"
+#include "cammsbaseequalizercontrol.h"
+
+// CONSTANTS
+namespace
+{
+const TInt KAMMSDefaultEqualizerLevel = 0;
+const TInt KAMMSDefaultEqualizerMaxLevel = 1200;
+const TInt KAMMSDefaultEqualizerMinLevel = -1200;
+const TInt KAMMSDefaultEqualizerTrebleAndBassLevel = 50;
+const TInt KAMMSUndefinedTrebleOrBass = -1004;
+const TInt KAMMSKilo = 1000; // e.g. 1Hz = 1000 mHz
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEqualizerControlGroup* CAMMSEqualizerControlGroup::NewLC()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::NewLC +");
+
+ CAMMSEqualizerControlGroup* self =
+ new(ELeave) CAMMSEqualizerControlGroup;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::NewLC -");
+
+ return self;
+}
+
+// Destructor
+CAMMSEqualizerControlGroup::~CAMMSEqualizerControlGroup()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::~ +");
+
+ delete iEmptyAudioEqualizerUtility;
+
+ iBands.Close();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::~ -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::Band
+// Gets the band that has the most effect on the given frequency
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::Band(TInt aFrequency)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::Band +");
+
+ // Check whether bands have effect on the given frequency.
+ if ((aFrequency <= 0) ||
+ (aFrequency > KAMMSHalfOfSamplingFrequency)) // 24000000 milliHertz
+ {
+ return -1; // no effect on the frequency. Frequency 0 goes here too.
+ }
+
+ TInt bandCount = iBands.Count();
+ if (bandCount == 0)
+ {
+ return 0; // if the number of the bands is zero, return band zero.
+ }
+
+ // Effect API uses hertzes whereas AMMS uses millihertzes.
+ TInt frequencyInHertzes = aFrequency / KAMMSKilo;
+
+ // Find the first band whose cross-over frequency is greater than the
+ // given frequency (the band has effect on the given frequency).
+ TInt i = 0;
+ for (i = 0; i < bandCount; i++)
+ {
+ if (iBands[ i ].iCrossoverFrequency >= frequencyInHertzes)
+ {
+ return i;
+ }
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::Band -");
+
+ // If the given frequency if bigger than any cross-over frequency,
+ // return the last band.
+ return (bandCount - 1);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::GetBandLevelL
+// Gets the gain set for the given equalizer band.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::GetBandLevelL(TInt aBand, TInt& aBandLevel)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetBandLevelL +");
+
+ CheckBandIndexL(aBand);
+
+ aBandLevel = iBands[ aBand ].iBandLevel; // CSI: 2 Index checked above #
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetBandLevelL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::Bass
+// Gets the bass level.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::Bass()
+{
+ return iBass;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::GetCenterFreqL
+// Gets the center frequency of the given band
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::GetCenterFreqL(TInt aBand, TInt& aCenterFreq)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetCenterFreqL +");
+
+ CheckBandIndexL(aBand);
+
+ // Effect API uses hertzes whereas AMMS uses millihertzes.
+ aCenterFreq = iBands[ aBand ].iCenterFrequency * KAMMSKilo; // CSI: 2 Index checked above #
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetCenterFreqL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::MaxBandLevel
+// Returns the maximum band level supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::MaxBandLevel()
+{
+ return iMaxBandLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::MinBandLevel
+// Returns the minimum band level supported.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::MinBandLevel()
+{
+ return iMinBandLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::NumberOfBands
+// Gets the number of frequency bands that the equalizer supports.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::NumberOfBands()
+{
+ return iBands.Count();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::Treble
+// Gets the treble level.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEqualizerControlGroup::Treble()
+{
+ return iTreble;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::SetBandLevelL
+// Sets the given equalizer band to the given gain value.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::SetBandLevelL(TInt aLevel, TInt aBand)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetBandLevelL +");
+
+ // check given parameters
+ CheckBandIndexL(aBand);
+
+ if (aLevel < iMinBandLevel || aLevel > iMaxBandLevel)
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // Set new level to controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetBandLevelL(aLevel, aBand);
+ }
+
+ iBands[ aBand ].iBandLevel = aLevel; // CSI: 2 Index checked above #
+
+ // remove current preset since it is not valid any more
+ iPresetIndex = -1;
+
+ iTreble = KAMMSUndefinedTrebleOrBass;
+ iBass = KAMMSUndefinedTrebleOrBass;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetBandLevelL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::SetBassL
+// Sets the bass level
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::SetBassL(TInt aLevel, TInt& aSetLevel)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetBassL +");
+
+ __ASSERT_DEBUG((aLevel >= iMinBandLevel) &&
+ (aLevel <= iMaxBandLevel), User::Invariant());
+
+ // Set the bass band (first band) to the given percentage of the valid range
+ // between MinBandLevel and MaxBandLevel.
+ TInt newBandLevel = iMinBandLevel + aLevel *
+ (iMaxBandLevel - iMinBandLevel) / 100; // CSI: 47 Value 100 means 100% here #
+
+ // Set new value to bass band (band 0) if band count > 0
+ if (iBands.Count() > 0)
+ {
+ // Set new bass (band 0) to controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetBandLevelL(newBandLevel, 0);
+ }
+
+ iBands[ 0 ].iBandLevel = newBandLevel;
+ }
+
+ // remove the current preset since it is not valid any more
+ iPresetIndex = -1;
+
+ iBass = aLevel;
+
+ aSetLevel = iBass;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetBassL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::SetTrebleL
+// Sets the treble level
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::SetTrebleL(TInt aLevel, TInt& aSetLevel)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetTrebleL +");
+
+ __ASSERT_DEBUG((aLevel >= iMinBandLevel) &&
+ (aLevel <= iMaxBandLevel), User::Invariant());
+
+ TInt bands = iBands.Count();
+ // Set new values to treble bands if there is at least two bands.
+ if (bands > 1)
+ {
+ // Treble affects to two bands.
+ TInt trebleIndex1 = bands - 1; // CSI: 47 Last band #
+ TInt trebleIndex2 = bands - 2; // CSI: 47 Second last band #
+
+ // Set the highest band with 100% weight of the given percentage
+ // of the valid range between MinBandLevel and MaxBandLevel.
+ TInt newBandLevel1 = iMinBandLevel +
+ aLevel * (iMaxBandLevel - iMinBandLevel) / 100; // CSI: 47 Value 100 means 100% #
+
+ // The treble affects 50% to the next highest band.
+ TInt newBandLevel2 = KAMMSDefaultEqualizerLevel +
+ (newBandLevel1 - KAMMSDefaultEqualizerLevel) / 2; // CSI: 47 Divided by 2 is the same as 50% #
+
+ // Set new treble level to controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetBandLevelL(newBandLevel1, trebleIndex1);
+ TypeSafeControl(i)->SetBandLevelL(newBandLevel2, trebleIndex2);
+ }
+
+ iBands[ trebleIndex1 ].iBandLevel = newBandLevel1;
+ iBands[ trebleIndex2 ].iBandLevel = newBandLevel2;
+ }
+
+ // remove the current preset since it is not valid any more
+ iPresetIndex = -1;
+
+ iTreble = aLevel;
+
+ aSetLevel = iTreble;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::SetTrebleL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSBaseEqualizerControl*
+CAMMSEqualizerControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSBaseEqualizerControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::CheckBandIndexL
+// Checks whether the band index is between 0 and number of bands -1.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::CheckBandIndexL(TInt aBand) const
+{
+ if (aBand < 0 || aBand >= iBands.Count())
+ {
+ User::Leave(KErrArgument);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::GetPresetBandsL
+// Gets bands corresponding to the given preset index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::GetPresetBandsL(TUint /*aPresetIndex*/,
+ RArray< TEfAudioEqualizerBand >& aBands)
+{
+ aBands.Reset();
+
+ TInt count = ControlCount();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetPresetBandsL, controls=%d",
+ count);
+
+ // Get data of each band from a control. If there is no controls in the
+ // group, get the data from the empty group utility.
+ if (count > 0)
+ {
+ CAMMSBaseEqualizerControl* control =
+ CAMMSEqualizerControlGroup::TypeSafeControl(0);
+
+ TInt bands = control->NumberOfBands();
+
+ for (TInt i = 0; i < bands; i++)
+ {
+ TEfAudioEqualizerBand band;
+
+ band.iBandLevel = control->BandLevelL(i);
+ band.iBandWidth = control->BandWidth(i);
+ band.iCenterFrequency = control->CenterFrequency(i);
+ band.iCrossoverFrequency = control->CrossoverFrequency(i);
+
+ aBands.AppendL(band);
+ }
+ }
+ else
+ {
+ // Create empty group utilities for getting preset data.
+ PrepareEmptyGroupUtilitiesL();
+
+ CAudioEqualizer& audioEffect = iEmptyAudioEqualizerUtility->Equalizer();
+ TInt bands = audioEffect.NumberOfBands();
+
+ for (TInt i = 0; i < bands; i++)
+ {
+ TEfAudioEqualizerBand band;
+
+ // Band 0 in JSR-234 equals Band 1 in Effect API
+ TUint8 bandId = (TUint8)(i + KAMMSBandOffset);
+
+ band.iBandLevel = audioEffect.BandLevel(bandId);
+ band.iBandWidth = audioEffect.BandWidth(bandId);
+ band.iCenterFrequency = audioEffect.CenterFrequency(bandId);
+ band.iCrossoverFrequency = audioEffect.CrossoverFrequency(bandId);
+
+ aBands.AppendL(band);
+ }
+
+ // Delete empty group utilities in order to save memory.
+ DeleteEmptyGroupUtilities();
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetPresetBandsL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSEqualizerControlGroup::ClassName()
+{
+ return KAMMSEqualizerControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::NotifyPlayerAddedL +");
+
+ CAMMSEffectControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSBaseEqualizerControl* control =
+ static_cast<CAMMSBaseEqualizerControl*>(aControl);
+
+ // if preset was not set into the new control by the main class,
+ // set bands, treble, and bass manually
+ if (iPresetIndex < 0)
+ {
+ TInt bands = iBands.Count();
+
+ // set current band levels
+ for (TInt i = 0; i < bands; i++)
+ {
+ control->SetBandLevelL(iBands[ i ].iBandLevel, i);
+ }
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::NotifyPlayerAddedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::PresetChangedL
+// Called when the current preset changes
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::PresetChangedL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::PresetChangedL +");
+
+ // Invalidate bass and treble levels
+ iBass = KAMMSUndefinedTrebleOrBass;
+ iTreble = KAMMSUndefinedTrebleOrBass;
+
+ // Get band data from controls (or from empty group utility, if the
+ // group has no controls).
+ GetPresetBandsL(iPresetIndex, iBands); // index limits already checked
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::PresetChangedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::InitializeL
+// Finish initialization (after the 1st player is added)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::InitializeL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::InitializeL +");
+
+ CAMMSBaseEqualizerControl* control = TypeSafeControl(0);
+
+ iMaxBandLevel = control->MaxBandLevel();
+ iMinBandLevel = control->MinBandLevel();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::InitializeL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::PrepareEmptyGroupUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::PrepareEmptyGroupUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::PrepareEmptyGroupUtilitiesL +");
+
+ if (!iEmptyAudioEqualizerUtility)
+ {
+ CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL();
+
+ iEmptyAudioEqualizerUtility =
+ CAudioEqualizerUtility::NewL(*iEmptyPlayerUtility);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::PrepareEmptyGroupUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::DeleteEmptyGroupUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::DeleteEmptyGroupUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::DeleteEmptyGroupUtilities +");
+
+ if (iEmptyPlayerUtility)
+ {
+ delete iEmptyAudioEqualizerUtility;
+ iEmptyAudioEqualizerUtility = NULL;
+
+ CAMMSEffectControlGroup::DeleteEmptyGroupUtilities();
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::DeleteEmptyGroupUtilities -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetPresetNamesL +");
+
+ // Create empty group utilities for getting preset names.
+ PrepareEmptyGroupUtilitiesL();
+
+ TArray< TEfAudioEqualizerUtilityPreset > presetNames =
+ iEmptyAudioEqualizerUtility->Presets();
+
+
+ TInt presetCount = presetNames.Count();
+
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+
+ // Delete empty group utilities in order to save memory.
+ DeleteEmptyGroupUtilities();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::GetPresetNamesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::CAMMSEqualizerControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSEqualizerControlGroup::CAMMSEqualizerControlGroup()
+ : CAMMSEffectControlGroup(KAMMSBaseEqualizerControl)
+{
+ iMaxBandLevel = KAMMSDefaultEqualizerMaxLevel;
+ iMinBandLevel = KAMMSDefaultEqualizerMinLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControlGroup::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::ConstructL +");
+
+ CAMMSEffectControlGroup::BaseConstructL();
+
+ // Get band data from empty group utility.
+ // If the Effect API implementation does not support the effect,
+ // the function leaves with KErrNotSupported. The leaving can be ignored
+ // in this case, the result is that the list of supported presets
+ // remain empty.
+ TRAPD(err, GetPresetBandsL(0, iBands));
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEqualizerControlGroup::ConstructL, err %d", err);
+
+ // In case of an error, delete possible utilities to save memory.
+ if (err != KErrNone)
+ {
+ DeleteEmptyGroupUtilities();
+ }
+
+ // Ignore the error so that using MMA and AMMS is possible.
+ // Only successfully read bands are visible for the user.
+
+
+ TInt bands = iBands.Count();
+
+ // Set default band levels.
+ for (TInt i = 0; i < bands; i++)
+ {
+ iBands[ i ].iBandLevel = KAMMSDefaultEqualizerLevel;
+ }
+
+ // Set default values for Bass and Treble. Value 50 means flat equalization.
+ iBass = KAMMSDefaultEqualizerTrebleAndBassLevel;
+ iTreble = KAMMSDefaultEqualizerTrebleAndBassLevel;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControlGroup::ConstructL -");
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/src/cammsreverbcontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <EnvironmentalReverbUtility.h>
+#include <EnvironmentalReverbUtilityData.h>
+#include <logger.h>
+
+#include "cammsreverbcontrolgroup.h"
+#include "cammsbasereverbcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSReverbControlGroup* CAMMSReverbControlGroup::NewLC()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::NewLC +");
+
+ CAMMSReverbControlGroup* self = new(ELeave) CAMMSReverbControlGroup;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::NewLC -");
+
+ return self;
+}
+
+// Destructor
+CAMMSReverbControlGroup::~CAMMSReverbControlGroup()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::~");
+
+ delete iEmptyEnvironmentalReverbUtility;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::ReverbLevel
+// Gets the gain level of the reverberation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSReverbControlGroup::ReverbLevel()
+{
+ return iReverbLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::ReverbTime
+// Gets the reverberation time, as set either explicitly via
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSReverbControlGroup::ReverbTime()
+{
+ return iReverbTime;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::SetReverbLevelL
+// Sets the gain level of the reverberation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::SetReverbLevelL(TInt aLevel)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::SetReverbLevelL");
+
+ __ASSERT_DEBUG(aLevel <= 0, User::Invariant());
+
+ // Set the level between the accepted limits [iReverbMinLevel,
+ // iReverbMaxLevel].
+ TInt reverbLevel = Min(aLevel, iReverbMaxLevel);
+ reverbLevel = Max(reverbLevel, iReverbMinLevel);
+
+ // Set reverb level to the controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetReverbLevelL(reverbLevel);
+ }
+
+ // Invalidate current preset and save the new reverb level
+ iPresetIndex = -1;
+ iReverbLevel = reverbLevel;
+
+ LOG4( EJavaMMAPI, EInfo, "CAMMSReverbControlGroup::SetReverbLevelL, levels: %d, %d, %d %d",
+ aLevel, iReverbMinLevel, iReverbMaxLevel, reverbLevel);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::SetReverbTimeL
+// Sets the reverberation time of the reverb
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::SetReverbTimeL(TInt aTime)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::SetReverbTimeL +");
+
+ __ASSERT_DEBUG(aTime >= 0, User::Invariant());
+
+ // Set reverb time to controls.
+ TInt count = ControlCount();
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetReverbTimeL(aTime);
+ }
+
+ // Invalidate current preset and save new reverb time
+ iPresetIndex = -1;
+ iReverbTime = aTime;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::SetReverbTimeL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSBaseReverbControl*
+CAMMSReverbControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSBaseReverbControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSReverbControlGroup::ClassName()
+{
+ return KAMMSReverbControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::NotifyPlayerAddedL +");
+
+ CAMMSEffectControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSBaseReverbControl* control =
+ static_cast<CAMMSBaseReverbControl*>(aControl);
+
+ // if the preset is not valid, set reverb level and time to the added
+ // control
+ if (iPresetIndex < 0)
+ {
+ control->SetReverbLevelL(iReverbLevel);
+ control->SetReverbTimeL(iReverbTime);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::NotifyPlayerAddedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::PresetChangedL
+// Called when the current preset changes
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::PresetChangedL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PresetChangedL +");
+
+ TInt count = ControlCount();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PresetChangedL, controls=%d",
+ count);
+
+ // Ask preset data from the first control if exists. If not, ask the
+ // data from the empty group utility.
+ if (count > 0)
+ {
+ CAMMSBaseReverbControl* control = TypeSafeControl(0);
+
+ iReverbTime = control->ReverbTime();
+ iReverbLevel = control->ReverbLevel();
+ iReverbMinLevel = control->MinReverbLevel();
+ iReverbMaxLevel = control->MaxReverbLevel();
+ }
+ else
+ {
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PresetChangedL, index=%d",
+ iPresetIndex);
+
+ __ASSERT_DEBUG(iPresetIndex >= 0, User::Invariant());
+
+ // Create empty group utilities for getting preset data.
+ PrepareEmptyGroupUtilitiesL();
+
+ // Set the preset to the empty group utility.
+ iEmptyEnvironmentalReverbUtility->GetPresetL(iPresetIndex);
+
+ CEnvironmentalReverb& audioEffect =
+ iEmptyEnvironmentalReverbUtility->EnvironmentalReverb();
+
+
+ iReverbTime = audioEffect.DecayTime();
+ iReverbLevel =
+ audioEffect.ReflectionsLevel() + audioEffect.RoomLevel();
+
+ TInt32 minLevel;
+ TInt32 maxLevel;
+ audioEffect.ReverbLevelRange(minLevel, maxLevel);
+
+ iReverbMinLevel = minLevel;
+ iReverbMaxLevel = maxLevel;
+
+ // Delete empty group utilities in order to save memory.
+ DeleteEmptyGroupUtilities();
+ }
+
+ LOG4( EJavaAMMS, EInfo, "CAMMSReverbControlGroup::PresetChangedL, values: %d, %d, %d %d",
+ iReverbTime, iReverbLevel, iReverbMinLevel, iReverbMaxLevel);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PresetChangedL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::InitializeL
+// Finish initialization (after the 1st player is added)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::InitializeL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::PrepareEmptyGroupUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::PrepareEmptyGroupUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PrepareEmptyGroupUtilitiesL +");
+
+ if (!iEmptyEnvironmentalReverbUtility)
+ {
+ CAMMSEffectControlGroup::PrepareEmptyGroupUtilitiesL();
+
+ iEmptyEnvironmentalReverbUtility =
+ CEnvironmentalReverbUtility::NewL(*iEmptyPlayerUtility);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::PrepareEmptyGroupUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::DeleteEmptyGroupUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::DeleteEmptyGroupUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::DeleteEmptyGroupUtilities +");
+
+ if (iEmptyPlayerUtility)
+ {
+ delete iEmptyEnvironmentalReverbUtility;
+ iEmptyEnvironmentalReverbUtility = NULL;
+
+ CAMMSEffectControlGroup::DeleteEmptyGroupUtilities();
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::DeleteEmptyGroupUtilities -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::GetPresetNamesL +");
+
+ // Create empty group utilities for getting preset names.
+ PrepareEmptyGroupUtilitiesL();
+
+ TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
+ iEmptyEnvironmentalReverbUtility->Presets();
+
+
+ TInt presetCount = presetNames.Count();
+
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+
+ // Delete empty group utilities in order to save memory.
+ DeleteEmptyGroupUtilities();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::GetPresetNamesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::CAMMSReverbControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSReverbControlGroup::CAMMSReverbControlGroup()
+ : CAMMSEffectControlGroup(KAMMSBaseReverbControl)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSReverbControlGroup::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::ConstructL +");
+
+ CAMMSEffectControlGroup::BaseConstructL();
+
+ TRAPD(err, SetPresetL(KAMMSBaseDefaultReverbPreset));
+
+ // The following code prevents build warning.
+ if (err != KErrNone)
+ {
+ ELOG1( EJavaAMMS, "AMMS::CAMMSReverbControlGroup::ConstructL, err %d", err);
+ }
+
+ // Ignore the error so that using MMA and AMMS is possible.
+ // Error is visible so that "smallroom" preset is not activated.
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControlGroup::ConstructL -");
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/audioeffect/src/cammsreverbsourcecontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for reverb source controls
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsreverbsourcecontrolgroup.h"
+#include "cammsbasereverbsourcecontrol.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSReverbSourceControlGroup* CAMMSReverbSourceControlGroup::NewLC()
+{
+ CAMMSReverbSourceControlGroup* self =
+ new(ELeave) CAMMSReverbSourceControlGroup;
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSReverbSourceControlGroup::~CAMMSReverbSourceControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::RoomLevel
+// Gets the gain level of the reverberation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSReverbSourceControlGroup::RoomLevel()
+{
+ return iRoomLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::SetRoomLevelL
+// Sets the gain level of the reverberation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbSourceControlGroup::SetRoomLevelL(TInt aLevel)
+{
+ // Set room level to controls.
+ TInt count = ControlCount();
+
+ for (TInt i = 0; i < count; i++)
+ {
+ TypeSafeControl(i)->SetRoomLevelL(aLevel);
+ }
+
+ iRoomLevel = aLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSBaseReverbSourceControl*
+CAMMSReverbSourceControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast< CAMMSBaseReverbSourceControl* >(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSReverbSourceControlGroup::ClassName()
+{
+ return KAMMSReverbSourceControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::NotifyPlayerAddedL
+// Called by PlayerRemoved when new player is added.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSReverbSourceControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSBaseReverbSourceControl* control =
+ static_cast<CAMMSBaseReverbSourceControl*>(aControl);
+
+ // set the current parameters
+ control->SetRoomLevelL(iRoomLevel);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::CAMMSReverbSourceControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSReverbSourceControlGroup::CAMMSReverbSourceControlGroup()
+ : CAMMSControlGroup(KAMMSBaseReverbSourceControl),
+ iRoomLevel(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControlGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSReverbSourceControlGroup::ConstructL()
+{
+ CAMMSControlGroup::ConstructL();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/inc/cammspancontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for panning controls
+*
+*/
+
+
+#ifndef CAMMSPANCONTROLGROUP_H
+#define CAMMSPANCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrolgroup.h"
+
+// CONSTANTS
+_LIT(KAMMSPanControlClassName, ".amms.control.PanControl");
+
+// FORWARD DECLARATIONS
+class CAMMSPanControl;
+
+// CLASS DECLARATION
+
+/**
+ * Group for panning controls
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSPanControlGroup): public CAMMSControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSPanControlGroup* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSPanControlGroup();
+
+public: // New functions
+
+ /**
+ * Gets the current panning set.
+ *
+ * @return The current panning.
+ */
+ TInt Pan();
+
+ /**
+ * Sets the panning using a linear point scale with values between -100
+ * and 100. 0 represents panning for both channels, -100 full panning to
+ * the left and 100 full panning to the right. If the given panning
+ * value is less than -100 or greater than 100, the panning will be set
+ * to -100 or 100, respectively.
+ *
+ * @param aPan The new panning to be set.
+ * @param aSetPan Returned pan that has been set.
+ */
+ void SetPanL(TInt aPan, TInt& aSetPan);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSPanControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base classes
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected:
+ /*
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSPanControlGroup();
+
+private: //Data
+
+ // the actual volume for this control group
+ TInt iPan;
+};
+
+#endif // CAMMSPANCONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/inc/cammsvolumecontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for volume controls
+*
+*/
+
+
+#ifndef CAMMSVOLUMECONTROLGROUP_H
+#define CAMMSVOLUMECONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrolgroup.h"
+
+// FORWARD DECLARATIONS
+class CAMMSVolumeControl;
+
+// CONSTANTS
+_LIT(KAMMSVolumeControlClassName, ".amms.control.VolumeControl");
+
+// CLASS DECLARATION
+
+/**
+ * Group for volume controls.
+ * This volume control group can be used with many CAMMSVolumeControl
+ * instances. Controls that belong to this group are identified with
+ * aClassName parameter given to the NewL / NewLC method.
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSVolumeControlGroup): public CAMMSControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aControlName Class name that identifies controls
+ * belonging tothis control group.
+ */
+ static CAMMSVolumeControlGroup* NewLC(const TDesC& aControlName);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSVolumeControlGroup();
+
+public: // New functions
+ /**
+ * Sets the current volume.
+ *
+ * @param aVolume Volume to be set.
+ */
+ void SetVolumeL(TInt aVolume);
+
+private: // New functions
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ CAMMSVolumeControl* TypeSafeControl(TInt aIndex) const;
+
+public: // Functions from base class
+ /**
+ * Returns class name that identifies this control group.
+ *
+ * @return Control group name.
+ */
+ const TDesC16& ClassName();
+
+protected: // From
+ /**
+ * Called by when a new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ void NotifyPlayerAddedL(CMMAPlayer *aPlayer, CMMAControl* aControl);
+
+private:
+ /**
+ * C++ default constructor.
+ * @param aControlName Class name that identifies controls
+ * belonging tothis control group.
+ */
+ CAMMSVolumeControlGroup(const TDesC& aControlName);
+
+protected: //Data
+
+ TInt iVolume;
+};
+
+#endif // CAMMSVOLUMECONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/src/cammspancontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for panning controls
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammspancontrolgroup.h"
+#include "cammspancontrol.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPanControlGroup* CAMMSPanControlGroup::NewLC()
+{
+ CAMMSPanControlGroup* self = new(ELeave) CAMMSPanControlGroup;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+
+}
+
+// Destructor.
+CAMMSPanControlGroup::~CAMMSPanControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::Pan
+// Gets the current panning set.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSPanControlGroup::Pan()
+{
+ return iPan;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::SetPanL
+// Sets the panning value
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPanControlGroup::SetPanL(TInt aPan, TInt& aSetPan)
+{
+ TInt groups = ControlCount();
+ TInt retVal = aPan;
+
+ for (TInt i = 0; i < groups; i++)
+ {
+ retVal = TypeSafeControl(i)->SetPanL(aPan);
+ }
+
+ iPan = retVal;
+
+ aSetPan = retVal;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSPanControl* CAMMSPanControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast<CAMMSPanControl*>(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSPanControlGroup::ClassName()
+{
+ return KAMMSPanControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPanControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSPanControl* control = static_cast<CAMMSPanControl*>(aControl);
+
+ // set the current parameters
+ control->SetPanL(iPan);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControlGroup::CAMMSPanControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPanControlGroup::CAMMSPanControlGroup()
+ : CAMMSControlGroup(KAMMSPanControl)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/ammscontrol/src/cammsvolumecontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for volume controls
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsvolumecontrolgroup.h"
+#include "cammsvolumecontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControlGroup* CAMMSVolumeControlGroup::NewLC(const TDesC& aControlName)
+{
+ CAMMSVolumeControlGroup* self = new(ELeave) CAMMSVolumeControlGroup(
+ aControlName);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSVolumeControlGroup::~CAMMSVolumeControlGroup()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlGroup::SetVolumeL
+// Sets the current volume set.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSVolumeControlGroup::SetVolumeL(TInt aVolume)
+{
+ TInt controls = ControlCount();
+ for (TInt i = 0; i < controls; i++)
+ {
+ TypeSafeControl(i)->SetVolumeL(aVolume);
+ }
+
+ iVolume = aVolume;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlGroup::TypeSafeControl
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSVolumeControl*
+CAMMSVolumeControlGroup::TypeSafeControl(TInt aIndex) const
+{
+ return static_cast< CAMMSVolumeControl* >(Control(aIndex));
+}
+
+// -----------------------------------------------------------------------------
+// TDesC16& CAMMSVolumeControlGroup::ClassName
+// Returns class name that identifies this control group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+const TDesC16& CAMMSVolumeControlGroup::ClassName()
+{
+ return KAMMSVolumeControlClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlGroup::NotifyPlayerAddedL
+// Called by when a new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSVolumeControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer *aPlayer,
+ CMMAControl* aControl)
+{
+ CAMMSControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
+
+ CAMMSVolumeControl* control =
+ static_cast< CAMMSVolumeControl* >(aControl);
+
+ // set the current parameters
+ control->SetVolumeL(iVolume);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlGroup::CAMMSVolumeControlGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControlGroup::CAMMSVolumeControlGroup(const TDesC& aControlName)
+ : CAMMSControlGroup(aControlName)
+{
+ iVolume = KAMMSMAXVolume;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,63 @@
+<!--
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+-->
+
+<project name="javaamms" default="deploy" basedir=".">
+
+ <import file="../../../build/utilities.xml"/>
+
+ <!--property name="java.src.paths" value="../javasrc:../src_tuner/javasrc"/-->
+ <property name="java.src.paths" value="../javasrc"/>
+
+ <!-- Needed by the utilities.xml. See the description form the utilities.xml
+ file -->
+
+ <target name="compile">
+ <omj.javac classpath="${compile.result.root}/javamobilemedia/classes/first:${compile.result.root}/javautils/classes/first"/>
+ </target>
+
+ <!-- Needed by the utilities.xml. See the description form the utilities.xml
+ file -->
+ <property name="javah.classnames"
+ value="com.nokia.amms.control.audioeffect.EqualizerControl,
+ com.nokia.amms.control.audioeffect.ReverbControl,
+ com.nokia.amms.control.audioeffect.ReverbSourceControl,
+ com.nokia.amms.control.audio3d.CommitControl,
+ com.nokia.amms.control.audio3d.DistanceAttenuationControl,
+ com.nokia.amms.control.audio3d.DopplerControl,
+ com.nokia.amms.control.audio3d.LocationControl,
+ com.nokia.amms.control.audio3d.OrientationControl,
+ com.nokia.amms.control.EffectControl,
+ com.nokia.amms.control.PanControl,
+ com.nokia.amms.control.PriorityControl,
+ com.nokia.mid.impl.media.AudioOutputControl,
+ com.nokia.amms.control.VolumeControl,
+ com.nokia.amms.AMMSPlugin,
+ com.nokia.amms.ControlContainer,
+ com.nokia.amms.GlobalManagerImpl,
+ com.nokia.amms.ModuleBase"/>
+
+
+ <target name="system.properties">
+ <properties>
+ audio.samplerates=8000 16000
+ audio3d.simultaneouslocations=4
+ microedition.amms.version=1.1
+ supports.mediacapabilities=music audio3d
+ </properties>
+ </target>
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/build/bwins/javaammsu.def Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
+ ?NewL@CTimeOutTimer@@SAPAV1@HAAVMTimeOutNotify@@@Z @ 2 NONAME ; class CTimeOutTimer * CTimeOutTimer::NewL(int, class MTimeOutNotify &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/build/eabi/javaammsu.def Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _Z10jni_lookupPKc @ 1 NONAME
+ _ZN13CTimeOutTimer4NewLEiR14MTimeOutNotify @ 2 NONAME
+ _ZTI13CTimeOutTimer @ 3 NONAME
+ _ZTV13CTimeOutTimer @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/build/javaamms.pro Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TARGET=javaamms
+TEMPLATE=lib
+CONFIG += omj java stl
+
+include(../../../inc/build_defines.pri)
+
+DEFINES += RD_JAVA_VOLUME_CONTROL
+DEFINES += RD_JAVA_OMA_DRM_V2
+DEFINES += __JAVA_JSR234_TUNER
+
+
+INCLUDEPATH += /epoc32/include/mmf/common \
+ /epoc32/include/caf \
+ ../ammscontrol/inc \
+ ../ammscontrol/audio3D/inc \
+ ../ammscontrol/audioeffect/inc \
+ ../mmacontrol/inc \
+ ../module/inc \
+ ../src_tuner/native/external_include \
+ ../src_tuner/native/inc \
+ ../ammscontrol/inc \
+ ../../mmapi_qt/baseline/inc \
+ ../../mmapi_qt/utils/inc \
+ /epoc32/include/mw/Qt
+
+
+SOURCES += ../ammscontrol/src/*.cpp \
+ ../ammscontrol/audio3D/src/*.cpp \
+ ../ammscontrol/audioeffect/src/*.cpp \
+ ../jni/src/*.cpp \
+ ../mmacontrol/src/*.cpp \
+ ../module/src/*.cpp \
+ ../../mmapi_qt/utils/src/*.cpp
+
+contains(PROJECT_DEFINES,RD_JAVA_HTTP_EMC_ENABLED) {
+ INCLUDEPATH += ../../mmapi_qt/baseline/inc.emc \
+ ../mmacontrol/inc.emc \
+
+ SOURCES += ../mmacontrol/src.emc/*.cpp
+
+
+ LIBS += -lEnhancedMediaClient \
+ -lmmfdevsound
+}
+else{
+ INCLUDEPATH += ../../mmapi_qt/baseline/inc.mmf \
+ ../mmacontrol/inc.mmf \
+
+ SOURCES += ../mmacontrol/src.mmf/*.cpp
+
+}
+
+contains(PROJECT_DEFINES,RD_JAVA_NGA_ENABLED) {
+ INCLUDEPATH += ../../mmapi_qt/baseline/inc.nga
+}
+else {
+ INCLUDEPATH += ../../mmapi_qt/baseline/inc.dsa
+}
+
+
+LIBS += -lAudioEqualizerEffect \
+ -lAudioEqualizerUtility \
+ -lCustomCommandUtility \
+ -lDistanceAttenuationEffect \
+ -lDopplerBase \
+ -lEnvironmentalReverbEffect \
+ -lEnvironmentalReverbUtility \
+ -lListenerDopplerEffect \
+ -lListenerLocationEffect \
+ -lListenerOrientationEffect \
+ -lLocationBase \
+ -lMediaClientAudio \
+ -lOrientationBase \
+ -lRoomLevelEffect \
+ -lSourceDopplerEffect \
+ -lSourceLocationEffect \
+ -lStereoWideningEffect \
+ -lStereoWideningUtility \
+ -lbafl \
+ -lcentralrepository \
+ -lestor \
+ -leuser \
+ -lflogger \
+ -ljavamobilemedia \
+ -lmidiclient \
+ -lmmfcontrollerframework \
+ -lmmfstandardcustomcommands \
+ -laudiooutputrouting \
+ -laccmonitor
+
+include(../../../build/omj.pri)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/AMMSError.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.NativeError;
+
+/**
+ * This class contains general helper methods for error conversion
+ * between native side and java side.
+ */
+public final class AMMSError
+{
+ /**
+ * Private, because this class is not intended to be constructed.
+ */
+ private AMMSError()
+ {
+ }
+
+ /**
+ * This method throws IllegalStateException if error code is
+ * KErrNotReady (-18)
+ *
+ * @param aNativeErrorCode Native error code.
+ */
+ static public void checkIllegalState(int aNativeErrorCode)
+ {
+ if (aNativeErrorCode == NativeError.KErrNotReady)
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * This method throws MediaException if checked native error
+ * code is below KErrNone.
+ * @param aNativeErrorCode Native error code.
+ */
+ static public void checkMediaException(int aNativeErrorCode)
+ throws MediaException
+ {
+ NativeError.checkOOMOnly(aNativeErrorCode);
+ if (aNativeErrorCode < NativeError.KErrNone)
+ {
+ throw new MediaException();
+ }
+ }
+ /**
+ * @param aObject Object to be checked.
+ */
+ static public void checkArgument(Object aObject)
+ {
+ if (aObject == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise throws basic Error class.
+ * @param aNativeErrorCode Native error code.
+ */
+ static public void check(int aNativeErrorCode)
+ {
+ NativeError.check(aNativeErrorCode);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/AMMSPlugin.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Adds PriorityControl when a player is created.
+*
+*/
+
+package com.nokia.amms;
+
+import com.nokia.amms.control.PriorityControl;
+import com.nokia.mid.impl.media.AudioOutputControl;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.PlayerImpl;
+import com.nokia.microedition.media.PlugIn;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.NativeError;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.protocol.DataSource;
+import java.io.IOException;
+
+
+// CLASS DEFINITION
+/**
+ * MMA Manager calls AMMSPlugin class when a new player is created.
+ * The plugin adds PriorityControl to the created player.
+ */
+public class AMMSPlugin implements PlugIn
+{
+ private final String PRIORITY_CONTROL =
+ "javax.microedition.amms.control.PriorityControl";
+ private final String AUDIO_OUTPUT_CONTROL =
+ "com.nokia.mid.media.AudioOutputControl";
+
+ /**
+ * Default constructor.
+ */
+ public AMMSPlugin()
+ {
+ }
+
+ /**
+ * From PlugIn. Empty implementation.
+ */
+ public String[] getSupportedContentTypes(String aProtocol)
+ {
+ return new String[ 0 ];
+ }
+
+ /**
+ * From PlugIn. Empty implementation.
+ */
+ public String[] getSupportedProtocols(String aContentType)
+ {
+ return new String[ 0 ];
+ }
+
+ /**
+ * From PlugIn. Empty implementation.
+ */
+ public InternalPlayer createPlayer(DataSource aDataSource)
+ throws MediaException, IOException
+ {
+ return null;
+ }
+
+ /**
+ * From PlugIn.
+ */
+ public void preparePlayer(InternalPlayer aPlayer) throws MediaException
+ {
+ // Do not add PriorityControl if the player is not derived from
+ // PlayerImpl (because native player handle is needed).
+ if (aPlayer instanceof PlayerImpl)
+ {
+ PlayerImpl player = (PlayerImpl)aPlayer;
+
+ int eventSource = ManagerImpl.getEventSource();
+ createAndAddPriorityControlToPlayer(eventSource, player);
+ createAndAddAudioOutputControlToPlayer(eventSource, player);
+ }
+
+ }
+ /**
+ * Create and add priority control to player
+ */
+ public void createAndAddPriorityControlToPlayer(int eventSource, PlayerImpl aPlayer)
+ {
+ // Create native PriorityControl and add it to the native player.
+ int nativePriorityControl = _createNativePriorityControl(
+ eventSource, aPlayer.getPlayerHandle());
+
+ NativeError.check(nativePriorityControl);
+
+
+ // Create java side control.
+ PriorityControl priorityControl = new PriorityControl(aPlayer);
+ priorityControl.initControl(eventSource, nativePriorityControl,
+ null); // This control does not belong to any module.
+
+ aPlayer.addControl(priorityControl, PRIORITY_CONTROL);
+ }
+ /**
+ * Create and add AudioOutput control to player
+ */
+ public void createAndAddAudioOutputControlToPlayer(int eventSource, PlayerImpl aPlayer)
+ {
+ // Create native AudioOutputControl and add it to the native player.
+ int nativeAudioOutputControl = _createNativeAudioOutputControl(
+ eventSource, aPlayer.getPlayerHandle());
+ NativeError.check(nativeAudioOutputControl);
+
+
+ // Create java side control.
+ AudioOutputControl audioOutputControl = new AudioOutputControl(aPlayer);
+ audioOutputControl.initControl(eventSource, nativeAudioOutputControl,
+ null); // This control does not belong to any module.
+ audioOutputControl.SetAudioOutputToNative();
+ aPlayer.addControl(audioOutputControl, AUDIO_OUTPUT_CONTROL);
+ }
+
+ /**
+ * Creates native PriorityControl and adds it
+ */
+ private static native int _createNativePriorityControl(
+ int aEventSource, int aPlayerHandle);
+ /**
+ * Creates native AudioOutputControl and adds it
+ */
+ private static native int _createNativeAudioOutputControl(
+ int aEventSource, int aPlayerHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/ControlContainer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,293 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Container for controls.
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.Controllable;
+import com.nokia.amms.ModuleBase;
+import com.nokia.amms.control.ControlImpl;
+import com.nokia.mj.impl.utils.Logger;
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * ControlContainer class creates java control objects according to a classname
+ * which is got from native control object. Created controls are accessible
+ * through Controllable interface which is implemented in this class.
+ */
+public class ControlContainer implements Controllable
+{
+ /**
+ * Default control package. Used when getting control with
+ * getControl method which appends default control package if package is
+ * not specified.
+ */
+ static final String CONTROL_DEFAULT_PACKAGE =
+ "javax.microedition.media.control.";
+
+ /**
+ * Package where control implementation are.
+ */
+ static final String PRIVATE_PACKAGE = "com.nokia";
+
+ /**
+ * Hashtable containing controls identified with a full package name.
+ * All control names starts with iDefaultPackage.
+ */
+ private final Hashtable iControls = new Hashtable();
+
+ /**
+ * Creates new ControlContainer.
+ */
+ private ControlContainer()
+ {
+ }
+
+ /**
+ * Create new ControlContainer and populates the controls.
+ *
+ * @param aDefaultPackege Default control package. Used when getting control
+ * with getControl method which appends default control package if package
+ * is not specified.
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aNativeHandle Handle to native control source.
+ * @param aModule Module where the controls belong to.
+ */
+ public static final ControlContainer populateControls(
+ int aEventSourceHandle,
+ int aNativeHandle,
+ ModuleBase aModule)
+ {
+ ControlContainer container = new ControlContainer();
+
+ // Get amount of controls in native object.
+ int controlCount = _getControlsCount(aEventSourceHandle,
+ aNativeHandle);
+
+ // Create java object for each native objects.
+ for (int i = 0; i < controlCount; i++)
+ {
+ // Get handle to native object at index i
+ int controlHandle = _getControlHandle(aEventSourceHandle,
+ aNativeHandle,
+ i);
+
+ // Get controls class name which will be used to create java object
+ String className = _getControlClassName(aEventSourceHandle,
+ controlHandle);
+
+ // create java instance
+ Control control = createControl(className,
+ controlHandle,
+ aEventSourceHandle,
+ aModule);
+
+ // Add package if it does not exists
+ if (className.indexOf('.') < 0)
+ {
+ className = CONTROL_DEFAULT_PACKAGE + className;
+ }
+ container.iControls.put(className, control);
+ }
+
+ // population succeed, return created collection
+ return container;
+ }
+
+ /**
+ * Implements method defined in javax.microedition.media.Controllable.
+ *
+ * @see javax.microedition.media.Controllable
+ * @param aControlType the class name of the Control. The class name should
+ * be given either as the fully-qualified name of the class; or if the
+ * package of the class is not given, the package
+ * javax.microedition.media.control is assumed.
+ * @return the object that implements the control, or null.
+ */
+ public Control getControl(String aControlType)
+ {
+ if (aControlType == null)
+ {
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "ControlContainer::getControl parameter was null");
+ throw new IllegalArgumentException("argument was null");
+ }
+
+ String controlType = aControlType;
+
+ // check if package name exists
+ if (controlType.indexOf(".") == -1)
+ {
+ // add package name
+ controlType = CONTROL_DEFAULT_PACKAGE + aControlType;
+ }
+ Control control = (Control)iControls.get(controlType);
+
+ // If control does not exists with default name, check if there is
+ // is a control with same type ( extends the given class name ).
+ if (control == null)
+ {
+ try
+ {
+ // try to create class for control
+ Class controlClass = Class.forName(controlType);
+
+ Enumeration elements = iControls.elements();
+
+ // search if any control is same type that requested control
+ while (elements.hasMoreElements() &&
+ control == null)
+ {
+ Control tmpControl = (Control)elements.nextElement();
+ if (controlClass.isInstance(tmpControl))
+ {
+ // control is found
+ control = tmpControl;
+ }
+ }
+ }
+ catch (ClassNotFoundException cnfe) // the class could not be found
+ {
+ // Exception is ignored and null is returned from this method
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "ControlContainer::getControl ",
+ cnfe);
+ }
+ catch (Error e) // the function failed for any other reason.
+ {
+ // Error is ignored and null is returned from this method
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "ControlContainer::getControl ",
+ e);
+ }
+ }
+ return control;
+ }
+
+ /**
+ * Implements method defined in javax.microedition.media.Controllable.
+ *
+ * @see javax.microedition.media.Controllable
+ * @return the collection of Control objects.
+ */
+ public Control[] getControls()
+ {
+ Control[] controls = new Control[ iControls.size()];
+ Enumeration elements = iControls.elements();
+ int i = 0;
+ // Put all controls to array
+ while (elements.hasMoreElements())
+ {
+ controls[ i ] = (Control)elements.nextElement();
+ i++;
+ }
+ return controls;
+ }
+
+ /**
+ * Invalidates the controls stored in this container.
+ * After this using controls in Java side will throw
+ * RuntimeException.
+ */
+ public void invalidateControls()
+ {
+ Enumeration elements = iControls.elements();
+
+ while (elements.hasMoreElements())
+ {
+ // All controls are instances of ControlImpl class.
+ ControlImpl control = (ControlImpl)elements.nextElement();
+ control.invalidateControl();
+ }
+ }
+
+ /**
+ * Creates new Control instance.
+ * All control classes must be in iPrivatePackage package and
+ * extend the ControlImpl base class. Created control is initialized
+ * with native control handle and eventsource handle.
+ *
+ * @param aClassName Control's class name without the package.
+ * @param aControlHandle Handle to native control.
+ * @param aModule Module where the control belongs to.
+ * @return created control
+ */
+ static private final Control createControl(String aClassName,
+ int aControlHandle,
+ int aEventSourceHandle,
+ ModuleBase aModule)
+ {
+ ControlImpl control = null;
+
+ // Try to make control instance. If instantion fails, it is an internal
+ // error and can only occur in development time.
+ try
+ {
+ Class controlClass =
+ Class.forName(PRIVATE_PACKAGE +
+ aClassName);
+ control = (ControlImpl)controlClass.newInstance();
+ control.initControl(aEventSourceHandle, aControlHandle, aModule);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new OutOfMemoryError(ie.getMessage());
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new OutOfMemoryError(iae.getMessage());
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new OutOfMemoryError(cnfe.getMessage());
+ }
+ return control;
+ }
+
+
+ /**
+ * Return the amount of controls in native control source.
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aNativeHandle Handle to native control source object.
+ */
+ private static native int _getControlsCount(int aEventSourceHandle,
+ int aNativeHandle);
+
+ /**
+ * Return native handle to control at specified index.
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aNativeHandle Handle to native control source object.
+ * @param aControlIndex Control's index.
+ */
+ private static native int _getControlHandle(int aEventSourceHandle,
+ int aNativeHandle,
+ int aControlIndex);
+ /**
+ * Returns the control class name that can be used to instantiate Java
+ * object.
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aControlHandle Handle to native control.
+ */
+ private static native String _getControlClassName(int aEventSourceHandle,
+ int aControlHandle);
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/EffectModuleImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.amms.EffectModule;
+import javax.microedition.media.Control;
+
+/**
+ * EffectModuleImpl provides functionality defined in EffectModule.
+ * This class is used through EffectModule interface which implements the
+ * Module interface and does not define any new methods. Methods defined in
+ * Module are implemented in ModuleBase class.
+ * Can be accessed only from com.nokia.amms package.
+ */
+class EffectModuleImpl extends ModuleBase
+ implements EffectModule
+{
+ /**
+ * Constructs new EffectModuleImpl instance.
+ * Package private.
+ * @param aEventSourceHandle Handle to event source.
+ * @param aNativeHandle Handle to corresponding native object.
+ * @param aManagerHandle Handle to native global manager.
+ */
+ EffectModuleImpl(int aEventSourceHandle,
+ int aNativeHandle,
+ int aManagerHandle)
+ {
+ super(aEventSourceHandle,
+ aNativeHandle,
+ aManagerHandle);
+ }
+
+ /**
+ * Obtain the object that implements the specified Control interface.
+ *
+ * @see javax.microedition.media.Controllable
+ * @param aControlType the class name of the Control. The class name should
+ * be given either as the fully-qualified name of the class; or if the
+ * package of the class is not given, the package
+ * javax.microedition.media.control is assumed.
+ * @return the object that implements the control, or null if no objects
+ * implement the control or if there is no players in the module.
+ */
+ public Control getControl(String aControlType)
+ {
+ if (iPlayers.size() > 0)
+ {
+ // Delegate to ControlContainer
+ return iControls.getControl(aControlType);
+ }
+ // An EffectModule, that has no Players attached to it, does not
+ // provide any Controls.
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Obtain the collection of Controls.
+ *
+ * @see javax.microedition.media.Controllable
+ * @return the collection of Control objects or a zero length array if
+ * there is no controls or players in the module.
+ */
+ public Control[] getControls()
+ {
+ if (iPlayers.size() > 0)
+ {
+ // Delegate to ControlContainer
+ return iControls.getControls();
+ }
+ // An EffectModule, that has no Players attached to it, does not
+ // provide any Controls.
+ else
+ {
+ return new Control[ 0 ];
+ }
+
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/GlobalManagerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.amms;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.amms.EffectModule;
+import javax.microedition.amms.SoundSource3D;
+import javax.microedition.amms.MediaProcessor;
+import javax.microedition.media.Manager;
+import java.util.Vector;
+
+/**
+ * GlobalManager implementation used by
+ * javax.microedition.amms.GlobalManager.
+ */
+public class GlobalManagerImpl extends ModuleBase
+{
+ /**
+ * There is no supported media processor input types.
+ */
+ private static final String[] SUPPORTED_MEDIA_PROCESSOR_INPUT_TYPES =
+ new String[ 0 ];
+
+ // Constants needed when getting supported player content types.
+ private static final String AUDIO_STRING = "audio";
+ private static final String VIDEO_STRING = "video";
+ private static final String CAPTURE_STRING = "capture";
+ private static final String DEVICE_STRING = "device";
+ private static final String PROTOCOL_SEPARATOR = "://";
+ private static final char MEDIA_SEPARATOR = '/';
+
+ /**
+ * Singleton instance.
+ */
+ static private GlobalManagerImpl iInstance;
+
+ /**
+ * Implements Spectator functionality.
+ */
+ private SpectatorImpl iSpectator;
+
+ /**
+ * Private constructor not to allow direct construction, because
+ * this class is singleton.
+ */
+ private GlobalManagerImpl(int aEventSourceHandle)
+ {
+ com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javaamms");
+
+ iEventSourceHandle = aEventSourceHandle;
+
+ // Create native instance
+ iModuleHandle = _createGlobalManager(iEventSourceHandle);
+
+
+ if (iModuleHandle < 0)
+ {
+ // Could not create native object
+ throw new OutOfMemoryError();
+ }
+ }
+
+ /**
+ * Creates static GlobalManagerImpl instance. Instance can be obtained
+ * with getInstance method.
+ * @param aEventSourceHandle Handle to native event source.
+ */
+ public static void invoke(int aEventSourceHandle)
+ {
+ // create static instance
+ iInstance = new GlobalManagerImpl(aEventSourceHandle);
+ }
+
+ /**
+ * Returns static GlobalManagerImpl instance. This method will be called
+ * from GlobalManager's static block when it is loaded for the first time.
+ * @return GlobalManagerImpl instance
+ */
+ public static GlobalManagerImpl getInstance()
+ {
+ if (iInstance == null)
+ {
+ // GlobalManagerImpl is not initialized because iInstance is null.
+ // Invoke MMA1.1 by calling one of Manager's static methods.
+ // MMA will invoke its invoke listener that will result a call to
+ // GlobalManagerImpl::invoke method which creates static global
+ // manager instance.
+ Manager.getSystemTimeBase();
+ }
+
+ // if spectator isn't null init is already called
+ if (iInstance.iSpectator == null)
+ {
+ iInstance.init();
+ }
+ return iInstance;
+ }
+
+ /**
+ * Finalizes GlobalManagerImpl's initialization.
+ * This method creates native global controls and corresponding Java
+ * controls.
+ */
+ private void init()
+ {
+ // Initialize native global manager instance.
+ int err = _init(iInstance.iEventSourceHandle,
+ iInstance.iModuleHandle);
+
+
+ // Initialize super class which will add global controls
+ init(iEventSourceHandle, iModuleHandle);
+
+ if (err < 0)
+ {
+ // Init failed. AMMS functionality cannot be used.
+ throw new OutOfMemoryError();
+ }
+ int handle = _createSpectator(iEventSourceHandle, iModuleHandle);
+ if (handle < 0)
+ {
+ // Could not create native object
+ throw new OutOfMemoryError();
+ }
+
+ // Create Java object for native spectator
+ iSpectator = new SpectatorImpl(iEventSourceHandle, handle);
+ }
+
+ /**
+ * Creates an <code>EffectModule</code>.
+ *
+ * @throws MediaException if creation of <code>EffectModule</code>
+ * is not supported.
+ * @return An <code>EffectModule</code> object that may be used to group
+ * <code>Player</code>s.
+ */
+ public EffectModule createEffectModule() throws MediaException
+ {
+ int handle = _createEffectModule(iEventSourceHandle, iModuleHandle);
+ if (handle < 0)
+ {
+ throw new MediaException();
+ }
+ return new EffectModuleImpl(iEventSourceHandle,
+ handle,
+ iModuleHandle);
+ }
+
+ /**
+ * Creates a <code>SoundSource3D</code>.
+ *
+ * @throws MediaException if creation of <code>SoundSource3D</code>
+ * is not supported.
+ * @return A <code>SoundSource3D</code> object that represents
+ * a virtual sound source and that may be used to group
+ * <code>Player</code>s.
+ */
+ public SoundSource3D createSoundSource3D() throws MediaException
+ {
+ int handle = _createSoundSource3D(iEventSourceHandle, iModuleHandle);
+ if (handle < 0)
+ {
+ throw new MediaException();
+ }
+ return new SoundSource3DImpl(iEventSourceHandle,
+ handle,
+ iModuleHandle);
+ }
+
+ /**
+ * Gets the supported player content types that can be added
+ * to a <code>SoundSource3D</code>.
+ * {@link javax.microedition.amms.control.AudioFormatControl}
+ * specifies constants for content types commonly used with
+ * <code>SoundSource3D</code>.
+ *
+ * @return a list of content types that can be used to create
+ * <code>Player</code>s supported by <code>SoundSource3D</code>
+ * (e.g. "audio/midi") and of device and capture locators that can
+ * be used to create <code>Player</code>s supported by
+ * <code>SoundSource3D</code> (e.g. "capture://radio")
+ */
+ public String[] getSupportedSoundSource3DPlayerTypes()
+ {
+ Vector resultVector = new Vector();
+
+ // Get content types (e.g. audio/midi)
+ playerTypes(null, resultVector);
+
+ // Get device locators (e.g. "device://video)
+ playerTypes(DEVICE_STRING, resultVector);
+
+
+ // Convert the vector to string array.
+
+ int resultLength = resultVector.size();
+
+ String[] result = new String[ resultLength ];
+
+ for (int i = 0; i < resultLength; i++)
+ {
+ result[ i ] = (String)resultVector.elementAt(i);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns player types that supports the given protocol.
+ * @param aProtocol Protocol (e.g. capture) or null if all protocols are used.
+ * @param aResultVector Vector where the result is stored.
+ */
+ private void playerTypes(String aProtocol, Vector aResultVector)
+ {
+ String[] contentTypes = Manager.getSupportedContentTypes(aProtocol);
+
+ int contents = contentTypes.length;
+
+ for (int i = 0; i < contents; i++)
+ {
+ String contentType = contentTypes[ i ];
+
+ // Select those types that are supported by AMMS.
+ if (contentType.startsWith(AUDIO_STRING + MEDIA_SEPARATOR) ||
+ contentType.startsWith(VIDEO_STRING + MEDIA_SEPARATOR))
+ {
+ String playerType = contentType;
+
+ // Add the protocol string if a specific one is used.
+ if (aProtocol != null)
+ {
+ int endIndex = contentType.indexOf(MEDIA_SEPARATOR);
+ if (endIndex >= 0)
+ {
+ contentType = contentType.substring(0, endIndex);
+ }
+
+ playerType = aProtocol + PROTOCOL_SEPARATOR + contentType;
+ }
+
+ // Add the type to the vector.
+ if (!aResultVector.contains(playerType))
+ {
+ aResultVector.addElement(playerType);
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the <code>Spectator</code>, which represents the listener
+ * in the virtual acoustical space.
+ *
+ * @return the <code>Spectator</code>, which represents the listener
+ * in the virtual acoustical space
+ */
+ public SpectatorImpl getSpectator()
+ {
+ return iSpectator;
+ }
+
+ /**
+ * Creates a <code>MediaProcessor</code> object. Content type is passed
+ * as a MIME type as specified in javax.microedition.media.Manager.
+ * {@link FormatControl},
+ * {@link javax.microedition.amms.control.ContainerFormatControl},
+ * {@link javax.microedition.amms.control.VideoFormatControl},
+ * {@link javax.microedition.amms.control.AudioFormatControl}
+ * and {@link javax.microedition.amms.control.ImageFormatControl} specify
+ * constants for a set of commonly used content types.
+ *
+ *
+ * @param contentType the content type of the source data to be processed.
+ * @throws MediaException if a <code>MediaProcessor</code> could
+ * not be created for the given content type.
+ * @return An instance of <code>MediaProcessor</code>
+ */
+ public MediaProcessor createMediaProcessor(String aContentType)
+ throws MediaException
+ {
+ // MediaProcessor is not supported.
+ throw new MediaException();
+ }
+
+ /**
+ * Obtain the handle of the GlobalManager.
+ *
+ * @return the module handle.
+ */
+ public static int getHandle()
+ {
+ if (iInstance == null)
+ {
+ // GlobalManagerImpl is not initialized because iInstance is null.
+ // Invoke MMA1.1 by calling one of Manager's static methods.
+ // MMA will invoke its invoke listener that will result a call to
+ // GlobalManagerImpl::invoke method which creates static global
+ // manager instance.
+ Manager.getSystemTimeBase();
+ }
+
+ return iInstance.iModuleHandle;
+ }
+
+ /**
+ * Gets the supported MediaProcessor input content types.
+ *
+ * @return Supported MediaProcessor input content types.
+ */
+ public String[] getSupportedMediaProcessorInputTypes()
+ {
+ return SUPPORTED_MEDIA_PROCESSOR_INPUT_TYPES;
+ }
+
+ /**
+ * @param aEventSourceHandle Handle to native event source.
+ * @return Handle to native object or an error code.
+ */
+ private static native int _createGlobalManager(int aEventSourceHandle);
+
+ /**
+ * Initializes native object.
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aGlobalManagerHandle Handle to native global manager.
+ * @return 0 if success or an error code.
+ */
+ private static native int _init(int aEventSourceHandle,
+ int aGlobalManagerHandle);
+
+ /**
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aGlobalManagerHandle Handle to native global manager.
+ * @return Handle to native object or an error code.
+ */
+ private static native int _createEffectModule(int aEventSourceHandle,
+ int aGlobalManagerHandle);
+
+ /**
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aGlobalManagerHandle Handle to native global manager.
+ * @return Handle to native object or an error code.
+ */
+ private static native int _createSoundSource3D(int aEventSourceHandle,
+ int aGlobalManagerHandle);
+
+ /**
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aGlobalManagerHandle Handle to native global manager.
+ * @return Handle to native object or an error code.
+ */
+ private static native int _createSpectator(int aEventSourceHandle,
+ int aGlobalManagerHandle);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/MMAInvokeListenerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is invoked when MMA event source is created.
+*
+*/
+
+package com.nokia.amms;
+
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.MMAInvokeListener;
+
+/**
+ * This class will be created and invoked when MMA event source is created.
+ */
+public class MMAInvokeListenerImpl implements MMAInvokeListener
+{
+ /**
+ * Public empty constructor to used from MMA.
+ */
+ public MMAInvokeListenerImpl()
+ {
+ }
+
+ /**
+ * From MMAInvokeListener. Invokes GlobalManager and adds AMMSPlugin to
+ * the MMA Manager.
+ * @param aEventSourceHandle Handle to native MMA event source.
+ */
+ public void notifyInvoke(int aEventSourceHandle)
+ {
+ // Create GlobalManagerImpl static instance.
+ GlobalManagerImpl.invoke(aEventSourceHandle);
+
+ // Add AMMSPlugin to MMA Manager. The plugin is called every time
+ // a player is created.
+ ManagerImpl.getInstance().addPlugIn(new AMMSPlugin());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/ModuleBase.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,400 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for modules.
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Player;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.Control;
+import com.nokia.microedition.media.PlayerImpl;
+
+import com.nokia.microedition.media.NativeError;
+import java.util.Vector;
+import com.nokia.mj.impl.rt.support.Finalizer;
+
+/**
+ * Base class for all modules.
+ */
+public class ModuleBase implements PlayerListener
+{
+ /**
+ * Player is already in some other module.
+ */
+ private static final int PLAYER_ALREADY_IN_MODULE = -123;
+ private static final int MIXING_NOT_SUPPORTED = -1234;
+
+ /**
+ * Current implementation does not support midi channels in modules.
+ */
+ private static final String MIDI_CHANNELS_NOT_SUPPORTED =
+ "Adding MIDI channels is not supported.";
+
+ /**
+ * Contains all controls in the module. Package private.
+ */
+ ControlContainer iControls;
+
+ /**
+ * Handle to native implemantation. Package private.
+ */
+ int iModuleHandle;
+
+ /**
+ * Handle to native event source. Package private.
+ */
+ int iEventSourceHandle;
+
+ /**
+ * Handle to native global mabager. Package private.
+ * Used to dispose native module.
+ */
+ int iManagerHandle;
+
+ /**
+ * Java-side players. Package private.
+ */
+ Vector iPlayers = new Vector();
+
+ private Finalizer mFinalizer;
+
+ /**
+ * Constructs new Module base. Package private.
+ * Module is registered for the finalization.
+ *
+ * @param aEventSourceHandle Handle to event source.
+ * @param aModuleHandle Handle to corresponding native object.
+ * @param aManagerHandle Handle to native global manager.
+ * @param aMana
+ */
+ ModuleBase(int aEventSourceHandle,
+ int aModuleHandle,
+ int aManagerHandle)
+ {
+ // registeredFinalize() method is called when this class is finalized.
+ mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+
+ iManagerHandle = aManagerHandle;
+
+ init(aEventSourceHandle,
+ aModuleHandle);
+ }
+
+ /**
+ * Constructs new Module base. Package private.
+ * Module is not registered for the finalization.
+ */
+ ModuleBase()
+ {
+ }
+
+ /**
+ * Initialises module base. This method must be called before module can be
+ * used. Package private.
+ *
+ * @param aEventSourceHandle Handle to event source.
+ * @param aModuleHandle Handle to corresponding native object.
+ */
+ final void init(int aEventSourceHandle,
+ int aModuleHandle)
+ {
+ iEventSourceHandle = aEventSourceHandle;
+ iModuleHandle = aModuleHandle;
+
+ iControls = ControlContainer.populateControls(
+ iEventSourceHandle,
+ iModuleHandle,
+ this);
+ }
+
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ /**
+ * This method is called when garbage collector finalizes this object.
+ */
+ void registeredFinalize()
+ {
+ iControls.invalidateControls();
+
+ _dispose(iManagerHandle,
+ iModuleHandle);
+ }
+
+ /**
+ * <p>Adds an individual MIDI channel of a MIDI <code>Player</code>
+ * to the module.</p>
+ *
+ * <p>If the played MIDI file or MIDI stream contains information
+ * that is contradictory
+ * to what is specified via this <code>Module</code> the behavior
+ * will be implementation specific.</p>
+ *
+ * @param player The MIDI <code>Player</code> whose channel is to be added.
+ * @param channel The channel of the given <code>Player</code> to be added.
+ * The range is 0-15.
+ *
+ * @throws MediaException if adding of channels is not supported.
+ * @throws IllegalArgumentException if the <code>player</code> is not a MIDI player or the <code>player</code> is null
+ * or if the <code>player</code> is already part of the module.
+ * @throws IllegalArgumentException if <code>channel</code> > 15 or <code>channel</code> < 0.
+ * @throws IllegalStateException if some <code>Player</code>
+ * in the <code>Module</code> tree is not in
+ * <code>UNREALIZED</code> or <code>REALIZED</code> state.
+ */
+ public void addMIDIChannel(Player aPlayer, int aChannel)
+ throws MediaException
+ {
+ // Midi channels are not supported modules.
+ throw new MediaException(MIDI_CHANNELS_NOT_SUPPORTED);
+ }
+
+ /**
+ * Removes a MIDI channel from the module.
+ *
+ * All channels can be removed at once by {@link #removePlayer removePlayer}
+ *
+ * @param player The MIDI <code>Player</code> whose channel is to be removed.
+ * @param channel The channel of the given MIDI <code>Player</code>
+ * to be removed.
+ * @throws IllegalArgumentException if the given <code>channel</code> is
+ * not part of the <code>Module</code> or if the <code>player</code> is null.
+ * @throws IllegalStateException if some <code>Player</code>
+ * in the <code>Module</code> tree is not in
+ * <code>UNREALIZED</code> or <code>REALIZED</code> state
+ */
+ public void removeMIDIChannel(Player aPlayer, int aChannel)
+ {
+ // Midi channels are not supported modules.
+ throw new IllegalArgumentException(MIDI_CHANNELS_NOT_SUPPORTED);
+ }
+
+ /**
+ * Adds a <code>Player</code> to the module.
+ * @param player The <code>Player</code> to be added.
+ * @throws IllegalArgumentException if the <code>player</code> is null or
+ * if the <code>player</code> or some channels of
+ * the <code>player</code> already belong to the module.
+ * @throws MediaException if the <code>player</code> cannot be added.
+ * @throws IllegalStateException if some <code>Player</code>
+ * in the <code>Module</code> tree is not in
+ * <code>UNREALIZED</code> or <code>REALIZED</code> state.
+ */
+ public void addPlayer(Player aPlayer) throws MediaException
+ {
+ if (aPlayer == null)
+ {
+ throw new IllegalArgumentException("Player is null.");
+ }
+ if (!(aPlayer instanceof PlayerImpl))
+ {
+ throw new MediaException("Player is not supported.");
+ }
+
+ // It is not reasonable to add a player that is in CLOSED state.
+ if (aPlayer.getState() == Player.CLOSED)
+ {
+ throw new IllegalStateException("Cannot add Player while it is in CLOSED state.");
+ }
+
+ int playerHandle = ((PlayerImpl)aPlayer).getPlayerHandle();
+
+ int err = _addPlayer(iEventSourceHandle,
+ iModuleHandle,
+ playerHandle);
+
+ // Throw IllegalArgumentException if the player or some channels of
+ // the player already belong to the module.
+ if (err == NativeError.KErrArgument)
+ {
+ throw new IllegalArgumentException("Player already belongs to the module.");
+ }
+
+ // Throw IllegalStateException if some Player in the Module
+ // (or the player to be added) is in PREFETCHED or STARTED state
+ if (err == NativeError.KErrNotReady)
+ {
+ throw new IllegalStateException("Cannot Add Player while any player in the module is in PREFETCHED or STARTED state");
+ }
+
+ // Throw MediaException if the player already exists in some
+ // other module.
+ if (err == PLAYER_ALREADY_IN_MODULE)
+ {
+ throw new MediaException("Player already in other module.");
+ }
+
+ // Throw MediaException if audio mixing is not supported (emulator).
+ if (err == MIXING_NOT_SUPPORTED)
+ {
+ throw new MediaException("Mixing is not supported in emulator.");
+ }
+
+ // Throw MediaException if the player cannot be added.
+ if (err < 0)
+ {
+ throw new MediaException(NativeError.errorMessage(err));
+ }
+
+ iPlayers.addElement(aPlayer);
+ aPlayer.addPlayerListener(this);
+ }
+
+ /**
+ * Removes a <code>Player</code> or all channels of a <code>Player</code>
+ * from the module.
+ * @param player The <code>Player</code> to be removed.
+ * @throws IllegalArgumentException if <code>player</code> is not part of
+ * the
+ * module or if <code>player</code> is null.
+ * @throws IllegalStateException if some <code>Player</code>
+ * in the <code>Module</code> tree is not in
+ * <code>UNREALIZED</code> or <code>REALIZED</code> state.
+ */
+ public void removePlayer(Player aPlayer)
+ {
+ // Throw IllegalArgumentException if the player is null, incorrect
+ // type, or does not belong to the module.
+ if (aPlayer == null)
+ {
+ throw new IllegalArgumentException("Player is null.");
+ }
+ if (!(aPlayer instanceof PlayerImpl))
+ {
+ throw new IllegalArgumentException("Not supported player.");
+ }
+
+ // If the player is in CLOSED state, the native side player is
+ // already removed and destroyed.
+ if (aPlayer.getState() != Player.CLOSED)
+ {
+ // The player list does not contain CLOSED players, thus do not
+ // check the existence for these players.
+ if (!iPlayers.contains(aPlayer))
+ {
+ throw new IllegalArgumentException(
+ "Player does not belong to the module.");
+ }
+
+ int playerHandle = ((PlayerImpl)aPlayer).getPlayerHandle();
+
+ int err = _removePlayer(iEventSourceHandle,
+ iModuleHandle,
+ playerHandle);
+
+ if (err == NativeError.KErrNotReady)
+ {
+ throw new IllegalStateException(
+ "Cannot remove Player while any player in the module is in PREFETCHED or STARTED state");
+ }
+
+ NativeError.check(err);
+
+ aPlayer.removePlayerListener(this);
+ }
+
+ iPlayers.removeElement(aPlayer);
+ }
+
+ /**
+ * Obtain the object that implements the specified Control interface.
+ *
+ * @see javax.microedition.media.Controllable
+ * @param aControlType the class name of the Control. The class name should
+ * be given either as the fully-qualified name of the class; or if the
+ * package of the class is not given, the package
+ * javax.microedition.media.control is assumed.
+ * @return the object that implements the control, or null.
+ */
+ public Control getControl(String aControlType)
+ {
+ // Delegate to ControlContainer
+ return iControls.getControl(aControlType);
+ }
+
+ /**
+ * Obtain the collection of Controls.
+ *
+ * @see javax.microedition.media.Controllable
+ * @return the collection of Control objects.
+ */
+ public Control[] getControls()
+ {
+ // Delegate to ControlContainer
+ return iControls.getControls();
+ }
+
+ /**
+ * From PlayerListener.
+ */
+ public void playerUpdate(Player aPlayer, String aEvent, Object aEventData)
+ {
+ // Remove the player from the vector in order to allow
+ // the garbage collector to dispose the player.
+ if (aEvent == PlayerListener.CLOSED)
+ {
+ iPlayers.removeElement(aPlayer);
+ }
+ }
+
+ /**
+ * Removes a Player from module.
+ * (The function is protected to allow inherited modules to remove
+ * CLOSED players which is not possible by removePlayer() function).
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aModuleHandle Handle to native module object.
+ * @param aPlayerHandle Handle to native player object.
+ * @return Negative value if player does not exist in the module.
+ */
+ static native protected int _removePlayer(int aEventSourceHandle,
+ int aModuleHandle,
+ int aPlayerHandle);
+
+ /**
+ * Adds a Player to module.
+ *
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aModuleHandle Handle to native module object.
+ * @param aPlayerHandle Handle to native player object.
+ * @return Error code
+ */
+ static native private int _addPlayer(int aEventSourceHandle,
+ int aModuleHandle,
+ int aPlayerHandle);
+
+ /**
+ * Disposes native module.
+ *
+ * @param aManagerHandle Handle to native global manager.
+ * @param aModuleHandle Handle to native module object.
+ */
+ static native private void _dispose(int aManagerHandle,
+ int aModuleHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/SoundSource3DImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.amms.SoundSource3D;
+
+/**
+ * SoundSource3DImpl provides functionality defined in SoundSource3D.
+ * This class is used through SoundSource3D interface which implements the
+ * Module interface and does not define any new methods. Methods defined in
+ * Module are implemented in ModuleBase class.
+ * Can be accessed only from com.nokia.amms package.
+ */
+class SoundSource3DImpl extends ModuleBase
+ implements SoundSource3D
+{
+ /**
+ * Constructs new EffectModuleImpl instance.
+ * Package private.
+ * @param aEventSourceHandle Handle to event source.
+ * @param aNativeHandle Handle to corresponding native object.
+ * @param aManagerHandle Handle to native global manager.
+ */
+ SoundSource3DImpl(int aEventSourceHandle,
+ int aNativeHandle,
+ int aManagerHandle)
+ {
+ super(aEventSourceHandle,
+ aNativeHandle,
+ aManagerHandle);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/SpectatorImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms;
+
+import javax.microedition.media.Controllable;
+
+/**
+ * SpectatorImpl provides functionality defined in Spectator class.
+ * This class is used through Controllable interface which methods are
+ * implemented in ModuleBase.
+ */
+class SpectatorImpl extends ModuleBase implements Controllable
+{
+ /**
+ * Constructs new SpectatorImpl instance.
+ * @param aEventSourceHandle Handle to event source.
+ * @param aNativeHandle Handle to corresponding native object.
+ */
+ SpectatorImpl(int aEventSourceHandle,
+ int aNativeHandle)
+ {
+ // use empty constructor which don't register this object for
+ // finalization. Finalization is not needed because spectator's
+ // is singleton class in the global manager.
+ init(aEventSourceHandle,
+ aNativeHandle);
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/ControlImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for all AMMS controls.
+*
+*/
+
+package com.nokia.amms.control;
+
+import javax.microedition.media.Control;
+import com.nokia.amms.ModuleBase;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * Base class for all AMMS controls.
+ */
+public class ControlImpl implements Control
+{
+ protected int iControlHandle;
+ protected int iEventSource;
+ // Module that owns this control. Storing the reference to the module
+ // will prevent the garbage collector from deleting the module if some
+ // controls are still used.
+ protected ModuleBase iModule;
+
+ protected static final int NO_ERROR = 0;
+ protected static final int NOT_READY = -18;
+ protected static final int NOT_FOUND = -1;
+ protected static final int NOT_SUPPORTED = -5;
+
+ /**
+ * Constructor
+ */
+ protected ControlImpl()
+ {
+ }
+
+ /**
+ * Initializes control with event source and native implementation handles.
+ * @param aEventSource Handle to native event source.
+ * @param aControl Handle to native control implementation.
+ * @param aModule Module that owns this control.
+ */
+ public void initControl(int aEventSource,
+ int aControlHandle,
+ ModuleBase aModule)
+ {
+ iEventSource = aEventSource;
+ iControlHandle = aControlHandle;
+ iModule = aModule;
+
+ Logger.LOG(Logger.EJavaMMAPI,
+ Logger.EInfo,
+ "created: " + toString() + " handle = " + aControlHandle);
+ }
+
+ /**
+ * Invalidates the control. Using this control after invalidating
+ * throws a RuntimeException.
+ */
+ public void invalidateControl()
+ {
+ iControlHandle = 0;
+ }
+
+
+ public void checkValid()
+ {
+ if ((iEventSource == 0) || (iControlHandle == 0))
+ {
+ throw new IllegalStateException("Control creation failed");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/EffectControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for Effect controls
+*
+*/
+
+package com.nokia.amms.control;
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.NativeError;
+
+public class EffectControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.EffectControl
+{
+ /**
+ * Constructor
+ */
+ public EffectControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setEnabled(boolean aEnable)
+ {
+ checkValid();
+
+ int err = _setEnabled(iEventSource, iControlHandle, aEnable);
+
+ if (err == NOT_READY)
+ {
+ throw new IllegalStateException(
+ "Enabling effect failed: Symbian OS error " + err);
+ }
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isEnabled()
+ {
+ checkValid();
+
+ // must ask the actual value from the native side
+ // because the effect can be dropped (if it's not enforced)
+
+ int err = _isEnabled(iEventSource, iControlHandle);
+ NativeError.check(err);
+
+ return err != 0;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setScope(int aScope) throws MediaException
+ {
+ checkValid();
+
+ String KScopeNotSupported = "Only SCOPE_LIVE_ONLY scope is supported";
+
+ // Only SCOPE_LIVE_ONLY is supported at the moment.
+ if (aScope != SCOPE_LIVE_ONLY)
+ {
+ throw new MediaException(KScopeNotSupported);
+ }
+
+ int err = _setScope(iEventSource, iControlHandle, aScope);
+ if (err < NO_ERROR)
+ {
+ if (err == NOT_READY)
+ {
+ throw new IllegalStateException(
+ "Setting scope failed: Symbian OS error " + err);
+ }
+ else if (err == NOT_SUPPORTED)
+ {
+ throw new MediaException(KScopeNotSupported);
+ }
+ else
+ {
+ NativeError.check(err);
+ }
+ }
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getScope()
+ {
+ checkValid();
+
+ int err = _getScope(iEventSource, iControlHandle);
+ NativeError.check(err);
+
+ return err;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setEnforced(boolean aEnforced)
+ {
+ checkValid();
+
+ int err = _setEnforced(iEventSource, iControlHandle, aEnforced);
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isEnforced()
+ {
+ checkValid();
+
+ int err = _isEnforced(iEventSource, iControlHandle);
+ NativeError.check(err);
+
+ return err != 0;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setPreset(String aPreset)
+ {
+ checkValid();
+
+ if (aPreset == null)
+ {
+ throw new IllegalArgumentException("Preset is null");
+ }
+
+ int err = _setPreset(iEventSource, iControlHandle, aPreset);
+
+ if (err == NOT_FOUND)
+ {
+ throw new IllegalArgumentException("Preset is not available");
+ }
+ else
+ {
+ NativeError.check(err);
+ }
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getPreset()
+ {
+ checkValid();
+
+ String[] preset = new String[1];
+ int err = _getPreset(iEventSource, iControlHandle, preset);
+ if (err < NO_ERROR)
+ {
+ throw new IllegalStateException();
+ }
+
+ return preset[0];
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String[] getPresetNames()
+ {
+ checkValid();
+
+ String[] presets = _getPresetNames(iEventSource, iControlHandle);
+
+ // native function must not return null, unless an error occures. If
+ // there is no supported types zero length array will be returned.
+ if (presets == null)
+ {
+ throw new OutOfMemoryError();
+ }
+ return presets;
+ }
+
+ // native methods
+ private static native int _setEnabled(
+ int aEventSource,
+ int aControlHandle,
+ boolean aEnable);
+ private static native int _isEnabled(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _setScope(
+ int aEventSource,
+ int aControlHandle,
+ int aScope);
+ private static native int _getScope(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _setEnforced(
+ int aEventSource,
+ int aControlHandle,
+ boolean aEnforced);
+ private static native int _isEnforced(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _setPreset(
+ int aEventSource,
+ int aControlHandle,
+ String aPreset);
+ private static native int _getPreset(
+ int aEventSource,
+ int aControlHandle,
+ String[] aPreset);
+ private static native String[] _getPresetNames(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/PanControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control;
+
+import com.nokia.microedition.media.NativeError;
+
+public class PanControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.PanControl
+{
+ private static final int MIN_PAN = -100;
+ private static final int MAX_PAN = 100;
+
+ /**
+ * Constructor
+ */
+ public PanControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setPan(int aPan)
+ {
+ checkValid();
+
+ int pan = aPan;
+ // Panning value that is out of range is set to the valid range.
+ if (pan < MIN_PAN)
+ {
+ pan = MIN_PAN;
+ }
+ if (pan > MAX_PAN)
+ {
+ pan = MAX_PAN;
+ }
+
+ // SetBalance method in native side returns a system wide error code.
+ int[] error = new int[ 1 ];
+ int value = _setPan(iEventSource, iControlHandle, pan, error);
+ NativeError.check(error[ 0 ]);
+
+ return value;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getPan()
+ {
+ checkValid();
+
+ int value = _getPan(iEventSource, iControlHandle);
+ // GetBalance method in native would return a system wide error code,
+ // but the panning value is just instead queried from the control group.
+
+ return value;
+ }
+
+ // native methods
+ private static native int _setPan(
+ int aEventSource,
+ int aControlHandle,
+ int aPan,
+ int[] aError);
+ private static native int _getPan(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/PriorityControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for adjusting player priorities.
+*
+*/
+
+package com.nokia.amms.control;
+
+import com.nokia.microedition.media.NativeError;
+import javax.microedition.media.Player;
+
+/**
+ * Control for adjusting player priorities.
+ */
+public class PriorityControl
+ extends ControlImpl
+ implements javax.microedition.amms.control.PriorityControl
+{
+ private static final int MIN_PRIORITY = 0;
+ private static final int MAX_PRIORITY = 100;
+
+ // The player owning this control.
+ private Player iPlayer;
+
+
+ /**
+ * Constructor
+ */
+ public PriorityControl(Player aPlayer)
+ {
+ iPlayer = aPlayer;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setPriority(int aPriority)
+ {
+ checkValid();
+
+ int priority = aPriority;
+ // Panning value that is out of range is set to the valid range.
+ if (aPriority < MIN_PRIORITY ||
+ aPriority > MAX_PRIORITY)
+ {
+ throw new IllegalArgumentException(
+ "Priority must be between 0 and 100");
+ }
+
+ // Priority setting in native side returns a system wide error code.
+ int error = _setPriority(iEventSource, iControlHandle, aPriority);
+ NativeError.check(error);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getPriority()
+ {
+ checkValid();
+
+ int value = _getPriority(iEventSource, iControlHandle);
+
+ return value;
+ }
+
+ public void checkValid()
+ {
+ super.checkValid();
+
+ if (iPlayer.getState() == Player.CLOSED)
+ {
+ throw new IllegalStateException("Player is closed.");
+ }
+ }
+
+ // native methods
+ private static native int _setPriority(
+ int aEventSource,
+ int aControlHandle,
+ int aPriority);
+ private static native int _getPriority(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/VolumeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.amms.control;
+
+import com.nokia.amms.AMMSError;
+
+public class VolumeControl extends ControlImpl
+ implements javax.microedition.media.control.VolumeControl
+{
+ private static final int MAX_VOLUME = 100;
+ private int iLevel = MAX_VOLUME;
+ private boolean iMuted = false;
+
+ /**
+ * Constructor
+ */
+ public VolumeControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isMuted()
+ {
+ checkValid();
+ return iMuted;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getLevel()
+ {
+ checkValid();
+ return iLevel;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setLevel(int aLevel)
+ {
+ checkValid();
+ int level = aLevel;
+
+ // Set level to between 0 and 100
+ if (level < 0)
+ {
+ level = 0;
+ }
+ else if (level > MAX_VOLUME)
+ {
+ level = MAX_VOLUME;
+ }
+
+ if (!iMuted)
+ {
+ AMMSError.check(_setLevel(iEventSource,
+ iControlHandle,
+ level));
+ }
+ iLevel = level;
+ return level;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setMute(boolean aMuted)
+ {
+ checkValid();
+
+ // Check if mute status is changed
+ if (aMuted != iMuted)
+ {
+ iMuted = aMuted;
+
+ int level = iLevel;
+
+ // If mute is on set volume to 0, otherwise set to level set before
+ if (iMuted)
+ {
+ level = 0;
+ }
+
+ AMMSError.check(_setLevel(iEventSource,
+ iControlHandle,
+ level));
+ }
+ }
+
+ /**
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aControlHandle Handle to native control.
+ * @param aLevel New volume level.
+ */
+ private static native int _setLevel(int aEventSourceHandle,
+ int aControlHandle,
+ int aLevel);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audio3d/CommitControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audio3d;
+
+import com.nokia.microedition.media.NativeError;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public class CommitControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audio3d.CommitControl
+{
+ // data
+ private boolean iIsDeferred = false;
+
+ /**
+ * Constructor
+ */
+ public CommitControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setDeferred(boolean aDeferred)
+ {
+ checkValid();
+
+ int err = _setDeferred(iEventSource, iControlHandle, aDeferred);
+
+ // check error
+ NativeError.check(err);
+
+ iIsDeferred = aDeferred;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isDeferred()
+ {
+ checkValid();
+
+ return iIsDeferred;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void commit()
+ {
+ checkValid();
+
+ int err = _commit(iEventSource, iControlHandle);
+
+ // check error
+ NativeError.check(err);
+ }
+
+ // native function
+ private static native int _setDeferred(int aEventSource, int aControlHandle, boolean aDeferred);
+ private static native int _commit(int aEventSource, int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audio3d/DistanceAttenuationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audio3d;
+
+import com.nokia.microedition.media.NativeError;
+
+public class DistanceAttenuationControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audio3d.DistanceAttenuationControl
+{
+ private static final int MIN_MINIMUM_DISTANCE = 1;
+ private static final int MIN_MAXIMUM_DISTANCE = 1;
+ private static final int MIN_ROLLOF_FACTOR = 0;
+ /**
+ * Constructor
+ */
+ public DistanceAttenuationControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setParameters(int aMinDistance,
+ int aMaxDistance,
+ boolean aMuteAfterMax,
+ int aRolloffFactor)
+ {
+ checkValid();
+
+ if (aMaxDistance <= aMinDistance)
+ {
+ throw new IllegalArgumentException("maxDistance must be equal or greater than minDistance");
+ }
+ if (aMinDistance < MIN_MINIMUM_DISTANCE)
+ {
+ throw new IllegalArgumentException("minDistance must be greater than zero");
+ }
+ if (aMaxDistance < MIN_MAXIMUM_DISTANCE)
+ {
+ throw new IllegalArgumentException("maxDistance must be greater than zero");
+ }
+ if (aRolloffFactor < MIN_ROLLOF_FACTOR)
+ {
+ throw new IllegalArgumentException("rolloffFactor cannot be less than zero");
+ }
+
+ int err = _setParameters(iEventSource, iControlHandle,
+ aMinDistance, aMaxDistance, aMuteAfterMax, aRolloffFactor);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinDistance()
+ {
+ checkValid();
+
+ // have to ask the native control because of commiting
+ return _getMinDistance(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxDistance()
+ {
+ checkValid();
+
+ // have to ask the native control because of commiting
+ return _getMaxDistance(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean getMuteAfterMax()
+ {
+ checkValid();
+
+ // have to ask the native control because of commiting
+ return _getMuteAfterMax(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getRolloffFactor()
+ {
+ checkValid();
+
+ // have to ask the native control because of commiting
+ return _getRolloffFactor(iEventSource, iControlHandle);
+ }
+
+ // native functions
+ private static native int _setParameters(
+ int aEventSource,
+ int aControlHandle,
+ int aMinDistance,
+ int aMaxDistance,
+ boolean aMuteAfterMax,
+ int aRolloffFactor);
+ private static native int _getMaxDistance(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _getMinDistance(
+ int aEventSource,
+ int aControlHandle);
+ private static native boolean _getMuteAfterMax(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _getRolloffFactor(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audio3d/DopplerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audio3d;
+
+import com.nokia.microedition.media.NativeError;
+
+public class DopplerControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audio3d.DopplerControl
+{
+ /**
+ * Constructor
+ */
+ public DopplerControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isEnabled()
+ {
+ checkValid();
+
+ // have to ask the native control because of commiting
+ return _isEnabled(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getVelocityCartesian()
+ {
+ checkValid();
+
+ int[] error = new int[ 1 ];
+ // have to ask the native control because of commiting
+ int[] velocity = _getVelocityCartesian(iEventSource,
+ iControlHandle,
+ error);
+ if (velocity == null)
+ {
+ // couldn't allocate memory
+ throw new OutOfMemoryError("Unable to obatin velocity.");
+ }
+
+ NativeError.check(error[ 0 ]);
+
+ return velocity;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setEnabled(boolean aDopplerEnabled)
+ {
+ checkValid();
+
+ int err = _setEnabled(iEventSource, iControlHandle, aDopplerEnabled);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setVelocityCartesian(int aX, int aY, int aZ)
+ {
+ checkValid();
+
+ int err = _setVelocityCartesian(iEventSource, iControlHandle, aX, aY, aZ);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setVelocitySpherical(int aAzimuth, int aElevation, int aRadius)
+ {
+ checkValid();
+
+ int err = _setVelocitySpherical(
+ iEventSource,
+ iControlHandle,
+ aAzimuth,
+ aElevation,
+ aRadius);
+
+ NativeError.check(err);
+ }
+
+ private static native boolean _isEnabled(
+ int aEventSource,
+ int aControlHandle);
+ private static native int[] _getVelocityCartesian(
+ int aEventSource,
+ int aControlHandle,
+ int[] aError);
+ private static native int _setEnabled(
+ int aEventSource,
+ int aControlHandle,
+ boolean dopplerEnabled);
+ private static native int _setVelocityCartesian(
+ int aEventSource,
+ int aControlHandle,
+ int x,
+ int y,
+ int z);
+ private static native int _setVelocitySpherical(
+ int aEventSource,
+ int aControlHandle,
+ int azimuth,
+ int elevation,
+ int radius);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audio3d/LocationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audio3d;
+
+import com.nokia.microedition.media.NativeError;
+
+public class LocationControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audio3d.LocationControl
+{
+ private static final int MIN_RADIUS = 0;
+
+ /**
+ * Constructor
+ */
+ public LocationControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setCartesian(int aX, int aY, int aZ)
+ {
+ checkValid();
+
+ int err = _setCartesian(iEventSource, iControlHandle, aX, aY, aZ);
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setSpherical(int aAzimuth, int aElevation, int aRadius)
+ {
+ checkValid();
+
+ if (aRadius < MIN_RADIUS)
+ {
+ throw new IllegalArgumentException("Radius cannot be less than zero");
+ }
+
+ int err = _setSpherical(
+ iEventSource,
+ iControlHandle,
+ aAzimuth,
+ aElevation,
+ aRadius);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getCartesian()
+ {
+ checkValid();
+
+ int[] error = new int[ 1 ];
+ int[] location = _getCartesian(iEventSource, iControlHandle, error);
+ if (location == null)
+ {
+ throw new OutOfMemoryError("Unable to obtain coordinates");
+ }
+
+ NativeError.check(error[ 0 ]);
+
+ return location;
+ }
+
+ private static native int[] _getCartesian(
+ int aEventSource,
+ int aControlHandle,
+ int[] aError);
+ private static native int _setCartesian(
+ int aEventSource,
+ int aControlHandle,
+ int x,
+ int y,
+ int z);
+ private static native int _setSpherical(
+ int aEventSource,
+ int aControlHandle,
+ int azimuth,
+ int elevation,
+ int radius);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audio3d/OrientationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audio3d;
+
+import com.nokia.microedition.media.NativeError;
+
+public class OrientationControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audio3d.OrientationControl
+{
+ private static final int REQUIRED_VECTOR_SIZE = 3;
+ private static final int COMPONENT_X = 0;
+ private static final int COMPONENT_Y = 1;
+ private static final int COMPONENT_Z = 2;
+
+ /**
+ * Constructor
+ */
+ public OrientationControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setOrientation(int aHeading, int aPitch, int aRoll)
+ {
+ checkValid();
+
+ int err = _setOrientation(
+ iEventSource,
+ iControlHandle,
+ aHeading,
+ aPitch,
+ aRoll);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setOrientation(int[] aFrontVector, int[] aAboveVector)
+ throws IllegalArgumentException
+ {
+ checkValid();
+
+ if ((aFrontVector == null) ||
+ (aAboveVector == null))
+ {
+ throw new IllegalArgumentException("Argument is null");
+ }
+
+ if ((aFrontVector.length < REQUIRED_VECTOR_SIZE) ||
+ (aAboveVector.length < REQUIRED_VECTOR_SIZE) ||
+ (aFrontVector.length > REQUIRED_VECTOR_SIZE) ||
+ (aAboveVector.length > REQUIRED_VECTOR_SIZE))
+ {
+ throw new IllegalArgumentException("Required orientation vector size is 3");
+ }
+
+ // Vector is a zero vector if all the components are zero
+ if (((aFrontVector[ COMPONENT_X ] == 0) &&
+ (aFrontVector[ COMPONENT_Y ] == 0) &&
+ (aFrontVector[ COMPONENT_Z ] == 0)) ||
+ ((aAboveVector[ COMPONENT_X ] == 0) &&
+ (aAboveVector[ COMPONENT_Y ] == 0) &&
+ (aAboveVector[ COMPONENT_Z ] == 0)))
+ {
+ throw new IllegalArgumentException("Orientation vector cannot be a zero vector");
+ }
+
+ // Two vectors are parallel if their cross product is zero vector.
+ // Cross product of vectors a1*i + a2*j + a3*k and b1*i + b2*j + b3*k :
+ // (a2*b3 - a3*b2)i + (a3*b1 - a1*b3)j + (a1*b2 - a2*b1)k
+ if ((
+ (aFrontVector[ COMPONENT_Y ] * aAboveVector[ COMPONENT_Z ]) -
+ (aFrontVector[ COMPONENT_Z ] * aAboveVector[ COMPONENT_Y ]) == 0
+ )
+ &&
+ (
+ (aFrontVector[ COMPONENT_Z ] * aAboveVector[ COMPONENT_X ]) -
+ (aFrontVector[ COMPONENT_X ] * aAboveVector[ COMPONENT_Z ]) == 0
+ )
+ &&
+ (
+ (aFrontVector[ COMPONENT_X ] * aAboveVector[ COMPONENT_Y ]) -
+ (aFrontVector[ COMPONENT_Y ] * aAboveVector[ COMPONENT_X ]) == 0
+ ))
+ {
+ throw new IllegalArgumentException("Orientation vectors cannot be parallel");
+ }
+
+ int err = _setOrientationVectors(
+ iEventSource,
+ iControlHandle,
+ aFrontVector,
+ aAboveVector);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getOrientationVectors()
+ {
+ checkValid();
+
+ int[] error = new int[ 1 ];
+
+ int[] orientation = _getOrientationVectors(
+ iEventSource,
+ iControlHandle,
+ error);
+
+ if (error[ 0 ] != NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError("Obtaining orientation vectors failed: Symbian OS error " +
+ error[ 0 ]);
+ }
+
+ if (orientation == null)
+ {
+ throw new OutOfMemoryError("Unable to obtain orientation vectors");
+ }
+ return orientation;
+ }
+
+ private static native int _setOrientation(
+ int aEventSource,
+ int aControlHandle,
+ int heading,
+ int pitch,
+ int roll);
+
+ private static native int _setOrientationVectors(
+ int aEventSource,
+ int aControlHandle,
+ int[] frontVector,
+ int[] aboveVector);
+
+ private static native int[] _getOrientationVectors(
+ int aEventSource,
+ int aControlHandle,
+ int[] error);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audioeffect/AudioVirtualizerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audioeffect;
+
+public class AudioVirtualizerControl
+ extends com.nokia.amms.control.EffectControl
+ implements javax.microedition.amms.control.audioeffect.AudioVirtualizerControl
+{
+ /**
+ * Constructor
+ */
+ public AudioVirtualizerControl()
+ {
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audioeffect/EqualizerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audioeffect;
+
+import com.nokia.microedition.media.NativeError;
+
+public class EqualizerControl
+ extends com.nokia.amms.control.EffectControl
+ implements javax.microedition.amms.control.audioeffect.EqualizerControl
+{
+ private static final int MAX_LEVEL = 100;
+ private static final int MIN_LEVEL = 0;
+
+ /**
+ * Constructor
+ */
+ public EqualizerControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinBandLevel()
+ {
+ checkValid();
+
+ return _getMinBandLevel(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxBandLevel()
+ {
+ checkValid();
+
+ return _getMaxBandLevel(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setBandLevel(int aLevel, int aBand)
+ throws IllegalArgumentException
+ {
+ checkValid();
+
+ int err = _setBandLevel(iEventSource, iControlHandle, aLevel, aBand);
+
+ // throws IllegalArgumentException on KErrArgument
+ NativeError.check(err);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getBandLevel(int aBand) throws IllegalArgumentException
+ {
+ checkValid();
+
+ int[] level = new int[ 1 ];
+
+ int error = _getBandLevel(iEventSource, iControlHandle, aBand, level);
+
+ // throws IllegalArgumentException on KErrArgument
+ NativeError.check(error);
+
+ return level[ 0 ];
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getNumberOfBands()
+ {
+ checkValid();
+
+ return _getNumberOfBands(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getCenterFreq(int aBand) throws IllegalArgumentException
+ {
+ checkValid();
+
+ int err = _getCenterFreq(iEventSource, iControlHandle, aBand);
+ NativeError.check(err);
+
+ return err;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getBand(int aFrequency)
+ {
+ checkValid();
+
+ int band = _getBand(iEventSource, iControlHandle, aFrequency);
+
+ return band;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setBass(int aLevel) throws IllegalArgumentException
+ {
+ checkValid();
+
+ if (aLevel < MIN_LEVEL || aLevel > MAX_LEVEL)
+ {
+ throw new IllegalArgumentException("Bass level out of range");
+ }
+
+ int err = _setBass(iEventSource, iControlHandle, aLevel);
+ NativeError.check(err);
+
+ return err;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setTreble(int aLevel) throws IllegalArgumentException
+ {
+ checkValid();
+
+ if (aLevel < MIN_LEVEL || aLevel > MAX_LEVEL)
+ {
+ throw new IllegalArgumentException("Treble level out of range");
+ }
+
+ int err = _setTreble(iEventSource, iControlHandle, aLevel);
+ NativeError.check(err);
+ return err;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getBass()
+ {
+ checkValid();
+
+ return _getBass(iEventSource, iControlHandle);
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getTreble()
+ {
+ checkValid();
+
+ return _getTreble(iEventSource, iControlHandle);
+ }
+
+ private static native int _getMinBandLevel(
+ int iEventSource,
+ int iControlHandle);
+ private static native int _getMaxBandLevel(
+ int iEventSource,
+ int iControlHandle);
+ private static native int _setBandLevel(
+ int iEventSource,
+ int iControlHandle,
+ int level,
+ int band);
+ private static native int _getBandLevel(
+ int iEventSource,
+ int iControlHandle,
+ int band,
+ int[] level);
+ private static native int _getCenterFreq(
+ int iEventSource,
+ int iControlHandle,
+ int band);
+ private static native int _getBand(
+ int iEventSource,
+ int iControlHandle,
+ int frequency);
+ private static native int _setBass(
+ int iEventSource,
+ int iControlHandle,
+ int level);
+ private static native int _setTreble(
+ int iEventSource,
+ int iControlHandle,
+ int level);
+ private static native int _getBass(
+ int iEventSource,
+ int iControlHandle);
+ private static native int _getTreble(
+ int iEventSource,
+ int iControlHandle);
+ private static native int _getNumberOfBands(
+ int iEventSource,
+ int iControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audioeffect/ReverbControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audioeffect;
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.NativeError;
+
+public class ReverbControl
+ extends com.nokia.amms.control.EffectControl
+ implements javax.microedition.amms.control.audioeffect.ReverbControl
+{
+ private static final int MAX_REVERB_LEVEL = 0;
+ private static final int MIN_REVERB_TIME = 0;
+
+ /**
+ * Constructor
+ */
+ public ReverbControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setReverbLevel(int aLevel) throws IllegalArgumentException
+ {
+ checkValid();
+
+ if (aLevel > MAX_REVERB_LEVEL)
+ {
+ throw new IllegalArgumentException("Reverb level cannot be greater than zero.");
+ }
+
+ int err[] = new int[ 1 ];
+ int setLevel = _setReverbLevel(iEventSource,
+ iControlHandle,
+ aLevel,
+ err);
+ NativeError.check(err[ 0 ]);
+
+ return setLevel;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getReverbLevel()
+ {
+ checkValid();
+
+ int level = _getReverbLevel(iEventSource, iControlHandle);
+
+ return level;
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setReverbTime(int aTime)
+ throws IllegalArgumentException, MediaException
+ {
+ checkValid();
+
+ if (aTime < MIN_REVERB_TIME)
+ {
+ throw new IllegalArgumentException("Reverb time cannot be less than zero");
+ }
+
+ int err = _setReverbTime(iEventSource, iControlHandle, aTime);
+ if (err < NO_ERROR)
+ {
+ if (err == NOT_READY)
+ {
+ NativeError.check(err);
+ }
+ else
+ {
+ throw new MediaException(
+ "Setting reverb time failed: Symbian OS error " + err);
+ }
+ }
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getReverbTime() throws javax.microedition.media.MediaException
+ {
+ checkValid();
+
+ int time = _getReverbTime(iEventSource, iControlHandle);
+
+ if (time == NOT_SUPPORTED)
+ {
+ throw new MediaException(
+ "Obtaining reverb time failed: Symbian OS error " + time);
+ }
+
+ return time;
+ }
+
+ // native methods
+ private static native int _setReverbLevel(
+ int aEventSource,
+ int aControlHandle,
+ int aLevel,
+ int aError[]);
+ private static native int _getReverbLevel(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _setReverbTime(
+ int aEventSource,
+ int aControlHandle,
+ int aTime);
+ private static native int _getReverbTime(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/amms/control/audioeffect/ReverbSourceControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.amms.control.audioeffect;
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.NativeError;
+
+public class ReverbSourceControl
+ extends com.nokia.amms.control.ControlImpl
+ implements javax.microedition.amms.control.audioeffect.ReverbSourceControl
+{
+
+ /**
+ * Constructor
+ */
+ public ReverbSourceControl()
+ {
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setRoomLevel(int aLevel)
+ throws IllegalArgumentException, MediaException
+ {
+ checkValid();
+
+ if ((aLevel > 0) &&
+ (aLevel != DISCONNECT))
+ {
+ throw new IllegalArgumentException("Room level must be less than zero");
+ }
+
+ int level = aLevel;
+ int err = _setRoomLevel(iEventSource, iControlHandle, level);
+
+ if (err < NO_ERROR)
+ {
+ if (err == NOT_READY)
+ {
+ NativeError.check(err);
+ }
+ else
+ {
+ throw new MediaException(
+ "Room level cannot be set: Symbian OS error " + err);
+ }
+ }
+ }
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getRoomLevel()
+ {
+ checkValid();
+
+ return _getRoomLevel(iEventSource, iControlHandle);
+ }
+
+ // native methods
+ private static native int _setRoomLevel(
+ int aEventSource,
+ int aControlHandle,
+ int aLevel);
+
+ private static native int _getRoomLevel(
+ int aEventSource,
+ int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/mid/impl/media/AudioOutput.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for routing the player's audio output.
+*
+*/
+package com.nokia.mid.impl.media;
+//AudioOutput Class which has info regarding the Output mode and device type
+public class AudioOutput implements com.nokia.mid.media.AudioOutput
+{
+ //Constructor
+ public AudioOutput(int mode)
+ {
+ outputmode = mode;
+ }
+ //public
+ public int getActiveOutputMode()
+ {
+ return outputmode;
+ }
+ public int[] getOutputDevices()
+ {
+ return null;
+ }
+ //package access
+ void setOutputMode(int mode)
+ {
+ outputmode = mode;
+ }
+
+ //private
+ private int outputmode;
+
+
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/mid/impl/media/AudioOutputControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for routing the player's audio output.
+*
+*/
+package com.nokia.mid.impl.media;
+
+import com.nokia.microedition.media.NativeError;
+import javax.microedition.media.Player;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.*;
+import com.nokia.mid.impl.media.AudioOutput;
+
+/**
+ * Control for adjusting player's Audio output routing. Note : This doesn't have any interface defined in javax.microediton.amms.control package
+ * as its internal to nokia
+ */
+public class AudioOutputControl
+ extends com.nokia.amms.control.ControlImpl
+ implements com.nokia.mid.media.AudioOutputControl
+{
+ // The player owning this control.
+ private Player iPlayer;
+ private AudioOutput audioOutputObj;
+ /**
+ * Constructor
+ */
+ public AudioOutputControl(Player aPlayer)
+ {
+ iPlayer = aPlayer;
+ }
+
+ public void SetAudioOutputToNative()
+ {
+ // Create an AudioOutput object and pass it to native
+ audioOutputObj = new AudioOutput(AudioOutputControl.DEFAULT);
+ setAudioOutputObject(audioOutputObj);
+ }
+ /**
+ * Sets the new mode.
+ * Throws IllegalArgumentException if the argument is invalid
+ * @param mode The new Output mode to be set.
+ */
+ public int setOutputMode(int mode)
+ {
+ checkValid();
+ int value = _setOutputMode(iEventSource, iControlHandle, mode);
+ NativeError.check(value);
+ return value;
+ }
+
+ /**
+ * Gets the previous set mode by user.
+ *
+ * @return The last set user mode .
+ */
+ public int getOutputMode()
+ {
+ checkValid();
+ int value = _getOutputMode(iEventSource, iControlHandle);
+ return value;
+ }
+
+ /**
+ * Gets the actual routing at that time.
+ * @return The current preference.
+ */
+
+ public com.nokia.mid.media.AudioOutput getCurrent()
+ {
+ checkValid();
+ int value = _getCurrent(iEventSource, iControlHandle);
+ NativeError.check(value);
+ return audioOutputObj;
+ }
+
+ /**
+ * @return all the available output modes.
+ */
+ public int[] getAvailableOutputModes()
+ {
+ checkValid();
+ int[] availableOutputModes = { DEFAULT, ALL, NONE, PRIVATE, PUBLIC };
+ return availableOutputModes;
+ }
+
+
+ public void checkValid()
+ {
+ super.checkValid();
+
+ if (iPlayer.getState() == Player.CLOSED)
+ {
+ throw new IllegalStateException("Closed player");
+ }
+ }
+ /**
+ * pass the AudioOutput object to native
+ */
+ public void setAudioOutputObject(AudioOutput obj)
+ {
+ checkValid();
+ int value = _setAudioOutputObject(iEventSource, iControlHandle, obj);
+ NativeError.check(value);
+ }
+
+
+ // native methods
+ private static native int _setOutputMode(
+ int aEventSource,
+ int aControlHandle,
+ int aMode);
+ private static native int _getOutputMode(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _getCurrent(
+ int aEventSource,
+ int aControlHandle);
+ private static native int _setAudioOutputObject(
+ int aEventSource, int aControlHandle,
+ AudioOutput audioOutputObj);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/mid/media/AudioOutput.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for routing the player's audio output.
+*
+*/
+
+package com.nokia.mid.media;
+
+/**
+ * <code>AudioOutput</code>
+ * Encapsulates current audio output mode and output device(s) used.
+ * <p>
+ * <p>
+ * @since 1.4
+ * <p>
+ */
+public interface AudioOutput
+{
+ /**
+ * Get active output mode.
+ * <p>
+ * The different modes are defined in AudioOutputControl class.
+ *
+ * @return The current audio output mode or -1 if unable to determine
+ *
+ * @exception SecurityException with message "Permission denied" if the
+ * called does not have permission to set the audio routing.
+ */
+ public int getActiveOutputMode();
+
+ /**
+ * Get supported output devices
+ * <p>
+ * returns array of audio output device types if it is supported
+ * otherwise returns "null"
+ */
+ public int[] getOutputDevices();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/com/nokia/mid/media/AudioOutputControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for routing the player's audio output.
+*
+*/
+
+package com.nokia.mid.media;
+
+/**
+ * <code>AudioOutputControl</code> is an interface for setting application
+ * preferred audio output mode.
+ * <p>
+ * <strong><u>SYMBIAN SPECIFIC BEHAVIOR:</u></strong> <BR><BR>
+ * Audio output mode is within the scope of a player instance and can be set
+ * when the MIDlet which set the audio routing is finished with the audio
+ * when the player is in REALIZED, PREFETCHED, STARTED or STOPPED state.
+ * The preferences are applied or imposed when media is played. <BR><BR>
+ * Audio output control is retrieved using 'Player' interface by calling
+ * <code>Control getControl ( java.lang.string controlType ) </code>
+ * The control type to be passed as an argument is
+ * <code>com.nokia.mid.media.AudioOutputControl</code>
+ * <p>
+ * <strong><u>S40 SPECIFIC BEHAVIOR:</u></strong> <BR><BR>
+ * The AudioOutputControl is a Global Control and will effect all players.
+ * When the MIDlet which set the audio routing is finished with the audio
+ * change then it must set it back to DEFAULT.
+ * <p>
+ * Audio output control is retrieved using 'GlobalManager' interface by calling
+ * <code>Control getControl ( java.lang.string controlType ) </code>
+ * The control type to be passed as an argument is
+ * <code>com.nokia.mid.media.AudioOutputControl</code>
+ * <p>
+ * <strong><u>Code Snippet:</u></strong><BR>
+ * <BR>
+ * <strong><u>1. Getting AudioOutputControl:</u></strong><BR><BR>
+ * <strong><u>In SYMBIAN:</u></strong> <BR><BR>
+ * <code>Player p =
+ * Manager.createPlayer(getClass().getResourceAsStream
+ * ("nokia_tune.mid"), "audio/midi"); <BR>
+ * p.realize(); <BR>
+ * AudioOutputControl iAudioOutputControl=
+ * (AudioOutputControl)p.getControl("com.nokia.mid.media.AudioOutputControl");<BR>
+ * p.addPlayerListener(this); </code> <BR> <BR>
+ * <strong><u>In S40:</u></strong> <BR><BR>
+ * <code>import javax.microedition.amms.*; <BR>
+ * iAudioOutputControl = (AudioOutputControl) GlobalManager.getControl("com.nokia.mid.media.AudioOutputControl"); <BR>
+ * </code> <BR> <BR>
+ * <strong><u>2. Setting and getting Audio Output Mode:</u></strong> <BR><BR>
+ * <strong><u>2.1 Setting PRIVATE mode:</u></strong> <BR><BR>
+ * <code>iAudioOutputControl.setOutputMode(PRIVATE);</code><BR> <BR>
+ * <strong><u>2.2 Getting Current Mode:</u></strong> <BR><BR>
+ * <code>AudioOutput audioOutput = iAudioOutputControl.getCurrent();</code><BR>
+ * <code>int mode = audioOutput.getOutputMode();</code> <BR><BR>
+ * <strong><u>3. Getting notification:</u></strong> <BR><BR>
+ * Notifications are supported only on SYMBIAN. <BR>
+ * The notification about the preference change is done using
+ * PlayerListener's playerUpdate() function.
+ * Whereas, this specific Event type is "com.nokia.audiooutputchange.event"
+ * and Event data is AudioOutput object. <BR><BR>
+ * <code>
+ * public void playerUpdate(Player aPlayer, String aEvent, Object aEventData){<BR>
+ * <DD>if(aEvent.equals("com.nokia.audiooutputchange.event")){ </DD>
+ * <DD><DD>helloForm.append("com.nokia.audiooutputchange.event"); </DD></DD>
+ * <DD><DD>// get the mode </DD></DD>
+ * <DD><DD>Int mode = ((AudioOutput)aEventData).getActiveOutputMode();</DD></DD>
+ * <DD>}</DD><BR>
+ * } </code> <BR>
+ * <p>
+ * <p>
+ * @since 1.4
+ * <p>
+ */
+
+
+public interface AudioOutputControl extends javax.microedition.media.Control
+{
+ /**
+ * The DEFAULT audio output mode.
+ * <p>
+ * No Preference. The audio routing is restored to the default value.
+ * <p>
+ * Value 0 is assigned to <code>DEFAULT</code>.
+ * <p>
+ * <strong><u>SYMBIAN SPECIFIC BEHAVIOR:</u></strong> <BR>
+ * Audio is by default routed to loudspeaker.
+ * Audio output changes dynamically to headset, when headset is connected to
+ * the device and vice versa. Application is notified about audio output
+ * change with audio output change event.
+ * <p>
+ */
+ public static final int DEFAULT = 0;
+
+ /**
+ * The ALL audio output mode.
+ * <p>
+ * Audio is routed to one public and one private output at the same time.
+ * The primary output method within public and private outputs is selected
+ * by the device and can change dynamically when external peripherals are
+ * connected or disconnected by the user (see "public" and "private" for
+ * their priorities).
+ * <p>
+ * Value 1 is assigned to <code>ALL</code>.
+ */
+ public static final int ALL = 1;
+
+ /**
+ * The NONE audio output mode.
+ * <p>
+ * Audio is not routed to any output.
+ * <p>
+ * Value 2 is assigned to <code>NONE</code>.
+ */
+ public static final int NONE = 2;
+
+ /**
+ * The PRIVATE audio output mode.
+ * <p>
+ * Audio is routed to earpiece or wired / wireless(BT) headset if connected.
+ * If there are several private output methods available at the same time
+ * audio is routed to only one of those selected with following priority
+ * order 1) wired headset 2) wireless headset 3) earpiece.
+ * <p>
+ * Value 3 is assigned to <code>PRIVATE</code>.
+ */
+ public static final int PRIVATE = 3;
+
+ /**
+ * The PUBLIC audio output mode.
+ * <p>
+ * Audio is routed to loudspeaker, wireless(BT) speakers or TV output. If
+ * there are several public output methods available at the same time
+ * audio is routed to only one of those selected with following priority
+ * order: (1) wired headset 2) Loudspeaker
+ * <p>
+ * Value 4 is assigned to <code>PUBLIC</code>.
+ */
+ public static final int PUBLIC = 4;
+
+ /**
+ * Get all supported audio output modes
+ * <p>
+ * @return The currently supported output modes
+ * <p>
+ */
+ int[] getAvailableOutputModes();
+
+ /**
+ * Get the currently set audio output mode. This is the last audioOutputMode
+ * sent to setOutputMode or DEFAULT if none has been set.
+ * <p>
+ * This does not return the actual audio output mode of the device. The
+ * AudioOutput can be used to provide the actual audio output mode.
+ *
+ * @return The last audio output mode which was sent to setOutputMode.
+ */
+ int getOutputMode();
+
+ /**
+ * returns an AudioOutput object which consists
+ * Device Type and the mode of the audio output
+ */
+ com.nokia.mid.media.AudioOutput getCurrent();
+
+ /**
+ * Sets the preferred audio output mode.
+ * <p>
+ *
+ * @return audio output mode set or -1 if unable to set
+ *
+ * @exception IllegalArgumentException with message "audio output mode is
+ * not valid" when the audio output mode is not valid
+ *
+ * @exception IllegalStateException with message "Accessory connected" if
+ * unable to change the audio routing due to an accessory connected
+ *
+ * @exception SecurityException with message "Permission denied" if the
+ * called does not have permission to set the audio routing.
+ * <p>
+ * <strong><u>SYMBIAN SPECIFIC BEHAVIOR:</u></strong> <BR>
+ * This effects only a specific player instance.
+ * Preference can be set when Player is in REALIZED, PREFETCHED,
+ * STARTED or STOPPED state.
+ * <p>
+ * <strong><u>S40 SPECIFIC BEHAVIOR:</u></strong> <BR>
+ * This will effect all players
+ */
+ int setOutputMode(int mode);
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/EffectModule.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface EffectModule extends Module
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/GlobalManager.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+import javax.microedition.amms.control.audio3d.LocationControl;
+import javax.microedition.amms.control.FormatControl;
+import javax.microedition.media.*;
+
+// Implementation
+import com.nokia.amms.GlobalManagerImpl;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public class GlobalManager
+{
+ /**
+ * Static spectator instance. Returned from getSpectator method.
+ */
+ private static Spectator iSpectator;
+
+ /**
+ * Implementation. All method calls in this class will be delegated
+ * GlobalManagerImpl.
+ */
+ private static GlobalManagerImpl iManagerImpl;
+
+ static
+ {
+ // Get static instance.
+ iManagerImpl = GlobalManagerImpl.getInstance();
+
+ // Spectator delegates all method calls to spectator got from
+ // GlobalManagerImpl
+ iSpectator = new Spectator(iManagerImpl.getSpectator());
+ }
+
+ /**
+ * Private not allow construction
+ */
+ private GlobalManager()
+ {
+ }
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static Control[] getControls()
+ {
+ return iManagerImpl.getControls();
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static Control getControl(String aControlType)
+ {
+ return iManagerImpl.getControl(aControlType);
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static EffectModule createEffectModule() throws MediaException
+ {
+ return iManagerImpl.createEffectModule();
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static SoundSource3D createSoundSource3D() throws MediaException
+ {
+ return iManagerImpl.createSoundSource3D();
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static String[] getSupportedSoundSource3DPlayerTypes()
+ {
+ return iManagerImpl.getSupportedSoundSource3DPlayerTypes();
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static Spectator getSpectator() throws MediaException
+ {
+ return iSpectator;
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static MediaProcessor createMediaProcessor(String aContentType)
+ throws MediaException
+ {
+ return iManagerImpl.createMediaProcessor(aContentType);
+ }
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static String[] getSupportedMediaProcessorInputTypes()
+ {
+ return iManagerImpl.getSupportedMediaProcessorInputTypes();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/MediaProcessor.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+import javax.microedition.media.*;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface MediaProcessor extends Controllable
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final int UNKNOWN = -1;
+
+ /**
+ * Please refer JSR 234 for more details.
+ *
+ */
+ public final int UNREALIZED = 100;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final int REALIZED = 200;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final int STARTED = 400;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final int STOPPED = 300;
+
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ *
+ */
+ public void setInput(InputStream input, int length) throws javax.microedition.media.MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ *
+ */
+ public void setInput(Object image) throws javax.microedition.media.MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void setOutput(OutputStream output);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void start() throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void stop() throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void complete() throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void abort();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void addMediaProcessorListener(MediaProcessorListener mediaProcessorListener);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void removeMediaProcessorListener(MediaProcessorListener mediaProcessorListener);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public int getProgress();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public int getState();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/MediaProcessorListener.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,43 @@
+package javax.microedition.amms;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface MediaProcessorListener
+{
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSOR_REALIZED = "processRealized";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSING_STARTED = "processingStarted";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSING_STOPPED = "processingStopped";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSING_ABORTED = "processingAborted";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSING_COMPLETED = "processingCompleted";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final String PROCESSING_ERROR = "processingError";
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void mediaProcessorUpdate(MediaProcessor processor, String event, Object eventData);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/Module.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+import javax.microedition.media.*;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface Module extends Controllable
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void addMIDIChannel(Player player, int channel)
+ throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void removeMIDIChannel(Player player, int channel);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void addPlayer(Player player) throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void removePlayer(Player player);
+
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/SoundSource3D.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface SoundSource3D extends Module
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/Spectator.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms;
+
+import javax.microedition.media.Controllable;
+import javax.microedition.media.Control;
+import javax.microedition.amms.control.audio3d.LocationControl;
+
+
+/**
+ * Please refer JSR 234 for more details.
+ *
+ */
+public class Spectator implements Controllable
+{
+ /**
+ * All method calls are delegated to this Controllable object
+ */
+ private Controllable iControllable;
+
+ /**
+ * Package private constructor. Can be used only from GlobalManager.
+ * @param aControllable Used to delegate all operations.
+ */
+ Spectator(Controllable aControllable)
+ {
+ iControllable = aControllable;
+ }
+
+ /**
+ * From JSR. This is never called. Added to state that constructor
+ * is private.
+ */
+ private Spectator()
+ {
+ }
+
+ /**
+ * From JSR
+ */
+ public Control getControl(java.lang.String aControlType)
+ {
+ return iControllable.getControl(aControlType);
+ }
+
+ /**
+ * From JSR
+ */
+ public Control[] getControls()
+ {
+ return iControllable.getControls();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/AudioFormatControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface AudioFormatControl extends FormatControl
+{
+
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/ContainerFormatControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface ContainerFormatControl extends FormatControl
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ *
+ */
+ void setFormat(String format);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/EffectControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.*;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface EffectControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final int SCOPE_LIVE_ONLY = 1;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final int SCOPE_RECORD_ONLY = 2;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public static final int SCOPE_LIVE_AND_RECORD = 3;
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void setEnabled(boolean enable);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void setScope(int scope) throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public int getScope();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void setEnforced(boolean enforced);
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public boolean isEnforced();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ void setPreset(String preset);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public String getPreset();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public String[] getPresetNames();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/EffectOrderControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface EffectOrderControl extends Control
+{
+
+ /**
+ Please refer JSR 234 for more details.
+ */
+ public int setEffectOrder(EffectControl effect, int order);
+
+ /**
+ Please refer JSR 234 for more details.
+ */
+ public int getEffectOrder(EffectControl effect);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public EffectControl[] getEffectOrders();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/FormatControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.*;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface FormatControl extends Control
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static int METADATA_NOT_SUPPORTED = 0;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static int METADATA_SUPPORTED_FIXED_KEYS = 1;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static int METADATA_SUPPORTED_FREE_KEYS = 2;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_BITRATE = "bitrate";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_BITRATE_TYPE = "bitrate type";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_SAMPLERATE = "sample rate";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_FRAMERATE = "frame rate";
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_QUALITY = "quality";
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public final static String PARAM_VERSION_TYPE = "version type";
+
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String[] getSupportedFormats();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String[] getSupportedStrParameters();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String[] getSupportedIntParameters();
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String[] getSupportedStrParameterValues(String parameter);
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int[] getSupportedIntParameterRange(String parameter);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ void setFormat(String format);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String getFormat();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int setParameter(String parameter, int value);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ void setParameter(String parameter, String value);
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String getStrParameterValue(String parameter);
+
+ /**
+ *Please refer JSR 234 for more details.
+ */
+ int getIntParameterValue(String parameter);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int getEstimatedBitRate() throws MediaException;
+
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ void setMetadata(String key, String value) throws MediaException;
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ String[] getSupportedMetadataKeys();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int getMetadataSupportMode();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ void setMetadataOverride(boolean override);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ boolean getMetadataOverride();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/ImageFormatControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface ImageFormatControl extends FormatControl
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int getEstimatedImageSize();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/MIDIChannelControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+
+public interface MIDIChannelControl
+ extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ Control getChannelControl(java.lang.String controlType, int channel);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ Control[] getChannelControls(int channel);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/PanControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+
+public interface PanControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int setPan(int pan);
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ int getPan();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/PriorityControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+/**
+Please refer JSR 234 for more details.
+*/
+public interface PriorityControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public int getPriority();
+
+ /**
+ * Please refer JSR 234 for more details.
+ */
+ public void setPriority(int level);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/VideoFormatControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control;
+
+import javax.microedition.media.MediaException;
+
+/**
+ * Please refer JSR 234 for more details.
+ */
+public interface VideoFormatControl extends FormatControl
+{
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/CommitControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.media.*;
+import javax.microedition.amms.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface CommitControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setDeferred(boolean deferred);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isDeferred();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void commit();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/DirectivityControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface DirectivityControl extends OrientationControl
+{
+
+ /**
+ Please refer to JSR 234 for more details.
+ */
+ public void setParameters(int minAngle,
+ int maxAngle,
+ int rearLevel);
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getParameters();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/DistanceAttenuationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.media.*;
+import javax.microedition.amms.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface DistanceAttenuationControl
+ extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setParameters(int minDistance,
+ int maxDistance,
+ boolean muteAfterMax,
+ int rolloffFactor);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinDistance();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxDistance();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean getMuteAfterMax();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getRolloffFactor();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/DopplerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.media.*;
+import javax.microedition.media.control.PitchControl;
+import javax.microedition.amms.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface DopplerControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setEnabled(boolean dopplerEnabled);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setVelocityCartesian(int x, int y, int z);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getVelocityCartesian();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setVelocitySpherical(int azimuth, int elevation, int radius);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/LocationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.media.*;
+
+/**
+ *
+ Please refer to JSR 234 for more details.
+ */
+
+public interface LocationControl extends javax.microedition.media.Control
+{
+
+ /**
+ Please refer to JSR 234 for more details.
+ */
+ public void setCartesian(int x, int y, int z);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setSpherical(int azimuth, int elevation, int radius);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getCartesian();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/MacroscopicControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.amms.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface MacroscopicControl extends OrientationControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setSize(int x, int y, int z);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int[] getSize();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/ObstructionControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ObstructionControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setLevel(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getLevel();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setHFLevel(int HFLevel);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getHFLevel();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audio3d/OrientationControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audio3d;
+
+import javax.microedition.media.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface OrientationControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setOrientation(int heading, int pitch, int roll);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setOrientation(int[] frontVector, int[] aboveVector)
+ throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getOrientationVectors();
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audioeffect/AudioVirtualizerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audioeffect;
+
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface AudioVirtualizerControl extends EffectControl
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audioeffect/ChorusControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audioeffect;
+
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ChorusControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setWetLevel(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ *
+ */
+ public int getWetLevel();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setModulationRate(int rate);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getModulationRate();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMinModulationRate();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMaxModulationRate();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setModulationDepth(int percentage);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getModulationDepth();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMaxModulationDepth();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setAverageDelay(int delay);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getAverageDelay();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMaxAverageDelay();
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audioeffect/EqualizerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audioeffect;
+
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface EqualizerControl
+ extends EffectControl
+{
+
+ public final int UNDEFINED = -1004;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMinBandLevel();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMaxBandLevel();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setBandLevel(int level, int band) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getBandLevel(int band) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getNumberOfBands();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getCenterFreq(int band) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getBand(int frequency);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setBass(int level) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setTreble(int level) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getBass();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getTreble();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audioeffect/ReverbControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audioeffect;
+
+import javax.microedition.media.*;
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ReverbControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setReverbLevel(int level) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getReverbLevel();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setReverbTime(int time) throws IllegalArgumentException,
+ javax.microedition.media.MediaException;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getReverbTime() throws
+ javax.microedition.media.MediaException;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/audioeffect/ReverbSourceControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.audioeffect;
+
+import javax.microedition.media.*;
+import javax.microedition.media.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ReverbSourceControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final int DISCONNECT = Integer.MAX_VALUE;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setRoomLevel(int level)
+ throws MediaException;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getRoomLevel();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/CameraControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface CameraControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int ROTATE_LEFT = 2;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int ROTATE_RIGHT = 3;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int ROTATE_NONE = 1;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int UNKNOWN = -1004;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getCameraRotation();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void enableShutterFeedback(boolean enable) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isShutterFeedbackEnabled();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String[] getSupportedExposureModes();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setExposureMode(String mode);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getExposureMode();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedVideoResolutions();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedStillResolutions();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setVideoResolution(int index);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setStillResolution(int index);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getVideoResolution();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getStillResolution();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/ExposureControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ *
+
+ *
+ * @see CameraControl#setExposureMode
+ */
+public interface ExposureControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedFStops();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getFStop();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setFStop(int aperture) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinExposureTime();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxExposureTime();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getExposureTime();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setExposureTime(int time) throws MediaException;
+
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedISOs();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getISO();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setISO(int iso) throws MediaException;
+
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedExposureCompensations();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getExposureCompensation();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setExposureCompensation(int ec) throws MediaException;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getExposureValue();
+
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String[] getSupportedLightMeterings();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setLightMetering(String metering);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getLightMetering();
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/FlashControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface FlashControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int OFF = 1;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO = 2;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO_WITH_REDEYEREDUCE = 3;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int FORCE = 4;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int FORCE_WITH_REDEYEREDUCE = 5;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int FILLIN = 6;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int[] getSupportedModes();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setMode(int mode);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMode();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isFlashReady();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/FocusControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface FocusControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO = -1000;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO_LOCK = -1005;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int NEXT = -1001;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int PREVIOUS = -1002;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int UNKNOWN = -1004;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setFocus(int distance) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getFocus();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinFocus();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getFocusSteps();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isManualFocusSupported();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isAutoFocusSupported();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean isMacroSupported();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setMacro(boolean enable) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean getMacro();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/SnapshotControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface SnapshotControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String SHOOTING_STOPPED = "SHOOTING_STOPPED";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String STORAGE_ERROR = "STORAGE_ERROR";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String WAITING_UNFREEZE = "WAITING_UNFREEZE";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int FREEZE = -2;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int FREEZE_AND_CONFIRM = -1;
+
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setDirectory(String directory);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getDirectory();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setFilePrefix(String prefix);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getFilePrefix();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setFileSuffix(String suffix);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getFileSuffix();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void start(int maxShots) throws SecurityException;
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void stop();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void unfreeze(boolean save);
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/camera/ZoomControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.camera;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ZoomControl extends Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int NEXT = -1001;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int PREVIOUS = -1002;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int UNKNOWN = -1004;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setOpticalZoom(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getOpticalZoom();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxOpticalZoom();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getOpticalZoomLevels();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinFocalLength();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setDigitalZoom(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getDigitalZoom();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxDigitalZoom();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getDigitalZoomLevels();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/imageeffect/ImageEffectControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.imageeffect;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.lcdui.Image;
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ImageEffectControl extends EffectControl
+{
+
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/imageeffect/ImageTonalityControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.imageeffect;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.amms.control.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface ImageTonalityControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO = -1000;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int NEXT = -1001;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int PREVIOUS = -1002;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setBrightness(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getBrightness();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getBrightnessLevels();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setContrast(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getContrast();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getContrastLevels();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setGamma(int level);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getGamma();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getGammaLevels();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/imageeffect/ImageTransformControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.imageeffect;
+
+import javax.microedition.media.Control;
+import javax.microedition.amms.control.*;
+
+/**
+ *
+ * Please refer to JSR 234 for more details.
+ */
+public interface ImageTransformControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getSourceWidth();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getSourceHeight();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setSourceRect(int x, int y, int width, int height);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setTargetSize(int width, int height, int rotation);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/imageeffect/OverlayControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.imageeffect;
+
+import javax.microedition.lcdui.Image;
+import javax.microedition.amms.control.*;
+import javax.microedition.media.*;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface OverlayControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int insertImage(Object image, int x, int y, int order) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int insertImage(Object image, int x, int y, int order, int transparentColor) throws IllegalArgumentException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void removeImage(Object image);
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ Object getImage(int order);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int numberOfImages();
+
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ *
+ */
+ void clear();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/imageeffect/WhiteBalanceControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.imageeffect;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+import javax.microedition.amms.control.EffectControl;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+public interface WhiteBalanceControl extends EffectControl
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int AUTO = -1000;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int NEXT = -1001;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int PREVIOUS = -1002;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public final static int UNKNOWN = -1004;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int setColorTemp(int temp);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getColorTemp();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMinColorTemp();
+
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int getMaxColorTemp();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getNumberOfSteps();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/tuner/RDSControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.tuner;
+
+import javax.microedition.media.*;
+
+import java.util.Date;
+
+/**
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface RDSControl extends javax.microedition.media.Control
+{
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String RDS_NEW_DATA = "RDS_NEW_DATA";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String RDS_NEW_ALARM = "RDS_ALARM";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String RADIO_CHANGED = "radio_changed";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ boolean isRDSSignal();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getPS();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getRT();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ short getPTY();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String getPTYString(boolean longer);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ short getPI();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int[] getFreqsByPTY(short PTY);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ int[][] getFreqsByTA(boolean TA);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String[] getPSByPTY(short PTY);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ String[] getPSByTA(boolean TA);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ Date getCT();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ boolean getTA();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ boolean getTP();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setAutomaticSwitching(boolean automatic)
+ throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ boolean getAutomaticSwitching();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ void setAutomaticTA(boolean automatic) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ boolean getAutomaticTA();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/javasrc/javax/microedition/amms/control/tuner/TunerControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.amms.control.tuner;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+
+/**
+ *
+ * Please refer to JSR 234 for more details.
+ */
+
+public interface TunerControl extends Control
+{
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public static final int MONO = 1;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public static final int STEREO = 2;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public static final int AUTO = 3;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public static final String MODULATION_FM = "fm";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public static final String MODULATION_AM = "am";
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMinFreq(String modulation);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getMaxFreq(String modulation);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int setFrequency(int freq, String modulation);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getFrequency();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int seek(int startFreq, String modulation, boolean upwards) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public boolean getSquelch();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setSquelch(boolean squelch) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getModulation();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getSignalStrength() throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getStereoMode();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setStereoMode(int mode);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getNumberOfPresets();
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void usePreset(int preset);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setPreset(int preset);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setPreset(int preset, int freq, String mod, int stereoMode);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getPresetFrequency(int preset);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getPresetModulation(int preset);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public int getPresetStereoMode(int preset) throws MediaException;
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public String getPresetName(int preset);
+
+ /**
+ * Please refer to JSR 234 for more details.
+ */
+ public void setPresetName(int preset, String name);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/ammsplugin.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Creates CAMMSPriorityControl and adds it to the player.
+*
+*/
+
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include "com_nokia_amms_AMMSPlugin.h"
+#include <mmafunctionserver.h>
+#include <cmmaplayer.h>
+#include "cammsprioritycontrol.h"
+#include "cammsaudiooutputcontrol.h"
+
+/**
+ * Creates CAMMSPriorityControl and adds it to the player.
+ * Returns the created control through the given parameter.
+ */
+static void CreatePriorityControlL(CMMAPlayer* aPlayer,
+ CAMMSPriorityControl** aControl)
+{
+ LOG( EJavaAMMS, EInfo, "CreatePriorityControlL +");
+
+ CAMMSPriorityControl* control = CAMMSPriorityControl::NewLC(aPlayer);
+
+ aPlayer->AddControlL(control);
+
+ CleanupStack::Pop(control);
+
+ *aControl = control;
+
+ LOG( EJavaAMMS, EInfo, "CreatePriorityControlL -");
+}
+
+/**
+* Creates CAMMSAudioOutputControl and adds it to the player.
+* Returns the created control through the given parameter.
+*/
+static void CreateAudioOutputControlL(CMMAPlayer* aPlayer,
+ CAMMSAudioOutputControl** aControl)
+{
+ LOG( EJavaAMMS, EInfo, "CreatePriorityControlL +");
+
+ CAMMSAudioOutputControl* control = CAMMSAudioOutputControl::NewLC(aPlayer);
+
+ aPlayer->AddControlL(control);
+
+ CleanupStack::Pop(control);
+
+ *aControl = control;
+
+ LOG( EJavaAMMS, EInfo, "CAMMSAudioOutputControl -");
+}
+/*
+ * Class: com_nokia_amms_AMMSPlugin
+ * Method: _createNativePriorityControl
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl + ");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayer);
+
+
+ // Create control and add it to the player.
+ CAMMSPriorityControl* control = NULL;
+
+ TInt handle =
+ eventSource->ExecuteTrap(&CreatePriorityControlL, player, &control);
+
+ __ASSERT_DEBUG(control, User::Invariant());
+
+ if (handle == KErrNone)
+ {
+ handle = reinterpret_cast<TInt>(control);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativePriorityControl - ");
+
+ return handle;
+}
+
+/*
+* Class: com_nokia_amms_AMMSPlugin
+* Method: _createNativeAudioOutputControl
+*
+*/
+
+JNIEXPORT jint JNICALL Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl + ");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayer);
+
+
+ // Create control and add it to the player.
+ CAMMSAudioOutputControl* control = NULL;
+
+ TInt handle =
+ eventSource->ExecuteTrap(&CreateAudioOutputControlL, player, &control);
+
+ __ASSERT_DEBUG(control, User::Invariant());
+
+ if (handle == KErrNone)
+ {
+ handle = reinterpret_cast<TInt>(control);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS: Java_com_nokia_amms_AMMSPlugin__1createNativeAudioOutputControl - ");
+
+ return handle;
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/audiooutputcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Creates cammsaudiooutputcontrol.
+*
+*/
+
+
+//#include <jutils.h>
+#include <logger.h>
+#include "com_nokia_mid_impl_media_AudioOutputControl.h"
+#include <mmafunctionserver.h>
+#include "cammsaudiooutputcontrol.h"
+
+/**
+* wrapper for CAMMSAudioOutputControl::GetPreference()
+*/
+static TInt GetPreference(CAMMSAudioOutputControl* aControl)
+{
+ TInt val = aControl->GetAudioOutput();
+ return val;
+}
+
+/**
+* wrapper for CAMMSAudioOutputControl::SetPreferenceL()
+*/
+static TInt SetPreference(CAMMSAudioOutputControl* aControl, TInt aPreference)
+{
+ return aControl->SetAudioOutput(aPreference);
+}
+
+/**
+* wrapper for CAMMSAudioOutputControl::GetCurrent()
+*/
+static void GetCurrent(CAMMSAudioOutputControl* aControl)
+{
+ aControl->GetCurrentPreference();
+}
+
+/**
+* wrapper for CAMMSAudioOutputControl::SetJavaAudioOutputObj()
+*/
+static void SetJavaAudioOutputObj(CAMMSAudioOutputControl* aControl,jobject obj)
+{
+ aControl->SetJavaAudioOutputObject(obj);
+}
+
+/*
+* Class: Java_com_nokia_mj_impl_media_AudioOutputControl
+* Method: _getOutputMode
+*
+*/
+
+JNIEXPORT jint JNICALL Java_com_nokia_mid_impl_media_AudioOutputControl__1getOutputMode(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+ CAMMSAudioOutputControl* control = static_cast< CAMMSAudioOutputControl* >(
+ reinterpret_cast< CAMMSControl* >(aControl));
+ __ASSERT_DEBUG(control, User::Invariant());
+ return eventSource->Execute(GetPreference, control);
+}
+
+/*
+* Class: Java_com_nokia_mj_impl_media_AudioOutputControl
+* Method: _setOutputMode
+*
+*/
+JNIEXPORT jint JNICALL Java_com_nokia_mid_impl_media_AudioOutputControl__1setOutputMode(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aPreference)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSAudioOutputControl* control = static_cast< CAMMSAudioOutputControl* >(
+ reinterpret_cast< CAMMSControl* >(aControl));
+ __ASSERT_DEBUG(control, User::Invariant());
+ TInt error = eventSource->Execute(
+ &SetPreference, control, (TInt) aPreference);
+ ELOG1( EJavaAMMS, "AMMS::AudioOutputControl_JNI::setOutputMode = %d", error);
+ return error;
+}
+
+
+/*
+* Class: Java_com_nokia_mj_impl_media_AudioOutputControl
+* Method: _getCurrent
+*
+*/
+
+JNIEXPORT jint JNICALL Java_com_nokia_mid_impl_media_AudioOutputControl__1getCurrent(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSAudioOutputControl* control = static_cast< CAMMSAudioOutputControl* >(
+ reinterpret_cast< CAMMSControl* >(aControl));
+ __ASSERT_DEBUG(control, User::Invariant());
+ TInt err = eventSource->ExecuteTrap(GetCurrent, control);
+ ELOG1( EJavaAMMS, "AMMS::AudioOutputControl_JNI::getCurrent = %d", err);
+ return err;
+}
+
+
+/*
+* Class: com_nokia_mj_impl_media_AudioOutputControl
+* Method: _setAudioOutputObject
+* Signature: (IILjava/lang/Object;)I
+*/
+JNIEXPORT jint JNICALL Java_com_nokia_mid_impl_media_AudioOutputControl__1setAudioOutputObject
+(JNIEnv *jni, jclass, jint aEventSource, jint aControl, jobject audioOutputObj)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+ CAMMSAudioOutputControl* control = static_cast< CAMMSAudioOutputControl* >(
+ reinterpret_cast< CAMMSControl* >(aControl));
+ __ASSERT_DEBUG(control, User::Invariant());
+ jobject obj = jni->NewWeakGlobalRef(audioOutputObj);
+ TInt err = eventSource->ExecuteTrap(SetJavaAudioOutputObj,control ,obj);
+ ELOG1( EJavaAMMS, "AMMS::AudioOutputControl_JNI::setAudioOutputObject = %d", err);
+ return err;
+}
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/commitcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audio3d_CommitControl.h"
+#include <mmafunctionserver.h>
+#include "cammscommitcontrolgroup.h"
+
+/**
+ * wrapper for CAMMSCommitControlGroup::CommitAllControlsL()
+ */
+static void CommitL(CAMMSCommitControlGroup* aControl)
+{
+ aControl->CommitAllControlsL();
+}
+
+/**
+ * wrapper for CAMMSCommitControlGroup::SetDeferredL()
+ */
+static void SetDeferredL(CAMMSCommitControlGroup* aControl, TBool aDeferred)
+{
+ aControl->SetDeferredL(aDeferred);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_CommitControl
+ * Method: _commit
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_CommitControl__1commit(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aCommitControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSCommitControlGroup* commitControl =
+ static_cast<CAMMSCommitControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aCommitControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(&CommitL, commitControl);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_CommitControl
+ * Method: _setDeferred
+ * Signature: (IIZ)V
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_CommitControl__1setDeferred(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aCommitControl,
+ jboolean aDeferred)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSCommitControlGroup* commitControl =
+ static_cast<CAMMSCommitControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aCommitControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(&SetDeferredL, commitControl,
+ (TBool) aDeferred);
+
+ return error;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/controlcontainer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI file for ControlContainer
+*
+*/
+
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include "com_nokia_amms_ControlContainer.h"
+
+#include "cammscontrolgroup.h"
+#include "cammsmodule.h"
+#include "jstringutils.h"
+#include "s60commonutils.h"
+using namespace java::util;
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jstring JNICALL Java_com_nokia_amms_ControlContainer__1getControlClassName
+(JNIEnv* aJniEnv,
+ jclass,
+ jint /*aEventSourceHandle*/,
+ jint aNativeHandle)
+{
+ CAMMSControlGroup* controlGroup =
+ reinterpret_cast< CAMMSControlGroup* >(aNativeHandle);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::ControlContainer.cpp::getControlClassName name = %S",
+ controlGroup->ClassName().Ptr());
+
+ return S60CommonUtils::NativeToJavaString(*aJniEnv, controlGroup->ClassName());
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_ControlContainer__1getControlsCount
+(JNIEnv*,
+ jclass,
+ jint /*aEventSourceHandle*/,
+ jint aNativeHandle)
+{
+ CAMMSModule* module = reinterpret_cast< CAMMSModule* >(aNativeHandle);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::ControlContainer.cpp::getControlsCount count = %d",
+ module->Count());
+ return module->Count();
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_ControlContainer__1getControlHandle
+(JNIEnv*,
+ jclass,
+ jint /*aEventSourceHandle*/,
+ jint aNativeHandle,
+ jint aIndex)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::ControlContainer.cpp::getControlHandle index = %d",
+ aIndex);
+ CAMMSModule* module = reinterpret_cast< CAMMSModule *>(aNativeHandle);
+
+ // Java handles must be created from CBase derived classes.
+ // Casting here is safe because all groups in the modules are derived from
+ // CAMMSControlGroup.
+ CAMMSControlGroup* group = static_cast< CAMMSControlGroup* >(
+ module->At(aIndex)); // CSI: 1 Wrong index means implementation error #
+
+ return reinterpret_cast<TInt>(group);
+}
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/distanceattenuationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI file for DistanceAttenuationControl
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audio3d_DistanceAttenuationControl.h"
+#include <mmafunctionserver.h>
+#include "cammsdistanceattenuationcontrolgroup.h"
+
+/**
+ * wrapper for CAMMSDistanceAttenuationControlGroup::MuteAfterMax()
+ */
+static TBool MuteAfterMax(CAMMSDistanceAttenuationControlGroup* aControl)
+{
+ return aControl->MuteAfterMax();
+}
+
+/**
+ * wrapper for CAMMSDistanceAttenuationControlGroup::MinDistance()
+ */
+static TInt32 MinDistance(CAMMSDistanceAttenuationControlGroup* aControl)
+{
+ return aControl->MinDistance();
+}
+
+/**
+ * wrapper for CAMMSDistanceAttenuationControlGroup::MaxDistance()
+ */
+static TInt32 MaxDistance(CAMMSDistanceAttenuationControlGroup* aControl)
+{
+ return aControl->MaxDistance();
+}
+
+/**
+ * wrapper for CAMMSDistanceAttenuationControlGroup::RolloffFactor()
+ */
+static TUint32 RolloffFactor(CAMMSDistanceAttenuationControlGroup* aControl)
+{
+ return aControl->RolloffFactor();
+}
+
+/**
+ * wrapper for CAMMSDistanceAttenuationControlGroup::SetParametersL()
+ */
+static void SetParametersL(
+ CAMMSDistanceAttenuationControlGroup* aControl,
+ TInt aMinDistance,
+ TInt aMaxDistance,
+ TBool aMuteAfterMax,
+ TInt aRolloffFactor)
+{
+ aControl->SetParametersL(
+ aMinDistance,
+ aMaxDistance,
+ aMuteAfterMax,
+ aRolloffFactor);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl
+ * Method: _getMuteAfterMax
+ * Signature: (II)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMuteAfterMax(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDistControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDistanceAttenuationControlGroup* distControl =
+ static_cast<CAMMSDistanceAttenuationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDistControl));
+
+ return (jboolean) eventSource->Execute(MuteAfterMax, distControl);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl
+ * Method: _getMinDistance
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMinDistance(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDistControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDistanceAttenuationControlGroup* distControl =
+ static_cast<CAMMSDistanceAttenuationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDistControl));
+
+ return (jint) eventSource->Execute(MinDistance, distControl);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl
+ * Method: _getMaxDistance
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMaxDistance(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDistControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDistanceAttenuationControlGroup* distControl =
+ static_cast<CAMMSDistanceAttenuationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDistControl));
+
+ return (jint) eventSource->Execute(MaxDistance, distControl);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl
+ * Method: _getRolloffFactor
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getRolloffFactor(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDistControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDistanceAttenuationControlGroup* distControl =
+ static_cast<CAMMSDistanceAttenuationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aDistControl));
+
+ return (jint) eventSource->Execute(RolloffFactor, distControl);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl
+ * Method: _setParameters
+ * Signature: (IIIIZI)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1setParameters(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDistControl,
+ jint aMinDistance,
+ jint aMaxDistance,
+ jboolean aMuteAfterMax,
+ jint aRolloffFactor)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDistanceAttenuationControlGroup* distControl =
+ static_cast<CAMMSDistanceAttenuationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDistControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ &SetParametersL,
+ distControl,
+ (TInt) aMinDistance,
+ (TInt) aMaxDistance,
+ (TBool) aMuteAfterMax,
+ (TInt) aRolloffFactor);
+
+ return error;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/dopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI file for DopplerControl
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audio3d_DopplerControl.h"
+#include <mmafunctionserver.h>
+#include "cammsdopplercontrolgroup.h"
+
+/**
+ * wrapper for CAMMSDopplerControlGroup::SetEnabledL()
+ */
+static void SetEnabledL(CAMMSDopplerControlGroup* aControl, TBool aEnabled)
+{
+ aControl->SetEnabledL(aEnabled);
+}
+
+/**
+ * wrapper for CAMMSDopplerControlGroup::SetVelocitySphericalL()
+ */
+static void SetVelocitySphericalL(CAMMSDopplerControlGroup* aControl,
+ TInt aAzimuth, TInt aElevation, TInt aRadius)
+{
+ aControl->SetVelocitySphericalL(aAzimuth, aElevation, aRadius);
+}
+
+/**
+ * wrapper for CAMMSDopplerControlGroup::VelocityCartesian()
+ */
+static void GetVelocityCartesianL(
+ CAMMSDopplerControlGroup* aControl,
+ TInt aVelocity[ KAMMSVectorComponents ])
+{
+ aControl->VelocityCartesianL(aVelocity);
+}
+
+/**
+ * wrapper for CAMMSDopplerControlGroup::Enabled()
+ */
+static TBool IsEnabled(CAMMSDopplerControlGroup* aControl)
+{
+ return aControl->Enabled();
+}
+
+/**
+ * wrapper for CAMMSDopplerControlGroup::SetVelocityCartesianL()
+ */
+static void SetVelocityCartesianL(
+ CAMMSDopplerControlGroup* aControl,
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+ aControl->SetVelocityCartesianL(aX, aY, aZ);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DopplerControl
+ * Method: _setEnabled
+ * Signature: (IIZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DopplerControl__1setEnabled(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDopplerControl,
+ jboolean aEnabled)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDopplerControlGroup* dopplerControl =
+ static_cast<CAMMSDopplerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDopplerControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetEnabledL,
+ dopplerControl,
+ (TBool) aEnabled);
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DopplerControl
+ * Method: _setVelocitySpherical
+ * Signature: (IIIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DopplerControl__1setVelocitySpherical(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDopplerControl,
+ jint aAzimuth,
+ jint aElevation,
+ jint aRadius)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDopplerControlGroup* dopplerControl =
+ static_cast<CAMMSDopplerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aDopplerControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetVelocitySphericalL, dopplerControl,
+ (TInt) aAzimuth, (TInt) aElevation, (TInt) aRadius);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DopplerControl
+ * Method: _getVelocityCartesian
+ * Signature: (II)[I
+ */
+JNIEXPORT jintArray JNICALL
+Java_com_nokia_amms_control_audio3d_DopplerControl__1getVelocityCartesian(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aDopplerControl,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSDopplerControlGroup* dopplerControl =
+ static_cast<CAMMSDopplerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDopplerControl));
+
+ TInt velocity[ KAMMSVectorComponents ];
+ TInt error = eventSource->ExecuteTrap(GetVelocityCartesianL,
+ dopplerControl,
+ velocity);
+ // allocate new array
+ jintArray javaArray = aJni->NewIntArray(KAMMSVectorComponents);
+ if (javaArray)
+ {
+ aJni->SetIntArrayRegion(
+ /*destination*/ javaArray,
+ /*first*/ 0,
+ /*count*/ KAMMSVectorComponents,
+ /*source*/ velocity);
+ }
+
+ jint javaError[ 1 ] = { error };
+ aJni->SetIntArrayRegion(aError, 0, 1, javaError);
+
+ return javaArray;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DopplerControl
+ * Method: _isEnabled
+ * Signature: (II)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_com_nokia_amms_control_audio3d_DopplerControl__1isEnabled(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDopplerControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDopplerControlGroup* dopplerControl =
+ static_cast<CAMMSDopplerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDopplerControl));
+
+ return (jboolean) eventSource->Execute(IsEnabled, dopplerControl);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_DopplerControl
+ * Method: _setVelocityCartesian
+ * Signature: (IIIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_DopplerControl__1setVelocityCartesian(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aDopplerControl,
+ jint aX,
+ jint aY,
+ jint aZ)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSDopplerControlGroup* dopplerControl =
+ static_cast<CAMMSDopplerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aDopplerControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetVelocityCartesianL,
+ dopplerControl,
+ (TInt) aX,
+ (TInt) aY,
+ (TInt) aZ);
+
+ return error;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/effectcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI for EffectControl
+*
+*/
+
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include "com_nokia_amms_control_EffectControl.h"
+#include <mmafunctionserver.h>
+#include "cammseffectcontrolgroup.h"
+#include "jstringutils.h"
+#include "s60commonutils.h"
+using namespace java::util;
+#include <JniEnvWrapper.h>
+
+/**
+ * wrapper for CAMMSEffectControlGroup::PresetNamesL()
+ */
+LOCAL_C void GetPresetNamesL(CAMMSEffectControlGroup* aControl,
+ JNIEnv* aJni,
+ jobjectArray* aArray)
+{
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ //aJni = JniEnvWrapper::GetValidJniRef();
+
+ // Create new java String array and copy values from the values array
+ *aArray = MMAPIUtils::CopyToNewJavaStringArrayL(*aJni, aControl->PresetNamesL());
+}
+
+/**
+ * wrapper for CAMMSEffectControlGroup::PresetL()
+ */
+static void GetPresetL(
+ CAMMSEffectControlGroup* aControl,
+ TDes* aPreset)
+{
+ aControl->GetPresetL(*aPreset);
+}
+
+/**
+ * wrapper for CAMMSEffectControlGroup::SetEnabledL()
+ */
+static void SetEnabledL(CAMMSEffectControlGroup* aControl, TBool aEnabled)
+{
+ aControl->SetEnabledL(aEnabled);
+}
+
+/**
+ * wrapper for CAMMSEffectControlGroup::SetScopeL()
+ */
+static void SetScopeL(CAMMSEffectControlGroup* aControl, TInt aScope)
+{
+ aControl->SetScopeL((CAMMSEffectControlGroup::TEffectScope) aScope);
+}
+
+/**
+ * wrapper for CAMMSEffectControlGroup::SetEnforcedL()
+ */
+static void SetEnforcedL(CAMMSEffectControlGroup* aControl, TBool aEnforced)
+{
+ aControl->SetEnforcedL(aEnforced);
+}
+
+/**
+ * wrapper for CAMMSEffectControlGroup::SetPresetL()
+ */
+static void SetPresetL(CAMMSEffectControlGroup* aControl, TDesC* aPreset)
+{
+ aControl->SetPresetL(*aPreset);
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _isEnabled
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1isEnabled(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ /*MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);*/
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->Enabled();
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _isEnforced
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1isEnforced(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ /* MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);*/
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->Enforced();
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _getPresetNames
+ * Signature: (II[Ljava/lang/String;)I
+ */
+JNIEXPORT jobjectArray JNICALL Java_com_nokia_amms_control_EffectControl__1getPresetNames(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ jobjectArray presetNames = NULL;
+
+ TInt error = eventSource->ExecuteTrap(GetPresetNamesL,
+ control,
+ aJni,
+ &presetNames);
+
+ // If an error happened, return null to Java
+ if (error != KErrNone)
+ {
+ presetNames = NULL;
+ }
+ return presetNames;
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _getPreset
+ * Signature: (II[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1getPreset(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jobjectArray aPreset)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ TBuf< KAMMSMaxPresetNameLength > preset;
+
+ error = eventSource->ExecuteTrap(GetPresetL, control, (TDes*) &preset);
+
+ if (error == KErrNone)
+ {
+ // return NULL if there is no preset set in the native class
+ if (preset == KNullDesC)
+ {
+ aJni->SetObjectArrayElement(aPreset, 0, NULL);
+ }
+ else
+ {
+ jstring javaStr = S60CommonUtils::NativeToJavaString(*aJni, preset);
+ if (!javaStr)
+ {
+ return KErrNoMemory;
+ }
+
+ aJni->SetObjectArrayElement(aPreset, 0, javaStr);
+ }
+ }
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _setScope
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1setScope(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jint aScope)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetScopeL, control, aScope);
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _setEnabled
+ * Signature: (IIZ)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1setEnabled(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jboolean aEnabled)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetEnabledL, control, (TBool) aEnabled);
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _getScope
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1getScope(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ /*MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);*/
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->Scope();
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _setPreset
+ * Signature: (IILjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1setPreset(
+ JNIEnv* aJni, jclass, jint aEventSource, jint aControl, jstring aPreset)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ JStringUtils preset(*aJni, aPreset);
+ error = eventSource->ExecuteTrap(SetPresetL, control, (TDesC*) &preset);
+
+ ELOG1( EJavaAMMS, "AMMS:JNI:EffectControl:setPreset, err=%d", error);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_EffectControl
+ * Method: _setEnforced
+ * Signature: (IIZ)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_EffectControl__1setEnforced(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jboolean aEnforced)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSEffectControlGroup* control = static_cast<CAMMSEffectControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetEnforcedL,
+ control,
+ (TBool) aEnforced);
+ return error;
+}
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/equalizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audioeffect_EqualizerControl.h"
+#include <mmafunctionserver.h>
+#include "cammsequalizercontrolgroup.h"
+
+/**
+ * wrapper for CAMMSEqualizerControlGroup::GetBandLevelL()
+ */
+static void GetBandLevelL(
+ CAMMSEqualizerControlGroup *aControl,
+ TInt aBand,
+ TInt *aLevel)
+{
+ aControl->GetBandLevelL(aBand, *aLevel);
+}
+
+/**
+ * wrapper for CAMMSEqualizerControlGroup::CenterFreqL()
+ */
+static void GetCenterFreqL(
+ CAMMSEqualizerControlGroup *aControl,
+ TInt aBand,
+ TInt *aFrequency)
+{
+ aControl->GetCenterFreqL(aBand, *aFrequency);
+}
+
+/**
+ * wrapper for CAMMSEqualizerControlGroup::SetBandLevelL()
+ */
+static void SetBandLevelL(
+ CAMMSEqualizerControlGroup *aControl,
+ TInt aLevel,
+ TInt aBand)
+{
+ aControl->SetBandLevelL(aLevel, aBand);
+}
+
+/**
+ * wrapper for CAMMSEqualizerControlGroup::SetBassL()
+ */
+static void SetBassL(CAMMSEqualizerControlGroup *aControl, TInt *aLevel, TInt *aSetLevel)
+{
+ aControl->SetBassL(*aLevel, *aSetLevel);
+}
+
+/**
+ * wrapper for CAMMSEqualizerControlGroup::SetTrebleL()
+ */
+static void SetTrebleL(CAMMSEqualizerControlGroup *aControl, TInt *aLevel, TInt *aSetLevel)
+{
+ aControl->SetTrebleL(*aLevel, *aSetLevel);
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getBand
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getBand(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jint aFrequency)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->Band(aFrequency);
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getTreble
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getTreble(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ return control->Treble();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _setBass
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1setBass(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jint aLevel)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ TInt level = aLevel;
+ TInt setLevel;
+
+ error = eventSource->ExecuteTrap(SetBassL, control, &level, &setLevel);
+ return (error < KErrNone) ? error : setLevel;
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getCenterFreq
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getCenterFreq(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jint aBand)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ TInt error;
+ TInt freq;
+
+ error = eventSource->ExecuteTrap(
+ GetCenterFreqL,
+ control,
+ (TInt) aBand,
+ &freq);
+
+ return (error < KErrNone) ? error : freq;
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _setBandLevel
+ * Signature: (IIII)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1setBandLevel(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aLevel,
+ jint aBand)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetBandLevelL,
+ control,
+ (TInt) aLevel,
+ (TInt) aBand);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _setTreble
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1setTreble(
+ JNIEnv*, jclass, jint aEventSource, jint aControl, jint aLevel)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ TInt level = aLevel;
+ TInt setLevel;
+
+ error = eventSource->ExecuteTrap(SetTrebleL, control, &level, &setLevel);
+ return (error < KErrNone) ? error : setLevel;
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getNumberOfBands
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getNumberOfBands(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->NumberOfBands();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getMinBandLevel
+ * Signature: (IILI)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getMinBandLevel(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+
+ return control->MinBandLevel();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getBass
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getBass(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->Bass();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getMaxBandLevel
+ * Signature: (IILI)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getMaxBandLevel(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ return control->MaxBandLevel();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_EqualizerControl
+ * Method: _getBandLevel
+ * Signature: (IIILI)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_EqualizerControl__1getBandLevel(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aBand,
+ jintArray aLevel)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSEqualizerControlGroup* control =
+ static_cast<CAMMSEqualizerControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ TInt level;
+
+ error = eventSource->ExecuteTrap(
+ GetBandLevelL,
+ control,
+ (TInt) aBand,
+ &level);
+
+ if (error == KErrNone)
+ {
+ // aLevel is an array of 1 element allocated at the java side
+ aJni->SetIntArrayRegion(
+ /*destination*/ aLevel,
+ /*first*/ 0,
+ /*count*/ 1,
+ /*source*/ &level);
+ }
+ return error;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/globalmanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include <mmafunctionserver.h>
+
+#include "com_nokia_amms_GlobalManagerImpl.h"
+#include "cammsglobalmanager.h"
+
+/**
+ * Creates new CAMMSGlobalManager instance which is added to
+ * MMAFunctionServer for cleanup.
+ * @param aHandle will contain handle to created object.
+ * @param aEventSource MMA event source instance.
+ */
+LOCAL_C void CreateManagerL(TInt* aHandle,
+ MMAFunctionServer* aEventSource)
+{
+ CAMMSGlobalManager* manager = CAMMSGlobalManager::NewLC();
+
+ // Make Java handle
+ *aHandle = reinterpret_cast<TInt>(manager);
+
+ MMAFunctionServer::StaticAddObjectFromHandleL(aEventSource,
+ *aHandle);
+
+ CleanupStack::Pop(manager);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_GlobalManagerImpl__1createGlobalManager
+(JNIEnv*,
+ jclass,
+ jint aEventSourceHandle)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::GlobalManager.cpp::createGlobalManager +");
+
+ // Development time check.
+ __ASSERT_DEBUG(aEventSourceHandle > 0, User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ // handle will be set in CreateManagerL function.
+ TInt handle = KErrNotReady;
+
+ // Call CreateManagerL. If it leaves handle will not be set
+ TInt error = eventSource->ExecuteTrap(&CreateManagerL,
+ &handle,
+ eventSource);
+
+ if (error != KErrNone)
+ {
+ // executed function leaved. Set error to be returned to java.
+ handle = error;
+ }
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::GlobalManager.cpp::createGlobalManager return %d",
+ handle);
+
+ return handle;
+}
+
+/**
+ * Calls CAMMSGlobalManager::InitL method.
+ *
+ * @param aManager CAMMSGlobalManager instance.
+ * @param aEventSource MMAFunctionServer instance.
+ */
+LOCAL_C void InitManagerL(CAMMSGlobalManager* aManager,
+ MMAFunctionServer* aEventSource)
+{
+ aManager->InitL(aEventSource->Players());
+
+ // Receive notifications when new players are created or deleted.
+ aEventSource->SetPlayerInstanceObserver(aManager);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_GlobalManagerImpl__1init
+(JNIEnv*,
+ jclass,
+ jint aEventSourceHandle,
+ jint aGlobalManagerHandle)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::GlobalManager.cpp::init +");
+
+ // Development time check.
+ __ASSERT_DEBUG(aEventSourceHandle > 0 &&
+ aGlobalManagerHandle > 0, User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSGlobalManager* manager =
+ reinterpret_cast< CAMMSGlobalManager* >(aGlobalManagerHandle);
+
+ // Call InitManagerL.
+ TInt error = eventSource->ExecuteTrap(&InitManagerL,
+ manager,
+ eventSource);
+
+ ELOG1( EJavaAMMS, "AMMS::GlobalManager.cpp::init error code %d", error);
+ return error;
+}
+
+/**
+ * Calls CAMMSGlobalManager::CreateSoundSource3DL method.
+ * @param aManager CAMMSGlobalManager instance.
+ * @param aHandle will contain handle to created object.
+ */
+LOCAL_C void CreateSoundSource3DL(CAMMSGlobalManager* aManager, TInt* aHandle)
+{
+ CAMMSModule* module = aManager->CreateSoundSource3DL();
+
+ // Make Java handle
+ *aHandle = reinterpret_cast<TInt>(module);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_GlobalManagerImpl__1createSoundSource3D
+(JNIEnv*,
+ jclass,
+ jint aEventSourceHandle,
+ jint aGlobalManagerHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSGlobalManager* manager =
+ reinterpret_cast< CAMMSGlobalManager* >(aGlobalManagerHandle);
+
+ // handle will be set in CreateSoundSource3DL function.
+ TInt handle = KErrNotReady;
+
+ // Call CreateSoundSource3DL. If it leaves handle will not be set
+ TInt error = eventSource->ExecuteTrap(&CreateSoundSource3DL,
+ manager,
+ &handle);
+
+ if (error != KErrNone)
+ {
+ // executed function leaved. Set error to be returned to java.
+ handle = error;
+ }
+ ELOG1( EJavaAMMS, "AMMS::GlobalManager.cpp::createSoundSource3D return value %d",
+ error);
+ return handle;
+}
+
+/**
+ * Calls CAMMSGlobalManager::CreateEffectModuleL method.
+ * @param aManager CAMMSGlobalManager instance.
+ * @param aHandle will contain handle to created object.
+ */
+LOCAL_C void CreateEffectModuleL(CAMMSGlobalManager* aManager, TInt* aHandle)
+{
+ CAMMSModule* module = aManager->CreateEffectModuleL();
+
+ // Make Java handle
+ *aHandle = reinterpret_cast<TInt>(module);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_GlobalManagerImpl__1createEffectModule
+(JNIEnv*,
+ jclass,
+ jint aEventSourceHandle,
+ jint aGlobalManagerHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSGlobalManager* manager =
+ reinterpret_cast< CAMMSGlobalManager* >(aGlobalManagerHandle);
+
+ // handle will be set in CreateEffectModuleL function.
+ TInt handle = KErrNotReady;
+
+ // Call CreateEffectModuleL. If it leaves handle will not be set
+ TInt error = eventSource->ExecuteTrap(&CreateEffectModuleL,
+ manager,
+ &handle);
+
+ if (error != KErrNone)
+ {
+ // executed function leaved. Set error to be returned to java.
+ handle = error;
+ }
+ ELOG1( EJavaAMMS, "AMMS::GlobalManager.cpp::createEffectModule return value %d",
+ error);
+ return handle;
+}
+
+/**
+ * Calls CAMMSGlobalManager::Spectator method.
+ * @param aManager CAMMSGlobalManager instance.
+ * @param aHandle will contain handle to created object.
+ */
+LOCAL_C void CreateSpectatorL(CAMMSGlobalManager* aManager, TInt* aHandle)
+{
+ CAMMSModule* spectator = aManager->Spectator();
+
+ // Make Java handle
+ *aHandle = reinterpret_cast<TInt>(spectator);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_GlobalManagerImpl__1createSpectator
+(JNIEnv*,
+ jclass,
+ jint aEventSourceHandle,
+ jint aGlobalManagerHandle)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::GlobalManager.cpp::createSpectator +");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSGlobalManager* manager =
+ reinterpret_cast< CAMMSGlobalManager* >(aGlobalManagerHandle);
+
+ // handle will be set in CreateSpectatorL function.
+ TInt handle = KErrNotReady;
+
+ // Call CreateSpectatorL. If it leaves handle will not be set
+ TInt error = eventSource->ExecuteTrap(&CreateSpectatorL,
+ manager,
+ &handle);
+
+ if (error != KErrNone)
+ {
+ // executed function leaved. Set error to be returned to java.
+ handle = error;
+ }
+ LOG1( EJavaAMMS, EInfo, "AMMS::GlobalManager.cpp::createSpectator error code %d", handle);
+ return handle;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/locationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audio3d_LocationControl.h"
+#include <mmafunctionserver.h>
+#include "cammslocationcontrolgroup.h"
+#include "ammsconstants.h"
+
+/**
+ * wrapper for CAMMSLocationControlGroup::Cartesian()
+ */
+static void GetCartesianL(
+ CAMMSLocationControlGroup* control,
+ TInt aLocation[ KAMMSVectorComponents ])
+{
+ control->CartesianL(aLocation);
+}
+
+/**
+ * wrapper for CAMMSLocationControlGroup::SetCartesianL()
+ */
+static void SetCartesianL(
+ CAMMSLocationControlGroup* control,
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+ control->SetCartesianL(aX, aY, aZ);
+}
+
+/**
+ * wrapper for CAMMSLocationControlGroup::SetSphericalL()
+ */
+static void SetSphericalL(
+ CAMMSLocationControlGroup* control,
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ control->SetSphericalL(aAzimuth, aElevation, aRadius);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_LocationControl
+ * Method: _setSpherical
+ * Signature: (IIIII)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1setSpherical(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aAzimuth,
+ jint aElevation,
+ jint aRadius)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetSphericalL, control,
+ aAzimuth, aElevation, aRadius);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_LocationControl
+ * Method: _getCartesian
+ * Signature: (II)LI
+ */
+JNIEXPORT jintArray JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1getCartesian(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt location[ KAMMSVectorComponents ];
+ TInt error = eventSource->ExecuteTrap(GetCartesianL,
+ control,
+ location);
+ // allocate new array
+ jintArray javaArray = aJni->NewIntArray(KAMMSVectorComponents);
+ if (javaArray)
+ {
+ aJni->SetIntArrayRegion(
+ /*destination*/ javaArray,
+ /*first*/0,
+ /*count*/KAMMSVectorComponents,
+ /*source*/ &location[ 0 ]);
+ }
+
+ jint javaError[ 1 ] = { error };
+ aJni->SetIntArrayRegion(aError, 0, 1, javaError);
+
+ return javaArray;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_LocationControl
+ * Method: _setCartesian
+ * Signature: (IIIII)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1setCartesian(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aX,
+ jint aY,
+ jint aZ)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetCartesianL,
+ control,
+ aX,
+ aY,
+ aZ);
+
+ return error;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/modulebase.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include <mmafunctionserver.h>
+#include <cmmaplayer.h>
+
+// Generated JNI header.
+#include "com_nokia_amms_ModuleBase.h"
+
+#include "cammsmodule.h"
+#include "cammsglobalmanager.h"
+
+/**
+ * Calls CAMMSModule::AddPlayerL method.
+ * @param aModule Module instance.
+ * @param aPlayer Player to add.
+ */
+LOCAL_C void AddPlayerL(CAMMSModule* aModule, CMMAPlayer* aPlayer)
+{
+ aModule->AddPlayerL(aPlayer);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_ModuleBase__1addPlayer
+(JNIEnv* /*aJniEnv*/,
+ jclass,
+ jint aEventSourceHandle,
+ jint aModuleHandle,
+ jint aPlayerHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSModule* module =
+ reinterpret_cast< CAMMSModule* >(aModuleHandle);
+
+ CMMAPlayer* player =
+ reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
+
+ // call CAMMSModule::AddPlayerL through local AddPlayerL function.
+ return eventSource->ExecuteTrap(&AddPlayerL,
+ module,
+ player);
+}
+
+/**
+ * Calls CAMMSModule::RemovePlayerL method.
+ * @param aModule Module instance.
+ * @param aPlayer Player to remove.
+ * @return KErrNotFound if player does not exist in the module.
+ */
+LOCAL_C TInt RemovePlayer(CAMMSModule* aModule, CMMAPlayer* aPlayer)
+{
+ return aModule->RemovePlayer(aPlayer);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_ModuleBase__1removePlayer
+(JNIEnv* /*aJniEnv*/,
+ jclass,
+ jint aEventSourceHandle,
+ jint aModuleHandle,
+ jint aPlayerHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CAMMSModule* module =
+ reinterpret_cast< CAMMSModule *>(aModuleHandle);
+
+ CMMAPlayer* player =
+ reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
+
+ // call CAMMSModule::RemovePlayerL through local RemovePlayerL function.
+ return eventSource->Execute(&RemovePlayer,
+ module,
+ player);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT void JNICALL Java_com_nokia_amms_ModuleBase__1dispose
+(JNIEnv*,
+ jclass,
+ jint aManagerHandle,
+ jint aModuleHandle)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::ModuleBase.cpp::finalize %d", aModuleHandle);
+
+ // Module to dispose
+ CAMMSModule* module =
+ reinterpret_cast< CAMMSModule* >(aModuleHandle);
+
+ CAMMSGlobalManager* manager =
+ reinterpret_cast< CAMMSGlobalManager* >(aManagerHandle);
+
+ manager->DisposeModule(module);
+}
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/orientationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI file for OrientationControl
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audio3d_OrientationControl.h"
+#include <mmafunctionserver.h>
+#include "cammsorientationcontrolgroup.h"
+
+/**
+ * wrapper for CAMMSOrientationControlGroup::OrientationVectors()
+ */
+static void GetOrientationVectorsL(
+ CAMMSOrientationControlGroup* control,
+ TInt aOrientation[ KAMMSTwoVectorComponents ])
+{
+ control->OrientationVectorsL(aOrientation);
+}
+
+/**
+ * wrapper for CAMMSOrientationControlGroup::SetOrientationVectorsL()
+ */
+static void SetOrientationVectorsL(
+ CAMMSOrientationControlGroup* control,
+ TInt aFrontVector[ KAMMSVectorComponents ],
+ TInt aAboveVector[ KAMMSVectorComponents ])
+{
+ control->SetOrientationVectorsL(aFrontVector, aAboveVector);
+}
+
+/**
+ * wrapper for CAMMSOrientationControlGroup::SetOrientationL()
+ */
+static void SetOrientationL(
+ CAMMSOrientationControlGroup* control,
+ TInt aHeading,
+ TInt aPitch,
+ TInt aRoll)
+{
+ control->SetOrientationL(aHeading, aPitch, aRoll);
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_OrientationControl
+ * Method: _setOrientation
+ * Signature:
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_OrientationControl__1setOrientation(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aHeading,
+ jint aPitch,
+ jint aRoll)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSOrientationControlGroup* control =
+ static_cast< CAMMSOrientationControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetOrientationL, control,
+ aHeading, aPitch, aRoll);
+
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_OrientationControl
+ * Method: _getOrientationVectros
+ * Signature:
+ */
+JNIEXPORT jintArray JNICALL
+Java_com_nokia_amms_control_audio3d_OrientationControl__1getOrientationVectors(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSOrientationControlGroup* control =
+ static_cast< CAMMSOrientationControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt orientation[ KAMMSTwoVectorComponents ];
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ GetOrientationVectorsL,
+ control,
+ orientation);
+
+ // Java side method can not throw exception, store possible error here
+ // aError is an array of 1 element allocated at the java side
+ aJni->SetIntArrayRegion(
+ /*destination*/ aError,
+ /*first*/ 0,
+ /*count*/ 1,
+ /*source*/ &error);
+
+ // allocate new array
+ jintArray javaArray = aJni->NewIntArray(KAMMSTwoVectorComponents);
+
+ if (javaArray)
+ {
+ aJni->SetIntArrayRegion(
+ /*destination*/ javaArray,
+ /*first*/0,
+ /*count*/KAMMSTwoVectorComponents,
+ /*source*/ &orientation[ 0 ]);
+ }
+
+ return javaArray;
+}
+
+/*
+ * Class: com_nokia_amms_control_audio3d_OrientationControl
+ * Method: _setOrientation
+ * Signature:
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_audio3d_OrientationControl__1setOrientationVectors(
+ JNIEnv* aJni,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jintArray aFrontVector,
+ jintArray aAboveVector)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSOrientationControlGroup* control =
+ static_cast< CAMMSOrientationControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ TInt i;
+
+ // copy java front vector array to native front vector array
+ TInt frontVector[ KAMMSVectorComponents ];
+ TInt count = aJni->GetArrayLength(aFrontVector);
+ jint* elements = aJni->GetIntArrayElements(aFrontVector, NULL);
+ for (i = 0; i < count; i++)
+ {
+ frontVector[ i ] = elements[ i ];
+ }
+ aJni->ReleaseIntArrayElements(aFrontVector, elements, 0);
+
+ // copy java above vector array to native above vector array
+ TInt aboveVector[ KAMMSVectorComponents ];
+ count = aJni->GetArrayLength(aAboveVector);
+ elements = aJni->GetIntArrayElements(aAboveVector, NULL);
+ for (i = 0; i < count; i++)
+ {
+ aboveVector[ i ] = elements[ i ];
+ }
+ aJni->ReleaseIntArrayElements(aAboveVector, elements, 0);
+
+ TInt error;
+ error = eventSource->ExecuteTrap(
+ SetOrientationVectorsL,
+ control,
+ frontVector,
+ aboveVector);
+
+ return error;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/pancontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_PanControl.h"
+#include <mmafunctionserver.h>
+#include "cammspancontrolgroup.h"
+
+/**
+ * wrapper for CAMMSPanControlGroup::Pan()
+ */
+static TInt GetPan(CAMMSPanControlGroup* aControl)
+{
+ return aControl->Pan();
+}
+
+/**
+ * wrapper for CAMMSPanControlGroup::SetPanL()
+ */
+static void SetPanL(CAMMSPanControlGroup* aControl, TInt aPan, TInt *aReturnedPan)
+{
+ aControl->SetPanL(aPan, *aReturnedPan);
+}
+
+/*
+ * Class: com_nokia_amms_control_PanControl
+ * Method: _getPan
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PanControl__1getPan(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSPanControlGroup* control = static_cast< CAMMSPanControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return eventSource->Execute(GetPan, control);
+}
+
+/*
+ * Class: com_nokia_amms_control_PanControl
+ * Method: _setPan
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PanControl__1setPan(
+ JNIEnv* aJniEnv,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aPan,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSPanControlGroup* control = static_cast< CAMMSPanControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ TInt error;
+ TInt aReturnedPan;
+ error = eventSource->ExecuteTrap(SetPanL, control, (TInt) aPan, &aReturnedPan);
+
+ // the returned pan value is between -100 and 100 (and the error code as well)
+ jint javaError[ 1 ] = { error };
+ aJniEnv->SetIntArrayRegion(aError, 0, 1, javaError);
+ return aReturnedPan;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/prioritycontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_PriorityControl.h"
+#include <mmafunctionserver.h>
+#include "cammsprioritycontrol.h"
+
+/**
+ * wrapper for CAMMSPriorityControl::Priority()
+ */
+static TInt GetPriority(CAMMSPriorityControl* aControl)
+{
+ return aControl->Priority();
+}
+
+/**
+ * wrapper for CAMMSPriorityControl::SetPriorityL()
+ */
+static void SetPriorityL(CAMMSPriorityControl* aControl, TInt aPriority)
+{
+ aControl->SetPriorityL(aPriority);
+}
+
+/*
+ * Class: com_nokia_amms_control_PriorityControl
+ * Method: _getPriority
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1getPriority(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
+ reinterpret_cast< CAMMSControl *>(aControl));
+
+ return eventSource->Execute(GetPriority, control);
+}
+
+/*
+ * Class: com_nokia_amms_control_PriorityControl
+ * Method: _setPriority
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1setPriority(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aPriority)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
+ reinterpret_cast< CAMMSControl* >(aControl));
+
+ TInt error = eventSource->ExecuteTrap(
+ &SetPriorityL, control, (TInt) aPriority);
+
+ return error;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/reverbcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audioeffect_ReverbControl.h"
+#include <mmafunctionserver.h>
+#include "cammsreverbcontrolgroup.h"
+
+/**
+ * wrapper for CAMMSReverbControlGroup::SetReverbLevelL()
+ */
+static void SetReverbLevelL(
+ CAMMSReverbControlGroup* aControl,
+ TInt *aLevel)
+{
+ aControl->SetReverbLevelL(*aLevel);
+ *aLevel = aControl->ReverbLevel();
+}
+
+/**
+ * wrapper for CAMMSReverbControlGroup::SetReverbLevelL()
+ */
+static void SetReverbTimeL(
+ CAMMSReverbControlGroup* aControl,
+ TInt aTime)
+{
+ aControl->SetReverbTimeL(aTime);
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbControl
+ * Method: _getReverbLevel
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1getReverbLevel(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->ReverbLevel();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbControl
+ * Method: _getReverbTime
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1getReverbTime(
+ JNIEnv*, jclass, jint aEventSource, jint aControl)
+{
+ CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup *>(aControl));
+
+ return control->ReverbTime();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbControl
+ * Method: _setReverbTime
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1setReverbTime(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aTime)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetReverbTimeL, control, (TInt) aTime);
+ return error;
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbControl
+ * Method: _setReverbLevel
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1setReverbLevel(
+ JNIEnv* aJniEnv,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aLevel,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ TInt level = aLevel;
+
+ error = eventSource->ExecuteTrap(
+ SetReverbLevelL,
+ control,
+ (TInt *) &level);
+
+ jint javaError[ 1 ] = { error };
+ aJniEnv->SetIntArrayRegion(aError, 0, 1, javaError);
+
+ return level;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/reverbsourcecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+//#include <jutils.h>
+
+#include "com_nokia_amms_control_audioeffect_ReverbSourceControl.h"
+#include <mmafunctionserver.h>
+#include "cammsreverbsourcecontrolgroup.h"
+
+
+/**
+ * wrapper for CAMMSReverbSourceControlGroup::SetRoomLevelL()
+ */
+static void SetRoomLevelL(
+ CAMMSReverbSourceControlGroup* aControl,
+ TInt aLevel)
+{
+ aControl->SetRoomLevelL(aLevel);
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbSourceControl
+ * Method: _getRoomLevel
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbSourceControl__1getRoomLevel(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl)
+{
+ CAMMSReverbSourceControlGroup* control =
+ static_cast< CAMMSReverbSourceControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ return control->RoomLevel();
+}
+
+/*
+ * Class: com_nokia_amms_control_audioeffect_ReverbSourceControl
+ * Method: _setRoomLevel
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbSourceControl__1setRoomLevel(
+ JNIEnv*,
+ jclass,
+ jint aEventSource,
+ jint aControl,
+ jint aLevel)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CAMMSReverbSourceControlGroup* control =
+ static_cast< CAMMSReverbSourceControlGroup* >(
+ reinterpret_cast< CAMMSControlGroup* >(aControl));
+
+ TInt error;
+ error = eventSource->ExecuteTrap(SetRoomLevelL, control, (TInt) aLevel);
+ return error;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/jni/src/volumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+//#include <jutils.h>
+#include <logger.h>
+
+#include <mmafunctionserver.h>
+
+// Generated JNI header.
+#include "com_nokia_amms_control_VolumeControl.h"
+
+#include "cammsvolumecontrolgroup.h"
+
+/**
+ * Calls CAMMSVolumeControlGroup::SetLevelL method.
+ * @param aVolumeControl CAMMSVolumeControlGroup instance.
+ * @param aLevel Level to set.
+ */
+LOCAL_C void SetVolumeL(CAMMSVolumeControlGroup* aVolumeControl, TInt aLevel)
+{
+ aVolumeControl->SetVolumeL(aLevel);
+}
+
+/**
+ * JNI function.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_amms_control_VolumeControl__1setLevel
+(JNIEnv* /*aJniEnv*/,
+ jclass,
+ jint aEventSourceHandle,
+ jint aControlHandle,
+ jint aVolume)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::VolumeControl.cpp::setLevel level = %d", aVolume);
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CAMMSVolumeControlGroup* control =
+ reinterpret_cast< CAMMSVolumeControlGroup* >(aControlHandle);
+
+ // call CAMMSVolumeControlGroup::SetVolumeL through local SetVolumeL function.
+ return eventSource->ExecuteTrap(&SetVolumeL,
+ control,
+ aVolume);
+}
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcaudiodopplercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an effect called Doppler.
+*
+*/
+
+
+#ifndef CAMMSEMCAUDIODOPPLERCONTROL_H
+#define CAMMSEMCAUDIODOPPLERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<SourceDopplerControl.h>
+#include <DopplerData.h>
+#include "cammsdopplercontrol.h"
+
+#include <cmmaemcaudioplayer.h>
+
+using multimedia :: MSourceDopplerControl;
+using multimedia :: KSourceDopplerEffectControl;
+
+
+// CONSTANTS
+_LIT(KAMMSEMCAudioDopplerControl, "DopplerControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Doppler Control effect for the Audio source.
+* This class delegates Doppler Control effect method calls to
+* MEffectControl.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCAudioDopplerControl): public CAMMSDopplerControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ *
+ */
+ static CAMMSEMCAudioDopplerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCAudioDopplerControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCAudioDopplerControl(CMMAPlayer* aPlayer);
+
+
+public:
+
+ void SetEnabledL(TBool aDopplerEnabled);
+
+ TBool Enabled();
+
+ void SetVelocityCartesianL(TInt aX, TInt aY, TInt aZ);
+
+ void VelocityCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ void SetVelocitySphericalL(TInt aAzimuth, TInt aElevation,
+ TInt aRadius);
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC SourceDoppler Control
+ */
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MSourceDopplerControl *iMSourceDopplerControl;
+};
+
+#endif // CAMMSEMCAUDIODOPPLERCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcaudiolocationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+#ifndef CAMMSEMCAUDIOLOCATIONCONTROL_H
+#define CAMMSEMCAUDIOLOCATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<SourceLocationControl.h>
+#include <LocationData.h>
+#include "cammslocationcontrol.h"
+
+#include <cmmaemcaudioplayer.h>
+
+using multimedia :: MSourceLocationControl;
+using multimedia :: KSourceLocationEffectControl;
+
+// CONSTANTS
+_LIT(KAMMSEMCAudioLocationControl, "LocationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Location Control effect for the Audio source.
+* This class delegates Location Control effect method calls to
+* MSourceLocationControl.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCAudioLocationControl): public CAMMSLocationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCAudioLocationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCAudioLocationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCAudioLocationControl(CMMAPlayer* aPlayer);
+
+
+public:
+
+ void SetLocationCartesianL(TInt& aX, TInt& aY, TInt& aZ);
+
+ void LocationCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ void SetLocationSphericalL(TInt& aAzimuth, TInt& aElevation,
+ TInt& aRadius);
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC SourceLocation Control
+ */
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MSourceLocationControl *iMSourceLocationControl;
+};
+
+#endif // CAMMSEMCAUDIOLOCATIONCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcaudiovirtualizercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Virtualizes audio channels.
+*
+*/
+
+
+#ifndef CAMMSEMCAUDIOVIRTUALIZERCONTROL_H
+#define CAMMSEMCAUDIOVIRTUALIZERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrol.h"
+#include "cammseffectcontrolgroup.h"
+#include <cmmaemcaudioplayer.h>
+#include<StereoWideningControl.h>
+//Utility for getting EnvironmentalPreset
+#include "cammsemcaudiovirtualizerenvironmentalpresetutility.h"
+
+
+using multimedia :: KStereoWideningEffectControl;
+using multimedia :: MStereoWideningControl;
+
+
+// CONSTANTS
+_LIT(KAMMSEMCAudioVirtualizerControl, "AudioVirtualizerControl");
+
+// CLASS DECLARATION
+/**
+*
+* Controls for the Audio Virtualizer effect.
+* This class delegates Audio Virtualizer effect method calls to
+* CStereoWidening.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCAudioVirtualizerControl): public CAMMSEffectControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCAudioVirtualizerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCAudioVirtualizerControl();
+
+public: // Functions from base classes
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+public: // overriden virtual functions from CAMMSEffectControl
+
+
+ virtual void SetEnforcedL(TBool aEnforced);
+
+ virtual TBool Enforced();
+
+ virtual void SetScopeL(TInt aScope);
+
+ virtual TInt Scope();
+
+protected:
+
+ virtual void ApplySettingsL();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCAudioVirtualizerControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /** Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+ TBuf<KAMMSMaxPresetNameLength> iPresetName;
+
+ /** Index of the current preset */
+ TInt iCurrentPreset;
+ /* AudioVirtualizer utility to get preset and data related to that preset*/
+ CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility * iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility;
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC AudioVirtualizer Control
+ */
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MStereoWideningControl *iMStereoWideningControl;
+
+
+};
+
+#endif // CAMMSEMCAUDIOVIRTUALIZERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcaudiovirtualizerenvironmentalpresetutility.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Utility to get the preset and data
+*
+*/
+
+
+#ifndef CAMMSEMCAUDIOVIRTUALIZERENVIRONMENTALPRESETUTILITY_H
+#define CAMMSEMCAUDIOVIRTUALIZERENVIRONMENTALPRESETUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsemcbasemmfdevsound.h"
+#include <StereoWideningUtility.h>
+#include <StereoWideningUtilityData.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * @since 5.1
+ */
+NONSHARABLE_CLASS(CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility)
+ : public CAMMSEMCBaseMMFDevSound
+{
+public: // destructor
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility();
+
+public: // New functions
+
+ /**
+ * Gets the current preset.
+ *
+ * @return the current preset
+ */
+ void GetPresetAtIndexL(TDes& aPreset ,TInt iPresetIndex);
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Creates utilities that can be used to obtain CSterioWidening Utility
+ * and preset data .
+ * Does nothing if the utility already exists.
+ */
+ virtual void PrepareEmptyStereoWideningUtilitiesL();
+
+ /**
+ * Deletes Environmental utilities
+ * Does nothing if the utilities have already been deleted.
+ */
+ virtual void DeleteEmptyStereoWideningUtilities();
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ virtual void GetPresetNamesL(CDesCArray& aPresetNames);
+
+ CStereoWidening * GetStereoWideningAtPresetIndexL(TInt iPresetIndex);
+
+public:
+ /**
+ * c++ constructor.
+ */
+ CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility();
+ /**
+ * 2nd phase constructor.
+ */
+
+ void ConstructL();
+
+protected: // data
+
+ // Available preset names, owned
+ CDesCArrayFlat* iPresetNames;
+ // Used to get preset names and data when the group is empty
+ // (there are no controls in the group, and thus, no actual
+ // control can be used for that purpose).
+ CStereoWideningUtility* iEmptyStereoWideningUtility;
+
+};
+
+#endif // CAMMSEMCAUDIOVIRTUALIZERENVIRONMENTALPRESETUTILITY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcbasemmfdevsound.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Utility to get the preset and data
+*
+*/
+
+
+#ifndef CAMMSEMCBASEMMFDEVSOUND_H
+#define CAMMSEMCBASEMMFDEVSOUND_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <mmf/server/sounddevice.h>
+#include <mmf/common/mmfbase.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * Group for effect controls
+ *
+ * @since 5.1
+ */
+NONSHARABLE_CLASS(CAMMSEMCBaseMMFDevSound)
+ :public CBase, public MDevSoundObserver
+{
+public: // destructor
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSEMCBaseMMFDevSound();
+
+public: // From MDevSoundObserver
+
+ // empty implementation for callback methods from MDevSoundObserver
+ virtual void InitializeComplete(TInt aError);
+ virtual void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {}
+ virtual void PlayError(TInt /*aError*/) {}
+
+ virtual void ToneFinished(TInt /*aError*/) {}
+ virtual void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {}
+ virtual void RecordError(TInt /*aError*/) {}
+ virtual void ConvertError(TInt /*aError*/) {}
+ virtual void DeviceMessage(TUid /*aMessageType*/,
+ const TDesC8& /*aMsg*/) {}
+ virtual void SendEventToClient(const TMMFEvent& /*aEvent*/) {}
+
+
+protected:
+ virtual TInt CreateAndInitializeDevSoundL();
+
+ /**
+ * Deletes utilities
+ * Does nothing if the utilities have already been deleted.
+ */
+ virtual void DeleteDevSound();
+
+public:
+ /**
+ * c++ constructor.
+ */
+ CAMMSEMCBaseMMFDevSound();
+ /**
+ * 2nd phase constructor.
+ */
+
+ void ConstructL();
+
+protected:
+
+ CMMFDevSound* iMMFDevSound;
+
+
+private:
+ // Used to wait for Initializing the iMMFDevSound.
+ CActiveSchedulerWait* iActiveSchedulerWait; // Owned.
+
+};
+
+#endif // CAMMSEMCBASEMMFDEVSOUND_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcdistanceattenuationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+#ifndef CAMMSEMCDISTANCEATTENUATIONCONTROL_H
+#define CAMMSEMCDISTANCEATTENUATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<DistanceAttenuationControl.h>
+#include <DistanceAttenuationData.h>
+#include "cammsbasedistanceattenuationcontrol.h"
+
+#include <cmmaemcaudioplayer.h>
+
+using multimedia :: MDistanceAttenuationControl;
+using multimedia :: KDistanceAttenuationEffectControl;
+
+
+// CONSTANTS
+_LIT(KAMMSEMCDistanceAttenuationControl, "DistanceAttenuationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Distance Attenuation effect.
+* This class delegates Distance Attenuation effect method calls to
+* CDistanceAttenuation.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCDistanceAttenuationControl): public CAMMSBaseDistanceAttenuationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCDistanceAttenuationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCDistanceAttenuationControl();
+
+public: // Overriden the base class function
+
+ /**
+ * Sets all the 3D audio distance attenuation parameters simultaneously.
+ * Distances are specified in units defined by
+ * "GlobalManager.getUnitsPerMeter()"
+ *
+ * @param aMinDistance The minimum distance, below which the distance
+ * gain is clipped to its maximum value of 1.0.
+ * @param aMaxDistance The maximum distance, beyond which the distance
+ * gain does not decrease any more. The exact behaviour of the gain at
+ * distances beyond the maximum distance depends on the value of the
+ * muteAfterMax.
+ * @param aMuteAfterMax A boolean determining how the distance gain
+ * behaves at distances greater than maxDistance: true if beyond the
+ * maximum distance the source is silent; false if beyond the maximum
+ * distance the source's gain is held constant at the level at the
+ * maximum distance.
+ * @param aRolloffFactor The rolloff factor, specified in thousandths
+ * (1000 representing a rolloff factor of 1.0, 2000 representing 2.0 and
+ * 500 representing 0.5). Higher values cause the distance gain to
+ * attenuate more quickly.
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aMaxDistance <= \a aMinDistance,
+ * \a aMinDistance <= 0, \a aMaxDistance <= 0 or \a aRolloffFactor < 0
+ */
+ void SetParametersL(
+ TInt aMinDistance,
+ TInt aMaxDistance,
+ TBool aMuteAfterMax,
+ TInt aRolloffFactor);
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCDistanceAttenuationControl(CMMAPlayer* aPlayer);
+
+private: // Data
+
+ CMMAPlayer *iMMAPlayer;
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MDistanceAttenuationControl *iMDistanceAttenuationControl;
+
+};
+
+#endif // CAMMSEMCDISTANCEATTENUATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcequalizercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+#ifndef CAMMSEMCEQUALIZERCONTROL_H
+#define CAMMSEMCEQUALIZERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrolgroup.h"
+//EMC
+#include <EffectControl.h>
+#include <EqualizerControl.h>
+#include "cammsbaseequalizercontrol.h"
+#include <cmmaemcaudioplayer.h>
+//Utility for getting EnvironmentalReverb
+#include "cammsemcequalizerenvironmentalpresetutility.h"
+
+
+using multimedia :: KEqualizerEffectControl;
+using multimedia::MEqualizerControl;
+
+
+// CONSTANTS
+_LIT(KAMMSEMCEqualizerControl, "EqualizerControl");
+_LIT(KAMMSEMCDefaultEqualizerPreset, "smallroom");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Equalizer effect.
+* This class delegates Equalizer effect method calls to CAudioEqualizer.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCEqualizerControl): public CAMMSBaseEqualizerControl
+{
+public:
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCEqualizerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCEqualizerControl();
+
+public: // New functions
+
+ /**
+ * Gets the gain set for the given equalizer band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The gain set for the given band in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand is out of range.
+ */
+ TInt BandLevelL(TInt aBand);
+
+ /**
+ * Returns the maximum band level supported.
+ *
+ * @return The maximum band level in millibels.
+ */
+ TInt MaxBandLevel();
+
+ /**
+ * Returns the minimum band level supported.
+ *
+ * @return The minimum band level in millibels.
+ */
+ TInt MinBandLevel();
+
+ /**
+ * Returns the band width in Hz for the specified band.
+ *
+ * @param aBand The frequency band whose band width is asked.
+ * The numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @return The band width in Hz for the specified band.
+ */
+ TInt BandWidth(TInt aBand);
+
+ /**
+ * Returns the center frequency in Hz for a given band.
+ *
+ * @param aBand The frequency band whose center frequency
+ * is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The center frequency in Hz for a given band.
+ */
+ TInt CenterFrequency(TInt aBand);
+
+ /**
+ * Returns the cross-over frequency between the given frequency
+ * band (aBand) and the next band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return Crossover frequency.
+ */
+ TInt CrossoverFrequency(TInt aBand);
+
+ /**
+ * Gets the number of frequency bands that the equalizer supports.
+ *
+ * @return The number of frequency bands that the equalizer supports.
+ */
+ TInt NumberOfBands();
+
+ /**
+ * Sets the given equalizer band to the given gain value.
+ *
+ * @param aLevel The new gain in millibels that will be set to the given
+ * band. getMinBandLevel() and getMaxBandLevel() will define the maximum
+ * and minimum values.
+ * @param aBand The frequency band that will have the new gain. The
+ * numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand or \a aLevel is out of range.
+ */
+ void SetBandLevelL(TInt aLevel, TInt aBand);
+
+public: // Functions from base classes
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+public: // override the virtual functions from base class CAMMSEffectControl
+
+ void SetEnforcedL(TBool aEnforced);
+ TBool Enforced();
+ void SetScopeL(TInt aScope);
+ TInt Scope();
+ void ApplySettingsL();
+
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCEqualizerControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /** Native audio equalizer */
+ // CAudioEqualizerUtility* iEqualizerUtility;
+
+ /* Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+
+ TBuf<KAMMSMaxPresetNameLength> iPresetName;
+
+ /* Index of the current preset */
+ TInt iCurrentPreset;
+
+ /* Equalizer utility to get preset and data related to that preset*/
+ CAMMSEMCEqualizerEnvironmentalPresetUtility * iAMMSEMCEqualizerEnvironmentalPresetUtility;
+
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Equalizer Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MEqualizerControl *iMEqualizerControl;
+
+};
+
+#endif // CAMMSEMCEQUALIZERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcequalizerenvironmentalpresetutility.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Utility to get the preset and data
+*
+*/
+
+
+#ifndef CAMMSEMCEQUALIZERENVIRONMENTALPRESETUTILITY_H
+#define CAMMSEMCEQUALIZERENVIRONMENTALPRESETUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsemcbasemmfdevsound.h"
+#include <AudioEqualizerUtility.h>
+#include <AudioEqualizerUtilityData.h>
+
+// CLASS DECLARATION
+
+/**
+ * Group for effect controls
+ *
+ * @since 5.1
+ */
+NONSHARABLE_CLASS(CAMMSEMCEqualizerEnvironmentalPresetUtility)
+ : public CAMMSEMCBaseMMFDevSound
+{
+public: // destructor
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCEqualizerEnvironmentalPresetUtility();
+
+public: // New functions
+
+ /**
+ * Gets the current preset.
+ *
+ * @return the current preset
+ */
+ void GetPresetAtIndexL(TDes& aPreset ,TInt iPresetIndex);
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Creates utilities that can be used to obtain CAudioEqualizer Utility
+ * and preset data .
+ * Does nothing if the utility already exists.
+ */
+ virtual void PrepareEmptyEqualizerUtilitiesL();
+
+ /**
+ * Deletes Environmental utilities
+ * Does nothing if the utilities have already been deleted.
+ */
+ virtual void DeleteEmptyEqualizerUtilities();
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ virtual void GetPresetNamesL(CDesCArray& aPresetNames);
+
+ CAudioEqualizer * GetEqualizerAtPresetIndexL(TInt iPresetIndex);
+
+public:
+ /**
+ * c++ constructor.
+ */
+ CAMMSEMCEqualizerEnvironmentalPresetUtility();
+ /**
+ * 2nd phase constructor.
+ */
+
+ void ConstructL();
+
+protected: // data
+
+ // Available preset names, owned
+ CDesCArrayFlat* iPresetNames;
+ // Pointer to the EqualizerUtility
+ CAudioEqualizerUtility* iEmptyEqualizerUtility;
+
+};
+
+#endif // CAMMSEMCEQUALIZERENVIRONMENTALPRESETUTILITY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcreverbcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+
+#ifndef CAMMSEMCREVERBCONTROL_H
+#define CAMMSEMCREVERBCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <EnvironmentalReverbBase.h>
+#include <EnvironmentalReverbUtility.h>
+#include "cammseffectcontrol.h"
+#include "cammseffectcontrolgroup.h"
+
+//EMC
+#include <EffectControl.h>
+#include <ReverbControl.h>
+#include <cammsbasereverbcontrol.h>
+#include <cmmaemcaudioplayer.h>
+//Utility for getting EnvironmentalReverb
+#include "cammsemcreverbenvironmentalpresetutility.h"
+
+
+using multimedia :: KReverbEffectControl;
+using multimedia :: MReverbControl;
+
+// CONSTANTS
+_LIT(KAMMSEMCReverbControl, "ReverbControl");
+_LIT(KAMMSEMCDefaultReverbPreset, "smallroom");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb effect.
+* This class delegates Reverb effect method calls to CReverb.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCReverbControl): public CAMMSBaseReverbControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCReverbControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCReverbControl();
+
+public: // New functions
+
+ /**
+ * Sets the gain level of the reverberation. The value defines what is
+ * the relative level of the first reflections compared to the sound
+ * source without possible distance attenuations, directivities or
+ * obstructions taken into account.
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ TInt SetReverbLevelL(TInt aLevel);
+
+ /**
+ * Sets the reverberation time of the reverb. The reverberation time is
+ * the time taken for the reverberant sound to attenuate by 60 dB from
+ * its initial level. Typical values are in the range from 100 to 20000
+ * milliseconds.
+ * The implementation might not support long reverberation times.
+ * Therefore, the actual time used might be shorter than the time
+ * specified with this method.
+ *
+ * @param aTime The new reverberation time in milliseconds.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aTime is negative.
+ * From Java API more leave codes are:
+ * - java.lang.IllegalArgumentException - when the given time is
+ * negative
+ * - javax.microedition.media.MediaException - when the changing of the
+ * reverb time is not supported
+ */
+ void SetReverbTimeL(TInt aTime);
+
+ /**
+ * Gets the gain level of the reverberation.
+ *
+ * @return The level of the reverberation in millibels.
+ */
+ TInt ReverbLevel();
+
+ /**
+ * Gets the reverberation time.
+ *
+ * @return The time of the reverberation in milliseconds.
+ */
+ TInt ReverbTime();
+
+ /**
+ * Gets the minimum level of the reverberation.
+ *
+ * @return The minimum level of the reverberation in millibels.
+ */
+ TInt MinReverbLevel();
+
+ /**
+ * Gets the maximum level of the reverberation.
+ *
+ * @return The maximum level of the reverberation in millibels.
+ */
+ TInt MaxReverbLevel();
+
+public: // Functions from base classes
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+public: // Functions needed by reverb source control
+ /**
+ * Returns the Reverb Control.
+ * CAMMSEMCReverbSourceControl has to use the same instance.
+ * The function creates the instance if they do not exist yet.
+ */
+ MReverbControl * GetReverbControlL();
+
+
+ /**
+ * Returns the Current Preset Index.
+ * CAMMSEMCReverbSourceControl has to use it.
+ */
+
+ TInt CurrentPresetIndex();
+
+public: // override the virtual functions from base class CAMMSEffectControl
+
+ void SetEnforcedL(TBool aEnforced);
+ TBool Enforced();
+ void SetScopeL(TInt aScope);
+ TInt Scope();
+ void ApplySettingsL();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCReverbControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /* Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+
+ TBuf<KAMMSMaxPresetNameLength> iPresetName;
+
+ /* Index of the current preset */
+ TInt iCurrentPreset;
+
+ /* Reverb utility to get Environmental Reverb*/
+ CAMMSEMCReverbEnvironmentalPresetUtility *iAMMSEMCReverbEnvironmentalPresetUtility;
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Reverb Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MReverbControl *iMReverbControl;
+ TInt iEnvReverbLevel;
+
+};
+
+#endif // CAMMSEMCREVERBCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcreverbenvironmentalpresetutility.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Utility to get the preset and data
+*
+*/
+
+
+#ifndef CAMMSEMCREVERBENVIRONMENTALPRESETUTILITY_H
+#define CAMMSEMCREVERBENVIRONMENTALPRESETUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsemcbasemmfdevsound.h"
+#include <EnvironmentalReverbUtility.h>
+#include <EnvironmentalReverbData.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * Group for effect controls
+ *
+ * @since 5.1
+ */
+NONSHARABLE_CLASS(CAMMSEMCReverbEnvironmentalPresetUtility)
+ : public CAMMSEMCBaseMMFDevSound
+{
+public: // destructor
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCReverbEnvironmentalPresetUtility();
+
+public: // New functions
+
+ /**
+ * Gets the current preset.
+ *
+ * @return the current preset
+ */
+ void GetPresetAtIndexL(TDes& aPreset ,TInt iPresetIndex);
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Creates utilities that can be used to obtain CEnvironmentalReverb Utility
+ * and preset data .
+ * Does nothing if the utility already exists.
+ */
+ virtual TInt PrepareEmptyReverbUtilitiesL();
+
+ /**
+ * Deletes Environmental utilities
+ * Does nothing if the utilities have already been deleted.
+ */
+ virtual void DeleteEmptyReverbUtilities();
+ /**
+ * Gets list of preset names available.
+ * @param aPresetNames Returned preset names
+ */
+ virtual void GetPresetNamesL(CDesCArray& aPresetNames);
+
+ CEnvironmentalReverb * GetEnvironmentalReverbAtPresetIndexL(TInt iPresetIndex);
+
+ CMMFDevSound* MMFDevSound();
+
+public:
+ /**
+ * c++ constructor.
+ */
+ CAMMSEMCReverbEnvironmentalPresetUtility();
+ /**
+ * 2nd phase constructor.
+ */
+
+ void ConstructL();
+
+protected: // data
+
+ // Available preset names, owned
+ CDesCArrayFlat* iPresetNames;
+ // Used to get preset names and data when the group is empty
+ // (there are no controls in the group, and thus, no actual
+ // control can be used for that purpose).
+ CEnvironmentalReverbUtility* iEmptyEnvironmentalReverbUtility;
+
+};
+
+#endif // CAMMSEMCREVERBENVIRONMENTALPRESETUTILITY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcreverbsourcecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect reverb source.
+*
+*/
+
+
+#ifndef CAMMSEMCREVERBSOURCECONTROL_H
+#define CAMMSEMCREVERBSOURCECONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <RoomLevelControl.h>
+#include "cammsbasereverbsourcecontrol.h"
+#include <cmmaemcaudioplayer.h>
+// CONSTANTS
+_LIT(KAMMSEMCReverbSourceControl, "ReverbSourceControl");
+
+using multimedia::MRoomLevelControl;
+using multimedia::KRoomLevelEffectControl;
+
+// FORWARD DECLARATIONS
+class CAMMSBaseReverbControl;
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb Source effect.
+* This class delegates Reverb Source effect method calls to CRoomLevel.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCReverbSourceControl): public CAMMSBaseReverbSourceControl /*CAMMSControl*/
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ * @param aReverbControl Reverb control belonging to aPlayer.
+ */
+ static CAMMSEMCReverbSourceControl* NewLC(CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aBaseReverbControl);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCReverbSourceControl();
+
+public: // New functions
+
+ /**
+ * Sets the object specific level for the reverberant sound.
+ * The default value is 0 meaning the natural room gain (set by
+ * ReverbControl's presets).
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ void SetRoomLevelL(TInt aLevel);
+
+public: // Functions from base classes
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ * @param aReverbControl Reverb control belonging to aPlayer.
+ */
+ CAMMSEMCReverbSourceControl(CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aReverbControl);
+
+private: // Data
+
+ /** Reverb control belonging to the player */
+ CAMMSBaseReverbControl* iBaseReverbControl;
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC ReverbSource Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MRoomLevelControl* iRoomLevelControl;
+};
+
+#endif // CAMMSEMCREVERBSOURCECONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcspectatordopplercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler of the spectator.
+*
+*/
+
+
+#ifndef CAMMSEMCSPECTATORDOPPLERCONTROL_H
+#define CAMMSEMCSPECTATORDOPPLERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<ListenerDopplerControl.h>
+#include <DopplerData.h>
+#include "cammsdopplercontrol.h"
+#include <cmmaemcaudioplayer.h> // from MMAPI
+
+using multimedia :: MListenerDopplerControl;
+using multimedia :: KListenerDopplerEffectControl;
+
+// CONSTANTS
+_LIT(KAMMSEMCListenerDopplerControl, "DopplerControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Doppler Control effect for the Spectator.
+* This class delegates Doppler Control effect method calls to
+* MListenerDopplerControl.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCSpectatorDopplerControl): public CAMMSDopplerControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCSpectatorDopplerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCSpectatorDopplerControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCSpectatorDopplerControl(CMMAPlayer* aPlayer);
+
+public:
+
+ void SetEnabledL(TBool aDopplerEnabled);
+
+ TBool Enabled();
+
+ void SetVelocityCartesianL(TInt aX, TInt aY, TInt aZ);
+
+ void VelocityCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ void SetVelocitySphericalL(TInt aAzimuth, TInt aElevation,
+ TInt aRadius);
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Spectator Doppler Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MListenerDopplerControl *iMListenerDopplerControl;
+};
+
+#endif // CAMMSEMCSPECTATORDOPPLERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcspectatorlocationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+#ifndef CAMMSEMCSPECTATORLOCATIONCONTROL_H
+#define CAMMSEMCSPECTATORLOCATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<ListenerLocationControl.h>
+#include <LocationData.h>
+#include "cammslocationcontrol.h"
+#include <cmmaemcaudioplayer.h>
+
+using multimedia :: MListenerLocationControl;
+using multimedia :: KListenerLocationEffectControl;
+
+// CONSTANTS
+_LIT(KAMMSEMCSpectatorLocationControl, "LocationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Location Control effect for the Audio source.
+* This class delegates Location Control effect method calls to
+* MSourceLocationControl.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCSpectatorLocationControl): public CAMMSLocationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCSpectatorLocationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCSpectatorLocationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCSpectatorLocationControl(CMMAPlayer* aPlayer);
+
+
+public:
+
+ void SetLocationCartesianL(TInt& aX, TInt& aY, TInt& aZ);
+
+ void LocationCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ void SetLocationSphericalL(TInt& aAzimuth, TInt& aElevation,
+ TInt& aRadius);
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Listener Location Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MListenerLocationControl *iMListenerLocationControl;
+};
+
+#endif // CAMMSEMCSPECTATORLOCATIONCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammsemcspectatororientationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of the spectator.
+*
+*/
+
+
+#ifndef CAMMSEMCSPECTATORORIENTATIONCONTROL_H
+#define CAMMSEMCSPECTATORORIENTATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include<ListenerOrientationControl.h>
+#include <OrientationData.h>
+#include "cammsorientationcontrol.h"
+#include <cmmaemcaudioplayer.h>
+
+using multimedia :: MListenerOrientationControl;
+using multimedia :: KListenerOrientationEffectControl;
+
+// CONSTANTS
+_LIT(KAMMSEMCSpectatorOrientationControl, "OrientationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Orientation Control effect for the Spectator.
+* This class delegates Orientation Control effect method calls to
+* MListenerOrientationControl.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSEMCSpectatorOrientationControl): public CAMMSOrientationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEMCSpectatorOrientationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEMCSpectatorOrientationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEMCSpectatorOrientationControl(CMMAPlayer* aPlayer);
+public:
+ //base class function overidden
+ virtual void SetOrientationL(TInt aHeading, TInt aPitch, TInt aRoll);
+ virtual void SetOrientationL(TInt aFrontX,
+ TInt aFrontY,
+ TInt aFrontZ,
+ TInt aAboveX,
+ TInt aAboveY,
+ TInt aAboveZ);
+
+ virtual void OrientationVectors(TInt& aFrontX,
+ TInt& aFrontY,
+ TInt& aFrontZ,
+ TInt& aAboveX,
+ TInt& aAboveY,
+ TInt& aAboveZ);
+
+
+private:
+
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Listener Orientation Control
+ */
+
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MListenerOrientationControl *iMListenerOrientationControl;
+
+};
+
+#endif // CAMMSEMCSPECTATORORIENTATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.emc/cammspancontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the panning of a Player in the stereo output mix.
+*
+*/
+
+
+#ifndef CAMMSPANCONTROL_H
+#define CAMMSPANCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmfstandardcustomcommands.h>
+#include <midiclientutility.h>
+#include "cammscontrol.h"
+
+//EMC header
+#include <BalanceControl.h>
+#include <cmmaemcaudioplayer.h>
+using multimedia :: MBalanceControl;
+using multimedia :: KBalanceEffectControl;
+// CONSTANTS
+_LIT(KAMMSPanControl, "PanControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Panning effect.
+* This class delegates Pan effect method calls to CBalance.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSPanControl): public CAMMSControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSPanControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSPanControl();
+
+public: // New functions
+
+ /**
+ * Gets the current panning set.
+ *
+ * @return The current balance or panning setting.
+ */
+ TInt PanL();
+
+ /**
+ * Sets the panning using a linear point scale with values between -100
+ * and 100. 0 represents panning for both channels, -100 full panning to
+ * the left and 100 full panning to the right. If the given panning
+ * value is less than -100 or greater than 100, the panning will be set
+ * to -100 or 100, respectively.
+ *
+ * @param aPan The new panning to be set.
+ *
+ * @return The panning that was actually set.
+ */
+ TInt SetPanL(TInt aPan);
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSPanControl(CMMAPlayer* aPlayer);
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+
+private: // Data
+
+ /** Client class to access Audio Play Device functionality, owned */
+ RMMFAudioPlayDeviceCustomCommands* iRMMFAudioPlayDeviceCustomCommands;
+
+ /** CMidiClientUtility, not owned. */
+ CMidiClientUtility* iMidiClientUtility;
+private:
+ CMMAPlayer *iMMAPlayer;
+ /**
+ * EMC Pan Control
+ */
+ CMultimediaFactory* iFactory;
+ MStreamControl* iStreamControl;
+ MBalanceControl *iMBalanceControl;
+};
+
+#endif // CAMMSPANCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc.mmf/cammspancontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the panning of a Player in the stereo output mix.
+*
+*/
+
+
+#ifndef CAMMSPANCONTROL_H
+#define CAMMSPANCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <MMFStandardCustomCommands.h>
+#include <MidiClientUtility.h>
+#include "CAMMSControl.h"
+
+// CONSTANTS
+_LIT(KAMMSPanControl, "PanControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Panning effect.
+* This class delegates Pan effect method calls to CBalance.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSPanControl): public CAMMSControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSPanControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSPanControl();
+
+public: // New functions
+
+ /**
+ * Gets the current panning set.
+ *
+ * @return The current balance or panning setting.
+ */
+ TInt PanL();
+
+ /**
+ * Sets the panning using a linear point scale with values between -100
+ * and 100. 0 represents panning for both channels, -100 full panning to
+ * the left and 100 full panning to the right. If the given panning
+ * value is less than -100 or greater than 100, the panning will be set
+ * to -100 or 100, respectively.
+ *
+ * @param aPan The new panning to be set.
+ *
+ * @return The panning that was actually set.
+ */
+ TInt SetPanL(TInt aPan);
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSPanControl(CMMAPlayer* aPlayer);
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+
+private: // Data
+
+ /** Client class to access Audio Play Device functionality, owned */
+ RMMFAudioPlayDeviceCustomCommands* iRMMFAudioPlayDeviceCustomCommands;
+
+ /** CMidiClientUtility, not owned. */
+ CMidiClientUtility* iMidiClientUtility;
+};
+
+#endif // CAMMSPANCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsaudiodopplercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an effect called Doppler.
+*
+*/
+
+
+#ifndef CAMMSAUDIODOPPLERCONTROL_H
+#define CAMMSAUDIODOPPLERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <SourceDopplerBase.h>
+#include <CustomCommandUtility.h>
+#include "cammsdopplercontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSAudioDopplerControl, "DopplerControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Doppler Control effect for the Audio source.
+* This class delegates Doppler Control effect method calls to
+* CSourceDoppler.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSAudioDopplerControl): public CAMMSDopplerControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ *
+ */
+ static CAMMSAudioDopplerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudioDopplerControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSAudioDopplerControl(CMMAPlayer* aPlayer);
+};
+
+#endif // CAMMSAUDIODOPPLERCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsaudiolocationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+#ifndef CAMMSAUDIOLOCATIONCONTROL_H
+#define CAMMSAUDIOLOCATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <SourceLocationBase.h>
+#include <CustomCommandUtility.h>
+#include "cammslocationcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSAudioLocationControl, "LocationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Location Control effect for the Audio source.
+* This class delegates Location Control effect method calls to
+* CSourceLocation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSAudioLocationControl): public CAMMSLocationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSAudioLocationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudioLocationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSAudioLocationControl(CMMAPlayer* aPlayer);
+};
+
+#endif // CAMMSAUDIOLOCATIONCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsaudiooutputcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the audio output mode.
+*
+*/
+#ifndef CAMMSAUDIOOUTPUTCONTROL_H
+#define CAMMSAUDIOOUTPUTCONTROL_H
+
+// INCLUDES
+#include "cammscontrol.h"
+#include <cmmamidiplayer.h>
+#include <mmmaplayerstatelistener.h>
+// for audio routing control
+#include <AudioOutput.h>
+
+// for audio routing observers
+#include <MAudioOutputObserver.h>
+#include <AccMonitor.h>
+#include <AccMonitorInfo.h>
+
+
+
+
+// CONSTANTS
+_LIT(KAMMSAudioOutputControl, "AudioOutputControl");
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Audio Routing.
+* This class delegates Audio Routing setting calls to RMMFController.
+*
+*
+* @since X.X
+*/
+NONSHARABLE_CLASS(CAMMSAudioOutputControl)
+ : public CAMMSControl, public MMMAPlayerStateListener ,public MAudioOutputObserver,public MAccMonitorObserver
+{
+public:
+ // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSAudioOutputControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudioOutputControl();
+
+public:
+ // New functions
+ /**
+ * Sets the AudioOutput.
+ *
+ * @param aPreference The new AudioOutput to be set.
+ */
+ TInt SetAudioOutput(TInt aPreference);
+
+ /**
+ * Gets the Audio Routing preference.
+ *
+ * @return The previously set Audio Routing preference.
+ */
+ TInt GetAudioOutput();
+ /**
+ * Reset the AudioOutput java object with changed value of current
+ */
+ void GetCurrentPreference();
+ /**
+ * Gets the Audio Routing preference.
+ *
+ * @return The previously set Audio Routing preference. and if not set retruns the device default
+ */
+
+ TInt GetCurrentPrefInt();
+ /**
+ * Gets the Audio Routing Device Default.
+ *
+ * @returns the device default
+ */
+ TInt GetDeviceDefaultPreference();
+ /**
+ * Create an Observer to get the notification for the Headset state.
+ * Also initializes iCurrentActualPreference with CAudioOutput::EPrivate if headset is connected.
+ * @returns the device default
+ */
+ void CreateHeadsetStateObserverL();
+ /**
+ * Actual native control is created using this function
+ */
+ void CreateNativeAudioOutputControlL();
+ /**
+ * seting java object used to send as callback event
+ */
+ void SetJavaAudioOutputObject(jobject object);
+ /**
+ * Reset the value of java object with current values
+ */
+ void ResetJavaAudioOutputObject();
+ /**
+ * Check if there is any change in Current output Mode,It sends a event to java
+ * If there is no change it returns silently
+ */
+ void NotifyJavaOnChange();
+
+
+public:
+ // From MMMAPlayerStateListener
+ void StateChanged(TInt aState);
+
+
+public:
+ // From MAudioOutputObserver
+ void DefaultAudioOutputChanged(CAudioOutput& aAudioOutput, CAudioOutput::TAudioOutputPreference aNewDefault);
+ void DisconnectedL(CAccMonitorInfo *aAccessoryInfo);
+ void ConnectedL(CAccMonitorInfo* aAccessoryInfo);
+ void AccMonitorObserverError(TInt aError);
+
+public:
+ // Functions from base classes
+ const TDesC& ClassName() const;
+
+protected:
+ // New functions
+ /**
+ * @param aAmmsPreference AMMS preference to be set.
+ */
+ TInt SetAudioOutputToMmf(CAudioOutput::TAudioOutputPreference aAmmsPreference);
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSAudioOutputControl(CMMAPlayer* aPlayer);
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+private:
+ //Data
+ // Preference visible in AMMS.
+ CAudioOutput::TAudioOutputPreference iRoutingUserPreference;
+ // Preference of the device changes by inserting/removing Jack.
+ CAudioOutput::TAudioOutputPreference iDefaultDevicePreference;
+ // Preference of the device changes by inserting/removing Jack.
+ TInt iCurrentPreference;
+ // owned
+ CAudioOutput* iAudioOutput;
+ CMMAPlayer::TPlayerState playerState;
+ //To get the peripheral attached/detached notification
+ CAccMonitorInfo* iAccessoryInfo;
+ RAccMonCapabilityArray capabilityArray;
+ CAccMonitor *iAccMonitor;
+ RConnectedAccessories array;
+ jobject iJavaAudioOutputObj;
+ JNIEnv* iJni;
+
+};
+
+#endif // CAMMSAUDIOOUTPUTCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsaudioplayerbuilder.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder for adding AMMS audio player controls.
+*
+*/
+
+
+#ifndef CAMMSAUDIOPLAYERBUILDER_H
+#define CAMMSAUDIOPLAYERBUILDER_H
+
+// INCLUDES
+#include "cammsplayerbuilder.h"
+
+
+// CLASS DECLARATION
+
+/**
+*
+* AudioControl player builder.
+* This class adds AMMS audio player controls.
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSAudioPlayerBuilder): public CAMMSPlayerBuilder
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSAudioPlayerBuilder* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudioPlayerBuilder();
+
+public: // Funtions from base classes
+ /**
+ * Adds the AMMS audio controls to the player
+ *
+ * @param aPlayer The Player where the AMMS controls are added
+ */
+ void PreparePlayerL(CMMAPlayer* aPlayer);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSAudioPlayerBuilder();
+
+};
+
+#endif // CAMMSAUDIOPLAYERBUILDER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsaudiovirtualizercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Virtualizes audio channels.
+*
+*/
+
+
+#ifndef CAMMSAUDIOVIRTUALIZERCONTROL_H
+#define CAMMSAUDIOVIRTUALIZERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <StereoWideningBase.h>
+#include <StereoWideningUtility.h>
+#include <CustomCommandUtility.h>
+#include "cammseffectcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSAudioVirtualizerControl, "AudioVirtualizerControl");
+
+// CLASS DECLARATION
+/**
+*
+* Controls for the Audio Virtualizer effect.
+* This class delegates Audio Virtualizer effect method calls to
+* CStereoWidening.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSAudioVirtualizerControl): public CAMMSEffectControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSAudioVirtualizerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSAudioVirtualizerControl();
+
+public: // New functions
+
+public: // Functions from base classes
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSAudioVirtualizerControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /** Native Stereo Widening Utility */
+ CStereoWideningUtility* iStereoWideningUtility;
+
+ /** Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+
+ /** Index of the current preset */
+ TInt iCurrentPreset;
+
+};
+
+#endif // CAMMSAUDIOVIRTUALIZERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsbasedistanceattenuationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+#ifndef CAMMSBASEDISTANCEATTENUATIONCONTROL_H
+#define CAMMSBASEDISTANCEATTENUATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSBaseDistanceAttenuationControl, "DistanceAttenuationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Base class for the Distance Attenuation effect.
+* This class delegates Distance Attenuation effect method calls to
+* to corresponding control.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSBaseDistanceAttenuationControl): public CAMMSControl
+{
+public: //destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSBaseDistanceAttenuationControl();
+
+public: // New functions
+
+ virtual void SetParametersL(
+ TInt/* aMinDistance*/,
+ TInt /*aMaxDistance*/,
+ TBool /*aMuteAfterMax*/,
+ TInt /*aRolloffFactor*/) = 0;
+
+public:
+ const TDesC& ClassName() const = 0;
+
+protected:
+ /**
+ * C++ default constructor, protected to allow access from derived class
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSBaseDistanceAttenuationControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSBASEDISTANCEATTENUATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsbaseequalizercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+#ifndef CAMMSBASEEQUALIZERCONTROL_H
+#define CAMMSBASEEQUALIZERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammseffectcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSBaseEqualizerControl, "EqualizerControl");
+const TInt KAMMSHalfOfSamplingFrequency = 24000000; //in milliHertz
+const TInt KAMMSBandOffset = 1; // Band 0 in JSR-234 equals Band 1 in Effect API
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Equalizer effect.
+*
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSBaseEqualizerControl): public CAMMSEffectControl
+{
+public:
+ /**
+ * Destructor.
+ */
+ ~CAMMSBaseEqualizerControl();
+
+public: // New functions
+
+ /**
+ * Gets the gain set for the given equalizer band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The gain set for the given band in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand is out of range.
+ */
+ virtual TInt BandLevelL(TInt aBand) = 0;
+
+ /**
+ * Returns the maximum band level supported.
+ *
+ * @return The maximum band level in millibels.
+ */
+ virtual TInt MaxBandLevel() = 0;
+
+ /**
+ * Returns the minimum band level supported.
+ *
+ * @return The minimum band level in millibels.
+ */
+ virtual TInt MinBandLevel() = 0;
+
+ /**
+ * Returns the band width in Hz for the specified band.
+ *
+ * @param aBand The frequency band whose band width is asked.
+ * The numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @return The band width in Hz for the specified band.
+ */
+ virtual TInt BandWidth(TInt aBand) = 0;
+
+ /**
+ * Returns the center frequency in Hz for a given band.
+ *
+ * @param aBand The frequency band whose center frequency
+ * is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The center frequency in Hz for a given band.
+ */
+ virtual TInt CenterFrequency(TInt aBand) = 0;
+
+ /**
+ * Returns the cross-over frequency between the given frequency
+ * band (aBand) and the next band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return Crossover frequency.
+ */
+ virtual TInt CrossoverFrequency(TInt aBand) = 0;
+
+ /**
+ * Gets the number of frequency bands that the equalizer supports.
+ *
+ * @return The number of frequency bands that the equalizer supports.
+ */
+ virtual TInt NumberOfBands() = 0;
+
+ /**
+ * Sets the given equalizer band to the given gain value.
+ *
+ * @param aLevel The new gain in millibels that will be set to the given
+ * band. getMinBandLevel() and getMaxBandLevel() will define the maximum
+ * and minimum values.
+ * @param aBand The frequency band that will have the new gain. The
+ * numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand or \a aLevel is out of range.
+ */
+ virtual void SetBandLevelL(TInt aLevel, TInt aBand) = 0;
+
+public:
+ virtual const TDesC& ClassName() const = 0;
+
+protected:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSBaseEqualizerControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSBASEEQUALIZERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsbasereverbcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+#ifndef CAMMSBASEREVERBCONTROL_H
+#define CAMMSBASEREVERBCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <EnvironmentalReverbBase.h>
+#include <EnvironmentalReverbUtility.h>
+#include <CustomCommandUtility.h>
+#include "cammseffectcontrol.h"
+// only require if platform support EMC
+#ifdef RD_JAVA_HTTP_EMC_ENABLED
+#include <ReverbControl.h>
+#endif
+// CONSTANTS
+_LIT(KAMMSBaseReverbControl, "ReverbControl");
+_LIT(KAMMSBaseDefaultReverbPreset, "smallroom");
+
+// only require if platform support EMC
+#ifdef RD_JAVA_HTTP_EMC_ENABLED
+using multimedia :: MReverbControl;
+#endif
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb effect.
+* This class delegates Reverb effect method calls to CReverb.
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSBaseReverbControl): public CAMMSEffectControl
+{
+public: // destructor
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSBaseReverbControl();
+
+public: // New functions
+
+ /**
+ * Sets the gain level of the reverberation. The value defines what is
+ * the relative level of the first reflections compared to the sound
+ * source without possible distance attenuations, directivities or
+ * obstructions taken into account.
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ virtual TInt SetReverbLevelL(TInt aLevel) = 0;
+
+ /**
+ * Sets the reverberation time of the reverb. The reverberation time is
+ * the time taken for the reverberant sound to attenuate by 60 dB from
+ * its initial level. Typical values are in the range from 100 to 20000
+ * milliseconds.
+ * The implementation might not support long reverberation times.
+ * Therefore, the actual time used might be shorter than the time
+ * specified with this method.
+ *
+ * @param aTime The new reverberation time in milliseconds.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aTime is negative.
+ * From Java API more leave codes are:
+ * - java.lang.IllegalArgumentException - when the given time is
+ * negative
+ * - javax.microedition.media.MediaException - when the changing of the
+ * reverb time is not supported
+ */
+ virtual void SetReverbTimeL(TInt aTime) = 0;
+
+ /**
+ * Gets the gain level of the reverberation.
+ *
+ * @return The level of the reverberation in millibels.
+ */
+ virtual TInt ReverbLevel() = 0;
+
+ /**
+ * Gets the reverberation time.
+ *
+ * @return The time of the reverberation in milliseconds.
+ */
+ virtual TInt ReverbTime() = 0;
+
+ /**
+ * Gets the minimum level of the reverberation.
+ *
+ * @return The minimum level of the reverberation in millibels.
+ */
+ virtual TInt MinReverbLevel() = 0;
+
+ /**
+ * Gets the maximum level of the reverberation.
+ *
+ * @return The maximum level of the reverberation in millibels.
+ */
+ virtual TInt MaxReverbLevel() = 0;
+
+ /**
+ * Gets the current preset index.
+ *
+ */
+ virtual TInt CurrentPresetIndex() = 0;
+
+public:
+
+ virtual const TDesC& ClassName() const = 0;
+
+
+public: // Functions needed by reverb source control
+
+ /**
+ * Returns the environmental reverb utility.
+ * ReverbSourceControl has to use the same instance.
+ * The function creates the instance if they do not exist yet.
+ *
+ * @param aEnvironmentalReverbUtility Returned utility instance.
+ */
+ virtual void GetEnvironmentalReverbUtilityL(
+ CEnvironmentalReverbUtility** aEnvironmentalReverbUtility);
+ // only require if platform support EMC
+#ifdef RD_JAVA_HTTP_EMC_ENABLED
+ virtual MReverbControl* GetReverbControlL();
+#endif
+protected:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSBaseReverbControl(CMMAPlayer* aPlayer);
+
+
+};
+
+#endif // CAMMSBASEREVERBCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsbasereverbsourcecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class behaves like interface of an audio effect reverb source.
+*
+*/
+
+
+#ifndef CAMMSBASEREVERBSOURCECONTROL_H
+#define CAMMSBASEREVERBSOURCECONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSBaseReverbSourceControl, "ReverbSourceControl");
+
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb Source effect.
+* This class delegates Base class of Reverb Source effect method .
+*
+*
+* @since 5.1
+*/
+NONSHARABLE_CLASS(CAMMSBaseReverbSourceControl): public CAMMSControl
+{
+public:
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSBaseReverbSourceControl();
+
+public:
+ /**
+ * Sets the object specific level for the reverberant sound.
+ * The default value is 0 meaning the natural room gain (set by
+ * ReverbControl's presets).
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ virtual void SetRoomLevelL(TInt aLevel) = 0;
+
+public:
+
+ const TDesC& ClassName() const = 0;
+
+protected:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ * @param aReverbControl Reverb control belonging to aPlayer.
+ */
+ CAMMSBaseReverbSourceControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSBASEREVERBSOURCECONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammscontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for AMMS controls.
+*
+*/
+
+
+#ifndef CAMMSCONTROL_H
+#define CAMMSCONTROL_H
+// INCLUDES
+#include <e32base.h>
+#include <cmmacontrol.h>
+#include "ammsconstants.h"
+// RD_JAVA_HTTP_EMC_ENABLED
+#ifdef RD_JAVA_HTTP_EMC_ENABLED
+#include "StreamControl.h"
+#include "EffectControl.h"
+#include "MMControlFactory.h"
+using namespace multimedia;
+using multimedia ::MStreamControl;
+using multimedia ::MEffectControl;
+using multimedia ::CMultimediaFactory;
+#endif
+
+// FORWARD DECLARATIONS
+class CCustomCommandUtility;
+class CMMAPlayer;
+
+// CLASS DECLARATION
+
+/**
+*
+* Base class for AMMS controls.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSControl): public CMMAControl
+{
+public:
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSControl();
+
+public: // New functions
+ /**
+ * Creates the custom command utility.
+ * @since 3.0
+ */
+ CCustomCommandUtility* CreateCustomCommandUtilityL();
+
+ /**
+ * Prepares the Control by creating the Effect API Control.
+ */
+ virtual void PrepareControlL();
+
+ /**
+ * Deallocates the Control by deleting the Effect API Control.
+ */
+ virtual void DeallocateControl();
+
+public: // From CMMAControl
+
+ const TDesC& PublicClassName() const;
+
+protected:
+
+ /**
+ * C++ default constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSControl(CMMAPlayer* aPlayer);
+
+public: // Data
+
+ /** Type of the Control */
+ TAMMSControlTypes iControlType;
+
+protected: // Data
+
+ CMMAPlayer* iPlayer; // Not owned.
+};
+
+#endif // CAMMSCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammscustomcommandutility.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Custom command utility class for AMMS custom commands.
+*
+*/
+
+
+#ifndef CAMMSCUSTOMCOMMANDUTILITY_H
+#define CAMMSCUSTOMCOMMANDUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include <CustomCommandUtility.h>
+#include <mmfcontroller.h>
+
+// CLASS DECLARATION
+
+/**
+*
+* Custom command Utility implementation class.
+* This class is used to deliver custom commands to MMFController.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSCustomCommandUtility): public CCustomCommandUtility
+{
+public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSCustomCommandUtility* NewL(
+ RMMFController& aMMFController);
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSCustomCommandUtility* NewLC(
+ RMMFController& aMMFController);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSCustomCommandUtility();
+
+public: // New functions
+
+public: // Functions from base classes
+
+ TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom);
+
+ TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2);
+
+ void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom,
+ TRequestStatus& aStatus);
+
+ void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TRequestStatus& aStatus);
+
+private:
+ /**
+ * C++ constructor.
+ */
+ CAMMSCustomCommandUtility(RMMFController& aMMFController);
+
+private: // Data
+
+ RMMFController& iMMFController;
+
+};
+
+#endif // CAMMSCUSTOMCOMMANDUTILITY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsdistanceattenuationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+#ifndef CAMMSDISTANCEATTENUATIONCONTROL_H
+#define CAMMSDISTANCEATTENUATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <DistanceAttenuationBase.h>
+#include <CustomCommandUtility.h>
+#include "cammsbasedistanceattenuationcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSDistanceAttenuationControl, "DistanceAttenuationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Distance Attenuation effect.
+* This class delegates Distance Attenuation effect method calls to
+* CDistanceAttenuation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSDistanceAttenuationControl): public CAMMSBaseDistanceAttenuationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSDistanceAttenuationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSDistanceAttenuationControl();
+
+public: // override base class functions
+
+ /**
+ * Sets all the 3D audio distance attenuation parameters simultaneously.
+ * Distances are specified in units defined by
+ * "GlobalManager.getUnitsPerMeter()"
+ *
+ * @param aMinDistance The minimum distance, below which the distance
+ * gain is clipped to its maximum value of 1.0.
+ * @param aMaxDistance The maximum distance, beyond which the distance
+ * gain does not decrease any more. The exact behaviour of the gain at
+ * distances beyond the maximum distance depends on the value of the
+ * muteAfterMax.
+ * @param aMuteAfterMax A boolean determining how the distance gain
+ * behaves at distances greater than maxDistance: true if beyond the
+ * maximum distance the source is silent; false if beyond the maximum
+ * distance the source's gain is held constant at the level at the
+ * maximum distance.
+ * @param aRolloffFactor The rolloff factor, specified in thousandths
+ * (1000 representing a rolloff factor of 1.0, 2000 representing 2.0 and
+ * 500 representing 0.5). Higher values cause the distance gain to
+ * attenuate more quickly.
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aMaxDistance <= \a aMinDistance,
+ * \a aMinDistance <= 0, \a aMaxDistance <= 0 or \a aRolloffFactor < 0
+ */
+ void SetParametersL(
+ TInt aMinDistance,
+ TInt aMaxDistance,
+ TBool aMuteAfterMax,
+ TInt aRolloffFactor);
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSDistanceAttenuationControl(CMMAPlayer* aPlayer);
+
+private: // Data
+
+ /** Native distance attenuation */
+ CDistanceAttenuation* iDistanceAttenuation;
+
+
+};
+
+#endif // CAMMSDISTANCEATTENUATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsdopplercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an effect called Doppler.
+*
+*/
+
+
+#ifndef CAMMSDOPPLERCONTROL_H
+#define CAMMSDOPPLERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <DopplerBase.h>
+#include "cammscontrol.h"
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Doppler effect.
+* This class delegates Doppler effect method calls to CDoppler.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSDopplerControl): public CAMMSControl
+{
+public: // Destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSDopplerControl();
+
+public: // New functions
+ /**
+ * Specifies if this Doppler effect is active or ignored. In case the
+ * DopplerControl is fetched from the Spectator, this method does not
+ * affect anything.
+ *
+ * @param aEnabled The boolean specifying if this Doppler effect is to
+ * be applied.
+ *
+ * @par Leaving:
+ * From Java API there are no leave codes, but the uset EffectControl's
+ * method leaves with the sama way as in effect control, if:
+ * - the effect cannot be enabled in this state of the player.
+ * - enabling is not supported (with the scope set).
+ */
+ virtual void SetEnabledL(TBool aDopplerEnabled);
+
+ /**
+ * Returns whether this Doppler effect is currently active.
+ *
+ * @return The boolean, true if Doppler is being applied.
+ */
+ virtual TBool Enabled();
+
+ /**
+ * Sets the velocity, used in calculations for the Doppler effect.
+ *
+ * The velocity is specified using right-handed cartesian components in
+ * units defined by GlobalManager.getUnitsPerMeter(). For example, if
+ * the x parameter is specified to be 5000 and
+ * GlobalManager.getUnitsPerMeter() returns 1000 the actual x component
+ * will be 5 m/s. The same applies to y and z parameters.
+ *
+ * @param aX The x-coordinate of the new velocity.
+ * @param aY The y-coordinate of the new velocity.
+ * @param aZ The z-coordinate of the new velocity.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - coordinates are not correct.
+ */
+ virtual void SetVelocityCartesianL(TInt aX, TInt aY, TInt aZ);
+
+ /**
+ * Returns the current velocity, used in calculations for the Doppler
+ * effect. The velocity is specified using right-handed cartesian
+ * components in units defined by GlobalManager.getUnitsPerMeter().
+ * The referenced memory of arguments will contain the coordinate values.
+ *
+ * @param aX The x-coordinate of the velocity.
+ * @param aY The y-coordinate of the velocity.
+ * @param aZ The z-coordinate of the velocity.
+ */
+ virtual void VelocityCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ /**
+ * Sets the velocity, used in calculations for the Doppler effect.
+ *
+ * The velocity is specified using spherical components. The radius
+ * component is specified in units defined by
+ * GlobalManager.getUnitsPerMeter(). For example, if the radius
+ * parameter is specified to be 5000 and
+ * GlobalManager.getUnitsPerMeter() returns 1000 the actual radius
+ * component will be 5 m/s.
+ *
+ * @param aAzimuth The azimuth angle of the new velocity in degrees.
+ * @param aElevation The elevation angle of the new velocity in degrees.
+ * @param aRadius The magnitude of the new velocity (namely the speed).
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - coordinates are not correct.
+ */
+ virtual void SetVelocitySphericalL(TInt aAzimuth, TInt aElevation,
+ TInt aRadius);
+
+protected:
+ /**
+ * C++ default constructor, protected to allow access from derived class
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSDopplerControl(CMMAPlayer* aPlayer);
+
+
+protected: // Data
+
+ /* Native Doppler effect, set from derived classes */
+ CDoppler* iDopplerEffect;
+};
+
+#endif // CAMMSDOPPLERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammseffectcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls an abstract filter with various preset settings.
+*
+*/
+
+
+#ifndef CAMMSEFFECTCONTROL_H
+#define CAMMSEFFECTCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <AudioEffectBase.h>
+#include "cammscontrol.h"
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the audio effect control.
+* This class delegates Audio Effect method calls to native
+* audio effect (created either in CAMMSEqualizerControl or
+* in CAMMSReverbControl).
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSEffectControl): public CAMMSControl
+{
+public: // Constructors and destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSEffectControl();
+
+public: // New functions
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ virtual void SetPresetL(const TDesC& aPreset) = 0;
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ virtual const CDesCArray& PresetNamesL() = 0;
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ virtual const TDesC& PresetL() = 0;
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ virtual void SetEnabledL(TBool aEnable) = 0;
+
+//Making the following funcitons virtual because of EMC added functionalities
+ /**
+ * Enforces the effect to be in use. If this is an EffectControl of a
+ * MediaProcessor, the enforced setting does not affect in any way.
+ *
+ * @param aPreset The boolean value - true if the effect is essential
+ * and cannot be dropped, false if the effect can be dropped if the
+ * system runs out of resources.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - some error happened.
+ */
+ virtual void SetEnforcedL(TBool aEnforced);
+
+ /**
+ * Returns the current enforced setting of the effect.
+ *
+ * @return The boolean, true if the effect is an enforced effect, false
+ * if not.
+ */
+ virtual TBool Enforced();
+
+ /**
+ * Sets the scope of the effect. If this is an EffectControl of the
+ * MediaProcessor, the scope setting does not affect in anything.
+ *
+ * @param aScope SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or
+ * SCOPE_LIVE_AND_RECORD.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - javax.microedition.media.MediaException - if the given scope is
+ * not supported
+ */
+ virtual void SetScopeL(TInt aScope);
+
+ /**
+ * Returns the scope in which the effect is present.
+ *
+ * @return SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY or SCOPE_LIVE_AND_RECORD.
+ */
+ virtual TInt Scope();
+
+protected:
+ /**
+ * C++ default constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEffectControl(CMMAPlayer* aPlayer);
+
+protected:
+ /**
+ * Apply changed settings if Effect is in enabled state.
+ */
+ virtual void ApplySettingsL();
+
+protected:
+ /**
+ * By default Symbian 2nd phase constructor is private,
+ * but allow now the base class to access ConstructL.
+ */
+ void ConstructL();
+
+protected: // Data
+
+ /* Native audio effect */
+ CAudioEffect* iAudioEffect;
+
+};
+
+#endif // CAMMSEFFECTCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsequalizercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+#ifndef CAMMSEQUALIZERCONTROL_H
+#define CAMMSEQUALIZERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <AudioEqualizerBase.h>
+#include <AudioEqualizerUtility.h>
+#include <CustomCommandUtility.h>
+#include "cammsbaseequalizercontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSEqualizerControl, "EqualizerControl");
+
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Equalizer effect.
+* This class delegates Equalizer effect method calls to CAudioEqualizer.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSEqualizerControl): public CAMMSBaseEqualizerControl
+{
+public:
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSEqualizerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEqualizerControl();
+
+public: // New functions
+
+ /**
+ * Gets the gain set for the given equalizer band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The gain set for the given band in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand is out of range.
+ */
+ TInt BandLevelL(TInt aBand);
+
+ /**
+ * Returns the maximum band level supported.
+ *
+ * @return The maximum band level in millibels.
+ */
+ TInt MaxBandLevel();
+
+ /**
+ * Returns the minimum band level supported.
+ *
+ * @return The minimum band level in millibels.
+ */
+ TInt MinBandLevel();
+
+ /**
+ * Returns the band width in Hz for the specified band.
+ *
+ * @param aBand The frequency band whose band width is asked.
+ * The numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @return The band width in Hz for the specified band.
+ */
+ TInt BandWidth(TInt aBand);
+
+ /**
+ * Returns the center frequency in Hz for a given band.
+ *
+ * @param aBand The frequency band whose center frequency
+ * is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return The center frequency in Hz for a given band.
+ */
+ TInt CenterFrequency(TInt aBand);
+
+ /**
+ * Returns the cross-over frequency between the given frequency
+ * band (aBand) and the next band.
+ *
+ * @param aBand The frequency band whose gain is asked. The numbering of
+ * the bands starts from 0 and ends at (getNumberOfBands() - 1).
+ *
+ * @return Crossover frequency.
+ */
+ TInt CrossoverFrequency(TInt aBand);
+
+ /**
+ * Gets the number of frequency bands that the equalizer supports.
+ *
+ * @return The number of frequency bands that the equalizer supports.
+ */
+ TInt NumberOfBands();
+
+ /**
+ * Sets the given equalizer band to the given gain value.
+ *
+ * @param aLevel The new gain in millibels that will be set to the given
+ * band. getMinBandLevel() and getMaxBandLevel() will define the maximum
+ * and minimum values.
+ * @param aBand The frequency band that will have the new gain. The
+ * numbering of the bands starts from 0 and ends at
+ * (getNumberOfBands() - 1).
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aBand or \a aLevel is out of range.
+ */
+ void SetBandLevelL(TInt aLevel, TInt aBand);
+
+public: // Functions from base classes
+
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSEqualizerControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /** Native audio equalizer */
+ CAudioEqualizerUtility* iEqualizerUtility;
+
+ /* Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+
+ /* Index of the current preset */
+ TInt iCurrentPreset;
+
+};
+
+#endif // CAMMSEQUALIZERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammslocationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of an object.
+*
+*/
+
+
+#ifndef CAMMSLOCATIONCONTROL_H
+#define CAMMSLOCATIONCONTROL_H
+
+// INCLUDES
+#include <LocationBase.h>
+#include "cammscontrol.h"
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Location Control effect.
+* This class delegates Location Control effect method calls to
+* CSourceLocation or CListenerLocation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSLocationControl): public CAMMSControl
+{
+public: // Constructors and destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSLocationControl();
+
+public: // New functions
+ /**
+ * Moves the object to the new location.
+ *
+ * Sets the location using cartesian right-handed coordinates that are
+ * relative to the origin. The measures are defined in units specified
+ * by GlobalManager.getUnitsPerMeter().
+ *
+ * @param aX The x-coordinate of the new location.
+ * @param aY The y-coordinate of the new location.
+ * @param aZ The z-coordinate of the new location.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - coordinates are not correct.
+ */
+ virtual void SetLocationCartesianL(TInt& aX, TInt& aY, TInt& aZ);
+
+ /**
+ * Gets the coordinates of the current location. The measures are
+ * defined in units specified by GlobalManager.getUnitsPerMeter(). .
+ *
+ * @param aX The x-coordinate of the location.
+ * @param aY The y-coordinate of the location.
+ * @param aZ The z-coordinate of the location.
+ */
+ virtual void LocationCartesian(TInt& aX, TInt& aY, TInt& aZ);
+
+ /**
+ * Moves the object to the new location.
+ *
+ * Sets the new location using spherical coordinates. The negative
+ * z-axis is the reference. That is, a location where both azimuth and
+ * elevation are zero, is on the negative z-axis. Radius is defined in
+ * units specified by GlobalManager.getUnitsPerMeter().
+ *
+ * @param aAzimuth The azimuth angle of the new location in degrees. The
+ * azimuth is measured from the negative z-axis in the direction of the
+ * x-axis.
+ * @param aElevation The elevation angle of the new location in degrees.
+ * The elevation is measured from the x-z-plane in the direction of the
+ * y-axis.
+ * @param aRadius The radius of the new location from the origin.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aRadius < 0.
+ */
+ virtual void SetLocationSphericalL(TInt& aAzimuth, TInt& aElevation,
+ TInt& aRadius);
+
+protected:
+ /**
+ * C++ default constructor, protected to allow access from derived class
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSLocationControl(CMMAPlayer* aPlayer);
+
+protected: // Data
+
+ /* Native location effect, set from derived classes */
+ CLocation* iLocationEffect;
+};
+
+#endif // CAMMSLOCATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsorientationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of an object.
+*
+*/
+
+
+#ifndef CAMMSORIENTATIONCONTROL_H
+#define CAMMSORIENTATIONCONTROL_H
+
+// INCLUDES
+#include <OrientationBase.h>
+#include "cammscontrol.h"
+
+// CONSTANS
+_LIT(KAMMSOrientationControl, "OrientationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Orientation Control effect.
+* This class delegates Orientation Control effect method calls to
+* CListenerOrientation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSOrientationControl): public CAMMSControl
+{
+public: // Constructors and destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSOrientationControl();
+
+public: // New functions
+ /**
+ * Turns the object to the new orientation.
+ *
+ * The new orientation is given using rotation angles. A zero vector
+ * corresponds to the orientation pointing directly towards the negative
+ * Z-axis. Orientation is applied in the following order: heading,
+ * pitch, and roll. Therefore, notice that heading turns the X-axis and
+ * therefore affects the pitch, and similarly heading and pitch turn the
+ * Z-axis and therefore affect the roll.
+ *
+ * @param aHeading The rotation around the Y-axis in degrees.
+ * @param aPitch The rotation around the X-axis in degrees.
+ * @param aRoll The rotation around the Z-axis in degrees.
+ */
+ virtual void SetOrientationL(TInt aHeading, TInt aPitch, TInt aRoll);
+
+ /**
+ * Turns the object to the new orientation.
+ *
+ * The orientation is specified using two vectors, one specifying the
+ * direction of the front vector of the object in world coordinates, and
+ * another specifying the "above" vector of the object. The right and up
+ * vectors of the object are calculated by first normalizing both source
+ * vectors, then calculating the right vector as the cross product of the
+ * "above" vector and the front vector, and the up vector as a cross
+ * product of the front and right vectors.
+ *
+ * Because both vectors are normalized, they may be of any length.
+ *
+ * @param aFrontX X value of Front vector
+ * @param aFrontY Y value of Front vector
+ * @param aFrontZ Z value of Front vector
+ * @param aAboveX X value of Above vector
+ * @param aAboveY Y value of Above vector
+ * @param aAboveZ Z value of Above vector
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - In case any of the parameters is a zero vector
+ * or they are parallel to each other.
+ * In that case, the orientation of the object remains unchanged.
+ */
+ virtual void SetOrientationL(TInt aFrontX,
+ TInt aFrontY,
+ TInt aFrontZ,
+ TInt aAboveX,
+ TInt aAboveY,
+ TInt aAboveZ);
+
+ /**
+ * Gets the orientation of the object using two vectors.
+ *
+ * Sets the location using cartesian right-handed coordinates that are
+ * relative to the origin. The measures are defined in units specified
+ * by GlobalManager.getUnitsPerMeter().
+ * Referenced memory of the arguments will contain the coordinate values.
+ *
+ * @param aFrontX X value of Front vector
+ * @param aFrontY Y value of Front vector
+ * @param aFrontZ Z value of Front vector
+ * @param aAboveX X value of Above vector
+ * @param aAboveY Y value of Above vector
+ * @param aAboveZ Z value of Above vector
+ */
+ virtual void OrientationVectors(TInt& aFrontX,
+ TInt& aFrontY,
+ TInt& aFrontZ,
+ TInt& aAboveX,
+ TInt& aAboveY,
+ TInt& aAboveZ);
+
+protected:
+ /**
+ * C++ default constructor, protected to allow access from derived class
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSOrientationControl(CMMAPlayer* aPlayer);
+
+protected: // Data
+
+ /* Native orientation effect, set from derived classes */
+ COrientation* iOrientationEffect;
+};
+
+#endif // CAMMSORIENTATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsplayerbuilder.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for AMMS player builders.
+*
+*/
+
+
+#ifndef CAMMSPLAYERBUILDER_H
+#define CAMMSPLAYERBUILDER_H
+
+// INCLUDES
+#include <cmmaplayer.h>
+
+// CLASS DECLARATION
+
+/**
+*
+* Base class for AMMS player and control builders.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSPlayerBuilder): public CBase
+{
+public: // Constructors and destructor
+ /**
+ * Destructor.
+ */
+ ~CAMMSPlayerBuilder();
+
+public: // New methods
+ /**
+ * Adds the AMMS audio controls to the player
+ *
+ * @param aPlayer The MMA Player where the AMMS controls are added
+ */
+ virtual void PreparePlayerL(CMMAPlayer* aPlayer) = 0;
+
+protected: //Protected so derived classes can access
+ /**
+ * C++ default constructor.
+ */
+ CAMMSPlayerBuilder();
+};
+
+#endif // CAMMSPLAYERBUILDER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsplayerbuildergroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder group for adding players.
+*
+*/
+
+
+#ifndef CAMMSPLAYERBUILDERGROUP_H
+#define CAMMSPLAYERBUILDERGROUP_H
+
+// INCLUDES
+#include "cammsplayerbuilder.h"
+
+// CLASS DECLARATION
+
+/**
+*
+* This class is used to add AMMS audio controls to the player.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSPlayerBuilderGroup): public CAMMSPlayerBuilder
+{
+public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSPlayerBuilderGroup* NewL();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSPlayerBuilderGroup* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSPlayerBuilderGroup();
+
+public: // Funtions from base classes
+ /**
+ * Adds the AMMS audio controls to the player
+ *
+ * @param aPlayer The MMA Player where the AMMS controls are added
+ */
+ virtual void PreparePlayerL(CMMAPlayer* aPlayer);
+
+public: // New methods
+ /**
+ * Adds the AMMS control builder
+ *
+ * @param aPlayerBuilder The AMMS player builder
+ */
+ void AddBuilderAndPopL(CAMMSPlayerBuilder* aPlayerBuilder);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSPlayerBuilderGroup();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ CArrayPtrSeg< CAMMSPlayerBuilder >* iPlayerBuilders; // Owned
+
+};
+
+#endif // CAMMSPLAYERBUILDERGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsprioritycontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the priority of a Player.
+*
+*/
+
+
+#ifndef CAMMSPRIORITYCONTROL_H
+#define CAMMSPRIORITYCONTROL_H
+
+// INCLUDES
+#include "cammscontrol.h"
+#include <mmmaplayerstatelistener.h>
+
+// CONSTANTS
+_LIT(KAMMSPriorityControl, "PriorityControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the priority.
+* This class delegates priority setting calls to RMMFController.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSPriorityControl)
+ : public CAMMSControl, public MMMAPlayerStateListener
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSPriorityControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSPriorityControl();
+
+public: // New functions
+
+ /**
+ * Sets the priority.
+ *
+ * @param aPriority The new priority to be set.
+ */
+ void SetPriorityL(TInt aPriority);
+
+ /**
+ * Gets the priority.
+ *
+ * @return The set priority.
+ */
+ TInt Priority();
+
+public: // From MMMAPlayerStateListener
+
+ void StateChanged(TInt aState);
+
+public: // Functions from base classes
+
+ const TDesC& ClassName() const;
+
+protected: // New functions
+
+ /**
+ * Scales the given AMMS priority to MMF priority
+ * and sets it to MMF if the priority has changed.
+ * @param aAmmsPriority AMMS priority to be set.
+ */
+ void SetPriorityToMmfL(TInt aAmmsPriority);
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSPriorityControl(CMMAPlayer* aPlayer);
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+private: // data
+
+ // Priority cannot be set if player is REALIZED. The priority is set
+ // when the player is prefetched.
+
+ TInt iVisiblePriority; // Priority visible in AMMS.
+
+ TInt iActualPriority; // Priority set in MMF.
+
+};
+
+#endif // CAMMSPRIORITYCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsreverbcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+#ifndef CAMMSREVERBCONTROL_H
+#define CAMMSREVERBCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <EnvironmentalReverbBase.h>
+#include <EnvironmentalReverbUtility.h>
+#include <CustomCommandUtility.h>
+#include "cammseffectcontrol.h"
+#include "cammsbasereverbcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSReverbControl, "ReverbControl");
+_LIT(KAMMSDefaultReverbPreset, "smallroom");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb effect.
+* This class delegates Reverb effect method calls to CReverb.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSReverbControl): public CAMMSBaseReverbControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSReverbControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSReverbControl();
+
+public: // New functions
+
+ /**
+ * Sets the gain level of the reverberation. The value defines what is
+ * the relative level of the first reflections compared to the sound
+ * source without possible distance attenuations, directivities or
+ * obstructions taken into account.
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ TInt SetReverbLevelL(TInt aLevel);
+
+ /**
+ * Sets the reverberation time of the reverb. The reverberation time is
+ * the time taken for the reverberant sound to attenuate by 60 dB from
+ * its initial level. Typical values are in the range from 100 to 20000
+ * milliseconds.
+ * The implementation might not support long reverberation times.
+ * Therefore, the actual time used might be shorter than the time
+ * specified with this method.
+ *
+ * @param aTime The new reverberation time in milliseconds.
+ *
+ * @return The value that was actually set.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aTime is negative.
+ * From Java API more leave codes are:
+ * - java.lang.IllegalArgumentException - when the given time is
+ * negative
+ * - javax.microedition.media.MediaException - when the changing of the
+ * reverb time is not supported
+ */
+ void SetReverbTimeL(TInt aTime);
+
+ /**
+ * Gets the gain level of the reverberation.
+ *
+ * @return The level of the reverberation in millibels.
+ */
+ TInt ReverbLevel();
+
+ /**
+ * Gets the reverberation time.
+ *
+ * @return The time of the reverberation in milliseconds.
+ */
+ TInt ReverbTime();
+
+ /**
+ * Gets the minimum level of the reverberation.
+ *
+ * @return The minimum level of the reverberation in millibels.
+ */
+ TInt MinReverbLevel();
+
+ /**
+ * Gets the maximum level of the reverberation.
+ *
+ * @return The maximum level of the reverberation in millibels.
+ */
+ TInt MaxReverbLevel();
+ virtual TInt CurrentPresetIndex();
+
+public: // Functions from base classes
+ /**
+ * Sets the effect according to the given preset.
+ *
+ * @param aPreset The new preset that will be taken into use.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aPreset is not available or it is null.
+ */
+ void SetPresetL(const TDesC& aPreset);
+
+ /**
+ * Gets the available preset names.
+ *
+ * @return The names of all the available preset modes.
+ */
+ const CDesCArray& PresetNamesL();
+
+ /**
+ * Gets the current preset.
+ *
+ * @return The preset that is set at the moment. If none of the presets
+ * is set, null will be returned.
+ */
+ const TDesC& PresetL();
+
+ /**
+ * Enables/disables the effect.
+ *
+ * @param aEnabled The boolean value, true=enabled, false=disabled.
+ *
+ * @par Leaving:
+ * From Java API the leave codes are:
+ * - java.lang.IllegalStateException - if the effect cannot be enabled
+ * in this state of the player.
+ * - javax.microedition.media.MediaException - if enabling is not
+ * supported (with the scope set).
+ */
+ void SetEnabledL(TBool aEnable);
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+public: // Functions needed by reverb source control
+
+ /**
+ * Returns the environmental reverb utility.
+ * ReverbSourceControl has to use the same instance.
+ * The function creates the instance if they do not exist yet.
+ *
+ * @param aEnvironmentalReverbUtility Returned utility instance.
+ */
+ void GetEnvironmentalReverbUtilityL(
+ CEnvironmentalReverbUtility** aEnvironmentalReverbUtility);
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSReverbControl(CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+
+ /** Native reverb utility */
+ CEnvironmentalReverbUtility* iReverbUtility;
+
+ /* Array for querying the preset names, owned */
+ CDesCArray* iPresetNames;
+
+ /* Index of the current preset */
+ TInt iCurrentPreset;
+
+};
+
+#endif // CAMMSREVERBCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsreverbsourcecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect reverb source.
+*
+*/
+
+
+#ifndef CAMMSREVERBSOURCECONTROL_H
+#define CAMMSREVERBSOURCECONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <RoomLevelBase.h>
+#include <EnvironmentalReverbBase.h>
+#include <CustomCommandUtility.h>
+//#include "CAMMSControl.h"
+#include "cammsbasereverbsourcecontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSReverbSourceControl, "ReverbSourceControl");
+
+// FORWARD DECLARATIONS
+class CAMMSBaseReverbControl;
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Reverb Source effect.
+* This class delegates Reverb Source effect method calls to CRoomLevel.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSReverbSourceControl): public CAMMSBaseReverbSourceControl //CAMMSControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ * @param aReverbControl Reverb control belonging to aPlayer.
+ */
+ static CAMMSReverbSourceControl* NewLC(CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aReverbControl);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSReverbSourceControl();
+
+public: // New functions
+
+ /**
+ * Sets the object specific level for the reverberant sound.
+ * The default value is 0 meaning the natural room gain (set by
+ * ReverbControl's presets).
+ *
+ * @param aLevel The new level of the reverberation in millibels.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a aLevel is greater than 0
+ */
+ void SetRoomLevelL(TInt aLevel);
+
+public: // Functions from base classes
+
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ * @param aReverbControl Reverb control belonging to aPlayer.
+ */
+ CAMMSReverbSourceControl(CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aReverbControl);
+
+private: // Data
+
+ /** Native reverb source */
+ CRoomLevel* iReverbSource;
+
+ /** Reverb control belonging to the player */
+ CAMMSBaseReverbControl* iReverbControl;
+
+};
+
+#endif // CAMMSREVERBSOURCECONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsspectatordopplercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler of the spectator.
+*
+*/
+
+
+#ifndef CAMMSSPECTATORDOPPLERCONTROL_H
+#define CAMMSSPECTATORDOPPLERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ListenerDopplerBase.h>
+#include <CustomCommandUtility.h>
+#include "cammsdopplercontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSSpectatorDopplerControl, "DopplerControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Doppler Control effect for the Spectator.
+* This class delegates Doppler Control effect method calls to
+* CListenerDoppler.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSSpectatorDopplerControl): public CAMMSDopplerControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSSpectatorDopplerControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSSpectatorDopplerControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSSpectatorDopplerControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSSPECTATORDOPPLERCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsspectatorlocationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the spectator.
+*
+*/
+
+
+#ifndef CAMMSSPECTATORLOCATIONCONTROL_H
+#define CAMMSSPECTATORLOCATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ListenerLocationBase.h>
+#include <CustomCommandUtility.h>
+#include "cammslocationcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSSpectatorLocationControl, "LocationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Location Control effect for the Spectator.
+* This class delegates Location Control effect method calls to
+* CListenerLocation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSSpectatorLocationControl): public CAMMSLocationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSSpectatorLocationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSSpectatorLocationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSSpectatorLocationControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSSPECTATORLOCATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsspectatororientationcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of the spectator.
+*
+*/
+
+
+#ifndef CAMMSSPECTATORORIENTATIONCONTROL_H
+#define CAMMSSPECTATORORIENTATIONCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ListenerOrientationBase.h>
+#include <CustomCommandUtility.h>
+#include "cammsorientationcontrol.h"
+
+// CONSTANTS
+_LIT(KAMMSSpectatorOrientationControl, "OrientationControl");
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls for the Orientation Control effect for the Spectator.
+* This class delegates Orientation Control effect method calls to
+* CListenerOrientation.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSSpectatorOrientationControl): public CAMMSOrientationControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSSpectatorOrientationControl* NewLC(CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSSpectatorOrientationControl();
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+ /**
+ * Prepares the Control.
+ */
+ void PrepareControlL();
+
+ /**
+ * Deallocates the Control.
+ */
+ void DeallocateControl();
+
+private:
+ /**
+ * C++ constructor.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSSpectatorOrientationControl(CMMAPlayer* aPlayer);
+
+};
+
+#endif // CAMMSSPECTATORORIENTATIONCONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsvolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls the volume of a CMMAVolumeControl.
+*
+*/
+
+
+#ifndef CAMMSVOLUMECONTROL_H
+#define CAMMSVOLUMECONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammscontrol.h"
+
+// FORWARD DECLARATIONS
+class CMMAVolumeControl;
+
+// CONSTANTS
+const TInt KAMMSMAXVolume = 100;
+
+// CLASS DECLARATION
+
+/**
+*
+* Controls the volume of a CMMAVolumeControl.
+* This class delegates SetVolumeL method calls to CMMAVolumeControl
+* given in constructor.
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSVolumeControl): public CAMMSControl
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aControlName Class name for this control.
+ * @param aVolumeControl Delegated control.
+ * @param aPlayer Player that has this control.
+ */
+ static CAMMSVolumeControl* NewLC(const TDesC& aControlName,
+ CMMAVolumeControl* aVolumeControl,
+ CMMAPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSVolumeControl();
+
+public: // New functions
+ /**
+ * Sets the volume..
+ *
+ * @param aVolume The new volume to be set.
+ */
+ void SetVolumeL(TInt aVolume);
+
+public: // Functions from base classes
+ const TDesC& ClassName() const;
+
+private:
+ /**
+ * C++ constructor.
+ * @param aControlName Class name for this control.
+ * @param aVolumeControl Delegated control.
+ * @param aPlayer Player that has this control.
+ */
+ CAMMSVolumeControl(const TDesC& aControlName,
+ CMMAVolumeControl* aVolumeControl,
+ CMMAPlayer* aPlayer);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // Data
+ const TDesC& iClassName;
+
+ // Not owned mma volume control.
+ CMMAVolumeControl* iVolumeControl;
+
+ // Index in iVolumeControl
+ TInt iControlLevelIndex;
+};
+
+#endif // CAMMSVOLUMECONTROL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/inc/cammsvolumecontrolbuilder.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VolumeControl player builder.
+*
+*/
+
+
+#ifndef CAMMSVOLUMECONTROLBUILDER_H
+#define CAMMSVOLUMECONTROLBUILDER_H
+
+// INCLUDES
+#include "cammsplayerbuilder.h"
+
+// CLASS DECLARATION
+
+/**
+*
+* VolumeControl player builder.
+* This class adds CAMMSVolumeControl to all players that have
+* CMMAVolumeControl.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSVolumeControlBuilder): public CAMMSPlayerBuilder
+{
+public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSVolumeControlBuilder* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSVolumeControlBuilder();
+
+public: // Funtions from CAMMSPlayerBuilder
+ void PreparePlayerL(CMMAPlayer* aPlayer);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSVolumeControlBuilder();
+};
+
+#endif // CAMMSVOLUMECONTROLBUILDER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsaudioplayerbuilder.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder for adding AMMS audio player controls.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmmamidiplayer.h>
+#include <cmmaaudioplayer.h>
+
+#include <logger.h>
+#include "cammsaudioplayerbuilder.h"
+#include "cammscustomcommandutility.h"
+
+//MMF
+#include "cammsequalizercontrol.h"
+#include "cammsreverbcontrol.h"
+#include "cammsreverbsourcecontrol.h"
+#include "cammsaudiovirtualizercontrol.h"
+#include "cammspancontrol.h" // same header will be used for EMC Control too
+#include "cammsdistanceattenuationcontrol.h"
+#include "cammsaudiodopplercontrol.h"
+#include "cammsspectatordopplercontrol.h"
+#include "cammsaudiolocationcontrol.h"
+#include "cammsspectatorlocationcontrol.h"
+#include "cammsspectatororientationcontrol.h"
+#include "cammsvolumecontrol.h"
+#include "ammsconstants.h"
+
+
+//EMC
+#include <cmmaemcaudioplayer.h>
+#include "cammsemcaudiodopplercontrol.h"
+#include "cammsemcspectatordopplercontrol.h"
+#include "cammsemcaudiolocationcontrol.h"
+#include "cammsemcspectatorlocationcontrol.h"
+#include "cammsemcspectatororientationcontrol.h"
+#include "cammsemcdistanceattenuationcontrol.h"
+#include "cammsemcreverbcontrol.h"
+#include "cammsemcreverbsourcecontrol.h"
+#include "cammsemcaudiovirtualizercontrol.h"
+#include "cammsemcequalizercontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioPlayerBuilder* CAMMSAudioPlayerBuilder::NewLC()
+{
+ CAMMSAudioPlayerBuilder* self = new(ELeave) CAMMSAudioPlayerBuilder();
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioPlayerBuilder::~CAMMSAudioPlayerBuilder()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::PreparePlayerL
+// Adds the AMMS audio controls to the player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioPlayerBuilder::PreparePlayerL(CMMAPlayer* aPlayer)
+{
+ const TDesC& playerType = aPlayer->Type();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL type %S",
+ playerType.Ptr());
+
+ if ((playerType != KMMAAudioPlayer) &&
+ (playerType != KMMAMIDIPlayer) && (playerType != KMMAEMCAudioPlayer))
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL, not supported");
+ return;
+ }
+
+
+ // Default type for a Control is base Control (=not a derived Control).
+ // DopplerControl and LocationControl have different Effect API
+ // implementations and also different corresponding AMMS Controls for
+ // SoundSource3D and for Spectator, so these Control types need to be
+ // set accordingly.
+ //
+ // CMMAPlayer::AddControlL( CMMAControl* aControl ) adds a new control.
+ // Ownership of the control is transferred to CMMAPlayer.
+ //
+
+ // CAMMSPanControl is common class to create control for MMF,MIDI and EMC type of Player,however implementation is different
+
+#ifndef __WINS__
+ // PanControl is not supported in WINSCW builds.
+ // This is because of limited pan support in DirectX.
+ CAMMSPanControl* panControl = CAMMSPanControl::NewLC(aPlayer);
+ aPlayer->AddControlL(panControl);
+ CleanupStack::Pop(panControl);
+#endif // __WINS__
+
+
+ if (playerType != KMMAEMCAudioPlayer)
+ {
+ CAMMSAudioDopplerControl* audioDopplerControl =
+ CAMMSAudioDopplerControl::NewLC(aPlayer);
+ audioDopplerControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(audioDopplerControl);
+ CleanupStack::Pop(audioDopplerControl);
+
+ CAMMSSpectatorDopplerControl* spectatorDopplerControl =
+ CAMMSSpectatorDopplerControl::NewLC(aPlayer);
+ spectatorDopplerControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(spectatorDopplerControl);
+ CleanupStack::Pop(spectatorDopplerControl);
+
+ CAMMSAudioLocationControl* audioLocationControl =
+ CAMMSAudioLocationControl::NewLC(aPlayer);
+ audioLocationControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(audioLocationControl);
+ CleanupStack::Pop(audioLocationControl);
+
+ CAMMSSpectatorLocationControl* spectatorLocationControl =
+ CAMMSSpectatorLocationControl::NewLC(aPlayer);
+ spectatorLocationControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(spectatorLocationControl);
+ CleanupStack::Pop(spectatorLocationControl);
+
+ CAMMSSpectatorOrientationControl* spectatorOrientationControl =
+ CAMMSSpectatorOrientationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(spectatorOrientationControl);
+ CleanupStack::Pop(spectatorOrientationControl);
+
+ CAMMSDistanceAttenuationControl* distanceAttenuationControl =
+ CAMMSDistanceAttenuationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(distanceAttenuationControl);
+ CleanupStack::Pop(distanceAttenuationControl);
+
+ CAMMSReverbControl* reverbControl =
+ CAMMSReverbControl::NewLC(aPlayer);
+ aPlayer->AddControlL(reverbControl);
+ CleanupStack::Pop(reverbControl);
+
+ CAMMSReverbSourceControl* reverbSourceControl =
+ CAMMSReverbSourceControl::NewLC(aPlayer, reverbControl);
+ aPlayer->AddControlL(reverbSourceControl);
+ CleanupStack::Pop(reverbSourceControl);
+
+ CAMMSAudioVirtualizerControl* audioVirtualizerControl =
+ CAMMSAudioVirtualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(audioVirtualizerControl);
+ CleanupStack::Pop(audioVirtualizerControl);
+
+ CAMMSEqualizerControl* equalizerControl =
+ CAMMSEqualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(equalizerControl);
+ CleanupStack::Pop(equalizerControl);
+
+ }
+ else //EMC Player
+ {
+
+ CAMMSEMCAudioDopplerControl* emcaudioDopplerControl =
+ CAMMSEMCAudioDopplerControl::NewLC(aPlayer);
+ emcaudioDopplerControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(emcaudioDopplerControl);
+ CleanupStack::Pop(emcaudioDopplerControl);
+
+ CAMMSEMCSpectatorDopplerControl* emcspectatorDopplerControl =
+ CAMMSEMCSpectatorDopplerControl::NewLC(aPlayer);
+ emcspectatorDopplerControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(emcspectatorDopplerControl);
+ CleanupStack::Pop(emcspectatorDopplerControl);
+
+ CAMMSEMCAudioLocationControl* emcaudioLocationControl =
+ CAMMSEMCAudioLocationControl::NewLC(aPlayer);
+ emcaudioLocationControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(emcaudioLocationControl);
+ CleanupStack::Pop(emcaudioLocationControl);
+
+ CAMMSEMCSpectatorLocationControl* emcspectatorLocationControl =
+ CAMMSEMCSpectatorLocationControl::NewLC(aPlayer);
+ emcspectatorLocationControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(emcspectatorLocationControl);
+ CleanupStack::Pop(emcspectatorLocationControl);
+
+ CAMMSEMCSpectatorOrientationControl* emcspectatorOrientationControl =
+ CAMMSEMCSpectatorOrientationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(emcspectatorOrientationControl);
+ CleanupStack::Pop(emcspectatorOrientationControl);
+
+ CAMMSEMCDistanceAttenuationControl* emcdistanceAttenuationControl =
+ CAMMSEMCDistanceAttenuationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(emcdistanceAttenuationControl);
+ CleanupStack::Pop(emcdistanceAttenuationControl);
+
+ CAMMSEMCReverbControl* emcreverbControl =
+ CAMMSEMCReverbControl::NewLC(aPlayer);
+ aPlayer->AddControlL(emcreverbControl);
+ CleanupStack::Pop(emcreverbControl);
+
+ CAMMSEMCReverbSourceControl* emcreverbSourceControl =
+ CAMMSEMCReverbSourceControl::NewLC(aPlayer, emcreverbControl);
+ aPlayer->AddControlL(emcreverbSourceControl);
+ CleanupStack::Pop(emcreverbSourceControl);
+
+ CAMMSEMCAudioVirtualizerControl* emcaudioVirtualizerControl =
+ CAMMSEMCAudioVirtualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(emcaudioVirtualizerControl);
+ CleanupStack::Pop(emcaudioVirtualizerControl);
+
+ CAMMSEMCEqualizerControl* emcequalizerControl =
+ CAMMSEMCEqualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(emcequalizerControl);
+ CleanupStack::Pop(emcequalizerControl);
+
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL add OK");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcaudiodopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler effect of the SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsemcaudiodopplercontrol.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioDopplerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioDopplerControl* CAMMSEMCAudioDopplerControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSEMCAudioDopplerControl* self =
+ new(ELeave) CAMMSEMCAudioDopplerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCAudioDopplerControl::~CAMMSEMCAudioDopplerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::~CAMMSEMCAudioDopplerControl");
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioDopplerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioDopplerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMSourceDopplerControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::PrepareControlL");
+ //Create Doppler Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+ //Check the state of stream control ,it must be INITIALIZED
+ TInt state = iStreamControl->GetState();
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::PrepareControlL: Stream state = %d,",state);
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KSourceDopplerEffectControl, temp));
+ iMSourceDopplerControl = static_cast<MSourceDopplerControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMSourceDopplerControl));
+ iMSourceDopplerControl->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioDopplerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioDopplerControl::DeallocateControl()
+{
+ if (iMSourceDopplerControl)
+ {
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::DeallocateControl");
+
+ // Doppler for Audio can be disabled or enabled
+ if (Enabled())
+ {
+ iMSourceDopplerControl->Disable();
+ }
+ //return the control to factory
+ MEffectControl* temp = iMSourceDopplerControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMSourceDopplerControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMSourceDopplerControl = NULL;
+
+ }
+
+}
+
+const TDesC& CAMMSEMCAudioDopplerControl::ClassName() const
+{
+ return KAMMSEMCAudioDopplerControl;
+}
+
+
+
+void CAMMSEMCAudioDopplerControl::SetEnabledL(TBool aDopplerEnabled)
+{
+
+ if (aDopplerEnabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::SetEnabledL(true)");
+ iMSourceDopplerControl->Enable();
+ }
+ else
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::SetEnabledL(false)");
+ iMSourceDopplerControl->Disable();
+ }
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDopplerControl::Enabled
+// Returns whether this Doppler effect is currently active.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSEMCAudioDopplerControl::Enabled()
+{
+ TBool temp;
+ iMSourceDopplerControl->IsEnabled(temp);
+ return temp;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDopplerControl::SetVelocityCartesianL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioDopplerControl::SetVelocityCartesianL(
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::SetVelocityCartesianL: X=%d, Y=%d, Z=%d",
+ aX, aY, aZ);
+ //Check the state of stream control ,it must be INITIALIZED
+ TInt state = iStreamControl->GetState();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::SetVelocityCartesianL: Stream state = %d,",state);
+ TInt err = iMSourceDopplerControl->SetCartesianVelocity(aX, aY, aZ);
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCAudioDopplerControl::SetVelocityCartesianL: err = %d,",err);
+
+
+ // Apply updated settings to Effect API.
+ iMSourceDopplerControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDopplerControl::VelocityCartesian
+// Returns the current velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioDopplerControl::VelocityCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Get the velocity's cartesian settings
+ // aX, aY and aZ are velocities in format mm/s
+ TInt err = iMSourceDopplerControl->CartesianVelocity(aX,aY,aZ);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCAudioDopplerControl::VelocityCartesian: err = %d,",err);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDopplerControl::SetVelocitySphericalL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioDopplerControl::SetVelocitySphericalL(
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ // Parameters are thousandths of radians
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioDopplerControl::SetVelocitySphericalL %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedElevation = (TInt32)(aElevation * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCDopplerControl::SetVelocitySphericalL %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ TInt err = iMSourceDopplerControl->SetSphericalVelocity(
+ convertedAzimuth, convertedElevation, aRadius);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCAudioDopplerControl::SetVelocitySphericalL: err = %d,",err);
+ // Apply updated settings to EMC API.
+ iMSourceDopplerControl->Apply();
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioDopplerControl::CAMMSEMCAudioDopplerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioDopplerControl::CAMMSEMCAudioDopplerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSDopplerControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcaudiolocationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsemcaudiolocationcontrol.h"
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMinRadius = 0;
+#endif // _DEBUG
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioLocationControl* CAMMSEMCAudioLocationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCAudioLocationControl* self =
+ new(ELeave) CAMMSEMCAudioLocationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCAudioLocationControl::~CAMMSEMCAudioLocationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::~CAMMSEMCAudioLocationControl");
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioLocationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMSourceLocationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::PrepareControlL");
+ //Create Location Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KSourceLocationEffectControl, temp));
+ iMSourceLocationControl = static_cast<MSourceLocationControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMSourceLocationControl));
+ iMSourceLocationControl->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioLocationControl::DeallocateControl()
+{
+ if (iMSourceLocationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::DeallocateControl");
+
+ // Location for Audio can be disabled or enabled
+ TRAPD(err,iMSourceLocationControl->Disable());
+ if (err != KErrNone)
+ {
+ // some EMC Error
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCAudioLocationControl::DeallocateControl err = %d",err);
+ }
+ //return the control to factory
+ MEffectControl* temp = iMSourceLocationControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMSourceLocationControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMSourceLocationControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCAudioLocationControl::ClassName() const
+{
+ return KAMMSEMCAudioLocationControl;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::SetLocationCartesianL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioLocationControl::SetLocationCartesianL(
+ TInt& aX,
+ TInt& aY,
+ TInt& aZ)
+{
+ // Sets the cartesian coordinates for the source location.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::SetLocationCartesianL: %d, %d, %d",
+ aX, aY, aZ);
+
+ iMSourceLocationControl->SetLocationCartesian(aX, aY, aZ);
+
+ // Apply updated settings to EMC API.
+ iMSourceLocationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::LocationCartesian
+// Gets the coordinates of the current location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioLocationControl::LocationCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Gets the cartesian coordinates for the location of the source position.
+ // The coordinates of the positions are in millimeters.
+ iMSourceLocationControl->LocationCartesian(aX, aY, aZ);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::SetLocationSphericalL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioLocationControl::SetLocationSphericalL(
+ TInt& aAzimuth,
+ TInt& aElevation,
+ TInt& aRadius)
+{
+ // Check in debug build that aRadius is within valid range.
+ __ASSERT_DEBUG(aRadius >= KAMMSMinRadius, User::Invariant());
+
+ // Sets the spherical coordinates for the location of the source position.
+ // The parameters are thousandths of radians
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::SetLocationSphericalL: %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth *
+ KDegToRad * 1000);
+
+ TInt32 convertedElevation = (TInt32)(aElevation *
+ KDegToRad * 1000);
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioLocationControl::SetLocationSphericalL: %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ iMSourceLocationControl->SetLocationSpherical(
+ convertedAzimuth, convertedElevation, (TInt32&)aRadius);
+
+ // Apply updated settings to EMC API.
+ iMSourceLocationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioLocationControl::CAMMSEMCAudioLocationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioLocationControl::CAMMSEMCAudioLocationControl(CMMAPlayer* aPlayer)
+ : CAMMSLocationControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcaudiovirtualizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,324 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Virtualizes audio channels.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcaudiovirtualizercontrol.h"
+
+
+// CONSTANTS
+const TInt KAMMSEMCDefaultStereoWideningLevel = 100;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioVirtualizerControl* CAMMSEMCAudioVirtualizerControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCAudioVirtualizerControl* self =
+ new(ELeave) CAMMSEMCAudioVirtualizerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCAudioVirtualizerControl::~CAMMSEMCAudioVirtualizerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::~CAMMSEMCAudioVirtualizerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ if (iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility)
+ delete iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility;
+ delete iPresetNames;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::SetPresetL(const TDesC& aPreset)
+{
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::SetPresetL \"%S\"",
+ aPreset.Ptr());
+ CStereoWidening *iStereoWidening = NULL;
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->PrepareEmptyStereoWideningUtilitiesL();
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ TInt presetPosition = 0;
+ TInt findPreset = iPresetNames->Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ iStereoWidening = iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->GetStereoWideningAtPresetIndexL(presetPosition);
+ iCurrentPreset = presetPosition;
+ }
+ else
+ {
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->DeleteEmptyStereoWideningUtilities();
+ User::Leave(KErrArgument);
+ }
+
+ if (!iStereoWidening)
+ {
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->DeleteEmptyStereoWideningUtilities();
+ return;
+ }
+ //Get all preset data here
+ TUint8 iStereoWideningLevel = iStereoWidening->StereoWideningLevel();
+ // Set all preset data to EMC
+ iMStereoWideningControl->SetStereoWideningLevel(iStereoWideningLevel);
+ iMStereoWideningControl->Apply();
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->DeleteEmptyStereoWideningUtilities();
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::SetPresetL \"%S\" GetPresetL OK",
+ aPreset.Ptr());
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSEMCAudioVirtualizerControl::PresetNamesL()
+{
+ // Returns an array of all preset names (pre-defined and user-defined).
+ // The pre-defined presets are in the beginning of the list.
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->PrepareEmptyStereoWideningUtilitiesL();
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->DeleteEmptyStereoWideningUtilities();
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSEMCAudioVirtualizerControl::PresetL()
+{
+ //if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+
+ else
+ {
+ // Retrieves a Preset with the given index from the utility class
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->PrepareEmptyStereoWideningUtilitiesL();
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->GetPresetAtIndexL(iPresetName , iCurrentPreset);
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->DeleteEmptyStereoWideningUtilities();
+ return iPresetName;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect.
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::SetEnabledL(true).");
+ iMStereoWideningControl->Enable();
+ iMStereoWideningControl->SetStereoWideningLevel(KAMMSEMCDefaultStereoWideningLevel);
+ iMStereoWideningControl->Apply();
+ }
+ else
+ {
+ // Disable the effect
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::SetEnabledL(false).");
+ iMStereoWideningControl->Disable();
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMStereoWideningControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::PrepareControlL");
+ //Create AudioVirtualizer Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KStereoWideningEffectControl, temp));
+ iMStereoWideningControl = static_cast<MStereoWideningControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMStereoWideningControl));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::DeallocateControl()
+{
+
+ if (iMStereoWideningControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl::DeallocateControl");
+
+ // StereoWidening for Audio can be disabled or enabled
+ TRAPD(err,iMStereoWideningControl->Disable());
+ if (err != KErrNone)
+ {
+ //Some EMC Error
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCAudioVirtualizerControl::DeallocateControl err = %d",err);
+ }
+ //return the control to factory
+ MEffectControl* temp = iMStereoWideningControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMStereoWideningControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMStereoWideningControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCAudioVirtualizerControl::ClassName() const
+{
+ return KAMMSEMCAudioVirtualizerControl;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::SetEnforcedL
+// Enforces the effect to be in use.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::SetEnforcedL(TBool aEnforced)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl:SetEnforcedL");
+ // Indicate the effect is to be enforced or not. ETrue = Enforced.
+
+ iMStereoWideningControl->Enforce(aEnforced);
+
+ ApplySettingsL();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::Enforced
+// Returns the current enforced setting of the effect.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSEMCAudioVirtualizerControl::Enforced()
+{
+ // Returns ETrue if the effect is enforced, EFalse if not enforced.
+ TBool enforced;
+ iMStereoWideningControl->IsEnforced(enforced);
+ return enforced;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::SetScopeL
+// Sets the scope of the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCAudioVirtualizerControl::SetScopeL(TInt aScope)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl:SetScopeL");
+ __ASSERT_DEBUG(
+ (aScope == CAMMSEffectControlGroup::EScopeLiveOnly),
+ User::Invariant());
+ // Just to suppress warning in release build
+ (void)aScope;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::Scope
+// Returns the scope in which the effect is present.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCAudioVirtualizerControl::Scope()
+{
+ // For now only the (LIVE_ONLY) scope is supported.
+ return CAMMSEffectControlGroup::EScopeLiveOnly;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::ApplySettingsL
+// Apply changed settings if Effect is in enabled state.
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerControl::ApplySettingsL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl:ApplySettingsL called, checking state");
+ TBool enabled;
+ iMStereoWideningControl->IsEnabled(enabled);
+ if (enabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerControl:ApplySettingsL calling ApplyL");
+ iMStereoWideningControl->Apply();
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility =
+ new(ELeave)CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility;
+ iAMMSEMCAudioVirtualizerEnvironmentalPresetUtility->ConstructL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::CAMMSEMCAudioVirtualizerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCAudioVirtualizerControl::CAMMSEMCAudioVirtualizerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSEffectControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcaudiovirtualizerenvironmentalpresetutility.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcaudiovirtualizerenvironmentalpresetutility.h"
+
+const TInt KAMMSEMCPresetGranularity = 5;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// Constructors
+
+CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility:: constructor");
+}
+
+// Destructor
+CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::~CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility()
+{
+ delete iPresetNames;
+ if (iEmptyStereoWideningUtility)
+ {
+ delete iEmptyStereoWideningUtility;
+ iEmptyStereoWideningUtility = NULL;
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::~ ");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL
+// Gets the current preset.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL(TDes& aPreset ,TInt iIndex)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL +");
+ // Return KNullDesC if no preset is set.
+ if (iIndex >= 0)
+ {
+
+ TArray< TEfStereoWideningUtilityPreset > presetNames =
+ iEmptyStereoWideningUtility->Presets();
+ aPreset = presetNames[ iIndex ].iPresetName ;
+
+ }
+ else
+ {
+ aPreset = KNullDesC;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL +");
+ //Calling base class function to create and initialize the CMMFDevSound
+ CreateAndInitializeDevSoundL();
+ if (!iEmptyStereoWideningUtility)
+ {
+ iEmptyStereoWideningUtility =
+ CStereoWideningUtility::NewL(*iMMFDevSound);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities +");
+
+ if (iEmptyStereoWideningUtility)
+ {
+ delete iEmptyStereoWideningUtility;
+ iEmptyStereoWideningUtility = NULL;
+ }
+ //Calling base class function to delete CMMFDevSound object to free memory
+ DeleteDevSound();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL +");
+ TArray< TEfStereoWideningUtilityPreset > presetNames =
+ iEmptyStereoWideningUtility->Presets();
+ TInt presetCount = presetNames.Count();
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetEnvironmentalStereoWideningAtPresetIndexL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CStereoWidening * CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetStereoWideningAtPresetIndexL(TInt iIndex)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetStereoWideningAtPresetIndexL, index=%d",
+ iIndex);
+
+ __ASSERT_DEBUG(iIndex >= 0, User::Invariant());
+
+ // Set the preset to the empty Environmental Reverb utility.
+ iEmptyStereoWideningUtility->GetPresetL(iIndex);
+ return &(iEmptyStereoWideningUtility->StereoWidening());
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL()
+{
+ iPresetNames = new(ELeave)CDesCArrayFlat(KAMMSEMCPresetGranularity);
+ CAMMSEMCBaseMMFDevSound ::ConstructL();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL");
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcbasemmfdevsound.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcbasemmfdevsound.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// Constructors
+
+CAMMSEMCBaseMMFDevSound::CAMMSEMCBaseMMFDevSound()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound:: CAMMSEMCBaseMMFDevSound()");
+}
+
+// Destructor
+CAMMSEMCBaseMMFDevSound::~CAMMSEMCBaseMMFDevSound()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::~ +");
+ if (iMMFDevSound)
+ {
+ delete iMMFDevSound;
+ iMMFDevSound = NULL;
+ }
+
+ if (iActiveSchedulerWait)
+ {
+ delete iActiveSchedulerWait;
+ iActiveSchedulerWait = NULL;
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::~ -");
+}
+
+/******************************************************************************
+* Method Name: CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL()
+******************************************************************************/
+TInt CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL");
+ TInt initError;
+ if (iMMFDevSound)
+ {
+ delete iMMFDevSound;
+ iMMFDevSound = NULL;
+ }
+ TRAP(initError, iMMFDevSound = CMMFDevSound::NewL());
+ if (initError)
+ return initError;
+
+ TRAP(initError,iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
+
+ if (!initError)
+ {
+ __ASSERT_DEBUG(!iActiveSchedulerWait->IsStarted(), User::Invariant());
+ // Wait until InitializeComplete() has been called.
+ iActiveSchedulerWait->Start(); // CSI: 10 iActiveSchedulerWait cannot be started, also checked in debug build #
+
+ }
+
+ return initError;
+}
+
+/******************************************************************************
+* Method Name: CAMMSEMCBaseMMFDevSound::DeleteDevSound()
+******************************************************************************/
+void CAMMSEMCBaseMMFDevSound::DeleteDevSound()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::DeleteDevSound + ");
+ if (iMMFDevSound)
+ {
+ delete iMMFDevSound;
+ iMMFDevSound = NULL;
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::DeleteDevSound - ");
+}
+
+/******************************************************************************
+******************************** CALLBACK ************************************
+*******************************************************************************/
+
+/******************************************************************************
+* Method Name: CAMMSEMCBaseMMFDevSound::InitializeComplete
+* Description: CMMFDevSound callback when Initialization is complete
+******************************************************************************/
+void CAMMSEMCBaseMMFDevSound::InitializeComplete(TInt aError)
+{
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCBaseMMFDevSound::InitializeComplete err = %d ",aError);
+ // Just to suppress warning in release build
+ (void)aError;
+ __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant());
+ // Stop waiting in CreateAndInitializeDevSoundL() function.
+ iActiveSchedulerWait->AsyncStop();
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCBaseMMFDevSound::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCBaseMMFDevSound::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::ConstructL ");
+ // create CActiveSchedulerWait
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcdistanceattenuationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcdistanceattenuationcontrol.h"
+
+// CONSTANTS
+namespace
+{
+const TInt KAMMSRoomRollOffFactor = 0; // The logical default value set to 0
+// Rolloff factor 1000 in AMMS is 100 in EMC API
+const TInt KAMMSRolloffDivider = 10;
+
+#ifdef _DEBUG
+const TInt KAMMSMinDistance = 1;
+const TInt KAMMSMinRollofFactor = 0;
+#endif // _DEBUG
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDistanceAttenuationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCDistanceAttenuationControl* CAMMSEMCDistanceAttenuationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCDistanceAttenuationControl* self =
+ new(ELeave)CAMMSEMCDistanceAttenuationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCDistanceAttenuationControl::~CAMMSEMCDistanceAttenuationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCDistanceAttenuationControl::~CAMMSEMCDistanceAttenuationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDistanceAttenuationControl::SetParametersL
+// Sets all the 3D audio distance attenuation parameters simultaneously.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCDistanceAttenuationControl::SetParametersL(
+ TInt aMinDistance,
+ TInt aMaxDistance,
+ TBool aMuteAfterMax,
+ TInt aRolloffFactor)
+{
+ // Check in debug build that parameters are within valid range.
+ __ASSERT_DEBUG(
+ (aMaxDistance > aMinDistance) &&
+ (aMinDistance >= KAMMSMinDistance) &&
+ (aMaxDistance >= KAMMSMinDistance) &&
+ (aRolloffFactor >= KAMMSMinRollofFactor),
+ User::Invariant());
+
+ // NOTE: Effect API uses hundreths (100 corresponds to 1.00),
+ // but JSR234 uses thousandths (1000 represents a rolloff factor of 1.0)
+ //
+ LOG4( EJavaMMAPI, EInfo, "AMMS::CAMMSEMCDistanceAttenuationControl::SetParametersL %d, %d, %d, %d",
+ aMinDistance, aMaxDistance, aMuteAfterMax, aRolloffFactor);
+
+ TInt convertedRolloffFactor = aRolloffFactor / KAMMSRolloffDivider;
+
+ iMDistanceAttenuationControl->SetDistanceAttenuation(aMinDistance, aMaxDistance,
+ aMuteAfterMax, convertedRolloffFactor, KAMMSRoomRollOffFactor);
+
+ // Apply updated settings to EMC API.
+ iMDistanceAttenuationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDistanceAttenuationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCDistanceAttenuationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMDistanceAttenuationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCDistanceAttenuationControl::PrepareControlL");
+ //Create Orientation Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KDistanceAttenuationEffectControl, temp));
+ iMDistanceAttenuationControl = static_cast<MDistanceAttenuationControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMDistanceAttenuationControl));
+ iMDistanceAttenuationControl->Enable();
+
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDistanceAttenuationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCDistanceAttenuationControl::DeallocateControl()
+{
+ if (iMDistanceAttenuationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCDistanceAttenuationControl::DeallocateControl");
+
+ // Location for Audio can be disabled or enabled
+ TRAPD(err,iMDistanceAttenuationControl->Disable());
+ if (err != KErrNone)
+ {
+ //Some EMC Error
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCDistanceAttenuationControl::DeallocateControl err = %d",err);
+ }
+ //return the control to factory
+ MEffectControl* temp = iMDistanceAttenuationControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMDistanceAttenuationControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMDistanceAttenuationControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCDistanceAttenuationControl::ClassName() const
+{
+ return KAMMSEMCDistanceAttenuationControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCDistanceAttenuationControl::CAMMSEMCDistanceAttenuationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCDistanceAttenuationControl::CAMMSEMCDistanceAttenuationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSBaseDistanceAttenuationControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcequalizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,456 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcequalizercontrol.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCEqualizerControl* CAMMSEMCEqualizerControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSEMCEqualizerControl* self =
+ new(ELeave) CAMMSEMCEqualizerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCEqualizerControl::~CAMMSEMCEqualizerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::~CAMMSEMCEqualizerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ if (iAMMSEMCEqualizerEnvironmentalPresetUtility)
+ delete iAMMSEMCEqualizerEnvironmentalPresetUtility;
+ delete iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::BandLevelL
+// Gets the gain set for the given equalizer band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::BandLevelL(TInt aBand)
+{
+ // if aBand is out of range the method must leave with KErrArgument.
+
+ if (aBand < 0 || aBand > (NumberOfBands() - 1))
+ {
+ User::Leave(KErrArgument);
+ }
+ // Returns the band level in mB for the specified band
+ TInt bandlevel;
+ TInt aNativeBand = aBand + KAMMSBandOffset;
+ iMEqualizerControl->BandLevel(aNativeBand,bandlevel);
+ return bandlevel;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::MaxBandLevel
+// Returns the maximum band level supported.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::MaxBandLevel()
+{
+ // Get the dB range in mB for the equalizer.
+ TInt min,max;
+ iMEqualizerControl->DbLevelLimits(min,max);
+ return max;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::MinBandLevel
+// Returns the minimum band level supported.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::MinBandLevel()
+{
+ // Get the dB range in mB for the equalizer.
+ TInt min,max;
+ iMEqualizerControl->DbLevelLimits(min,max);
+ return min;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::BandWidth
+// Returns the band width in Hz for the specified band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::BandWidth(TInt aBand)
+{
+ TInt bndwdth;
+ TInt aNativeBand = aBand + KAMMSBandOffset;
+ iMEqualizerControl->BandWidth(aNativeBand,bndwdth);
+ return bndwdth;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::CenterFrequency
+// Returns the center frequency in Hz for a given band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::CenterFrequency(TInt aBand)
+{
+ TInt cntrfreq;
+ TInt aNativeBand = aBand + KAMMSBandOffset;
+ iMEqualizerControl->CenterFrequency(aNativeBand,cntrfreq);
+ return cntrfreq;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::CrossoverFrequency
+// Returns the cross-over frequency between the given frequency.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::CrossoverFrequency(TInt aBand)
+{
+ TInt aCrossOverFreq;
+ TInt aNativeBand = aBand + KAMMSBandOffset;
+ iMEqualizerControl->CrossoverFrequency(aNativeBand, aCrossOverFreq);
+ return aCrossOverFreq;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::NumberOfBands
+// Gets the number of frequency bands that the equalizer supports.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::NumberOfBands()
+{
+ // Returns the number of equalizer bands.
+ // AudioEqualizerBase: TUint8 NumberOfBands() const;
+
+ TInt aNumOfBands;
+ iMEqualizerControl->NumberOfBands(aNumOfBands);
+ return aNumOfBands;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::SetBandLevelL
+// Sets the given equalizer band to the given gain value.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::SetBandLevelL(
+ TInt aLevel,
+ TInt aBand)
+{
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::SetBandLevelL: level=%d, band=%d",
+ aLevel, aBand);
+ // If aBand or aLevel is out of valid range the method must leave
+ // with KErrArgument.
+ if (aBand < 0 ||
+ aBand > (NumberOfBands() - 1) ||
+ aLevel < MinBandLevel() ||
+ aLevel > MaxBandLevel())
+ {
+ User::Leave(KErrArgument);
+ }
+ TInt aNativeBand = aBand + KAMMSBandOffset;
+ // Sets the equalizer band level value in mB, ranging from Min to Max
+ iMEqualizerControl->SetBandLevel(aNativeBand, aLevel);
+
+ ApplySettingsL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::SetPresetL(const TDesC& aPreset)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::SetPresetL \"%S\"", aPreset.Ptr());
+ CAudioEqualizer *iAudioEqualizer = NULL;
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->PrepareEmptyEqualizerUtilitiesL();
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ TInt presetPosition = 0;
+ TInt findPreset = iPresetNames->Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ iAudioEqualizer = iAMMSEMCEqualizerEnvironmentalPresetUtility->GetEqualizerAtPresetIndexL(presetPosition);
+ iCurrentPreset = presetPosition;
+ }
+ else
+ {
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->DeleteEmptyEqualizerUtilities();
+ User::Leave(KErrArgument);
+ }
+
+ if (!iAudioEqualizer)
+ {
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->DeleteEmptyEqualizerUtilities();
+ return;
+ }
+ //Get all preset data here
+ // For each band of AudioEqualizer get the band level and set it to iMEqualizerControl
+
+ TInt noOfbands = iAudioEqualizer->NumberOfBands();
+
+ for (TInt i = 0; i < noOfbands; i++)
+ {
+ // Band 0 in JSR-234 equals Band 1 in Effect API
+ TInt aNativeBand = i + KAMMSBandOffset;
+ TInt iBandLevel = iAudioEqualizer->BandLevel(aNativeBand);
+ iMEqualizerControl->SetBandLevel(aNativeBand, iBandLevel);
+ }
+
+ iMEqualizerControl->Apply();
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->DeleteEmptyEqualizerUtilities();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSEMCEqualizerControl::PresetNamesL()
+{
+ // Returns an array of all preset names (pre-defined and user-defined).
+ // The pre-defined presets are in the beginning of the list.
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->PrepareEmptyEqualizerUtilitiesL();
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->DeleteEmptyEqualizerUtilities();
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSEMCEqualizerControl::PresetL()
+{//if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+
+ else
+ {
+ // Retrieves a Preset with the given index from the utility class
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->PrepareEmptyEqualizerUtilitiesL(); // codescanner::leave
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->GetPresetAtIndexL(iPresetName , iCurrentPreset); // codescanner::leave
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->DeleteEmptyEqualizerUtilities();
+ return iPresetName;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect.
+
+ iMEqualizerControl->Enable();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::SetEnabledL(true), calling Apply");
+ iMEqualizerControl->Apply();
+ }
+ else
+ {
+ // Disable the effect
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::SetEnabledL(false), calling Disable");
+ iMEqualizerControl->Disable();
+ iMEqualizerControl->Apply();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMEqualizerControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::PrepareControlL");
+ //Create Equalizer Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KEqualizerEffectControl, temp));
+ iMEqualizerControl = static_cast<MEqualizerControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMEqualizerControl));
+ iMEqualizerControl->Enable();
+ }
+
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::DeallocateControl()
+{
+ if (iMEqualizerControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl::DeallocateControl");
+
+ // Equalizer for Audio can be disabled or enabled
+ TRAPD(err,iMEqualizerControl->Disable());
+ if (err != KErrNone)
+ {
+ //Some EMC Error
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCEqualizerControl::DeallocateControl err = %d",err);
+ }
+ //return the control to factory
+ MEffectControl* temp = iMEqualizerControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMEqualizerControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMEqualizerControl = NULL;
+ }
+}
+
+
+const TDesC& CAMMSEMCEqualizerControl::ClassName() const
+{
+ return KAMMSEMCEqualizerControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::SetEnforcedL
+// Enforces the effect to be in use.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::SetEnforcedL(TBool aEnforced)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl:SetEnforcedL");
+ // Indicate the effect is to be enforced or not. ETrue = Enforced.
+
+ iMEqualizerControl->Enforce(aEnforced);
+
+ ApplySettingsL();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::Enforced
+// Returns the current enforced setting of the effect.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSEMCEqualizerControl::Enforced()
+{
+ // Returns ETrue if the effect is enforced, EFalse if not enforced.
+ TBool enforced;
+ iMEqualizerControl->IsEnforced(enforced);
+ return enforced;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::SetScopeL
+// Sets the scope of the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCEqualizerControl::SetScopeL(TInt aScope)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl:SetScopeL");
+ __ASSERT_DEBUG(
+ (aScope == CAMMSEffectControlGroup::EScopeLiveOnly),
+ User::Invariant());
+ // Just to suppress warning in release build
+ (void)aScope;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::Scope
+// Returns the scope in which the effect is present.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCEqualizerControl::Scope()
+{
+ // For now only the (LIVE_ONLY) scope is supported.
+ return CAMMSEffectControlGroup::EScopeLiveOnly;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCAudioVirtualizerControl::ApplySettingsL
+// Apply changed settings if Effect is in enabled state.
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerControl::ApplySettingsL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl:ApplySettingsL called, checking state");
+ TBool enabled;
+ iMEqualizerControl->IsEnabled(enabled);
+ if (enabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerControl:ApplySettingsL calling ApplyL");
+ iMEqualizerControl->Apply();
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+ iAMMSEMCEqualizerEnvironmentalPresetUtility = new(ELeave)CAMMSEMCEqualizerEnvironmentalPresetUtility;
+ iAMMSEMCEqualizerEnvironmentalPresetUtility->ConstructL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerControl::CAMMSEMCEqualizerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCEqualizerControl::CAMMSEMCEqualizerControl(CMMAPlayer* aPlayer)
+ : CAMMSBaseEqualizerControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcequalizerenvironmentalpresetutility.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcequalizerenvironmentalpresetutility.h"
+
+const TInt KAMMSEMCPresetGranularity = 5;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// Constructors
+
+CAMMSEMCEqualizerEnvironmentalPresetUtility::CAMMSEMCEqualizerEnvironmentalPresetUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility:: CAMMSEMCEqualizerEnvironmentalPresetUtility()");
+}
+
+// Destructor
+CAMMSEMCEqualizerEnvironmentalPresetUtility::~CAMMSEMCEqualizerEnvironmentalPresetUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::~ +");
+ delete iPresetNames;
+ if (iEmptyEqualizerUtility)
+ {
+ TRAPD(err,iEmptyEqualizerUtility ->DisableEqualizerL());
+ if (err)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Utility
+ // class is already created, that situation can be discarded here.
+ }
+ delete iEmptyEqualizerUtility;
+ iEmptyEqualizerUtility = NULL;
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::~ -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetAtIndexL
+// Gets the current preset.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetAtIndexL(TDes& aPreset ,TInt iIndex)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetAtIndexL +");
+ // Return KNullDesC if no preset is set.
+ if (iIndex >= 0)
+ {
+
+ TArray< TEfAudioEqualizerUtilityPreset > presetNames =
+ iEmptyEqualizerUtility->Presets();
+ aPreset = presetNames[ iIndex ].iPresetName ;
+
+ }
+ else
+ {
+ aPreset = KNullDesC;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetAtIndexL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::PrepareEmptyEqualizerUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerEnvironmentalPresetUtility::PrepareEmptyEqualizerUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::PrepareEmptyEqualizerUtilitiesL +");
+ //Calling base class function to create and initialize the CMMFDevSound
+ CreateAndInitializeDevSoundL();
+ if (!iEmptyEqualizerUtility)
+ {
+ iEmptyEqualizerUtility =
+ CAudioEqualizerUtility::NewL(*iMMFDevSound);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::PrepareEmptyEqualizerUtilitiesL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::DeleteEmptyEqualizerUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerEnvironmentalPresetUtility::DeleteEmptyEqualizerUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::DeleteEmptyEqualizerUtilities +");
+
+ if (iEmptyEqualizerUtility)
+ {
+ TRAPD(err,iEmptyEqualizerUtility ->DisableEqualizerL());
+ if (err)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Utility
+ // class is already created, that situation can be discarded here.
+ }
+ delete iEmptyEqualizerUtility;
+ iEmptyEqualizerUtility = NULL;
+ }
+
+ //Calling base class function to delete CMMFDevSound object to free memory
+ DeleteDevSound();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::DeleteEmptyEqualizerUtilities -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetNamesL +");
+ TArray< TEfAudioEqualizerUtilityPreset > presetNames =
+ iEmptyEqualizerUtility->Presets();
+ TInt presetCount = presetNames.Count();
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::GetPresetNamesL -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::GetEqualizerAtPresetIndexL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAudioEqualizer * CAMMSEMCEqualizerEnvironmentalPresetUtility::GetEqualizerAtPresetIndexL(TInt iIndex)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::GetEqualizerAtPresetIndexL, index=%d",
+ iIndex);
+
+ __ASSERT_DEBUG(iIndex >= 0, User::Invariant());
+
+ // Set the preset to the empty Environmental Equalizer utility.
+ iEmptyEqualizerUtility->GetPresetL(iIndex);
+ return &(iEmptyEqualizerUtility->Equalizer());
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCEqualizerEnvironmentalPresetUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCEqualizerEnvironmentalPresetUtility::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCEqualizerEnvironmentalPresetUtility::ConstructL");
+ iPresetNames = new(ELeave)CDesCArrayFlat(KAMMSEMCPresetGranularity);
+ CAMMSEMCBaseMMFDevSound ::ConstructL();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcreverbcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsemcreverbcontrol.h"
+#include <RoomLevelBase.h>
+#include <logger.h>
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxReverbLevel = 0;
+const TInt KAMMSMinReverbTime = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCReverbControl* CAMMSEMCReverbControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSEMCReverbControl* self = new(ELeave) CAMMSEMCReverbControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCReverbControl::~CAMMSEMCReverbControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::~CAMMSEMCReverbControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ if (iAMMSEMCReverbEnvironmentalPresetUtility)
+ delete iAMMSEMCReverbEnvironmentalPresetUtility;
+ delete iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::SetReverbLevelL
+// Sets the gain level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCReverbControl::SetReverbLevelL(TInt aLevel)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetReverbLevelL: %d", aLevel);
+ __ASSERT_DEBUG(aLevel <= KAMMSMaxReverbLevel, User::Invariant());
+ TInt roomLevel = 0;
+ iMReverbControl->RoomLevel(roomLevel);
+ TInt reflectionLevel =0;
+ iMReverbControl->ReflectionsLevel(reflectionLevel);
+ TInt tempChange = aLevel - reflectionLevel - roomLevel;
+
+ // Sets the reverb reflections level in mB
+ iMReverbControl->SetReflectionsLevel(aLevel - roomLevel);
+
+ // Calculate native reverb level.
+ TInt reverbLevel;
+ // iMReverbControl->ReverbLevel(reverbLevel);
+ reverbLevel = iEnvReverbLevel + tempChange;
+
+ // Ensure that the level is within the limits.
+
+ TInt minLevel = 0;
+ TInt maxLevel = 0;
+ iMReverbControl->ReverbLevelRange(minLevel, maxLevel);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetReverbLevelL: orig %d",
+ reverbLevel);
+
+ reverbLevel = Min(reverbLevel, maxLevel);
+ reverbLevel = Max(reverbLevel, minLevel);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetReverbLevelL: set %d",
+ reverbLevel);
+ // Sets the reverb level in mB
+ iMReverbControl->SetReverbLevel(reverbLevel);
+ // Apply can be called for Reverb, as it does not internally include EnableL
+ // unlike in case of Equalizer or StereoWidening
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetReverbLevelL calling ApplyL");
+ iMReverbControl->Apply();
+
+ // Return the value that was used in setting the reverb
+ return aLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::SetReverbTimeL
+// Sets the reverberation time of the reverb.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbControl::SetReverbTimeL(TInt aTime)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetReverbTimeL: %d", aTime);
+ // Check in debug build that aTime is within valid range.
+ __ASSERT_DEBUG(aTime >= KAMMSMinReverbTime, User::Invariant());
+ iMReverbControl->SetDecayTime(aTime);
+ iMReverbControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::ReverbLevel
+// Gets the gain level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCReverbControl::ReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::ReverbLevel called");
+ TInt iReverbLevel;
+ iMReverbControl->ReverbLevel(iReverbLevel);
+ return iReverbLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::ReverbTime
+// Gets the reverberation time.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCReverbControl::ReverbTime()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::ReverbTime called");
+
+ TUint iReverbTime;
+ iMReverbControl->DecayTime(iReverbTime);
+ return iReverbTime;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::MinReverbLevel
+// Gets the minimum level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCReverbControl::MinReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::MinReverbLevel called");
+
+ TInt minLevel;
+ TInt maxLevel;
+ iMReverbControl->ReverbLevelRange(
+ minLevel, maxLevel);
+
+ return minLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::MaxReverbLevel
+// Gets the maximum level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEMCReverbControl::MaxReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::MaxReverbLevel called");
+ TInt minLevel;
+ TInt maxLevel;
+ iMReverbControl->ReverbLevelRange(minLevel, maxLevel);
+ return maxLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbControl::SetPresetL(const TDesC& aPreset)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetPresetL \"%S\"", aPreset.Ptr());
+ CEnvironmentalReverb *iEnvironmentalReverb = NULL;
+ User::LeaveIfError(iAMMSEMCReverbEnvironmentalPresetUtility->PrepareEmptyReverbUtilitiesL());
+ iAMMSEMCReverbEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ TInt presetPosition = 0;
+ TInt findPreset = iPresetNames->Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ iEnvironmentalReverb = iAMMSEMCReverbEnvironmentalPresetUtility->GetEnvironmentalReverbAtPresetIndexL(presetPosition);
+ iCurrentPreset = presetPosition;
+ }
+ else
+ {
+ iAMMSEMCReverbEnvironmentalPresetUtility->DeleteEmptyReverbUtilities();
+ User::Leave(KErrArgument);
+ }
+
+ if (!iEnvironmentalReverb)
+ {
+ iAMMSEMCReverbEnvironmentalPresetUtility->DeleteEmptyReverbUtilities();
+ return;
+ }
+ //Get all preset data here
+
+ TInt iReverbTime = iEnvironmentalReverb-> DecayTime();
+ TInt iReverbLevel = iEnvironmentalReverb->ReflectionsLevel() + iEnvironmentalReverb->RoomLevel();
+ iEnvReverbLevel = iEnvironmentalReverb->ReverbLevel();
+ TInt roomLevel = iEnvironmentalReverb->RoomLevel();
+ TInt reflectionLevel = iEnvironmentalReverb->ReflectionsLevel();
+ TUint decayHFRatio = iEnvironmentalReverb->DecayHFRatio();
+ TUint density = iEnvironmentalReverb->Density();
+ TUint diffusion = iEnvironmentalReverb->Diffusion();
+ TUint reflectionsDelay = iEnvironmentalReverb->ReflectionsDelay();
+ TUint reverbDelay = iEnvironmentalReverb->ReverbDelay();
+ TUint roomHFLevel = iEnvironmentalReverb->RoomHFLevel();
+
+ // Set all preset data to EMC
+ TInt err = iMReverbControl->SetDecayTime(iReverbTime);
+ err = iMReverbControl->SetReverbLevel(iReverbLevel);
+ err = iMReverbControl->SetRoomLevel(roomLevel);
+ err = iMReverbControl->SetReflectionsLevel(reflectionLevel);
+ err = iMReverbControl->SetDecayHFRatio(decayHFRatio);
+ err = iMReverbControl->SetDensity(density);
+ err = iMReverbControl->SetDiffusion(diffusion);
+ err = iMReverbControl->SetReflectionsDelay(reflectionsDelay);
+ err = iMReverbControl->SetReverbDelay(reverbDelay);
+ err = iMReverbControl->SetRoomHFLevel(roomHFLevel);
+ err = iMReverbControl->Apply();
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCReverbControl::SetPresetL iMReverbControl setter func. err = %d",err);
+ iAMMSEMCReverbEnvironmentalPresetUtility->DeleteEmptyReverbUtilities();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSEMCReverbControl::PresetNamesL()
+{
+
+ //CEnvironmentalReverb *iEnvironmentalReverb = NULL;
+ iAMMSEMCReverbEnvironmentalPresetUtility->PrepareEmptyReverbUtilitiesL();
+ iAMMSEMCReverbEnvironmentalPresetUtility->GetPresetNamesL(*iPresetNames);
+ iAMMSEMCReverbEnvironmentalPresetUtility->DeleteEmptyReverbUtilities();
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSEMCReverbControl::PresetL()
+{
+ //if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+
+ else
+ {
+ // Retrieves a Preset with the given index from the utility class
+ iAMMSEMCReverbEnvironmentalPresetUtility->PrepareEmptyReverbUtilitiesL();
+ iAMMSEMCReverbEnvironmentalPresetUtility->GetPresetAtIndexL(iPresetName , iCurrentPreset);
+ iAMMSEMCReverbEnvironmentalPresetUtility->DeleteEmptyReverbUtilities();
+ return iPresetName;
+ }
+
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetEnabledL(true), calling Enable");
+ iMReverbControl->Enable();
+ iMReverbControl->Apply();
+ }
+ else
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetEnabledL(false), calling Disable");
+ iMReverbControl->Disable();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMReverbControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::PrepareControlL");
+ //Create Reverb Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KReverbEffectControl, temp));
+ iMReverbControl = static_cast<MReverbControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMReverbControl));
+ iMReverbControl->Enable();
+ SetPresetL(KAMMSEMCDefaultReverbPreset);
+
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbControl::DeallocateControl()
+{
+
+ if (iMReverbControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::DeallocateControl");
+
+ // Reverb for Audio can be disabled or enabled
+ TRAPD(err,iMReverbControl->Disable());
+ if (err != KErrNone)
+ {
+ //Some EMC Error
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCReverbControl::DeallocateControl err = %d",err);
+ }
+ //return the control to factory
+ MEffectControl* temp = iMReverbControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMReverbControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMReverbControl = NULL;
+
+ iCurrentPreset = -1;
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::GetReverbControl
+// Returns the reverb control. It will be used by CAMMSEMCReverbSourceControl
+// -----------------------------------------------------------------------------
+MReverbControl * CAMMSEMCReverbControl::GetReverbControlL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::GetReverbControl");
+
+ if (! iMReverbControl)
+ {
+ PrepareControlL(); // creates the control
+ }
+
+ return iMReverbControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::CurrentPresetIndex
+// Returns the Current Preset Index. It will be used by CAMMSEMCReverbSourceControl
+// -----------------------------------------------------------------------------
+TInt CAMMSEMCReverbControl::CurrentPresetIndex()
+{
+ return iCurrentPreset;
+}
+
+// -----------------------------------------------------------------------------
+// Overriding the base class CAMMSEffectControl function here
+//------------------------------------------------------------------------------
+
+void CAMMSEMCReverbControl::SetEnforcedL(TBool aEnforced)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetEnforcedL");
+ // Indicate the effect is to be enforced or not. ETrue = Enforced.
+ iMReverbControl->Enforce(aEnforced);
+
+ ApplySettingsL();
+
+}
+TBool CAMMSEMCReverbControl::Enforced()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::Enforced");
+ // Returns ETrue if the effect is enforced, EFalse if not enforced.
+ TBool enforced;
+ iMReverbControl->IsEnforced(enforced);
+ return enforced;
+
+}
+void CAMMSEMCReverbControl::SetScopeL(TInt aScope)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::SetScopeL");
+ __ASSERT_DEBUG(
+ (aScope == CAMMSEffectControlGroup::EScopeLiveOnly),
+ User::Invariant());
+ // Just to suppress warning in release build
+ (void)aScope;
+}
+TInt CAMMSEMCReverbControl::Scope()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::Scope");
+ // For now only the (LIVE_ONLY) scope is supported.
+ return CAMMSEffectControlGroup::EScopeLiveOnly;
+
+}
+void CAMMSEMCReverbControl::ApplySettingsL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl::ApplySettingsL");
+ TBool enabled;
+ iMReverbControl->IsEnabled(enabled);
+ if (enabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbControl:ApplySettingsL calling ApplyL");
+ iMReverbControl->Apply();
+ }
+}
+
+const TDesC& CAMMSEMCReverbControl::ClassName() const
+{
+ return KAMMSEMCReverbControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEMCReverbControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+ iAMMSEMCReverbEnvironmentalPresetUtility = new(ELeave) CAMMSEMCReverbEnvironmentalPresetUtility;
+ iAMMSEMCReverbEnvironmentalPresetUtility->ConstructL();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbControl::CAMMSEMCReverbControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCReverbControl::CAMMSEMCReverbControl(CMMAPlayer* aPlayer)
+ : CAMMSBaseReverbControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcreverbenvironmentalpresetutility.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Group for effect controls
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcreverbenvironmentalpresetutility.h"
+
+const TInt KAMMSEMCPresetGranularity = 5;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// Constructors
+
+CAMMSEMCReverbEnvironmentalPresetUtility::CAMMSEMCReverbEnvironmentalPresetUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility:: CAMMSEMCReverbEnvironmentalPresetUtility()");
+}
+
+// Destructor
+CAMMSEMCReverbEnvironmentalPresetUtility::~CAMMSEMCReverbEnvironmentalPresetUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::~ +");
+ delete iPresetNames;
+
+ if (iEmptyEnvironmentalReverbUtility)
+ {
+ delete iEmptyEnvironmentalReverbUtility;
+ iEmptyEnvironmentalReverbUtility = NULL;
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::~ -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetAtIndexL
+// Gets the current preset.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetAtIndexL(TDes& aPreset ,TInt iIndex)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetAtIndexL +");
+ // Return KNullDesC if no preset is set.
+ if (iIndex >= 0)
+ {
+
+ TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
+ iEmptyEnvironmentalReverbUtility->Presets();
+ aPreset = presetNames[ iIndex ].iPresetName ;
+
+ }
+ else
+ {
+ aPreset = KNullDesC;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetAtIndexL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::PrepareEmptyReverbUtilitiesL
+// Creates utilities that can be used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSEMCReverbEnvironmentalPresetUtility::PrepareEmptyReverbUtilitiesL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::PrepareEmptyReverbUtilitiesL +");
+ //Calling base class function to create and initialize the CMMFDevSound
+ TInt err = CreateAndInitializeDevSoundL();
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::PrepareEmptyReverbUtilitiesL err = %d",err);
+ if (!iEmptyEnvironmentalReverbUtility && (err == KErrNone))
+ {
+ iEmptyEnvironmentalReverbUtility =
+ CEnvironmentalReverbUtility::NewL(*iMMFDevSound);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::PrepareEmptyReverbUtilitiesL -");
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::DeleteEmptyReverbUtilities
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCReverbEnvironmentalPresetUtility::DeleteEmptyReverbUtilities()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::DeleteEmptyReverbUtilities +");
+
+ if (iEmptyEnvironmentalReverbUtility)
+ {
+ delete iEmptyEnvironmentalReverbUtility;
+ iEmptyEnvironmentalReverbUtility = NULL;
+ }
+ //Calling base class function to delete CMMFDevSound object to free memory
+ DeleteDevSound();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::DeleteEmptyReverbUtilities -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::MMFDevSound
+// Deletes utilities that are used to obtain preset names and preset data.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CMMFDevSound* CAMMSEMCReverbEnvironmentalPresetUtility::MMFDevSound()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::MMFDevSound ");
+ return iMMFDevSound;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL(
+ CDesCArray& aPresetNames)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL +");
+ TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
+ iEmptyEnvironmentalReverbUtility->Presets();
+ TInt presetCount = presetNames.Count();
+ for (TInt i = 0; i < presetCount; i++)
+ {
+ aPresetNames.AppendL(presetNames[ i ].iPresetName);
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetPresetNamesL -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::GetEnvironmentalReverbAtPresetIndexL
+// Gets list of preset names available.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CEnvironmentalReverb * CAMMSEMCReverbEnvironmentalPresetUtility::GetEnvironmentalReverbAtPresetIndexL(TInt iIndex)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::GetEnvironmentalReverbAtPresetIndexL, index=%d",
+ iIndex);
+
+ __ASSERT_DEBUG(iIndex >= 0, User::Invariant());
+
+ // Set the preset to the empty Environmental Reverb utility.
+ iEmptyEnvironmentalReverbUtility->GetPresetL(iIndex);
+ return &(iEmptyEnvironmentalReverbUtility->EnvironmentalReverb());
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbEnvironmentalPresetUtility::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSEMCReverbEnvironmentalPresetUtility::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbEnvironmentalPresetUtility::ConstructL ");
+ iPresetNames = new(ELeave)CDesCArrayFlat(KAMMSEMCPresetGranularity);
+ CAMMSEMCBaseMMFDevSound ::ConstructL();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcreverbsourcecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect reverb source.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsemcreverbsourcecontrol.h"
+#include "cammsbasereverbcontrol.h"
+#include "cammsemcreverbcontrol.h"
+
+// CONSTANTS
+const TInt KAMMSDisconnectReverbSource = 2147483647; // From JSR-234
+
+#ifdef _DEBUG
+const TInt KAMMSMaxRoomLevel = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbSourceControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCReverbSourceControl* CAMMSEMCReverbSourceControl::NewLC(
+ CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aBaseReverbControl)
+{
+ CAMMSEMCReverbSourceControl* self =
+ new(ELeave)CAMMSEMCReverbSourceControl(aPlayer, aBaseReverbControl);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCReverbSourceControl::~CAMMSEMCReverbSourceControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::~CAMMSEMCReverbSourceControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbSourceControl::SetRoomLevelL
+// Sets the object specific level for the reverberant sound.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbSourceControl::SetRoomLevelL(TInt aLevel)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS:: CAMMSEMCReverbSourceControl::SetRoomLevelL +: %d", aLevel);
+// Check in debug build that aLevel is within valid range.
+ __ASSERT_DEBUG(
+ (aLevel <= KAMMSMaxRoomLevel) ||
+ (aLevel == KAMMSDisconnectReverbSource),
+ User::Invariant());
+
+ // With the JSR-234 value Integer.MIN_VALUE, the reflected sound for the
+ // given object can be disabled.
+ if (aLevel == KMinTInt)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL(Integer.MIN_VALUE)");
+ aLevel = 0;
+ }
+
+ // Check the allowed boundaries for room level.
+ TInt minLevel = 0;
+ TInt maxLevel = 0;
+ iRoomLevelControl->LevelRange(minLevel, maxLevel);
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL boundaries %d, %d",
+ minLevel, maxLevel);
+
+ // Check the state of the effect. If it is in disabled state, enable it.
+ TBool enabled;
+ iRoomLevelControl->IsEnabled(enabled);
+ if (!enabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL calling EnableL");
+ iRoomLevelControl->Enable();
+ }
+
+ // With the JSR-234 value DISCONNECT, the object can be disconnected
+ // from the reverb.
+ if (aLevel == KAMMSDisconnectReverbSource)
+ {
+ // Do not call iReverbSource->DisableL(), instead set the room level to
+ // _minimum_ value (= smallest negative gain -> maximum attenuation).
+ // The CRoomLevel must also be kept enabled.
+ aLevel = minLevel;
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL(DISCONNECT) %d",
+ minLevel);
+ }
+ else
+ {
+ // Set the room level within allowed boundaries from EMC API
+ aLevel = Min(aLevel, maxLevel);
+ aLevel = Max(aLevel, minLevel);
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL setting value: %d", aLevel);
+ }
+
+ // Sets the RoomLevel level, it will leave if aRoomLevel is not within range
+ // of Min and Max
+ iRoomLevelControl->SetRoomLevel(aLevel);
+
+ // Apply updated settings to EMC API.
+ iRoomLevelControl->Apply();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::SetRoomLevelL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbSourceControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbSourceControl::PrepareControlL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::PrepareControlL");
+
+ if (!iRoomLevelControl)
+ {
+ //Create RoomLevel Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KRoomLevelEffectControl, temp));
+ iRoomLevelControl = static_cast<MRoomLevelControl*>(temp);
+
+
+ //Attach EMC Reverb Control to RoomLevelControl
+ MReverbControl* reverbControl = iBaseReverbControl->GetReverbControlL();
+ iRoomLevelControl->AttachReverb(*reverbControl);
+
+ //Add Effect to Stream Control
+ User::LeaveIfError(iStreamControl->AddEffect(*iRoomLevelControl));
+ }
+
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbSourceControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCReverbSourceControl::DeallocateControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCReverbSourceControl::DeallocateControl");
+ if (iRoomLevelControl)
+ {
+ /*
+ //idealy reverbControl should be checked for its existance and if it is there ,should be detached from RoomLevelControl.
+ //But in this case reverbControl is deleted till this position,so need not to do it.
+ if(reverbControl)
+ {
+ iRoomLevelControl->DetachReverb(*reverbControl);
+ }
+ */
+ iStreamControl->RemoveEffect(*iRoomLevelControl);
+ MEffectControl* objPtr2 = iRoomLevelControl;
+ iFactory->DeleteEffectControl(objPtr2);
+ iRoomLevelControl = NULL;
+ }
+
+
+
+
+}
+
+const TDesC& CAMMSEMCReverbSourceControl::ClassName() const
+{
+ return KAMMSEMCReverbSourceControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCReverbSourceControl::CAMMSEMCReverbSourceControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCReverbSourceControl::CAMMSEMCReverbSourceControl(
+ CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aBaseReverbControl)
+ : CAMMSBaseReverbSourceControl(aPlayer), iBaseReverbControl(aBaseReverbControl)
+{
+
+ iMMAPlayer = aPlayer;
+
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcspectatordopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler effect of the spectator.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsemcspectatordopplercontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorDopplerControl* CAMMSEMCSpectatorDopplerControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCSpectatorDopplerControl* self =
+ new(ELeave)CAMMSEMCSpectatorDopplerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCSpectatorDopplerControl::~CAMMSEMCSpectatorDopplerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::~CAMMSEMCSpectatorDopplerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorDopplerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMListenerDopplerControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::PrepareControlL");
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KListenerDopplerEffectControl, temp));
+ iMListenerDopplerControl = static_cast<MListenerDopplerControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMListenerDopplerControl));
+ TInt err = iMListenerDopplerControl->Enable();
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::PrepareControlL: EnableErr = %d", err);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorDopplerControl::DeallocateControl()
+{
+ if (iMListenerDopplerControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::DeallocateControl");
+
+ // Doppler for Spectator is always enabled (JSR-234 mandates it)
+ // so the disabling is needed here
+ iMListenerDopplerControl->Disable();
+ //return the control to factory
+ MEffectControl* temp = iMListenerDopplerControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMListenerDopplerControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMListenerDopplerControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCSpectatorDopplerControl::ClassName() const
+{
+ return KAMMSEMCListenerDopplerControl;
+}
+
+
+void CAMMSEMCSpectatorDopplerControl::SetEnabledL(TBool aDopplerEnabled)
+{
+ if (aDopplerEnabled)
+ {
+ TInt err = iMListenerDopplerControl->Enable();
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::SetEnabledL: Enable err = %d", err);
+ }
+ else
+ {
+ TInt err = iMListenerDopplerControl->Disable();
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::SetEnabledL: Disable err = %d", err);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::Enabled
+// Returns whether this Doppler effect is currently active.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSEMCSpectatorDopplerControl::Enabled()
+{
+ TBool temp;
+ TInt err = iMListenerDopplerControl->IsEnabled(temp);
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::Enabled: err = %d", err);
+ return temp;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::SetVelocityCartesianL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorDopplerControl::SetVelocityCartesianL(
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::SetVelocityCartesianL: X=%d, Y=%d, Z=%d",
+ aX, aY, aZ);
+ TInt err = iMListenerDopplerControl->SetCartesianVelocity(aX, aY, aZ);
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::SetVelocityCartesianL: err = %d", err);
+ // Apply updated settings
+ iMListenerDopplerControl->Apply();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::VelocityCartesian
+// Returns the current velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorDopplerControl::VelocityCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Get the velocity's cartesian settings
+ // aX, aY and aZ are velocities in format mm/s
+
+ TInt err = iMListenerDopplerControl->CartesianVelocity(aX,aY,aZ);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::VelocityCartesian: err = %d", err);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::SetVelocitySphericalL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorDopplerControl::SetVelocitySphericalL(
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ // Parameters are thousandths of radians
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::SetVelocitySphericalL %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedElevation = (TInt32)(aElevation * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorDopplerControl::SetVelocitySphericalL %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ TInt err = iMListenerDopplerControl->SetSphericalVelocity(
+ convertedAzimuth, convertedElevation, aRadius);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorDopplerControl::SetVelocitySphericalL: err = %d", err);
+ // Apply updated settings to EMC API.
+ iMListenerDopplerControl->Apply();
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorDopplerControl::CAMMSEMCSpectatorDopplerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorDopplerControl::CAMMSEMCSpectatorDopplerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSDopplerControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcspectatorlocationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsemcspectatorlocationcontrol.h"
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMinRadius = 0;
+#endif // _DEBUG
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorLocationControl* CAMMSEMCSpectatorLocationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCSpectatorLocationControl* self =
+ new(ELeave) CAMMSEMCSpectatorLocationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCSpectatorLocationControl::~CAMMSEMCSpectatorLocationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::CAMMSEMCSpectatorLocationControl");
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorLocationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMListenerLocationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::PrepareControlL");
+ //Create Location Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KListenerLocationEffectControl, temp));
+ iMListenerLocationControl = static_cast<MListenerLocationControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMListenerLocationControl));
+ iMListenerLocationControl->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorLocationControl::DeallocateControl()
+{
+ if (iMListenerLocationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::DeallocateControl");
+
+ // Location for Audio can be disabled or enabled
+ iMListenerLocationControl->Disable();
+ //return the control to factory
+ MEffectControl* temp = iMListenerLocationControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMListenerLocationControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMListenerLocationControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCSpectatorLocationControl::ClassName() const
+{
+ return KAMMSEMCSpectatorLocationControl;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::SetLocationCartesianL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorLocationControl::SetLocationCartesianL(
+ TInt& aX,
+ TInt& aY,
+ TInt& aZ)
+{
+ // Sets the cartesian coordinates for the source location.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::SetLocationCartesianL: %d, %d, %d",
+ aX, aY, aZ);
+
+ iMListenerLocationControl->SetLocationCartesian(aX, aY, aZ);
+
+ // Apply updated settings to EMC API.
+ iMListenerLocationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::LocationCartesian
+// Gets the coordinates of the current location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorLocationControl::LocationCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Gets the cartesian coordinates for the location of the Listener position.
+ // The coordinates of the positions are in millimeters.
+ iMListenerLocationControl->LocationCartesian(aX, aY, aZ);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::SetLocationSphericalL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorLocationControl::SetLocationSphericalL(
+ TInt& aAzimuth,
+ TInt& aElevation,
+ TInt& aRadius)
+{
+ // Check in debug build that aRadius is within valid range.
+ __ASSERT_DEBUG(aRadius >= KAMMSMinRadius, User::Invariant());
+
+ // Sets the spherical coordinates for the location of the source position.
+ // The parameters are thousandths of radians
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::SetLocationSphericalL: %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth *
+ KDegToRad * 1000);
+
+ TInt32 convertedElevation = (TInt32)(aElevation *
+ KDegToRad * 1000);
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorLocationControl::SetLocationSphericalL: %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ iMListenerLocationControl->SetLocationSpherical(
+ convertedAzimuth, convertedElevation, (TInt32&)aRadius);
+
+ // Apply updated settings to EMC API.
+ iMListenerLocationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorLocationControl::CAMMSEMCSpectatorLocationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorLocationControl::CAMMSEMCSpectatorLocationControl(CMMAPlayer* aPlayer)
+ : CAMMSLocationControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsemcspectatororientationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of the spectator.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+#include "cammsemcspectatororientationcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorOrientationControl* CAMMSEMCSpectatorOrientationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSEMCSpectatorOrientationControl* self =
+ new(ELeave)CAMMSEMCSpectatorOrientationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSEMCSpectatorOrientationControl::~CAMMSEMCSpectatorOrientationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::~CAMMSEMCSpectatorOrientationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorOrientationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iMListenerOrientationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::PrepareControlL");
+ //Create Orientation Effect Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KListenerOrientationEffectControl, temp));
+ iMListenerOrientationControl = static_cast<MListenerOrientationControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMListenerOrientationControl));
+ iMListenerOrientationControl->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEMCSpectatorOrientationControl::DeallocateControl()
+{
+ if (iMListenerOrientationControl)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::DeallocateControl");
+
+ // Orientation for Listener can be disabled or enabled
+ iMListenerOrientationControl->Disable();
+ //return the control to factory
+ MEffectControl* temp = iMListenerOrientationControl;
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMListenerOrientationControl;
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMListenerOrientationControl = NULL;
+ }
+}
+
+const TDesC& CAMMSEMCSpectatorOrientationControl::ClassName() const
+{
+ return KAMMSEMCSpectatorOrientationControl;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::SetOrientationL
+// Turns the object to the new orientation.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorOrientationControl::SetOrientationL(
+ TInt aHeading,
+ TInt aPitch,
+ TInt aRoll)
+{
+ // Sets the Heading, Pitch, Roll values for the source/listener orientation.
+ // Parameters are given in thousandths of radians.
+ // SourceOrientationBase/ListenerLocationBase :
+ //
+ // NOTE: Effect API uses thousandths of radians for all three parameters,
+ // but JSR234 uses degrees.
+ //
+ // From e32Math.h: The multiplying factor to convert degrees to radians.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL: %d, %d, %d",
+ aHeading, aPitch, aRoll);
+
+ TInt32 convertedHeading = (TInt32)(aHeading * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedPitch = (TInt32)(aPitch * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedRoll = (TInt32)(aRoll * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL: %d, %d, %d",
+ convertedHeading, convertedPitch, convertedRoll);
+
+ TInt err = iMListenerOrientationControl->SetOrientation(
+ convertedHeading, convertedPitch, convertedRoll);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL(3 arg.) err = %d",err);
+
+
+ // Apply updated settings to EMC API.
+ iMListenerOrientationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::SetOrientationL
+// Turns the object to the new orientation.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorOrientationControl::SetOrientationL(
+ TInt aFrontX, TInt aFrontY, TInt aFrontZ,
+ TInt aAboveX, TInt aAboveY, TInt aAboveZ)
+{
+ // Check in debug build that parameters are not zero vectors.
+ __ASSERT_DEBUG(((aFrontX != 0) ||
+ (aFrontY != 0) ||
+ (aFrontZ != 0)) &&
+ ((aAboveX != 0) ||
+ (aAboveY != 0) ||
+ (aAboveZ != 0)),
+ User::Invariant());
+
+ // Check in debug build that vectors are not parallel.
+ // Two vectors are parallel if their cross product is zero vector.
+ // Cross product of vectors a1*i + a2*j + a3*k and b1*i + b2*j + b3*k :
+ // (a2*b3 - a3*b2)i + (a3*b1 - a1*b3)j + (a1*b2 - a2*b1)k
+ __ASSERT_DEBUG(
+ ((aFrontY * aAboveZ) - (aFrontZ * aAboveY) != 0) ||
+ ((aFrontZ * aAboveX) - (aFrontX * aAboveZ) != 0) ||
+ ((aFrontX * aAboveY) - (aFrontY * aAboveX) != 0),
+ User::Invariant());
+
+ // Sets the Front and Above vectors for the orientation of the source/listener.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL: Front %d, %d, %d",
+ aFrontX, aFrontY, aFrontZ);
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL: Above %d, %d, %d",
+ aAboveX, aAboveY, aAboveZ);
+
+ TInt err = iMListenerOrientationControl->SetOrientationVectors(
+ (TInt32)aFrontX, (TInt32)aFrontY, (TInt32)aFrontZ,
+ (TInt32)aAboveX, (TInt32)aAboveY, (TInt32)aAboveZ);
+ ELOG1( EJavaAMMS, "AMMS::CAMMSEMCSpectatorOrientationControl::SetOrientationL(6 arg.) err = %d",err);
+ // Apply updated settings to EMC API.
+ iMListenerOrientationControl->Apply();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::OrientationVectors
+// Gets the orientation of the object using two vectors.
+// -----------------------------------------------------------------------------
+void CAMMSEMCSpectatorOrientationControl::OrientationVectors(
+ TInt& aFrontX, TInt& aFrontY, TInt& aFrontZ,
+ TInt& aAboveX, TInt& aAboveY, TInt& aAboveZ)
+{
+ // Gets the orientation of the source.
+
+ iMListenerOrientationControl->OrientationVectors(
+ aFrontX, aFrontY, aFrontZ, aAboveX, aAboveY, aAboveZ);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEMCSpectatorOrientationControl::CAMMSEMCSpectatorOrientationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEMCSpectatorOrientationControl::CAMMSEMCSpectatorOrientationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSOrientationControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammspancontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the panning of a Player in the stereo output mix.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <cmmaaudioplayer.h>
+#include <cmmamidiplayer.h>
+#include <cmmaemcaudioplayer.h>
+#include "cammspancontrol.h"
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxPanning = 100;
+const TInt KAMMSMinPanning = -100;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPanControl* CAMMSPanControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSPanControl* self = new(ELeave) CAMMSPanControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSPanControl::~CAMMSPanControl()
+{
+ if (iRMMFAudioPlayDeviceCustomCommands)
+ {
+ delete iRMMFAudioPlayDeviceCustomCommands;
+ iRMMFAudioPlayDeviceCustomCommands = NULL;
+ }
+
+ // Remove the EMC Pan Control Effect from Stream Control
+ // Deleted the effect
+ if (iMBalanceControl)
+ {
+ //return the control to factory
+ MEffectControl* temp = iMBalanceControl;
+ if (iStreamControl)
+ iStreamControl->RemoveEffect(*temp);
+ // Delete the Effect
+ MEffectControl* tempCtrl = iMBalanceControl;
+ if (iFactory)
+ iFactory->DeleteEffectControl(tempCtrl);
+ iMBalanceControl = NULL;
+ }
+
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::PanL
+// Gets the current panning set.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSPanControl::PanL()
+{
+ TInt balance = KMMFBalanceCenter;
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iMidiClientUtility)
+ {
+ // Get the current stereo balance value.
+
+ balance = iMidiClientUtility->GetBalanceL();
+ }
+ else if (iRMMFAudioPlayDeviceCustomCommands)
+ {
+ // Gets the balance between the left and right stereo audio channels.
+
+ User::LeaveIfError(
+ iRMMFAudioPlayDeviceCustomCommands->GetBalance(balance));
+ }
+ else // if EMC Pan Control
+ {
+ // Get the balance and set it to balance var.
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::PanL is called for EMC implemented palyer");
+ User::LeaveIfError(iMBalanceControl->GetBalance(balance));
+ }
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::PanL called, native GetBalance = %d",
+ balance);
+
+ return balance;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::SetPanL
+// Sets the panning using a linear point scale (-100 - +100).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSPanControl::SetPanL(TInt aPan)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::SetPanL: Pan = %d", aPan);
+
+ // Check in debug build that aPan is within valid range.
+ __ASSERT_DEBUG(
+ (aPan <= KAMMSMaxPanning) &&
+ (aPan >= KAMMSMinPanning),
+ User::Invariant());
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iMidiClientUtility)
+ {
+ // Set the current stereo balance value.
+ // Defaults to KMMFBalanceCenter to restore equal left-right balance.
+
+ iMidiClientUtility->SetBalanceL(aPan);
+ }
+ else if (iRMMFAudioPlayDeviceCustomCommands)
+ {
+ // Sets the balance between the left and right stereo audio channels
+ // Use a value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
+ // Centre balance can be restored by using KMMFBalanceCenter.
+
+ User::LeaveIfError(
+ iRMMFAudioPlayDeviceCustomCommands->SetBalance(aPan));
+ }
+ else // EMC Pan Control
+ {
+ // Set the Balance using the Pan Control
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::SetPanL: SetBalance()-- EMC ");
+ User::LeaveIfError(iMBalanceControl->SetBalance(aPan));
+ User::LeaveIfError(iMBalanceControl->Apply());
+ }
+
+ return PanL();
+}
+
+
+const TDesC& CAMMSPanControl::ClassName() const
+{
+ return KAMMSPanControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSPanControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::ConstructL");
+
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ // In case of CMMAMIDIPlayer use CMidiClientUtility
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+
+ iMidiClientUtility = mmaMIDIPlayer->MidiClient();
+ }
+ else if (iPlayer->Type() == KMMAEMCAudioPlayer)
+ {
+ //Get MMFactory and StreamControl from the player
+ //Create Pan Control using EMC API.
+ //Add the control to Stream Control
+ //Create Balance Control
+ iStreamControl = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->StreamControl();
+ iFactory = (static_cast<CMMAEMCAudioPlayer*>(iMMAPlayer))->MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(iFactory->CreateEffectControl(KBalanceEffectControl, temp));
+ iMBalanceControl = static_cast<MBalanceControl*>(temp);
+ User::LeaveIfError(iStreamControl->AddEffect(*iMBalanceControl));
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::ConstructL is called for EMC implemented Player");
+ }
+ else
+ {
+ CMMAAudioPlayer* mmaAudioPlayer =
+ reinterpret_cast< CMMAAudioPlayer* >(iPlayer);
+
+ RMMFController& mmfController = mmaAudioPlayer->Controller();
+
+ iRMMFAudioPlayDeviceCustomCommands =
+ new(ELeave) RMMFAudioPlayDeviceCustomCommands(mmfController);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::CAMMSPanControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPanControl::CAMMSPanControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+ iMMAPlayer = aPlayer;
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.emc/cammsprioritycontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the priority of a Player.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AudioPreference.h>
+#include <logger.h>
+#include <cmmamidiplayer.h>
+#include "cammsprioritycontrol.h"
+#include <cmmaplayerevent.h>
+#include <cmmaaudioplayer.h>
+#include <cmmaemcaudioplayer.h>
+#include <mmfcontroller.h>
+#include <midiclientutility.h>
+
+
+
+const TInt KErrorMessageSize = 32;
+_LIT(KErrPriorityError, "AMMS PC error: %d");
+
+// Default AMMS priority.
+const TInt KAMMSDefaultPriority = 50;
+
+// Reasonable MMF priorities.
+const TInt KAMMSMinMMFPriority = 71;
+const TInt KAMMSMaxMMFPriority = 89;
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxPriority = 100;
+const TInt KAMMSMinPriority = 0;
+#endif // _DEBUG
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPriorityControl* CAMMSPriorityControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSPriorityControl* self = new(ELeave) CAMMSPriorityControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSPriorityControl::~CAMMSPriorityControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::~");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::SetPriorityL
+// Sets the priority using a linear point scale between 0 and 100.
+// -----------------------------------------------------------------------------
+//
+void CAMMSPriorityControl::SetPriorityL(TInt aPriority)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityL %d", aPriority);
+
+ // Check in debug build that aPriority is within valid range.
+ __ASSERT_DEBUG(
+ (aPriority <= KAMMSMaxPriority) &&
+ (aPriority >= KAMMSMinPriority),
+ User::Invariant());
+
+ // Set a new priority only if it differs from the previous one.
+ if (aPriority != iVisiblePriority)
+ {
+ // Set the new priority to MMF only if the player is PREFETCHED
+ // (otherwise setting will leave). In other states, the new priority
+ // will be set when the player state changes to PREFETCHED.
+ if (iPlayer->State() == CMMAPlayer::EPrefetched)
+ {
+ SetPriorityToMmfL(aPriority);
+ }
+
+ iVisiblePriority = aPriority;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::Priority
+// Gets the priority.
+// -----------------------------------------------------------------------------
+TInt CAMMSPriorityControl::Priority()
+{
+ return iVisiblePriority;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::StateChanged
+// Called when player state is changed.
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::StateChanged(TInt aState)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::StateChanged +, state = %d",
+ aState);
+
+ // If the state was changed to PREFETCHED, set the buffered priority to
+ // MMF. Set a new priority only if it differs from the previous one.
+
+ if ((aState == CMMAPlayer::EPrefetched) &&
+ (iActualPriority != iVisiblePriority))
+ {
+ TRAPD(err, SetPriorityToMmfL(iVisiblePriority));
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSPriorityControl::StateChanged, err = %d", err);
+
+ if (err != KErrNone)
+ {
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrPriorityError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::StateChanged -");
+}
+
+const TDesC& CAMMSPriorityControl::ClassName() const
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSPriorityControl::ClassName");
+
+ return KAMMSPriorityControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::SetPriorityToMmfL
+// Scales the given AMMS priority to MMF priority and sets it to MMF.
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::SetPriorityToMmfL(TInt aAmmsPriority)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL %d",
+ aAmmsPriority);
+
+ // Scale the AMMS priority value to MMF priority value before setting it.
+ // The default priority used by MMA is 80. MMF priority can be between
+ // -100 and 100, but values between 71 and 89 are reasonable ones.
+ TInt newPriority = KAMMSMinMMFPriority + aAmmsPriority *
+ (KAMMSMaxMMFPriority - KAMMSMinMMFPriority) / 100; // CSI: 47 100% for scaled value #
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL, newPriority = %d",
+ newPriority);
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ // In case of CMMAMIDIPlayer use CMidiClientUtility
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+
+ CMidiClientUtility* midiClientUtility = mmaMIDIPlayer->MidiClient();
+
+ midiClientUtility->SetPriorityL(newPriority,
+ KMMAMIDIPriorityPreference);
+ }
+ else if (iPlayer->Type() == KMMAAudioPlayer)
+ {
+ CMMAAudioPlayer* mmaAudioPlayer =
+ reinterpret_cast< CMMAAudioPlayer* >(iPlayer);
+
+ RMMFController& rmmfController = mmaAudioPlayer->Controller();
+
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = newPriority;
+
+ User::LeaveIfError(
+ rmmfController.SetPrioritySettings(prioritySettings));
+ }
+ else if (iPlayer->Type() == KMMAEMCAudioPlayer)
+ {
+ MStreamControl* streamControl = (static_cast<CMMAEMCAudioPlayer*>(iPlayer))->StreamControl();
+ User::LeaveIfError(streamControl->SetPriority(newPriority, KMMAEMCPriorityPreference));
+ }
+
+ iActualPriority = aAmmsPriority;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::CAMMSPriorityControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPriorityControl::CAMMSPriorityControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer),
+ iVisiblePriority(KAMMSDefaultPriority),
+ iActualPriority(KAMMSDefaultPriority)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::ConstructL
+// 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::ConstructL +");
+
+ iPlayer->AddStateListenerL(this);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::ConstructL -");
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.mmf/cammsaudioplayerbuilder.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder for adding AMMS audio player controls.
+*
+*/
+
+
+// INCLUDE FILES
+#include <CMMAMIDIPlayer.h>
+#include <CMMAAudioPlayer.h>
+#include <logger.h>
+
+#include "CAMMSAudioPlayerBuilder.h"
+#include "CAMMSCustomCommandUtility.h"
+
+#include "CAMMSEqualizerControl.h"
+#include "CAMMSReverbControl.h"
+#include "CAMMSReverbSourceControl.h"
+#include "CAMMSAudioVirtualizerControl.h"
+#include "CAMMSPanControl.h"
+#include "CAMMSDistanceAttenuationControl.h"
+#include "CAMMSAudioDopplerControl.h"
+#include "CAMMSSpectatorDopplerControl.h"
+#include "CAMMSAudioLocationControl.h"
+#include "CAMMSSpectatorLocationControl.h"
+#include "CAMMSSpectatorOrientationControl.h"
+#include "CAMMSVolumeControl.h"
+#include "AMMSConstants.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioPlayerBuilder* CAMMSAudioPlayerBuilder::NewLC()
+{
+ CAMMSAudioPlayerBuilder* self = new(ELeave) CAMMSAudioPlayerBuilder();
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioPlayerBuilder::~CAMMSAudioPlayerBuilder()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::PreparePlayerL
+// Adds the AMMS audio controls to the player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioPlayerBuilder::PreparePlayerL(CMMAPlayer* aPlayer)
+{
+ const TDesC& playerType = aPlayer->Type();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL type %S",
+ playerType);
+
+ if ((playerType != KMMAAudioPlayer) &&
+ (playerType != KMMAMIDIPlayer))
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL, not supported");
+ return;
+ }
+
+
+ // Default type for a Control is base Control (=not a derived Control).
+ // DopplerControl and LocationControl have different Effect API
+ // implementations and also different corresponding AMMS Controls for
+ // SoundSource3D and for Spectator, so these Control types need to be
+ // set accordingly.
+ //
+ // CMMAPlayer::AddControlL( CMMAControl* aControl ) adds a new control.
+ // Ownership of the control is transferred to CMMAPlayer.
+ //
+
+#ifndef __WINS__
+ // PanControl is not supported in WINSCW builds.
+ // This is because of limited pan support in DirectX.
+ CAMMSPanControl* panControl = CAMMSPanControl::NewLC(aPlayer);
+ aPlayer->AddControlL(panControl);
+ CleanupStack::Pop(panControl);
+#endif // __WINS__
+
+ CAMMSEqualizerControl* equalizerControl =
+ CAMMSEqualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(equalizerControl);
+ CleanupStack::Pop(equalizerControl);
+
+ CAMMSReverbControl* reverbControl =
+ CAMMSReverbControl::NewLC(aPlayer);
+ aPlayer->AddControlL(reverbControl);
+ CleanupStack::Pop(reverbControl);
+
+ CAMMSAudioVirtualizerControl* audioVirtualizerControl =
+ CAMMSAudioVirtualizerControl::NewLC(aPlayer);
+ aPlayer->AddControlL(audioVirtualizerControl);
+ CleanupStack::Pop(audioVirtualizerControl);
+
+ CAMMSReverbSourceControl* reverbSourceControl =
+ CAMMSReverbSourceControl::NewLC(aPlayer, reverbControl);
+ aPlayer->AddControlL(reverbSourceControl);
+ CleanupStack::Pop(reverbSourceControl);
+
+ CAMMSDistanceAttenuationControl* distanceAttenuationControl =
+ CAMMSDistanceAttenuationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(distanceAttenuationControl);
+ CleanupStack::Pop(distanceAttenuationControl);
+
+ CAMMSAudioDopplerControl* audioDopplerControl =
+ CAMMSAudioDopplerControl::NewLC(aPlayer);
+ audioDopplerControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(audioDopplerControl);
+ CleanupStack::Pop(audioDopplerControl);
+
+ CAMMSSpectatorDopplerControl* spectatorDopplerControl =
+ CAMMSSpectatorDopplerControl::NewLC(aPlayer);
+ spectatorDopplerControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(spectatorDopplerControl);
+ CleanupStack::Pop(spectatorDopplerControl);
+
+ CAMMSAudioLocationControl* audioLocationControl =
+ CAMMSAudioLocationControl::NewLC(aPlayer);
+ audioLocationControl->iControlType = EAMMSSoundSource3DControl;
+ aPlayer->AddControlL(audioLocationControl);
+ CleanupStack::Pop(audioLocationControl);
+
+ CAMMSSpectatorLocationControl* spectatorLocationControl =
+ CAMMSSpectatorLocationControl::NewLC(aPlayer);
+ spectatorLocationControl->iControlType = EAMMSSpectatorControl;
+ aPlayer->AddControlL(spectatorLocationControl);
+ CleanupStack::Pop(spectatorLocationControl);
+
+ CAMMSSpectatorOrientationControl* spectatorOrientationControl =
+ CAMMSSpectatorOrientationControl::NewLC(aPlayer);
+ aPlayer->AddControlL(spectatorOrientationControl);
+ CleanupStack::Pop(spectatorOrientationControl);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioPlayerBuilder::PreparePlayerL add OK");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioPlayerBuilder::CAMMSAudioPlayerBuilder()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.mmf/cammspancontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the panning of a Player in the stereo output mix.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <CMMAAudioPlayer.h>
+#include <CMMAMidiPlayer.h>
+#include "CAMMSPanControl.h"
+
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxPanning = 100;
+const TInt KAMMSMinPanning = -100;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPanControl* CAMMSPanControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSPanControl* self = new(ELeave) CAMMSPanControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSPanControl::~CAMMSPanControl()
+{
+ delete iRMMFAudioPlayDeviceCustomCommands;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::PanL
+// Gets the current panning set.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSPanControl::PanL()
+{
+ TInt balance = KMMFBalanceCenter;
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iMidiClientUtility)
+ {
+ // Get the current stereo balance value.
+
+ balance = iMidiClientUtility->GetBalanceL();
+ }
+ else
+ {
+ // Gets the balance between the left and right stereo audio channels.
+
+ User::LeaveIfError(
+ iRMMFAudioPlayDeviceCustomCommands->GetBalance(balance));
+ }
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::PanL called, native GetBalance = %d",
+ balance);
+
+ return balance;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::SetPanL
+// Sets the panning using a linear point scale (-100 - +100).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSPanControl::SetPanL(TInt aPan)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::SetPanL: Pan = %d", aPan);
+
+ // Check in debug build that aPan is within valid range.
+ __ASSERT_DEBUG(
+ (aPan <= KAMMSMaxPanning) &&
+ (aPan >= KAMMSMinPanning),
+ User::Invariant());
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iMidiClientUtility)
+ {
+ // Set the current stereo balance value.
+ // Defaults to KMMFBalanceCenter to restore equal left-right balance.
+
+ iMidiClientUtility->SetBalanceL(aPan);
+ }
+ else
+ {
+ // Sets the balance between the left and right stereo audio channels
+ // Use a value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
+ // Centre balance can be restored by using KMMFBalanceCenter.
+
+ User::LeaveIfError(
+ iRMMFAudioPlayDeviceCustomCommands->SetBalance(aPan));
+ }
+
+ return PanL();
+}
+
+
+const TDesC& CAMMSPanControl::ClassName() const
+{
+ return KAMMSPanControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSPanControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPanControl::ConstructL");
+
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ // In case of CMMAMIDIPlayer use CMidiClientUtility
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+
+ iMidiClientUtility = mmaMIDIPlayer->MidiClient();
+ }
+ else
+ {
+ CMMAAudioPlayer* mmaAudioPlayer =
+ reinterpret_cast< CMMAAudioPlayer* >(iPlayer);
+
+ RMMFController& mmfController = mmaAudioPlayer->Controller();
+
+ iRMMFAudioPlayDeviceCustomCommands =
+ new(ELeave) RMMFAudioPlayDeviceCustomCommands(mmfController);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPanControl::CAMMSPanControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPanControl::CAMMSPanControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src.mmf/cammsprioritycontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the priority of a Player.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <audiopreference.h>
+#include <logger.h>
+#include <CMMAMidiPlayer.h>
+#include "CAMMSPriorityControl.h"
+#include <CMMAPlayerEvent.h>
+#include <CMMAAudioPlayer.h>
+#include <MMFController.h>
+#include <MidiClientUtility.h>
+
+
+
+const TInt KErrorMessageSize = 32;
+_LIT(KErrPriorityError, "AMMS PC error: %d");
+
+// Default AMMS priority.
+const TInt KAMMSDefaultPriority = 50;
+
+// Reasonable MMF priorities.
+const TInt KAMMSMinMMFPriority = 71;
+const TInt KAMMSMaxMMFPriority = 89;
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxPriority = 100;
+const TInt KAMMSMinPriority = 0;
+#endif // _DEBUG
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPriorityControl* CAMMSPriorityControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSPriorityControl* self = new(ELeave) CAMMSPriorityControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSPriorityControl::~CAMMSPriorityControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::~");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::SetPriorityL
+// Sets the priority using a linear point scale between 0 and 100.
+// -----------------------------------------------------------------------------
+//
+void CAMMSPriorityControl::SetPriorityL(TInt aPriority)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityL %d", aPriority);
+
+ // Check in debug build that aPriority is within valid range.
+ __ASSERT_DEBUG(
+ (aPriority <= KAMMSMaxPriority) &&
+ (aPriority >= KAMMSMinPriority),
+ User::Invariant());
+
+ // Set a new priority only if it differs from the previous one.
+ if (aPriority != iVisiblePriority)
+ {
+ // Set the new priority to MMF only if the player is PREFETCHED
+ // (otherwise setting will leave). In other states, the new priority
+ // will be set when the player state changes to PREFETCHED.
+ if (iPlayer->State() == CMMAPlayer::EPrefetched)
+ {
+ SetPriorityToMmfL(aPriority);
+ }
+
+ iVisiblePriority = aPriority;
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::Priority
+// Gets the priority.
+// -----------------------------------------------------------------------------
+TInt CAMMSPriorityControl::Priority()
+{
+ return iVisiblePriority;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::StateChanged
+// Called when player state is changed.
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::StateChanged(TInt aState)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::StateChanged +, state = %d",
+ aState);
+
+ // If the state was changed to PREFETCHED, set the buffered priority to
+ // MMF. Set a new priority only if it differs from the previous one.
+
+ if ((aState == CMMAPlayer::EPrefetched) &&
+ (iActualPriority != iVisiblePriority))
+ {
+ TRAPD(err, SetPriorityToMmfL(iVisiblePriority));
+
+ ELOG1( EJavaAMMS, "AMMS::CAMMSPriorityControl::StateChanged, err = %d", err);
+
+ if (err != KErrNone)
+ {
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrPriorityError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::StateChanged -");
+}
+
+const TDesC& CAMMSPriorityControl::ClassName() const
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSPriorityControl::ClassName");
+
+ return KAMMSPriorityControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::SetPriorityToMmfL
+// Scales the given AMMS priority to MMF priority and sets it to MMF.
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::SetPriorityToMmfL(TInt aAmmsPriority)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL %d",
+ aAmmsPriority);
+
+ // Scale the AMMS priority value to MMF priority value before setting it.
+ // The default priority used by MMA is 80. MMF priority can be between
+ // -100 and 100, but values between 71 and 89 are reasonable ones.
+ TInt newPriority = KAMMSMinMMFPriority + aAmmsPriority *
+ (KAMMSMaxMMFPriority - KAMMSMinMMFPriority) / 100; // CSI: 47 100% for scaled value #
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL, newPriority = %d",
+ newPriority);
+
+ // In case of MIDIPlayer, use CMidiClientUtility, otherwise RMMFController.
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ // In case of CMMAMIDIPlayer use CMidiClientUtility
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+
+ CMidiClientUtility* midiClientUtility = mmaMIDIPlayer->MidiClient();
+
+ midiClientUtility->SetPriorityL(newPriority,
+ KMMAMIDIPriorityPreference);
+ }
+ else
+ {
+ CMMAAudioPlayer* mmaAudioPlayer =
+ reinterpret_cast< CMMAAudioPlayer* >(iPlayer);
+
+ RMMFController& rmmfController = mmaAudioPlayer->Controller();
+
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = newPriority;
+
+ User::LeaveIfError(
+ rmmfController.SetPrioritySettings(prioritySettings));
+ }
+
+ iActualPriority = aAmmsPriority;
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::SetPriorityToMmfL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPriorityControl::CAMMSPriorityControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPriorityControl::CAMMSPriorityControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer),
+ iVisiblePriority(KAMMSDefaultPriority),
+ iActualPriority(KAMMSDefaultPriority)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::ConstructL
+// 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPriorityControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::ConstructL +");
+
+ iPlayer->AddStateListenerL(this);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSPriorityControl::ConstructL -");
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiodopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler effect of the SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsaudiodopplercontrol.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioDopplerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioDopplerControl* CAMMSAudioDopplerControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSAudioDopplerControl* self =
+ new(ELeave) CAMMSAudioDopplerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioDopplerControl::~CAMMSAudioDopplerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioDopplerControl::~CAMMSAudioDopplerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete(CAudioEffect*)iDopplerEffect;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioDopplerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioDopplerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iDopplerEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioDopplerControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Set the base class location effect as CSourceDoppler
+ // Effect API takes the ownership of customCommandUtility.
+ iDopplerEffect = CSourceDoppler::NewL(customCommandUtility);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioDopplerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioDopplerControl::DeallocateControl()
+{
+ if (iDopplerEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioDopplerControl::DeallocateControl");
+
+ // Doppler for Audio can be disabled or enabled
+ if (Enabled())
+ {
+ TRAPD(err, iDopplerEffect->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling
+ // ApplyL method without having update rights, but since the
+ // Effect is already created, that situation can be discarded.
+ }
+ }
+
+ // Delete the Effect API class.
+ delete(CAudioEffect*)iDopplerEffect;
+ iDopplerEffect = NULL;
+ }
+}
+
+const TDesC& CAMMSAudioDopplerControl::ClassName() const
+{
+ return KAMMSAudioDopplerControl;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioDopplerControl::CAMMSAudioDopplerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioDopplerControl::CAMMSAudioDopplerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSDopplerControl(aPlayer)
+{
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiolocationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsaudiolocationcontrol.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioLocationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioLocationControl* CAMMSAudioLocationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSAudioLocationControl* self =
+ new(ELeave) CAMMSAudioLocationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioLocationControl::~CAMMSAudioLocationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioLocationControl::~CAMMSAudioLocationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete(CAudioEffect*)iLocationEffect;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioLocationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioLocationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iLocationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioLocationControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Set the base class location effect as CSourceLocation
+ // Effect API takes the ownership of customCommandUtility.
+ iLocationEffect = CSourceLocation::NewL(customCommandUtility);
+
+ // Enable the Effect API Control
+ iLocationEffect->EnableL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioLocationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioLocationControl::DeallocateControl()
+{
+ if (iLocationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioLocationControl::DeallocateControl");
+
+ // Disable the Effect API Control
+ TRAPD(err, iLocationEffect->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class.
+ // The class that is derived from CLocation is casted here to the
+ // base class CAudioEffect, since CLocation has the destructor
+ // defined as protected, but the derived class and the base class
+ // have it defined as public.
+ delete(CAudioEffect*)iLocationEffect;
+ iLocationEffect = NULL;
+ }
+}
+
+const TDesC& CAMMSAudioLocationControl::ClassName() const
+{
+ return KAMMSAudioLocationControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioLocationControl::CAMMSAudioLocationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioLocationControl::CAMMSAudioLocationControl(CMMAPlayer* aPlayer)
+ : CAMMSLocationControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiooutputcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the audio output mode.
+*
+*/
+
+// INCLUDE FILES
+#include <AudioPreference.h>
+#include <logger.h>
+#include "cammsaudiooutputcontrol.h"
+#include <cmmaplayerevent.h>
+#include <cmmaaudioplayer.h>
+#include <cmmavideoplayer.h>
+#include <mmfcontroller.h>
+#include <midiclientutility.h>
+#include <cammscustomcommandutility.h>
+#include <JniEnvWrapper.h>
+// CONSTANTS
+_LIT(KErrAudioOutputControlError, "AMMS AudioOutputControl error: %d");
+const TInt KEventMessageSize = 64;
+const TInt KNoPriference = 0;
+const TInt KAllSpeakers = 1;
+const TInt KNoAudioOutput = 2;
+const TInt KAudioEarpiece = 3;
+const TInt KAudioLoudspeaker = 4;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioOutputControl* CAMMSAudioOutputControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSAudioOutputControl* self = new(ELeave) CAMMSAudioOutputControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioOutputControl::~CAMMSAudioOutputControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::~");
+ if (iAudioOutput)
+ {
+ iAudioOutput->UnregisterObserver(*this);
+ delete iAudioOutput;
+ }
+ if (iAccMonitor)
+ {
+ iAccMonitor ->StopObserving();
+ delete iAccMonitor;
+ }
+}
+
+//set java AudioOutput object
+void CAMMSAudioOutputControl::SetJavaAudioOutputObject(jobject object)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::SetJavaAudioOutputObject ");
+ iJavaAudioOutputObj = object;
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ // iJni = JniEnvWrapper::GetValidJniRef();
+}
+
+void CAMMSAudioOutputControl::ResetJavaAudioOutputObject()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::ResetJavaAudioOutputObject ");
+ jmethodID setOutputModeID = iJni->GetMethodID(
+ iJni->GetObjectClass(iJavaAudioOutputObj),
+ "setOutputMode",
+ "(I)V");
+
+ jint jpref = (jint)GetCurrentPrefInt();
+ iJni->CallVoidMethod(iJavaAudioOutputObj,setOutputModeID,jpref);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::SetAudioOutput
+// Sets the preference using a linear point scale between 0 and 4.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSAudioOutputControl::SetAudioOutput(TInt aPreference)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::SetAudioOutputL %d", aPreference);
+
+ TInt temppreference = 0;
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::SetAudioOutputL After __ASSERT_DEBUG");
+ // Set a new preference only if it differs from the previous one.
+ if (aPreference != iRoutingUserPreference)
+ {
+ switch (aPreference)
+ {
+ case KNoPriference:
+ {
+ temppreference = SetAudioOutputToMmf(CAudioOutput::ENoPreference);
+ }
+ break;
+ case KAllSpeakers:
+ {
+ temppreference = SetAudioOutputToMmf(CAudioOutput::EAll);
+ }
+ break;
+ case KNoAudioOutput:
+ {
+ temppreference = SetAudioOutputToMmf(CAudioOutput::ENoOutput);
+ }
+ break;
+ case KAudioEarpiece:
+ {
+ temppreference = SetAudioOutputToMmf(CAudioOutput::EPrivate);
+ }
+ break;
+ case KAudioLoudspeaker:
+ {
+ temppreference = SetAudioOutputToMmf(CAudioOutput::EPublic);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::SetAudioOutputL - = %d", temppreference);
+ return temppreference;
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::GetAudioOutput
+// Gets the preference.
+// -----------------------------------------------------------------------------
+TInt CAMMSAudioOutputControl::GetAudioOutput()
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::GetAudioOutput %d", (TInt)iRoutingUserPreference);
+ return (TInt)iRoutingUserPreference;
+}
+
+// ----------------------------------------------------------------------------------------
+// CAMMSAudioOutputControl::GetCurrentPreference
+// Gets the preference.if user preference is not set return the current device preference
+// ----------------------------------------------------------------------------------------
+void CAMMSAudioOutputControl::GetCurrentPreference()
+{
+ // reset the java AudioOutput object with current mode
+ ResetJavaAudioOutputObject();
+}
+
+// ----------------------------------------------------------------------------------------
+// CAMMSAudioOutputControl::GetCurrentPrefInt
+// Gets the preference.if user preference is not set return the current device preference in TInt form
+// ----------------------------------------------------------------------------------------
+
+TInt CAMMSAudioOutputControl::GetCurrentPrefInt()
+{
+ TInt pref ;
+ // get the value of current preference
+ if (iRoutingUserPreference == CAudioOutput::ENoPreference)
+ {
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::GetCurrentPrefInt_if %d", (TInt)iDefaultDevicePreference);
+ pref = GetDeviceDefaultPreference();
+ }
+ else
+ {
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::GetCurrentPrefInt_else %d", (TInt)iRoutingUserPreference);
+ pref = (TInt)iRoutingUserPreference;
+ }
+ return pref;
+}
+// ----------------------------------------------------------------------------------------
+// CAMMSAudioOutputControl::GetDeviceDefaultPreference
+// Gets the current device preference used as default
+// ----------------------------------------------------------------------------------------
+TInt CAMMSAudioOutputControl::GetDeviceDefaultPreference()
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::GetDeviceDefaultPreference %d", (TInt)iDefaultDevicePreference);
+ array.Reset();
+ TInt temp = 0;
+ TRAPD(err,iAccMonitor->GetConnectedAccessoriesL(array));
+ if (err)
+ {
+ temp = -1;
+ }
+ TInt count = array.Count();
+ if (count == 0)
+ {
+ temp = (TInt)CAudioOutput::EPublic;
+ }
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::GetDeviceDefaultPreference :RConnectedAccessories count = %d",count);
+ for (TInt i = 0; i != count; i++)
+ {
+ TAccMonCapability deviceType = array[ i ]->AccDeviceType();
+ if ((deviceType == KAccMonHeadset)||(deviceType == KAccMonBluetooth))
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::CreateHeadsetStateObserverL info = Headset Connected ");
+ temp = (TInt)CAudioOutput::EPrivate;
+ break;
+ }
+
+ }
+ return temp;
+}
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::StateChanged
+// Called when player state is changed.
+// -----------------------------------------------------------------------------
+void CAMMSAudioOutputControl::StateChanged(TInt aState)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::StateChanged +, state = %d", aState);
+ playerState = (CMMAPlayer::TPlayerState)aState;
+ if (aState == CMMAPlayer::EStarted)
+ {
+ NotifyJavaOnChange();
+ }
+}
+
+const TDesC& CAMMSAudioOutputControl::ClassName() const
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSAudioOutputControl::ClassName");
+ return KAMMSAudioOutputControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::SetPriorityToMmf
+// Scales the given AMMS priority to MMF priority and sets it to MMF.
+// -----------------------------------------------------------------------------
+TInt CAMMSAudioOutputControl::SetAudioOutputToMmf(CAudioOutput::TAudioOutputPreference aPref)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::SetAudioOutputToMmfL +");
+ CAudioOutput::TAudioOutputPreference tempPreference = iRoutingUserPreference ;
+ iRoutingUserPreference = aPref;
+ TRAPD(err,CreateNativeAudioOutputControlL();
+ iAudioOutput->SetAudioOutputL(aPref));
+ if (KErrNone != err)
+ {
+ iRoutingUserPreference = tempPreference;
+ TBuf<KEventMessageSize> errorMessage;
+ errorMessage.Format(KErrAudioOutputControlError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+ // if during play user set a preference event should be sent to java
+ if (playerState == CMMAPlayer::EStarted)
+ {
+ NotifyJavaOnChange();
+ }
+ return (TInt)iRoutingUserPreference;
+}
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::DefaultAudioOutputChanged
+// MAudioOutputObserver's function is implemented to notify about the change in routing preference
+// -----------------------------------------------------------------------------
+
+void CAMMSAudioOutputControl::DefaultAudioOutputChanged(CAudioOutput& /*aAudioOutput*/,
+ CAudioOutput::TAudioOutputPreference /*aNewDefault*/)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DefaultAudioOutputChanged ");
+
+}
+
+void CAMMSAudioOutputControl::NotifyJavaOnChange()
+{
+ TInt tempPref = GetCurrentPrefInt();
+ if (iCurrentPreference == tempPref)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::NotifyJavaOnChange - No Event ");
+ return;
+ }
+ //reset the java side object with the current iCurrentActualPreference
+ ResetJavaAudioOutputObject();
+ iCurrentPreference = tempPref;
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::NotifyJavaOnChange - Sending Event ");
+ iPlayer->PostObjectEvent(CMMAPlayerEvent::EAudioOutputPreferenceChangeEvent, iJavaAudioOutputObj);
+}
+
+void CAMMSAudioOutputControl::AccMonitorObserverError(TInt /*aError*/)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::AccMonitorObserverError");
+}
+// -----------------------------------------------------------------------------
+// CAMMSAudioOutputControl::CAMMSAudioOutputControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioOutputControl::CAMMSAudioOutputControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer),
+ iRoutingUserPreference(CAudioOutput::ENoPreference)
+{
+}
+// HEADSET CONNECTED OR NOT
+void CAMMSAudioOutputControl::ConnectedL(CAccMonitorInfo* aAccessoryInfo)
+{ // Reserve memory for the accessory information instance if necessary
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::ConnectedL +");
+ if (!iAccessoryInfo)
+ {
+ iAccessoryInfo = CAccMonitorInfo::NewL();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::ConnectedL iAccessoryInfo created");
+ }
+ // Otherwise just reset accessory information instance
+ else
+ {
+ iAccessoryInfo->Reset();
+ }
+ iAccessoryInfo->CopyL(aAccessoryInfo);
+ TAccMonCapability deviceType = iAccessoryInfo->AccDeviceType() ;
+ if ((deviceType == KAccMonHeadset) || (deviceType == KAccMonBluetooth))
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DisconnectedL: Headset connected");
+ //send a callback
+ if (iRoutingUserPreference == (TInt)(CAudioOutput::ENoPreference))
+ {
+ NotifyJavaOnChange();
+ }
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::ConnectedL -");
+}
+
+
+void CAMMSAudioOutputControl::DisconnectedL(CAccMonitorInfo* aAccessoryInfo)
+{ // Reserve memory for the accessory information instance if necessary
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DisconnectedL +");
+ if (!iAccessoryInfo)
+ {
+ iAccessoryInfo = CAccMonitorInfo::NewL();
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DisconnectedL: iAccessoryInfo created");
+ }
+ else
+ {
+ iAccessoryInfo->Reset();
+ }
+ iAccessoryInfo->CopyL(aAccessoryInfo);
+ TAccMonCapability deviceType = iAccessoryInfo->AccDeviceType();
+ if ((deviceType == KAccMonHeadset)||(deviceType == KAccMonBluetooth))
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DisconnectedL: Headset Disconnected");
+ //send a callback
+ if (iRoutingUserPreference == (TInt)(CAudioOutput::ENoPreference))
+ {
+ NotifyJavaOnChange();
+ }
+ }
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::DisconnectedL -");
+}
+
+// start observing headset connection disconnection
+
+void CAMMSAudioOutputControl::CreateHeadsetStateObserverL()
+{
+ // Headset connection and disconnection
+ iAccessoryInfo = NULL;
+ capabilityArray.Append(KAccMonHeadset);
+ capabilityArray.Append(KAccMonBluetooth);
+
+ iAccMonitor = CAccMonitor::NewL();
+ iDefaultDevicePreference = (CAudioOutput::TAudioOutputPreference)GetDeviceDefaultPreference();
+ iCurrentPreference = (TInt)iDefaultDevicePreference;
+ TBool isObserving = iAccMonitor->IsObserving();
+ if (!isObserving)
+ {
+ iAccMonitor->StartObservingL(this, capabilityArray);
+ }
+}
+
+// end CreateHeadsetStateObserver
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::ConstructL
+// 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSAudioOutputControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioOutputControl::ConstructL +");
+ // create an observer to notify the state of headset
+ //and initialize iDefaultDevicePreference with CAudioOutput::EPrivate if headset is connected.
+ CreateHeadsetStateObserverL();
+ iPlayer->AddStateListenerL(this);
+}
+
+void CAMMSAudioOutputControl::CreateNativeAudioOutputControlL()
+{
+ if (iAudioOutput)
+ {
+ return;
+ }
+
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+ iAudioOutput = CAudioOutput::NewL(*(mmaMIDIPlayer->MidiClient()));
+ }
+ else if (iPlayer->Type() == KMMAAudioPlayer)
+ {
+ MCustomCommand* customCommandUtility = (MCustomCommand *)CreateCustomCommandUtilityL();
+ // Create the CAudioOutput Object to handle the audio routing
+ iAudioOutput = CAudioOutput::NewL(*customCommandUtility);
+ }
+ else if (iPlayer->Type() == KMMAVideoPlayer)
+ {
+ CMMAVideoPlayer* mmaVideoPlayer =
+ reinterpret_cast< CMMAVideoPlayer* >(iPlayer);
+ RMMFController& mmfController = mmaVideoPlayer->Controller();
+ MCustomCommand* customCommandUtility =
+ CAMMSCustomCommandUtility::NewL(mmfController);
+ iAudioOutput = CAudioOutput::NewL(*customCommandUtility);
+ }
+
+ if(iAudioOutput)
+ {
+ iAudioOutput->RegisterObserverL(*this);
+ }
+ else
+ {
+ User::Leave(KErrNotSupported);
+ }
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsaudiovirtualizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Virtualizes audio channels.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsaudiovirtualizercontrol.h"
+
+// CONSTANTS
+const TInt KAMMSDefaultStereoWideningLevel = 100;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSAudioVirtualizerControl* CAMMSAudioVirtualizerControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSAudioVirtualizerControl* self =
+ new(ELeave) CAMMSAudioVirtualizerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSAudioVirtualizerControl::~CAMMSAudioVirtualizerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::~CAMMSAudioVirtualizerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete iStereoWideningUtility;
+ delete iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioVirtualizerControl::SetPresetL(const TDesC& aPreset)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::SetPresetL \"%S\"",
+ aPreset.Ptr());
+
+ const CDesCArray& presetNames = PresetNamesL();
+
+ TInt presetPosition = 0;
+ TInt findPreset = presetNames.Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ // This supposes that the indexing of the presets starts at zero.
+ iStereoWideningUtility->GetPresetL(presetPosition);
+
+ // Set the base class audio effect as the new CStereoWidening
+ // that is set with the previous GetPresetL method.
+ iAudioEffect = &(iStereoWideningUtility->StereoWidening());
+ iCurrentPreset = presetPosition;
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::SetPresetL \"%S\" GetPresetL OK",
+ aPreset.Ptr());
+ }
+ else
+ {
+ User::Leave(KErrArgument);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSAudioVirtualizerControl::PresetNamesL()
+{
+ // Returns an array of all preset names (pre-defined and user-defined).
+ // The pre-defined presets are in the beginning of the list.
+
+ TArray< TEfStereoWideningUtilityPreset > presetNames =
+ iStereoWideningUtility->Presets();
+
+ // Before appending the preset names, reset the member array
+ iPresetNames->Reset();
+ for (TInt i = 0; i < presetNames.Count(); i++)
+ {
+ iPresetNames->AppendL(presetNames[ i ].iPresetName);
+ }
+
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSAudioVirtualizerControl::PresetL()
+{
+ //if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+ else
+ {
+ // Retrieves a Preset with the given index from the Central Repository
+ return iStereoWideningUtility->GetPresetL(iCurrentPreset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioVirtualizerControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect.
+
+ ((CStereoWidening*)iAudioEffect)->SetStereoWideningLevelL(
+ KAMMSDefaultStereoWideningLevel);
+
+ // Instead of using CAudioEffectBase: virtual void EnableL(),
+ // use the derived effect's (=preset's) ApplyL which calls EnableL.
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::SetEnabledL(true), calling ApplyL");
+ iAudioEffect->ApplyL();
+ }
+ else
+ {
+ // Disable the effect
+ // Instead of using CAudioEffectBase: virtual void DisableL(),
+ // use the utility class DisableStereoWideningL,
+ // which calls DisableL for the correct preset
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::SetEnabledL(false), calling DisableStereoWideningL");
+ iStereoWideningUtility->DisableStereoWideningL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioVirtualizerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iStereoWideningUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Effect API takes the ownership of customCommandUtility.
+ iStereoWideningUtility = CStereoWideningUtility::NewL(
+ customCommandUtility);
+
+ // Set the base class audio effect as CStereoWidening
+ // even the native CStereoWideningUtility has an empty CStereoWidening
+ iAudioEffect = &(iStereoWideningUtility->StereoWidening());
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSAudioVirtualizerControl::DeallocateControl()
+{
+ if (iStereoWideningUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSAudioVirtualizerControl::DeallocateControl");
+
+ // Delete the Effect API class.
+ TRAPD(err, iStereoWideningUtility->DisableStereoWideningL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Utility
+ // class is already created, that situation can be discarded here.
+ }
+
+ delete iStereoWideningUtility;
+ iStereoWideningUtility = NULL;
+ }
+}
+
+const TDesC& CAMMSAudioVirtualizerControl::ClassName() const
+{
+ return KAMMSAudioVirtualizerControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSAudioVirtualizerControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSAudioVirtualizerControl::CAMMSAudioVirtualizerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSAudioVirtualizerControl::CAMMSAudioVirtualizerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSEffectControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsbasedistanceattenuationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsbasedistanceattenuationcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// Destructor
+CAMMSBaseDistanceAttenuationControl::~CAMMSBaseDistanceAttenuationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSBaseDistanceAttenuationControl::~CAMMSBaseDistanceAttenuationControl");
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSBaseDistanceAttenuationControl::CAMMSBaseDistanceAttenuationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSBaseDistanceAttenuationControl::CAMMSBaseDistanceAttenuationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsbaseequalizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsbaseequalizercontrol.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// Destructor
+CAMMSBaseEqualizerControl::~CAMMSBaseEqualizerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSBaseEqualizerControl::~CAMMSBaseEqualizerControl");
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSBaseEqualizerControl::CAMMSBaseEqualizerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSBaseEqualizerControl::CAMMSBaseEqualizerControl(CMMAPlayer* aPlayer)
+ : CAMMSEffectControl(aPlayer)
+{
+}
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsbasereverbcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsbasereverbcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSBaseReverbControl::~CAMMSBaseReverbControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSBaseReverbControl::~CAMMSBaseReverbControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSBaseReverbControl::GetEnvironmentalReverbUtilityL
+// Returns the environmental reverb utility.
+// -----------------------------------------------------------------------------
+void CAMMSBaseReverbControl::GetEnvironmentalReverbUtilityL(
+ CEnvironmentalReverbUtility** /*aEnvironmentalReverbUtility*/)
+{
+ // Derived Class will implement this method
+}
+// only require if platform support EMC
+#ifdef RD_JAVA_HTTP_EMC_ENABLED
+MReverbControl* CAMMSBaseReverbControl::GetReverbControlL()
+{
+ // derived class will implement this method
+ return (MReverbControl*)NULL;
+}
+#endif
+// -----------------------------------------------------------------------------
+// CAMMSBaseReverbControl::CAMMSBaseReverbControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSBaseReverbControl::CAMMSBaseReverbControl(CMMAPlayer* aPlayer)
+ : CAMMSEffectControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsbasereverbsourcecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect reverb source.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsbasereverbsourcecontrol.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// Destructor
+CAMMSBaseReverbSourceControl::~CAMMSBaseReverbSourceControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSBaseReverbSourceControl::~CAMMSBaseReverbSourceControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSBaseReverbSourceControl::CAMMSBaseReverbSourceControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSBaseReverbSourceControl::CAMMSBaseReverbSourceControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammscontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for AMMS controls.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmmaaudioplayer.h>
+#include <cmmamidiplayer.h>
+#include "cammscontrol.h"
+#include "cammscustomcommandutility.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSControl::~CAMMSControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControl::CreateCustomCommandUtilityL
+// Creates a custom command utility.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCustomCommandUtility* CAMMSControl::CreateCustomCommandUtilityL()
+{
+ CCustomCommandUtility* customCommandUtility = NULL;
+
+ if (iPlayer->Type() == KMMAMIDIPlayer)
+ {
+ CMMAMIDIPlayer* mmaMIDIPlayer =
+ reinterpret_cast< CMMAMIDIPlayer* >(iPlayer);
+
+ CMidiClientUtility* midiClientUtility = mmaMIDIPlayer->MidiClient();
+ customCommandUtility =
+ CCustomCommandUtility::NewL(*midiClientUtility);
+ }
+ else if (iPlayer->Type() == KMMAAudioPlayer)
+ {
+ CMMAAudioPlayer* mmaAudioPlayer =
+ reinterpret_cast< CMMAAudioPlayer* >(iPlayer);
+
+ RMMFController& mmfController = mmaAudioPlayer->Controller();
+ customCommandUtility =
+ CAMMSCustomCommandUtility::NewL(mmfController);
+ }
+ else
+ {
+ // Player is KMMAEMCAudioPlayer or of other type
+ // Do nothing
+ }
+
+ return customCommandUtility;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControl::PublicClassName
+// Returns public class name.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSControl::PublicClassName() const
+{
+ // Return null descriptor so that the control name is not visible in MMA.
+ return KNullDesC;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControl::PrepareControlL
+// Virtual function to prepare Controls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSControl::PrepareControlL()
+{
+ // Empty implementation, the Controls that need preparing overwrite this
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControl::DeallocateControl
+// Virtual function to deallocate Controls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSControl::DeallocateControl()
+{
+ // Empty implementation, the Controls that need deallocating overwrite this
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControl::CAMMSControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSControl::CAMMSControl(CMMAPlayer* aPlayer)
+ : iPlayer(aPlayer)
+{
+}
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammscustomcommandutility.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Custom command utility class for AMMS custom commands.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammscustomcommandutility.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSCustomCommandUtility::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSCustomCommandUtility* CAMMSCustomCommandUtility::NewL(
+ RMMFController& aMMFController)
+{
+ CAMMSCustomCommandUtility* self = NewLC(aMMFController);
+ CleanupStack::Pop(self);
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSCustomCommandUtility::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSCustomCommandUtility* CAMMSCustomCommandUtility::NewLC(
+ RMMFController& aMMFController)
+{
+ CAMMSCustomCommandUtility* self =
+ new(ELeave) CAMMSCustomCommandUtility(aMMFController);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSCustomCommandUtility::~CAMMSCustomCommandUtility()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSCustomCommandUtility::~CAMMSCustomCommandUtility");
+}
+
+TInt CAMMSCustomCommandUtility::CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom)
+{
+ LOG1( EJavaAMMS, EInfo,
+ "AMMS::CAMMSCustomCommandUtility::CustomCommandSync(1) function: %d",
+ aFunction);
+
+ // In the first message (ECibGetBuilder) the aDataTo1 is null,
+ // but in the second message (ECibBuild) it should contain the interface ID
+
+ return iMMFController.CustomCommandSync(
+ aDestination,
+ aFunction,
+ aDataTo1,
+ aDataTo2,
+ aDataFrom);
+}
+
+TInt CAMMSCustomCommandUtility::CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2)
+{
+ LOG1( EJavaAMMS, EInfo,
+ "AMMS::CAMMSCustomCommandUtility::CustomCommandSync(2) function: %d",
+ aFunction);
+ return iMMFController.CustomCommandSync(
+ aDestination,
+ aFunction,
+ aDataTo1,
+ aDataTo2);
+}
+
+void CAMMSCustomCommandUtility::CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom,
+ TRequestStatus& aStatus)
+{
+ LOG1( EJavaAMMS, EInfo,
+ "AMMS::CAMMSCustomCommandUtility::CustomCommandAsync(1) function: %d",
+ aFunction);
+ iMMFController.CustomCommandAsync(
+ aDestination,
+ aFunction,
+ aDataTo1,
+ aDataTo2,
+ aDataFrom,
+ aStatus);
+}
+
+void CAMMSCustomCommandUtility::CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TRequestStatus& aStatus)
+{
+ LOG1( EJavaAMMS, EInfo,
+ "AMMS::CAMMSCustomCommandUtility::CustomCommandAsync(2) function: %d",
+ aFunction);
+ iMMFController.CustomCommandAsync(
+ aDestination,
+ aFunction,
+ aDataTo1,
+ aDataTo2,
+ aStatus);
+}
+
+// -----------------------------------------------------------------------------
+// CCAMMSCustomCommandUtility::CAMMSCustomCommandUtility
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSCustomCommandUtility::CAMMSCustomCommandUtility(
+ RMMFController& aMMFController):
+ iMMFController(aMMFController)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsdistanceattenuationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls how the sound is attenuated with its distance.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsdistanceattenuationcontrol.h"
+
+// CONSTANTS
+namespace
+{
+const TInt KAMMSRoomRollOffFactor = 0; // The logical default value set to 0
+// Rolloff factor 1000 in AMMS is 100 in Effect API
+const TInt KAMMSRolloffDivider = 10;
+
+#ifdef _DEBUG
+const TInt KAMMSMinDistance = 1;
+const TInt KAMMSMinRollofFactor = 0;
+#endif // _DEBUG
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSDistanceAttenuationControl* CAMMSDistanceAttenuationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSDistanceAttenuationControl* self =
+ new(ELeave)CAMMSDistanceAttenuationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSDistanceAttenuationControl::~CAMMSDistanceAttenuationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDistanceAttenuationControl::~CAMMSDistanceAttenuationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete iDistanceAttenuation;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControl::SetParametersL
+// Sets all the 3D audio distance attenuation parameters simultaneously.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDistanceAttenuationControl::SetParametersL(
+ TInt aMinDistance,
+ TInt aMaxDistance,
+ TBool aMuteAfterMax,
+ TInt aRolloffFactor)
+{
+ // Check in debug build that parameters are within valid range.
+ __ASSERT_DEBUG(
+ (aMaxDistance > aMinDistance) &&
+ (aMinDistance >= KAMMSMinDistance) &&
+ (aMaxDistance >= KAMMSMinDistance) &&
+ (aRolloffFactor >= KAMMSMinRollofFactor),
+ User::Invariant());
+
+ // NOTE: Effect API uses hundreths (100 corresponds to 1.00),
+ // but JSR234 uses thousandths (1000 represents a rolloff factor of 1.0)
+ //
+ LOG4( EJavaMMAPI, EInfo, "AMMS::CAMMSDistanceAttenuationControl::SetParametersL %d, %d, %d, %d",
+ aMinDistance, aMaxDistance, aMuteAfterMax, aRolloffFactor);
+
+ TInt convertedRolloffFactor = aRolloffFactor / KAMMSRolloffDivider;
+
+ iDistanceAttenuation->SetDistanceAttenuationL(aMinDistance, aMaxDistance,
+ aMuteAfterMax, convertedRolloffFactor, KAMMSRoomRollOffFactor);
+
+ // Apply updated settings to Effect API.
+ iDistanceAttenuation->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDistanceAttenuationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iDistanceAttenuation)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDistanceAttenuationControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Effect API takes the ownership of customCommandUtility.
+ iDistanceAttenuation = CDistanceAttenuation::NewL(
+ customCommandUtility);
+
+ // Enable the Effect API Control
+ iDistanceAttenuation->EnableL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDistanceAttenuationControl::DeallocateControl()
+{
+ if (iDistanceAttenuation)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDistanceAttenuationControl::DeallocateControl");
+
+ // Disable the Effect API Control
+ TRAPD(err, iDistanceAttenuation->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class (it deletes CustomCommandUtility)
+ delete iDistanceAttenuation;
+ iDistanceAttenuation = NULL;
+ }
+}
+
+const TDesC& CAMMSDistanceAttenuationControl::ClassName() const
+{
+ return KAMMSDistanceAttenuationControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDistanceAttenuationControl::CAMMSDistanceAttenuationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSDistanceAttenuationControl::CAMMSDistanceAttenuationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSBaseDistanceAttenuationControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsdopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an effect called Doppler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <logger.h>
+#include "cammsdopplercontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSDopplerControl::~CAMMSDopplerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::~CAMMSDopplerControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::SetEnabled
+// Specifies if this Doppler effect is active or ignored.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDopplerControl::SetEnabledL(TBool aDopplerEnabled)
+{
+ if (aDopplerEnabled)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::SetEnabledL(true)");
+ iDopplerEffect->EnableL();
+ }
+ else
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::SetEnabledL(false)");
+ iDopplerEffect->DisableL();
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::Enabled
+// Returns whether this Doppler effect is currently active.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSDopplerControl::Enabled()
+{
+ return iDopplerEffect->IsEnabled();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::SetVelocityCartesianL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDopplerControl::SetVelocityCartesianL(
+ TInt aX,
+ TInt aY,
+ TInt aZ)
+{
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::SetVelocityCartesianL: X=%d, Y=%d, Z=%d",
+ aX, aY, aZ);
+
+ iDopplerEffect->SetCartesianVelocityL(aX, aY, aZ);
+
+ // Apply updated settings to Effect API.
+ iDopplerEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::VelocityCartesian
+// Returns the current velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDopplerControl::VelocityCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Get the velocity's cartesian settings
+ // aX, aY and aZ are velocities in format mm/s
+
+ iDopplerEffect->CartesianVelocity(
+ (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::SetVelocitySphericalL
+// Sets the velocity, used in calculations for the Doppler effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSDopplerControl::SetVelocitySphericalL(
+ TInt aAzimuth,
+ TInt aElevation,
+ TInt aRadius)
+{
+ // Parameters are thousandths of radians
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::SetVelocitySphericalL %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedElevation = (TInt32)(aElevation * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSDopplerControl::SetVelocitySphericalL %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ iDopplerEffect->SetSphericalVelocityL(
+ convertedAzimuth, convertedElevation, aRadius);
+
+ // Apply updated settings to Effect API.
+ iDopplerEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSDopplerControl::CAMMSDopplerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSDopplerControl::CAMMSDopplerControl(CMMAPlayer* aPlayer):
+ CAMMSControl(aPlayer)
+{
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammseffectcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls an abstract filter with various preset settings.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammseffectcontrol.h"
+#include "cammseffectcontrolgroup.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSEffectControl::~CAMMSEffectControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControl::~CAMMSEffectControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::SetEnforcedL
+// Enforces the effect to be in use.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEffectControl::SetEnforcedL(TBool aEnforced)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControl:SetEnforcedL");
+ // Indicate the effect is to be enforced or not. ETrue = Enforced.
+
+ iAudioEffect->EnforceL(aEnforced);
+
+ ApplySettingsL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::Enforced
+// Returns the current enforced setting of the effect.
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSEffectControl::Enforced()
+{
+ // Returns ETrue if the effect is enforced, EFalse if not enforced.
+ return iAudioEffect->IsEnforced();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::SetScopeL
+// Sets the scope of the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEffectControl::SetScopeL(TInt aScope)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControl:SetScopeL");
+ // Check in debug build that scope is the only supported scope (LIVE_ONLY).
+ __ASSERT_DEBUG(
+ (aScope == CAMMSEffectControlGroup::EScopeLiveOnly),
+ User::Invariant());
+ // Just to suppress warning in release build
+ (void)aScope;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::Scope
+// Returns the scope in which the effect is present.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEffectControl::Scope()
+{
+ // For now only the (LIVE_ONLY) scope is supported.
+ return CAMMSEffectControlGroup::EScopeLiveOnly;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::ApplySettingsL
+// Apply changed settings if Effect is in enabled state.
+// -----------------------------------------------------------------------------
+void CAMMSEffectControl::ApplySettingsL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControl:ApplySettingsL called, checking state");
+ if (iAudioEffect->IsEnabled())
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEffectControl:ApplySettingsL calling ApplyL");
+ iAudioEffect->ApplyL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEffectControl::ConstructL()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectControl::CAMMSEffectControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEffectControl::CAMMSEffectControl(CMMAPlayer* aPlayer):
+ CAMMSControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsequalizercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the equalization settings of a Player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsequalizercontrol.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEqualizerControl* CAMMSEqualizerControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSEqualizerControl* self =
+ new(ELeave) CAMMSEqualizerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSEqualizerControl::~CAMMSEqualizerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::~CAMMSEqualizerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete iEqualizerUtility;
+ delete iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::BandLevelL
+// Gets the gain set for the given equalizer band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::BandLevelL(TInt aBand)
+{
+ // if aBand is out of range the method must leave with KErrArgument.
+ if (aBand < 0 || aBand > (NumberOfBands() - 1))
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // Returns the band level in mB for the specified band
+ // AudioEqualizerBase: TInt32 BandLevel( TUint8 aBand ) const;
+ return ((CAudioEqualizer*)iAudioEffect)->BandLevel(
+ (TUint8)(aBand + KAMMSBandOffset));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::MaxBandLevel
+// Returns the maximum band level supported.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::MaxBandLevel()
+{
+ // Get the dB range in mB for the equalizer.
+
+ TInt32 minLevel = 0;
+ TInt32 maxLevel = 0;
+ ((CAudioEqualizer*)iAudioEffect)->DbLevelLimits(minLevel, maxLevel);
+
+ return maxLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::MinBandLevel
+// Returns the minimum band level supported.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::MinBandLevel()
+{
+ // Get the dB range in mB for the equalizer.
+
+ TInt32 minLevel = 0;
+ TInt32 maxLevel = 0;
+ ((CAudioEqualizer*)iAudioEffect)->DbLevelLimits(minLevel, maxLevel);
+
+ return minLevel;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::BandWidth
+// Returns the band width in Hz for the specified band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::BandWidth(TInt aBand)
+{
+ return ((CAudioEqualizer*)iAudioEffect)->BandWidth(
+ (TUint8)(aBand + KAMMSBandOffset));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::CenterFrequency
+// Returns the center frequency in Hz for a given band.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::CenterFrequency(TInt aBand)
+{
+ return ((CAudioEqualizer*)iAudioEffect)->CenterFrequency(
+ (TUint8)(aBand + KAMMSBandOffset));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::CrossoverFrequency
+// Returns the cross-over frequency between the given frequency.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::CrossoverFrequency(TInt aBand)
+{
+ return ((CAudioEqualizer*)iAudioEffect)->CrossoverFrequency(
+ (TUint8)(aBand + KAMMSBandOffset));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::NumberOfBands
+// Gets the number of frequency bands that the equalizer supports.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSEqualizerControl::NumberOfBands()
+{
+ // Returns the number of equalizer bands.
+ // AudioEqualizerBase: TUint8 NumberOfBands() const;
+ return ((CAudioEqualizer*)iAudioEffect)->NumberOfBands();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::SetBandLevelL
+// Sets the given equalizer band to the given gain value.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEqualizerControl::SetBandLevelL(
+ TInt aLevel,
+ TInt aBand)
+{
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetBandLevelL: level=%d, band=%d",
+ aLevel, aBand);
+
+ // If aBand or aLevel is out of valid range the method must leave
+ // with KErrArgument.
+ if (aBand < 0 ||
+ aBand > (NumberOfBands() - 1) ||
+ aLevel < MinBandLevel() ||
+ aLevel > MaxBandLevel())
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // Sets the equalizer band level value in mB, ranging from Min to Max
+ ((CAudioEqualizer*)iAudioEffect)->SetBandLevelL(
+ (TInt8)(aBand + KAMMSBandOffset), aLevel);
+
+ ApplySettingsL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEqualizerControl::SetPresetL(const TDesC& aPreset)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetPresetL \"%S\"", aPreset.Ptr());
+
+ const CDesCArray& presetNames = PresetNamesL();
+
+ TInt presetPosition = 0;
+ TInt findPreset = presetNames.Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ // This supposes that the indexing of the presets starts at zero.
+ iEqualizerUtility->GetPresetL(presetPosition);
+
+ // Set the base class audio effect as the new CAudioEqualizer
+ // that is set with the previous GetPresetL method.
+ iAudioEffect = &(iEqualizerUtility->Equalizer());
+ iCurrentPreset = presetPosition;
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetPresetL \"%S\" GetPresetL OK",
+ aPreset.Ptr());
+ }
+ else
+ {
+ User::Leave(KErrArgument);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSEqualizerControl::PresetNamesL()
+{
+ // Returns an array of all preset names (pre-defined and user-defined).
+ // The pre-defined presets are in the beginning of the list.
+
+ TArray< TEfAudioEqualizerUtilityPreset > presetNames =
+ iEqualizerUtility->Presets();
+
+ // Before appending the preset names, reset the member array
+ iPresetNames->Reset();
+ for (TInt i = 0; i < presetNames.Count(); i++)
+ {
+ iPresetNames->AppendL(presetNames[ i ].iPresetName);
+ }
+
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSEqualizerControl::PresetL()
+{
+ //if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+ else
+ {
+ // Retrieves a Preset with the given index from the Central Repository
+ // AudioEqualizerUtility.h:
+ // const TDesC& GetPresetL(TInt aPresetIndex)
+ return iEqualizerUtility->GetPresetL(iCurrentPreset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEqualizerControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect
+ // Instead of using CAudioEffectBase: virtual void EnableL(),
+ // use the derived effect's (=preset's) ApplyL which calls EnableL.
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetEnabledL(true), calling ApplyL");
+ iAudioEffect->ApplyL();
+ }
+ else
+ {
+ // Disable the effect
+ // Instead of using CAudioEffectBase: virtual void DisableL(),
+ // use the utility class DisableEqualizerL,
+ // which calls DisableL for the correct preset
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetEnabledL(false), calling DisableEqualizerL");
+ iEqualizerUtility->DisableEqualizerL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEqualizerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iEqualizerUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Effect API takes the ownership of customCommandUtility.
+ iEqualizerUtility = CAudioEqualizerUtility::NewL(
+ customCommandUtility);
+
+ // Set the base class audio effect as CAudioEqualizer,
+ // even the native AudioEqualizerUtility has an empty CAudioEqualizer
+ iAudioEffect = &(iEqualizerUtility->Equalizer());
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSEqualizerControl::DeallocateControl()
+{
+ if (iEqualizerUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::DeallocateControlL");
+
+ // Delete the Effect API class.
+ TRAPD(err, iEqualizerUtility->DisableEqualizerL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Utility
+ // class is already created, that situation can be discarded here.
+ }
+
+ delete iEqualizerUtility;
+ iEqualizerUtility = NULL;
+ }
+}
+
+const TDesC& CAMMSEqualizerControl::ClassName() const
+{
+ return KAMMSEqualizerControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEqualizerControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEqualizerControl::CAMMSEqualizerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEqualizerControl::CAMMSEqualizerControl(CMMAPlayer* aPlayer)
+ : CAMMSBaseEqualizerControl(aPlayer)
+{
+}
+
+// End of File
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammslocationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of an object.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <logger.h>
+#include "cammslocationcontrol.h"
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMinRadius = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSLocationControl::~CAMMSLocationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSLocationControl::~CAMMSLocationControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControl::SetLocationCartesianL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSLocationControl::SetLocationCartesianL(
+ TInt& aX,
+ TInt& aY,
+ TInt& aZ)
+{
+ // Sets the cartesian coordinates for the listener/source location.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSLocationControl::SetLocationCartesianL: %d, %d, %d",
+ aX, aY, aZ);
+
+ iLocationEffect->SetLocationCartesianL(
+ (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ);
+
+ // Apply updated settings to Effect API.
+ iLocationEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControl::LocationCartesian
+// Gets the coordinates of the current location.
+// -----------------------------------------------------------------------------
+void CAMMSLocationControl::LocationCartesian(
+ TInt& aX, TInt& aY, TInt& aZ)
+{
+ // Gets the cartesian coordinates for the location of the listener position.
+ // The coordinates of the positions are in millimeters.
+
+ iLocationEffect->LocationCartesian(
+ (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ);
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControl::SetLocationSphericalL
+// Moves the object to the new location.
+// -----------------------------------------------------------------------------
+void CAMMSLocationControl::SetLocationSphericalL(
+ TInt& aAzimuth,
+ TInt& aElevation,
+ TInt& aRadius)
+{
+ // Check in debug build that aRadius is within valid range.
+ __ASSERT_DEBUG(aRadius >= KAMMSMinRadius, User::Invariant());
+
+ // Sets the spherical coordinates for the location of the listener position.
+ // The parameters are thousandths of radians
+ //
+ // NOTE: Effect API uses thousandths of radians for aAzimuth and aElevation,
+ // but JSR234 uses degrees.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSLocationControl::SetLocationSphericalL: %d, %d, %d",
+ aAzimuth, aElevation, aRadius);
+
+ TInt32 convertedAzimuth = (TInt32)(aAzimuth *
+ KDegToRad * 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedElevation = (TInt32)(aElevation *
+ KDegToRad * 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSLocationControl::SetLocationSphericalL: %d, %d",
+ convertedAzimuth, convertedElevation);
+
+ iLocationEffect->SetLocationSphericalL(
+ convertedAzimuth, convertedElevation, (TInt32&)aRadius);
+
+ // Apply updated settings to Effect API.
+ iLocationEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSLocationControl::CAMMSLocationControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSLocationControl::CAMMSLocationControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsorientationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of an object.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <logger.h>
+#include "cammsorientationcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSOrientationControl::~CAMMSOrientationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSOrientationControl::~CAMMSOrientationControl");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControl::SetOrientationL
+// Turns the object to the new orientation.
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControl::SetOrientationL(
+ TInt aHeading,
+ TInt aPitch,
+ TInt aRoll)
+{
+ // Sets the Heading, Pitch, Roll values for the source/listener orientation.
+ // Parameters are given in thousandths of radians.
+ // SourceOrientationBase/ListenerLocationBase :
+ //
+ // NOTE: Effect API uses thousandths of radians for all three parameters,
+ // but JSR234 uses degrees.
+ //
+ // From e32Math.h: The multiplying factor to convert degrees to radians.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSOrientationControl::SetOrientationL: %d, %d, %d",
+ aHeading, aPitch, aRoll);
+
+ TInt32 convertedHeading = (TInt32)(aHeading * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedPitch = (TInt32)(aPitch * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ TInt32 convertedRoll = (TInt32)(aRoll * KDegToRad *
+ 1000); // CSI: 47 Effect API uses thousands of radians #
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSOrientationControl::SetOrientationL: %d, %d, %d",
+ convertedHeading, convertedPitch, convertedRoll);
+
+ iOrientationEffect->SetOrientationL(
+ convertedHeading, convertedPitch, convertedRoll);
+
+ // Apply updated settings to Effect API.
+ iOrientationEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControl::SetOrientationL
+// Turns the object to the new orientation.
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControl::SetOrientationL(
+ TInt aFrontX, TInt aFrontY, TInt aFrontZ,
+ TInt aAboveX, TInt aAboveY, TInt aAboveZ)
+{
+ // Check in debug build that parameters are not zero vectors.
+ __ASSERT_DEBUG(((aFrontX != 0) ||
+ (aFrontY != 0) ||
+ (aFrontZ != 0)) &&
+ ((aAboveX != 0) ||
+ (aAboveY != 0) ||
+ (aAboveZ != 0)),
+ User::Invariant());
+
+ // Check in debug build that vectors are not parallel.
+ // Two vectors are parallel if their cross product is zero vector.
+ // Cross product of vectors a1*i + a2*j + a3*k and b1*i + b2*j + b3*k :
+ // (a2*b3 - a3*b2)i + (a3*b1 - a1*b3)j + (a1*b2 - a2*b1)k
+ __ASSERT_DEBUG(
+ ((aFrontY * aAboveZ) - (aFrontZ * aAboveY) != 0) ||
+ ((aFrontZ * aAboveX) - (aFrontX * aAboveZ) != 0) ||
+ ((aFrontX * aAboveY) - (aFrontY * aAboveX) != 0),
+ User::Invariant());
+
+ // Sets the Front and Above vectors for the orientation of the source/listener.
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSOrientationControl::SetOrientationL: Front %d, %d, %d",
+ aFrontX, aFrontY, aFrontZ);
+
+ LOG3( EJavaAMMS, EInfo, "AMMS::CAMMSOrientationControl::SetOrientationL: Above %d, %d, %d",
+ aAboveX, aAboveY, aAboveZ);
+
+ iOrientationEffect->SetOrientationVectorsL(
+ (TInt32)aFrontX, (TInt32)aFrontY, (TInt32)aFrontZ,
+ (TInt32)aAboveX, (TInt32)aAboveY, (TInt32)aAboveZ);
+
+ // Apply updated settings to Effect API.
+ iOrientationEffect->ApplyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControl::OrientationVectors
+// Gets the orientation of the object using two vectors.
+// -----------------------------------------------------------------------------
+void CAMMSOrientationControl::OrientationVectors(
+ TInt& aFrontX, TInt& aFrontY, TInt& aFrontZ,
+ TInt& aAboveX, TInt& aAboveY, TInt& aAboveZ)
+{
+ // Gets the orientation of the source.
+
+ iOrientationEffect->OrientationVectors(
+ (TInt32&)aFrontX, (TInt32&)aFrontY, (TInt32&)aFrontZ,
+ (TInt32&)aAboveX, (TInt32&)aAboveY, (TInt32&)aAboveZ);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSOrientationControl::CAMMSOrientationControl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSOrientationControl::CAMMSOrientationControl(CMMAPlayer* aPlayer)
+ : CAMMSControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsplayerbuilder.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for AMMS player builders.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cammsplayerbuilder.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSPlayerBuilder::~CAMMSPlayerBuilder()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilder::CAMMSPlayerBuilder
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPlayerBuilder::CAMMSPlayerBuilder()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsplayerbuildergroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder group for adding players.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cammsplayerbuildergroup.h"
+
+// CONSTANTS
+const TInt KDefaultGranularity = 1;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPlayerBuilderGroup* CAMMSPlayerBuilderGroup::NewL()
+{
+ CAMMSPlayerBuilderGroup* self = NewLC();
+ CleanupStack::Pop(self);
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSPlayerBuilderGroup* CAMMSPlayerBuilderGroup::NewLC()
+{
+ CAMMSPlayerBuilderGroup* self = new(ELeave) CAMMSPlayerBuilderGroup();
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSPlayerBuilderGroup::~CAMMSPlayerBuilderGroup()
+{
+ if (iPlayerBuilders)
+ {
+ iPlayerBuilders->ResetAndDestroy();
+ }
+ delete iPlayerBuilders;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::PreparePlayerL
+// Performs PreparePlayerL for every player builder in the array.
+// -----------------------------------------------------------------------------
+void CAMMSPlayerBuilderGroup::PreparePlayerL(CMMAPlayer* aPlayer)
+{
+ TInt builderCount = iPlayerBuilders->Count();
+ for (TInt i = 0; i < builderCount; i++)
+ {
+ iPlayerBuilders->At(i)->PreparePlayerL(aPlayer);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::AddBuilderAndPopL
+// Adds a player builder to the array.
+// -----------------------------------------------------------------------------
+//
+void CAMMSPlayerBuilderGroup::AddBuilderAndPopL(
+ CAMMSPlayerBuilder* aPlayerBuilder)
+{
+ iPlayerBuilders->AppendL(aPlayerBuilder);
+ CleanupStack::Pop(aPlayerBuilder);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSPlayerBuilderGroup::ConstructL()
+{
+ iPlayerBuilders = new(ELeave) CArrayPtrSeg< CAMMSPlayerBuilder >
+ (KDefaultGranularity);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerBuilderGroup::CAMMSPlayerBuilderGroup
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSPlayerBuilderGroup::CAMMSPlayerBuilderGroup()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsreverbcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,390 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect called reverb.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsreverbcontrol.h"
+#include <RoomLevelBase.h>
+#include <logger.h>
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxReverbLevel = 0;
+const TInt KAMMSMinReverbTime = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSReverbControl* CAMMSReverbControl::NewLC(CMMAPlayer* aPlayer)
+{
+ CAMMSReverbControl* self = new(ELeave) CAMMSReverbControl(aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSReverbControl::~CAMMSReverbControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::~CAMMSReverbControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete iReverbUtility;
+ delete iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::SetReverbLevelL
+// Sets the gain level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::SetReverbLevelL(TInt aLevel)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbLevelL: %d", aLevel);
+
+ // Check in debug build that aLevel is within valid range.
+ __ASSERT_DEBUG(aLevel <= KAMMSMaxReverbLevel, User::Invariant());
+
+ CEnvironmentalReverb* reverbEffect = (CEnvironmentalReverb*)iAudioEffect;
+
+ TInt roomLevel = reverbEffect->RoomLevel();
+ TInt tempChange = aLevel - reverbEffect->ReflectionsLevel() - roomLevel;
+
+ // Sets the reverb reflections level in mB
+ reverbEffect->SetReflectionsLevelL(aLevel - roomLevel);
+
+
+ // Calculate native reverb level.
+ TInt reverbLevel = reverbEffect->ReverbLevel() + tempChange;
+
+ // Ensure that the level is within the limits.
+
+ TInt32 minLevel = 0;
+ TInt32 maxLevel = 0;
+ reverbEffect->ReverbLevelRange(minLevel, maxLevel);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbLevelL: orig %d",
+ reverbLevel);
+
+ reverbLevel = Min(reverbLevel, maxLevel);
+ reverbLevel = Max(reverbLevel, minLevel);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbLevelL: set %d",
+ reverbLevel);
+
+ // Sets the reverb level in mB
+ reverbEffect->SetReverbLevelL(reverbLevel);
+
+ // Apply can be called for Reverb, as it does not internally include EnableL
+ // unlike in case of Equalizer or StereoWidening
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbLevelL calling ApplyL");
+ reverbEffect->ApplyL();
+
+ // Return the value that was used in setting the reverb
+ return aLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::SetReverbTimeL
+// Sets the reverberation time of the reverb.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbControl::SetReverbTimeL(TInt aTime)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbTimeL: %d", aTime);
+
+ // Check in debug build that aTime is within valid range.
+ __ASSERT_DEBUG(aTime >= KAMMSMinReverbTime, User::Invariant());
+
+ // Sets the decay time in milliseconds
+ ((CEnvironmentalReverb*)iAudioEffect)->SetDecayTimeL(aTime);
+
+ // Apply can be called for Reverb, as it does not internally include EnableL
+ // unlike in case of Equalizer or StereoWidening
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetReverbTimeL calling ApplyL");
+ iAudioEffect->ApplyL();
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::ReverbLevel
+// Gets the gain level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::ReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::ReverbLevel called");
+ // Return here (reflections level + room level)
+ return (((CEnvironmentalReverb*)iAudioEffect)->ReflectionsLevel() +
+ ((CEnvironmentalReverb*)iAudioEffect)->RoomLevel());
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::ReverbTime
+// Gets the reverberation time.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::ReverbTime()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::ReverbTime called");
+
+ return (((CEnvironmentalReverb*)iAudioEffect)->DecayTime());
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::MinReverbLevel
+// Gets the minimum level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::MinReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::MinReverbLevel called");
+
+ TInt32 minLevel;
+ TInt32 maxLevel;
+ ((CEnvironmentalReverb*)iAudioEffect)->ReverbLevelRange(
+ minLevel, maxLevel);
+
+ return minLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::MaxReverbLevel
+// Gets the maximum level of the reverberation.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::MaxReverbLevel()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::MaxReverbLevel called");
+
+ TInt32 minLevel;
+ TInt32 maxLevel;
+ ((CEnvironmentalReverb*)iAudioEffect)->ReverbLevelRange(
+ minLevel, maxLevel);
+
+ return maxLevel;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::CurrentPresetIndex
+// Gets current preset index.
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSReverbControl::CurrentPresetIndex()
+{
+ return iCurrentPreset;
+}
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::SetPresetL
+// Sets the effect according to the given preset.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbControl::SetPresetL(const TDesC& aPreset)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetPresetL \"%S\"", aPreset.Ptr());
+
+ const CDesCArray& presetNames = PresetNamesL();
+
+ TInt presetPosition = 0;
+ TInt findPreset = presetNames.Find(aPreset, presetPosition);
+ if (findPreset == 0) // Find returns zero, if a matching element is found.
+ {
+ // This supposes that the indexing of the presets starts at zero.
+ iReverbUtility->GetPresetL(presetPosition);
+
+ // Set the base class audio effect as the new CEnvironmentalReverb
+ // that is set with the previous GetPresetL method.
+ iAudioEffect = &(iReverbUtility->EnvironmentalReverb());
+ iCurrentPreset = presetPosition;
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetPresetL \"%S\" GetPresetL OK",
+ aPreset.Ptr());
+ }
+ else
+ {
+ User::Leave(KErrArgument);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::PresetNamesL
+// Gets the available preset names.
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CAMMSReverbControl::PresetNamesL()
+{
+ // Returns an array of all preset names (pre-defined and user-defined).
+ // The pre-defined presets are in the beginning of the list.
+ TArray< TEfEnvironmentalReverbUtilityPreset > presetNames =
+ iReverbUtility->Presets();
+
+ // Before appending the preset names, reset the member array
+ iPresetNames->Reset();
+ for (TInt i = 0; i < presetNames.Count(); i++)
+ {
+ iPresetNames->AppendL(presetNames[ i ].iPresetName);
+ }
+
+ return *iPresetNames;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::PresetL
+// Gets the current preset.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAMMSReverbControl::PresetL()
+{
+ //if no preset is set, return null
+ if (iCurrentPreset < 0)
+ {
+ return KNullDesC;
+ }
+ else
+ {
+ // Retrieves a Preset with the given index from the Central Repository
+ return iReverbUtility->GetPresetL(iCurrentPreset);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::SetEnabledL
+// Enables/disables the effect.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbControl::SetEnabledL(TBool aEnable)
+{
+ if (aEnable)
+ {
+ // Enable the effect
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetEnabledL(true), calling EnableL");
+ iAudioEffect->EnableL();
+ }
+ else
+ {
+ // Disable the effect
+ // Instead of using CAudioEffectBase: virtual void DisableL(),
+ // use the utility class DisableEnvironmentalReverbL,
+ // which calls DisableL for the correct preset
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::SetEnabledL(false), calling DisableEnvironmentalReverbL");
+ iReverbUtility->DisableEnvironmentalReverbL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iReverbUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Effect API takes the ownership of customCommandUtility.
+ iReverbUtility = CEnvironmentalReverbUtility::NewL(
+ customCommandUtility);
+
+ SetPresetL(KAMMSDefaultReverbPreset);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbControl::DeallocateControl()
+{
+ if (iReverbUtility)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::DeallocateControlL");
+
+ // Delete the Effect API class.
+ TRAPD(err, iReverbUtility->DisableEnvironmentalReverbL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Utility
+ // class is already created, that situation can be discarded here.
+ }
+
+ delete iReverbUtility;
+ iReverbUtility = NULL;
+
+ // Set current preset to a negative value to state it has not been set
+ iCurrentPreset = -1;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::GetEnvironmentalReverbUtilityL
+// Returns the environmental reverb utility.
+// -----------------------------------------------------------------------------
+void CAMMSReverbControl::GetEnvironmentalReverbUtilityL(
+ CEnvironmentalReverbUtility** aEnvironmentalReverbUtility)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::GetEnvironmentalReverbUtilityL");
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbControl::GetEnvironmentalReverbUtilityL CurrentPreset = %d",CurrentPresetIndex());
+ *aEnvironmentalReverbUtility = iReverbUtility;
+}
+
+const TDesC& CAMMSReverbControl::ClassName() const
+{
+ return KAMMSReverbControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSReverbControl::ConstructL()
+{
+ // Create array for preset names
+ iPresetNames = new(ELeave) CDesCArrayFlat(1);
+
+ // Set current preset to a negative value as it is not set yet
+ iCurrentPreset = -1;
+
+ CAMMSEffectControl::ConstructL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbControl::CAMMSReverbControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSReverbControl::CAMMSReverbControl(CMMAPlayer* aPlayer)
+ : CAMMSBaseReverbControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsreverbsourcecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the settings of an audio effect reverb source.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsreverbsourcecontrol.h"
+#include "cammsbasereverbcontrol.h"
+
+// CONSTANTS
+const TInt KAMMSDisconnectReverbSource = 2147483647; // From JSR-234
+
+
+#ifdef _DEBUG
+const TInt KAMMSMaxRoomLevel = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSReverbSourceControl* CAMMSReverbSourceControl::NewLC(
+ CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aReverbControl)
+{
+ CAMMSReverbSourceControl* self =
+ new(ELeave)CAMMSReverbSourceControl(aPlayer, aReverbControl);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSReverbSourceControl::~CAMMSReverbSourceControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::~CAMMSReverbSourceControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete iReverbSource;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControl::SetRoomLevelL
+// Sets the object specific level for the reverberant sound.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbSourceControl::SetRoomLevelL(TInt aLevel)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL +: %d", aLevel);
+
+ // Check in debug build that aLevel is within valid range.
+ __ASSERT_DEBUG(
+ (aLevel <= KAMMSMaxRoomLevel) ||
+ (aLevel == KAMMSDisconnectReverbSource),
+ User::Invariant());
+
+ // With the JSR-234 value Integer.MIN_VALUE, the reflected sound for the
+ // given object can be disabled.
+ if (aLevel == KMinTInt)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL(Integer.MIN_VALUE)");
+ aLevel = 0;
+ }
+
+ // Check the allowed boundaries for room level.
+ TInt32 minLevel = 0;
+ TInt32 maxLevel = 0;
+ iReverbSource->LevelRange(minLevel, maxLevel);
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL boundaries %d, %d",
+ minLevel, maxLevel);
+
+ // Check the state of the effect. If it is in disabled state, enable it.
+ if (!iReverbSource->IsEnabled())
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL calling EnableL");
+ iReverbSource->EnableL();
+ }
+
+ // With the JSR-234 value DISCONNECT, the object can be disconnected
+ // from the reverb.
+ if (aLevel == KAMMSDisconnectReverbSource)
+ {
+ // Do not call iReverbSource->DisableL(), instead set the room level to
+ // _minimum_ value (= smallest negative gain -> maximum attenuation).
+ // The CRoomLevel must also be kept enabled.
+ aLevel = minLevel;
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL(DISCONNECT) %d",
+ minLevel);
+ }
+ else
+ {
+ // Set the room level within allowed boundaries from Effect API
+ aLevel = Min(aLevel, maxLevel);
+ aLevel = Max(aLevel, minLevel);
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL setting value: %d", aLevel);
+ }
+
+ // Sets the RoomLevel level, it will leave if aRoomLevel is not within range
+ // of Min and Max
+ iReverbSource->SetRoomLevelL((TInt32)aLevel);
+
+ // Apply updated settings to Effect API.
+ iReverbSource->ApplyL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::SetRoomLevelL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbSourceControl::PrepareControlL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::PrepareControlL");
+
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iReverbSource)
+ {
+ CEnvironmentalReverbUtility* reverbUtility = NULL;
+ iReverbControl->GetEnvironmentalReverbUtilityL(&reverbUtility);
+ // Reverb utility must exist, otherwise room level creation will fail.
+ __ASSERT_DEBUG(reverbUtility, User::Invariant());
+
+ CEnvironmentalReverb* reverb =
+ &(reverbUtility->EnvironmentalReverb());
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Effect API takes the ownership of customCommandUtility.
+ iReverbSource = CRoomLevel::NewL(customCommandUtility, *reverb);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSReverbSourceControl::DeallocateControl()
+{
+ if (iReverbSource)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSReverbSourceControl::DeallocateControl");
+
+ // Disable the Effect API Control
+ TRAPD(err, iReverbSource->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class (it deletes CustomCommandUtility)
+ delete iReverbSource;
+ iReverbSource = NULL;
+ }
+}
+
+const TDesC& CAMMSReverbSourceControl::ClassName() const
+{
+ return KAMMSReverbSourceControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSReverbSourceControl::CAMMSReverbSourceControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSReverbSourceControl::CAMMSReverbSourceControl(
+ CMMAPlayer* aPlayer,
+ CAMMSBaseReverbControl* aReverbControl)
+ : CAMMSBaseReverbSourceControl(aPlayer), iReverbControl(aReverbControl)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsspectatordopplercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the doppler effect of the spectator.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsspectatordopplercontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorDopplerControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorDopplerControl* CAMMSSpectatorDopplerControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSSpectatorDopplerControl* self =
+ new(ELeave)CAMMSSpectatorDopplerControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSSpectatorDopplerControl::~CAMMSSpectatorDopplerControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorDopplerControl::~CAMMSSpectatorDopplerControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete(CAudioEffect*)iDopplerEffect;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorDopplerControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorDopplerControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iDopplerEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorDopplerControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Set the base class doppler effect as CListenerDoppler
+ // Effect API takes the ownership of customCommandUtility.
+ iDopplerEffect = CListenerDoppler::NewL(customCommandUtility);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorDopplerControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorDopplerControl::DeallocateControl()
+{
+ if (iDopplerEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorDopplerControl::DeallocateControl");
+
+ // Doppler for Spectator is always enabled (JSR-234 mandates it)
+ // so the disabling is needed here
+ TRAPD(err, iDopplerEffect->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class (it deletes CustomCommandUtility)
+ // The class that is derived from CDoppler is casted here to the
+ // base class CAudioEffect, since CDoppler has the destructor
+ // defined as protected, but the derived class and the base class
+ // have it defined as public.
+ delete(CAudioEffect*)iDopplerEffect;
+ iDopplerEffect = NULL;
+ }
+}
+
+const TDesC& CAMMSSpectatorDopplerControl::ClassName() const
+{
+ return KAMMSSpectatorDopplerControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorDopplerControl::CAMMSSpectatorDopplerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorDopplerControl::CAMMSSpectatorDopplerControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSDopplerControl(aPlayer)
+{
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsspectatorlocationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual location of the spectator.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsspectatorlocationcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorLocationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorLocationControl* CAMMSSpectatorLocationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSSpectatorLocationControl* self = new(ELeave)
+ CAMMSSpectatorLocationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSSpectatorLocationControl::~CAMMSSpectatorLocationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorLocationControl::~CAMMSSpectatorLocationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete(CAudioEffect*)iLocationEffect;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorLocationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorLocationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iLocationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorLocationControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Set the base class location effect as CListenerLocation
+ // Effect API takes the ownership of customCommandUtility.
+ iLocationEffect = CListenerLocation::NewL(customCommandUtility);
+
+ // Enable the Effect API Control
+ iLocationEffect->EnableL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorLocationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorLocationControl::DeallocateControl()
+{
+ if (iLocationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorLocationControl::DeallocateControl");
+
+ // Disable the Effect API Control
+ TRAPD(err, iLocationEffect->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class.
+ // The class that is derived from CLocation is casted here to the
+ // base class CAudioEffect, since CLocation has the destructor
+ // defined as protected, but the derived class and the base class
+ // have it defined as public.
+ delete(CAudioEffect*)iLocationEffect;
+ iLocationEffect = NULL;
+ }
+}
+
+const TDesC& CAMMSSpectatorLocationControl::ClassName() const
+{
+ return KAMMSSpectatorLocationControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorLocationControl::CAMMSSpectatorLocationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorLocationControl::CAMMSSpectatorLocationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSLocationControl(aPlayer)
+{
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsspectatororientationcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manipulates the virtual orientation of the spectator.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammsspectatororientationcontrol.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorOrientationControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorOrientationControl* CAMMSSpectatorOrientationControl::NewLC(
+ CMMAPlayer* aPlayer)
+{
+ CAMMSSpectatorOrientationControl* self =
+ new(ELeave)CAMMSSpectatorOrientationControl(aPlayer);
+
+ CleanupStack::PushL(self);
+
+ return self;
+}
+
+// Destructor
+CAMMSSpectatorOrientationControl::~CAMMSSpectatorOrientationControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorOrientationControl::~CAMMSSpectatorOrientationControl");
+
+ // Perform DeallocateControl, if the state change has not yet performed it.
+ DeallocateControl();
+ delete(CAudioEffect*)iOrientationEffect;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorOrientationControl::PrepareControlL
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorOrientationControl::PrepareControlL()
+{
+ // Perform the action only for the first time, skip if called afterwards
+ if (!iOrientationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorOrientationControl::PrepareControlL");
+
+ CCustomCommandUtility* customCommandUtility =
+ CreateCustomCommandUtilityL();
+
+ // Set the base class orientation effect as CListenerOrientation
+ // Effect API takes the ownership of customCommandUtility.
+ iOrientationEffect = CListenerOrientation::NewL(
+ customCommandUtility);
+
+ // Enable the Effect API Control
+ iOrientationEffect->EnableL();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorOrientationControl::DeallocateControl
+// Function which is called after the correct state is set in Player.
+// -----------------------------------------------------------------------------
+//
+void CAMMSSpectatorOrientationControl::DeallocateControl()
+{
+ if (iOrientationEffect)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSSpectatorOrientationControl::DeallocateControl");
+
+ // Disable the Effect API Control
+ TRAPD(err, iOrientationEffect->DisableL());
+ if (err != KErrNone)
+ {
+ // The only even theoritically possible error code here would be
+ // KErrAccessDenied which is a result from Effect API calling ApplyL
+ // method without having update rights, but since the Effect
+ // is already created, that situation can be discarded here.
+ }
+
+ // Delete the Effect API class.
+ // The class that is derived from COrientation is casted here to the
+ // base class CAudioEffect, since COrientation has the destructor
+ // defined as protected, but the derived class and the base class
+ // have it defined as public.
+ delete(CAudioEffect*)iOrientationEffect;
+ iOrientationEffect = NULL;
+ }
+}
+
+const TDesC& CAMMSSpectatorOrientationControl::ClassName() const
+{
+ return KAMMSSpectatorOrientationControl;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSpectatorOrientationControl::CAMMSSpectatorOrientationControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSSpectatorOrientationControl::CAMMSSpectatorOrientationControl(
+ CMMAPlayer* aPlayer)
+ : CAMMSOrientationControl(aPlayer)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsvolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Controls the volume of a CMMAVolumeControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmmavolumecontrol.h>
+#include <logger.h>
+
+#include "cammsvolumecontrol.h"
+
+#ifdef _DEBUG
+// CONSTANTS
+const TInt KAMMSMaxVolume = 100;
+const TInt KAMMSMinVolume = 0;
+#endif // _DEBUG
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControl* CAMMSVolumeControl::NewLC(const TDesC& aControlName,
+ CMMAVolumeControl* aVolumeControl, CMMAPlayer* aPlayer)
+{
+ CAMMSVolumeControl* self = new(ELeave) CAMMSVolumeControl(
+ aControlName, aVolumeControl, aPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSVolumeControl::~CAMMSVolumeControl()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSVolumeControl::~CAMMSVolumeControl");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControl::SetVolumeL
+// Sets the volume level.
+// -----------------------------------------------------------------------------
+//
+void CAMMSVolumeControl::SetVolumeL(TInt aVolume)
+{
+ // Check in debug build that aVolume is within valid range.
+ __ASSERT_DEBUG(
+ (aVolume <= KAMMSMaxVolume) &&
+ (aVolume >= KAMMSMinVolume),
+ User::Invariant());
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSVolumeControl::SetVolumeL: Volume = %d", aVolume);
+ iVolumeControl->SetVolumeLevelL(iControlLevelIndex, aVolume);
+}
+
+const TDesC& CAMMSVolumeControl::ClassName() const
+{
+ return iClassName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSVolumeControl::ConstructL()
+{
+ iControlLevelIndex = iVolumeControl->AddLevelL();
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSVolumeControl::ConstructL level index = %d",
+ iControlLevelIndex);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControl::CAMMSVolumeControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControl::CAMMSVolumeControl(
+ const TDesC& aControlName,
+ CMMAVolumeControl* aVolumeControl,
+ CMMAPlayer* aPlayer) :
+ CAMMSControl(aPlayer),
+ iClassName(aControlName)
+{
+ iVolumeControl = aVolumeControl;
+}
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/mmacontrol/src/cammsvolumecontrolbuilder.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AMMS player builder for adding AMMS audio player controls.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <cmmavolumecontrol.h>
+#include <cmmaaudioplayer.h>
+#include <logger.h>
+
+#include "cammsvolumecontrolbuilder.h"
+#include "cammsvolumecontrol.h"
+#include "ammsconstants.h"
+#include "ammsutil.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlBuilder::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControlBuilder* CAMMSVolumeControlBuilder::NewLC()
+{
+ CAMMSVolumeControlBuilder* self = new(ELeave) CAMMSVolumeControlBuilder();
+ CleanupStack::PushL(self);
+ return self;
+}
+
+
+// Destructor
+CAMMSVolumeControlBuilder::~CAMMSVolumeControlBuilder()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlBuilder::PreparePlayerL
+// -----------------------------------------------------------------------------
+//
+void CAMMSVolumeControlBuilder::PreparePlayerL(CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSVolumeControlBuilder::PreparePlayerL type %S",
+ aPlayer->Type().Ptr());
+
+ CMMAControl* control = AMMSUtil::FindControl(aPlayer,
+ KMMAVolumeControlName);
+ if (control)
+ {
+ CMMAVolumeControl* mmaControl =
+ reinterpret_cast< CMMAVolumeControl* >(control);
+
+ CAMMSVolumeControl* ammsControl = CAMMSVolumeControl::NewLC(
+ KAMMSGlobalVolume,
+ mmaControl,
+ aPlayer);
+ aPlayer->AddControlL(ammsControl);
+ CleanupStack::Pop(ammsControl);
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSVolumeControlBuilder::PreparePlayerL add OK");
+ }
+ // else volume control need not to be added, for example camera player.
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSVolumeControlBuilder::CAMMSVolumeControlBuilder
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSVolumeControlBuilder::CAMMSVolumeControlBuilder()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/ammsconstants.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file defines global constants.
+*
+*/
+
+
+#ifndef AMMSCONSTANTS_H
+#define AMMSCONSTANTS_H
+
+/**
+*
+* This file defines global constants.
+*
+*
+* @since 3.0
+*/
+
+const TInt KAMMSVectorComponents = 3; // Components in a vector
+const TInt KAMMSTwoVectorComponents = 6; // Components in two vectors
+
+// Component indexes in vectors
+enum TVectorIndex
+{
+ EComponentX = 0,
+ EComponentY = 1,
+ EComponentZ = 2,
+ EAzimuth = 0,
+ EElevation = 1,
+ ERadius = 2
+};
+
+enum TAMMSControlTypes
+{
+ EAMMSBaseControl = 0,
+ EAMMSSpectatorControl,
+ EAMMSSoundSource3DControl
+};
+
+_LIT(KAMMSGlobalVolume, "VolumeGlobal");
+
+#endif // AMMSCONSTANTS_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/ammsutil.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Static general reusable methods.
+*
+*/
+
+
+#ifndef AMMSUTIL_H
+#define AMMSUTIL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "ammsconstants.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+class CMMAControl;
+
+// CLASS DECLARATION
+
+/**
+* Static general reusable methods.
+*
+* This class contains only static method which can be used in many classes.
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(AMMSUtil)
+{
+public: // New functions
+ /**
+ * Finds the control of a corresponding type that
+ * belongs to the player given as a parameter
+ *
+ * @param aPlayer The Player where to find the Control
+ * @param aControlName Name of the control to look for
+ * @param aControlType Special AMMS type of the Control
+ * @return Control of type aControlName or NULL if not found
+ */
+ static CMMAControl* FindControl(
+ CMMAPlayer* aPlayer,
+ const TDesC& aControlName,
+ TAMMSControlTypes aControlType = EAMMSBaseControl);
+
+ /**
+ * Converts vector from spherical to cartesian.
+ *
+ * @param aSphericalVector Spherical vector to be converted
+ * @param aCartesianVector Result cartesian vector
+ */
+ static void FromSphericalToCartesianL(
+ TInt aSphericalVector[ KAMMSVectorComponents ],
+ TInt aCartesianVector[ KAMMSVectorComponents ]);
+
+ /*
+ * Rotates a vector round the given axis. The starting point of each
+ * vectors is in the origo, and thus, only coordinates of the ending
+ * point should be given.
+ *
+ * @param aVector X, Y, and Z value of a vector to be rotated
+ * @param aAxisVector X, Y, and Z value of an axis vector
+ * @param aAngle Rotation angle in degrees
+ * @param aRotatedVector X, Y, and Z value of the rotated vector
+ */
+ static void RotateVectorL(TReal aVector[ KAMMSVectorComponents ],
+ TReal aAxisVector[ KAMMSVectorComponents ],
+ TInt aAngle,
+ TReal aRotatedVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Rounds each component in the given vector.
+ *
+ * @param aVector A vector to be rounded
+ * @param aRoundedVector Rounded vector
+ */
+ static void RoundVectorL(TReal aVector[ KAMMSVectorComponents ],
+ TInt aRoundedVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Multiplies the given vector by the given scalar value.
+ *
+ * @param aVector A vector to be rounded
+ * @param aMultiplier A multiplier
+ */
+ static void MultiplyVector(TReal aVector[ KAMMSVectorComponents ],
+ TReal aMultiplier);
+
+ /**
+ * Calculates vector cross product.
+ * @param aA A vector having KAMMSVectorComponents elements
+ * @param aB A vector having KAMMSVectorComponents elements
+ * @param aResultVector Result of the cross product
+ */
+ static void CrossProduct(TReal aA[ KAMMSVectorComponents ],
+ TReal aB[ KAMMSVectorComponents ],
+ TReal aResultVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Calculates the length of the given vector.
+ *
+ * @param aVector A vector whose length is calculated
+ */
+ static TReal VectorLengthL(TReal aVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Converts the given vector to the unit vector. The original vector
+ * is replaced by the result vector.
+ *
+ * @param aVector A vector that is converted to the unit vector and is
+ * replaced by the result vector
+ */
+ static void ConvertToUnitVectorL(TReal aVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Checks whether two given vectors are similar according to the given
+ * maximum error percentage. The function compares each component in
+ * aA to the corresponding component in aB.
+ *
+ * @param aA A vector
+ * @param aB A vector
+ * @param aMaxComponentErrorPercentage Maximum error percentage between
+ * a component in aA and the corresponding component in aB
+ * @return ETrue if difference between each component pair is lower
+ * than the given error, else ETrue is returned
+ */
+ static TBool AreVectorsSimilar(TReal aA[ KAMMSVectorComponents ],
+ TInt aB[ KAMMSVectorComponents ],
+ TInt aMaxComponentErrorPercentage);
+
+ /**
+ * Returns the maximum component value in the given vector.
+ *
+ * @param aVector A vector
+ * @return Maximum component value in aVector
+ */
+ static TReal MaxVectorComponent(TReal aVector[ KAMMSVectorComponents ]);
+
+ /**
+ * Returns the minimum component value in the given vector.
+ *
+ * @param aVector A vector
+ * @return Minimum component value in aVector
+ */
+ static TReal MinVectorComponent(TReal aVector[ KAMMSVectorComponents ]);
+
+private:
+ /**
+ * C++ default constructor. Private to not allow construction.
+ */
+ AMMSUtil();
+};
+
+#endif // AMMSUTIL_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammscontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for control groups
+*
+*/
+
+
+#ifndef CAMMSCONTROLGROUP_H
+#define CAMMSCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mammscontrolgroup.h"
+#include "ammsconstants.h"
+
+// FORWARD DECLARATIONS
+class MAMMSControllable;
+class CMMAControl;
+class CMMAPlayer;
+class CAMMSPlayerStateListener;
+
+// CLASS DECLARATION
+/**
+ * Base class for control groups
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSControlGroup): public CBase, public MAMMSControlGroup
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSControlGroup();
+
+public: // New functions
+
+ /**
+ * This function is called when state of a player has changed.
+ *
+ * @param aPlayer Player whose state has changed.
+ * @param aNewState State that the player has now.
+ */
+ void PlayerStateChangedL(CMMAPlayer* aPlayer,
+ TInt aNewState);
+
+protected: // New functions
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Returns the total count of controls in this group.
+ *
+ * @return Count of the controls.
+ */
+ TInt ControlCount() const;
+
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ *
+ * @return the control at given index
+ */
+ CMMAControl* Control(TInt aIndex) const;
+
+ /**
+ * Called by PlayerAddedL when new player is added
+ *
+ * @param aPlayer The player being added
+ * @param aControl The player's control relevant to this group
+ */
+ virtual void NotifyPlayerAddedL(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+ /**
+ * Called by PlayerRemoved when new player is removed
+ *
+ * @param aPlayer The player being removed
+ * @param aControl The player's control relevant to this group
+ */
+ virtual void NotifyPlayerRemoved(CMMAPlayer* aPlayer, CMMAControl* aControl);
+
+public: // From MAMMSControlGroup
+
+ /**
+ * Called by the owning module when a player is added
+ *
+ * @param aPlayer The player being added
+ */
+ void PlayerAddedL(CMMAPlayer *aPlayer);
+
+ /**
+ * Called by the owning module when a player is removed
+ *
+ * @param aPlayer The player being removed
+ */
+ void PlayerRemoved(CMMAPlayer *aPlayer);
+
+protected:
+ /**
+ * C++ default constructor.
+ *
+ * @param aName The name of the corresponding amms control
+ * (doesn't take a copy!)
+ * @param aControlType Special AMMS type of the Control
+ */
+ CAMMSControlGroup(
+ const TDesC& aName,
+ TAMMSControlTypes aControlType = EAMMSBaseControl);
+
+protected: // Data
+
+ // Listeners for player state changes, owned.
+ CArrayPtrSeg< CAMMSPlayerStateListener >* iPlayerStateListeners;
+
+ // Grouped controls, not owned
+ RArray< CMMAControl* > iControls;
+
+ // The name of contained controls, not owned
+ const TDesC& iName;
+
+ // The type of the actual Control
+ TAMMSControlTypes iControlType;
+
+ // Controllable object. Not owned. (Global manager)
+ MAMMSControllable* iAMMSControllable;
+
+};
+
+#endif // CAMMSCONTROLGROUP_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammseffectmodule.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Module for holding control groups belonging to EffectModule.
+*
+*/
+
+
+#ifndef CAMMSEFFECTMODULE_H
+#define CAMMSEFFECTMODULE_H
+
+// INCLUDES
+#include "cammsmodule.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+class CAMMSGlobalManager;
+
+
+// CLASS DECLARATION
+
+/**
+* Module for holding control groups belonging to EffectModule.
+*
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSEffectModule): public CAMMSModule
+{
+public:
+ /**
+ * Two-phased constructor.
+ *
+ * @param aGlobalManager Global manager.
+ */
+ static CAMMSEffectModule* NewLC(CAMMSGlobalManager* aGlobalManager);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSEffectModule();
+
+public: // From CAMMSModule
+
+ void AddPlayerNoStateCheckL(CMMAPlayer* aPlayer);
+
+protected:
+ /**
+ * C++ default constructor.
+ *
+ * @param aGlobalManager Global manager.
+ */
+ CAMMSEffectModule(CAMMSGlobalManager* aGlobalManager);
+
+ void ConstructL();
+
+private: // Data
+
+ CAMMSGlobalManager* iGlobalManager; // Not owned.
+};
+
+#endif // CAMMSEFFECTMODULE_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammsglobalmanager.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class provides GlobalManager functionality.
+*
+*/
+
+
+#ifndef CAMMSGLOBALMANAGER_H
+#define CAMMSGLOBALMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <mmmaplayerinstanceobserver.h>
+
+#include "cammsmodule.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CAMMSModuleContainer;
+class CAMMSPlayerBuilderGroup;
+
+// CLASS DECLARATION
+
+/**
+*
+* This class provides GlobalManager functionality.
+* The GlobalManager handles the creation of EffectModules, SoundSource3Ds
+* and MediaProcessors. Furthermore, a Spectator can be get from the
+* GlobalManager. GlobalManager extends the CAMMSModule and contains global
+* controls.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSGlobalManager): public CAMMSModule, public MMMAPlayerInstanceObserver
+{
+public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSGlobalManager* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSGlobalManager();
+
+public: // From MMMAPlayerInstanceObserver
+ /**
+ * MMA will call this method when new player is created.
+ * @since 3.0
+ * @param aPlayer Player to add.
+ */
+ void AddPlayerNotifyL(CMMAPlayer* aPlayer);
+
+ /**
+ * MMA will call this method when player does not exist anymore.
+ * @since 3.0
+ * @param aPlayer Player to remove.
+ */
+ void RemovePlayerNotify(CMMAPlayer* aPlayer);
+
+public: // New functions
+ /**
+ * Initializes GlobalManager. This method is called when Java
+ * GlobalManager is accessed for the first time.
+ * This method creates mma controls to the added players and creates
+ * global controls. After this method is called amms controls are added
+ * to players immediately.
+ * @param aPlayers Players created with mma api.
+ * @since 3.0
+ */
+ void InitL(RPointerArray< CMMAPlayer >& aPlayers);
+
+ /**
+ * Creates a new sound source 3D module.
+ * Module will be owned by global manager.
+ * @since 3.0
+ * @return New sound source 3D module.
+ */
+ CAMMSModule* CreateSoundSource3DL();
+
+ /**
+ * Creates a new effect module.
+ * Module will be owned by global manager.
+ * @since 3.0
+ * @return New effect module.
+ */
+ CAMMSModule* CreateEffectModuleL();
+
+ /**
+ * Returns the spectator.
+ * @since 3.0
+ * @return Spectator.
+ */
+ CAMMSModule* Spectator();
+
+ /**
+ * Disposes module.
+ * @param aModule Module to dispose.
+ */
+ void DisposeModule(CAMMSModule* aModule);
+
+ /**
+ * Checks whether the given player can be added to a module (EffectModule
+ * or SoundSource3D).
+ * @param aPlayer Player to be checked.
+ * @return KErrNone if the player can be added or some error
+ * code if the adding is not allowed.
+ */
+ TInt PlayerAddingAllowed(CMMAPlayer* aPlayer);
+
+private:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSGlobalManager();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: // New functions
+
+ /**
+ * Checks whether the given player can be added to a module
+ * according to the given module (is there any player in
+ * the module that can prevent player adding to any module).
+ * @param aPlayer Player to be checked.
+ * @param aModule Module to be checked.
+ * @return KErrNone if the player can be added or some error
+ * code if the adding is not allowed.
+ */
+ TInt PlayerAddingAllowed(CMMAPlayer* aPlayer, CAMMSModule* aModule);
+
+
+private: // Data
+ // Owned spectator
+ CAMMSModule* iSpectator;
+
+ // Owned effect modules
+ CAMMSModuleContainer* iEffectModules;
+
+ // Owned sound source 3Ds
+ CAMMSModuleContainer* iSoundSource3Ds;
+
+ // Owned player builder
+ CAMMSPlayerBuilderGroup* iPlayerBuilder;
+};
+
+#endif // CAMMSGLOBALMANAGER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammsmodule.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a container for MAMMSControlGroup objects.
+*
+*/
+
+
+#ifndef CAMMSMODULE_H
+#define CAMMSMODULE_H
+
+// INCLUDES
+#include <e32base.h>
+
+#include <cmmaplayer.h>
+
+#include "mammscontrollable.h"
+
+// CONSTANTS
+const TInt KAMMSPlayerAlreadyInModuleError = -123;
+
+#ifdef __WINS__
+const TInt KAMMSMixingNotSupported = -1234;
+#endif // __WINS__
+
+
+// FORWARD DECLARATIONS
+class CAMMSControlGroup;
+
+// CLASS DECLARATION
+
+/**
+*
+* This class is a container for MAMMSControlGroup objects.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSModule): public CBase, public MAMMSControllable
+{
+public:
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSModule* NewL();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSModule* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSModule();
+
+public: // New functions
+ /**
+ * Adds new control group to module. Ownership is transferred to
+ * the module and aGroup is removed from the cleanupstack
+ * if this method does not leave.
+ * @since 3.0
+ * @param aGroup New control group. Must be the previous item in the
+ * cleanupstack.
+ */
+ void AddControlGroupAndPopL(CAMMSControlGroup* aGroup);
+
+ /**
+ * Adds new player to this module.
+ * @param aPlayer New player to add
+ */
+ virtual void AddPlayerL(CMMAPlayer* aPlayer);
+
+ /**
+ * Removes player from module.
+ * @param aPlayer player to remove
+ * @return KErrNotFound if player was not in the module.
+ */
+ virtual TInt RemovePlayer(CMMAPlayer* aPlayer);
+
+ /**
+ * Adds new player to this module without checking player states.
+ * @param aPlayer New player to add
+ */
+ virtual void AddPlayerNoStateCheckL(CMMAPlayer* aPlayer);
+
+ /**
+ * Removes player from module without checking player states.
+ * @param aPlayer player to remove
+ * @return KErrNotFound if player was not in the module.
+ */
+ virtual TInt RemovePlayerNoStateCheck(CMMAPlayer* aPlayer);
+
+ /**
+ * Checks whether the given player is in this module.
+ * @param aPlayer Player to be checked.
+ * @return ETrue if the specified player exists in this
+ * module; EFalse otherwise.
+ */
+ TBool HasPlayer(CMMAPlayer* aPlayer);
+
+#ifdef __WINS__
+
+ /**
+ * Returns the count of players whose state is between the given
+ * limits.
+ * @param aMinState Minimum player state to be searched.
+ * @param aMaxState Maximum player state to be searched.
+ * @return The count of players having state between the given
+ * limits.
+ */
+ TInt PlayerCount(TInt aMinState, TInt aMaxState);
+
+#endif // __WINS__
+
+
+private: // Private new functions
+ /**
+ * Checks that none of the players in this module is not in PREFETCHED
+ * or STARTED state.
+ * @return KErrNotReady if some player is in PREFETCHED or STARTED
+ * state, otherwise KErrNone.
+ */
+ TInt CheckAllPlayersState();
+
+ /**
+ * Checks that player state is not in PREFETCHED or STARTED state.
+ * @param aPlayer player to check
+ * @return KErrNotReady if player is in PREFETCHED or STARTED state,
+ * otherwise KErrNone.
+ */
+ TInt CheckPlayerState(CMMAPlayer* aPlayer);
+
+ /**
+ * Static function to be used with TCleanupItem in
+ * AddPlayerNoStateCheckL method. This method removes last added
+ * player from module and control groups.
+ * @param aModule Module to clean.
+ */
+ static void CleanupAddPlayer(TAny* aModule);
+
+public: // Functions from base classes
+ MAMMSControlGroup* Find(const TDesC& aClassName);
+ MAMMSControlGroup* At(TInt aIndex);
+ TInt Count();
+
+protected:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSModule();
+
+protected:
+ /**
+ * Protected because derived classes must call ConstructL.
+ */
+ void ConstructL();
+
+private: // Data
+ // Owned array containing control groups, which are owned.
+ // Elements are added using AddControlGroupL method and deleted
+ // in the destructor.
+ CArrayPtrSeg< CAMMSControlGroup >* iControlGroups;
+
+ // Array containing players.
+ // Elements are added using AddPlayerL method and removes
+ // with RemovePlayer
+ RPointerArray< CMMAPlayer > iPlayers;
+};
+
+#endif // CAMMSMODULE_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammsmodulecontainer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Container for CAMMSModule objects.
+*
+*/
+
+
+#ifndef CAMMSMODULECONTAINER_H
+#define CAMMSMODULECONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cammsmodule.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+// CLASS DECLARATION
+
+/**
+*
+* This class is a container for CAMMSModule objects. All modules added to
+* this class with CArrayPtrSeg::AppendL method are owned and deleted in the
+* destructor.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSModuleContainer): public CArrayPtrSeg< CAMMSModule >
+{
+public:
+ /**
+ * C++ default constructor.
+ */
+ CAMMSModuleContainer();
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSModuleContainer();
+
+public: // New functions
+ /**
+ * Removes player from all modules. Player states are not checked.
+ * @param aPlayer player to remove
+ */
+ void RemovePlayer(CMMAPlayer* aPlayer);
+
+ /**
+ * Removes module from container. The module itself is not deleted
+ * by this method, so it has to be deleted elsewhere.
+ * Method returns silently if module is not found.
+ * @param aModule Module to remove.
+ */
+ void RemoveModule(CAMMSModule* aModule);
+
+};
+
+#endif // CAMMSMODULECONTAINER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammsplayerstatelistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation for player state listener.
+*
+*/
+
+
+#ifndef CAMMSPLAYERSTATELISTENER_H
+#define CAMMSPLAYERSTATELISTENER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmmaplayerstatelistener.h>
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+class CAMMSControlGroup;
+
+// CLASS DECLARATION
+/**
+ * Implementation for player state listener.
+ *
+ * @since 3.0
+ */
+NONSHARABLE_CLASS(CAMMSPlayerStateListener)
+ : public CBase,
+ public MMMAPlayerStateListener
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param iPlayer Player to be listened by this listener.
+ * @param iControlGroup Control group to be informed when
+ * player state changes.
+ */
+ static CAMMSPlayerStateListener* NewLC(
+ CMMAPlayer* aPlayer,
+ CAMMSControlGroup* aControlGroup);
+ /**
+ * Destructor.
+ */
+ ~CAMMSPlayerStateListener();
+
+private: // Constructors and destructor
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * C++ constructor.
+ * @param iPlayer Player to be listened by this listener.
+ * @param iControlGroup Control group to be informed when
+ * player state changes.
+ */
+ CAMMSPlayerStateListener(CMMAPlayer* aPlayer,
+ CAMMSControlGroup* aControlGroup);
+
+
+public: // New methods
+
+ /**
+ * Returns the player listened by this listener.
+ *
+ * @return Player.
+ */
+ CMMAPlayer* Player();
+
+ /**
+ * Returns the array index of the listener that listens
+ * to the given player.
+ */
+ /* static TInt FindPlayerInArray(
+ CArrayFix< CAMMSPlayerStateListener >* aArray, CMMAPlayer* aPlayer );
+ */
+
+public: // From MMMAPlayerStateListener
+
+ void StateChanged(TInt aState);
+
+private: // Data
+
+ // Player to be listened, not owned.
+ CMMAPlayer* iPlayer;
+
+ // Control group to be informed when player state changes, not owned.
+ CAMMSControlGroup* iControlGroup;
+
+};
+
+#endif // CAMMSPLAYERSTATELISTENER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/cammssoundsource3d.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Module for holding control groups belonging to SoundSource3D.
+*
+*/
+
+
+#ifndef CAMMSSOUNDSOURCE3D_H
+#define CAMMSSOUNDSOURCE3D_H
+
+// INCLUDES
+#include "cammsmodule.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+class CAMMSGlobalManager;
+
+
+// CLASS DECLARATION
+
+/**
+* Module for holding control groups belonging to SoundSource3D.
+*
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(CAMMSSoundSource3D): public CAMMSModule
+{
+public:
+ /**
+ * Two-phased constructor.
+ *
+ * @param aSpectator Spectator.
+ * @param aGlobalManager Global manager.
+ */
+ static CAMMSSoundSource3D* NewLC(CAMMSModule* aSpectator,
+ CAMMSGlobalManager* aGlobalManager);
+
+ /**
+ * Destructor.
+ */
+ ~CAMMSSoundSource3D();
+
+public: // New functions
+
+ /**
+ * From CAMMSModule.
+ */
+ void AddPlayerNoStateCheckL(CMMAPlayer* aPlayer);
+
+ /**
+ * From CAMMSModule.
+ */
+ TInt RemovePlayerNoStateCheck(CMMAPlayer* aPlayer);
+
+protected:
+ /**
+ * C++ default constructor.
+ *
+ * @param aSpectator Spectator.
+ * @param aGlobalManager Global manager.
+ */
+ CAMMSSoundSource3D(CAMMSModule* aSpectator,
+ CAMMSGlobalManager* aGlobalManager);
+
+protected:
+ /**
+ * Protected because derived classes must call ConstructL.
+ */
+ void ConstructL();
+
+private: // Data
+
+ CAMMSModule* iSpectator; // Not owned.
+ CAMMSGlobalManager* iGlobalManager; // Not owned.
+};
+
+#endif // CAMMSSOUNDSOURCE3D_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/mammscontrolgroup.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for all control groups.
+*
+*/
+
+
+#ifndef MAMMSCONTROLGROUP_H
+#define MAMMSCONTROLGROUP_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+*
+* Interface for all control groups.
+*
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(MAMMSControlGroup)
+{
+protected: // Enumerations
+
+ enum TCommitMode { EImmediate, EDeferred };
+
+public: // New functions
+ /**
+ * Returns class name that identifies this control group.
+ * @return Control group name.
+ */
+ virtual const TDesC& ClassName() = 0;
+
+ /**
+ * Sets the mode of the CommitControl.
+ *
+ * @param aMode commit mode
+ */
+ virtual void SetModeL(TCommitMode /*aMode*/) {};
+
+ /**
+ * Commit all the controls in the group
+ * in immediate mode commits, in deferred mode marks what variables
+ * need to be commited later
+ */
+ virtual void CommitGroupL() {};
+
+protected:
+ /**
+ * Protected destructor not allow delete throw this interface.
+ */
+ virtual ~MAMMSControlGroup() {};
+};
+#endif // MAMMSCONTROLGROUP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/inc/mammscontrollable.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface to access control groups.
+*
+*/
+
+
+#ifndef MAMMSCONTROLLABLE_H
+#define MAMMSCONTROLLABLE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MAMMSControlGroup;
+
+// CLASS DECLARATION
+/**
+*
+* Interface to access control groups.
+*
+* @since 3.0
+*/
+NONSHARABLE_CLASS(MAMMSControllable)
+{
+public:
+ /**
+ * Finds and returns control group specified with a name.
+ * @since 3.0
+ * @param aClassName Name of the control group.
+ * @return Control group or NULL if group can't be found.
+ */
+ virtual MAMMSControlGroup* Find(const TDesC& aClassName) = 0;
+
+ /**
+ * Returns control group at the specified index.
+ * @since 3.0
+ * @param aIndex Group index.
+ * @return A control group at specified index.
+ */
+ virtual MAMMSControlGroup* At(TInt aIndex) = 0;
+
+ /**
+ * Return number of control groups.
+ * @since 3.0
+ * @return Number of control groups.
+ */
+ virtual TInt Count() = 0;
+protected:
+
+ /**
+ * Protected destructor not to allow delete through this interface.
+ */
+ virtual ~MAMMSControllable() {};
+};
+
+#endif // MAMMSCONTROLLABLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/ammsutil.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Static general reusable methods.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "ammsutil.h"
+#include <cmmaplayer.h>
+#include <cmmacontrol.h>
+#include "cammscontrol.h"
+
+// CONSTANTS
+namespace
+{
+const TInt KAMMSStraightAngle = 180;
+
+// Set a value to 0 if its absolute value is less than this.
+const TReal KAMMSDiscreteErrorConstant = 0.00000001;
+}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::FindControl
+// Finds the control of a corresponding name.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CMMAControl* AMMSUtil::FindControl(CMMAPlayer* aPlayer,
+ const TDesC& aControlName,
+ TAMMSControlTypes aControlType)
+{
+ TInt controlCount = aPlayer->ControlCount();
+ TInt index = 0;
+
+ // if control is not found NULL will be returned
+ CMMAControl* control = NULL;
+
+ // go through all controls
+ while (index < controlCount)
+ {
+ CMMAControl* tmp = aPlayer->Control(index);
+
+ // if the name of the Control matches the name used in finding
+ if (tmp->ClassName() == aControlName)
+ {
+
+ // a base Control can be accepted always, it can not be derived
+ if (aControlType == EAMMSBaseControl)
+ {
+ // found correct control
+ control = tmp;
+
+ // set index to stop while loop
+ index = controlCount;
+ }
+
+ // in case the Control is not a base Control, check AMMS subtype
+ else
+ {
+ if (aControlType == ((CAMMSControl*)tmp)->iControlType)
+ {
+ // found correct (derived) control
+ control = tmp;
+
+ // set index to stop while loop
+ index = controlCount;
+ }
+ else
+ {
+ // move to next control
+ index++;
+ }
+ }
+ }
+
+ // Control name was not the one used in finding
+ else
+ {
+ // move to next control
+ index++;
+ }
+ }
+ return control;
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::FromSphericalToCartesianL
+// Converts vector from spherical to cartesian.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::FromSphericalToCartesianL(
+ TInt aSphericalVector[ KAMMSVectorComponents ],
+ TInt aCartesianVector[ KAMMSVectorComponents ])
+{
+ // convert to radians
+ TReal elevation = aSphericalVector[ EElevation ] *
+ (KPi / KAMMSStraightAngle);
+ TReal azimuth = aSphericalVector[ EAzimuth ] *
+ (KPi / KAMMSStraightAngle);
+ TReal radius = aSphericalVector[ ERadius ];
+
+ TReal elevationSin;
+ TReal elevationCos;
+ User::LeaveIfError(Math::Sin(elevationSin, elevation));
+ User::LeaveIfError(Math::Cos(elevationCos, elevation));
+
+ TReal cartesian[ KAMMSVectorComponents ];
+
+ cartesian[ EComponentY ] = elevationSin * radius;
+ TReal distXZ = elevationCos * radius; // distance in x-z plane
+
+ TReal azimuthSin;
+ TReal azimuthCos;
+ User::LeaveIfError(Math::Sin(azimuthSin, azimuth));
+ User::LeaveIfError(Math::Cos(azimuthCos, azimuth));
+
+ // azimuth of 0 degrees points to negative z axis
+ cartesian[ EComponentZ ] = -azimuthCos * distXZ;
+ cartesian[ EComponentX ] = azimuthSin * distXZ;
+
+ // round real values and convert them to integers
+ RoundVectorL(cartesian, aCartesianVector);
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::RotateVectorL
+// Rotates a vector round the given axis.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::RotateVectorL(
+ TReal aVector[ KAMMSVectorComponents ],
+ TReal aAxisVector[ KAMMSVectorComponents ],
+ TInt aAngle,
+ TReal aRotatedVector[ KAMMSVectorComponents ])
+{
+ // calculate the length of the axis vector
+ TReal lengthSquare = aAxisVector[ EComponentX ] *
+ aAxisVector[ EComponentX ] + aAxisVector[ EComponentY ] *
+ aAxisVector[ EComponentY ] + aAxisVector[ EComponentZ ] *
+ aAxisVector[ EComponentZ ];
+
+ TReal length;
+ User::LeaveIfError(Math::Sqrt(length, lengthSquare));
+
+ // check that the vector is long enough
+ __ASSERT_DEBUG(length > 0, User::Invariant());
+
+ // normalize the axis vector
+ TReal x = aAxisVector[ EComponentX ] / length;
+ TReal y = aAxisVector[ EComponentY ] / length;
+ TReal z = aAxisVector[ EComponentZ ] / length;
+
+ // calculate sine and cosine values
+ TReal angleRad = aAngle / 180.0 * KPi;
+ TReal c;
+ User::LeaveIfError(Math::Cos(c, angleRad));
+ TReal s;
+ User::LeaveIfError(Math::Sin(s, angleRad));
+
+ // calculate some help variables
+ TReal t = 1 - c;
+ TReal txy = t * x * y;
+ TReal txz = t * x * z;
+ TReal tyz = t * y * z;
+ TReal sz = s * z;
+ TReal sy = s * y;
+ TReal sx = s * x;
+ TReal x2 = aVector[ EComponentX ];
+ TReal y2 = aVector[ EComponentY ];
+ TReal z2 = aVector[ EComponentZ ];
+
+ // calculate new x value
+ aRotatedVector[ EComponentX ] = (t * x * x + c) * x2 +
+ (txy - sz) * y2 + (txz + sy) * z2;
+
+ // calculate new y value
+ aRotatedVector[ EComponentY ] = (txy + sz) * x2 +
+ (t * y * y + c) * y2 + (tyz - sx) * z2;
+
+ // calculate new z value
+ aRotatedVector[ EComponentZ ] = (txz - sy) * x2 +
+ (tyz + sx) * y2 + (t * z * z + c) * z2;
+
+ // Remove error of discrete values.
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ if (Abs(aRotatedVector[ i ]) < KAMMSDiscreteErrorConstant) // CSI: 2 Wrong index means implementation error #
+ {
+ aRotatedVector[ i ] = 0; // CSI: 2 Wrong index means implementation error #
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::RoundVectorL
+// Rounds vector components.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::RoundVectorL(
+ TReal aVector[ KAMMSVectorComponents ],
+ TInt aRoundedVector[ KAMMSVectorComponents ])
+{
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ TReal roundedValue;
+ User::LeaveIfError(Math::Round(roundedValue,
+ (TReal)aVector[ i ], 0)); // CSI: 2 Wrong index means implementation error #
+
+ aRoundedVector[ i ] = (TInt)roundedValue; // CSI: 2 Wrong index means implementation error #
+ }
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::MultiplyVector
+// Multiplies a vector by a scalar.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::MultiplyVector(
+ TReal aVector[ KAMMSVectorComponents ],
+ TReal aMultiplier)
+{
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ aVector[ i ] *= aMultiplier; // CSI: 2 Wrong index means implementation error #
+ }
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::CrossProduct
+// Calculates vector cross product.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::CrossProduct(
+ TReal aA[ KAMMSVectorComponents ],
+ TReal aB[ KAMMSVectorComponents ],
+ TReal aResultVector[ KAMMSVectorComponents ])
+{
+ // This function can handle only vectors with 3 components
+
+ // Calculate the cross product.
+ aResultVector[ EComponentX ] = -aA[ EComponentZ ] * aB[ EComponentY ] +
+ aA[ EComponentY ] * aB[ EComponentZ ];
+
+ aResultVector[ EComponentY ] = aA[ EComponentZ ] * aB[ EComponentX ] -
+ aA[ EComponentX ] * aB[ EComponentZ ];
+
+ aResultVector[ EComponentZ ] = -aA[ EComponentY ] * aB[ EComponentX ] +
+ aA[ EComponentX ] * aB[ EComponentY ];
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::VectorLengthL
+// Calculates the length of the given vector.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TReal AMMSUtil::VectorLengthL(
+ TReal aVector[ KAMMSVectorComponents ])
+{
+ TReal squareLength = 0;
+
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ squareLength += aVector[ i ] * aVector[ i ];
+ }
+
+ TReal length;
+ User::LeaveIfError(Math::Sqrt(length, squareLength));
+
+ return length;
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::ConvertToUnitVectorL
+// Converts the given vector to unit vector.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void AMMSUtil::ConvertToUnitVectorL(
+ TReal aVector[ KAMMSVectorComponents ])
+{
+ TReal length = VectorLengthL(aVector);
+
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ aVector[ i ] /= length; // CSI: 2 Wrong index means implementation error #
+ }
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::AreVectorsSimilar
+// Checks whether two vectors are similar enough.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TBool AMMSUtil::AreVectorsSimilar(
+ TReal aA[ KAMMSVectorComponents ],
+ TInt aB[ KAMMSVectorComponents ],
+ TInt aMaxComponentErrorPercentage)
+{
+ TReal maxRelativeError = aMaxComponentErrorPercentage / 100.0; // CSI: 47 Value 100 means 100% #
+
+ for (TInt i = 0; i < KAMMSVectorComponents; i++)
+ {
+ TReal maxError =
+ Max(Abs(aA[ i ]), Abs(aB[ i ])) * maxRelativeError; // CSI: 2 Wrong index means implementation error #
+
+ if (Abs(aA[ i ] - aB[ i ]) > maxError) // CSI: 2 Wrong index means implementation error #
+ {
+ return EFalse;
+ }
+ }
+
+ // Vectors were similar enough.
+ return ETrue;
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::MaxVectorComponent
+// Returns the maximum component in the given vector.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TReal AMMSUtil::MaxVectorComponent(
+ TReal aVector[ KAMMSVectorComponents ])
+{
+ TReal maxValue = aVector[ 0 ];
+
+ for (TInt i = 1; i < KAMMSVectorComponents; i++)
+ {
+ maxValue = Max(maxValue, aVector[ i ]); // CSI: 2 Wrong index means implementation error #
+ }
+
+ return maxValue;
+}
+
+// -----------------------------------------------------------------------------
+// AMMSUtil::MinVectorComponent
+// Returns the minimum component in the given vector.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TReal AMMSUtil::MinVectorComponent(
+ TReal aVector[ KAMMSVectorComponents ])
+{
+ TReal minValue = aVector[ 0 ];
+
+ for (TInt i = 1; i < KAMMSVectorComponents; i++)
+ {
+ minValue = Min(minValue, aVector[ i ]); // CSI: 2 Wrong index means implementation error #
+ }
+
+ return minValue;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammscontrolgroup.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for control groups
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cammscontrolgroup.h"
+#include <cmmaplayer.h>
+#include "cammscontrol.h"
+#include "ammsutil.h"
+#include "cammsplayerstatelistener.h"
+
+#ifdef _DEBUG
+_LIT(KAMMSNoGroupNameError, "No group name");
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::~CAMMSControlGroup
+// Destructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSControlGroup::~CAMMSControlGroup()
+{
+ if (iPlayerStateListeners)
+ {
+ iPlayerStateListeners->ResetAndDestroy();
+ delete iPlayerStateListeners;
+ }
+
+ iControls.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::PlayerStateChangedL
+// This function is called when state of a player has changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::PlayerStateChangedL(
+ CMMAPlayer* aPlayer,
+ TInt aNewState)
+{
+ CMMAControl* findControl = AMMSUtil::FindControl(
+ aPlayer, iName, iControlType);
+
+ // It is safe to cast CMMAControl to the subclass CAMMSControl, as only
+ // AMMS Controls are returned from FindControl method
+ CAMMSControl* control = static_cast< CAMMSControl* >(findControl);
+
+ // The player has a control belonging to this group if this function
+ // is called.
+ __ASSERT_DEBUG(control, User::Invariant());
+
+ TInt controlIndex = iControls.Find(control);
+
+ // Add the control of the player to the group if the player is prefetched
+ // or started.
+ if (controlIndex == KErrNotFound)
+ {
+ if ((aNewState == CMMAPlayer::EPrefetched) ||
+ (aNewState == CMMAPlayer::EStarted))
+ {
+ // Now it is safe to call PrepareControlL to initialize the Control
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSControlGroup::PlayerStateChangedL calling PrepareControl for type: %d",
+ control->iControlType);
+ control->PrepareControlL();
+
+ // Add control to controls array
+ User::LeaveIfError(iControls.Append(control));
+
+ // Notify derived classes about new player control
+ NotifyPlayerAddedL(aPlayer, control);
+ }
+ }
+
+ // Remove the control of the player from the group if the player is
+ // deallocated or closed.
+ else
+ {
+ if ((aNewState == CMMAPlayer::ERealized) ||
+ (aNewState == CMMAPlayer::EClosed))
+ {
+ // Call DeallocateControl to delete the Control's Effect API class
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSControlGroup::PlayerStateChangedL calling DeallocateControl for type: %d",
+ control->iControlType);
+ control->DeallocateControl();
+
+ NotifyPlayerRemoved(aPlayer, control);
+ iControls.Remove(controlIndex);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::ConstructL
+// 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::ConstructL()
+{
+ iPlayerStateListeners =
+ new(ELeave) CArrayPtrSeg< CAMMSPlayerStateListener >(1);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::ControlCount
+// Returns the total count of controls in this group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSControlGroup::ControlCount() const
+{
+ return iControls.Count();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::Control
+// Gets control. Ownership is not tranferred.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CMMAControl* CAMMSControlGroup::Control(TInt aIndex) const
+{
+ // aIndex must not be negative and must not be greater than the number
+ // of objects currently in the array,
+ // otherwise the operator raises a USER-130 panic.
+ return iControls[ aIndex ];
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::NotifyPlayerRemoved
+// Called by PlayerAddedL when new player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::NotifyPlayerAddedL(
+ CMMAPlayer* /*aPlayer*/,
+ CMMAControl* /*aControl*/)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::NotifyPlayerRemoved
+// Called by PlayerRemoved when a player is removed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::NotifyPlayerRemoved(
+ CMMAPlayer* /*aPlayer*/,
+ CMMAControl* /*aControl*/)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::PlayerAddedL
+// Called by the owning module when a player is added
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::PlayerAddedL(CMMAPlayer *aPlayer)
+{
+ // All derived classes must define name for the group
+ __ASSERT_DEBUG(iName != KNullDesC,
+ User::Panic(KAMMSNoGroupNameError,
+ KErrUnknown));
+
+ // Do nothing if the player does not have a control belonging to this group.
+ CMMAControl* findControl = AMMSUtil::FindControl(
+ aPlayer, iName, iControlType);
+ if (!findControl)
+ {
+ return;
+ }
+
+ // It is safe to cast CMMAControl to the subclass CAMMSControl, as only
+ // AMMS Controls are returned from FindControl method
+ CAMMSControl* control = static_cast< CAMMSControl* >(findControl);
+
+ CAMMSPlayerStateListener* playerListener =
+ CAMMSPlayerStateListener::NewLC(aPlayer, this);
+
+ iPlayerStateListeners->AppendL(playerListener);
+
+ CleanupStack::Pop(playerListener);
+
+ // Add the control of the player directly to the group
+ // if the player is in STARTED or PREFETCHED state.
+ // If not, the control is added later when the player changes
+ // its state to PREFETCHED.
+ TInt playerState = aPlayer->State();
+
+ if ((playerState == CMMAPlayer::EPrefetched) ||
+ (playerState == CMMAPlayer::EStarted))
+ {
+ // Now it is safe to call PrepareControlL to initialize the Control
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSControlGroup::PlayerAddedL calling PrepareControl for type: %d",
+ control->iControlType);
+ control->PrepareControlL();
+
+ // Add control to controls array
+ User::LeaveIfError(iControls.Append(control));
+
+ // Notify derived classes about new player control
+ NotifyPlayerAddedL(aPlayer, control);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::PlayerRemoved
+// Called by the owning module when a player is removed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSControlGroup::PlayerRemoved(CMMAPlayer *aPlayer)
+{
+ CMMAControl* control = AMMSUtil::FindControl(
+ aPlayer, iName, iControlType);
+
+ // Do nothing if the player does not have a control belonging to this group.
+ if (!control)
+ {
+ return;
+ }
+
+ // Remove the control of the player if the control is in the group.
+ TInt controlIndex = iControls.Find(control);
+ if (controlIndex != KErrNotFound)
+ {
+ // It is safe to cast CMMAControl to the subclass CAMMSControl, as only
+ // AMMS Controls are returned from FindControl method
+ CAMMSControl* ammsControl = static_cast< CAMMSControl* >(control);
+
+ // Call DeallocateControl to delete the Control's Effect API class
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSControlGroup::PlayerRemoved calling DeallocateControl for type: %d",
+ ammsControl->iControlType);
+ ammsControl->DeallocateControl();
+
+ NotifyPlayerRemoved(aPlayer, ammsControl);
+ iControls.Remove(controlIndex);
+ }
+
+ // Remove the state listener belonging to the given player.
+
+ TInt listenerCount = iPlayerStateListeners->Count();
+ TInt listenerIndex = KErrNotFound;
+
+ for (TInt i = 0; i < listenerCount; i++)
+ {
+ // Elements in the listener array are never null.
+ if (iPlayerStateListeners->At(i)->Player() == aPlayer)
+ {
+ listenerIndex = i;
+ break;
+ }
+ }
+
+ if (listenerIndex != KErrNotFound)
+ {
+ delete iPlayerStateListeners->At(listenerIndex);
+ iPlayerStateListeners->Delete(listenerIndex);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSControlGroup::CAMMSControlGroup
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CAMMSControlGroup::CAMMSControlGroup(
+ const TDesC& aName,
+ TAMMSControlTypes aControlType) :
+ iName(aName),
+ iControlType(aControlType)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammseffectmodule.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Module for holding control groups belonging to EffectModule.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammseffectmodule.h"
+#include "cammsaudiovirtualizercontrolgroup.h"
+#include "cammsglobalmanager.h"
+#include <logger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectModule::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSEffectModule* CAMMSEffectModule::NewLC(
+ CAMMSGlobalManager* aGlobalManager)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::NewLC +");
+
+ CAMMSEffectModule* self = new(ELeave) CAMMSEffectModule(aGlobalManager);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::NewLC -");
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectModule::~CAMMSEffectModule()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAMMSEffectModule::~CAMMSEffectModule()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::~");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectModule::AddPlayerNoStateCheckL
+// Adds player without checking its state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSEffectModule::AddPlayerNoStateCheckL(CMMAPlayer* aPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::AddPlayerNoStateCheckL +");
+
+ // Check that the player can be added.
+ User::LeaveIfError(iGlobalManager->PlayerAddingAllowed(aPlayer));
+
+ // Add the player to this module.
+ CAMMSModule::AddPlayerNoStateCheckL(aPlayer);
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::AddPlayerNoStateCheckL -");
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSEffectModule::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::ConstructL +");
+
+ CAMMSModule::ConstructL();
+
+ // Add required controls to the EffectModule.
+
+ AddControlGroupAndPopL(CAMMSAudioVirtualizerControlGroup::NewLC());
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSEffectModule::ConstructL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSEffectModule::CAMMSEffectModule
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSEffectModule::CAMMSEffectModule(CAMMSGlobalManager* aGlobalManager)
+ : iGlobalManager(aGlobalManager)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammsglobalmanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class provides GlobalManager functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cammsglobalmanager.h"
+#include "cammsmodulecontainer.h"
+#include "cammssoundsource3d.h"
+#include "cammseffectmodule.h"
+
+// Audio 3d includes.
+#include "cammsdopplercontrolgroup.h"
+#include "cammslocationcontrolgroup.h"
+
+// Global manager
+#include "cammsreverbcontrolgroup.h"
+#include "cammsequalizercontrolgroup.h"
+#include "cammsvolumecontrolgroup.h"
+#include "cammspancontrolgroup.h"
+#include "cammscommitcontrolgroup.h"
+#include "cammsorientationcontrolgroup.h"
+
+#include "cammsplayerbuildergroup.h"
+#include "cammsaudioplayerbuilder.h"
+#include "cammsvolumecontrolbuilder.h"
+#include "ammsconstants.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSGlobalManager* CAMMSGlobalManager::NewLC()
+{
+ CAMMSGlobalManager* self = new(ELeave) CAMMSGlobalManager;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ return self;
+}
+
+// Destructor
+CAMMSGlobalManager::~CAMMSGlobalManager()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::~CAMMSGlobalManager");
+ delete iSpectator;
+ delete iEffectModules;
+ delete iSoundSource3Ds;
+ delete iPlayerBuilder;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::AddPlayerNotifyL
+// Adds new player
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSGlobalManager::AddPlayerNotifyL(CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::AddPlayerNotifyL player type %S",
+ aPlayer->Type().Ptr());
+
+ // Add amms controls to player.
+ iPlayerBuilder->PreparePlayerL(aPlayer);
+
+ // AddPlayerNoStateCheckL is used to add players to global manager and
+ // global controls because mma player may be started or prefetched before
+ // amms global manager is created.
+
+ // Add player to global manager. All global control groups will be informed.
+ AddPlayerNoStateCheckL(aPlayer);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::RemovePlayerNotify
+// Removes player
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSGlobalManager::RemovePlayerNotify(CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::RemovePlayerNotify player type %S",
+ aPlayer->Type().Ptr());
+
+ // RemovePlayer can return only KErrNotFound or KErrNone, and in this case
+ // we do not need to handle KErrNotFound
+ RemovePlayerNoStateCheck(aPlayer);
+
+ // Removing player from other modules
+ iEffectModules->RemovePlayer(aPlayer);
+ iSoundSource3Ds->RemovePlayer(aPlayer);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::InitL
+// Initializes GlobalManager.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSGlobalManager::InitL(RPointerArray< CMMAPlayer >& aPlayers)
+{
+ TInt playerCount = aPlayers.Count();
+
+ // Add all players to the global controls and to the spectator.
+ for (TInt i = 0; i < playerCount; i++)
+ {
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::InitL adding controls to %S",
+ aPlayers[ i ]->Type().Ptr());
+ AddPlayerNotifyL(aPlayers[ i ]);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::CreateSoundSource3DL
+// Creates a new sound source 3D module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CAMMSModule* CAMMSGlobalManager::CreateSoundSource3DL()
+{
+ // InitL must have been called before call to this methdod.
+ __ASSERT_DEBUG(iSpectator, User::Invariant());
+
+ CAMMSSoundSource3D* soundSource3D =
+ CAMMSSoundSource3D::NewLC(iSpectator, this);
+
+ iSoundSource3Ds->AppendL(soundSource3D);
+
+ CleanupStack::Pop(soundSource3D);
+
+ return soundSource3D;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::CreateEffectModuleL
+// Creates a new effect module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CAMMSModule* CAMMSGlobalManager::CreateEffectModuleL()
+{
+ CAMMSEffectModule* module = CAMMSEffectModule::NewLC(this);
+
+ iEffectModules->AppendL(module);
+
+ CleanupStack::Pop(module);
+
+ return module;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::Spectator
+// Returns the spectator.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CAMMSModule* CAMMSGlobalManager::Spectator()
+{
+ return iSpectator;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::DisposeModule
+// Disposes module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSGlobalManager::DisposeModule(CAMMSModule* aModule)
+{
+ // Remove the module from the module containers.
+ iSoundSource3Ds->RemoveModule(aModule);
+ iEffectModules->RemoveModule(aModule);
+
+ // Delete the module itself.
+ delete aModule;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::PlayerAddingAllowed
+// Checks whether the given player can be added to a module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSGlobalManager::PlayerAddingAllowed(CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::PlayerAddingAllowed %d +",
+ (TInt)aPlayer);
+
+ TInt result = KErrNone;
+
+ // Check whether the player can be added according to SoundSource3Ds.
+ TInt modules = iSoundSource3Ds->Count();
+
+ for (TInt i = 0; (result == KErrNone) && (i < modules); i++)
+ {
+ CAMMSModule* module = iSoundSource3Ds->At(i);
+
+ result = PlayerAddingAllowed(aPlayer, module);
+ }
+
+
+ // Check whether the player can be added according to EffectModules.
+ modules = iEffectModules->Count();
+
+ for (TInt i = 0; (result == KErrNone) && (i < modules); i++)
+ {
+ CAMMSModule* module = iEffectModules->At(i);
+
+ result = PlayerAddingAllowed(aPlayer, module);
+ }
+
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::PlayerAddingAllowed %d -", result);
+
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::CAMMSGlobalManager
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSGlobalManager::CAMMSGlobalManager()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSGlobalManager::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::ConstructL +");
+
+ CAMMSModule::ConstructL();
+
+ iSoundSource3Ds = new(ELeave) CAMMSModuleContainer();
+ iEffectModules = new(ELeave) CAMMSModuleContainer();
+ iPlayerBuilder = CAMMSPlayerBuilderGroup::NewL();
+ iPlayerBuilder->AddBuilderAndPopL(CAMMSAudioPlayerBuilder::NewLC());
+ iPlayerBuilder->AddBuilderAndPopL(CAMMSVolumeControlBuilder::NewLC());
+
+ // Add control groups to global manager
+ AddControlGroupAndPopL(CAMMSReverbControlGroup::NewLC());
+ AddControlGroupAndPopL(CAMMSEqualizerControlGroup::NewLC());
+ AddControlGroupAndPopL(CAMMSVolumeControlGroup::NewLC(
+ KAMMSGlobalVolume));
+
+#ifndef __WINS__
+ // PanControl is not supported in WINSCW builds.
+ // This is because of limited pan support in DirectX.
+ AddControlGroupAndPopL(CAMMSPanControlGroup::NewLC());
+#endif // __WINS__
+
+ // Create spectator and add controls.
+ iSpectator = CAMMSModule::NewL();
+ iSpectator->AddControlGroupAndPopL(CAMMSLocationControlGroup::NewLC(
+ EAMMSSpectatorControl));
+ iSpectator->AddControlGroupAndPopL(CAMMSOrientationControlGroup::NewLC());
+ iSpectator->AddControlGroupAndPopL(CAMMSDopplerControlGroup::NewLC(
+ EAMMSSpectatorControl));
+
+ // Add Commit control group to global manager, and pass required references
+ AddControlGroupAndPopL(CAMMSCommitControlGroup::NewLC(
+ *iSpectator,
+ *iSoundSource3Ds));
+
+ LOG( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::ConstructL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSGlobalManager::PlayerAddingAllowed
+// Checks whether the given player can be added to a module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CAMMSGlobalManager::PlayerAddingAllowed(CMMAPlayer* aPlayer,
+ CAMMSModule* aModule)
+{
+ LOG2( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::PlayerAddingAllowed %d %d +",
+ (TInt)aPlayer, (TInt)aModule);
+
+ TBool playerExists = aModule->HasPlayer(aPlayer);
+
+ TInt result = (playerExists ? KAMMSPlayerAlreadyInModuleError : KErrNone);
+
+// WINSCW build does not support audio mixing.
+// Thus, check in WINSCW build that there is not any non-closed player
+// in the module. If there is any non-closed player in the module,
+// adding a new player is not allowed to ANY module.
+// However, allow a player to be in CLOSED state, because it cannot be started
+// anymore and cannot thus reserve any resources anymore.
+
+#ifdef __WINS__
+
+ if (result == KErrNone)
+ {
+ TInt players = aModule->PlayerCount(CMMAPlayer::EUnrealized,
+ CMMAPlayer::EStarted);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::PlayerAddingAllowed players=%d",
+ players);
+
+ result = (players == 0 ? KErrNone : KAMMSMixingNotSupported);
+ }
+
+#endif // __WINS__
+
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSGlobalManager::PlayerAddingAllowed %d -", result);
+
+ return result;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammsmodule.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,379 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a container for MAMMSControlGroup objects.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsmodule.h"
+#include "cammscontrolgroup.h"
+#include <logger.h>
+
+
+// CONSTANTS
+// Before further testing is done, 4 is sufficient average value to be used here.
+const TInt KAMMSModuleDefaultGranularity = 4;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSModule* CAMMSModule::NewL()
+{
+ CAMMSModule* self = NewLC();
+ CleanupStack::Pop(self);
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSModule* CAMMSModule::NewLC()
+{
+ CAMMSModule* self = new(ELeave) CAMMSModule;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+// Destructor
+CAMMSModule::~CAMMSModule()
+{
+ // Check that construction fully succeed.
+ if (iControlGroups)
+ {
+ // control groups are owned and they must be deleted.
+ iControlGroups->ResetAndDestroy();
+ delete iControlGroups;
+ }
+
+ // Players are not owned.
+ iPlayers.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::AddControlGroupL
+// Add control to iControlGroups array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModule::AddControlGroupAndPopL(CAMMSControlGroup* aGroup)
+{
+ // Check in debug build that group is not null.
+ __ASSERT_DEBUG(aGroup, User::Invariant());
+
+ iControlGroups->AppendL(aGroup);
+
+ // aGroup must be the previous item in the cleanupstack
+ CleanupStack::Pop(aGroup);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::AddPlayerL
+// Adds new player to this module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModule::AddPlayerL(CMMAPlayer* aPlayer)
+{
+ // Check in debug build that player is not null.
+ __ASSERT_DEBUG(aPlayer, User::Invariant());
+
+ // Must leave if the player is already in the module
+ if (HasPlayer(aPlayer))
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // Must leave if player is in PREFETCHED or STARTED state
+ User::LeaveIfError(CheckPlayerState(aPlayer));
+
+ // Check that none of the players is not in PREFETCHED or STARTED state
+ User::LeaveIfError(CheckAllPlayersState());
+
+ AddPlayerNoStateCheckL(aPlayer);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::RemovePlayer
+// Removes player from module..
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::RemovePlayer(CMMAPlayer* aPlayer)
+{
+ // call RemovePlayerNoStateCheck only if aPlayer and all players in the
+ // module are in the right state.
+ TInt error = CheckPlayerState(aPlayer);
+ if (error == KErrNone)
+ {
+ error = CheckAllPlayersState();
+ if (error == KErrNone)
+ {
+ error = RemovePlayerNoStateCheck(aPlayer);
+ }
+ }
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::AddPlayerNoStateCheckL
+// Adds player without checking its state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModule::AddPlayerNoStateCheckL(CMMAPlayer* aPlayer)
+{
+ iPlayers.AppendL(aPlayer);
+
+ // If adding players leaves CAMMSModule::CleanupAddPlayer method will be
+ // called and player removed from module and from groups.
+ CleanupStack::PushL(TCleanupItem(&CAMMSModule::CleanupAddPlayer, this));
+
+ // Inform all control groups
+ TInt count = iControlGroups->Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iControlGroups->At(i)->PlayerAddedL(aPlayer);
+ }
+
+ CleanupStack::Pop(); // CSI: 12 Parameter TCleanupItem cannot be used as a parameter in Pop #
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::RemovePlayerNoStateCheck
+// Removes player without checking its state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::RemovePlayerNoStateCheck(CMMAPlayer* aPlayer)
+{
+ TInt index = iPlayers.Find(aPlayer);
+ if (index != KErrNotFound)
+ {
+ // player was in the array, remove it
+ iPlayers.Remove(index);
+
+ // inform all groups
+ TInt count = iControlGroups->Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iControlGroups->At(i)->PlayerRemoved(aPlayer);
+ }
+ }
+
+ // Find returned KErrNotFound if player was not in the module
+ return index;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::HasPlayer
+// Checks whether the given player is in this module.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CAMMSModule::HasPlayer(CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaAMMS, EInfo, "AMMS:CAMMSModule::HasPlayer %d +", (TInt)aPlayer);
+
+ TInt index = iPlayers.Find(aPlayer);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS:CAMMSModule::HasPlayer index=%d -", index);
+
+ return (index != KErrNotFound);
+}
+
+
+#ifdef __WINS__
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::PlayerCount
+// Returns the count of players whose state is between the given limits.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::PlayerCount(TInt aMinState, TInt aMaxState)
+{
+ LOG2( EJavaAMMS, EInfo, "AMMS:CAMMSModule::PlayerCount %d %d +", aMinState, aMaxState);
+
+ TInt result = 0;
+
+ TInt playerCount = iPlayers.Count();
+
+ LOG1( EJavaAMMS, EInfo, "AMMS:CAMMSModule::HasPlayer, players=%d", playerCount);
+
+ for (TInt i = 0; i < playerCount; i++)
+ {
+ TInt playerState = iPlayers[ i ]->State();
+
+ LOG2( EJavaAMMS, EInfo, "AMMS:CAMMSModule::HasPlayer %d, state=%d", i,
+ playerState);
+
+ if ((playerState >= aMinState) &&
+ (playerState <= aMaxState))
+ {
+ result++;
+ }
+ }
+
+ LOG1( EJavaAMMS, EInfo, "AMMS:CAMMSModule::PlayerCount %d -", result);
+
+ return result;
+}
+
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::CheckPlayerState
+// Checks all players state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::CheckAllPlayersState()
+{
+ TInt error = KErrNone;
+
+ TInt playerCount = iPlayers.Count();
+
+ // Loop until all players are checked or one of the players is in
+ // PREFETCHED or STARTED state
+ for (TInt i = 0; (i < playerCount) &&
+ (error == KErrNone); i++)
+ {
+ error = CheckPlayerState(iPlayers[ i ]);
+ }
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::CheckPlayerState
+// Checks player state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::CheckPlayerState(CMMAPlayer* aPlayer)
+{
+ // Player may not be in PREFETCHED or STARTED state
+ TInt retVal = KErrNone;
+ TInt playerState = aPlayer->State();
+ if (playerState == CMMAPlayer::EStarted ||
+ playerState == CMMAPlayer::EPrefetched)
+ {
+ retVal = KErrNotReady;
+ }
+ return retVal;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::CleanupAddPlayer
+// Static function to be used with TCleanupItem in AddPlayerNoStateCheckL
+// method. This method removes last added player from module and control
+// groups.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModule::CleanupAddPlayer(TAny* aModule)
+{
+ CAMMSModule* module = static_cast< CAMMSModule* >(aModule);
+
+ // This method is called from AddPlayerNoStateCheckL and there is always
+ // at least one player.
+ __ASSERT_DEBUG(module->iPlayers.Count() > 0, User::Invariant());
+
+ // Remove last added player from module and from control groups
+ module->RemovePlayerNoStateCheck(
+ module->iPlayers[ module->iPlayers.Count() - 1 ]);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::Find
+// Find control group with specified class name.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MAMMSControlGroup* CAMMSModule::Find(const TDesC& aClassName)
+{
+ MAMMSControlGroup* group = NULL;
+ TInt groupIndex = 0;
+ TInt groupCount = iControlGroups->Count();
+
+ // Loop until group is found or all group are checked
+ while (!group && (groupIndex < groupCount))
+ {
+ MAMMSControlGroup* tmpGroup = iControlGroups->At(groupIndex);
+
+ if (tmpGroup->ClassName() == aClassName)
+ {
+ // found the group, set return value which will stop while loop
+ group = tmpGroup;
+ }
+
+ groupIndex++;
+ }
+
+ return group;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::At
+// Index must be non-negative and less than the number of objects currently
+// within the array otherwise the functions raise an E32USER-CBase 21 panic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MAMMSControlGroup* CAMMSModule::At(TInt aIndex)
+{
+ return iControlGroups->At(aIndex); // CSI: 1 Array range panic allowed according to function description #
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::Count
+// return iControlGroup count.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSModule::Count()
+{
+ return iControlGroups->Count();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSModule::ConstructL()
+{
+ // Create array with default granularity, all derived classes must call
+ // this method.
+ iControlGroups = new(ELeave)CArrayPtrSeg< CAMMSControlGroup >(
+ KAMMSModuleDefaultGranularity);
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModule::CAMMSModule
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSModule::CAMMSModule()
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammsmodulecontainer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Container for CAMMSModule objects.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cammsmodulecontainer.h"
+
+// CONSTANTS
+// Before further testing is done, 4 is sufficient average value to be used here.
+const TInt KAMMSContainerDefaultGranularity = 4;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CAMMSModuleContainer::~CAMMSModuleContainer()
+{
+ ResetAndDestroy();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModuleContainer::RemovePlayer
+// Removes player from all modules.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModuleContainer::RemovePlayer(CMMAPlayer* aPlayer)
+{
+ // Remove player from all modules
+ for (TInt i = 0; i < Count(); i++)
+ {
+ At(i)->RemovePlayerNoStateCheck(aPlayer);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModuleContainer::RemoveModule
+// Removes module from container.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSModuleContainer::RemoveModule(CAMMSModule* aModule)
+{
+ // If the element is found, index is set to the position of that module
+ // element within the array.
+ TInt index = KErrNotFound;
+
+ TKeyArrayFix key(0, ECmpTInt); // offset = 0, type integer
+
+ // find returns 0, if the element with the specified key is found. Non-zero
+ // if the element with the specified key is not found
+ TInt retVal = Find(aModule, key, index);
+
+ LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSModuleContainer::DisposeModule find result %d",
+ retVal);
+
+ if (retVal == KErrNone)
+ {
+ // Remove the element by position. The module itself is not deleted
+ // here, so it has to be deleted elsewhere if needed.
+ Delete(index);
+ }
+ // else, module was not added to this container
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSModuleContainer::CAMMSModuleContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSModuleContainer::CAMMSModuleContainer():
+ CArrayPtrSeg< CAMMSModule >(KAMMSContainerDefaultGranularity)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammsplayerstatelistener.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation for player state listener.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammsplayerstatelistener.h"
+#include "cammscontrolgroup.h"
+#include <cmmaplayer.h>
+#include <cmmaplayerevent.h>
+
+// CONSTANTS
+const TInt KErrorMessageSize = 32;
+_LIT(KErrDefaultError, "AMMS error: %d");
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::NewLC
+// Two-phased constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSPlayerStateListener* CAMMSPlayerStateListener::NewLC(
+ CMMAPlayer* aPlayer,
+ CAMMSControlGroup* aControlGroup)
+{
+ CAMMSPlayerStateListener* self =
+ new(ELeave) CAMMSPlayerStateListener(aPlayer,
+ aControlGroup);
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::~CAMMSPlayerStateListener
+// Destructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSPlayerStateListener::~CAMMSPlayerStateListener()
+{
+ if (iPlayer)
+ {
+ iPlayer->RemoveStateListener(this);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::ConstructL
+// 2nd phase constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPlayerStateListener::ConstructL()
+{
+ __ASSERT_DEBUG(iPlayer && iControlGroup, User::Invariant());
+
+ iPlayer->AddStateListenerL(this);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::CAMMSPlayerStateListener
+// C++ constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CAMMSPlayerStateListener::CAMMSPlayerStateListener(
+ CMMAPlayer* aPlayer,
+ CAMMSControlGroup* aControlGroup)
+ : iPlayer(aPlayer),
+ iControlGroup(aControlGroup)
+{
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::Player
+// Returns the player listened by this listener.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CMMAPlayer* CAMMSPlayerStateListener::Player()
+{
+ return iPlayer;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSPlayerStateListener::StateChanged
+// Called when player state is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSPlayerStateListener::StateChanged(TInt aState)
+{
+ TRAPD(err, iControlGroup->PlayerStateChangedL(iPlayer, aState));
+
+ if (err != KErrNone)
+ {
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/module/src/cammssoundsource3d.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Module for holding control groups belonging to SoundSource3D.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cammssoundsource3d.h"
+#include "cammsdopplercontrolgroup.h"
+#include "cammslocationcontrolgroup.h"
+#include "cammsreverbsourcecontrolgroup.h"
+#include "cammsdistanceattenuationcontrolgroup.h"
+#include "cammspancontrolgroup.h"
+#include "cammsglobalmanager.h"
+#include <logger.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CAMMSSoundSource3D* CAMMSSoundSource3D::NewLC(CAMMSModule* aSpectator,
+ CAMMSGlobalManager* aGlobalManager)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::NewLC +");
+
+ CAMMSSoundSource3D* self = new(ELeave) CAMMSSoundSource3D(aSpectator,
+ aGlobalManager);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::NewLC -");
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::~CAMMSSoundSource3D()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CAMMSSoundSource3D::~CAMMSSoundSource3D()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::~");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::AddPlayerNoStateCheckL
+// Adds player without checking its state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSSoundSource3D::AddPlayerNoStateCheckL(CMMAPlayer* aPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::AddPlayerNoStateCheckL +");
+
+ // Check that the player can be added.
+ User::LeaveIfError(iGlobalManager->PlayerAddingAllowed(aPlayer));
+
+ // Remove the pan control from the global manager because the pan control
+ // cannot be used when 3D sound is in use.
+ CAMMSPanControlGroup* panControlGroup =
+ (CAMMSPanControlGroup*)iGlobalManager->Find(
+ KAMMSPanControlClassName);
+
+ // PanControl is not supported in WINSCW builds.
+ if (panControlGroup)
+ {
+ panControlGroup->PlayerRemoved(aPlayer);
+ }
+
+
+ // Add the player to the spectator.
+ iSpectator->AddPlayerNoStateCheckL(aPlayer);
+
+ // Add the player to this module.
+ CAMMSModule::AddPlayerNoStateCheckL(aPlayer);
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::AddPlayerNoStateCheckL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::RemovePlayerNoStateCheck
+// Removes player without checking its state
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAMMSSoundSource3D::RemovePlayerNoStateCheck(CMMAPlayer* aPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::RemovePlayerNoStateCheck +");
+
+ // Remove the player from the module. The method returns the index
+ // of the Player or an error code.
+ TInt error = CAMMSModule::RemovePlayerNoStateCheck(aPlayer);
+
+ ELOG1( EJavaAMMS, "AMMS:CAMMSSoundSource3D::RemovePlayerNoStateCheck err %d",
+ error);
+
+ // If the player was found in this module, remove the player also from the
+ // spectator. The method returns the index of the Player or an error code.
+ if (error >= KErrNone)
+ {
+ error = iSpectator->RemovePlayerNoStateCheck(aPlayer);
+
+ ELOG1( EJavaAMMS, "AMMS:CAMMSSoundSource3D::RemovePlayerNoStateCheck err2 %d",
+ error);
+ }
+
+ // If the player is deleted from the module, it is required to add the
+ // pan control to the global manager.
+ if (error >= KErrNone)
+ {
+ CAMMSPanControlGroup* panControlGroup =
+ (CAMMSPanControlGroup*)iGlobalManager->Find(
+ KAMMSPanControlClassName);
+
+ // PanControl is not supported in WINSCW builds.
+ if (panControlGroup)
+ {
+ TRAP(error, panControlGroup->PlayerAddedL(aPlayer));
+ }
+
+ ELOG1( EJavaAMMS, "AMMS:CAMMSSoundSource3D::RemovePlayerNoStateCheck err3 %d",
+ error);
+ }
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::RemovePlayerNoStateCheck -");
+
+ return error;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CAMMSSoundSource3D::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::ConstructL +");
+
+ CAMMSModule::ConstructL();
+
+ // Add required controls to the SoundSource3D.
+
+ AddControlGroupAndPopL(CAMMSDopplerControlGroup::NewLC(
+ EAMMSSoundSource3DControl));
+
+ AddControlGroupAndPopL(CAMMSLocationControlGroup::NewLC(
+ EAMMSSoundSource3DControl));
+
+ AddControlGroupAndPopL(CAMMSDistanceAttenuationControlGroup::NewLC());
+
+ AddControlGroupAndPopL(CAMMSReverbSourceControlGroup::NewLC());
+
+ LOG( EJavaAMMS, EInfo, "AMMS:CAMMSSoundSource3D::ConstructL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSSoundSource3D::CAMMSSoundSource3D
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CAMMSSoundSource3D::CAMMSSoundSource3D(CAMMSModule* aSpectator,
+ CAMMSGlobalManager* aGlobalManager)
+ : iSpectator(aSpectator),
+ iGlobalManager(aGlobalManager)
+{
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/javasrc/com/nokia/amms/control/tuner/TunerControlImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,548 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements
+ * javax.microedition.amms.control.tuner.TunerControl
+ *
+*/
+
+
+package com.nokia.amms.control.tuner;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Control;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.PlayerImpl;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.control.ControlImpl;
+import com.nokia.mj.impl.rt.legacy.NativeError;
+
+public class TunerControlImpl
+ extends ControlImpl
+ implements javax.microedition.amms.control.tuner.TunerControl
+{
+ //preset name max length
+ private static final int MAX_PRESET_NAME_LENGTH = 100;
+ //max number of presets
+ private static final int MAX_NUMBER_OF_PRESETS = 20;
+ //all frequencys are in 100 Hertzs
+ private static final int HERTZ_MULTIPLIER = 100;
+
+ /**
+ * Constructor
+ */
+ public TunerControlImpl()
+ {
+ //JDEBUG( "AMMS TunerControlImpl Constructor" );
+ }
+
+ /**
+ * Gets the minimum frequency supported by this tuner
+ * with the given modulation.
+ *
+ * @param modulation The modulation whose supported minimum frequency
+ * is asked.
+ * @return The minimum frequency in 100 Hertzs.
+ * @throws IllegalArgumentException if the <code>modulation</code> is not supported or it is null.
+ */
+ public int getMinFreq(String aModulation)
+ {
+ if (aModulation != MODULATION_FM)
+ {
+ throw new IllegalArgumentException("Modulation is not valid.");
+ }
+
+ int minFreq = _getMinFreq(iEventSource,
+ iControlHandle);
+
+ NativeError.check(minFreq);
+
+ return minFreq / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * Gets the maximum frequency supported by this tuner
+ * with the given modulation.
+ *
+ * @param modulation The modulation whose supported maximum frequency
+ * is asked.
+ * @return The maximum frequency in 100 Hertzs.
+ * @throws IllegalArgumentException if the <code>modulation</code> is not supported or it is null.
+ */
+ public int getMaxFreq(String aModulation)
+ {
+ if (aModulation != MODULATION_FM)
+ {
+ throw new IllegalArgumentException("Modulation is not valid.");
+ }
+
+ int maxFreq = _getMaxFreq(iEventSource,
+ iControlHandle);
+
+ NativeError.check(maxFreq);
+
+ return maxFreq / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * Tunes to the given frequency or to the closest supported frequency.
+ *
+ * @param freq The frequency in 100 Hertzs that will be taken into use.
+ * If that frequency is not supported, the closest supported
+ * frequency will be taken into use.
+ *
+ * @param modulation The modulation to be used. <code>TunerControl</code> specifies
+ * predefined constants <code>MODULATION_FM</code> and <code>MODULATION_AM</code>
+ * but other modulations can be supported as well. Supported modulations can be queried
+ * by <code>System</code> property <code>tuner.modulations</code>.
+ *
+ * @throws IllegalArgumentException if <code>freq</code> is not inside the frequency band supported
+ * by the device or if the <code>modulation</code> is not supported or the <code>modulation</code> is null.
+ *
+ * @return the frequency in 100 Hertzs that was taken into use.
+ */
+ public int setFrequency(int aFreq, String aModulation)
+ {
+ if (aModulation != MODULATION_FM)
+ {
+ throw new IllegalArgumentException("Modulation is not valid.");
+ }
+
+ int freqInUse = _setFrequency(iEventSource,
+ iControlHandle,
+ aFreq * HERTZ_MULTIPLIER);
+
+ NativeError.check(freqInUse);
+
+ return freqInUse / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * Gets the frequency which the tuner has been tuned to.
+ *
+ * @return The frequency to which the device has been tuned, in 100 Hertzs.
+ */
+ public int getFrequency()
+ {
+ int freq = _getFrequency(iEventSource, iControlHandle);
+
+ NativeError.check(freq);
+
+ return freq / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * <p>Seeks for the next broadcast signal. If the end of the Player's
+ * frequency band is reached before a signal was found, the scan
+ * continues from the other end until a signal is found or the
+ * starting frequency is reached.</p>
+ *
+ * <p>After seeking, the frequency of the Player is the one that
+ * was returned or if nothing was found, the original frequency.</p>
+ *
+ * @param startFreq the frequency in 100 Hertzs wherefrom the scan starts (inclusive)
+ *
+ * @param modulation The modulation to be used. <code>TunerControl</code> specifies
+ * predefined constants <code>MODULATION_FM</code> and <code>MODULATION_AM</code>
+ * but other modulations can be supported as well. Supported modulations can be queried
+ * by <code>System</code> property <code>tuner.modulations</code>.
+ * @param upwards if <code>true</code>, the scan proceeds towards higher frequencies,
+ * otherwise towards lower frequencies
+ *
+ * @return The found frequency in 100 Hertzs or, if no signal was found, 0.
+ *
+ * @throws IllegalArgumentException if <code>startFreq</code> is not between the supported minimum
+ * and maximum frequencies or if the <code>modulation</code> is null.
+ * @throws MediaException if the seek functionality is not available for the given modulation.
+ */
+ public int seek(int aStartFreq, String aModulation, boolean aUpwards)
+ throws MediaException
+ {
+ if (aModulation != MODULATION_FM)
+ {
+ throw new IllegalArgumentException("Modulation is not valid.");
+ }
+
+ int foundFreq = _seek(iEventSource,
+ iControlHandle,
+ aStartFreq * HERTZ_MULTIPLIER,
+ aUpwards);
+
+ NativeError.check(foundFreq);
+
+ return foundFreq / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * Gets the current squelching (muting in frequencies without broadcast)
+ * setting.
+ *
+ * @return <code>true</code> if squelch is on or <code>false</code> if squelch is off.
+ */
+ public boolean getSquelch()
+ {
+ int retValue = _getSquelch(iEventSource, iControlHandle);
+
+ NativeError.check(retValue);
+
+ if (retValue == NativeError.KErrNone)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Sets squelching on or off. Squelching means muting the frequencies
+ * that do not contain radio broadcast.
+ *
+ * @param squelch <code>true</code> to turn the squelch on or <code>false</code> to turn the squelch off.
+ * @throws MediaException if the given squelch setting is not supported.
+ */
+ public void setSquelch(boolean aSquelch) throws MediaException
+ {
+ int err = _setSquelch(iEventSource, iControlHandle, aSquelch);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Gets the modulation in use.
+ *
+ * @return The modulation currently in use.
+ */
+ public String getModulation()
+ {
+ //only FM modulation is supported
+ return MODULATION_FM;
+ }
+
+ /**
+ * Gets the strength of the recepted signal.
+ *
+ * @return A value between 0 and 100 where 0 means the faintest and 100 the strongest possible signal strength.
+ * @throws MediaException if querying the signal strength is not supported.
+ */
+ public int getSignalStrength() throws MediaException
+ {
+ int signalStrength = _getSignalStrength(iEventSource,
+ iControlHandle);
+
+ if (signalStrength != NativeError.KErrNone)
+ {
+ throw new MediaException("Signal strength is not supported.");
+ }
+
+ return signalStrength;
+ }
+
+ /**
+ * Gets the stereo mode in use.
+ *
+ * @return The stereo mode in use. Stereo mode is one of <code>MONO</code>,
+ * <code>STEREO</code> or <code>AUTO</code>.
+ */
+ public int getStereoMode()
+ {
+ int stereoMode = _getStereoMode(iEventSource, iControlHandle);
+
+ NativeError.check(stereoMode);
+
+ return stereoMode;
+ }
+
+ /**
+ * Sets the stereo mode.
+ *
+ * @param mode The stereo mode to be used. Stereo mode is one of <code>MONO</code>,
+ * <code>STEREO</code> or <code>AUTO</code>.
+ * @throws IllegalArgumentException if the given mode is not supported.
+ */
+ public void setStereoMode(int aStereoMode)
+ {
+ if (aStereoMode != MONO && aStereoMode != STEREO && aStereoMode != AUTO)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ int err = _setStereoMode(iEventSource, iControlHandle, aStereoMode);
+
+ if (err != NativeError.KErrNone)
+ {
+ throw new IllegalArgumentException("Stereo mode is not supported.");
+ }
+ }
+
+ /**
+ * Gets the number of presets. The numbering of presets starts from one and the largest
+ * preset number equals the value returned from this method.
+ *
+ * @return The number of presets, or zero if the presets are not supported.
+ */
+ public int getNumberOfPresets()
+ {
+
+ return 0;
+ }
+
+ /**
+ * Tunes the tuner by using settings specified in the preset. Changes to
+ * presets following a <code>usePreset</code> call do not tune the tuner automatically.
+ *
+ * @param preset the preset to be used.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets.
+ */
+ public void usePreset(int aPreset)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+ int err = _usePreset(iEventSource, iControlHandle, aPreset);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Configures the preset using current frequency and modulation
+ * (and stereo mode if native presets support storing it).
+ *
+ * @param preset the preset to be set.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of preset range.
+ * @throws SecurityException if setting presets has been prohibited.
+ */
+ public void setPreset(int aPreset)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+ int err = _setPreset(iEventSource, iControlHandle, aPreset);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Configures the preset using given settings.
+ * The stereo mode might not be stored if it is not supported by the presets.
+ * (In that case, <code>IllegalArgumentException</code> is not thrown.)
+ *
+ * @param preset the preset to be configured.
+ * @param freq the frequency of the preset in 100 Hertzs.
+ * @param mod the modulation of the preset.
+ * @param stereoMode the stereo mode of the preset.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets or
+ * <code>freq</code> or <code>modulation</code> are not available or if the <code>modulation</code> is null or if <code>stereoMode</code> is not a supported stereo mode.
+ * @throws SecurityException if setting presets has been prohibited.
+ */
+ public void setPreset(int aPreset, int aFreq, String aModulation, int aStereoMode)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+ if (aModulation != MODULATION_FM)
+ {
+ throw new IllegalArgumentException("Modulation is not valid.");
+ }
+ if (aStereoMode != MONO && aStereoMode != STEREO && aStereoMode != AUTO)
+ {
+ throw new IllegalArgumentException("Stereo mode is not supported.");
+ }
+
+ int err = _setPreset(iEventSource, iControlHandle, aPreset, aFreq * HERTZ_MULTIPLIER, aStereoMode);
+
+ NativeError.check(err);
+ }
+
+ /**
+ * Gets the preset's frequency.
+ *
+ * @param preset the preset whose frequency is to be returned.
+ * @return The frequency of the preset in 100 Hertzs.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets.
+ */
+ public int getPresetFrequency(int aPreset)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+
+ int presetFreq = _getPresetFrequency(iEventSource, iControlHandle, aPreset);
+
+ NativeError.check(presetFreq);
+
+ return presetFreq / HERTZ_MULTIPLIER;
+ }
+
+ /**
+ * Gets the preset's modulation.
+ *
+ * @param preset the preset whose modulation is to be returned.
+ * @return The modulation of the preset.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets.
+ */
+ public String getPresetModulation(int aPreset)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+ return MODULATION_FM;
+ }
+
+ /**
+ * Gets the preset's stereo mode.
+ *
+ * @param preset the preset whose stereo mode is to be returned.
+ * @return The stereo mode of the preset. Stereo mode is one of
+ * <code>MONO</code>, <code>STEREO</code> or <code>AUTO</code>.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets.
+ * @throws MediaException if the presets do not support storing of the stereo mode.
+ */
+ public int getPresetStereoMode(int aPreset) throws MediaException
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+
+ int presetStereoMode = _getPresetStereoMode(iEventSource, iControlHandle, aPreset);
+
+ NativeError.check(presetStereoMode);
+
+ return presetStereoMode;
+ }
+
+ /**
+ * Gets the preset name.
+ *
+ * @param preset the preset whose name is to be returned.
+ * @return A <code>String</code> containing the preset name.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets.
+ */
+ public String getPresetName(int aPreset)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+
+ int[] error = new int[ 1 ];
+
+ String presetName = _getPresetName(iEventSource, iControlHandle, aPreset, error);
+
+ NativeError.check(error[ 0 ]);
+
+ return presetName;
+ }
+
+ /**
+ * Sets the preset name.
+ *
+ * @param preset the preset whose name is to be set.
+ * @param name the name of the preset.
+ * @throws IllegalArgumentException if <code>preset</code> < 1 or <code>preset</code> > number of presets or
+ * if the <code>name</code> is null.
+ * @throws SecurityException if setting presets has been prohibited.
+ */
+ public void setPresetName(int aPreset, String aName)
+ {
+ if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
+ {
+ throw new IllegalArgumentException("Preset out of preset range.");
+ }
+ if (aName.length() > MAX_PRESET_NAME_LENGTH)
+ {
+ throw new IllegalArgumentException("Preset name too long");
+ }
+
+ int err = _setPresetName(iEventSource, iControlHandle, aPreset, aName);
+
+ NativeError.check(err);
+ }
+
+
+ private native int _getMinFreq(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+ private native int _getMaxFreq(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+ private native int _setFrequency(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aFreq);
+
+ private native int _getFrequency(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+
+ private native int _seek(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aStartFreq,
+ boolean aUpwards);
+
+ private native int _getSquelch(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+ private native int _setSquelch(int aEventSourceHandle,
+ int aTunerControlHandle,
+ boolean aSquelch);
+
+ private native int _getSignalStrength(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+ private native int _getStereoMode(int aEventSourceHandle,
+ int aTunerControlHandle);
+
+ private native int _setStereoMode(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aStereoMode);
+
+ private native int _usePreset(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset);
+
+ private native int _setPreset(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset);
+
+ private native int _setPreset(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset,
+ int aFreq,
+ int aStereoMode);
+
+ private native int _getPresetFrequency(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset);
+
+ private native int _getPresetStereoMode(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset);
+
+ private native int _setPresetName(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset,
+ String aName);
+
+ private native String _getPresetName(int aEventSourceHandle,
+ int aTunerControlHandle,
+ int aPreset,
+ int[] aError);
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/javasrc/com/nokia/microedition/media/protocol/capture/radio/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is capture://radio protocol
+ *
+*/
+
+package com.nokia.microedition.media.protocol.capture.radio;
+
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.PlayerImpl;
+import javax.microedition.media.MediaException;
+import com.nokia.mj.impl.rt.legacy.NativeError;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.amms.control.tuner.TunerControlImpl;
+
+/**
+ * This class is capture://radio protocol.
+ */
+public class Protocol
+ implements com.nokia.microedition.media.protocol.Protocol
+{
+ // Constants
+ private static final String TUNER_CONTROL_NAME =
+ "javax.microedition.amms.control.tuner.TunerControl";
+
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ // JDEBUG( "AMMS Tuner Protocol createPlayer" );
+
+ String locatorParameters = aLocator.getParameters();
+
+ // Create native tuner player. The native tuner player
+ // creates a native tuner control and adds it to its list.
+ // Handle for the native player are returned.
+ int playerHandle = 0;
+ playerHandle = _createNativeTunerPlayer(
+ ManagerImpl.getEventSource(),
+ locatorParameters);
+
+// JDEBUG( "AMMS Tuner Protocol createPlayer playerHandle = " + playerHandle );
+
+ NativeError.check(playerHandle);
+
+ PlayerImpl tunerPlayer = new PlayerImpl(playerHandle);
+
+ return tunerPlayer;
+ }
+
+ /**
+ * Creates native tuner player.
+ * Native tuner player creates and adds native tuner control.
+ *
+ * @param aEventSourceHandle Handle to event source.
+ * @param aLocatorParameters
+ * @return Error code.
+ */
+ private native int _createNativeTunerPlayer(int aEventSourceHandle,
+ String aLocatorParameters);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/external_include/fmradioenginecrkeys.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Definition of central repository keys for FM Radio Engine.
+*
+*/
+
+
+#ifndef FMRADIOENGINECRKEYS_H
+#define FMRADIOENGINECRKEYS_H
+
+// FM Radio Engine UID
+const TUid KCRUidFMRadioEngine = {0x101F7CBC};
+
+// Radio headset volume
+const TUint32 KRadioHeadsetVolume = 0x00000001;
+
+// Radio speaker volume
+const TUint32 KRadioSpeakerVolume = 0x00000002;
+
+// The last played radio frequency
+const TUint32 KFmRadioFrequency = 0x00000003;
+
+// The last played radio channel
+const TUint32 KFmRadioChannel = 0x00000004;
+
+// The radio mode before radio off
+const TUint32 KFmRadioMode = 0x00000005;
+
+// The first preset channel's location in central repository
+const TUint32 KFmRadioPresetChannel1 = 0x0000000A;
+
+#endif // FMRADIOENGINECRKEYS_H
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/external_include/tuner.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,2535 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file for Tuner component.
+*
+*/
+
+
+#ifndef TUNER_H
+#define TUNER_H
+
+#include <e32base.h>
+#include <MCustomCommand.h>
+#include <mmf/common/mmfbase.h>
+#include <mmf/common/mmfutilities.h>
+#include <mmf/common/mmfcontrollerframework.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include <mmf/common/mmfaudio.h>
+#include <Mda/Common/audio.h>
+class RRadioSession;
+
+/**
+@file
+@publishedAll
+@prototype
+*/
+/**
+The Tuner Capabilities structure defines the capabilities of the tuner
+on the device, as retrieved using the function GetCapabilities.
+*/
+class TTunerCapabilities
+{
+public:
+ inline TTunerCapabilities();
+ inline TTunerCapabilities(TUint32 aTunerBands, TUint32 aAdditionalFunctions);
+public:
+ /**
+ Bitfield (as defined by CMMTunerUtility::TTunerBand) with the bits of the
+ supported bands set
+ */
+ TUint32 iTunerBands;
+
+ /** Tuner Function bit flags - may be extended in future */
+ enum TTunerFunctions
+ {
+ /** Recording of Tuner Audio is possible */
+ ETunerFunctionRecording = 0x01,
+ /** Tuner can record and play back simultaneously */
+ ETunerFunctionSimultaneousPlayAndRecord = 0x02,
+ /** The tuner requires an external antenna (e.g. a headset) to function */
+ ETunerFunctionRequiresAntenna = 0x04,
+ /** CMMRdsTunerUtility supported */
+ ETunerFunctionRds = 0x08,
+ /** The tuner can be used when the device is in flight mode */
+ ETunerFunctionAvailableInFlightMode = 0x10
+ };
+
+ /** Bitfield (as defined by ETunerFunctions) with the bits of the supported functions set */
+ TUint32 iAdditionalFunctions;
+};
+
+/**
+Class representing a frequency.
+*/
+class TFrequency
+{
+public:
+ inline TFrequency();
+ explicit inline TFrequency(TInt aFrequency);
+ inline TInt operator==(const TFrequency& aFrequency) const;
+ inline TInt operator!=(const TFrequency& aFrequency) const;
+ inline TInt operator> (const TFrequency& aFrequency) const;
+ inline TInt operator>=(const TFrequency& aFrequency) const;
+ inline TInt operator< (const TFrequency& aFrequency) const;
+ inline TInt operator<=(const TFrequency& aFrequency) const;
+public:
+ /**
+ The Frequency, in Hertz. A TInt is at least 32 bits, giving a maximum frequency
+ of at least 2.4GHz (i.e. 0x7fffffff Hz)
+ */
+ TInt iFrequency;
+};
+
+
+class MMMTunerObserver;
+class MMMTunerChangeObserver;
+class MMMTunerStereoObserver;
+class MMMSignalStrengthObserver;
+class MMMTunerAudioPlayerObserver;
+class MMMTunerAudioRecorderObserver;
+class CMMTunerAudioPlayerUtility;
+class CMMTunerAudioRecorderUtility;
+class CMMTunerScannerUtility;
+class CMMRdsTunerUtility;
+
+/**
+The MMF Tuner API is present to allow clients to control
+the tuner hardware present on a device.
+*/
+class CMMTunerUtility : public CBase
+{
+ friend class CMMTunerAudioPlayerUtility;
+ friend class CMMTunerAudioRecorderUtility;
+ friend class CMMTunerScannerUtility;
+ friend class CMMRdsTunerUtility;
+public:
+ /** Tuner Band bit flags - may be extended in future */
+ enum TTunerBand
+ {
+ ETunerNoBand = 0x00,
+ /** Long Wave - uses frequencies */
+ ETunerBandLw = 0x01,
+ /** Amplitude Modulation or Medium Wave - uses frequencies */
+ ETunerBandAm = 0x02,
+ /** Frequency Modulation, European and American band - uses frequencies */
+ ETunerBandFm = 0x04,
+ /** Frequency Modulation, Japanese band - uses frequencies */
+ ETunerBandJapaneseFm = 0x08,
+ /** Digital Audio Broadcasting - uses channels */
+ ETunerBandDab = 0x10,
+ /** Digital Video Broadcasting */
+ ETunerBandDvb = 0x20
+ };
+ /**
+ Search direction enumeration
+ */
+ enum TSearchDirection
+ {
+ /** Search for stations upwards - i.e. by increasing frequency */
+ ESearchDirectionUp = 1,
+ /** Search for stations downwards - i.e. by decreasing frequency */
+ ESearchDirectionDown
+ };
+ /**
+ The Tuner Access Priority enables clients to correctly identify their needs
+ when it comes to accessing the tuner. A process must have the MultimediaDD
+ capability to use priorities greater than ETunerAccessPriorityNormal.
+ */
+ enum TTunerAccessPriority
+ {
+ /** Radio accessible when device is idle */
+ ETunerAccessPriorityBackground = -100,
+ /** Ordinary application priority */
+ ETunerAccessPriorityNormal = 0,
+ /** Radio is to be used as an alarm sound */
+ ETunerAccessPriorityAlarm = 75,
+ /** System use only */
+ ETunerAccessPrioritySystem = 100
+ };
+ /**
+ Bitmasks to indicate what state the tuner is in.
+ */
+ enum TTunerState
+ {
+ /**
+ Tuner is active, and can therefore report frequency etc. If this bit is
+ not set, none of the others should be set.
+ */
+ ETunerStateActive = 0x01,
+ /** The tuner is playing sound. */
+ ETunerStatePlaying = 0x02,
+ /** The tuner is currently recording. */
+ ETunerStateRecording = 0x04,
+ /** The tuner is currently retuning or searching for a new station. */
+ ETunerStateRetuning = 0x08,
+ };
+public:
+
+ /**
+ Factory function to create a new instance of the Tuner. Tuner access priority
+ setting is required to ensure that applications such as alarms using the radio
+ as an alarm sound are not prevented from doing so by other clients. Priority
+ setting is needed for audio output when accessing the sound device. Tuner is
+ ready for use on return from this function.
+
+ @param aObserver The observer object for receiving async completion callbacks
+ @param aTunerIndex An index from 0 to TunersAvailable() - 1 specifying the tuner
+ device to use.
+ @param aAccessPriority Tuner access priority value
+ @leave KErrNoMemory Out of memory
+ @leave KErrNotFound The specified tuner or tuner controller is not present
+ @return A pointer and ownership of the fully constructed CMMTunerUtility object
+ */
+ IMPORT_C static CMMTunerUtility* NewL(MMMTunerObserver& aObserver,
+ TTunerBand aBand,
+ TInt aTunerIndex,
+ CMMTunerUtility::TTunerAccessPriority aAccessPriority = ETunerAccessPriorityNormal);
+
+ IMPORT_C virtual ~CMMTunerUtility();
+
+
+
+ /**
+ Set the current tuner access priority of this client. This priority is used to
+ arbitrate between multiple tuner clients, determining who get control of the
+ tuner.
+
+ The platform security capability is MultimediaDD and a client with this capability
+ is allowed to set the priority in preference to a client with a lower capability.
+
+ @param aAccessPriority The new priority to use.
+ @capability MultimediaDD
+ @return A standard system error code.
+ */
+ IMPORT_C TInt SetPriority(TTunerAccessPriority aAccessPriority);
+
+ /**
+ Get the current tuner access priority of this client.
+
+ @param aAccessPriority A variable to which the current priority will be written.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetPriority(TTunerAccessPriority& aAccessPriority) const;
+
+
+ /**
+ Get the current state of the tuner.
+
+ @param aState A variable to set with the current state. Bits set according to
+ TTunerState.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetState(TUint32& aState) const;
+
+ /**
+ Indicates if the external antenna is currently attached or not. The tuner
+ capabilties should be queried to determine if the external antenna is required
+ to use the tuner or not; A value of false returned here does not necessarily
+ imply that the tuner cannot be used.
+
+ @param aAttached When this function returns, this will contain ETrue if and only
+ if an external antenna is attached.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt IsAntennaAttached(TBool& aAttached);
+
+ /**
+ Indicates if the device is currently in 'flight mode' or not. The tuner
+ capabilities should be queried to determine in the tuner can be used in flight
+ mode or not.
+
+ @param aFlightMode On return, this will have been set to ETrue if and only if
+ the device is in flight mode.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetFlightMode(TBool& aFlightMode) const;
+
+ /**
+ Tune the tuner to the required frequency specified in Hertz. This is an asynchronous
+ command and will result in a callback to MToTuneComplete or MToTunerError.
+
+ If the session does not currently have control of the tuner, a request for control
+ will be made. If control of the tuner is granted, a callback to MToTunerControlGranted
+ will occur. If not, there will be a callback to MtoTunerError with error value
+ KErrAccessDenied.
+
+ Once control of the tuner has been granted, it will be retained until either a
+ call to ReleaseTunerControl, or the session is preempted in which case there
+ will be a callback to MToTunerError with error value KErrAccessDenied.
+
+ @param aFrequency The frequency to tune to
+ @param aBand The band to which aFrequency belongs
+ */
+ IMPORT_C void Tune(TFrequency aFrequency);
+
+ /**
+ Find a radio station, starting at the start frequency and searching in the
+ direction specified (i.e. Up or down) the search is limited to the specified
+ band. If the session does not currently have control of the tuner, a request
+ for control will be made. If control of the tuner is granted, a callback to
+ MToTunerControlGranted will occur. If not, there will be a callback to MToTunerError
+ with error value KErrAccessDenied.
+
+ Once control of the tuner has been granted, it will be retained until either a
+ call to ReleaseTunerControl, or the session is preempted in which case there
+ will be a callback to MToTunerError with error value KErrAccessDenied.
+
+ A callback to MToTuneComplete will occur if the Seek is successful.
+
+ @param aBand The band
+ @param aSearchDirect The direction to search in
+ @param aCircularSeek If set to ETrue the station seek will loop back to the other
+ end of the band once the end of the band has been reached. (Defaults to ETrue)
+ If not set reaching the end of the band without finding a station will result
+ in a callback to MToTuneComplete with error KErrNotFound.
+ */
+ IMPORT_C void StationSeek(TSearchDirection aSearchDirection);
+
+ /**
+ Cancels an ongoing retune operation, as initiated by a call to Tune or StationSeek.
+ The usual callback will not occur if this has been called.
+
+ Has not affect if no tune or seek operation is ongoing.
+ */
+ IMPORT_C void CancelRetune();
+
+ /**
+ Makes a synchronous request for control of the tuner. If this method returns
+ KErrNone, control of the tuner has been granted. Control of the tuner is kept
+ until it is explically released using ReleaseTunerControl, or it is revoked
+ in which case a callback to MToTunerError with an error of KErrAccessDenied
+ will occur.
+
+ If this method returns with KErrAccessDenied, a request to recieve a
+ notifiaction when control could be granted can be made using
+ NotifyTunerControl.
+
+ Note that methods that require control of the tuner (such as Tune) will make
+ a request for control themselves if control has not already been granted.
+
+ @return A standard system error code. If control was granted, KErrNone, and if
+ control was denied KErrAccessDenied.
+ */
+ IMPORT_C TInt RequestTunerControl();
+
+ /**
+ Makes an asyncronous request for control of the tuner. This method should be
+ called after an control of the tuner has been denied to receive a notification
+ when control of the tuner can be granted. A callback to MToTunerControlGranted
+ will occur in this event.
+ */
+ IMPORT_C TInt NotifyTunerControl();
+
+ /**
+ Release control of the tuner, allowing other clients to tune it. Change
+ notifications may still be received. A request for control of the tuner can be
+ made again by calling RequestTunerControl, or any methods that require control
+ of the tuner.
+ */
+ IMPORT_C void ReleaseTunerControl();
+
+ /**
+ Release the tuner. Any ongoing playing or recording activity will be stopped,
+ control of the tuner will be released, and the hardware will be powered down if
+ no other clients need it.
+ */
+ IMPORT_C void Close();
+
+ /**
+ Retrieve the current frequency that the tuner is tuned to
+
+ @param aFrequency The variable to set to the current frequency,
+ -1 if channels are in use
+ @param aBand The variable used to set the current band.
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetFrequency(TFrequency& aFrequency) const;
+
+ /**
+ Retrieve the signal strenth of the currently tuned signal
+
+ @param aSignalStrength Variable into which the signal strength will be written.
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetSignalStrength(TInt& aSignalStrength) const;
+
+ /**
+ Get the maximum possible signal strength of a tuned signal.
+
+ @param aMaxSignalStrength A variable that will have the maximun signal strength
+ written to.
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetMaxSignalStrength(TInt& aMaxSignalStrength) const;
+
+ /**
+ Request notifications when the signal strength changes. Due to the potentially
+ short intervals at which the signal strength may change at, notifications will
+ only be sent when a relatively large change occurrs. This should allow a visual
+ display of signal strength to be maintained fairly accurately.
+
+ The first signal strength notification will be sent immediately after this
+ request.
+
+ @param aObserver The object which will receive notifications of signal strength
+ changes.
+ @return A standard system error code
+ */
+ IMPORT_C TInt NotifySignalStrength(MMMSignalStrengthObserver& aObserver);
+
+ /**
+ Cancel an outstanding NotifySignalStrength request.
+ */
+ IMPORT_C void CancelNotifySignalStrength();
+
+ /**
+ Find out if the current signal is being received in stereo or not.
+
+ @param aStereo On return, will be ETrue if and only if a stereo signal is
+ currently being received.
+ */
+ IMPORT_C TInt IsStereoSignal(TBool& aStereo);
+
+ /**
+ Request notifications when stereo reception is lost/restored.
+
+ @param aObserver The object requiring notification when a stereo signal is lost
+ or restored. The first notification will occur immediately.
+ @return A standard system error code
+ */
+ IMPORT_C TInt NotifyStereoChange(MMMTunerStereoObserver& aObserver);
+
+ /**
+ Cancels a stereo change notification request.
+ */
+ IMPORT_C void CancelNotifyStereoChange();
+
+ /**
+ Indicates whether the reception should be forced into monophonic mode.
+
+ @param aMono If ETrue, all reception will be in mono mode even if a stereo
+ signal is available. If EFalse, a stereo signal will be received when
+ possible.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt ForceMonoReception(TBool aMono);
+
+ /**
+ Find out whether reception is forced into monophonic mode or not.
+
+ @param aMono This will be set to ETrue if all reception is forced to be mono. If
+ this is EFalse, this does not imply that stereo reception is currently
+ available.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetForcedMonoReception(TBool& aMono) const;
+
+ /**
+ Sets the current squleching (muting in frequencies without reception) setting.
+
+ @param aEnabled ETrue to enable squelching, EFalse to disable it.
+ @return KErrNone if successful, else a system wide error code.
+ */
+ IMPORT_C TInt SetSquelch(TBool aEnabled);
+
+ /**
+ Gets the current squleching (muting in frequencies without reception) setting.
+
+ @param aEnabled This will be set to ETrue if squelching is enabled, EFalse otherwise.
+ @return KErrNone if successful, else a system wide error code.
+ */
+ IMPORT_C TInt GetSquelch(TBool& aEnabled) const;
+
+ /**
+ Get the capabilities of the tuner on the device
+
+ @param aCaps The capabilities object to fill
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetCapabilities(TTunerCapabilities& aCaps) const;
+
+ /**
+ Get the frequency range (in Hertz) of the specified band.
+ This function should be used to enquire the frequency range
+ of the bands that GetCapabilities reports as supported.
+
+ @param aBand The band to query
+ @param aBottomFrequency The variable to set to the lowest frequency allowed
+ @param aTopFrequency The variable to set to the highest frequency allowed
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetFrequencyBandRange(TFrequency& aBottomFrequency, TFrequency& aTopFrequency);
+
+ /**
+ Request to be notified when the tuned frequency or channel changes, or when the
+ tuner changes state (e.g. starts playing or recording)
+
+ @param aObserver The object wishing to receive tuning change events
+ @return A standard system error code
+ */
+ IMPORT_C TInt NotifyChange(MMMTunerChangeObserver& aObserver);
+
+ /**
+ Cancel request to be notified when the tuned frequency or channel changes
+ */
+ IMPORT_C void CancelNotifyChange();
+
+ /**
+ Send a synchronous custom command to the tuner.
+
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined by the first IPC argument
+ @param aArgs The IPC arguments to send to the tuner. The first of these
+ arguments must be the UID of the interface within the tuner to which the
+ command is destined, represented as an integer. Failure to set the first
+ argument properly will result in the command completing with
+ KErrNotSupported at best, but possibly the client being panicked.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs);
+
+ /**
+ Send an asynchronous custom command to the tuner.
+
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined by the first IPC argument
+ @param aArgs The IPC arguments to send to the tuner. The first of these
+ arguments must be the UID of the interface within the tuner to which the
+ command is destined, represented as an integer. Failure to set the first
+ argument properly will result in the command completing with
+ KErrNotSupported at best, but possibly the client being panicked.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ */
+ IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus);
+
+ /**
+ Get the Tuner Player Utility
+
+ @param aAccessPriority A variable to which the current priority will be written.
+ @return A standard system error code.
+ */
+ IMPORT_C CMMTunerAudioPlayerUtility* TunerPlayerUtilityL(MMMTunerAudioPlayerObserver& aObserver) ;
+ /**
+ Get the Tuner Recorder Utility
+
+ @param aAccessPriority A variable to which the current priority will be written.
+ @return A standard system error code.
+ */
+ IMPORT_C CMMTunerAudioRecorderUtility* TunerRecorderUtilityL(MMMTunerAudioRecorderObserver& aObserver) ;
+
+ /**
+ Get the Tuner Scanner Utility
+
+ @param aAccessPriority A variable to which the current priority will be written.
+ @return A standard system error code.
+ */
+ IMPORT_C CMMTunerScannerUtility* TunerScannerUtilityL() ;
+
+ /**
+ Get the Tuner Rds Utility
+
+ @param aAccessPriority A variable to which the current priority will be written.
+ @return A standard system error code.
+ */
+ IMPORT_C CMMRdsTunerUtility* TunerRdsUtilityL() ;
+
+private:
+ CMMTunerUtility();
+protected:
+ class CBody;
+private:
+ CBody* iBody;
+};
+
+/**
+The Tuner Observer mixin class defines asynchronous
+event completion function callbacks
+*/
+class MMMTunerObserver
+{
+public:
+ /**
+ Tune complete event. This event is asynchronous
+ and is received after a call to the Tune method.
+
+ @param aError A standard system error
+ */
+ virtual void MToTuneComplete(TInt aError) = 0;
+
+};
+
+/**
+The Tuner Change Observer mixin class defines the interface via which
+notification for changes to the tuned frequency, channel and other tuner
+state can be received. A client interested in these notifications
+should call the function CMMTunerUtility::NotifyChange.
+*/
+class MMMTunerChangeObserver
+{
+public:
+ /**
+ Called when the tuned frequency changes
+
+ @param aOldFrequency The frequency in use before the change
+ @param aNewFrequency The new tuned frequency
+ */
+ virtual void MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency) = 0;
+
+ /**
+ Called when the state of the tuner changes.
+
+ @param aOldState The old state. Bits are set according to TTunerState.
+ @param aNewState The new state. Bits are set according to TTunerState.
+ */
+ virtual void MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState) = 0;
+
+ /**
+ This function is called when an external antenna is detached from the device.
+ This does not necessarily indicate that the tuner can no longer be used; the
+ capabilities of the tuner indicate if the external antenna is required in order
+ to use the tuner.
+ */
+ virtual void MTcoAntennaDetached() = 0;
+
+ /**
+ This function is called when an external antenna is attached to the device. If
+ the antenna is required to use the tuner, this indicates that the tuner can be
+ used again.
+ */
+ virtual void MTcoAntennaAttached() = 0;
+
+ /**
+ This function is called when the device enters or leaves flight mode. If the tuner
+ cannot be used in flight mode when the device enters this mode, this indicates
+ that the tuner can no longer be used; the capabilities of the tuner indicate if
+ it can be used in flight mode or not.
+
+ @param aFlightMode ETrue if the device has just entered flight mode, EFalse if
+ flight mode has just been left.
+ */
+ virtual void FlightModeChanged(TBool aFlightMode) = 0;
+};
+
+/**
+The stereo observer mixin class defines the interface by which clients can be
+notified when a stereo signal is received/lost. An interested client should call
+the function CMMTunerUtility::NotifyStereoChange.
+*/
+class MMMTunerStereoObserver
+{
+public:
+ /**
+ Called when stereo reception is lost/restored.
+
+ @param aStereo If true, indicates that stereo reception has just been restored.
+ If false, indicates that stereo reception has just been lost.
+ */
+ virtual void MTsoStereoReceptionChanged(TBool aStereo) = 0;
+
+ /**
+ Called when a client enables/disabled forced mono reception.
+
+ @param aForcedMono ETrue if reception is forced to be mono, even when a stereo
+ signal is available.
+ */
+ virtual void MTsoForcedMonoChanged(TBool aForcedMono) = 0;
+};
+
+/**
+This mixin class should be derived from by clients wishing to receive
+notifications when the signal strength changes. Such a client should call
+function CMMTunerUtility::NotifySignalStrength.
+*/
+class MMMSignalStrengthObserver
+{
+public:
+ /**
+ Callback indicating that the signal strength has changed by an amount meriting
+ a notification.
+
+ @param aNewSignalStrength The new signal strength.
+ */
+ virtual void MssoSignalStrengthChanged(TInt aNewSignalStrength) = 0;
+};
+
+
+class MMMAudioResourceNotificationCallback;
+
+/**
+The Tuner Audio Player Utility is used to initiate and control playback of audio
+from the tuner.
+*/
+class CMMTunerAudioPlayerUtility : public CBase, public MCustomCommand
+{
+ friend class CMMTunerUtility::CBody;
+public:
+
+ IMPORT_C ~CMMTunerAudioPlayerUtility();
+
+ /**
+ Set-up the API for playing the output from tuner to the speaker asynchronously.
+ Calls MMMTunerAudioPlayerObserver::MTapoInitializeComplete on completion. This must be
+ called before Play.
+
+ @param aPriority Sound device priority value
+ @param aPref Sound device priority preference value
+ */
+ IMPORT_C void InitializeL(TInt aAudioPriority = EMdaPriorityNormal, TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
+
+ /**
+ Start playback of the tuner output. To stop playback, call Mute, or Stop if
+ play will not need to be restarted. InitializeL() must have already been
+ called, and a callback to MTapoInitializeComplete with an error of KErrNone must
+ have occurred; if this is not the case, this raises a TunerAudioPlay 1 panic.
+ */
+ IMPORT_C void Play();
+
+ /**
+ Mute or unmute playback.
+
+ Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
+
+ @param aMute ETrue to mute the audio, EFalse to unmute it.
+ @return A standard system error code
+ */
+ IMPORT_C TInt Mute(TBool aMute);
+
+ /**
+ Stop playback, and release the output device for use by other clients
+
+ Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
+
+ Playback should already be under way.
+ */
+ IMPORT_C void Stop();
+
+ /**
+ Set the current audio priority. This priority is used to arbitrate
+ between multiple audio sources trying to access the audio hardware.
+
+ @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax
+ @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
+
+ /**
+ Get the current audio priority. This is used to arbitrate between simultaneous
+ accesses to the sound hardware.
+
+ @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return
+ @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const;
+
+ /**
+ Set the volume to the specified level
+
+ Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
+
+ @param aVolume The volume level to set
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetVolume(TInt aVolume);
+
+ /**
+ Return the current volume
+
+ @param aVolume The variable to set to the current volume
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetVolume(TInt& aVolume) const;
+
+ /**
+ Define a volume ramp, aRampInterval defining
+ the interval between valid volume settings
+
+ Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
+
+ @param aRampInterval The time interval over which the volume
+ should be increased from zero to the current volume setting
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampInterval);
+
+ /**
+ Return the maximum volume supported
+
+ @return The maximum volume setting permitted
+ */
+ IMPORT_C TInt MaxVolume() const;
+
+ /**
+ Set the stereo balance between left and right channels
+
+ Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
+
+ @param aBalance The balance value to set - must be between
+ KMMFBalanceMaxLeft and KMMFBalanceMaxRight
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
+
+ /**
+ Return the current stereo balance
+
+ @param aBalance The variable to set to the current balance
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetBalance(TInt& aBalance) const;
+
+ /**
+ Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption
+ by a higher priority audio client.
+ */
+ IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL);
+
+ /**
+ Cancel an outstanding audio resource notification.
+ */
+ IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
+
+ /**
+ Returns the controller implementation information associated with the current controller, if any.
+
+ @return The controller implementation structure associated with the controller
+ @leave KErrNotFound if no controller is in use.
+ */
+ IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
+
+ /**
+ Send a synchronous custom command to the playback controller, if ones exists.
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2);
+
+ /**
+ Send a synchronous custom command to the playback controller, if ones exists.
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataFrom The area of memory to which the controller framework
+ will write any data to be passed back to the client. Can't be KNullDesC8.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom);
+
+ /**
+ Send an asynchronous custom command to the playback controller, if ones exists.
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ */
+ IMPORT_C void CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TRequestStatus& aStatus);
+
+ /**
+ Send an asynchronous custom command to the playback controller, if ones exists.
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataFrom The area of memory to which the controller framework
+ will write any data to be passed back to the client. Can't be KNullDesC8.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ */
+ IMPORT_C void CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom,
+ TRequestStatus& aStatus);
+
+protected:
+ /**
+ Factory function to create a new Tuner Audio Player utility. Note that only one audio player
+ utility may be created per instance of CMMTunerUtility. Multiple instances will result in an
+ error of KErrAlreadyExists when InitializeL() is called.
+
+ @param aTuner The tuner object which this utility will play the audio from.
+ @param aObserver The observer of the player utility to receive asychronous completion and
+ notifiction callbacks.
+ @leave KErrNoMemory Out of memory
+ @leave KErrNotSupported If the given tuner doesn't support audio playback.
+ @return A new tuner audio player utility.
+ */
+ static CMMTunerAudioPlayerUtility* NewL(CMMTunerUtility& aTuner, RRadioSession& aRadioSession, MMMTunerAudioPlayerObserver& aObserver);
+
+private:
+ CMMTunerAudioPlayerUtility();
+private:
+ class CBody;
+ CBody* iBody;
+};
+
+class MMMTunerAudioPlayerObserver
+{
+public:
+ /**
+ The TEvent enumeration is used to indicate which type of event is being sent to the client.
+ Each event will be associated with an error code and potentially some addition information,
+ and will be passed to the client via method MTapoPlayEvent().
+ */
+ enum TEventType
+ {
+ /** An event relating to the tuner itself. Any error other than KErrNone associated
+ with this event type may indicate that the tuner cannot be used anymore.
+
+ No additional information is associated with this type of event. */
+ ETunerEvent,
+ /**
+ An event relating to audio playback.
+
+ No additional information is associated with this type of event.
+ */
+ EAudioEvent
+ };
+public:
+ /**
+ Initialize complete event. This event is asynchronous and is received after
+ a call to CMMTunerAudioPlayerUtility::InitializeL().
+
+ @param aError A standard system error
+ */
+ virtual void MTapoInitializeComplete(TInt aError) = 0;
+
+ /**
+ Passes an asychronous event to the tuner client.
+
+ @param aEvent The type of event. See enumeration MMMTunerAudioPlayerObserver::TEventType
+ for more information about when the event types mean.
+ @param aError An error code associated with the event.
+ @param aAdditionalInfo Any additional information associated with the event, or NULL if
+ no such additional information exists.
+ */
+ virtual void MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0;
+};
+
+/**
+This class is used to perform recording of audio from the tuner. Many of the methods
+in this class have identical functionality to similarly names functions in class
+CMdaAudioRecorderUtility.
+*/
+class CMMTunerAudioRecorderUtility : public CBase
+{
+ friend class CMMTunerUtility::CBody;
+public:
+
+ IMPORT_C ~CMMTunerAudioRecorderUtility();
+
+ /**
+ Initialize for recording from the tuner to the specified file
+ asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion
+
+ @param aRecordFilename The name of the file to create, if necessary, and record to
+ @param "aDestinationDataType" Data type for recording
+ @param "aControllerUid" The Uid of the controller to use for recording
+ @param "aDestinationFormatUid" Uid of record format
+ @param aPriority Sound device priority value
+ @param aPref Sound device priority preference value
+ */
+ IMPORT_C void InitializeL(const TDesC& aRecordFilename,
+ TFourCC aDestinationDataType = KFourCCNULL,
+ TUid aControllerUid=KNullUid,
+ TUid aDestinationFormatUid=KNullUid,
+ TInt aAudioPriority = EMdaPriorityNormal,
+ TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
+
+ /**
+ Initialize for recording from the tuner to the specified descriptor
+ asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion
+
+ @param aRecordDescriptor The descriptor to record to
+ @param "aDestinationDataType" Data type for recording
+ @param "aControllerUid" The Uid of the controller to use for recording
+ @param "aDestinationFormatUid" Uid of record format
+ @param aPriority Sound device priority value
+ @param aPref Sound device priority preference value
+ */
+ IMPORT_C void InitializeL(TDes8& aRecordDescriptor,
+ TFourCC aDestinationDataType = KFourCCNULL,
+ TUid aControllerUid=KNullUid,
+ TUid aDestinationFormatUid=KNullUid,
+ TInt aAudioPriority = EMdaPriorityNormal,
+ TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
+
+ /**
+ Return a list of the supported data types for the record destination
+ @param "aSupportedDataTypes" list of four character codes, representing supported data
+ encodings for the record destination.
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const;
+
+ /**
+ Set the data type of the destination audio clip
+ @param "aDataType" four character code, representing the encoding of the destination audio clip
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void SetDestinationDataTypeL(TFourCC aDataType);
+
+ /**
+ Return the data type of the destination audio clip
+ @returns four character code, representing the encoding of the destination audio clip
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C TFourCC DestinationDataTypeL() const;
+
+ /**
+ Set the bit rate for recording
+ @param "aBitRate" destination bit rate in bits/second
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void SetDestinationBitRateL(TUint aBitRate);
+
+ /**
+ Return the recording bit rate
+ @returns destination bit rate in bits/second
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C TUint DestinationBitRateL() const;
+
+ /**
+ Return a list of the supported bit rates for recording
+ @param "aSupportedBitRates" List of bit rates supported for the record
+ destination
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void GetSupportedBitRatesL(RArray<TUint>& aSupportedBitRates) const;
+
+ /**
+ Set the sample rate for the record destination
+ @param "aSampleRate" The sample rate of the record destination
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void SetDestinationSampleRateL(TUint aSampleRate);
+
+ /**
+ Return the sample rate of the record destination
+ @returns The sample rate of the record destination
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C TUint DestinationSampleRateL() const;
+
+ /**
+ Get a list of supported recording sample rates.
+ @param "aSupportedSampleRates" List of the sample rates that are supported for
+ recording
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void GetSupportedSampleRatesL(RArray<TUint>& aSupportedSampleRates) const;
+
+ /**
+ Set the format of the audio clip. This can only be done if the audio clip does not
+ exist
+
+ @param "aFormatUid" Uid of the audio clip format
+ @leaves KErrAlreadyExists if the clip already exists and the format is different
+ from the existing format, or can leave with one of the system-wide error codes
+ */
+ IMPORT_C void SetDestinationFormatL(TUid aFormatUid);
+
+ /**
+ Return the format of the audio clip
+ @returns Uid of the audio clip format
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C TUid DestinationFormatL() const;
+
+ /**
+ Set the number of channels for the recorded audio clip
+ @param "aNumberOfChannels" The number of channels to record
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels);
+
+ /**
+ Return the number of channels in audio clip
+ @returns number of channels supported by audio clip
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C TUint DestinationNumberOfChannelsL() const;
+
+ /**
+ Return a list of the supported number of channels for recording
+ @param "aSupportedNumChannels" List of the number of channels supported for
+ recording
+ @leaves Can leave with one of the system-wide error codes
+ */
+ IMPORT_C void GetSupportedNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels) const;
+
+ /** Start recording of the tuner output */
+ IMPORT_C void RecordL();
+
+ /**
+ Pause recording. Recording can be resumed with another call to Record.
+
+ @return A standard system error code
+ */
+ IMPORT_C TInt PauseRecord();
+
+ /**
+ Stop recording, and release the output device for use by other clients
+
+ Recording should already be under way.
+ */
+ IMPORT_C void Stop();
+
+ /**
+ Stop recording, and release the output device for use by other clients
+
+ Recording should already be under way.
+ */
+ IMPORT_C void Close();
+
+ /**
+ Return the maximum value for the gain
+
+ @return The maximum gain. For devices where automatic gain control is used, this value may be zero.
+ */
+ IMPORT_C TInt MaxGain() const;
+
+ /**
+ Sets the gain for the audio device to a specified value.
+
+ @param aGain The gain setting. This can be any value from zero to the value returned by a call to
+ MaxGain(). A value which is less than zero is set to zero. A value which is greater than
+ MaxGain() is set to MaxGain().
+ */
+ IMPORT_C void SetGain(TInt aGain);
+
+ /**
+ Sets the current recording balance setting between the left and right stereo channels
+
+ The balance can be changed before or during recording and is effective immediately.
+
+ @param aBalance The balance value to set. Any value between KMMFBalanceMaxLeft and
+ KMMFBalanceMaxRight, the default value being KMMFBalanceCenter.
+ @return An error code indicating if the call was successful. KErrNone on success,
+ otherwise another of the system-wide error codes.
+ */
+ IMPORT_C TInt SetRecordBalance(TInt aBalance = KMMFBalanceCenter);
+
+ /**
+ Returns the current recording balance setting between the left and right stereo channels.
+
+ @param aBalance On return, contains the current recording balance between KMMFBalanceMaxLeft
+ and KMMFBalanceMaxRight.
+ @return An error code indicating if the call was successful. KErrNone on success, otherwise
+ another of the system-wide error codes.
+ */
+ IMPORT_C TInt GetRecordBalance(TInt& aBalance) const;
+
+ /**
+ Set the current audio priority. This priority is used to arbitrate
+ between multiple audio sources trying to access the audio hardware.
+
+ @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax
+ @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
+
+ /**
+ Get the current audio priority. This is used to arbitrate between simultaneous
+ accesses to the sound hardware.
+
+ @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return
+ @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const;
+
+ /**
+ Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption
+ by a higher priority audio client.
+ */
+ IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL);
+
+ /**
+ Cancel an outstanding audio resource notification.
+ */
+ IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
+
+
+ /**
+ Sets the maximum size for a file that is being recorded.
+
+ When this limit is reached, MMF stops recording and notifies the client application. Notification is caused
+ by MMdaObjectStateChangeObserver::MoscoStateChangeEvent() with the error code KErrEof.
+
+ This function is provided so that applications such as recorders can limit the amount of file storage/memory
+ that should be allocated.
+
+ @param aMaxWriteLength
+ The maximum file size in kilobytes. If the default value is used, there is no maximum file size.
+
+ */
+ IMPORT_C void SetMaxWriteLength(TInt aMaxWriteLength = KMdaClipLocationMaxWriteLengthNone);
+
+ /**
+ Returns the recording time available for the selected file or descriptor and encoding format.
+ */
+ IMPORT_C const TTimeIntervalMicroSeconds& RecordTimeAvailable();
+
+ /**
+ Returns the duration of the audio sample data.
+ */
+ IMPORT_C const TTimeIntervalMicroSeconds& Duration();
+
+ /**
+ Return the controller implementation information structure of the current controller
+
+ @leave KErrNoMemory Out of memory
+ @return A reference to the current controller information
+ */
+ IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
+
+ /*
+ Returns the number of meta data entries associated with this clip.
+ @return Number of metadata entries
+ */
+ IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
+
+ /*
+ Returns the specified meta data entry from the current audio clip.
+ @return Metadata entry
+ */
+ IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
+
+ /*
+ Adds a meta data entry to the audio clip.
+ */
+ IMPORT_C void AddMetaDataEntryL(CMMFMetaDataEntry& aMetaDataEntry);
+
+ /*
+ Removes a specified meta data entry from the audio clip
+ @return An error code indicating if the call was successful
+ */
+ IMPORT_C TInt RemoveMetaDataEntry(TInt aMetaDataIndex);
+
+ /*
+ Replaces the specified meta data entry with a new entry
+ */
+ IMPORT_C void ReplaceMetaDataEntryL(TInt aMetaDataIndex, CMMFMetaDataEntry& aMetaDataEntry);
+
+
+ /**
+ Send a synchronous custom command to the recording controller
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2);
+
+ /**
+ Send a synchronous custom command to the recording controller
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataFrom The area of memory to which the controller framework
+ will write any data to be passed back to the client. Can't be KNullDesC8.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom);
+
+ /**
+ Send an asynchronous custom command to the recording controller
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ @return A standard system error code
+ */
+ IMPORT_C void CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TRequestStatus& aStatus);
+
+ /**
+ Send an asynchronous custom command to the recording controller
+
+ @param aDestination The destination of the message, consisting of the uid of
+ the interface of this message
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined in the aDestination parameter
+ @param aDataTo1 The first chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataTo2 The second chunk of data to be copied to the controller
+ framework. The exact contents of the data are dependent on the
+ interface being called. Can be KNullDesC8.
+ @param aDataFrom The area of memory to which the controller framework
+ will write any data to be passed back to the client. Can't be KNullDesC8.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ @return A standard system error code
+ */
+ IMPORT_C void CustomCommandAsync(
+ const TMMFMessageDestinationPckg& aDestination,
+ TInt aFunction,
+ const TDesC8& aDataTo1,
+ const TDesC8& aDataTo2,
+ TDes8& aDataFrom,
+ TRequestStatus& aStatus);
+
+protected:
+ /**
+ Create a new audio recorder utility. Note that only one audio recorder utility may be created
+ per instance of CMMTunerUtility. Multiple instances will result in an error of KErrAlreadyExists
+ when InitializeL() is called.
+ */
+ static CMMTunerAudioRecorderUtility* NewL(CMMTunerUtility& aTuner, MMMTunerAudioRecorderObserver& aObserver);
+
+private:
+ CMMTunerAudioRecorderUtility();
+private:
+ class CBody;
+ CBody* iBody;
+
+};
+
+class MMMTunerAudioRecorderObserver
+{
+public:
+ /**
+ The TEvent enumeration is used to indicate which type of event is being sent to the client.
+ Each event will be associated with an error code and potentially some addition information,
+ and will be passed to the client via method MTaroRecordEvent().
+ */
+ enum TEventType
+ {
+ /** An event relating to the tuner itself. Any error other than KErrNone associated
+ with this event type may indicate that the tuner cannot be used anymore.
+
+ No additional information is associated with this type of event. */
+ ETunerEvent,
+ /**
+ An event relating to audio recording.
+
+ No additional information is associated with this type of event.
+ */
+ EAudioEvent
+ };
+public:
+ /**
+ Initialize complete event. This event is asynchronous and is received after
+ a call to CMMTunerAudioRecorderUtility::InitializeL.
+
+ @param aError A standard system error
+ */
+ virtual void MTaroInitializeComplete(TInt aError) = 0;
+
+ /**
+ Passes an asychronous event to the tuner client.
+
+ @param aEvent The type of event. See enumeration MMMTunerAudioRecorderObserver::TEventType
+ for more information about when the event types mean.
+ @param aError An error code associated with the event.
+ @param aAdditionalInfo Any additional information associated with the event, or NULL if
+ no such additional information exists.
+ */
+ virtual void MTaroRecordEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0;
+};
+
+/**
+This class augments CMMTunerUtility to provide station scanning functionality,
+whereby the frequency spectrum is searched, pausing for a specified amount of
+time when a station is found.
+*/
+class CMMTunerScannerUtility : public CBase
+{
+ friend class CMMTunerUtility::CBody;
+public:
+
+ IMPORT_C ~CMMTunerScannerUtility();
+
+ /**
+ Continuously scan for a radio station, pausing for the time specified before
+ continuing on to the next station. Call StopScan to select the currently tuned
+ station. The search is limited to the specified band.
+
+ @note The control of a CMMTunerUtility object must have been passed to this
+ class (using TransferTunerControl) before this function is called.
+
+ @param aBand The band to which aStartFrequency belongs
+ @param aSearchDirect The direction to search in
+ @param aPauseDuration Time to pause at each station
+ @param aCircularScan If set to ETrue the station scan will loop back to the other
+ end of the band once the end of the band has been reached. (Defaults to ETrue)
+ */
+ IMPORT_C void StationScan(CMMTunerUtility::TSearchDirection aSearchDirection,
+ TTimeIntervalMicroSeconds32 aPauseDuration
+ );
+
+ /**
+ Stop scanning and use the currently tuned station
+
+ @return ETrue if a station is tuned, EFalse otherwise
+ */
+ IMPORT_C TBool StopScan();
+
+protected:
+ /**
+ Factory function to create a new CMMTunerScannerUtility.
+
+ @param aTuner The tuner with which to perform the scanning.
+ @leave KErrNoMemory Out of memory.
+ @return A newly contructed tuner scanner utility.
+ */
+ static CMMTunerScannerUtility* NewL(CMMTunerUtility& aTuner,CMMTunerUtility::TTunerBand aBand);
+
+private:
+ CMMTunerScannerUtility();
+private:
+ class CBody;
+ CBody* iBody;
+
+};
+
+
+/** Programme Station name, 8 characters */
+typedef TBuf<8> TRdsStationName;
+/** Programme Type Name, 8 characters */
+typedef TBuf<8> TRdsProgrammeTypeName;
+/** RDS Programme Identifier, a unique ID for each radio station */
+typedef TInt TRdsProgrammeIdentifier;
+
+/**
+Programme Item Number - identifies the start time of the current programme,
+as published by the broadcaster.
+*/
+class TRdsProgrammeItemNumber
+{
+public:
+ /** The day of the month of the broadcast, in the range 1-31 */
+ TInt iDayOfMonth;
+ /** The hour of the day, in the range 0-23 */
+ TInt iHour;
+ /** The minute past the hour, in the range 0-59 */
+ TInt iMinute;
+public:
+ inline TInt operator==(const TRdsProgrammeItemNumber& aPin) const;
+ inline TInt operator!=(const TRdsProgrammeItemNumber& aPin) const;
+};
+
+/**
+An RDS extended country code. The meaning of a value of this type is defined
+by the RDS specification, IEC62106.
+*/
+typedef TInt TRdsCountryCode;
+
+/**
+An RDS language identification code. The meaning of a value of this type is
+defined by the RDS specification, IEC62106.
+*/
+typedef TInt TRdsLanguageIdentifier;
+
+/**
+RDS Programme Type.
+
+The interpretation of values of this type depends on the origin of the RDS
+broadcast: in North America, a slightly different standard, RBDS, is used.
+These PTY codes are defined by static values KRbdsPtyXxxxx, for example
+KRbdsPtySoftRock.
+
+Elsewhere, including Europe, the RDS standard is used. In these areas, the
+PTY codes are defined by static values KRdsPtyXxxxx, for example
+KRdsPtyChildrensProgrammes.
+
+In all other important aspects, the European RDS and North American RBDS
+standards are identical.
+*/
+typedef TInt TRdsProgrammeType;
+
+/** No programme type or undefined */
+const static TRdsProgrammeType KRdsPtyNone = 0;
+/** News */
+const static TRdsProgrammeType KRdsPtyNews = 1;
+/** CurrentAffairs */
+const static TRdsProgrammeType KRdsPtyCurrentAffairs = 2;
+/** Information */
+const static TRdsProgrammeType KRdsPtyInformation = 3;
+/** Sport */
+const static TRdsProgrammeType KRdsPtySport = 4;
+/** Education */
+const static TRdsProgrammeType KRdsPtyEducation = 5;
+/** Drama */
+const static TRdsProgrammeType KRdsPtyDrama = 6;
+/** Culture */
+const static TRdsProgrammeType KRdsPtyCulture = 7;
+/** Science */
+const static TRdsProgrammeType KRdsPtyScience = 8;
+/** VariedSpeech */
+const static TRdsProgrammeType KRdsPtyVariedSpeech = 9;
+/** PopMusic */
+const static TRdsProgrammeType KRdsPtyPopMusic = 10;
+/** RockMusic */
+const static TRdsProgrammeType KRdsPtyRockMusic = 11;
+/** EasyListening */
+const static TRdsProgrammeType KRdsPtyEasyListening = 12;
+/** LightClassical */
+const static TRdsProgrammeType KRdsPtyLightClassical = 13;
+/** SeriousClassics */
+const static TRdsProgrammeType KRdsPtySeriousClassical = 14;
+/** OtherMusic */
+const static TRdsProgrammeType KRdsPtyOtherMusic = 15;
+/** Weather */
+const static TRdsProgrammeType KRdsPtyWeather = 16;
+/** Finance */
+const static TRdsProgrammeType KRdsPtyFinance = 17;
+/** ChildrensProgrammes */
+const static TRdsProgrammeType KRdsPtyChildrensProgrammes = 18;
+/** SocialAffairs */
+const static TRdsProgrammeType KRdsPtySocialAffairs = 19;
+/** Religion */
+const static TRdsProgrammeType KRdsPtyReligion = 20;
+/** PhoneIn */
+const static TRdsProgrammeType KRdsPtyPhoneIn = 21;
+/** Travel */
+const static TRdsProgrammeType KRdsPtyTravel = 22;
+/** Leisure */
+const static TRdsProgrammeType KRdsPtyLeisure = 23;
+/** JazzMusic */
+const static TRdsProgrammeType KRdsPtyJazzMusic = 24;
+/** CountryMusic */
+const static TRdsProgrammeType KRdsPtyCountryMusic = 25;
+/** NationalMusic */
+const static TRdsProgrammeType KRdsPtyNationalMusic = 26;
+/** OldiesMusic */
+const static TRdsProgrammeType KRdsPtyOldiesMusic = 27;
+/** FolkMusic */
+const static TRdsProgrammeType KRdsPtyFolkMusic = 28;
+/** Documentary */
+const static TRdsProgrammeType KRdsPtyDocumentary = 29;
+/** AlarmTest */
+const static TRdsProgrammeType KRdsPtyAlarmTest = 30;
+/** Alarm */
+const static TRdsProgrammeType KRdsPtyAlarm = 31;
+
+
+/** No programme type or undefined */
+const static TRdsProgrammeType KRbdsPtyNone = 0;
+/** News */
+const static TRdsProgrammeType KRbdsPtyNews = 1;
+/** Informaion */
+const static TRdsProgrammeType KRbdsPtyInformation = 2;
+/** Sports */
+const static TRdsProgrammeType KRbdsPtySports = 3;
+/** Talk */
+const static TRdsProgrammeType KRbdsPtyTalk = 4;
+/** Rock */
+const static TRdsProgrammeType KRbdsPtyRock = 5;
+/** Classic Rock */
+const static TRdsProgrammeType KRbdsPtyClassicRock = 6;
+/** Adult Hits */
+const static TRdsProgrammeType KRbdsPtyAdultHits = 7;
+/** Soft Rock */
+const static TRdsProgrammeType KRbdsPtySoftRock = 8;
+/** Top 40 */
+const static TRdsProgrammeType KRbdsPtyTop40 = 9;
+/** Country */
+const static TRdsProgrammeType KRbdsPtyCountry = 10;
+/** Oldies */
+const static TRdsProgrammeType KRbdsPtyOldies = 11;
+/** Soft */
+const static TRdsProgrammeType KRbdsPtySoft = 12;
+/** Nostalgia */
+const static TRdsProgrammeType KRbdsPtyNostalgia = 13;
+/** Jazz */
+const static TRdsProgrammeType KRbdsPtyJazz = 14;
+/** Classical */
+const static TRdsProgrammeType KRbdsPtyClassical = 15;
+/** Rhythm and Blues */
+const static TRdsProgrammeType KRbdsPtyRhythmAndBlues = 16;
+/** Soft Rhythm and Blues */
+const static TRdsProgrammeType KRbdsPtySoftRhythmAndBlues = 17;
+/** Language */
+const static TRdsProgrammeType KRbdsPtyLanguage = 18;
+/** Religious Music */
+const static TRdsProgrammeType KRbdsPtyReligiousMusic = 19;
+/** Religious Talk */
+const static TRdsProgrammeType KRbdsPtyReligiousTalk = 20;
+/** Personality */
+const static TRdsProgrammeType KRbdsPtyPersonality = 21;
+/** Public */
+const static TRdsProgrammeType KRbdsPtyPublic = 22;
+/** College */
+const static TRdsProgrammeType KRbdsPtyCollege = 23;
+/** Unassigned */
+const static TRdsProgrammeType KRbdsPtyUnassigned1 = 24;
+/** Unassigned */
+const static TRdsProgrammeType KRbdsPtyUnassigned2 = 25;
+/** Unassigned */
+const static TRdsProgrammeType KRbdsPtyUnassigned3 = 26;
+/** Unassigned */
+const static TRdsProgrammeType KRbdsPtyUnassigned4 = 27;
+/** Unassigned */
+const static TRdsProgrammeType KRbdsPtyUnassigned5 = 28;
+/** Weather */
+const static TRdsProgrammeType KRbdsPtyWeather = 29;
+/** Emergency Test */
+const static TRdsProgrammeType KRbdsPtyEmergencyTest = 30;
+/** Emergency */
+const static TRdsProgrammeType KRbdsPtyEmergency = 31;
+
+/**
+The RDS Capabilities class defines the capabilities of the RDS tuner on the
+device, as retrieved using the function GetRdsCapabilities.
+*/
+class TRdsCapabilities
+{
+public:
+ /** RDS Function Bit Flags */
+ enum TRdsFunctions
+ {
+ /** Traffic Announcement */
+ ERdsFunctionTa = 0x01,
+ /** Regional Links */
+ ERdsFunctionRegLink = 0x02,
+ /** News Announcement */
+ ERdsFunctionNa = 0x04,
+ /** Programme Type */
+ ERdsFunctionPty = 0x08,
+ /** Clock Time */
+ ERdsFunctionCt = 0x10,
+ /** Enhanced Other Networks */
+ ERdsFunctionEon = 0x20,
+ /** Alternative Frequency */
+ ERdsFunctionAf = 0x40
+ };
+public:
+ /** Bitfield as defined by ERdsFunctions with the bits of the supported functions set */
+ TUint32 iRdsFunctions;
+};
+
+class MMMRdsDataObserver;
+class MMMRdsEonObserver;
+class MMMRdsStateChangeObserver;
+class MMMRdsAnnouncementObserver;
+
+/**
+This class represents the basic RDS data associated with an RDS station.
+*/
+class TRdsData
+{
+public:
+ inline TRdsData();
+public:
+ /**
+ Enumeration to indicate a subset of the members of class TRdsData. These values should
+ be bitwise or'ed together to indicate which members belong in a set.
+ */
+ enum TField
+ {
+ /** Indicates the the member iPi is in a set */
+ EProgrammeIdentifier = 0x001,
+ /** Indicates the the member iPs is in a set */
+ EStationName = 0x002,
+ /** Indicates the the member iTp is in a set */
+ ETrafficProgramme = 0x004,
+ /** Indicates the the member iTa is in a set */
+ ETrafficAnnouncement = 0x008,
+ /** Indicates the the member iPty is in a set */
+ EProgrammeType = 0x010,
+ /** Indicates the the member iPtyn is in a set */
+ EProgrammeTypeName = 0x020,
+ /** Indicates the the member iPin is in a set */
+ EProgrammeItemNumber = 0x040,
+ /** Indicates the the member iMs is in a set */
+ EMusicSpeech = 0x080,
+ /** Indicates the the member iBroadcastLanguage is in a set */
+ EBroadcastLanguage = 0x100,
+ /** Indicates the the member iEcc is in a set */
+ EExtendedCountryCode = 0x200
+ };
+ /**
+ A value indicating a set containig all RDS data encapsulated by class TRdsData.
+ */
+ const static TUint32 KAllRdsData = (EProgrammeIdentifier | EStationName | ETrafficProgramme | ETrafficAnnouncement
+ | EProgrammeType | EProgrammeTypeName | EProgrammeItemNumber | EMusicSpeech
+ | EBroadcastLanguage | EExtendedCountryCode);
+public:
+ /** Programme Identifier of the station */
+ TRdsProgrammeIdentifier iPi;
+ /** Programme Station name of the station */
+ TRdsStationName iPs;
+ /** Value of the Traffic Programme flag of the station */
+ TBool iTp;
+ /** Value of the Traffic Announcement flag of the station */
+ TBool iTa;
+ /** Programme Type of the station */
+ TRdsProgrammeType iPty;
+ /** Programme Type Name of the station */
+ TRdsProgrammeTypeName iPtyn;
+ /** Programme Item Number of the station */
+ TRdsProgrammeItemNumber iPin;
+ /** Value of the Music Speech flag of the station. EFalse indicates the speech is being
+ broadcast at present. ETrue indicates that music is being broadcast, or that the flag is
+ not in use by the broadcaster. */
+ TBool iMs;
+ /** The current language of the broadcast */
+ TRdsLanguageIdentifier iBroadcastLanguage;
+ /** The Extended Country Code of the station */
+ TRdsCountryCode iEcc;
+};
+
+/**
+Class representing a station broadcast as an Enhanced Other Networks station.
+*/
+class TEonStation
+{
+public:
+ /**
+ Enumeration to indicate a subset of the members of class TEonStation. These values should
+ be bitwise or'ed together to indicate which members belong in a set.
+ */
+ enum TField
+ {
+ /** Indicates that member iProgrammeIdentifier is valid. */
+ EProgrammeIdentifier= 0x01,
+ /** Indicates that member iStationName is valid. */
+ EStationName = 0x02,
+ /** Indicates that member iProgrammeType is valid. */
+ EProgrammeType = 0x04,
+ /** Indicates that member iTrafficProgramme is valid. */
+ ETrafficProgramme = 0x08,
+ /** Indicates that member iTrafficAnnouncement is valid. */
+ ETrafficAnnouncement= 0x10,
+ /** Indicates that member iProgrammeItemNumber is valid. */
+ EProgrammeItemNumber= 0x20,
+ /** Indicates that member iNoFrequencies is valid. */
+ ENoFrequencies = 0x40,
+ /** Indicates that member iNoMappedFrequencies is valid. */
+ ENoMappedFrequencies= 0x80
+ };
+public:
+ /** The unique identifier of this station */
+ TRdsProgrammeIdentifier iProgrammeIdentifier;
+ /** The textual name of this station */
+ TRdsStationName iStationName;
+ /** The current programme type (PTY) of this station */
+ TRdsProgrammeType iProgrammeType;
+ /** Indicates if this station broadcasts traffic programmes */
+ TBool iTrafficProgramme;
+ /** Indicates if this station is currently broadcasting a traffic announcement */
+ TBool iTrafficAnnouncement;
+ /** The programme item number (PIN) of the current broadcast on this station. */
+ TRdsProgrammeItemNumber iProgrammeItemNumber;
+ /**
+ The number of frequencies associated with this station. If this number is zero,
+ it may be that the EON station uses the mapped frequencies method instead. See
+ iNoMappedFrequencies.
+ */
+ TInt iNoFrequencies;
+ /**
+ The number of mapped frequencies associated with this station. If this number is
+ zero, it may be that the EON station uses a flat frequency list instead. See
+ iNoFrequencies.
+ */
+ TInt iNoMappedFrequencies;
+ /**
+ Indicates the subset of fields of the class that are valid. Bits are set according to enumeration
+ TEonStation::TField
+ */
+ TUint32 iValid;
+};
+
+/**
+Mapped frequencies can be broadcast as a part of the EON information. They relate the
+current tuning frequency with the frequency which the referred EON station will be
+broadcast on.
+*/
+class TEonMappedFrequency
+{
+public:
+ inline TEonMappedFrequency(TFrequency aTuningFrequency, TFrequency aMappedFrequency);
+public:
+ /** The current tuning frequency, relating to the station broadcasting the EON informarion. */
+ TFrequency iTuningFrequency;
+ /**
+ The mapped frequency. If iTunedFrequency matches the currently tuned frequency, the
+ EON station will be broadcast on this frequency.
+ */
+ TFrequency iMappedFrequency;
+};
+
+/**
+The RDS class augments the tuner API to give access to the RDS capabilities
+of the device. As such additional tuner technologies can be supported without
+changing the Tuner API.
+
+Note that despite this class being names 'RDS', it is capable of supporting both
+the RDS standard, and the North American equivilant RBDS. The only important difference
+from the APIs perspective is the interpretation of the Programme Type (PTY) codes. See
+TRdsProgrammeType for more information.
+*/
+class CMMRdsTunerUtility : public CBase
+{
+ friend class CMMTunerUtility::CBody;
+public:
+ /** RDS Announcement Type */
+ enum TAnnouncementType
+ {
+ /** Traffic announcement */
+ ERdsTrafficAnnouncement,
+ /** News announcement */
+ ERdsNewsAnnouncement
+ };
+public:
+ /**
+ Factory function to create a new instance of the RDS Tuner API
+
+ @param aTuner A RDS capable tuner object (check using CMMTunerUtility::GetCapabilities())
+ @param aObserver The observer of the tuner to receive asynchronous completion messages.
+ @leave KErrNoMemory Out of memory
+ @leave KErrNotFound CMMRdsTunerUtility object is not present
+ @leave KErrNotSupported RDS is not supported by the tuner
+ @return A pointer and ownership of a fully constructed CMMRdsTunerUtility object
+ */
+ IMPORT_C static CMMRdsTunerUtility* NewL(CMMTunerUtility& aTuner, MMMTunerObserver& aObserver, CMMTunerUtility::TTunerBand aBand);
+
+ IMPORT_C ~CMMRdsTunerUtility();
+
+ /**
+ Get the RDS capabilities of the device
+
+ @param aCaps The capabilities object to fill
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetRdsCapabilities(TRdsCapabilities& aCaps) const;
+
+ /**
+ Find a radio station which contains RDS data starting at the start frequency
+ and searching in the direction specified (i.e. Up or down).
+
+ @note this function is subject to the same access control scheme as the Tune
+ methods of CMMTunerUtility
+
+ @param aStartFrequency The frequency to start searching from, or 0 to start at the
+ beginning of the stated band.
+ @param aBand The frequency band to search. This must be a FM band.
+ @param aSearchDirection The direction to search in
+ @param aCircularSeek If set to ETrue the station seek will loop back to the
+ other end of the band once the end of the band has been reached.
+ (Defaults to ETrue) If not set reaching the end of the band without
+ finding a station will result in a callback to MToTuneComplete with error
+ KErrNotFound.
+ */
+ IMPORT_C void StationSearchByRds(TFrequency aStartFrequency,
+ CMMTunerUtility::TSearchDirection aSearchDirection
+ );
+
+ /**
+ Find a radio station, of the specified programme type starting at the start
+ frequency and searching in the direction specified (i.e. Up or down).
+
+ @note this function is subject to the same access control scheme as the Tune
+ methods of CMMTunerUtility
+
+ @param aProgType The type of programme to search for
+ @param aStartFrequency The frequency to start searching from, or 0 to start at the
+ beginning of the stated band.
+ @param aBand The frequency band to search. This must be a FM band.
+ @param aSearchDirection The direction to search in
+ @param aCircularSeek If set to ETrue the station seek will loop back to the
+ other end of the band once the end of the band has been reached.
+ (Defaults to ETrue) If not set reaching the end of the band without
+ finding a station will result in a callback to MToTuneComplete with error
+ KErrNotFound.
+ */
+ IMPORT_C void StationSearchByProgrammeType(
+ TRdsProgrammeType aProgType,
+ TFrequency aStartFrequency,
+ CMMTunerUtility::TSearchDirection aSearchDirection
+ );
+
+ /**
+ Find a radio station, with the specified programme identifier starting at the
+ start frequency and searching in the direction specified (i.e. Up or down).
+
+ @note this function is subject to the same access control scheme as the Tune
+ methods of CMMTunerUtility
+
+ @param aPi The programme identifier of the station to search for
+ @param aStartFrequency The frequency to start searching from, or 0 to start at the
+ beginning of the stated band.
+ @param aBand The frequency band to search. This must be a FM band.
+ @param aSearchDirection The direction to search in
+ @param aCircularSeek If set to ETrue the station seek will loop back to the other
+ end of the band once the end of the band has been reached. (Defaults to ETrue)
+ If not set reaching the end of the band without finding a station will result
+ in a callback to MToTuneComplete with error KErrNotFound.
+ */
+ IMPORT_C void StationSearchByProgrammeIdentifier(
+ TRdsProgrammeIdentifier aPi,
+ TFrequency aStartFrequency,
+ CMMTunerUtility::TSearchDirection aSearchDirection
+ );
+
+ /**
+ Find a radio station, with the specified traffic programme flag value starting at
+ the start frequency and searching in the direction specified (i.e. Up or down).
+
+ @note this function is subject to the same access control scheme as the Tune
+ methods of CMMTunerUtility
+
+ @param aTp The TP flag value of a station to search for
+ @param aStartFrequency The frequency to start searching from, or 0 to start at the
+ beginning of the stated band.
+ @param aBand The frequency band to search. This must be a FM band.
+ @param aSearchDirection The direction to search in
+ @param aCircularSeek If set to ETrue the station seek will loop back to the other
+ end of the band once the end of the band has been reached. (Defaults to ETrue)
+ If not set reaching the end of the band without finding a station will result
+ in a callback to MToTuneComplete with error KErrNotFound.
+ */
+ IMPORT_C void StationSearchByTrafficProgramme(
+ TBool aTp,
+ TFrequency aStartFrequency,
+ CMMTunerUtility::TSearchDirection aSearchDirection
+ );
+
+ /**
+ Cancels an ongoing RDS search as initiated by one of the functions
+ StationSearchByRds, StationSearchByProgrammeType,
+ StationSearchByProgrammeIdentifier or StationSearchByTrafficProgramme. The
+ asynchronous callback will not occur if this is called.
+
+ Has not affect if no RDS search operation is ongoing.
+ */
+ IMPORT_C void CancelRdsSearch();
+
+ /**
+ Requests notifications when all RDS data become invalid due to the tuner being
+ retuned.
+
+ @param aObserver The client to be notified.
+ @param aWhichData The subset of data for which change notifications are required.
+ @return A standard system wide error code.
+ */
+ IMPORT_C TInt NotifyRdsDataChange(MMMRdsDataObserver& aObserver, TUint32 aWhichData = TRdsData::KAllRdsData);
+
+ /**
+ Cancel a NotifyRdsDataChange request.
+ */
+ IMPORT_C void CancelNotifyRdsDataChange();
+
+ /**
+ Request some RDS data. This will complete immediately with whatever RDS data have already been
+ received.
+
+ When this function returns, and data that was requested but is not indicated to be
+ valid can be assumed not to have been received.
+
+ @param aData The RDS data will be written to this variable.
+ @param aValid On return, indicates a subset of RDS data that are valid.
+ @param aWhichData The subset of RDS data that are being requested.
+ @return A standard system wide error code.
+ */
+ IMPORT_C TInt GetRdsData(TRdsData& aData, TUint32& aValid, TUint32 aWhichData = TRdsData::KAllRdsData) const;
+
+ /**
+ Converts an RDS language identifier into a Symbian TLanguage type. Note that not all
+ languages defined by the RDS specification IEC62106 are present in the TLanguage
+ enumeration; in these cases, a value of ELangOther will be returned.
+
+ @param aRdsLangId An RDS language identification code
+ @return The corresponding TLanguage member, or ELangOther if none exists.
+ */
+ IMPORT_C static TLanguage ConvertRdsLanguageId(TRdsLanguageIdentifier aRdsLangId);
+
+ /**
+ Get the length of the available radio text. If no radio text is available this
+ function will return KErrNotFound. The maximum possible length for radio text is 64 characters.
+
+ @param aLength The variable to set to the length of the avaiable radio text
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetRadioTextLength(TUint& aLength) const;
+
+ /**
+ Get the radio text. If no radio text is available, this will return KErrNotFound. In this
+ case, a client can call NotifyRadioText to receive a notification when it is received.
+
+ The radio text will have been converted to unicode, eliminating any control characters
+ within it.
+
+ @param aRadioText The descriptor to fill with the radio text
+ @return A standard system error code
+ */
+ IMPORT_C TInt GetRadioText(TDes& aRadioText) const;
+
+ /**
+ Request notification when the radio text is received or changes.
+
+ @param aObserver The client to be notified when the radio text is received or changes.
+ @return A standard system wide error code.
+ */
+ IMPORT_C TInt NotifyRadioText(MMMRdsDataObserver& aObserver);
+
+ /**
+ Cancel a NotifyRadioText request.
+ */
+ IMPORT_C void CancelNotifyRadioText();
+
+ /**
+ Turns regional link function on or off depending on the value of the parameter.
+ A value of ETrue should be passed if you wish to stay tuned to the currently
+ tuned local station regardless of signal quality and signal strength.
+ i.e. don't switch to another local station in the region.
+
+ @param aRegOn ETrue to turn regional link on, EFalse to turn it off
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetRegionalLink(TBool aRegOn);
+
+ /**
+ Finds out if the regional link function is currently on or off.
+
+ @param aRegOn This will be set to ETrue on return if and only if the regional
+ link function is currently enabled.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetRegionalLink(TBool& aRegOn) const;
+
+ /**
+ Turn the travel announcement function on or off depending on the value of the
+ parameter. A value of ETrue turns on Traffic Announcements, EFalse turns them off.
+
+ If Traffic announcements are disabled while the tuner is retuned to a traffic
+ announcement, the tuner will not revert to the original frequency. To revert to
+ the original frequency, StopAnnouncement() must be called before the traffic
+ announcement feature is disabled.
+
+ @param aTaOn ETrue to turn TA on, EFalse to turn it off
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetTrafficAnnouncement(TBool aTaOn);
+
+ /**
+ Finds out if the traffic announcement function is currently enabled or not.
+
+ @param aTaOn This is set to ETrue on return if and only if the traffic
+ announcement function is currenly enabled.
+ */
+ IMPORT_C TInt GetTrafficAnnouncement(TBool& aTaOn) const;
+
+ /**
+ Set the absolute volume to apply during a traffic or news announcement.
+
+ @param aVolume The volume to use. Must be between 0 and MaxVolume.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt SetAnnouncementVolume(TInt aVolume);
+
+ /**
+ Find the current absolute volume level used for news of traffic annoucements.
+
+ @param aVolume This will be set to the current volume used for annoucements.
+ @return A standard system error code, KErrNotFound if a annoucement volume offset has been set.
+ use.
+ */
+ IMPORT_C TInt GetAnnouncementVolume(TInt& aVolume) const;
+
+ /**
+ Set the offset to the system volume level to apply during a traffic or news announcement
+
+ @param aVolumeOffset The offset to the volume level to set for announcements. Must be between -MaxVolume and MaxVolume inclusive.
+ the actual volume with the offset applied will be clipped between 0 and MaxVolume if the offset would
+ otherwise result in a volume outside this range.
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetAnnouncementVolumeOffset(TInt aVolumeOffset);
+
+ /**
+ Find the current offset of the system volume that applies during traffic and news announcements.
+
+ @param aVolumeOffset This will be set to the current traffic and news announcement offset on return.
+ @return A standard system error code, KErrNotFound if an absolute annoucement volume has been set.
+ */
+ IMPORT_C TInt GetAnnouncementVolumeOffset(TInt& aVolumeOffset) const;
+
+ /**
+ Turn the news announcement function on or off depending on the value of the
+ parameter. The news announcement function when enabled causes the radio to
+ retune to a station when that station is broadcasting a news report. When the
+ news announcement is finished the radio will tune back to the original station.
+ A value of ETrue turns on News Announcements, EFalse turns them off.
+
+ If News announcements are disabled while the tuner is retuned to a news
+ announcement, the tuner will not revert to the original frequency. To revert to
+ the original frequency, StopAnnouncement() must be called before the news
+ announcement feature is disabled.
+
+ @param aNaOn ETrue to turn NA on, EFalse to turn it off
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetNewsAnnouncement(TBool aNaOn);
+
+ /**
+ Finds out whether the news announcement function is on or off.
+
+ @param aNaOn This will be set to ETrue if and only if the new announcement
+ function is currently on.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetNewsAnnouncement(TBool& aNaOn) const;
+
+ /**
+ Cancels any current announcement, reverting to the original frequency. The announcement
+ feature will remain enabled. If no announcement is currently happening, this function
+ has no affect. This can be used for both News and Traffic announcements.
+
+ @return A standard system error code. KErrNone if an announcement was successfully
+ stopped, or KErrNotReady if no announcement is currently happening.
+ */
+ IMPORT_C TInt StopAnnouncement();
+
+ /**
+ Turns alternative frequency function on or off depending on the value of the parameter.
+ A value of ETrue should be passed if you wish to enable automatic retuning to the current
+ station on an alternative frequency.
+
+ @param aAfOn ETrue to turn alternative frequency on, EFalse to turn it off
+ @return A standard system error code
+ */
+ IMPORT_C TInt SetAlternativeFrequency(TBool aAfOn);
+
+ /**
+ Finds out whether the alternative frequency function is on or off.
+
+ @param aAfOn This will be set to ETrue if and only if the alternative frequency
+ function is currently on.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt GetAlternativeFrequency(TBool& aAfOn) const;
+
+ /**
+ Requests a notification when RDS functionality is enabled or disabled, or when
+ the traffic announcement volume offset is changed.
+
+ @param aObserver The class which is to be notified of the changes.
+ @return A standard system error code.
+ */
+ IMPORT_C TInt NotifyRdsStateChange(MMMRdsStateChangeObserver& aObserver);
+
+ /**
+ Cancels an outstanding RDS state change notification request.
+ */
+ IMPORT_C void CancelNotifyRdsStateChange();
+
+ /**
+ Get the current RDS time. This is an asynchronous function due to the latency of
+ the RDS information becoming available. This information is broadcast at the start of
+ every minute, and is not cached for obvious reasons. Thus, whenever a request is made,
+ it will complete next time the Data and Time are broadcast. The RDS standard states
+ that this is broadcast within 0.1s of the start of a minute, and is accurate to one
+ minute. The latency of the notification reaching the application cannot be guarteed.
+
+ @param aTimeAndDate The variable to set to the current RDS time and date
+ @param aStatus A TRequestStatus. This will be signalled when the request completes
+ and will contain the result of the request, this will be one of the system error codes.
+ */
+ IMPORT_C void GetRdsTime(TPckg<TDateTime>& aTimeAndDate, TRequestStatus& aStatus) const;
+
+ /**
+ Cancel the GetRdsTime request
+ */
+ IMPORT_C void CancelGetRdsTime();
+
+ /**
+ Request notification when a retune caused by an announcement occurs. This will be
+ a traffic or news announcement. A notification will be provided both at
+ the start of the announcement and at the end.
+
+ @param aObserver The object wishing to receive announcement events
+ @return A standard system error code
+ */
+ IMPORT_C TInt NotifyAnnouncement(MMMRdsAnnouncementObserver& aObserver);
+
+ /**
+ Cancel the NotifyAnnouncement request
+ */
+ IMPORT_C void CancelNotifyAnnouncement();
+
+ /**
+ Returns a list containing information about other networks broadcast with the currently tuned
+ programmme. This call will return immediately with whatever EON information is currently available.
+ Note that is is possible for this function to return no EON stations when several are being broadcast
+ simply because not enough RDS frames have been received yet. An interested application should make a
+ call to NotifyEonInfo to receive notifications when EON information is received or changes.
+
+ @param aEonInfo An array to which the EON information will be appended.
+ */
+ IMPORT_C void GetEonInfoL(RArray<TEonStation>& aEonInfo) const;
+
+ /**
+ Gets the frequencies assoicated with an EON station. This will complete immediately with whatever
+ frequencies are currently cached. An interested application should make a call to NotifyEonChange
+ to receive notifications when more frequencies are received.
+
+ @param aEonStation the EON station to get the frequencies for
+ @param aFrequencies an array to which the frequencies associated with the given station will be
+ appended.
+ */
+ IMPORT_C void GetEonFrequenciesL(const TEonStation& aEonStation, RArray<TFrequency>& aFrequencies) const;
+
+ /**
+ Gets the mapped frequencies associated with an EON station. This will complete immediately with whatever
+ mapped frequencies are currently cached. An interested application should make a call to NotifyEonChange
+ to receive notifications when more frequencies are received.
+
+ @param aEonStation the EON station to get the mapped frequencies for
+ @param aMappedFrequencies an array to which the mapped frequencies associated with the given station
+ will be appended.
+ */
+ IMPORT_C void GetEonMappedFrequenciesL(const TEonStation& aEonStation, RArray<TEonMappedFrequency>& aMappedFrequencies) const;
+
+ /**
+ Request notification when the Enhanced Other Networks (EON) information changes.
+
+ @param aObserver The client to be notifier when EON information changes or an error occurs.
+ */
+ IMPORT_C TInt NotifyEonInfo(MMMRdsEonObserver& aObserver);
+
+ /**
+ Cancels a NotifyEonInfo request.
+ */
+ IMPORT_C void CancelNotifyEonInfo();
+
+ /**
+ Tunes to a station represented by a TEonStation. This will result to a callback to MtoTuneComplete.
+
+ @param aEonStation The EON station that is to be tuned to.
+ */
+ IMPORT_C void TuneToEonStation(const TEonStation& aEonStation);
+
+ /**
+ Send a synchronous custom command to the RDS tuner.
+
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined by the first IPC argument
+ @param aArgs The IPC arguments to send to the RDS tuner. The first of these
+ arguments must be the UID of the interface within the tuner to which the
+ command is destined, represented as an integer. Failure to set the first
+ argument properly will result in the command completing with
+ KErrNotSupported at best, but possibly the client being panicked.
+ @return A standard system error code
+ */
+ IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs);
+
+ /**
+ Send an asynchronous custom command to the RDS tuner.
+
+ @param aFunction The function number to indicate which function is to be called
+ on the interface defined by the first IPC argument
+ @param aArgs The IPC arguments to send to the RDS tuner. The first of these
+ arguments must be the UID of the interface within the tuner to which the
+ command is destined, represented as an integer. Failure to set the first
+ argument properly will result in the command completing with
+ KErrNotSupported at best, but possibly the client being panicked.
+ @param aStatus The TRequestStatus of an active object. This will contain the
+ result of the request on completion. The exact range of result values is
+ dependent on the interface.
+ */
+ IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus);
+
+private:
+ CMMRdsTunerUtility();
+private:
+ class CBody;
+ CBody* iBody;
+
+};
+
+/**
+This mixin class should be implemented by applications wishing to receive notifications
+when RDS data is received, changes or becomes invalid. Each method corresponds to a
+particular request in CMMRdsTunerUtility. Only methods corresponding to requests in
+CMMRdsTunerUtility that are used by a client need be implemented - empty default
+implementations are provided.
+*/
+class MMMRdsDataObserver
+{
+public:
+ /**
+ Called when some error occurs which makes RDS data unavailable.
+ */
+ virtual void MrdoError(TInt aError) = 0;
+
+ /**
+ Called when some RDS data is received or has changed.
+
+ Two subsets of the RDS data supplied are indicted: that which has changed and that which is
+ valid. This information can be interpreted as follows:
+ For an item of RDS data x:
+ valid(x) & !changed(x) => x was received before and has not changed
+ valid(x) & changed(x) => x has either just been received for the first time, or has just changed
+ !valid(x) & changed(x) => x is no longer available
+ !valid(x) & !changed(x) => x was not available before, and is still not available.
+
+ When the tuner is retuned to a new station, all RDS data will be flushed. This will result in
+ a call to this function indicating that all RDS data has changed and is longer valid.
+
+ @param aData The RDS data.
+ @param aValid Indicates a subset of aData that is valid (i.e. has been received)
+ @param aChanged Indicates a subset of aData that has changed since the last call to this function.
+ */
+ virtual void MrdoDataReceived(const TRdsData& aData, TUint32 aValid, TUint32 aChanged) = 0;
+
+ /**
+ Called when the RDS Radio Text (RT) is received, changes, or is no longer available.
+
+ @param aRt The Radio Text message. This will be empty if aValid==EFalse.
+ @param aValid Indicates if the radio text is valid.
+ @param aChanges Indicates if the radio test has changed.
+ */
+ virtual void MrdoRadioTextReceived(const TDesC& aRt, TBool aValid, TBool aChanged) = 0;
+};
+
+/**
+The state change observer mixin class defines the interface via which changes to
+the state of the RDS radio can be observed. These state changes will be a result
+of a client enabling or disabling RDS functionality.
+*/
+class MMMRdsStateChangeObserver
+{
+public:
+ /**
+ Called when the regional link functionality is enabled/disabled.
+
+ @param aNewRegLinkOn The new setting: ETrue if the regional link function has
+ just been enabled.
+ */
+ virtual void MrscoRegionalLinkChanged(TBool aNewRegLinkOn) = 0;
+
+ /**
+ Called when the traffic announcement functionality has just been enabled or
+ disabled.
+
+ @param aNewTaOn ETrue if the TA function is now on, EFalse otherwise.
+ */
+ virtual void MrscoTrafficAnnouncementChanged(TBool aNewTaOn) = 0;
+
+ /**
+ Called when the traffic and news announcement volume offset is changed. A callback to
+ this method indicates the a volume offset is being used instead of an absolute volume.
+
+ @param aOldOffset The announcement volume offset before the change
+ @param aNewOffset The announcement volume offset after the change
+ */
+ virtual void MrscoAnnouncementVolumeOffsetChanged(TInt aOldOffset, TInt aNewOffset) = 0;
+
+ /**
+ Called when the traffic an news announcement volume is changed. A callback to
+ this method indicates that an absolute volume is being used instead of volume offsets.
+
+ @param aOldVolume The announcement volume before the change.
+ @param aNewVolume The announcement volume after the change.
+ */
+ virtual void MrscoAnnouncementVolumeChanged(TInt aOldVolume, TInt aNewVolume) = 0;
+
+ /**
+ Called when the news announcement functionality has just been enabled or
+ disabled.
+
+ @param aNewNAOn ETrue if the NA function is now enabled, else EFalse.
+ */
+ virtual void MrscoNewsAnnouncementChanged(TBool aNewNAOn) = 0;
+
+ /**
+ Called when the alternative frequencies function is turned on or off.
+
+ @param aNewAFOn ETrue if the AF function has just been turned on, else EFalse.
+ */
+ virtual void MrscoAlternativeFrequenciesChanged(TBool aNewAFOn) = 0;
+};
+
+
+/**
+The Announcement Observer mixin class defines the interface via which
+announcement events can be received. A client interested in such
+information calls the function NotifyAnnouncement.
+*/
+class MMMRdsAnnouncementObserver
+{
+public:
+ /**
+ Called when an announcement starts
+
+ @param aType The type of announcement (travel or news)
+ */
+ virtual void MraoAnnouncementStart(CMMRdsTunerUtility::TAnnouncementType aType) = 0;
+
+ /**
+ Called when an announcement ends
+
+ @param aType The type of announcement (travel or news)
+ */
+ virtual void MraoAnnouncementEnd(CMMRdsTunerUtility::TAnnouncementType aType) = 0;
+
+ /**
+ Called when an error occurs which results in announcement notifications
+ becoming unavailable.
+ */
+ virtual void MraoError(TInt aError) = 0;
+};
+
+/**
+The enhanced other networks observer mixin class defines the interface via
+which changes to the enhanced other networks information can be notified. A
+client interested in such information calls the function NotifyEonChange.
+*/
+class MMMRdsEonObserver
+{
+public:
+ /**
+ Called when some details of an EON station change. The station can be referenced
+ to an existing one using it's Programme Identifier, which cannot change.
+
+ @param aStation A TEonStation containing the new information about the station.
+ @param aChanged The subset of the members of aStation that have changed. Bits are
+ set according to TEonStation::TField.
+ */
+ virtual void MreoEonStationChanged(const TEonStation& aStation, TUint32 aChanged) = 0;
+
+ /**
+ Called when details of a new EON station are received.
+
+ @param aStation A TEonStation containing the new information about the station.
+ */
+ virtual void MreoNewEonStation(const TEonStation& aStation) = 0;
+
+ /**
+ Called when details of <b>all</b> EON stations cease to be broadcast. This will
+ typically happen when the tuner is retuned. More EON stations may continue to be
+ recieved: this call does not indicate that EON information is no longer available.
+ */
+ virtual void MreoAllEonStationsRemoved() = 0;
+
+ /**
+ Called when details of an EON station cease to be broadcast.
+
+ @param aPi The programme identifier of the EON station which has been removed.
+ */
+ virtual void MreoEonStationRemoved(const TRdsProgrammeIdentifier& aPi) = 0;
+
+ /**
+ Called when an error occurs resulting in EON notifications not being available.
+ */
+ virtual void MreoError(TInt aError) = 0;
+};
+
+#include <tuner.inl>
+
+#endif // TUNER_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/external_include/tuner.inl Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Inline functions for Tuner component.
+*
+*/
+
+
+TTunerCapabilities::TTunerCapabilities()
+ : iTunerBands(0), iAdditionalFunctions(0)
+{}
+
+TTunerCapabilities::TTunerCapabilities(TUint32 aTunerBands, TUint32 aAdditionalFunctions)
+ : iTunerBands(aTunerBands), iAdditionalFunctions(aAdditionalFunctions)
+{}
+
+TFrequency::TFrequency()
+ : iFrequency(0)
+{}
+
+TFrequency::TFrequency(TInt aFrequency)
+ : iFrequency(aFrequency)
+{}
+
+TInt TFrequency::operator==(const TFrequency& aFrequency) const
+{
+ return (iFrequency==aFrequency.iFrequency);
+}
+
+TInt TFrequency::operator!=(const TFrequency& aFrequency) const
+{
+ return (iFrequency!=aFrequency.iFrequency);
+}
+
+TInt TFrequency::operator> (const TFrequency& aFrequency) const
+{
+ return (iFrequency>aFrequency.iFrequency);
+}
+
+TInt TFrequency::operator>=(const TFrequency& aFrequency) const
+{
+ return (iFrequency>=aFrequency.iFrequency);
+}
+
+TInt TFrequency::operator< (const TFrequency& aFrequency) const
+{
+ return (iFrequency<aFrequency.iFrequency);
+}
+
+TInt TFrequency::operator<=(const TFrequency& aFrequency) const
+{
+ return (iFrequency<=aFrequency.iFrequency);
+}
+
+TRdsData::TRdsData()
+{
+}
+
+TEonMappedFrequency::TEonMappedFrequency(TFrequency aTuningFrequency, TFrequency aMappedFrequency)
+ : iTuningFrequency(aTuningFrequency), iMappedFrequency(aMappedFrequency)
+{
+}
+
+TInt TRdsProgrammeItemNumber::operator==(const TRdsProgrammeItemNumber& aPin) const
+{
+ return ((iDayOfMonth==aPin.iDayOfMonth)&&(iHour==aPin.iHour)&&(iMinute==aPin.iMinute));
+}
+
+TInt TRdsProgrammeItemNumber::operator!=(const TRdsProgrammeItemNumber& aPin) const
+{
+ return (!((*this)==aPin));
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/ammstunerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to create tuner player and control
+*
+*/
+
+
+
+#ifndef AMMSTUNERFACTORY_H
+#define AMMSTUNERFACTORY_H
+
+// INCLUDES
+#include <e32base.h>
+
+#include "CAMMSTunerControl.h"
+
+// FORWARD DECLARATIONS
+class CAMMSTunerPlayer;
+class CAMMSTunerControl;
+
+// CLASS DECLARATION
+/**
+* This class is used to create tuner player and control.
+* It parses locator parameters and set them to control.
+*/
+
+NONSHARABLE_CLASS(AMMSTunerFactory)
+{
+public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~AMMSTunerFactory();
+
+public: // New functions
+
+ /**
+ * ?member_description.
+ * @param aTunerPlayer
+ * @param aLocatorParams
+ */
+ static void CreatePlayerL(CAMMSTunerPlayer** aTunerPlayer,
+ const TDesC* aLocatorParams);
+
+protected: // New functions
+
+ /**
+ * Parse all locator parameters.
+ * @param aLocatorParams
+ * @param aFrequency
+ * @param aStereoMode
+ * @param aPreset
+ */
+ static void ParseParamsL(const TDesC* aLocatorParams,
+ TInt& aFrequency,
+ TInt& aStereoMode,
+ TInt& aPreset);
+
+ /**
+ * Parses frequency parameter
+ * @param aFrequency - locator's frequency parameter
+ * @return frequency in TInt
+ */
+ static TInt ParseFreqL(const TPtrC aFrequency);
+
+ /**
+ * Converts TPtrC to TReal using TLex.
+ * @param aHertz - hertzs in TPtrC
+ * @return hertzs in TReal
+ */
+ static TReal TDesCToTRealL(const TPtrC aHertz);
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ AMMSTunerFactory();
+};
+
+#endif // AMMSTUNERFACTORY_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/cammstunercontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Control for tuner
+*
+*/
+
+
+#ifndef CAMMSTUNERCONTROL_H
+#define CAMMSTUNERCONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <tuner.h>
+
+#include <CMMAControl.h>
+
+
+// FORWARD DECLARATIONS
+class CAMMSTunerPlayer;
+class CAMMSTunerPresetsHandler;
+
+// CLASS DECLARATION
+/**
+* Control for tuner
+*/
+
+NONSHARABLE_CLASS(CAMMSTunerControl) : public CMMAControl,
+ public MMMTunerObserver,
+ public MMMTunerChangeObserver,
+ public MMMTunerStereoObserver
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSTunerControl* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSTunerControl();
+
+public: // New functions
+
+ /**
+ * Getter for CMMTunerUtility
+ * @return CMMTunerUtility
+ */
+ CMMTunerUtility* TunerUtility();
+
+ /**
+ * Gets the minimum frequency supported by this tuner
+ * with the given modulation.
+ * @return minimum frequency supported by this tuner
+ */
+ TInt MinFreqL();
+
+ /**
+ * Gets the maximum frequency supported by this tuner
+ * with the given modulation.
+ * @return maximum frequency supported by this tuner
+ */
+ TInt MaxFreqL();
+
+ /**
+ * Tunes to the given frequency or to the closest supported frequency.
+ * @param aFreq - the frequency in Hertzs that will be taken into use
+ * @return the frequency in 100 Hertzs that was taken into use
+
+ */
+ void SetFrequencyL(TInt aFreq);
+
+ /**
+ * Gets the frequency which the tuner has been tuned to.
+ * @return the frequency to which the device has been tuned,
+ * in 100 Hertzs
+ */
+ TInt FrequencyL();
+
+ /**
+ * Seeks for the next broadcast signal.
+ * @param aStartFreq - the frequency in Hertzs wherefrom the scan starts
+ * @param aUpwards - if true, the scan proceeds towards higher
+ * frequencies, otherwise towards lower frequencies
+ * @return the found frequency
+ */
+ TInt SeekL(TInt aStartFreq, TBool aUpwards);
+
+ /**
+ * Gets the current squelching (muting in frequencies without broadcast)
+ * setting.
+ * @return true if squelch is on or false if squelch is off
+ */
+ TBool SquelchL();
+
+ /**
+ * Sets squelching on or off.
+ * @param aSquelch - true to turn the squelch on or false
+ * to turn the squelch off
+ */
+ void SetSquelchL(TBool aSquelch);
+
+ /**
+ * Gets the strength of the recepted signal.
+ * @return a value between 0 and 100 where 0 means the faintest
+ * and 100 the strongest possible signal strength
+ */
+ TInt SignalStrengthL();
+
+ /**
+ * Gets the stereo mode in use.
+ * @return stereo mode in use
+ */
+ TInt StereoModeL();
+
+ /**
+ * Sets the stereo mode.
+ * @param aMode - the stereo mode to be used
+ */
+ void SetStereoModeL(TInt aMode);
+
+ /**
+ * Tunes the tuner by using settings specified in the preset.
+ * @param aPreset - the preset to be used.
+ */
+ void UsePresetL(TInt aPreset);
+
+ /**
+ * Configures the preset using current frequency and modulation
+ * and stereo mode.
+ * @param aPreset - the preset to be set.
+ */
+ void SetPresetL(TInt aPreset);
+
+ /**
+ * Configures the preset using given settings.
+ * @param aPreset - the preset to be set.
+ * @param aFrequency - the frequency to be set.
+ * @param aStereoMode - the stereo mode to be set.
+ */
+ void SetPresetL(TInt aPreset, TInt aFrequency, TInt aStereoMode);
+
+ /**
+ * Gets preset frequency
+ * @param aPreset - the preset whose frequency is to be returned
+ . * @return the frequency of the preset in 100 Hertzs
+ */
+ TInt PresetFrequencyL(TInt aPreset);
+
+ /**
+ * Gets preset stereo mode
+ * @param aPreset - the preset whose stereo mode is to be returned
+ . * @return the stereo mode of the preset.
+ */
+ TInt PresetStereoModeL(TInt aPreset);
+
+ /**
+ * Set preset name
+ * @param aPreset - the preset whose name is to be set
+ * @param aPresetName - the name of the preset
+ */
+ void SetPresetNameL(TInt aPreset, const TDesC* aPresetName);
+
+ /**
+ * Get preset name
+ * @param aPreset - the preset whose name is asked
+ * @param aPresetName - the name of the preset
+ */
+ void GetPresetNameL(TInt aPreset, TPtrC* aPresetName);
+
+public: // functions from base classes
+
+ // from CMMAControl
+
+ const TDesC& ClassName() const;
+
+ const TDesC& PublicClassName() const;
+
+ // from MMMTunerObserver
+
+ void MToTuneComplete(TInt aError);
+
+ // from class MMMTunerChangeObserver
+
+ /**
+ Called when the tuned frequency changes
+
+ @param aOldFrequency The frequency in use before the change
+ @param aNewFrequency The new tuned frequency
+ */
+ void MTcoFrequencyChanged(const TFrequency& aOldFrequency,
+ const TFrequency& aNewFrequency);
+
+ /**
+ Called when the state of the tuner changes.
+
+ @param aOldState The old state. Bits are set according to TTunerState.
+ @param aNewState The new state. Bits are set according to TTunerState.
+ */
+ void MTcoStateChanged(const TUint32& aOldState,
+ const TUint32& aNewState);
+
+ /**
+ This function is called when an external antenna is detached from the device.
+ This does not necessarily indicate that the tuner can no longer be used; the
+ capabilities of the tuner indicate if the external antenna is required in order
+ to use the tuner.
+ */
+ void MTcoAntennaDetached();
+
+ /**
+ This function is called when an external antenna is attached to the device. If
+ the antenna is required to use the tuner, this indicates that the tuner can be
+ used again.
+ */
+ void MTcoAntennaAttached();
+
+ /**
+ This function is called when the device enters or leaves flight mode. If the tuner
+ cannot be used in flight mode when the device enters this mode, this indicates
+ that the tuner can no longer be used; the capabilities of the tuner indicate if
+ it can be used in flight mode or not.
+
+ @param aFlightMode ETrue if the device has just entered flight mode, EFalse if
+ flight mode has just been left.
+ */
+ void FlightModeChanged(TBool aFlightMode);
+
+ // from class MMMTunerStereoObserver
+
+ /**
+ Called when stereo reception is lost/restored.
+
+ @param aStereo If true, indicates that stereo reception has just been restored.
+ If false, indicates that stereo reception has just been lost.
+ */
+ void MTsoStereoReceptionChanged(TBool aStereo);
+
+ /**
+ Called when a client enables/disabled forced mono reception.
+
+ @param aForcedMono ETrue if reception is forced to be mono, even when a stereo
+ signal is available.
+ */
+ void MTsoForcedMonoChanged(TBool aForcedMono);
+
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAMMSTunerControl();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // CAMMSTunerControl( const CAMMSTunerControl& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // CAMMSTunerControl& operator=( const CAMMSTunerControl& );
+
+
+private: // Data
+
+ TInt iMinFreq;
+ TInt iMaxFreq;
+
+ CMMTunerUtility* iTunerUtility;
+ CActiveSchedulerWait* iActiveSchedulerWait;
+ CAMMSTunerPresetsHandler* iPresetsHandler;
+};
+
+#endif // CAMMSTUNERCONTROL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/cammstunerplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+#ifndef CAMMSTUNERPLAYER_H
+#define CAMMSTUNERPLAYER_H
+
+// INCLUDES
+#include <CMMAPlayer.h>
+#include "CAMMSTunerControl.h"
+
+#include <e32base.h>
+#include <tuner.h>
+
+
+// CLASS DECLARATION
+
+/**
+* Player for tuner
+*
+*/
+NONSHARABLE_CLASS(CAMMSTunerPlayer) : public CMMAPlayer,
+ public MMMTunerAudioPlayerObserver
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSTunerPlayer* NewL(CAMMSTunerControl* aTunerControl);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSTunerPlayer();
+
+public: // from CMMAPlayer
+
+ void PrefetchL();
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void DeallocateL();
+ void GetMediaTime(TInt64* aMediaTime);
+
+public: // from MMMTunerAudioPlayerObserver
+
+ void MTapoInitializeComplete(TInt aError);
+ void MTapoPlayEvent(MMMTunerAudioPlayerObserver::TEventType aEvent, TInt aError, TAny* aAdditionalInfo);
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAMMSTunerPlayer();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL(CAMMSTunerControl* aTunerControl);
+
+
+ TInt64 CurrentTime();
+
+private: // Data
+ CMMTunerAudioPlayerUtility* iTunerPlayerUtility;
+ CAMMSTunerControl* iTunerControl;
+ CActiveSchedulerWait* iActiveSchedulerWait;
+
+ TBool iIsInitialized;
+ TInt64 iMediaTime;
+ TInt64 iStartTime;
+};
+
+#endif // CAMMSTUNERPLAYER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/cammstunerpresetshandler.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class handles presets central repository usage.
+*
+*/
+
+
+
+#ifndef CAMMSTUNERPRESETSHANDLER_H
+#define CAMMSTUNERPRESETSHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <centralrepository.h>
+
+
+// FORWARD DECLARATIONS
+class TAMMSTunerPreset;
+
+// CLASS DECLARATION
+/**
+* This class handles presets central repository usage.
+*
+* @lib ?library
+* @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CAMMSTunerPresetsHandler) : public CBase
+{
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CAMMSTunerPresetsHandler* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAMMSTunerPresetsHandler();
+
+public: // New functions
+
+ /**
+ * Gets presets from central repository
+ * @param aPreset - presets index
+ * @param aTunerPreset
+ */
+ void GetPresetL(TInt aPreset, TAMMSTunerPreset &aTunerPreset);
+
+ /**
+ * Save presets to central repository
+ * @param aPreset - presets index
+ * @param aTunerPreset
+ */
+ void SavePresetL(TInt aPreset, TAMMSTunerPreset aTunerPreset);
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAMMSTunerPresetsHandler();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // CAMMSTunerPresetsHandler( const CAMMSTunerPresetsHandler& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // CAMMSTunerPresetsHandler& operator=( const CAMMSTunerPresetsHandler& );
+
+
+private: // Data
+
+ CRepository* iCentralRepository;
+
+
+};
+
+#endif // CAMMSTUNERPRESETSHANDLER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/cammstunervolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to tuner player
+*
+*/
+
+
+#ifndef CAMMSTUNERVOLUMECONTROL_H
+#define CAMMSTUNERVOLUMECONTROL_H
+
+// INCLUDES
+#include <e32base.h>
+
+#include <CMMAVolumeControl.h>
+
+// FORWARD DECLARATIONS
+class CAMMSTunerPlayer;
+
+// CLASS DECLARATION
+/**
+* This class is used for setting volume to tuner player
+*/
+
+NONSHARABLE_CLASS(CAMMSTunerVolumeControl) : public CMMAVolumeControl
+{
+public: // Constructor
+ static CAMMSTunerVolumeControl* NewL(CAMMSTunerPlayer* aTunerPlayer);
+
+public: // functions from base classes
+
+ // from CMMAVolumeControl
+
+ void DoSetLevelL(TInt aLevel);
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAMMSTunerVolumeControl(CAMMSTunerPlayer* aTunerPlayer);
+
+
+private: // Data
+
+ CAMMSTunerPlayer* iTunerPlayer;
+};
+
+#endif // CAMMSTUNERVOLUMECONTROL_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/inc/tammstunerpreset.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class for preset handling, reads and writes preset
+* values in/out stream.
+*
+*/
+
+
+
+#ifndef TAMMSTUNERPRESET_H
+#define TAMMSTUNERPRESET_H
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class RWriteStream;
+class RReadStream;
+
+// CONSTANTS
+const TInt KPresetNameLength = 100;
+
+// CLASS DECLARATION
+/**
+* Helper class for preset handling, reads and writes preset
+* values in/out stream.
+*
+* @lib ?library
+* @since ?Series60_version
+*/
+NONSHARABLE_CLASS(TAMMSTunerPreset)
+{
+public:
+
+ /**
+ * C++ default constructor.
+ */
+ TAMMSTunerPreset();
+
+ /**
+ * Setter for preset name.
+ */
+ void SetPresetName(const TDesC* aPresetName);
+
+ /**
+ * Setter for preset frequency.
+ */
+ void SetPresetFrequency(const TInt aPresetFrequency);
+
+ /**
+ * Setter for preset stereo mode.
+ */
+ void SetPresetStereoMode(const TInt aPresetStereoMode);
+
+ /**
+ * Getter for preset name.
+ */
+ TPtrC PresetName();
+
+ /**
+ * Getter for preset frequency.
+ */
+ TInt PresetFrequency();
+
+ /**
+ * Getter for preset stereo mode.
+ */
+ TInt PresetStereoMode();
+
+ /**
+ * Serialize the data to stream.
+ * @param aStream - used for write stream
+ */
+ void ExternalizeL(RWriteStream &aStream) const;
+
+ /**
+ * deserialize the data out of stream.
+ * @param aStream used for read stream
+ */
+ void InternalizeL(RReadStream &aStream);
+
+private:
+
+ TBuf<KPresetNameLength> iPresetName;
+ TInt iPresetFrequency;
+ TInt iPresetStereoMode;
+
+};
+
+#endif // TAMMSTUNERPRESET_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/ammstunerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to create tuner player and control
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "AMMSTunerFactory.h"
+#include "CAMMSTunerPlayer.h"
+#include "CAMMSTunerControl.h"
+//#include "CAMMSTunerVolumeControl.h"
+#include <CMMAPlayerProperties.h>
+
+#include <e32std.h>
+#include <e32math.h>
+#include <logger.h>
+
+// CONSTANTS
+_LIT(KFreqParam, "f");
+
+_LIT(KModulationParam, "mod");
+
+_LIT(KStereoModeParam, "st");
+MMA_PARAMETER_STR(KStereoModeParamMono, "mono");
+MMA_PARAMETER_STR(KStereoModeParamStereo, "stereo");
+MMA_PARAMETER_STR(KStereoModeParamAuto, "auto");
+MMA_PARAMETER_ARRAY(KValidStereoModeValues)
+{
+ {
+ &KStereoModeParamMono
+ }, {&KStereoModeParamStereo}, {&KStereoModeParamAuto}
+};
+
+_LIT(KProgramIdParam, "id");
+_LIT(KPresetParam, "preset");
+
+_LIT(KModulationFm, "fm");
+
+_LIT(KStereoModeMono, "mono");
+_LIT(KStereoModeStereo, "stereo");
+_LIT(KStereoModeAuto, "auto");
+
+const TInt KMegaHertzChar = 'M';
+const TInt KKiloHertzChar = 'k';
+const TInt KFreqDotChar = '.';
+
+const TInt KMegaHzMultiplier = 1000000;
+const TInt KKiloHzMultiplier = 1000;
+
+const TInt KStereoModeMonoInt = 1;
+const TInt KStereoModeStereoInt = 2;
+const TInt KStereoModeAutoInt = 3;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+AMMSTunerFactory::~AMMSTunerFactory()
+{
+
+}
+
+
+// -----------------------------------------------------------------------------
+// AMMSTunerFactory::CreatePlayerL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void AMMSTunerFactory::CreatePlayerL(CAMMSTunerPlayer** aTunerPlayer,
+ const TDesC* aLocatorParams)
+{
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL +");
+
+ TInt frequency = 0;
+ TInt stereoMode = 0;
+ TInt preset = 0;
+
+ if (aLocatorParams->Length() != 0)
+ {
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL 1");
+ ParseParamsL(aLocatorParams, frequency, stereoMode, preset);
+ }
+
+ //create tunercontrol
+ CAMMSTunerControl* tunerControl = CAMMSTunerControl::NewL();
+ CleanupStack::PushL(tunerControl);
+
+ //set values to tunercontrol
+ if (frequency > 0)
+ {
+ tunerControl->SetFrequencyL(frequency);
+ }
+
+ if (frequency == 0)
+ {
+ //by default frequency is fm modulation's min freq
+ tunerControl->SetFrequencyL(tunerControl->MinFreqL());
+ }
+
+ if (stereoMode > 0)
+ {
+ tunerControl->SetStereoModeL(stereoMode);
+ }
+
+ if (preset > 0)
+ {
+ tunerControl->UsePresetL(preset);
+ }
+
+ //create tunerplayer
+ *aTunerPlayer = CAMMSTunerPlayer::NewL(tunerControl);
+
+ //create tunervolumeconrol
+ //CAMMSTunerVolumeControl* tunerVolumeControl = CAMMSTunerVolumeControl::NewL( *aTunerPlayer );
+
+ //add controls to player
+ (*aTunerPlayer)->AddControlL(tunerControl);
+ //(*aTunerPlayer)->AddControlL( tunerVolumeControl );
+ CleanupStack::Pop(tunerControl);
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL -");
+}
+
+// -----------------------------------------------------------------------------
+// AMMSTunerFactory::ParseParamsL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void AMMSTunerFactory::ParseParamsL(const TDesC* aLocatorParams,
+ TInt& aFrequency,
+ TInt& aStereoMode,
+ TInt& aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseParamsL +");
+ CMMAParameterRuleSet* rules = CMMAParameterRuleSet::NewLC();
+
+ //freq rule
+ TMMAParameterRuleDes freqRule(KFreqParam);
+ rules->AppendRuleL(&freqRule);
+
+ //modulation rule
+ TMMAParameterRuleDes modulationRule(KModulationParam);
+ rules->AppendRuleL(&modulationRule);
+
+ //stereo mode rule
+ TMMAParameterRuleDes stereoModeRule(KStereoModeParam, KValidStereoModeValues,
+ MMA_PARAMETER_ARRAY_SIZE(KValidStereoModeValues));
+ rules->AppendRuleL(&stereoModeRule);
+
+ //preset rule KMinTInt-KMaxTInt
+ TMMAParameterRuleInt presetRule(KPresetParam);
+ rules->AppendRuleL(&presetRule);
+
+ //id rule
+ TMMAParameterRuleDes idRule(KProgramIdParam);
+ rules->AppendRuleL(&idRule);
+
+ CMMAPlayerProperties* properties = CMMAPlayerProperties::NewL(*aLocatorParams, *rules);
+ CleanupStack::PushL(properties);
+
+ // validating properties
+ properties->ValidateL();
+
+ //get freq
+ TPtrC freq(NULL, 0);
+ properties->GetProperty(KFreqParam, freq);
+ //parse frequency
+ if (freq.Length() != 0)
+ {
+ aFrequency = ParseFreqL(freq);
+ }
+
+ //get modulation
+ TPtrC modulation(NULL, 0);
+ properties->GetProperty(KModulationParam, modulation);
+ if (modulation.Length() != 0)
+ {
+ // only fm modulation is supported
+ if (modulation.Compare(KModulationFm) != 0)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ }
+
+ //get stereo mode
+ TPtrC stereoMode(NULL, 0);
+ properties->GetProperty(KStereoModeParam, stereoMode);
+ if (stereoMode.Compare(KStereoModeMono) == 0)
+ {
+ aStereoMode = KStereoModeMonoInt;
+ }
+ else if (stereoMode.Compare(KStereoModeStereo) == 0)
+ {
+ aStereoMode = KStereoModeStereoInt;
+ }
+ else if (stereoMode.Compare(KStereoModeAuto) == 0)
+ {
+ aStereoMode = KStereoModeAutoInt;
+ }
+
+ //get preset
+ properties->GetProperty(KPresetParam, aPreset);
+
+ //get id
+ TPtrC id(NULL, 0);
+ properties->GetProperty(KProgramIdParam, id);
+ if (id.Length() != 0)
+ {
+ // id is not supported
+ User::Leave(KErrNotSupported);
+ }
+
+ CleanupStack::PopAndDestroy(properties);
+ CleanupStack::PopAndDestroy(rules);
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseParamsL -");
+}
+
+// -----------------------------------------------------------------------------
+// AMMSTunerFactory::ParseFreqL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt AMMSTunerFactory::ParseFreqL(const TPtrC aFrequency)
+{
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseFreqL +");
+ TReal freqReal = 0;
+
+ //is value MHz or kHz or just hertz
+ TInt freqPrefixMPos = aFrequency.Locate(KMegaHertzChar);
+ TInt freqPrefixKPos = aFrequency.Locate(KKiloHertzChar);
+
+ if (freqPrefixMPos != KErrNotFound)
+ {
+ //there is a M
+ TPtrC hertz = aFrequency.Left(freqPrefixMPos);
+ //TPtrC -> TReal
+ TReal value = TDesCToTRealL(hertz);
+
+ freqReal = value * KMegaHzMultiplier;
+ }
+ else if (freqPrefixKPos != KErrNotFound)
+ {
+ //there is a k
+ TPtrC hertz = aFrequency.Left(freqPrefixKPos);
+ //TPtrC -> TReal
+ TReal value = TDesCToTRealL(hertz);
+
+ freqReal = value * KKiloHzMultiplier;
+ }
+ else
+ {
+ //parameter value is simply hertz, there is no M or k
+ //TPtrC -> TReal
+ freqReal = TDesCToTRealL(aFrequency);
+ }
+ TInt32 freqInt = 0;
+ //TReal -> TInt
+ TInt err = Math::Int(freqInt, freqReal);
+ if (err != KErrNone)
+ {
+ User::Leave(KErrArgument);
+ }
+
+ return freqInt;
+}
+
+// -----------------------------------------------------------------------------
+// AMMSTunerFactory::TDesCToTRealL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal AMMSTunerFactory::TDesCToTRealL(const TPtrC aHertz)
+{
+ LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::TDesCToTRealL +");
+ TReal valueReal = 0;
+ TLex lex(aHertz);
+ if ((lex.Val(valueReal, KFreqDotChar) != KErrNone) ||
+ !lex.Eos())
+ {
+ User::Leave(KErrArgument);
+ }
+ return valueReal;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/cammstunercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,504 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to control tuner
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CAMMSTunerControl.h"
+#include "CAMMSTunerPlayer.h"
+#include "CAMMSTunerPresetsHandler.h"
+#include "TAMMSTunerPreset.h"
+#include "AMMSTunerFactory.h"
+
+#include <tuner.h>
+#include <logger.h>
+
+
+// CONSTANTS
+_LIT(KControlImplName, "com.nokia.amms.control.tuner.TunerControlImpl");
+_LIT(KControlPublicName, "javax.microedition.amms.control.tuner.TunerControl");
+
+const TInt KStereoModeMono = 1;
+const TInt KStereoModeStereo = 2;
+const TInt KStereoModeAuto = 3;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::CAMMSTunerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerControl::CAMMSTunerControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerControl* CAMMSTunerControl::NewL()
+{
+ CAMMSTunerControl* self = new(ELeave) CAMMSTunerControl;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAMMSTunerControl::ConstructL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::ConstructL +");
+
+ iTunerUtility = CMMTunerUtility::NewL(*this,
+ CMMTunerUtility::ETunerBandFm,
+ 1,
+ CMMTunerUtility::ETunerAccessPriorityNormal);
+
+ iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
+
+ iPresetsHandler = CAMMSTunerPresetsHandler::NewL();
+
+ iMinFreq = MinFreqL();
+ iMaxFreq = MaxFreqL();
+
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::ConstructL -");
+}
+
+
+// Destructor
+CAMMSTunerControl::~CAMMSTunerControl()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::~CAMMSTunerControl +");
+ delete iTunerUtility;
+ delete iActiveSchedulerWait;
+ delete iPresetsHandler;
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::~CAMMSTunerControl -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::TunerUtility()
+// -----------------------------------------------------------------------------
+CMMTunerUtility* CAMMSTunerControl::TunerUtility()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::TunerUtility");
+ return iTunerUtility;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MinFreq()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::MinFreqL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MinFreqL +");
+ TFrequency minFreq;
+ TFrequency maxFreq;
+ User::LeaveIfError(iTunerUtility->GetFrequencyBandRange(minFreq,
+ maxFreq));
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::MinFreqL = %d", minFreq.iFrequency);
+ return minFreq.iFrequency;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MaxFreq()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::MaxFreqL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MaxFreqL +");
+ TFrequency minFreq;
+ TFrequency maxFreq;
+ User::LeaveIfError(iTunerUtility->GetFrequencyBandRange(minFreq,
+ maxFreq));
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::MaxFreqL = %d", maxFreq.iFrequency);
+ return maxFreq.iFrequency;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetFrequency()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetFrequencyL(TInt aFreq)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency +");
+ if (aFreq < iMinFreq || aFreq > iMaxFreq)
+ {
+ User::Leave(KErrArgument);
+ }
+
+ TFrequency freq = TFrequency(aFreq);
+
+ TUint32 state = 0;
+ iTunerUtility->GetState(state);
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency, state = %d", state);
+
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency = %d", freq.iFrequency);
+
+ iTunerUtility->Tune(freq);
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start(); // CSI: 10 Active object state already checked. #
+ }
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::Frequency()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::FrequencyL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::Frequency +");
+ TFrequency freq;
+
+ User::LeaveIfError(iTunerUtility->GetFrequency(freq));
+ TInt frequency = freq.iFrequency;
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::Frequency frequency = %d", frequency);
+ return frequency;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SeekL()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::SeekL(TInt aStartFreq, TBool aUpwards)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SeekL +");
+ if (aStartFreq < iMinFreq || aStartFreq > iMaxFreq)
+ {
+ User::Leave(KErrArgument);
+ }
+
+ if (aUpwards)
+ {
+ iTunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionUp);
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start(); // CSI: 10 Active object state already checked. #
+ }
+ }
+ else
+ {
+ iTunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionDown);
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start(); // CSI: 10 Active object state already checked. #
+ }
+ }
+
+ return FrequencyL();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SquelchL()
+// -----------------------------------------------------------------------------
+TBool CAMMSTunerControl::SquelchL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SquelchL +");
+ TBool enabled = EFalse;
+ User::LeaveIfError(iTunerUtility->GetSquelch(enabled));
+ return enabled;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetSquelchL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetSquelchL(TBool aSquelch)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetSquelchL +");
+ User::LeaveIfError(iTunerUtility->SetSquelch(aSquelch));
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SignalStrengthL()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::SignalStrengthL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL +");
+ TInt maxSignalStrength = 0;
+ TInt signalStrength = 0;
+
+ User::LeaveIfError(iTunerUtility->GetMaxSignalStrength(maxSignalStrength));
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL, maxSignalStrength = %d", maxSignalStrength);
+ User::LeaveIfError(iTunerUtility->GetSignalStrength(signalStrength));
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL, signalStrength = %d", signalStrength);
+ if (maxSignalStrength > 0)
+ {
+ return signalStrength / maxSignalStrength * 100; // CSI: 47 signal strength must be between 0 and 100 #
+ }
+ return KErrNotSupported;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::StereoModeL()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::StereoModeL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::StereoModeL +");
+ TBool mono = EFalse;
+ TBool stereo = EFalse;
+
+ User::LeaveIfError(iTunerUtility->GetForcedMonoReception(mono));
+ if (mono)
+ {
+ return KStereoModeMono;
+ }
+
+ //User::LeaveIfError( iTunerUtility->IsStereoSignal( stereo ) );
+ TInt err = iTunerUtility->IsStereoSignal(stereo);
+ //this is for emulator testing, FIX IT
+ if (err == KErrNotReady)
+ {
+ return KStereoModeAuto;
+ }
+ else if (err != KErrNone)
+ {
+ User::LeaveIfError(err);
+ }
+
+ if (stereo)
+ {
+ return KStereoModeStereo;
+ }
+
+ return KStereoModeAuto;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetStereoMode()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetStereoModeL(TInt aMode)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetStereoModeL +");
+ if (aMode == KStereoModeMono)
+ {
+ User::LeaveIfError(iTunerUtility->ForceMonoReception(ETrue));
+ }
+
+ if (aMode == KStereoModeStereo)
+ {
+ User::LeaveIfError(iTunerUtility->ForceMonoReception(EFalse));
+ TBool stereo = EFalse;
+ User::LeaveIfError(iTunerUtility->IsStereoSignal(stereo));
+ if (!stereo)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ }
+
+ if (aMode == KStereoModeAuto)
+ {
+ User::LeaveIfError(iTunerUtility->ForceMonoReception(EFalse));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::UsePresetL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::UsePresetL(TInt aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::UsePresetL +");
+ TAMMSTunerPreset tunerPreset;
+
+ //get presets
+ iPresetsHandler->GetPresetL(aPreset, tunerPreset);
+
+ //set presets to tunerutility
+ SetFrequencyL(tunerPreset.PresetFrequency());
+ SetStereoModeL(tunerPreset.PresetStereoMode());
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetPresetL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetPresetL(TInt aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetL1 +");
+ TAMMSTunerPreset tunerPreset;
+
+ //get current frequency
+ tunerPreset.SetPresetFrequency(FrequencyL());
+ //get current stereo mode
+ tunerPreset.SetPresetStereoMode(StereoModeL());
+
+ iPresetsHandler->SavePresetL(aPreset, tunerPreset);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetPresetL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetPresetL(TInt aPreset,
+ TInt aFrequency,
+ TInt aStereoMode)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetL2 +");
+ TAMMSTunerPreset tunerPreset;
+
+ tunerPreset.SetPresetFrequency(aFrequency);
+ tunerPreset.SetPresetStereoMode(aStereoMode);
+
+ iPresetsHandler->SavePresetL(aPreset, tunerPreset);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::PresetFrequencyL()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::PresetFrequencyL(TInt aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::PresetFrequencyL +");
+ TAMMSTunerPreset tunerPreset;
+
+ iPresetsHandler->GetPresetL(aPreset, tunerPreset);
+
+ return tunerPreset.PresetFrequency();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::PresetStereoModeL()
+// -----------------------------------------------------------------------------
+TInt CAMMSTunerControl::PresetStereoModeL(TInt aPreset)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::PresetStereoModeL +");
+ TAMMSTunerPreset tunerPreset;
+
+ iPresetsHandler->GetPresetL(aPreset, tunerPreset);
+
+ return tunerPreset.PresetStereoMode();
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::SetPresetNameL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::SetPresetNameL(TInt aPreset, const TDesC* aPresetName)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetNameL +");
+ TAMMSTunerPreset tunerPreset;
+
+ iPresetsHandler->GetPresetL(aPreset, tunerPreset);
+
+ tunerPreset.SetPresetName(aPresetName);
+
+ iPresetsHandler->SavePresetL(aPreset, tunerPreset);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::GetPresetNameL()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::GetPresetNameL(TInt aPreset, TPtrC* aPresetName)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::GetPresetNameL +");
+ TAMMSTunerPreset tunerPreset;
+
+ iPresetsHandler->GetPresetL(aPreset, tunerPreset);
+
+ aPresetName->Set(tunerPreset.PresetName());
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::ClassName()
+// -----------------------------------------------------------------------------
+const TDesC& CAMMSTunerControl::ClassName() const
+{
+ return KControlImplName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::PublicClassName()
+// -----------------------------------------------------------------------------
+const TDesC& CAMMSTunerControl::PublicClassName() const
+{
+ return KControlPublicName;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MToTuneComplete()
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MToTuneComplete(TInt aError)
+{
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MToTuneComplete AsyncStop");
+ iActiveSchedulerWait->AsyncStop();
+ }
+ ELOG1( EJavaAMMS, "CAMMSTunerControl::MToTuneComplete ERROR = %d", aError);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTcoFrequencyChanged
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTcoFrequencyChanged(const TFrequency& /*aOldFrequency*/,
+ const TFrequency& /*aNewFrequency*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoFrequencyChanged");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTcoStateChanged
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTcoStateChanged(const TUint32& /*aOldState*/,
+ const TUint32& /*aNewState*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoStateChanged");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTcoAntennaDetached
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTcoAntennaDetached()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoAntennaDetached");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTcoAntennaAttached
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTcoAntennaAttached()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoAntennaAttached");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::FlightModeChanged
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::FlightModeChanged(TBool /*aFlightMode*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::FlightModeChanged");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTsoStereoReceptionChanged
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTsoStereoReceptionChanged(TBool /*aStereo*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTsoStereoReceptionChanged");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerControl::MTsoForcedMonoChanged
+// -----------------------------------------------------------------------------
+void CAMMSTunerControl::MTsoForcedMonoChanged(TBool /*aForcedMono*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTsoForcedMonoChanged");
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/cammstunerplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a tuner player
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CAMMSTunerPlayer.h"
+#include "CAMMSTunerControl.h"
+
+#include <tuner.h>
+#include <logger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::CAMMSTunerPlayer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerPlayer::CAMMSTunerPlayer()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerPlayer* CAMMSTunerPlayer::NewL(CAMMSTunerControl* aTunerControl)
+{
+ CAMMSTunerPlayer* self = new(ELeave) CAMMSTunerPlayer;
+
+ CleanupStack::PushL(self);
+ self->ConstructL(aTunerControl);
+ CleanupStack::Pop();
+
+ return self;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAMMSTunerPlayer::ConstructL(CAMMSTunerControl* aTunerControl)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::ConstructL +");
+ iTunerControl = aTunerControl;
+ iTunerPlayerUtility = iTunerControl->TunerUtility()->TunerPlayerUtilityL(*this);
+ iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
+ iIsInitialized = EFalse;
+
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::ConstructL -");
+}
+
+// Destructor
+CAMMSTunerPlayer::~CAMMSTunerPlayer()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::~CAMMSTunerPlayer +");
+ delete iTunerPlayerUtility;
+ delete iActiveSchedulerWait;
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::~CAMMSTunerPlayer -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::PrefetchL()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::PrefetchL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::PrefetchL +");
+ //this must be called before play, stop, mute etc...
+ iTunerPlayerUtility->InitializeL(EMdaPriorityNormal,
+ EMdaPriorityPreferenceTimeAndQuality);
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start(); // CSI: 10 Active object state already checked. #
+ }
+
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::PrefetchL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::StartL()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::StartL()
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StartL +");
+ if (iIsInitialized)
+ {
+ // inform java side
+ ChangeState(EStarted);
+ iTunerPlayerUtility->Play();
+ // set time when started
+ iStartTime = CurrentTime();
+
+ TInt64 time;
+ GetMediaTime(&time);
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ }
+ else
+ {
+ User::Leave(KErrNotReady);
+ }
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StartL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::StopL()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::StopL(TBool /*aPostEvent*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StopL +");
+ if (iIsInitialized)
+ {
+ ChangeState(EPrefetched);
+
+ iTunerPlayerUtility->Stop();
+
+ TInt64 time;
+ GetMediaTime(&time);
+ iStartTime = KErrNotFound;
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ else
+ {
+ User::Leave(KErrNotReady);
+ }
+
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StopL -");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::DeallocateL()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::DeallocateL()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::GetMediaTime()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ if (iState == EStarted)
+ {
+ // add play time to media time
+ iMediaTime += CurrentTime() - iStartTime;
+ // set new start time
+ iStartTime = CurrentTime();
+ }
+
+ // set value to parameter
+ (*aMediaTime) = iMediaTime;
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::MTapoInitializeComplete
+// Initialize complete event. This event is asynchronous and is received after
+// a call to CMMTunerAudioPlayerUtility::InitializeL().
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::MTapoInitializeComplete(TInt aError)
+{
+ ELOG1( EJavaAMMS, "CAMMSTunerPlayer::MTapoInitializeComplete aError = %d", aError);
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MToTuneComplete AsyncStop");
+ iActiveSchedulerWait->AsyncStop();
+ }
+ if (aError == KErrNone)
+ {
+ iIsInitialized = ETrue;
+ ChangeState(EPrefetched);
+ // Inform Java side.
+ PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ ELOG1( EJavaAMMS, "CAMMSTunerPlayer::MTapoInitializeComplete aError = %d", aError);
+ PostLongEvent(CMMAPlayerEvent::EError, aError);
+ //User::Leave( aError );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::MTapoPlayEvent
+// Passes an asychronous event to the tuner client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CAMMSTunerPlayer::MTapoPlayEvent(
+ MMMTunerAudioPlayerObserver::TEventType /*aEvent*/,
+ TInt /*aError*/, TAny* /*aAdditionalInfo*/)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::MTapoPlayEvent +");
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPlayer::CurrentTime()
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt64 CAMMSTunerPlayer::CurrentTime()
+{
+ TTime time;
+ time.HomeTime();
+ return time.Int64();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/cammstunerpresetshandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CAMMSTunerPresetsHandler.h"
+#include "TAMMSTunerPreset.h"
+
+#include <FMRadioEngineCRKeys.h>
+#include <s32mem.h>
+#include <logger.h>
+
+
+// CONSTANTS
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPresetsHandler::CAMMSTunerPresetsHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerPresetsHandler::CAMMSTunerPresetsHandler()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPresetsHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAMMSTunerPresetsHandler::ConstructL()
+{
+ iCentralRepository = CRepository::NewL(KCRUidFMRadioEngine);
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPresetsHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAMMSTunerPresetsHandler* CAMMSTunerPresetsHandler::NewL()
+{
+ CAMMSTunerPresetsHandler* self = new(ELeave) CAMMSTunerPresetsHandler;
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+
+// Destructor
+CAMMSTunerPresetsHandler::~CAMMSTunerPresetsHandler()
+{
+ delete iCentralRepository;
+}
+
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPresetsHandler::GetPreset
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSTunerPresetsHandler::GetPresetL(TInt aPreset, TAMMSTunerPreset &aTunerPreset)
+{
+ // KFmRadioPresetChannel1 = The first preset channel's location in central repository
+ TInt tempChannelIndex = KFmRadioPresetChannel1 + aPreset;
+
+ HBufC8* buf = HBufC8::NewLC(sizeof(TAMMSTunerPreset));
+ TPtr8 bufPtr = buf->Des();
+
+ TInt err = iCentralRepository->Get(tempChannelIndex, bufPtr);
+ if (err == KErrNone)
+ {
+ RDesReadStream inStream;
+ inStream.Open(bufPtr);
+ CleanupClosePushL(inStream);
+ aTunerPreset.InternalizeL(inStream);
+ CleanupStack::PopAndDestroy(&inStream);
+ }
+ else
+ {
+ User::Leave(err);
+ }
+ CleanupStack::PopAndDestroy(); // buf
+}
+
+// -----------------------------------------------------------------------------
+// CAMMSTunerPresetsHandler::SavePreset
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAMMSTunerPresetsHandler::SavePresetL(TInt aPreset, TAMMSTunerPreset aTunerPreset)
+{
+ // KFmRadioPresetChannel1 = The first preset channel's location in central repository
+ TInt fieldNameIndex = KFmRadioPresetChannel1 + TUint32(aPreset);
+
+ HBufC8* buf = HBufC8::NewLC(sizeof(TAMMSTunerPreset));
+ TPtr8 bufPtr = buf->Des();
+
+ RDesWriteStream outStream(bufPtr);
+ CleanupClosePushL(outStream);
+ aTunerPreset.ExternalizeL(outStream);
+ outStream.CommitL();
+ CleanupStack::PopAndDestroy(&outStream);
+
+ iCentralRepository->Set(fieldNameIndex, bufPtr);
+ CleanupStack::PopAndDestroy(); //buf
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/cammstunervolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to tuner player
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CAMMSTunerVolumeControl.h"
+#include "CAMMSTunerPlayer.h"
+
+#include <logger.h>
+
+
+CAMMSTunerVolumeControl::CAMMSTunerVolumeControl(CAMMSTunerPlayer* aTunerPlayer)
+ : CMMAVolumeControl(aTunerPlayer)
+{
+ iTunerPlayer = aTunerPlayer;
+}
+
+CAMMSTunerVolumeControl* CAMMSTunerVolumeControl::NewL(CAMMSTunerPlayer* aTunerPlayer)
+{
+ LOG( EJavaAMMS, EInfo, "CAMMSTunerVolumeControl::NewL +");
+ CAMMSTunerVolumeControl* self = new(ELeave) CAMMSTunerVolumeControl(aTunerPlayer);
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+void CAMMSTunerVolumeControl::DoSetLevelL(TInt aLevel)
+{
+ LOG1( EJavaAMMS, EInfo, "CAMMSTunerVolumeControl::DoSetLevelL, aLevel = %d", aLevel);
+ // TunerPlayer does not currently have SetVolumeL method
+ User::Invariant();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/protocol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Protocol JNI wrapper.
+ *
+*/
+
+
+// EXTERNAL INCLUDES
+//#include <jutils.h>
+#include <logger.h>
+
+// INTERNAL INCLUDES
+#include "com_nokia_microedition_media_protocol_capture_radio_Protocol.h"
+#include <MMAFunctionServer.h>
+#include "CAMMSTunerControl.h"
+#include "CAMMSTunerPlayer.h"
+#include "AMMSTunerFactory.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+// Creates native tuner player
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer(
+ JNIEnv* aJniEnv,
+ jobject /*aPeer*/,
+ jint aEventSourceHandle,
+ jstring aLocatorParameters)
+{
+ LOG( EJavaAMMS, EInfo, "AMMS Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer +");
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ JStringUtils locatorParams(*aJniEnv, aLocatorParameters);
+
+ CAMMSTunerPlayer* tunerPlayer = NULL;
+
+ TInt error = eventSource->ExecuteTrap(
+ &AMMSTunerFactory::CreatePlayerL,
+ &tunerPlayer,
+ (const TDesC*)&locatorParams);
+
+ ELOG1( EJavaAMMS, "AMMS __1createNativeTunerPlayer, error = %d", error);
+
+ if (error != KErrNone)
+ {
+ return error;
+ }
+
+ return reinterpret_cast<TInt>(tunerPlayer);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/tammstunerpreset.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "TAMMSTunerPreset.h"
+
+#include <s32mem.h>
+#include <logger.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::TAMMSTunerPreset
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TAMMSTunerPreset::TAMMSTunerPreset()
+{
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::SetPresetName
+// -----------------------------------------------------------------------------
+//
+void TAMMSTunerPreset::SetPresetName(const TDesC* aPresetName)
+{
+ iPresetName.Copy(*aPresetName);
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::SetPresetFrequency
+// -----------------------------------------------------------------------------
+//
+void TAMMSTunerPreset::SetPresetFrequency(const TInt aPresetFrequency)
+{
+ iPresetFrequency = aPresetFrequency;
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::SetPresetStereoMode
+// -----------------------------------------------------------------------------
+//
+void TAMMSTunerPreset::SetPresetStereoMode(const TInt aPresetStereoMode)
+{
+ iPresetStereoMode = aPresetStereoMode;
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::PresetName
+// -----------------------------------------------------------------------------
+//
+TPtrC TAMMSTunerPreset::PresetName()
+{
+ return iPresetName;
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::PresetFrequency
+// -----------------------------------------------------------------------------
+//
+TInt TAMMSTunerPreset::PresetFrequency()
+{
+ return iPresetFrequency;
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::PresetStereoMode
+// -----------------------------------------------------------------------------
+//
+TInt TAMMSTunerPreset::PresetStereoMode()
+{
+ return iPresetStereoMode;
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::ExternalizeL
+// Writes preset values to stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TAMMSTunerPreset::ExternalizeL(RWriteStream& aStream) const
+{
+ aStream<<iPresetName;
+ aStream.WriteUint32L(iPresetFrequency);
+ aStream.WriteUint32L(iPresetStereoMode);
+}
+
+// -----------------------------------------------------------------------------
+// TAMMSTunerPreset::InternalizeL
+// Reads preset values from stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TAMMSTunerPreset::InternalizeL(RReadStream& aStream)
+{
+ aStream>>iPresetName;
+ iPresetFrequency = aStream.ReadUint32L();
+ iPresetStereoMode = aStream.ReadUint32L();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/amms_qt/src_tuner/native/src/tunercontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,731 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TunerControl JNI wrapper.
+ *
+*/
+
+
+// EXTERNAL INCLUDES
+//#include <jutils.h>
+
+// INTERNAL INCLUDES
+#include "com_nokia_amms_control_tuner_TunerControlImpl.h"
+#include <MMAFunctionServer.h>
+#include "CAMMSTunerControl.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+/**
+* Static delegator function for getMinFreq
+*/
+LOCAL_C void GetMinFreqL(CAMMSTunerControl* aNativeClass,
+ TInt *aMinFreq)
+{
+
+ *aMinFreq = aNativeClass->MinFreqL();
+}
+
+/**
+* getMinFreq JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getMinFreq(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ TInt minFreq;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetMinFreqL,
+ nativeHandle,
+ &minFreq);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return minFreq;
+}
+
+
+/**
+* Static delegator function for getMaxFreq
+*/
+LOCAL_C void GetMaxFreqL(CAMMSTunerControl* aNativeClass,
+ TInt *aMaxFreq)
+{
+
+ *aMaxFreq = aNativeClass->MaxFreqL();
+}
+
+/**
+* getMaxFreq JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getMaxFreq(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ TInt maxFreq;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetMaxFreqL,
+ nativeHandle,
+ &maxFreq);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return maxFreq;
+}
+
+
+/**
+* Static delegator function for setFrequency
+*/
+LOCAL_C void SetFreqL(CAMMSTunerControl* aNativeClass,
+ TInt aFreq)
+{
+
+ aNativeClass->SetFrequencyL(aFreq);
+}
+
+/**
+* Static delegator function for getFrequency
+*/
+LOCAL_C void GetFreqL(CAMMSTunerControl* aNativeClass,
+ TInt *aFreq)
+{
+ *aFreq = aNativeClass->FrequencyL();
+}
+
+/**
+* setFrequency JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setFrequency(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aFreq)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SetFreqL,
+ nativeHandle,
+ aFreq);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ //get tuned frequency
+ TInt tunedFreq;
+ err = eventSource->ExecuteTrap(GetFreqL,
+ nativeHandle,
+ &tunedFreq);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return tunedFreq;
+}
+
+/**
+* getFrequency JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getFrequency(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ TInt freq;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetFreqL,
+ nativeHandle,
+ &freq);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return freq;
+}
+
+
+/**
+* Static delegator function for seek
+*/
+LOCAL_C void SeekL(CAMMSTunerControl* aNativeClass,
+ TInt aStartFreq,
+ TBool aUpwards,
+ TInt* aSeekedFreq)
+{
+
+ *aSeekedFreq = aNativeClass->SeekL(aStartFreq, aUpwards);
+}
+
+/**
+* seek JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1seek(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aStartFreq,
+ jboolean aUpwards)
+{
+ TInt seekedFreq;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SeekL,
+ nativeHandle,
+ aStartFreq,
+ (TBool) aUpwards,
+ &seekedFreq);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return seekedFreq;
+}
+
+
+/**
+* Static delegator function for getSquelch
+*/
+LOCAL_C void GetSquelchL(CAMMSTunerControl* aNativeClass,
+ TBool* aSquelch)
+{
+
+ *aSquelch = aNativeClass->SquelchL();
+}
+
+/**
+* getSquelch JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getSquelch(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TBool squelch = EFalse;
+
+ TInt err = eventSource->ExecuteTrap(GetSquelchL,
+ nativeHandle,
+ &squelch);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ if (!squelch)
+ {
+ //return 1 if false
+ return 1;
+ }
+ //return 0 if true
+ return KErrNone;
+}
+
+
+/**
+* Static delegator function for setSquelch
+*/
+LOCAL_C void SetSquelchL(CAMMSTunerControl* aNativeClass,
+ TBool aSquelch)
+{
+
+ aNativeClass->SetSquelchL(aSquelch);
+}
+
+/**
+* setSquelch JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setSquelch(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jboolean aSquelch)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SetSquelchL,
+ nativeHandle,
+ (TBool) aSquelch);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return KErrNone;
+}
+
+
+/**
+* Static delegator function for getSignalStrength
+*/
+LOCAL_C void GetSignalStrengthL(CAMMSTunerControl* aNativeClass,
+ TInt *aSignalStrength)
+{
+
+ *aSignalStrength = aNativeClass->SignalStrengthL();
+}
+
+/**
+* getSignalStrength JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getSignalStrength(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ TInt signalStrength;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetSignalStrengthL,
+ nativeHandle,
+ &signalStrength);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return signalStrength;
+}
+
+
+/**
+* Static delegator function for getStereoMode
+*/
+LOCAL_C void GetStereoModeL(CAMMSTunerControl* aNativeClass,
+ TInt *aStereoMode)
+{
+
+ *aStereoMode = aNativeClass->StereoModeL();
+}
+
+/**
+* getStereoMode JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getStereoMode(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle)
+{
+ TInt stereoMode;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetStereoModeL,
+ nativeHandle,
+ &stereoMode);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return stereoMode;
+}
+
+
+/**
+* Static delegator function for setStereoMode
+*/
+LOCAL_C void SetStereoModeL(CAMMSTunerControl* aNativeClass,
+ TInt aStereoMode)
+{
+ aNativeClass->SetStereoModeL(aStereoMode);
+}
+
+/**
+* setStereoMode JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setStereoMode(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aStereoMode)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SetStereoModeL,
+ nativeHandle,
+ aStereoMode);
+
+ return err;
+}
+
+
+/**
+* Static delegator function for usePreset
+*/
+LOCAL_C void UsePresetL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset)
+{
+ aNativeClass->UsePresetL(aPreset);
+}
+
+/**
+* usePreset JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1usePreset(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(UsePresetL,
+ nativeHandle,
+ aPreset);
+
+ return err;
+}
+
+
+/**
+* Static delegator function for setPreset__III
+*/
+LOCAL_C void SetPresetL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset)
+{
+ aNativeClass->SetPresetL(aPreset);
+}
+
+/**
+* setPreset__III JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPreset__III(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SetPresetL,
+ nativeHandle,
+ aPreset);
+
+ return err;
+}
+
+
+/**
+* Static delegator function for setPreset__IIIII
+*/
+LOCAL_C void SetPresetL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset,
+ TInt aFrequency,
+ TInt aStereoMode)
+{
+ aNativeClass->SetPresetL(aPreset, aFrequency, aStereoMode);
+}
+
+/**
+* setPreset__IIIII JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPreset__IIIII(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset,
+ jint aFrequency,
+ jint aStereoMode)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(SetPresetL,
+ nativeHandle,
+ aPreset,
+ aFrequency,
+ aStereoMode);
+
+ return err;
+}
+
+
+/**
+* Static delegator function for getPresetFrequency
+*/
+LOCAL_C void GetPresetFreqL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset,
+ TInt *aPresetFreq)
+{
+
+ *aPresetFreq = aNativeClass->PresetFrequencyL(aPreset);
+}
+
+/**
+* getPresetFrequency JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetFrequency(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset)
+{
+ TInt presetFreq;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetPresetFreqL,
+ nativeHandle,
+ aPreset,
+ &presetFreq);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return presetFreq;
+}
+
+
+/**
+* Static delegator function for getPresetStereoMode
+*/
+LOCAL_C void GetPresetStereoModeL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset,
+ TInt *aPresetStereoMode)
+{
+
+ *aPresetStereoMode = aNativeClass->PresetStereoModeL(aPreset);
+}
+
+/**
+* getPresetStereoMode JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetStereoMode(
+ JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset)
+{
+ TInt presetStereoMode;
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(GetPresetStereoModeL,
+ nativeHandle,
+ aPreset,
+ &presetStereoMode);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ return presetStereoMode;
+}
+
+
+/**
+* Static delegator function for setPresetName
+*/
+LOCAL_C void SetPresetNameL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset,
+ const TDesC* aPresetName)
+{
+ aNativeClass->SetPresetNameL(aPreset, aPresetName);
+}
+
+/**
+* setPresetName JNI function
+*/
+JNIEXPORT jint JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPresetName(
+ JNIEnv* aJni,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset,
+ jstring aPresetName)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ JStringUtils presetName(*aJni, aPresetName);
+
+ TInt err = eventSource->ExecuteTrap(SetPresetNameL,
+ nativeHandle,
+ aPreset,
+ (const TDesC*)&presetName);
+
+ return err;
+}
+
+
+/**
+* Static delegator function for getPresetName
+*/
+LOCAL_C void GetPresetNameL(CAMMSTunerControl* aNativeClass,
+ TInt aPreset,
+ TPtrC* aPresetName)
+{
+ aNativeClass->GetPresetNameL(aPreset, aPresetName);
+}
+
+/**
+* getPresetName JNI function
+*/
+JNIEXPORT jstring JNICALL
+Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetName(
+ JNIEnv* aJni,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aTunerControlHandle,
+ jint aPreset,
+ jintArray aError)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CAMMSTunerControl* nativeHandle =
+ reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
+
+ TPtrC presetNamePtr(NULL, 0);
+ jstring presetName = NULL;
+
+ TInt err = eventSource->ExecuteTrap(GetPresetNameL,
+ nativeHandle,
+ aPreset,
+ &presetNamePtr);
+
+ if (err == KErrNone)
+ {
+ presetName = S60CommonUtils::NativeToJavaString(*aJni, presetNamePtr);
+ if (!presetName)
+ {
+ err = KErrNotSupported;
+ }
+ }
+
+ jint javaErr[ 1 ] = { err };
+ aJni->SetIntArrayRegion(aError, 0, 1, javaErr);
+
+ return presetName;
+}
+
+// End of file
--- a/javauis/coreui_akn/build/javacoreui_0x2002DCA8.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/coreui_akn/build/javacoreui_0x2002DCA8.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -115,6 +114,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/coreui_akn/src/javauiavkonimpl.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/coreui_akn/src/javauiavkonimpl.cpp Tue May 11 16:07:20 2010 +0300
@@ -197,20 +197,25 @@
setDefaultProcessPriority(timeForCurrentPriority);
}
- if (hasStartScreen())
+ if (event.Type() == EEventFocusLost)
{
- ASSERT(mAppView);
- if (event.Type() == EEventFocusLost)
+ mIsForeground = false;
+ if (hasStartScreen())
{
- mIsForeground = false;
- mAppView->HandleForeground(false);
+ ASSERT(mAppView);
+ mAppView->HandleForeground(false);
}
- else if (event.Type() == EEventFocusGained)
+ }
+ else if (event.Type() == EEventFocusGained)
+ {
+ mIsForeground = true;
+ if (hasStartScreen())
{
- mIsForeground = true;
+ ASSERT(mAppView);
mAppView->HandleForeground(true);
}
}
+
bool eventBlocked = false;
if (mActiveChild)
{
--- a/javauis/coreui_akn/src/startupscreen/startscreen.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/coreui_akn/src/startupscreen/startscreen.cpp Tue May 11 16:07:20 2010 +0300
@@ -626,28 +626,18 @@
{
if (mState == ESyncRead)
{
- if (iStatus == KErrUnderflow)
- {
- ELOG1(EJavaUI, "CStartScreen::RunL, "
- "CImageDecoder::Convert failed: %d", KErrUnderflow);
- mDecoder->ContinueConvert(&iStatus);
- SetActive();
- }
- else
+ if (mWait.IsStarted())
{
- if (mWait.IsStarted())
- {
- mWait.AsyncStop();
- }
+ mWait.AsyncStop();
+ }
- // Release the lock on the file.
- ASSERT(mDecoder);
- delete mDecoder;
- mDecoder = NULL;
+ // Release the lock on the file.
+ ASSERT(mDecoder);
+ delete mDecoder;
+ mDecoder = NULL;
- // Reset state
- mState = EIdle;
- }
+ // Reset state
+ mState = EIdle;
}
else if (mState == EAsyncWrite)
{
--- a/javauis/coreui_akn/src/startupscreen/startscreencontainer.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/coreui_akn/src/startupscreen/startscreencontainer.cpp Tue May 11 16:07:20 2010 +0300
@@ -19,9 +19,9 @@
#include <data_caging_path_literals.hrh>
#include <AknsDrawUtils.h>
#include <AknUtils.h>
-#ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
+#ifdef RD_JAVA_S60_RELEASE_9_2
#include <alf/alfdrawer.h>
-#endif // RD_JAVA_UI_ALFDRAWER_ENABLED
+#endif // RD_JAVA_S60_RELEASE_9_2
#include "startscreencontainer.h"
#include "startscreen.h"
@@ -236,7 +236,11 @@
TBool CStartScreenContainer::HidesIndicators() const
{
+#ifdef RD_JAVA_S60_RELEASE_9_2
return (mStartScreen && mStartScreen->Type() == CStartScreen::EStartScreenAutomatic);
+#else
+ return EFalse;
+#endif
}
void CStartScreenContainer::Draw(const TRect& aRect) const
@@ -314,6 +318,7 @@
JELOG2(EJavaUI);
mStartScreenTimer = CStartScreenTimer::NewL(*this);
+ mStartScreenTimer->Start();
CreateWindowL();
SetMopParent(&mAppUi);
--- a/javauis/eswt_akn/eswtapifacade/src/swtbrowserschemehandler.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtapifacade/src/swtbrowserschemehandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -16,8 +16,8 @@
*/
+#include <schemehandler.h>
-#include <schemehandler.h>
#include "swtbrowserschemehandler.h"
--- a/javauis/eswt_akn/eswtapifacade/src/swtlaffacade.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtapifacade/src/swtlaffacade.cpp Tue May 11 16:07:20 2010 +0300
@@ -377,9 +377,16 @@
layoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::
list_single_popup_submenu_pane(0).LayoutLine());
break;
+
case EPopupEswtTasktipWindow:
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ layoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::
+ popup_discreet_window(aArg1).LayoutLine());
+#else
layoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::
popup_eswt_tasktip_window(aArg1).LayoutLine());
+#endif
+
break;
case EWaitBarPaneCp71:
layoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::
@@ -576,10 +583,6 @@
layoutText.LayoutText(aRect, AknLayout::
Form_data_wide_graphic_field_texts_Line_2(aArg1));
break;
- case EPopupEswtTasktipWindowT1:
- layoutText.LayoutText(aRect, AknLayoutScalable_Avkon::
- popup_eswt_tasktip_window_t1(aArg1).LayoutLine());
- break;
case ETabs4ActivePaneT1:
layoutText.LayoutText(aRect, AknLayoutScalable_Avkon::
tabs_4_active_pane_t1(aArg1).LayoutLine());
--- a/javauis/eswt_akn/eswtapifacade/src/swtpopupformproxyprivate.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtapifacade/src/swtpopupformproxyprivate.cpp Tue May 11 16:07:20 2010 +0300
@@ -110,7 +110,6 @@
//
void CSwtPopupFormProxyPrivate::ProcessCommandL(TInt aCommandId)
{
-
if (iTimeOut)
{
// if timed messsagebox
@@ -134,11 +133,19 @@
TKeyResponse CSwtPopupFormProxyPrivate::OfferKeyEventL(const TKeyEvent& aKeyEvent,
TEventCode aType)
{
-
if (!iTimeOut)
{
// Other than TimedMessageBox
- CAknPopupForm::OfferKeyEventL(aKeyEvent, aType);
+ TKeyResponse res = CAknPopupForm::OfferKeyEventL(aKeyEvent, aType);
+ if (aType == EEventKey && res == EKeyWasNotConsumed)
+ {
+ if (aKeyEvent.iCode == EKeyEnter || aKeyEvent.iCode == EKeyOK)
+ {
+ // Trigger the positive CBA action / soft key
+ TKeyEvent ev = {EKeyCBA1, EStdKeyDevice0, 0, 0};
+ TRAP_IGNORE(CCoeEnv::Static()->SimulateKeyEventL(ev, EEventKey));
+ }
+ }
}
else
{
@@ -152,7 +159,7 @@
CAknPopupForm::OfferKeyEventL(aKeyEvent, aType);
}
}
-
+
// Keys cannot be allowed to "pass trough" the dialog.
return EKeyWasConsumed;
}
@@ -166,7 +173,6 @@
void CSwtPopupFormProxyPrivate::HandlePointerEventL(
const TPointerEvent& aPointerEvent)
{
-
if (!iTimeOut)
{
// if not a timed messagebox
--- a/javauis/eswt_akn/eswtdirectcontent/build/eswtdirectcontent_0x2002DC94.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtdirectcontent/build/eswtdirectcontent_0x2002DC94.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -99,6 +98,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 12.19065
--- a/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdccontrol.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdccontrol.h Tue May 11 16:07:20 2010 +0300
@@ -51,7 +51,7 @@
, public MSwtAppFocusObserver
, public MMMAContainer
, public MSwtDcEventConsumer
-#ifdef SWTDCCONTROL_DSA_ENABLED
+#ifdef SWTDCCONTROL_DSA_ENABLED
, public MDirectScreenAccess
#endif
{
@@ -119,8 +119,8 @@
public: // From MSwtDcFullscreenProvider
void HandleDcEvent(int aType);
-
-#ifdef SWTDCCONTROL_DSA_ENABLED
+
+#ifdef SWTDCCONTROL_DSA_ENABLED
public: // MDirectScreenAccess
void Restart(RDirectScreenAccess::TTerminationReasons aReason);
void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
@@ -153,7 +153,7 @@
private:
TBool IsControlActive() const;
-#ifdef SWTDCCONTROL_DSA_ENABLED
+#ifdef SWTDCCONTROL_DSA_ENABLED
TBool IsDsaRegionValid() const;
#endif
TBool IsContentVisibilityAllowed() const;
@@ -188,13 +188,13 @@
// True, is DSA was started already
TBool iDsaWasStartedAlready;
#endif
-
+
// Own.
// This observer receives requests from any thread and asynchronously
// calls a callback in ESWT thread to a given receiver
CSwtDcObserver* iDcObserver;
-
-
+
+
};
--- a/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdceventconsumer.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdceventconsumer.h Tue May 11 16:07:20 2010 +0300
@@ -12,7 +12,7 @@
* Contributors:
*
* Description: THIS FILE IS NOT INCLUDED INTO ECLIPSE CVS DELIVERY
-* An interface to sent events from using CSwtDcObserver.
+* An interface to sent events from using CSwtDcObserver.
*
*/
@@ -22,7 +22,7 @@
class MSwtDcEventConsumer
{
public:
- virtual void HandleDcEvent(int aType) = 0;
+ virtual void HandleDcEvent(int aType) = 0;
};
#endif // SWTDCEVENTCONSUMER_H
--- a/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdcobserver.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtdirectcontent/native/inc/swtdcobserver.h Tue May 11 16:07:20 2010 +0300
@@ -99,7 +99,7 @@
* @param aCallbackId Id which is provided to the callback
*/
void InvokeUICallback(MUiEventConsumer& aConsumer, TInt aCallbackId);
-
+
private:
/** CSwtDcObserver event datatype */
enum TDcEventType
@@ -148,7 +148,7 @@
MUiEventConsumer *aConsumer,
TInt aCallbackId);
-
+
// from base class CActive
/**
--- a/javauis/eswt_akn/eswtdirectcontent/native/src/swtdccontrol.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/eswtdirectcontent/native/src/swtdccontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -422,7 +422,7 @@
}
}
#else
- (void)aFocused; //Supresses compilation warning
+ (void)aFocused; //Supresses compilation warning
#endif
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/build/eswt.pro Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/build/eswt.pro Tue May 11 16:07:20 2010 +0300
@@ -124,7 +124,6 @@
../src/swttableitemdrawer.cpp \
../src/swttablelistbox.cpp \
../src/swttablelistboxview.cpp \
- ../src/swttasktip.cpp \
../src/swttext.cpp \
../src/swttextbase.cpp \
../src/swttextextension.cpp \
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/build/eswt_0x2002DC93.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/build/eswt_0x2002DC93.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -169,7 +168,6 @@
SOURCE swttableitemdrawer.cpp
SOURCE swttablelistbox.cpp
SOURCE swttablelistboxview.cpp
-SOURCE swttasktip.cpp
SOURCE swttext.cpp
SOURCE swttextbase.cpp
SOURCE swttextextension.cpp
@@ -255,6 +253,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 12.19065
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/browserpreferences.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/browserpreferences.h Tue May 11 16:07:20 2010 +0300
@@ -34,29 +34,32 @@
TUint iAssocVpn;
TBool iAccessPointSelectionMode;
TBool iAutoLoadImages;
- TInt iFontSize;
+ TUint iFontSize;
TBool iTextWrap;
- TWmlSettingsCookies iCookies;
+ TBool iCookies;
TBool iPageOverview;
TBool iBackList;
TBool iAutoRefresh;
- TWmlSettingsECMA iEcma;
- TWmlSettingsIMEI iIMEINotification;
+ TBool iEcma;
+ TBool iIMEINotification;
TUint32 iEncoding;
- TWmlSettingsFullScreen iFullScreen;
+ TBool iFullScreen;
TBool iQueryOnExit;
TBool iSendReferrer;
- TWmlSettingsHomePage iHomePgType;
+ TUint iHomePgType;
TBool iHTTPSecuritySupressed;
TBool iConnDialogs;
TBool iHttpSecurityWarnings;
- TInt iMediaVolume;
+ TUint iMediaVolume;
HBufC* iSearchPgURL;
HBufC* iHomePgURL;
TBool iPopupBlocking;
- TWmlSettingsFormData iFormDataSaving;
- TWmlSettingsAutomaticUpdating iAutomaticUpdating;
+ TUint iFormDataSaving;
+ TUint iAutomaticUpdating;
TUint iAutomaticUpdatingAP;
+ TUint iZoomMin;
+ TUint iZoomMax;
+ TUint iZoomDef;
};
@@ -106,7 +109,7 @@
* central repository values
* @return Returns references of TPreferencesValues which contains all preferences
*/
- virtual const TPreferencesValues& AllPreferencesL() = 0;
+ virtual const TPreferencesValues& AllPreferences() const = 0;
/**
* To access DefaultAccessPoint setting
@@ -216,20 +219,20 @@
* To access Cookies setting
* @return TWmlSettingsCookies
*/
- virtual TWmlSettingsCookies Cookies() const = 0;
+ virtual TBool Cookies() const = 0;
/**
* To access ECMA setting
* @return TWmlSettingsECMA
*/
- virtual TWmlSettingsECMA Ecma() const = 0;
+ virtual TBool Ecma() const = 0;
/**
* Get IMEI notification setting
* @return EWmlSettingsIMEIEnable if notification is enabled,
* otherwise EWmlSettingsIMEIDisable
*/
- virtual TWmlSettingsIMEI IMEINotification() const = 0;
+ virtual TBool IMEINotification() const = 0;
/**
* Sends/Don not send the referrer header
@@ -249,7 +252,7 @@
* To access Form Data Saving setting.
* @return value of setting
*/
- virtual TWmlSettingsFormData FormDataSaving() const = 0;
+ virtual TUint FormDataSaving() const = 0;
/**
* Adds an observer to be notified about changes. Derived classes MUST
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswt.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswt.h Tue May 11 16:07:20 2010 +0300
@@ -801,7 +801,7 @@
* Unregisters a resource change observer.
*/
virtual void RemoveResourceChangeObserver(MSwtResourceChangeObserver* aObserver) = 0;
-
+
/**
* Registers app focus observer.
* MSwtUiUtils and MSwtShell instances are already informed separately so don't add them.
@@ -1138,7 +1138,7 @@
* Checks if the UI has started to be displayed on screen.
*/
virtual TBool IsUiReady() const =0;
-
+
/**
* Whatever UI component is getting ready to be displayed should notify the display.
* @param aFullScreenUi Specifies if the starting ui is full screen.
@@ -1155,15 +1155,15 @@
* Returns names of all fonts according to aScalable parameter.
*/
virtual CDesC16ArrayFlat* GetFontNamesL(TBool aScalable) const =0;
-
+
/**
- * Check if the current pointer event being handled is
+ * Check if the current pointer event being handled is
* intended to revert the state of the grabbing control.
*/
virtual TBool RevertPointerEvent() const =0;
-
+
/**
- * Set the current pointer event being handled as
+ * Set the current pointer event being handled as
* intended to revert the state of the grabbing control.
*/
virtual void SetRevertPointerEvent(TBool aStatus) =0;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtexpanded.hrh Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtexpanded.hrh Tue May 11 16:07:20 2010 +0300
@@ -17,117 +17,59 @@
// FullScreen
enum TWmlSettingsFullScreen
- {
+{
EWmlSettingsFullScreenSoftkeysOnly,
EWmlSettingsFullScreenFullScreen
- };
+};
// MediaVolume
enum TWmlSettingsMediaVolume
- {
+{
EWmlSettingsVolumeMuted = 0,
EWmlSettingsVolume1 = 2,
EWmlSettingsVolume2 = 5,
EWmlSettingsVolume3 = 8,
EWmlSettingsVolume4 = 10
- };
+};
// Automatic updating
enum TWmlSettingsAutomaticUpdating
- {
+{
EWmlSettingsAutomaticUpdatingWeekly,
EWmlSettingsAutomaticUpdatingDaily,
EWmlSettingsAutomaticUpdating4hours,
EWmlSettingsAutomaticUpdatingHourly,
EWmlSettingsAutomaticUpdating15min,
EWmlSettingsAutomaticUpdatingOff
- };
+};
// Cookies
enum TWmlSettingsCookies
- {
+{
EWmlSettingsCookieReject,
EWmlSettingsCookieAllow
- };
+};
// ECMA
enum TWmlSettingsECMA
- {
+{
EWmlSettingsECMADisable,
EWmlSettingsECMAEnable
- };
+};
// IMEI
enum TWmlSettingsIMEI
- {
+{
EWmlSettingsIMEIDisable,
EWmlSettingsIMEIEnable
- };
-
-// HomePage
-enum TWmlSettingsHomePage
- {
- EWmlSettingsHomePageAccessPoint, // 0
- EWmlSettingsHomePageAddress, // 1
- EWmlSettingsHomePageUseCurrent, // 2
- EWmlSettingsHomePageBookmarks // 3
- };
-
-// FormData
-enum TWmlSettingsFormData
- {
- EWmlSettingsFormDataOff, // 0
- EWmlSettingsFormDataOnly, // 1
- EWmlSettingsFormDataPlusPassword // 2
- };
-
-// settings listbox items
-enum TWmlBrowserSettingsItems
- {
- // Main Settings Categories
- EWmlSettingsGeneral = 0,
- EWmlSettingsPage,
- EWmlSettingsPrivacy,
- EWmlSettingsWebFeeds,
-
- // Individual Settings
- EWmlSettingsAccesspoint,
- EWmlSettingsAutoLoadImages,
- EWmlSettingsPageOverview,
- EWmlSettingsBackList,
- EWmlSettingsAutoRefresh,
- EWmlSettingsEncoding,
- EWmlSettingsFullScreen,
- EWmlSettingsCookies,
- EWmlSettingsEcma,
- EWmlSettingsHttpSecurityWarnings,
- EWmlSettingsIMEINotification,
-
- EWmlSettingsMediaVolume,
- EWmlSettingsAutomaticUpdating,
- EWmlSettingsAutomaticUpdatingAP,
- EWmlSettingsHomePage,
- EWmlSettingsFormDataSaving,
- EWmlSettingsFontSize,
-
- // Multiple Windows Support
- EWmlSettingsPopupBlocking,
-
-
-
- // For CDMA settings, use any values within this range
- EWmlSettingsCDMAMin = 50,
- EWmlSettingsSendReferrer,
- EWmlSettingsCDMAMax = 70
- };
-
+};
// Default Access Point
enum TWmlSettingsAccessPointSelectionMode
- {
+{
EWmlSettingsAccessPointSelectionModeUserDefined,
EWmlSettingsAccessPointSelectionModeAlwaysAsk
- };
+};
#endif // ESWTEXPANDED_HRH
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtgraphics.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtgraphics.h Tue May 11 16:07:20 2010 +0300
@@ -599,7 +599,7 @@
* Copies a rectangular area to a given position.
*/
virtual void CopyArea(const TRect& aSource, const TPoint& aDestination) =0;
-
+
#ifdef RD_JAVA_NGA_ENABLED
/**
* Ensure that all drawing commands have been issued and
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtmobileextensions.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtmobileextensions.h Tue May 11 16:07:20 2010 +0300
@@ -1437,23 +1437,6 @@
/**
- * Interface class for the org.eclipse.ercp.swt.mobile.TaskTip class.
- */
-class MSwtTaskTip
-{
-protected:
- virtual ~MSwtTaskTip() {} // Made protected to prevent destruction through the interface
-
-public:
- virtual TSwtPeer Dispose() =0;
- virtual TRect GetBarDefaultBounds(TBool aHasText) const=0;
- virtual TRect GetLabelDefaultBounds(TBool aHasText) const=0;
- virtual TRect GetShellDefaultBounds(TBool aHasText) const=0;
- virtual TSwtPeer JavaPeer() const =0;
-};
-
-
-/**
* Interface class for the org.eclipse.ercp.swt.mobile.TextExtension class.
*/
class MSwtTextExtension
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtwidgetscore.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtwidgetscore.h Tue May 11 16:07:20 2010 +0300
@@ -52,7 +52,6 @@
class MSwtListBox;
class MSwtListView;
class MSwtSortedList;
-class MSwtTaskTip;
class MSwtTextExtension;
class MSwtClipboard;
class MSwtTableColumn;
@@ -762,9 +761,9 @@
virtual TBool IsLongTapAnimationCandidate(const TPointerEvent& aPointerEvent) const =0;
virtual void DoControlSpecificFeedback(const TBool& aFirstTap,
- const TBool& aTappedToChildRect,
+ const TBool& aTappedToChildRect,
const TPointerEvent& aPointerEvent) const = 0;
-
+
virtual void PostMouseEventL(const TPointerEvent& aPointerEvent) = 0;
};
@@ -956,7 +955,7 @@
* In case this is a ScrolledComposite, returns one of the possible physics actions defined in eswt.h
*/
virtual TInt ScrolledCompositePysicsAction() const = 0;
-
+
/**
* Draw scrollbar background.
*/
@@ -1128,7 +1127,7 @@
* Interface class for the org.eclipse.swt.widgets.Shell class
* A class that implements MSwtShell must also implement MSwtDecorations.
*/
-class MSwtShell
+class MSwtShell
: public MEikStatusPaneObserver
{
public:
@@ -1397,12 +1396,18 @@
*/
virtual TBool AsyncPainting() const = 0;
virtual void SetAsyncPainting(TBool aStatus) = 0;
-
+
/**
* Attached CBA to the Shell. Cannot be undone.
*/
virtual void InstallCba() = 0;
virtual TBool HasCba() const = 0;
+
+ /**
+ * Set task tip style.
+ */
+ virtual void SetTaskTip() = 0;
+ virtual TBool IsTaskTip() const = 0;
};
/**
@@ -2798,18 +2803,18 @@
* Returns number of active browsers in applicaition.
*/
virtual TInt ActiveBrowserCount() const = 0;
-
+
/**
* Setter and getter for key input flag.
*/
virtual TBool NaviKeyInput() const = 0;
virtual void SetNaviKeyInput(TBool aKeyInput) = 0;
-
+
/**
* This should be always used to hide, show the CBA.
*/
virtual void SetCbaVisible(TBool aVisible) = 0;
-
+
/**
* Returns the pointer to the control that is currently receiving the pointer events
* because it has received EButton1Down event. This returns a valid control only between
@@ -2817,6 +2822,22 @@
* @return Pointer to the control that is receiving the pointer events currently or NULL.
*/
virtual MSwtControl* GetPointerGrabbingControl() = 0;
+
+ /**
+ * Default bounds for TaskTips
+ */
+ virtual TRect TaskTipRect() const = 0;
+
+ /**
+ * Sets the pointerGrabbingControl
+ * Calling with NULL of course unsets.
+ */
+ virtual void SetPointerCaptureControl(MSwtControl* aControl) = 0;
+
+ /**
+ * Returns the current control that is grabbing the pointer events.
+ */
+ virtual MSwtControl* PointerCaptureControl() = 0;
};
@@ -3157,14 +3178,6 @@
TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
/**
- * Constructs a TaskTip
- * @param aDisplay The Display this TaskTip belongs to.
- * @param aPeer The Java object associated with this C++ object
- */
- virtual MSwtTaskTip* NewTaskTipL(MSwtDisplay& aDisplay,
- TSwtPeer aPeer, TInt aStyle) const =0;
-
- /**
* Constructs a TextExtension
* @param aDisplay The Display this TextExtension belongs to.
* @param aPeer The Java object associated with this C++ object
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtbrowserpreferences.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtbrowserpreferences.h Tue May 11 16:07:20 2010 +0300
@@ -70,7 +70,7 @@
// From MActiveApDbObserver
// From MBrowserPreferences
- const TPreferencesValues& AllPreferencesL();
+ const TPreferencesValues& AllPreferences() const;
void AddObserverL(MPreferencesObserver* anObserver);
void RemoveObserver(MPreferencesObserver* anObserver);
void NotifyObserversL(TPreferencesEvent aEvent,
@@ -85,7 +85,6 @@
TUint aAssocVpn = KWmlNoDefaultAccessPoint);
void SetFontSizeL(TInt aFontSize);
void SetEncodingL(TUint32 aEncoding);
- void SetHomePageTypeL(TWmlSettingsHomePage aHomePageType);
TPtrC SelfDownloadContentTypesL();
TBool AccessPointSelectionMode();
void SetAccessPointSelectionModeL(
@@ -93,12 +92,12 @@
TBool AutoLoadImages() const;
TBool BackList() const;
TBool AutoRefresh() const;
- TWmlSettingsCookies Cookies() const;
- TWmlSettingsECMA Ecma() const;
- TWmlSettingsIMEI IMEINotification() const;
+ TBool Cookies() const;
+ TBool Ecma() const;
+ TBool IMEINotification() const;
TBool SendReferrer() const;
TBool PageOverview() const;
- virtual TWmlSettingsFormData FormDataSaving() const;
+ TUint FormDataSaving() const;
private:
/**
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtbutton.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtbutton.h Tue May 11 16:07:20 2010 +0300
@@ -135,19 +135,19 @@
void RetrieveDefaultFontL();
void ProcessFontUpdate();
-
+
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
/**
* Returns ETrue when tactile feedback is needed on touch down
*/
TBool IsFeedbackOnTouchDownNeeded(
- const TPointerEvent& aPointerEvent) const;
+ const TPointerEvent& aPointerEvent) const;
/**
* Returns ETrue when tactile feedback is needed on touch release
*/
TBool IsFeedbackOnTouchReleaseNeeded(
- const TPointerEvent& aPointerEvent) const;
+ const TPointerEvent& aPointerEvent) const;
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
// From CCoeControl
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcaptionedcontrol.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcaptionedcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -42,7 +42,7 @@
* @return pointer to an object of this class
*/
static CSwtCaptionedControl* NewL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
- MSwtComposite& aParent, TInt aStyle);
+ MSwtComposite& aParent, TInt aStyle);
private:
/**
@@ -264,7 +264,7 @@
* Not Own.
*/
const MSwtColor* iForegroundColor;
-
+
/**
* Can be the child or null.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtclipboard.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtclipboard.h Tue May 11 16:07:20 2010 +0300
@@ -80,7 +80,7 @@
* The java peer object
*/
const TSwtPeer iPeer;
-
+
CEikonEnv* iCoeEnv;
};
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcomposite.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcomposite.h Tue May 11 16:07:20 2010 +0300
@@ -19,7 +19,9 @@
#include <mswtphysics.h>
#include "eswtwidgetscore.h"
#include "swtscrollablebase.h"
-
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+#include <touchfeedback.h>
+#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
class CEikScrollBarFrame;
class CSwtScrollBar;
@@ -136,6 +138,7 @@
void PaintUrgently() const;
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
void UpdateTactileFeedbackDensity();
+ void DoScrollingFeedback();
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
// Data
@@ -205,8 +208,10 @@
/**
* Kinetic scrolling tactile feedback
*/
+ MTouchFeedback* iFeedback; // Not own
TInt iLastTactileFeedbackPos;
- TInt iTactileFeedbackDensity;
+ TInt iTactileFeedbackDensity;
+ TInt iLastPointerEventType;
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
};
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcontrolbase.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtcontrolbase.h Tue May 11 16:07:20 2010 +0300
@@ -71,7 +71,7 @@
* its parent. Other controls in the same parent are not taken
* into account.
* @param aRect Rectangle to be clipped
- * @return Clipped rectangle
+ * @return Clipped rectangle
*/
TRect ClipToVisibleRect(const TRect& aRect) const;
@@ -148,6 +148,9 @@
*/
void RedrawFocusBackground();
+ /**
+ * Checks if this controls should display a border / frame in case of Shells.
+ */
TBool HasBorderStyle() const;
/**
@@ -236,14 +239,14 @@
* Needs to be called by all inheritors from their PositionChanged().
*/
IMPORT_C void HandlePositionChanged();
-
+
/**
* Draws the non-window-owning component controls of the specified control
* The GC must have already been activated.
*/
static void DrawComponentControls(const CCoeControl& aControl,
const TRect& aRect, CWindowGc& aGc, TBool aCanDrawOutsideRect);
-
+
static TBool RectContainsRect(const TRect& aContainer, const TRect& aContainee);
/**
@@ -260,17 +263,17 @@
* Check if one of the children is focused.
*/
TBool ChildIsFocused() const;
-
+
/**
* Same as SetFontL but without redraw.
*/
void DoSetFontL(const MSwtFont* aFont);
-
+
/**
* Same as SetBackgroundL but without redraw.
*/
void DoSetBackgroundL(const MSwtColor* aColor);
-
+
/**
* Same as SetForegroundL but without redraw.
*/
@@ -417,7 +420,7 @@
// True if control changed its focus.
// Currently used for advanced tactile feedback.
TBool iFocusChanged;
-
+
/**
* Used to implement visual pressed down feedback for some controls.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtdateeditor.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtdateeditor.h Tue May 11 16:07:20 2010 +0300
@@ -118,7 +118,7 @@
* @param aIsFieldNumeric indicates whether field is numeric field
* @returns true if field was modified, false otherwise.
*/
- TBool CSwtDateEditor::IsCurrentFieldChanged(TBool aIsFieldNumeric);
+ TBool IsCurrentFieldChanged(TBool aIsFieldNumeric);
/**
* Updates current field counters if necessary.
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtdisplaybase.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtdisplaybase.h Tue May 11 16:07:20 2010 +0300
@@ -192,11 +192,11 @@
// From MSwtPopupMenuCallBack
public:
void HandlePopupMenuClosedL();
-
+
// From MSwtMediaKeysListener
public:
void HandleMediaKeyEvent(TKeyEvent& aKeyEvent, TInt aEventType);
-
+
private:
TInt LoadResourceFileL();
@@ -204,10 +204,10 @@
protected:
// The thread of the Java VM
RThread iJavaUiThread;
-
+
// The event queue, owned, cannot be NULL
CSwtEventQueue* iEventQueue;
-
+
// Our status object used for notification of events
TRequestStatus iRequestStatus;
@@ -215,62 +215,62 @@
protected:
// DLL's factory, owned, cannot be NULL
MSwtFactory* iFactory;
-
+
// The UI utility object, owned, cannot be NULL
MSwtUiUtils* iUiUtils;
-
+
// The Menu arranger, owned, cannot be NULL
MSwtMenuArranger* iMenuArranger;
-
+
// The Command arranger, owned, may be NULL
MSwtCommandArranger* iCommandArranger;
-
+
// The key mapper, owned, cannot be NULL
CSwtKeyMapper* iKeyMapper;
-
- // The system font, object owned. Null at construction,
+
+ // The system font, object owned. Null at construction,
// allocated at the first SystemFontL() method call.
MSwtFont* iSystemFont;
-
+
// The java side timers that are currently active
- RPointerArray<CSwtTimer> iTimers;
-
+ RPointerArray<CSwtTimer> iTimers;
+
// Registered resource change observers
RPointerArray<MSwtResourceChangeObserver> iResourceChangeObservers;
-
+
// Registered app focus observers
RPointerArray<MSwtAppFocusObserver> iAppFocusObservers;
-
+
// The unique instance of the mobile device
MSwtMobileDevice* iMobileDevice;
-
+
// The listener object for media keys
CSwtMIDRemConObserver* iRemConObserver;
-
- // The shared object taking care of drawing the Java
+
+ // The shared object taking care of drawing the Java
// content for all controls, owned, cannot be NULL
CSwtJavaBufferDrawer* iJavaBufferDrawer;
-
+
#ifdef RD_SCALABLE_UI_V2
// The long tap detector, cannot be NULL
CAknLongTapDetector* iLongTapDetector;
-
+
// Indicates if a long tap has been detected after the previous EButton1Down event.
TBool iLongTapDetected;
-
+
// The pointer event of type EButton1Down which initiates the long tap
TPointerEvent iLongTapPointerEvent;
-
+
// The control upon which long tap started
MSwtControl* iLongTapControl;
#endif
-
+
// Id of the loaded resource file
TInt iResId;
-
+
// Cached Coe env reference.
CEikonEnv* iCoeEnv;
-
+
// Flag for state reverting pointer events.
TBool iRevertPointerEvent;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtedwincustomdrawer.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtedwincustomdrawer.h Tue May 11 16:07:20 2010 +0300
@@ -56,7 +56,7 @@
const TInt aStart, const TInt aEnd, const TPoint& aTextOrigin,
TInt aExtraPixels) const;
#endif
-
+
TRgb SystemColor(TUint aColorIndex, TRgb aDefaultColor) const;
private:
@@ -64,13 +64,13 @@
* Control owning the drawer.
*/
const CEikEdwin& iEdwin;
-
+
/**
* Original drawer used for actual drawing.
* Not own.
*/
const MFormCustomDraw* iEdWinDrawer;
-
+
/**
* Clipping rectangle.
* Applied before iEdWinDrawer draws.
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtfactory.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtfactory.h Tue May 11 16:07:20 2010 +0300
@@ -103,8 +103,6 @@
MSwtComposite& aParent, TInt aStyle) const;
MSwtSortedList* NewSortedListL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
MSwtComposite& aParent, TInt aStyle) const;
- MSwtTaskTip* NewTaskTipL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
- TInt aStyle) const;
MSwtTextExtension* NewTextExtensionL(MSwtDisplay& aDisplay,
TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const;
void RunTimedMessageBoxDlgLD(const TDesC& aTitle, const TDesC& aMessage,
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtgrid.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtgrid.h Tue May 11 16:07:20 2010 +0300
@@ -68,7 +68,7 @@
* Updates item drawer's custom clipping rectangle.
*/
void SetItemDrawerClippingRect(const TRect& aRect);
-
+
/**
* Wrapper for protected member function HandleScrollEventL of CAknGrid.
*/
@@ -80,7 +80,7 @@
// From CAknGrid
protected:
void CreateItemDrawerL();
-
+
private:
/**
* Called when size or position has changed.
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swthyperlink.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swthyperlink.h Tue May 11 16:07:20 2010 +0300
@@ -135,7 +135,7 @@
* Link fragment text color.
*/
TRgb iLinkColor;
-
+
/**
* Link fragment text color when highlighted.
*/
@@ -162,7 +162,7 @@
* Not own.
*/
MTouchFeedback* iFeedback;
-
+
/**
* True for as long as pressed by pointer.
* Eclipses ASwtControlBase::iPressed!
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtimagedataloader.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtimagedataloader.h Tue May 11 16:07:20 2010 +0300
@@ -95,7 +95,7 @@
* Set the logical values for height or width equal to
* the values of the greatest frame (for height or width).
*/
- void CSwtImageDataLoader::SetLogicalScreenValues(const TFrameInfo& aInfo);
+ void SetLogicalScreenValues(const TFrameInfo& aInfo);
/**
* Set the x and y coordinates of the image in the current frame.
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlaffacade.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlaffacade.h Tue May 11 16:07:20 2010 +0300
@@ -149,19 +149,8 @@
EChildShellWithoutTitlePane,
EMenuItemPane,
ESubMenuItemPane,
-
- /**
- * popup_eswt_tasktip_window(0): task tip bar + label
- * popup_eswt_tasktip_window(1): task tip bar or label only
- */
EPopupEswtTasktipWindow,
-
- /**
- * wait_bar_pane_cp71(0): progress bar in task tip bar + label
- * wait_bar_pane_cp71(1): progress bar in task tip bar or label only
- */
EWaitBarPaneCp71,
-
EChildShellTitleImagePane,
EFindPane,
EPopupMidpNoteAlarmWindowG1,
@@ -202,14 +191,7 @@
EListDoubleLargeGraphicPaneT2,
ECellEswtAppPaneT1,
EFormDataWideGraphicFieldTextsLine2,
-
- /**
- * popup_eswt_tasktip_window_t1(0): label in task tip bar + label
- * popup_eswt_tasktip_window_t1(1): label in task tip bar or label only
- */
- EPopupEswtTasktipWindowT1,
ETabs4ActivePaneT1,
-
ECellHcAppPaneT1,
ECellAppPaneT1,
};
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlink.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlink.h Tue May 11 16:07:20 2010 +0300
@@ -95,9 +95,9 @@
TInt DoTrailingWhitespaceCorrection(
const TInt aCurrentTextPosition) const;
TRect GetDrawableFragmentRectangle(const CFont& aFont,
- const TDesC& aText, const TInt aLinePosition, const TInt aLength,
- const TInt aAvailableWidth, const TInt aXOffset, const TInt aYOffset,
- const TInt aCurrentLineIndex) const;
+ const TDesC& aText, const TInt aLinePosition, const TInt aLength,
+ const TInt aAvailableWidth, const TInt aXOffset, const TInt aYOffset,
+ const TInt aCurrentLineIndex) const;
void SetFocusedFragment();
TBool IsRtl() const;
@@ -181,7 +181,7 @@
* Link fragment text color.
*/
TRgb iLinkColor;
-
+
/**
* Link fragment text color when highlighted.
*/
@@ -224,13 +224,13 @@
* Own.
*/
const CSwtLinkFragmentDescriptor* iFocusedFragment;
-
+
/**
* True for as long as pressed by pointer.
* Eclipses ASwtControlBase::iPressed!
*/
TBool iPressed;
-
+
/**
* True if 2 or more targets.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlist.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlist.h Tue May 11 16:07:20 2010 +0300
@@ -8,7 +8,7 @@
* Contributors:
* Nokia Corporation - S60 implementation
*******************************************************************************/
-
+
#ifndef SWTLIST_H
#define SWTLIST_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistbase.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistbase.h Tue May 11 16:07:20 2010 +0300
@@ -222,8 +222,8 @@
/**
* Second phase constructor
*/
- void ConstructL();
-
+ void ConstructL();
+
private:
/**
* Update the default font.
@@ -256,7 +256,7 @@
void PositionChanged();
void FocusChanged(TDrawNow aDrawNow);
TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
-
+
private:
void Draw(const TRect& aRect) const;
@@ -358,12 +358,12 @@
* Stores last known focus index. Use only during paint and key handlers.
*/
TInt iPrevFocusIndex;
-
+
/**
* Type of the list
*/
TInt iListType;
-
+
/**
* View visible rect at last draw
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistbox.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistbox.h Tue May 11 16:07:20 2010 +0300
@@ -151,7 +151,7 @@
void PositionChanged();
void FocusChanged(TDrawNow aDrawNow);
TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
-
+
private:
void Draw(const TRect& aRect) const;
@@ -480,7 +480,7 @@
* Stores last known focus index. Use only during paint and key handlers.
*/
TInt iPrevFocusIndex;
-
+
/**
* View visible rect at last draw
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistboxlists.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistboxlists.h Tue May 11 16:07:20 2010 +0300
@@ -259,6 +259,14 @@
TInt aListType,
CEikTextListBox* aList,
TInt aHorizontal, TInt aVertical);
+
+ /**
+ * Change stretching
+ */
+ static void EnableStretching(
+ TInt aListType,
+ CEikTextListBox* aList,
+ TBool aEnabled);
};
#endif // SWTLISTBOXLISTS_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistboxlistsitemdrawer.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistboxlistsitemdrawer.h Tue May 11 16:07:20 2010 +0300
@@ -55,7 +55,7 @@
CEikListBox* aOwner);
~CSwtColumnListBoxItemDrawer();
-
+
// From CListItemDrawer
protected:
void DrawItemText(TInt aItemIndex,
@@ -76,7 +76,7 @@
CColumnListBoxData* aListBoxData, CEikListBox* aOwner);
~CSwtSingleHeadingStyleListBoxItemDrawer();
-
+
// From CListItemDrawer
protected:
void DrawItemText(TInt aItemIndex,
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistview.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtlistview.h Tue May 11 16:07:20 2010 +0300
@@ -8,7 +8,7 @@
* Contributors:
* Nokia Corporation - S60 implementation
*******************************************************************************/
-
+
#ifndef SWTLISTVIEW_H
#define SWTLISTVIEW_H
@@ -198,7 +198,7 @@
CSwtLafFacade::TSwtLafFacadeTextId& aRectIdPaneT1,
CSwtLafFacade::TSwtLafFacadeFontId& aRectIdPaneT1Font
) const;
- void CoerceCellRect(const TSwtListViewDensity& aDensity,
+ void CoerceCellRect(const TSwtListViewDensity& aDensity,
TRect& aCellRect) const;
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
@@ -332,7 +332,7 @@
* Stores grid cell layout update status
*/
TBool iIsGridCellLayoutNeeded;
-
+
/**
* View visible rect at last draw
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmenuarranger.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmenuarranger.h Tue May 11 16:07:20 2010 +0300
@@ -25,7 +25,7 @@
/**
* CSwtMenuArranger
* @lib eswt
- *
+ *
* Context menus contain:
* # Prior to 9.2:
* - Specific control menu of focused control (Mark, Unmark, etc.).
@@ -33,7 +33,7 @@
* - OK & SELECT commands of all parents of focused control.
* # Since 9.2:
* - No context menus in 9.2.
- *
+ *
* Stylus popup menus contain:
* # Prior to 9.2:
* - Specific control menu of long tapped control (Mark, Unmark, etc.).
@@ -45,7 +45,7 @@
* - Specific control menu of long tapped control (Mark, Unmark, etc.).
* - All commands of long tapped control.
* - Popup menu of long tapped control (Control.setMenu()).
- *
+ *
* Options menus contain:
* # Prior to 9.2:
* - Menu bar of active shell.
@@ -179,7 +179,7 @@
CEikMenuPane* ParentPane(CEikMenuPane& aPane) const;
#ifdef RD_SCALABLE_UI_V2
- void OpenStylusPopupMenuL(const MSwtControl& aControl, const TPoint& aPoint,
+ void OpenStylusPopupMenuL(const MSwtControl& aControl, const TPoint& aPoint,
MSwtPopupMenuCallBack* aCallBack = NULL);
void OpenStylusPopupMenuL(const MSwtMenu& aMenu, const TPoint& aPoint);
void CloseStylusPopupMenuL();
@@ -292,7 +292,7 @@
* Cached image size for the panes
*/
TSize iImageSize;
-
+
MSwtPopupMenuCallBack* iPopupMenuCallback;
};
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmidmediakeyslistener.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmidmediakeyslistener.h Tue May 11 16:07:20 2010 +0300
@@ -8,7 +8,7 @@
* Contributors:
* Nokia Corporation - S60 implementation
*******************************************************************************/
-
+
#ifndef SWTMIDMEDIAKEYSLISTENER_H
#define SWTMIDMEDIAKEYSLISTENER_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmobiledevice.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtmobiledevice.h Tue May 11 16:07:20 2010 +0300
@@ -8,7 +8,7 @@
* Contributors:
* Nokia Corporation - S60 implementation
*******************************************************************************/
-
+
#ifndef SWTMOBILEDEVICE_H
#define SWTMOBILEDEVICE_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtquerydialog.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtquerydialog.h Tue May 11 16:07:20 2010 +0300
@@ -54,7 +54,7 @@
: public CAknTextQueryDialog
{
private:
- CSwtQueryDialogText::CSwtQueryDialogText(TInt aMinimum, TDes& aResult);
+ CSwtQueryDialogText(TInt aMinimum, TDes& aResult);
public:
enum TTextDialogStyle
@@ -86,7 +86,7 @@
: public CAknFloatingPointQueryDialog
{
private:
- CSwtQueryDialogNumeric::CSwtQueryDialogNumeric(TReal& aResult,
+ CSwtQueryDialogNumeric(TReal& aResult,
const TDesC& aDefaultValue, TInt aMinimum, TInt aMaximum);
public:
@@ -114,7 +114,7 @@
: public CAknTimeQueryDialog
{
private:
- CSwtQueryDialogDateTime::CSwtQueryDialogDateTime(TTime& aTime);
+ CSwtQueryDialogDateTime(TTime& aTime);
public:
enum TDateTimeDialogStyle
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtshell.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtshell.h Tue May 11 16:07:20 2010 +0300
@@ -148,6 +148,8 @@
void SetAsyncPainting(TBool aStatus);
void InstallCba();
TBool HasCba() const;
+ void SetTaskTip();
+ TBool IsTaskTip() const;
// From MEikStatusPaneObserver
public:
@@ -155,7 +157,7 @@
private:
void FinishRedraw() const;
-
+
// Data
private:
/**
@@ -248,11 +250,16 @@
* this goes ETrue.
*/
TBool iAsyncPainting;
-
+
/**
* Once turned on can never be turned off.
*/
TBool iHasCba;
+
+ /**
+ * Task tip style.
+ */
+ TBool iIsTaskTip;
};
#endif // SWTSHELL_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtsortedlist.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtsortedlist.h Tue May 11 16:07:20 2010 +0300
@@ -43,7 +43,7 @@
* @return pointer to an object of this class
*/
static CSwtSortedList* NewL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
- MSwtComposite& aParent, TInt aStyle);
+ MSwtComposite& aParent, TInt aStyle);
protected:
/**
@@ -130,7 +130,7 @@
* @param aSearchField the search field.
*/
void UpdateSearchTextViewRect(const CAknSearchField* aSearchField);
-
+
/**
* Rebound the filter.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swttablelistbox.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swttablelistbox.h Tue May 11 16:07:20 2010 +0300
@@ -294,7 +294,7 @@
* Stores last known focus index. Use only during paint and key handlers.
*/
TInt iPrevFocusIndex;
-
+
/**
* Used to implement horizontal panning.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swttasktip.h Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nokia Corporation - S60 implementation
- *******************************************************************************/
-
-
-#ifndef SWTTASKTIP_H
-#define SWTTASKTIP_H
-
-
-#include "eswtmobileextensions.h"
-
-
-/**
- * CSwtTaskTip
- * @lib eswt
- */
-NONSHARABLE_CLASS(CSwtTaskTip)
- : public CBase
- , public MSwtTaskTip
- , public MSwtResourceChangeObserver
-{
-// Own methods
-public:
- static CSwtTaskTip* NewL(MSwtDisplay& aDisplay, TSwtPeer aPeer, TInt aStyle);
-
-// From MSwtTaskTip
-public:
- TSwtPeer Dispose();
- TSwtPeer JavaPeer() const;
- TRect GetBarDefaultBounds(TBool aHasText) const;
- TRect GetLabelDefaultBounds(TBool aHasText) const;
- TRect GetShellDefaultBounds(TBool aHasText) const;
-
-// From MSwtResourceChangeObserver
-public:
- void OfferResourceChangeL(TInt aType);
-
-// Own methods
-private:
- CSwtTaskTip(MSwtDisplay& aDisplay, TSwtPeer aPeer, TInt aStyle);
- ~CSwtTaskTip();
- void ConstructL();
- void UpdateLayout();
-
-// Data
-private:
- MSwtDisplay& iDisplay;
- const TSwtPeer iPeer;
- TInt iStyle;
- TRect iRectShell;
- TRect iRectShellBarOrLabelOnly;
- TRect iRectLabel;
- TRect iRectLabelOnly;
- TRect iRectBar;
- TRect iRectBarOnly;
-};
-
-#endif // SWTTASKTIP_H
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtuiutils.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/swtuiutils.h Tue May 11 16:07:20 2010 +0300
@@ -85,17 +85,6 @@
void ShellActivabilityChanged(MSwtShell& aShell);
/**
- * Sets the pointerGrabbingControl
- * Calling with NULL of course unsets.
- */
- void SetPointerCaptureControl(MSwtControl* aControl);
-
- /**
- * Returns the current control that is grabbing the pointer events.
- */
- MSwtControl* PointerCaptureControl();
-
- /**
* Sets next focused control. This function is called when app lost focus, which stores
* a pointer of control that can be focused when app gains focus again.
* Calling with NULL of course unsets.
@@ -195,7 +184,7 @@
* Highest inline control default font. See InlineReferenceFontHeight.
*/
const CFont& InlineReferenceFont() const;
-
+
void HideIndicator(TInt aId);
void HideIndicators();
@@ -237,10 +226,13 @@
void SetNaviKeyInput(TBool aStatus);
void SetCbaVisible(TBool aVisible);
MSwtControl* GetPointerGrabbingControl();
+ TRect TaskTipRect() const;
+ void SetPointerCaptureControl(MSwtControl* aControl);
+ MSwtControl* PointerCaptureControl();
protected:
void HandleFreeRamEventL(TInt aEventType);
-
+
// From MSwtAppFocusObserver
public:
void HandleAppFocusChangeL(TBool aFocused);
@@ -264,7 +256,7 @@
* Display reference needed for getting CEikEnv for now.
*/
MSwtDisplay& iDisplay;
-
+
/**
* All shells.
* Not own.
@@ -385,14 +377,14 @@
* Cached scrollbar breadth. Valid till next resolution change.
*/
TInt iScrollBarBreadth;
-
+
/**
* Inline reference stuff
*/
mutable const CFont* iInlineFont;
mutable TInt iInlineFontHeight;
- mutable TMargins8 iInlinePadding;
-
+ mutable TMargins8 iInlinePadding;
+
/**
* Key input flag.
*/
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/org_eclipse_ercp_swt_mobile_internal_OS.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/org_eclipse_ercp_swt_mobile_internal_OS.cpp Tue May 11 16:07:20 2010 +0300
@@ -2526,81 +2526,16 @@
}
- /*
+ /**
* Class TaskTip
*/
- JNIEXPORT jint JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1New(
- JNIEnv *aJniEnv,
- jclass,
- jobject aPeer,
- jint aStyle)
- {
- jweak peerRef = aJniEnv->NewWeakGlobalRef(aPeer);
- if (peerRef == NULL)
- {
- return NULL;
- }
-
- CSwtDisplay& display = CSwtDisplay::Current();
- const MSwtFactory* factory = &display.Factory();
- MSwtTaskTip* result = NULL;
- TRAPD(error, CallMethodL(result, factory, &MSwtFactory::NewTaskTipL, display, peerRef, aStyle));
- if (error)
- {
- aJniEnv->DeleteWeakGlobalRef(peerRef);
- Throw(error, aJniEnv);
- }
- INCREASE_INSTANCE_COUNT(result, TaskTip);
-
- return reinterpret_cast<jint>(result);
- }
-
- JNIEXPORT void JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1Dispose(
- JNIEnv* aJniEnv,
- jclass,
- jint aHandle)
+ JNIEXPORT jobject JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1DefaultBounds(
+ JNIEnv* aJniEnv, jclass)
{
- MSwtTaskTip* tasktip = reinterpret_cast<MSwtTaskTip*>(aHandle);
- TSwtPeer peerRef;
- CallMethod(peerRef, tasktip, &MSwtTaskTip::Dispose);
- ReleasePeer(aJniEnv, peerRef);
- DECREASE_INSTANCE_COUNT(TaskTip);
- }
-
- JNIEXPORT jobject JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1GetBarDefaultBounds(
- JNIEnv* aJniEnv,
- jclass,
- jint aHandle,
- jboolean aHasText)
- {
- MSwtTaskTip* tasktip = reinterpret_cast<MSwtTaskTip*>(aHandle);
- TRect bounds(TRect::EUninitialized);
- CallMethod(bounds, tasktip, &MSwtTaskTip::GetBarDefaultBounds, aHasText);
- return NewJavaRectangle(aJniEnv, bounds);
- }
-
- JNIEXPORT jobject JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1GetLabelDefaultBounds(
- JNIEnv* aJniEnv,
- jclass,
- jint aHandle,
- jboolean aHasText)
- {
- MSwtTaskTip* tasktip = reinterpret_cast<MSwtTaskTip*>(aHandle);
- TRect bounds(TRect::EUninitialized);
- CallMethod(bounds, tasktip, &MSwtTaskTip::GetLabelDefaultBounds, aHasText);
- return NewJavaRectangle(aJniEnv, bounds);
- }
-
- JNIEXPORT jobject JNICALL Java_org_eclipse_ercp_swt_mobile_internal_OS_TaskTip_1GetShellDefaultBounds(
- JNIEnv* aJniEnv,
- jclass,
- jint aHandle,
- jboolean aHasText)
- {
- MSwtTaskTip* tasktip = reinterpret_cast<MSwtTaskTip*>(aHandle);
- TRect bounds(TRect::EUninitialized);
- CallMethod(bounds, tasktip, &MSwtTaskTip::GetShellDefaultBounds, aHasText);
- return NewJavaRectangle(aJniEnv, bounds);
+ MSwtDisplay& display = CSwtDisplay::Current();
+ TRect res(TRect::EUninitialized);
+ CallMethod(res, &display.UiUtils(), &MSwtUiUtils::TaskTipRect);
+ return NewJavaRectangle(aJniEnv, res);
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/org_eclipse_swt_internal_symbian_OS.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/org_eclipse_swt_internal_symbian_OS.cpp Tue May 11 16:07:20 2010 +0300
@@ -374,7 +374,7 @@
}
}
}
-
+
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_symbian_OS_Display_1NotifyFirstPaintComplete
(JNIEnv *, jclass, jboolean aTopShell)
{
@@ -1991,6 +1991,13 @@
CallMethod(shell, &MSwtShell::SetAsyncPainting, aStatus);
}
+ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_symbian_OS_Shell_1SetTaskTip(
+ JNIEnv*, jclass, jint aHandle)
+ {
+ MSwtShell* shell = reinterpret_cast<MSwtShell*>(aHandle);
+ CallMethod(shell, &MSwtShell::SetTaskTip);
+ }
+
/*
* Class Label
@@ -3320,4 +3327,13 @@
return result;
}
+ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_symbian_OS_windowServer(JNIEnv *, jclass)
+ {
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ return 2;
+#else
+ return 1;
+#endif
+ }
+
} // extern "C"
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowser.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowser.cpp Tue May 11 16:07:20 2010 +0300
@@ -135,7 +135,11 @@
| TBrCtlDefs::ECapabilityCursorNavigation
| TBrCtlDefs::ECapabilityFavicon
| TBrCtlDefs::ECapabilityToolBar
- | TBrCtlDefs::ECapabilityFitToScreen;
+ | TBrCtlDefs::ECapabilityFitToScreen
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ | TBrCtlDefs::ECapabilityPinchZoom
+#endif
+ ;
if ((iBrowserLevelStyle | KSwtStyleHScroll) || (iBrowserLevelStyle | KSwtStyleVScroll))
{
@@ -212,7 +216,7 @@
iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsAutoFormFillEnabled, Preferences().FormDataSaving());
// Update browser local settings according to values stored in preferences
- const TPreferencesValues& pref = iPreferences->AllPreferencesL();
+ const TPreferencesValues& pref = iPreferences->AllPreferences();
iFontSize = pref.iFontSize;
iTextWrap = pref.iTextWrap;
iEncoding = pref.iEncoding;
@@ -221,6 +225,19 @@
iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsCharacterset, iEncoding);
iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsLaunchAppUid, iDisplay.ApplicationUid());
+ if (pref.iZoomMin < pref.iZoomMax && pref.iZoomDef >= pref.iZoomMin && pref.iZoomDef <= pref.iZoomMax)
+ {
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelMin, pref.iZoomMin);
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelMax, pref.iZoomMax);
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelDefault, pref.iZoomDef);
+ }
+ else
+ {
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelMin, 10);
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelMax, 200);
+ iBrCtlInterface->SetBrowserSettingL(TBrCtlDefs::ESettingsZoomLevelDefault, 100);
+ }
+
// WidgetExtension needs a valid base path.
// Base path would be used to write preferences on Widget runtime context but
// when embedded into eSWT it does not really write any data. The base path still
@@ -374,19 +391,32 @@
}
#ifdef RD_SCALABLE_UI_V2
+// ---------------------------------------------------------------------------
+// Originated from CSwtBrowserContainer, not CSwtShell.
+// ---------------------------------------------------------------------------
+//
void CSwtBrowser::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
iHandlingPointerEv = ETrue;
- // From parent Shell coordinates to CSwtBrowserContainer coordinates
- TPointerEvent event(aPointerEvent);
- event.iPosition -= Rect().iTl;
-
- iBrCtlInterface->HandlePointerEventL(event);
-
- // Must grab to allow HandlePointerBufferReadyL to be forwarded to Browser
- // Enables panning / touch scrolling.
- iBrCtlInterface->ClaimPointerGrab(EFalse);
+ if (!iDisplay.RevertPointerEvent())
+ {
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // From parent Shell coordinates to CSwtBrowserContainer coordinates
+ if (aPointerEvent.AdvancedPointerEvent())
+ {
+ TAdvancedPointerEvent event = *(static_cast<const TAdvancedPointerEvent*>(&aPointerEvent));
+ event.iPosition -= Rect().iTl;
+ iBrCtlInterface->HandlePointerEventL(event);
+ }
+ else
+#endif
+ {
+ TPointerEvent event = *(static_cast<const TPointerEvent *>(&aPointerEvent));
+ event.iPosition -= Rect().iTl;
+ iBrCtlInterface->HandlePointerEventL(event);
+ }
+ }
iHandlingPointerEv = EFalse;
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowsercontainer.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowsercontainer.cpp Tue May 11 16:07:20 2010 +0300
@@ -42,6 +42,13 @@
// Required by the Browser control. WSERV:43 raised if not provided.
Window().AllocPointerMoveBuffer(256, 0);
Window().DisablePointerMoveBuffer();
+ EnableDragEvents();
+#ifdef RD_JAVA_S60_RELEASE_9_2
+#ifndef __WINSCW__
+ Window().EnableAdvancedPointers();
+#endif
+#endif // RD_JAVA_S60_RELEASE_9_2
+ ActivateL();
}
void CSwtBrowserContainer::FocusChanged(TDrawNow aDrawNow)
@@ -53,14 +60,31 @@
#ifdef RD_SCALABLE_UI_V2
void CSwtBrowserContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
- // From CSwtBrowserContainer coordinates to parent Shell coordinates
- TPointerEvent event(aPointerEvent);
- event.iPosition += iApiProvider.Rect().iTl;
+ // Capturing the pointer improves considerably the frequency of drag events
+ // and the usability of the pinch zooming. It also shortens the route of
+ // the event back to the browser.
+ MSwtUiUtils& utils = iApiProvider.Display().UiUtils();
+ MSwtControl* prevCapturingCtrl = utils.PointerCaptureControl();
+ utils.SetPointerCaptureControl(&iApiProvider);
+
+ MSwtControl* shell = iApiProvider.GetShell().Control();
- // Forward to Shell which will forward to CSwtBrowser. If not done this way,
- // CSwtBrowser will not get focused meaning users being unable to use the websites!
- MSwtShell& shell = iApiProvider.GetShell();
- shell.Control()->CoeControl().HandlePointerEventL(event);
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ if (aPointerEvent.AdvancedPointerEvent())
+ {
+ TAdvancedPointerEvent event = *(static_cast<const TAdvancedPointerEvent *>(&aPointerEvent));
+ event.iPosition += iApiProvider.Rect().iTl;
+ shell->HandlePointerEventL(event);
+ }
+ else
+#endif
+ {
+ TPointerEvent event = *(static_cast<const TPointerEvent *>(&aPointerEvent));
+ event.iPosition += iApiProvider.Rect().iTl;
+ shell->HandlePointerEventL(event);
+ }
+
+ utils.SetPointerCaptureControl(prevCapturingCtrl);
}
#endif
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowserpreferences.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbrowserpreferences.cpp Tue May 11 16:07:20 2010 +0300
@@ -144,47 +144,22 @@
void CSwtBrowserPreferences::RestoreSettingsL()
{
- // Read auto load images setting
iAllPreferences.iAutoLoadImages = GetIntValue(KBrowserNGImagesEnabled);
-
- // Read font size
iAllPreferences.iFontSize = GetIntValue(KBrowserNGFontSize);
-
- // Read Allow Cookies setting
- if (GetIntValue(KBrowserNGCookiesEnabled))
- {
- iAllPreferences.iCookies = EWmlSettingsCookieAllow;
- }
- else
- {
- iAllPreferences.iCookies = EWmlSettingsCookieReject;
- }
-
- // Read ECMA Setting
- if (GetIntValue(KBrowserNGECMAScriptSupport))
- {
- iAllPreferences.iEcma = EWmlSettingsECMAEnable;
- }
- else
- {
- iAllPreferences.iEcma = EWmlSettingsECMADisable;
- }
+ iAllPreferences.iCookies = GetIntValue(KBrowserNGCookiesEnabled);
+ iAllPreferences.iEcma = GetIntValue(KBrowserNGECMAScriptSupport);
TInt encoding;
iRepository->Get(KBrowserNGEncoding, encoding);
- iAllPreferences.iEncoding = static_cast< TUint32 >(encoding);
+ iAllPreferences.iEncoding = (TUint32)encoding;
- // Read operator variated settings
- iAllPreferences.iPageOverview = GetIntValue(
- KBrowserNGPageOverview);
- iAllPreferences.iBackList
- = GetIntValue(KBrowserNGBackList);
- iAllPreferences.iAutoRefresh
- = GetIntValue(KBrowserNGAutoRefresh);
+ iAllPreferences.iPageOverview = GetIntValue(KBrowserNGPageOverview);
+ iAllPreferences.iBackList = GetIntValue(KBrowserNGBackList);
+ iAllPreferences.iAutoRefresh = GetIntValue(KBrowserNGAutoRefresh);
+ iAllPreferences.iIMEINotification = GetIntValue(KBrowserIMEINotification);
// Read suppress security UI setting
- iAllPreferences.iHTTPSecuritySupressed
- = GetIntValue(KBrowserSecurityUI);
+ iAllPreferences.iHTTPSecuritySupressed = GetIntValue(KBrowserSecurityUI);
// Read show connection queries setting
iAllPreferences.iConnDialogs = GetIntValue(CSwtLafFacade::GetUintConstant(
@@ -207,9 +182,8 @@
CSwtLafFacade::EBrowserNGPopupBlocking));
// Form Data Saving
- iAllPreferences.iFormDataSaving
- = static_cast< TWmlSettingsFormData >(GetIntValue(
- CSwtLafFacade::GetUintConstant(CSwtLafFacade::EBrowserFormDataSaving)));
+ iAllPreferences.iFormDataSaving = GetIntValue(
+ CSwtLafFacade::GetUintConstant(CSwtLafFacade::EBrowserFormDataSaving));
// Search Page, dont't want search page
if (iAllPreferences.iSearchPgURL)
@@ -218,21 +192,28 @@
iAllPreferences.iSearchPgURL = NULL;
}
- // Web reed feeds settings
+ // Web feeds settings
iAllPreferences.iAutomaticUpdating = static_cast< TWmlSettingsAutomaticUpdating >
(GetIntValue(KBrowserNGAutomaticUpdating));
iAllPreferences.iAutomaticUpdatingAP = GetIntValue(
KBrowserNGAutomaticUpdatingAccessPoint);
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ iAllPreferences.iZoomMax = GetIntValue(KBrowserNGZoomMax);
+ iAllPreferences.iZoomMin = GetIntValue(KBrowserNGZoomMin);
+ iAllPreferences.iZoomDef = GetIntValue(KBrowserNGZoomDefault);
+#endif
+
// Read Accesss point selection mode for advanced settings
iAllPreferences.iAccessPointSelectionMode
- = GetIntValue(KBrowserAccessPointSelectionMode);
+ = GetIntValue(KBrowserAccessPointSelectionMode);
// Read default AP setting
- // get application specific ap
+ // Get application specific ap
TUint32 appId = iApiProvider.Display().ApplicationUid();
- // get applicatin specific ap
+
+ // Get applicatin specific ap
TUint32 ap = CSwtLafFacade::JavaAPNL(appId);
if (ap == CSwtLafFacade::GetUintConstant(
@@ -246,7 +227,7 @@
if (ap == CSwtLafFacade::GetUintConstant(
CSwtLafFacade::EMIDletSuiteAPNNotSpecified))
{
- // try to get ap from browser NG reposictory
+ // Try to get ap from browser NG reposictory
ap = GetIntValue(KBrowserDefaultAccessPoint);
}
if (!ap)
@@ -425,7 +406,7 @@
return retVal;
}
-const TPreferencesValues& CSwtBrowserPreferences::AllPreferencesL()
+const TPreferencesValues& CSwtBrowserPreferences::AllPreferences() const
{
return iAllPreferences;
}
@@ -489,17 +470,17 @@
return iAllPreferences.iAutoRefresh;
}
-TWmlSettingsCookies CSwtBrowserPreferences::Cookies() const
+TBool CSwtBrowserPreferences::Cookies() const
{
return iAllPreferences.iCookies;
}
-TWmlSettingsECMA CSwtBrowserPreferences::Ecma() const
+TBool CSwtBrowserPreferences::Ecma() const
{
return iAllPreferences.iEcma;
}
-TWmlSettingsIMEI CSwtBrowserPreferences::IMEINotification() const
+TBool CSwtBrowserPreferences::IMEINotification() const
{
return iAllPreferences.iIMEINotification;
}
@@ -514,7 +495,7 @@
return iAllPreferences.iPageOverview;
}
-TWmlSettingsFormData CSwtBrowserPreferences::FormDataSaving() const
+TUint CSwtBrowserPreferences::FormDataSaving() const
{
return iAllPreferences.iFormDataSaving;
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbutton.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtbutton.cpp Tue May 11 16:07:20 2010 +0300
@@ -697,7 +697,7 @@
{
// Do not pass SKs to CAknButton as it will activate.
if (iButton && (aKeyEvent.iScanCode != EStdKeyDevice0 && aKeyEvent.iScanCode != EStdKeyDevice1))
- {
+ {
TBool forward(EFalse);
if ((iStyle & KSwtStyleRadio)
&& (GetParent()->Control()->CaptionedControlInterface() == NULL)
@@ -712,10 +712,11 @@
{
forward = ETrue;
}
-
+
if (forward)
{
- if (aKeyEvent.iScanCode == EStdKeyNkpEnter) {
+ if (aKeyEvent.iScanCode == EStdKeyNkpEnter)
+ {
// Workaround for CAknButton's inability to handle EKeyEnter correctly
TKeyEvent ev;
ev.iCode = aKeyEvent.iCode;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcommand.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcommand.cpp Tue May 11 16:07:20 2010 +0300
@@ -47,7 +47,7 @@
void CSwtCommand::ConstructL()
{
iParentControl.GetShell().InstallCba();
-
+
// Notify Command arranger (must be done at the end of ConstructL,
// when Command is created for sure)
MSwtCommandArranger* commandArranger = iDisplay.CommandArranger();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcommandarranger.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcommandarranger.cpp Tue May 11 16:07:20 2010 +0300
@@ -250,14 +250,14 @@
// Get pointer to first control (the one that is actually focused) to process
const MSwtControl* control = GetFirstFocusedControl();
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
- if (control)
+ if (control)
{
control = control->GetShell().Control();
}
#endif // RD_JAVA_S60_RELEASE_9_2
-
+
const MSwtControl* focusedControl(control);
TFixedArray<TBool, KCbaButtonCountMax> cbaIsAvailable;
@@ -760,7 +760,7 @@
if (iCommandMenuOK)
{
TInt numberOfOKCommands(iCommandMenuOK->CountDisplayableItems());
-
+
// If MSK enabled, not in fullscreen, no control menu items,
// and there is only one OK (or SELECT) command,
// this command is not included in the context options menu since
@@ -774,7 +774,7 @@
{
numberOfOKCommands = 0;
}
-
+
// Addition of control menu items and OK (or SELECT) commands
iNumberOfContextOptionMenuItems =
numberOfOKCommands + numberOfControlMenuItems;
@@ -1287,7 +1287,7 @@
//
// From MEikCommandObserver
// Notified from CEikCba::OfferKeyEventL > CEikButtonGroupContainer::ProcessCommandL
-//
+//
void CSwtCommandArranger::ProcessCommandL(TInt aCommandId)
{
TInt cmdIndex(aCommandId - KSwtCommandBaseId);
@@ -1442,7 +1442,7 @@
{
return ETrue;
}
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
if (aControl.IsShell())
{
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcomposite.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcomposite.cpp Tue May 11 16:07:20 2010 +0300
@@ -21,7 +21,6 @@
#include <AknsFrameBackgroundControlContext.h>
#include <centralrepository.h>
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
-#include <touchfeedback.h>
#include <swtlaffacade.h>
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
#include "swtcomposite.h"
@@ -44,6 +43,7 @@
CAknControl::SetDimmed(aDimmed);
SetFocusing(ETrue);
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ iFeedback = MTouchFeedback::Instance();
UpdateTactileFeedbackDensity();
#endif // RD_JAVA_ADVANCED_TACTILE_FEEDBACK
}
@@ -367,6 +367,10 @@
CEikScrollBar* hsb = iSbFrame ?
iSbFrame->GetScrollBarHandle(CEikScrollBar::EHorizontal) : NULL;
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ iLastPointerEventType = aPointerEvent.iType;
+#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+
// Check if we should start scrollbar grabbing
if (aPointerEvent.iType == TPointerEvent::EButton1Down)
{
@@ -1444,28 +1448,11 @@
}
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ // Flicking or panning the composite content should give the feedback
if (iPhysicsAction == KSwtPhysicsPanning ||
iPhysicsAction == KSwtPhysicsFlicking)
{
- TRect scrolledRect(coeCtrl.Rect());
- TRect thisRect(CoeControl().Rect());
- if (scrolledRect.iTl.iY < thisRect.iTl.iY &&
- scrolledRect.iBr.iY > thisRect.iBr.iY)
- {
- TInt lastFeedbackDistanceY = Abs(iLastTactileFeedbackPos
- - iPhysicsViewPos.iY);
-
- if (lastFeedbackDistanceY >= iTactileFeedbackDensity)
- {
- iLastTactileFeedbackPos = iPhysicsViewPos.iY;
-
- MTouchFeedback* feedback = MTouchFeedback::Instance();
- if (feedback)
- {
- feedback->InstantFeedback(ETouchFeedbackFlick);
- }
- }
- }
+ DoScrollingFeedback();
}
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
}
@@ -1629,8 +1616,61 @@
void CSwtComposite::UpdateTactileFeedbackDensity()
{
TAknLayoutRect layoutRect = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EListDoubleLargeGraphicPane,
+ CSwtLafFacade::EListSingleHeadingPane,
TRect(), 0, 0, 0);
iTactileFeedbackDensity = layoutRect.Rect().Height();
}
+
+void CSwtComposite::DoScrollingFeedback()
+{
+ if (!iScrlCompContent)
+ {
+ return;
+ }
+
+ TRect scrolledRect(iScrlCompContent->CoeControl().Rect());
+ TRect thisRect(CoeControl().Rect());
+
+ // Calculate distance between current content position
+ // and previous position, where last feedback happened
+ TInt lastFeedbackDistanceY = Abs(iLastTactileFeedbackPos
+ - iPhysicsViewPos.iY);
+ TTouchLogicalFeedback feedbackType(ETouchFeedbackNone);
+ if (lastFeedbackDistanceY >= iTactileFeedbackDensity)
+ {
+ if (scrolledRect.iTl.iY < thisRect.iTl.iY &&
+ scrolledRect.iBr.iY > thisRect.iBr.iY)
+ {
+ // If top (or bottom) edge of the content is outside
+ // of visible area of composite, do feedback every time
+ feedbackType = ETouchFeedbackSensitiveList;
+ }
+ else if (iLastPointerEventType != TPointerEvent::EButton1Up)
+ {
+ // Begining or end of the content reached (i.e. top or bottom
+ // egde of the contont is now visible): feedback is given
+ // only if user do panning. No feedback, if touch release
+ // happened.
+ feedbackType = ETouchFeedbackSensitiveList;
+ }
+ // Store the position of the content
+ iLastTactileFeedbackPos = iPhysicsViewPos.iY;
+ }
+
+ if (iFeedback && feedbackType != ETouchFeedbackNone)
+ {
+ if (iLastPointerEventType != TPointerEvent::EButton1Up)
+ {
+ iFeedback->EnableFeedbackForControl(this, ETrue, ETrue);
+ }
+ else
+ {
+ // Disable audion feedback on flicking (i.e. user don't pan by
+ // touch input)
+ iFeedback->EnableFeedbackForControl(this, ETrue, EFalse);
+ }
+ // Do the feedback if needed
+ iFeedback->InstantFeedback(this, feedbackType);
+ }
+}
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtconstrainedtext.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtconstrainedtext.cpp Tue May 11 16:07:20 2010 +0300
@@ -79,7 +79,7 @@
{
return;
}
-
+
// Update editor's visibility, otherwise text will be drawn
// when performing clipboard operations on invisible control.
const TBool visible = GetVisibleRecursively();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcontrolbase.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtcontrolbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -170,13 +170,16 @@
clippingRegion = SetupChildClippingRegion(composite, aGc, aRect);
}
+ TBool isDialogShell = IsShell() && iParent;
+ TBool isTaskTip = isDialogShell && ShellInterface()->IsTaskTip();
+
// Draw the background.
if (!IsDefaultBackgroundUse()
#ifdef RD_JAVA_S60_RELEASE_9_2
- // Fill the round corners
- || (IsShell() && iParent)
+ // Fill the round corners
+ || (isDialogShell && !isTaskTip)
#endif // RD_JAVA_S60_RELEASE_9_2
- )
+ )
{
aGc.SetBrushColor(GetBackground());
aGc.Clear(aRect);
@@ -227,9 +230,11 @@
TBool ASwtControlBase::HasBorderStyle() const
{
TBool res = (iStyle & KSwtStyleBorder);
- if (IsShell())
+ const MSwtShell* shell = ShellInterface();
+ if (shell)
{
- res = res && (!(iStyle & KSwtStyleNoTrim) && iParent);
+ // TaskTip shells have the border.
+ res = shell->IsTaskTip() || (res && !(iStyle & KSwtStyleNoTrim) && iParent);
}
return res;
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdateeditor.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdateeditor.cpp Tue May 11 16:07:20 2010 +0300
@@ -257,7 +257,7 @@
{
iBgColorIsCustom = EFalse;
}
-
+
Redraw();
}
@@ -268,7 +268,7 @@
void CSwtDateEditor::SetForegroundL(const MSwtColor* aColor)
{
ASwtControlBase::DoSetForegroundL(aColor);
-
+
TRgb color((aColor) ? aColor->RgbValue() : iEikonEnv->Color(EColorControlText));
iEditor->OverrideColorL(EColorControlText, color);
@@ -293,7 +293,7 @@
{
iFgColorIsCustom = EFalse;
}
-
+
Redraw();
}
@@ -1107,7 +1107,7 @@
void CSwtDateEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
TBool hit = ETrue;
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
TBool pressed = iPressed;
hit = Rect().Contains(aPointerEvent.iPosition);
@@ -1119,9 +1119,9 @@
else if (aPointerEvent.iType == TPointerEvent::EDrag)
iPressed = hit;
#endif
-
- if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
- && (iDisplay.RevertPointerEvent() || !hit)))
+
+ if (!(aPointerEvent.iType == TPointerEvent::EButton1Up
+ && (iDisplay.RevertPointerEvent() || !hit)))
{
iEditor->HandlePointerEventL(aPointerEvent);
@@ -1141,7 +1141,7 @@
iCurrentFieldLength = 0;
iCurrentFieldDecimalPlacesCount = 0;
iLastField = iEditor->CurrentField();
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
if (pressed != iPressed)
Redraw();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdisplaybase.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtdisplaybase.cpp Tue May 11 16:07:20 2010 +0300
@@ -790,7 +790,7 @@
return iRevertPointerEvent || iLongTapDetected;
}
-void ASwtDisplayBase::SetRevertPointerEvent(TBool aStatus)
+void ASwtDisplayBase::SetRevertPointerEvent(TBool aStatus)
{
iRevertPointerEvent = aStatus;
}
@@ -1082,6 +1082,8 @@
{
iLongTapControl = NULL;
iLongTapDetected = EFalse;
+
+ // The Shell is required to already have handled the pointer down.
MSwtControl* ctrl = iUiUtils->GetPointerGrabbingControl();
// No long tap animation on scrollbars or trimings.
@@ -1091,7 +1093,7 @@
iLongTapControl = ctrl;
}
}
-
+
iLongTapPointerEvent = aPointerEvent;
if (iLongTapControl)
@@ -1128,7 +1130,7 @@
return;
}
- // Will be switched back after the popup menu closes
+ // Will be switched back after the popup menu closes
// and the late pointer up event was delivered.
iLongTapDetected = ETrue;
@@ -1148,7 +1150,7 @@
event.iType = TPointerEvent::EButton1Up;
iLongTapControl->HandlePointerEventL(event); // revert
}
-
+
// Just to clear the flags.
CancelLongTapAnimation();
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtedwin.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtedwin.cpp Tue May 11 16:07:20 2010 +0300
@@ -49,7 +49,7 @@
//
CLafEdwinCustomDrawBase* CSwtEdwin::CreateCustomDrawL()
{
- // Custom draw object is deleted by CEikEdwin
+ // Custom draw object is deleted by CEikEdwin
const MFormCustomDraw* edwinDrawer = CEikEdwin::CreateCustomDrawL();
iClippingCustomDrawer = new(ELeave)CSwtEdwinCustomDrawer(
iEikonEnv->LafEnv(), edwinDrawer, *this);
@@ -87,7 +87,7 @@
//
CLafEdwinCustomDrawBase* CSwtIntegerEdwin::CreateCustomDrawL()
{
- // Custom draw object is deleted by CEikEdwin
+ // Custom draw object is deleted by CEikEdwin
const MFormCustomDraw* edwinDrawer = CEikEdwin::CreateCustomDrawL();
iClippingCustomDrawer = new(ELeave)CSwtEdwinCustomDrawer(
iEikonEnv->LafEnv(), edwinDrawer, *this);
@@ -142,7 +142,7 @@
//
CLafEdwinCustomDrawBase* CSwtFloatingPointEdwin::CreateCustomDrawL()
{
- // Custom draw object is deleted by CEikEdwin
+ // Custom draw object is deleted by CEikEdwin
const MFormCustomDraw* edwinDrawer = CEikEdwin::CreateCustomDrawL();
iClippingCustomDrawer = new(ELeave)CSwtEdwinCustomDrawer(
iEikonEnv->LafEnv(), edwinDrawer, *this);
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtfactory.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -49,7 +49,6 @@
#include "swtmultipagedialog.h"
#include "swtscreen.h"
#include "swtsortedlist.h"
-#include "swttasktip.h"
#include "swttextextension.h"
#include "swttimedmessagebox.h"
#include "swtquerydialog.h"
@@ -392,14 +391,6 @@
return CSwtQueryDialog::ConvertDefaultValueL(aString, aQueryType);
}
-MSwtTaskTip* CSwtFactory::NewTaskTipL(
- MSwtDisplay& aDisplay,
- TSwtPeer aPeer,
- TInt aStyle) const
-{
- return CSwtTaskTip::NewL(aDisplay, aPeer, aStyle);
-}
-
MSwtTextExtension* CSwtFactory::NewTextExtensionL(
MSwtDisplay& aDisplay,
TSwtPeer aPeer,
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtgcbase.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtgcbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -22,9 +22,9 @@
#include <graphics/openfontconstants.h>
#endif
-#ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
+#ifdef RD_JAVA_S60_RELEASE_9_2
#include <alf/alfdrawer.h>
-#endif // RD_JAVA_UI_ALFDRAWER_ENABLED
+#endif // RD_JAVA_S60_RELEASE_9_2
/*
* This method is used only for M2G support purposes
@@ -674,14 +674,14 @@
TInt CSwtGcBase::FinishOperationL()
{
TInt err = KErrNone;
-#ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
+#ifdef RD_JAVA_S60_RELEASE_9_2
CAlfDrawer* drawer = CAlfDrawer::NewL();
CleanupStack::PushL(drawer);
err = drawer->Finish();
CleanupStack::PopAndDestroy(drawer);
#else
err = CCoeEnv::Static()->WsSession().Finish();
-#endif // RD_JAVA_UI_ALFDRAWER_ENABLED
+#endif // RD_JAVA_S60_RELEASE_9_2
return err;
}
#endif // RD_JAVA_NGA_ENABLED
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtjavabufferdrawer.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtjavabufferdrawer.cpp Tue May 11 16:07:20 2010 +0300
@@ -397,10 +397,9 @@
TSize* size = reinterpret_cast<TSize*>(&width);
TPoint* pointDest = reinterpret_cast<TPoint*>(&destX);
- (void)aWindow; // Just to suppress a potential warning
+ (void)aWindow; // Just to suppress a potential warning
(void)aDrawRect; // Just to suppress a potential warning
-#ifdef RD_JAVA_NGA_ENABLED
-#ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
+#ifdef RD_JAVA_S60_RELEASE_9_2
aWindow->EndRedraw();
TInt result = KErrAbort;
TRAPD(err,result = aGc->FinishOperationL());
@@ -411,8 +410,7 @@
CCoeEnv::Static()->WsSession().Finish();
}
aWindow->BeginRedraw(aDrawRect);
-#endif // RD_JAVA_UI_ALFDRAWER_ENABLED
-#endif // RD_JAVA_NGA_ENABLED
+#endif // RD_JAVA_S60_RELEASE_9_2
aGc->CopyArea(TRect(*pointSrc, *size), *pointDest);
}
@@ -425,10 +423,9 @@
TPoint pos(srcX, srcY);
- (void)aWindow; // Just to suppress a potential warning
+ (void)aWindow; // Just to suppress a potential warning
(void)aDrawRect; // Just to suppress a potential warning
-#ifdef RD_JAVA_NGA_ENABLED
-#ifdef RD_JAVA_UI_ALFDRAWER_ENABLED
+#ifdef RD_JAVA_S60_RELEASE_9_2
aWindow->EndRedraw();
TInt result = KErrAbort;
TRAPD(err,result = aGc->FinishOperationL());
@@ -439,8 +436,8 @@
CCoeEnv::Static()->WsSession().Finish();
}
aWindow->BeginRedraw(aDrawRect);
-#endif // RD_JAVA_UI_ALFDRAWER_ENABLED
-#endif // RD_JAVA_NGA_ENABLED
+#endif // RD_JAVA_S60_RELEASE_9_2
+
aGc->CopyAreaL(*image, pos);
}
break;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp Tue May 11 16:07:20 2010 +0300
@@ -1205,7 +1205,7 @@
const CFont& font = (swtFont->Font());
DoSetFontL(&font);
}
-
+
Redraw();
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistbase.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -1460,6 +1460,11 @@
// Update background color
listBoxDrawer->SetBackColor(GetBackground());
+
+ // Suppress margins - they are drawn over scrollbars
+ // We need to update margins here one more time, because previous
+ // code re-sets them
+ CSwtListBoxLists::SetMargins(iListType, iList, 0, 0);
}
// ---------------------------------------------------------------------------
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistbox.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistbox.cpp Tue May 11 16:07:20 2010 +0300
@@ -895,6 +895,22 @@
// This is needed for the case where the theme has animated highlights.
iList->SetFocus(ETrue, ENoDrawNow);
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // Disable stretching for two line lists
+ switch (iProps.iListType)
+ {
+ case ESwtLbDouble:
+ case ESwtLbDoubleGraphic:
+ case ESwtLbDoubleLarge:
+ // Disable stretching to keep items double line in landscape
+ CSwtListBoxLists::EnableStretching(iProps.iListType, iList, EFalse);
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+#endif
+
// Must trigger SizeChanged which Avkon lists use to create the layout
// columns. Not calling this will result in invisible lists or incorrect
// list layouts. Also important is to hide the list while is being
@@ -1249,6 +1265,11 @@
// The listbox looses the custom color after resize, therefore reset.
if (iColor)
UpdateListColor();
+
+ // Suppress margins - they are drawn over scrollbars
+ // We need to update margins here one more time, because previous
+ // code re-sets them
+ CSwtListBoxLists::SetMargins(iProps.iListType, iList, 0, 0);
}
// ---------------------------------------------------------------------------
@@ -1444,6 +1465,7 @@
list->SetCurrentItemIndex(0);
list->SetComponentsToInheritVisibility(ETrue);
CreateScrollBarsL(list);
+
#ifdef RD_SCALABLE_UI_V2
list->SetListBoxObserver(this);
#endif // RD_SCALABLE_UI_V2
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistboxlists.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistboxlists.cpp Tue May 11 16:07:20 2010 +0300
@@ -204,20 +204,25 @@
&& aSbFrame->ScrollBarVisibility(CEikScrollBar::EVertical)
!= CEikScrollBarFrame::EOff)
{
+ TInt breadth(0);
+ if (iListObserver)
+ {
+ breadth = iListObserver->Utils().ScrollBarBreadth(
+ aSbFrame->VerticalScrollBar());
+ }
+ else
+ {
+ breadth = aSbFrame->ScrollBarBreadth(CEikScrollBar::EVertical);
+ }
+
if (!AknLayoutUtils::LayoutMirrored())
{
- TInt breadth(0);
- if (iListObserver)
- {
- breadth = iListObserver->Utils().ScrollBarBreadth(
- aSbFrame->VerticalScrollBar());
- }
- else
- {
- breadth = aSbFrame->ScrollBarBreadth(CEikScrollBar::EVertical);
- }
clientRect.iBr.iX -= breadth;
}
+ else
+ {
+ clientRect.iTl.iX += breadth;
+ }
}
}
@@ -471,6 +476,34 @@
}
}
+// ---------------------------------------------------------------------------
+// CSwtListBoxLists::EnableStretching
+// ---------------------------------------------------------------------------
+//
+void CSwtListBoxLists::EnableStretching(TInt aListType, CEikTextListBox* aList,
+ TBool aEnabled)
+{
+ ASSERT(IsListType(aListType));
+
+ switch (aListType)
+ {
+ case ESwtLbDouble:
+ STATIC_CAST(CSwtListBoxDouble*, aList)
+ ->EnableStretching(aEnabled);
+ break;
+ case ESwtLbDoubleGraphic:
+ STATIC_CAST(CSwtListBoxDoubleGraphic*, aList)
+ ->EnableStretching(aEnabled);
+ break;
+ case ESwtLbDoubleLarge:
+ STATIC_CAST(CSwtListBoxDoubleLarge*, aList)
+ ->EnableStretching(aEnabled);
+ break;
+ default:
+ // Other list types are not supported
+ break;
+ }
+}
// The compiler does not automatically instantiate templates defined in other
// files. Because of this, code written will often produce undefined symbol
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistboxlistsitemdrawer.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistboxlistsitemdrawer.cpp Tue May 11 16:07:20 2010 +0300
@@ -102,7 +102,7 @@
{
BeginClipping(iGc);
CColumnListBoxItemDrawer::DrawItemText(aItemIndex, aItemTextRect,
- aItemIsCurrent, aViewIsEmphasized, aItemIsSelected);
+ aItemIsCurrent, aViewIsEmphasized, aItemIsSelected);
EndClipping(iGc);
}
@@ -160,14 +160,7 @@
void ASwtListBoxItemDrawerBase::SetCustomClippingRect(
const TRect& aRect)
{
- if (aRect.IsNormalized())
- {
- iCustomClippingRect = aRect;
- }
- else
- {
- iCustomClippingRect = TRect::EUninitialized;
- }
+ iCustomClippingRect = aRect;
}
// ---------------------------------------------------------------------------
@@ -176,10 +169,7 @@
//
void ASwtListBoxItemDrawerBase::BeginClipping(CWindowGc* aGc) const
{
- if (iCustomClippingRect != TRect::EUninitialized)
- {
- aGc->SetClippingRect(iCustomClippingRect);
- }
+ aGc->SetClippingRect(iCustomClippingRect);
}
// ---------------------------------------------------------------------------
@@ -188,8 +178,5 @@
//
void ASwtListBoxItemDrawerBase::EndClipping(CWindowGc* aGc) const
{
- if (iCustomClippingRect != TRect::EUninitialized)
- {
- aGc->CancelClippingRect();
- }
+ aGc->CancelClippingRect();
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistview.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlistview.cpp Tue May 11 16:07:20 2010 +0300
@@ -192,6 +192,8 @@
#else
gridFlags |= EAknListBoxMarkableGrid;
#endif
+ // Enabling marking only by pressing enter key
+ gridFlags |= CEikListBox::EEnterMarks;
// Create control menu
iMenu = CSwtControlMenu::NewL(iDisplay, NULL, 0);
@@ -2689,15 +2691,7 @@
{
GetSelection(iOldSelectionArray);
- TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift) ||
- (aKeyEvent.iModifiers & EModifierLeftShift) ||
- (aKeyEvent.iModifiers & EModifierRightShift);
-
- // Do not offer menu opening ok key event to the grid
- if ((aKeyEvent.iCode != EKeyOK && aKeyEvent.iCode != EKeyEnter) || shiftKeyPressed)
- {
- iGrid->OfferKeyEventL(aKeyEvent, aType);
- }
+ iGrid->OfferKeyEventL(aKeyEvent, aType);
if (aType == EEventKeyUp)
{
@@ -2931,22 +2925,16 @@
}
else if (aKeyCode == EKeyOK || aKeyCode == EKeyEnter)
{
- if (iStyle & KSwtStyleSingle)
+ MSwtCommandArranger* commandArranger = iDisplay.CommandArranger();
+ if (commandArranger)
{
- MSwtCommandArranger* commandArranger = iDisplay.CommandArranger();
- if (commandArranger)
+ if (iStyle & KSwtStyleSingle &&
+ commandArranger->IsContextSensitiveOperationSet())
{
- if (commandArranger->IsContextSensitiveOperationSet())
- {
- return EFalse;
- }
+ return EFalse;
}
- return ETrue;
}
- else
- {
- return EFalse;
- }
+ return ETrue;
}
return ETrue;
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtmobileshell.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtmobileshell.cpp Tue May 11 16:07:20 2010 +0300
@@ -197,7 +197,7 @@
{
return;
}
-
+
iStatusPaneStyle = statusStyle;
// Immediatelly called after construction on Java side. Status style is
@@ -215,7 +215,7 @@
{
utils.UpdateStatusPaneL();
}
-
+
CCoeControl::SetRect(DefaultBounds());
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtscreen.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtscreen.cpp Tue May 11 16:07:20 2010 +0300
@@ -73,6 +73,13 @@
}
iIsTheOnlyScreen = (iDisplay.MobileDevice()->GetScreenNumber() == 1);
iOrientationState = EOrientationNotSet;
+
+ iActivationState = EFalse;
+ if (iScreenDevice->GetScreenNumber() == iId)
+ {
+ iActivationState = ETrue;
+ }
+
if (IsScreenOn())
{
iOrientation = CurrentOrientation();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtshell.cpp Tue May 11 16:07:20 2010 +0300
@@ -146,38 +146,38 @@
CCoeControl::SetPointerCapture(ETrue);
}
#endif //RD_SCALABLE_UI_V2
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
GfxTransEffect::Enable();
- GfxTransEffect::Register(this,
- iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
+ GfxTransEffect::Register(this,
+ iParent ? KGfxOptionsMenuControlUid : KGfxInformationNoteControlUid, EFalse);
// Window transparency cannot be enabled as it breaks the async drawing.
- // Since transparency cannot be enabled, set the initial background
+ // Since transparency cannot be enabled, set the initial background
// color to something closer to the theme's background.
if (iParent)
{
TRgb bgColor = iDisplay.UiUtils().GetSystemColor(ESwtColorWidgetBackground);
-
+
TInt r = bgColor.Green();
r -= KSwtRoundCornerBgColorDiff;
- if (r < 0)
+ if (r < 0)
r = 0;
-
+
TInt g = bgColor.Green();
g -= KSwtRoundCornerBgColorDiff;
- if (g < 0)
+ if (g < 0)
g = 0;
-
+
TInt b = bgColor.Blue();
b -= KSwtRoundCornerBgColorDiff;
- if (b < 0)
+ if (b < 0)
b = 0;
-
+
bgColor.SetRed(b);
bgColor.SetGreen(b);
bgColor.SetBlue(b);
-
+
OverrideColorL(EColorControlBackground, bgColor);
}
#endif // RD_JAVA_S60_RELEASE_9_2
@@ -304,7 +304,7 @@
#ifdef RD_JAVA_S60_RELEASE_9_2
GfxTransEffect::Deregister(this);
#endif // RD_JAVA_S60_RELEASE_9_2
-
+
CSwtUiUtils& uiUtils = UiUtils();
if (uiUtils.GetActiveShell() == this)
{
@@ -362,7 +362,7 @@
// ---------------------------------------------------------------------------
// CSwtShell::HandlePointerEventL
// This is the entry point for all pointer events targeted at any of the children
-// of this Shell.
+// of this Shell except for Browser's case.
// From CCoeControl
// ---------------------------------------------------------------------------
//
@@ -371,19 +371,10 @@
{
CSwtUiUtils& utils = UiUtils();
- utils.SetNaviKeyInput(EFalse);
-
- MSwtControl* capturingControl = utils.PointerCaptureControl();
- if (capturingControl && capturingControl != this)
- {
- capturingControl->HandlePointerEventL(aPointerEvent);
- capturingControl->PostMouseEventL(aPointerEvent);
- iDisplay.TryDetectLongTapL(aPointerEvent);
- return;
- }
-
if (aPointerEvent.iType == TPointerEvent::EButton1Down)
{
+ utils.SetNaviKeyInput(EFalse);
+
// Ignore pointer events outside modal Shells.
MSwtShell *activeShell = utils.GetActiveShell();
if (!activeShell || (activeShell && activeShell != this &&
@@ -394,6 +385,20 @@
}
}
+ MSwtControl* capturingControl = utils.PointerCaptureControl();
+ if (capturingControl && capturingControl != this)
+ {
+ if (aPointerEvent.iType == TPointerEvent::EButton1Down
+ && capturingControl->IsFocusable())
+ {
+ capturingControl->SetSwtFocus(KSwtFocusByPointer);
+ }
+ capturingControl->HandlePointerEventL(aPointerEvent);
+ capturingControl->PostMouseEventL(aPointerEvent);
+ iDisplay.TryDetectLongTapL(aPointerEvent);
+ return;
+ }
+
MSwtControl* ctrl = NULL;
if (aPointerEvent.iType == TPointerEvent::EButton1Up)
@@ -435,9 +440,9 @@
{
TRAP_IGNORE(CreateBackgroundL());
}
-
+
CSwtUiUtils& utils = UiUtils();
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
TBool doEffect = (IsVisible() != aVisible) && (iDisplay.IsUiReady() || iParent);
if (doEffect)
@@ -455,9 +460,9 @@
GfxTransEffect::End(this);
}
#endif // RD_JAVA_S60_RELEASE_9_2
-
+
utils.ShellActivabilityChanged(*this);
-
+
// Done already if the Shell became active
if (aVisible && utils.GetActiveShell() != this)
{
@@ -919,10 +924,10 @@
// ---------------------------------------------------------------------------
//
void CSwtShell::SetVisible(TBool aVisible)
-{
+{
// A DrawNow() is absolutely mandatory if the ui is set to be ready.
CSwtDecorations::SetVisible(aVisible);
-
+
TBool paintingUrgently = !AsyncPainting();
if (aVisible && paintingUrgently && !iDisplay.IsUiReady())
{
@@ -2053,6 +2058,38 @@
}
// ---------------------------------------------------------------------------
+// CSwtShell::SetTaskTip
+// From MSwtShell
+// ---------------------------------------------------------------------------
+//
+void CSwtShell::SetTaskTip()
+{
+ iIsTaskTip = ETrue;
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ if (iParent && CAknEnv::Static()->TransparencyEnabled())
+ {
+ Window().SetRequiredDisplayMode(EColor16MA);
+ if (Window().SetTransparencyAlphaChannel() == KErrNone)
+ {
+ Window().SetBackgroundColor(~0);
+ }
+ }
+ GfxTransEffect::Deregister(this); // already registered in ConstructL
+ GfxTransEffect::Register(this, KGfxDiscreetPopupControlUid, EFalse);
+#endif
+}
+
+// ---------------------------------------------------------------------------
+// CSwtShell::IsTaskTip
+// From MSwtShell
+// ---------------------------------------------------------------------------
+//
+TBool CSwtShell::IsTaskTip() const
+{
+ return iIsTaskTip;
+}
+
+// ---------------------------------------------------------------------------
// CSwtShell::HandleStatusPaneSizeChange
// From MEikStatusPaneObserver
// ---------------------------------------------------------------------------
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtsortedlist.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtsortedlist.cpp Tue May 11 16:07:20 2010 +0300
@@ -393,7 +393,7 @@
//
TInt CSwtSortedList::CountComponentControls() const
{
- // The filter is orphaned to force its editor to draw CAknSearchField's
+ // The filter is orphaned to force its editor to draw CAknSearchField's
// background instead of our Shell's background.
return 1;
}
@@ -405,7 +405,7 @@
//
CCoeControl* CSwtSortedList::ComponentControl(TInt /*aIndex*/) const
{
- // The filter is orphaned to force its editor to draw CAknSearchField's
+ // The filter is orphaned to force its editor to draw CAknSearchField's
// background instead of our Shell's background.
return iList;
}
@@ -603,8 +603,8 @@
void CSwtSortedList::DoPaint(const TRect& aRect) const
{
CSwtListBase::DoPaint(aRect);
-
- // The filter is orphaned to force its editor to draw CAknSearchField's
+
+ // The filter is orphaned to force its editor to draw CAknSearchField's
// background instead of our Shell's background. Therefore drawing must
// be done 'manually'.
if (iSearchField)
@@ -612,7 +612,7 @@
CWindowGc& gc = SystemGc();
iSearchField->SetGc(&gc); // required by effects
iSearchField->DrawBackground(aRect);
- iSearchField->DrawForeground(aRect);
+ iSearchField->DrawForeground(aRect);
DrawComponentControls(*iSearchField, aRect, gc, EFalse);
}
}
@@ -915,11 +915,11 @@
iSearchField = CAknSearchField::NewL(*this,
CAknSearchField::EAdaptiveSearch, NULL, KSwtSearchFieldTextLimit);
iSearchField->Editor().AddEdwinObserverL(this);
-
- // Orphane the filter to force its editor to draw CAknSearchField's
+
+ // Orphane the filter to force its editor to draw CAknSearchField's
// background instead of our Shell's background.
iSearchField->SetParent(NULL);
-
+
iSearchField->AddAdaptiveSearchTextObserverL(this);
iSearchField->SetComponentsToInheritVisibility(ETrue);
CAknFilteredTextListBoxModel* model = STATIC_CAST(
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttable.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttable.cpp Tue May 11 16:07:20 2010 +0300
@@ -1710,13 +1710,13 @@
// Now we know the highest item checkbox/image/font height.
// Just add margins and set it.
TInt newItemHeight(highestHeight + marginTop + marginBottom);
-
+
MSwtUiUtils& utils = iDisplay.UiUtils();
TMargins8 padding = iDisplay.UiUtils().InlineReferencePadding();
TInt height = utils.InlineReferenceFontHeight();
height += padding.iTop + padding.iBottom;
if (newItemHeight < height) newItemHeight = height;
-
+
if (oldItemHeight != newItemHeight)
{
TRAP_IGNORE(
@@ -2096,7 +2096,7 @@
{
PackColumn(0);
}
-
+
Redraw();
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttablelistbox.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttablelistbox.cpp Tue May 11 16:07:20 2010 +0300
@@ -356,7 +356,7 @@
#else
EAknsCIQsnLineColorsCG6
#endif
- );
+ );
aGc.SetPenColor(gridLineColor);
aGc.SetPenSize(TSize(lineWidth, lineWidth));
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
@@ -377,13 +377,13 @@
drawRect.iBr.iX = iView->ViewRect().iBr.iX;
}
- // Last index means also last index partially visible,
- // therefore intentionally we do not substract 1 here.
- TInt lastIndex = iView->TopItemIndex()
- + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
+ // Last index means also last index partially visible,
+ // therefore intentionally we do not substract 1 here.
+ TInt lastIndex = iView->TopItemIndex()
+ + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
- drawRect.iBr.iY = iView->ItemPos(lastPotentialItemIndex).iY
- + iView->ItemSize(lastPotentialItemIndex).iHeight;
+ drawRect.iBr.iY = iView->ItemPos(lastPotentialItemIndex).iY
+ + iView->ItemSize(lastPotentialItemIndex).iHeight;
if (drawRect.iBr.iY > viewRect.iBr.iY) drawRect.iBr.iY = viewRect.iBr.iY;
@@ -403,7 +403,7 @@
p1.iY += itemHeight;
p2.iY += itemHeight;
}
-
+
// Then draw the vertical lines
// Compute the first column edge location
@@ -696,14 +696,14 @@
if (deltaX != 0)
iView->HScroll(deltaX);
}
-
+
iDragPos = aPointerEvent.iPosition;
CEikTextListBox::HandlePointerEventL(aPointerEvent);
if (aPointerEvent.iType == TPointerEvent::EButton1Up)
{
TInt focusIndex = CurrentItemIndex();
-
+
if (iListBoxFlags & EMultipleSelection)
{
// Multi lists
@@ -718,12 +718,12 @@
}
else
{
- View()->SelectItemL(focusIndex);
+ View()->SelectItemL(focusIndex);
}
}
else
{
- iTable.PostSelectionEventL(KSwtStyleCheck, focusIndex);
+ iTable.PostSelectionEventL(KSwtStyleCheck, focusIndex);
}
}
}
@@ -1003,18 +1003,18 @@
heightOfItemArea = viewRect.Height();
}
- // Last index means also last index partially visible,
+ // Last index means also last index partially visible,
// therefore intentionally we do not substract 1 here.
- TInt lastIndex = iView->TopItemIndex()
- + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
+ TInt lastIndex = iView->TopItemIndex()
+ + iView->NumberOfItemsThatFitInRect(iView->ViewRect());
TInt lastPotentialItemIndex = Min(iModel->NumberOfItems() - 1, lastIndex);
// Clear the unused portion of the viewing area
TRect usedPortionOfViewRect(viewRect.iTl.iX, iView->ItemPos(iView->TopItemIndex()).iY,
viewRect.iBr.iX, iView->ItemPos(lastPotentialItemIndex).iY
+ iView->ItemSize(lastPotentialItemIndex).iHeight);
-
- // This is needed as the horizontal scrollbar is transparent.
+
+ // This is needed as the horizontal scrollbar is transparent.
if (usedPortionOfViewRect.iBr.iY > viewRect.iBr.iY)
usedPortionOfViewRect.iBr.iY = viewRect.iBr.iY;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttasktip.cpp Fri Apr 30 10:40:48 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nokia Corporation - S60 implementation
- *******************************************************************************/
-
-
-#include <swtlaffacade.h>
-#include "swttasktip.h"
-
-
-const TInt KVariationFullScreen = 3;
-const TInt KVariationWindow = 0;
-const TInt KVariationWindowBarOrTextOnly = 1;
-const TInt KVariationBar = 0;
-const TInt KVariationBarOnly = 1;
-const TInt KVariationLabel = 0;
-const TInt KVariationLabelOnly = 1;
-
-
-// ======== MEMBER FUNCTIONS ========
-
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::NewL
-// ---------------------------------------------------------------------------
-//
-CSwtTaskTip* CSwtTaskTip::NewL(MSwtDisplay& aDisplay, TSwtPeer aPeer, TInt aStyle)
-{
- CSwtTaskTip* self = new(ELeave) CSwtTaskTip(aDisplay, aPeer, aStyle);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::Dispose
-// From MSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-TSwtPeer CSwtTaskTip::Dispose()
-{
- TSwtPeer peer(JavaPeer());
- delete this;
- return peer;
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::JavaPeer
-// From MSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-TSwtPeer CSwtTaskTip::JavaPeer() const
-{
- return iPeer;
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::GetBarDefaultBounds
-// From MSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-TRect CSwtTaskTip::GetBarDefaultBounds(TBool aHasText) const
-{
- if (aHasText
- && (((iStyle & KSwtStyleIndeterminate) != 0)
- || ((iStyle & KSwtStyleSmooth) != 0)))
- {
- return iRectBar;
- }
- else
- {
- return iRectBarOnly;
- }
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::GetLabelDefaultBounds
-// From MSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-TRect CSwtTaskTip::GetLabelDefaultBounds(TBool aHasText) const
-{
- if (aHasText
- && (((iStyle & KSwtStyleIndeterminate) != 0)
- || ((iStyle & KSwtStyleSmooth) != 0)))
- {
- return iRectLabel;
- }
- else
- {
- return iRectLabelOnly;
- }
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::GetShellDefaultBounds
-// From MSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-TRect CSwtTaskTip::GetShellDefaultBounds(TBool aHasText) const
-{
- if (aHasText
- && (((iStyle & KSwtStyleIndeterminate) != 0)
- || ((iStyle & KSwtStyleSmooth) != 0)))
- {
- return iRectShell;
- }
- else
- {
- return iRectShellBarOrLabelOnly;
- }
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::OfferResourceChangeL
-// From MSwtResourceChangeObserver
-// ---------------------------------------------------------------------------
-//
-void CSwtTaskTip::OfferResourceChangeL(TInt aType)
-{
- if (aType == KEikDynamicLayoutVariantSwitch)
- {
- UpdateLayout();
- }
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::CSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-CSwtTaskTip::CSwtTaskTip(MSwtDisplay& aDisplay, TSwtPeer aPeer, TInt aStyle)
- : iDisplay(aDisplay)
- , iPeer(aPeer)
- , iStyle(aStyle)
-{
- iRectShell = TRect(TRect::EUninitialized);
- iRectShellBarOrLabelOnly = TRect(TRect::EUninitialized);
- iRectLabel = TRect(TRect::EUninitialized);
- iRectLabelOnly = TRect(TRect::EUninitialized);
- iRectBar = TRect(TRect::EUninitialized);
- iRectBarOnly = TRect(TRect::EUninitialized);
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::CSwtTaskTip
-// ---------------------------------------------------------------------------
-//
-CSwtTaskTip::~CSwtTaskTip()
-{
- iDisplay.RemoveResourceChangeObserver(this);
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CSwtTaskTip::ConstructL()
-{
- iDisplay.AddResourceChangeObserverL(this);
- UpdateLayout();
-}
-
-// ---------------------------------------------------------------------------
-// CSwtTaskTip::UpdateLayout
-// ---------------------------------------------------------------------------
-//
-void CSwtTaskTip::UpdateLayout()
-{
- TRect screenRect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect);
- TAknLayoutRect layoutMainPane = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EMainEswtPane,
- screenRect,
- KVariationFullScreen);
- TRect mainPaneRect = layoutMainPane.Rect();
-
- // Shell bounds
- TAknLayoutRect layoutShell = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EPopupEswtTasktipWindow,
- mainPaneRect,
- KVariationWindow);
- iRectShell = layoutShell.Rect();
- layoutShell = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EPopupEswtTasktipWindow,
- mainPaneRect,
- KVariationWindowBarOrTextOnly);
- iRectShellBarOrLabelOnly = layoutShell.Rect();
-
- // Label bounds
- TAknLayoutText layoutLabel = CSwtLafFacade::GetLayoutText(
- CSwtLafFacade::EPopupEswtTasktipWindowT1,
- iRectShell,
- KVariationLabel);
- iRectLabel = layoutLabel.TextRect();
- layoutLabel = CSwtLafFacade::GetLayoutText(
- CSwtLafFacade::EPopupEswtTasktipWindowT1,
- iRectShellBarOrLabelOnly,
- KVariationLabelOnly);
- iRectLabelOnly = layoutLabel.TextRect();
-
- // Progress bar bounds
- if (((iStyle & KSwtStyleIndeterminate) != 0)
- || ((iStyle & KSwtStyleSmooth) != 0))
- {
- TAknLayoutRect layoutBar = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EWaitBarPaneCp71,
- iRectShell,
- KVariationBar);
- iRectBar = layoutBar.Rect();
- layoutBar = CSwtLafFacade::GetLayoutRect(
- CSwtLafFacade::EWaitBarPaneCp71,
- iRectShellBarOrLabelOnly,
- KVariationBarOnly);
- iRectBarOnly = layoutBar.Rect();
- }
-}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttext.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swttext.cpp Tue May 11 16:07:20 2010 +0300
@@ -614,7 +614,7 @@
{
return;
}
-
+
// Update editor's visibility, otherwise text will be drawn
// when performing clipboard operations on invisible control.
const TBool visible = GetVisibleRecursively();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtuiutils.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtuiutils.cpp Tue May 11 16:07:20 2010 +0300
@@ -35,6 +35,7 @@
#include "swtdisplaybase.h"
_LIT(KSeparator, "-");
+const TInt KVariationFullScreen = 3;
// ======== MEMBER FUNCTIONS ========
@@ -676,15 +677,15 @@
&appUi,
NULL,
CEikButtonGroupContainer::EAddToStack);
-
+
// The Cba will be made visible by the firtst top shell to show
// or by the first child Shell with commands to show.
iCba->MakeVisible(EFalse);
-
+
#ifdef RD_JAVA_S60_RELEASE_9_2
static_cast<CEikCba*>(iCba->ButtonGroup())->EnableItemSpecificSoftkey(EFalse);
#endif
-
+
const TSize screenSize = iDisplay.CoeEnv()->ScreenDevice()->SizeInPixels();
iCba->SetBoundingRect(TRect(screenSize));
@@ -744,7 +745,7 @@
// Bring back on screen and activate the new Shell.
MoveToEndOfQueue(*iActiveShell);
-
+
TRAP_IGNORE(UpdateStatusPaneL());
iActiveShell->Control()->ShowSilently();
@@ -753,7 +754,7 @@
// Remember the new top most Shell for Shell activability changes.
iLastTopMostShell = TopMostTopShell();
-
+
SetShellFade(iActiveShell, ETrue);
}
@@ -865,7 +866,7 @@
{
if (!iStatusPane)
return;
-
+
HideIndicator(EEikStatusPaneUidSignal);
HideIndicator(EEikStatusPaneUidBattery);
HideIndicator(EEikStatusPaneUidIndic);
@@ -1134,7 +1135,7 @@
// CSwtUiUtils::UpdateStatusPaneL
// From MSwtUiUtils
// Calls to this should be kept to a severe minimum! This function is not anymore
-// responsible of resizing the topmost shells since Shell's bounds should not
+// responsible of resizing the topmost shells since Shell's bounds should not
// depend on the current status pane height(See CSwtShell::DefaultBounds()).
// ---------------------------------------------------------------------------
//
@@ -1273,22 +1274,22 @@
iStatusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE);
}
iStatusPane->MakeVisible(ETrue);
-
+
java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonEswt::getInstance().getJavaUiAppUi();
if (appUi && appUi->hidesIndicators())
{
HideIndicators();
}
-
+
// The above relies on DrawDeferred which is too slow for some cases.
- // For instance, the pane must draw immediately when the app draws the
+ // For instance, the pane must draw immediately when the app draws the
// first time otherwise the startup screenshot will miss the pane.
iStatusPane->DrawNow();
}
-
+
// This will cause HandleStatusPaneSizeChange notifications again
iStatusPane->SetObserver(this);
-
+
// Shells are trusted to have the correct size already.
}
@@ -1305,9 +1306,9 @@
{
return;
}
-
+
ASSERT(!iActiveShell);
-
+
// Update flag
iFocusLost = EFalse;
TBool getFocused(EFalse);
@@ -1316,7 +1317,7 @@
getFocused = iNextFocusedControl->SetSwtFocus(KSwtFocusByForce);
iNextFocusedControl = NULL;
}
-
+
if (getFocused)
{
// do nothing
@@ -1524,7 +1525,7 @@
iInlineFont = NULL;
iInlineFontHeight = -1;
iInlinePadding.iTop = -1;
-
+
// Sometimes CBA bounds are incorrect at this point in the case we have
// a dialog shell active. As a result Shell gets wrong size.
// Set the bounds here to make sure they are always correct.
@@ -1613,6 +1614,11 @@
return;
}
iCba->MakeVisible(aVisible);
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // To enable clock pane in landscape after MIDlet was started
+ iCba->SetBoundingRect(TRect(0, 0, 0, 0));
+#endif // RD_JAVA_S60_RELEASE_9_2
}
// ---------------------------------------------------------------------------
@@ -1654,6 +1660,26 @@
// From MSwtUiUtils
// ---------------------------------------------------------------------------
//
+TRect CSwtUiUtils::TaskTipRect() const
+{
+ TRect screenRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect);
+ TAknLayoutRect layoutMainPane = CSwtLafFacade::GetLayoutRect(
+ CSwtLafFacade::EMainEswtPane,
+ screenRect,
+ KVariationFullScreen);
+ TRect mainPaneRect = layoutMainPane.Rect();
+ TAknLayoutRect layoutShell = CSwtLafFacade::GetLayoutRect(
+ CSwtLafFacade::EPopupEswtTasktipWindow,
+ mainPaneRect);
+ return layoutShell.Rect();
+}
+
+// ---------------------------------------------------------------------------
+// CSwtUiUtils::HandleFreeRamEventL
+// From MSwtUiUtils
+// ---------------------------------------------------------------------------
+//
void CSwtUiUtils::HandleFreeRamEventL(TInt aEventType)
{
const TInt count = iShells.Count();
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/ercp/swt/mobile/TaskTip.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/ercp/swt/mobile/TaskTip.java Tue May 11 16:07:20 2010 +0300
@@ -18,6 +18,8 @@
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
@@ -76,8 +78,6 @@
*/
public class TaskTip extends Widget
{
- private int handle = 0;
-
private Shell tasktipShell = null;
private Label tasktipLabel = null;
private ProgressBar tasktipBar = null;
@@ -89,8 +89,6 @@
private Shell topShell = null;
private ControlListener topShellListener = null;
- private boolean hasText = false;
-
/**
*
* Constructs a TaskTip with plain text style.
@@ -151,13 +149,22 @@
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
- handle = OS.TaskTip_New(this, getStyle());
-
tasktipShell = new Shell(shell, SWT.NO_FOCUS|SWT.ON_TOP|SWT.NO_TRIM);
- tasktipLabel = new Label(tasktipShell, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginBottom = 0;
+ layout.marginTop = 0;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 1;
+ layout.horizontalSpacing = 0;
+ tasktipShell.setLayout(layout);
+ tasktipShell.internal_setTaskTip();
if (getStyle() != SWT.NONE)
{
tasktipBar = new ProgressBar(tasktipShell, getStyle());
+ tasktipBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
}
// If the parent shell is disposed task tip is disposed also
@@ -351,18 +358,25 @@
public void setText(String string)
{
checkWidget();
- boolean hasTextPrev = hasText;
+ boolean prevLabel = tasktipLabel != null;
if (string == null)
{
- tasktipLabel.setText("");
- hasText = false;
+ if (tasktipLabel != null)
+ {
+ tasktipLabel.dispose();
+ tasktipLabel = null;
+ }
}
else
{
+ if (tasktipLabel == null)
+ {
+ tasktipLabel = new Label(tasktipShell, SWT.NONE);
+ tasktipLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ }
tasktipLabel.setText(removeLine(string));
- hasText = true;
}
- if (hasTextPrev != hasText)
+ if (prevLabel != (tasktipLabel != null))
{
rebound();
}
@@ -402,16 +416,6 @@
tasktipShell.setVisible(visible);
}
- protected void internal_releaseHandle()
- {
- if (handle != 0)
- {
- OS.TaskTip_Dispose(handle);
- handle = 0;
- }
- super.internal_releaseHandle();
- }
-
protected void internal_releaseResources()
{
if (tasktipShell != null)
@@ -428,31 +432,14 @@
private void rebound()
{
- int heightDifference = 0;
- Rectangle labelRect = new Rectangle(0,0,0,0);
- Rectangle shellRect = OS.TaskTip_GetShellDefaultBounds(handle, hasText);
- if (hasText)
- {
- labelRect = OS.TaskTip_GetLabelDefaultBounds(handle, hasText);
- labelRect.x -= shellRect.x;
- labelRect.y -= shellRect.y;
- Point labelPrefSize = tasktipLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- if (labelPrefSize.y > labelRect.height)
- {
- heightDifference = labelPrefSize.y - labelRect.height;
- labelRect.height = labelPrefSize.y;
- }
- }
- shellRect.height += heightDifference;
+ Rectangle shellRect = OS.TaskTip_DefaultBounds();
+
+ Point idealSize = tasktipShell.computeSize(shellRect.width, SWT.DEFAULT);
+ if (shellRect.height < idealSize.y)
+ shellRect.height = idealSize.y;
+
tasktipShell.setBounds(shellRect);
- tasktipLabel.setBounds(labelRect);
- if (tasktipBar != null)
- {
- Rectangle barRect = OS.TaskTip_GetBarDefaultBounds(handle, hasText);
- barRect.x -= shellRect.x;
- barRect.y -= shellRect.y;
- tasktipBar.setBounds(barRect);
- }
+ tasktipShell.layout();
}
private String removeLine(String aString)
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/ercp/swt/mobile/internal/OS.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/ercp/swt/mobile/internal/OS.java Tue May 11 16:07:20 2010 +0300
@@ -210,11 +210,7 @@
/*
* Class TaskTip
*/
- public static final native int TaskTip_New(TaskTip peer, int style);
- public static final native void TaskTip_Dispose(int handle);
- public static final native Rectangle TaskTip_GetBarDefaultBounds(int handle, boolean hasText);
- public static final native Rectangle TaskTip_GetLabelDefaultBounds(int handle, boolean hasText);
- public static final native Rectangle TaskTip_GetShellDefaultBounds(int handle, boolean hasText);
+ public static final native Rectangle TaskTip_DefaultBounds();
/*
* Class TextExtension
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/internal/symbian/OS.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/internal/symbian/OS.java Tue May 11 16:07:20 2010 +0300
@@ -21,7 +21,7 @@
/**
* @brief This is the place where all native functions are located.
*
- * This class is not supposed to be instanciated as it only contains static
+ * This class is not supposed to be instantiated as it only contains static
* methods. <b>Warning</b>: the content of this class is platform dependent.
*/
public class OS
@@ -32,6 +32,12 @@
{
Library.loadLibrary("eswt");
}
+
+ public static final int WS_SYMBIAN_S60_50 = 1;
+ public static final int WS_SYMBIAN_S60_92 = 2;
+
+ // Underlying window server.
+ public static final int windowServer = windowServer();
/*
* Class Device
@@ -301,6 +307,7 @@
public static final native void Shell_SetImeInputMode(int shellHandle, int mode);
public static final native Rectangle Shell_GetDefaultBounds(int shellHandle);
public static final native void Shell_SetAsyncPainting(int shellHandle, boolean status);
+ public static final native void Shell_SetTaskTip(int shellHandle);
/*
* Class Label
@@ -481,4 +488,8 @@
public static final native int ImageDataLoader_GetLogicalScreenHeight(int handle);
public static final native int ImageDataLoader_GetLogicalScreenWidth(int handle);
+ /*
+ * General
+ */
+ private static final native int windowServer();
}
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/FontDialog.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/FontDialog.java Tue May 11 16:07:20 2010 +0300
@@ -14,8 +14,6 @@
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Shell;
@@ -28,14 +26,11 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.ercp.swt.expanded.internal.OS;
-import org.eclipse.ercp.swt.mobile.Command;
-import java.util.Vector;
/**
@@ -208,7 +203,13 @@
flags |= SWT.TITLE;
shell = new Shell(getParent(), flags);
shell.setText(title);
- shell.open();
+
+ if (org.eclipse.swt.internal.symbian.OS.windowServer
+ < org.eclipse.swt.internal.symbian.OS.WS_SYMBIAN_S60_92)
+ {
+ // On 5.0 the modal Shell needs to be made visible before Combo is created.
+ shell.open();
+ }
// Listen to skin and resolution changes
settingsListener = new Listener()
@@ -325,6 +326,12 @@
}
shell.setBounds(rect);
+
+ if (org.eclipse.swt.internal.symbian.OS.windowServer
+ >= org.eclipse.swt.internal.symbian.OS.WS_SYMBIAN_S60_92)
+ {
+ shell.open();
+ }
// Block till submited
isOpen = true;
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/Label.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/Label.java Tue May 11 16:07:20 2010 +0300
@@ -115,18 +115,6 @@
}
/**
- * Disable SetMenu method because label is a non-focusable widget.
- *
- */
- /*
- public void setMenu (Menu menu) {
- checkWidget ();
- }
- */
-
-
-
- /**
* Returns a value which describes the position of the
* text or image in the receiver. The value will be one of
* <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/Shell.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/widgets/Shell.java Tue May 11 16:07:20 2010 +0300
@@ -104,8 +104,6 @@
{
private int shellHandle;
- // Widgets registered with this Shell
- private Vector widgets = new Vector();
private Vector asyncPaintControls = new Vector();
/**
@@ -396,12 +394,26 @@
return size;
}
+ /**
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Shell</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ */
protected void internal_setShellHandle(int shellHandle)
{
this.shellHandle = shellHandle;
internal_setDecorationsHandle(OS.Shell_DecorationsHandle(shellHandle));
}
+ /**
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Shell</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ */
public void internal_checkShell()
{
checkWidget();
@@ -550,15 +562,6 @@
protected void internal_releaseResources()
{
- int size = widgets.size();
- for (int i=0; i<size; ++i)
- {
- // release the registered widgets
- // that take this shell as parent
- Widget widget = (Widget)widgets.elementAt(i);
- widget.internal_release();
- }
- widgets.removeAllElements();
asyncPaintControls.removeAllElements();
super.internal_releaseResources();
}
@@ -680,21 +683,25 @@
OS.Shell_SetImeInputMode(shellHandle, mode);
}
+ /**
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Shell</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ */
public int internal_getShellHandle()
{
return shellHandle;
}
- public void internal_registerWidget(Widget widget)
- {
- widgets.addElement(widget);
- }
-
- public void internal_unregisterWidget(Widget widget)
- {
- widgets.removeElement(widget);
- }
-
+ /**
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Shell</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ */
public Rectangle internal_getDefaultBounds()
{
return OS.Shell_GetDefaultBounds(shellHandle);
@@ -712,6 +719,18 @@
return OS.Control_GetVisible(this.display.handle, handle);
}
+ /**
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Shell</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ */
+ public void internal_setTaskTip()
+ {
+ OS.Shell_SetTaskTip(shellHandle);
+ }
+
void setAsyncPainting(Control child, boolean status)
{
if (status)
--- a/javauis/javalegacyutils/build/javalegacyutils_0x2002DCBB.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/javalegacyutils/build/javalegacyutils_0x2002DCBB.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -106,6 +105,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/lcdui_akn/javalcdui/build/javalcdui.pro Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/build/javalcdui.pro Tue May 11 16:07:20 2010 +0300
@@ -46,6 +46,7 @@
-lhwrmlightclient \
-lgfxtrans \
-lws32 \
+ -lCentralRepository \
#ifdef RD_JAVA_NGA_ENABLED
-llibegl \
-llibglesv1_cm
--- a/javauis/lcdui_akn/javalcdui/build/javalcdui_0x2002DCBA.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/build/javalcdui_0x2002DCBA.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -158,6 +157,7 @@
LIBRARY ws32.lib
LIBRARY hwrmlightclient.lib
LIBRARY gfxtrans.lib
+LIBRARY CentralRepository.lib
LIBRARY libegl.lib
LIBRARY libglesv1_cm.lib
LIBRARY javautils.lib
@@ -172,6 +172,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/lcdui_akn/javalcdui/inc/CMIDToolkit.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/inc/CMIDToolkit.h Tue May 11 16:07:20 2010 +0300
@@ -167,6 +167,11 @@
void HandleResourceChangeL(TInt aType);
private:
+ /**
+ * Resets user inactivity timers
+ */
+ void ResetInactivityTimeL();
+
static TInt CreateToolkitL
(
JNIEnv& aJni,
--- a/javauis/lcdui_akn/javalcdui/inc/lcdui.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/inc/lcdui.h Tue May 11 16:07:20 2010 +0300
@@ -720,13 +720,6 @@
*/
EDrwOpcBitBltRect = 1
#endif // RD_JAVA_NGA_ENABLED
-
- /**
- * Indicates first ever canvas paint.
- * Used to stop the splash screen.
- * @since S60 9.2
- */
- ,EDrwOpcFirstPaint = 3
};
public:
/**
@@ -830,6 +823,8 @@
*/
virtual void UpdateRect(const TRect& aRect) = 0;
#endif // RD_JAVA_NGA_ENABLED
+
+ virtual TBool ReadyToBlit() const = 0;
};
/**
--- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java Tue May 11 16:07:20 2010 +0300
@@ -10,7 +10,7 @@
*
* Contributors:
*
- * Description: Package private class implementing the S40 and S60 interfaces
+ * Description: Package private class implementing the S60 interfaces
* for TextEditor
*
*/
@@ -34,9 +34,8 @@
* @since 1.4
*/
class TextEditorImpl
- extends com.nokia.mid.ui.TextEditor
- implements com.nokia.mid.ui.S60TextEditor
-{
+ extends com.nokia.mid.ui.TextEditor
+ implements com.nokia.mid.ui.S60TextEditor {
/*
* Indicates that all input methods are available.
* <p>
@@ -129,8 +128,7 @@
* if the width or height is less than one pixel
*/
TextEditorImpl(String aText, int aMaxSize, int aConstraints, int aWidth,
- int aHeight)
- {
+ int aHeight) {
super(aText, aMaxSize, aConstraints, aWidth, aHeight, false);
}
@@ -173,11 +171,10 @@
* @throws IllegalArgumentException
* if the width is less than one pixel
*/
- TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows)
- {
+ TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows) {
super(null, aMaxSize, aConstraints, aWidth, aRows, true);
}
-
+
/*
* Set the parent object of this TextEditor. Typically in LCDUI the parent
* object would be Canvas or CustomItem. Setting the parameter to null
@@ -189,12 +186,10 @@
* if <code>aParent</code> is not a valid object with which a
* TextEditor can be associated
*/
- public void setParent(Object aParent)
- {
- super.setParent(aParent);
+ public void setParent( Object aParent ) {
+ super.setParent( aParent );
// Update indicator location to their default position.
- if (aParent != null)
- {
+ if( aParent != null ) {
setDefaultIndicators();
}
}
@@ -233,12 +228,10 @@
* the y coordinate of the anchor point, in pixels.
*
*/
- public void setIndicatorLocation(int x, int y)
- {
- synchronized (iToolkit)
- {
+ public void setIndicatorLocation(int x, int y) {
+ synchronized (iToolkit) {
NativeError.check(_setIndicatorLocation(getToolkitHandle(),
- iHandle, x, y));
+ iHandle, x, y));
}
}
@@ -267,20 +260,17 @@
* If the <code>TextEditor</code> is not added to
* <code>Canvas</code>
*/
- public void setDefaultIndicators()
- {
- synchronized (iToolkit)
- {
+ public void setDefaultIndicators() {
+ synchronized (iToolkit) {
Object parent = getParent();
boolean fullScreen = false;
- if (parent instanceof Canvas)
- {
+ if (parent instanceof Canvas) {
fullScreen = iLCDUIPackageInvoker.isFullScreen((Canvas) parent);
}
NativeError.check(_setDefaultIndicators(getToolkitHandle(),
- iHandle, fullScreen));
+ iHandle, fullScreen));
}
}
@@ -304,12 +294,10 @@
* @see #setIndicatorLocation(int, int)
* @see #setDefaultIndicators()
*/
- public void setIndicatorVisibility(boolean visible)
- {
- synchronized (iToolkit)
- {
+ public void setIndicatorVisibility(boolean visible) {
+ synchronized (iToolkit) {
NativeError.check(_setIndicatorVisibility(getToolkitHandle(),
- iHandle, visible));
+ iHandle, visible));
}
}
@@ -329,14 +317,12 @@
* @return the width and height of area needed for drawing input indicators
* @see #setDefaultIndicators()
*/
- public int[] getIndicatorSize()
- {
+ public int[] getIndicatorSize() {
int[] size = new int[INDICATOR_SIZE_COUNT];
- synchronized (iToolkit)
- {
+ synchronized (iToolkit) {
NativeError.check(_getIndicatorSize(getToolkitHandle(), iHandle,
- size));
+ size));
}
return size;
}
@@ -363,20 +349,17 @@
* @see #setPreferredTouchMode(int)
* @see #getDisabledTouchInputModes()
*/
- public void setDisabledTouchInputModes(int touchInputModes)
- {
+ public void setDisabledTouchInputModes(int touchInputModes) {
// Validate touch input modes. There must not be additional modes
// 0 is valid.
// See com.nokia.mid.ui.s60.TextEditor.TOUCH_INPUT_ALL_AVAILABLE.
- if ((touchInputModes & ~MASK) != 0)
- {
+ if ((touchInputModes & ~MASK) != 0) {
throw new IllegalArgumentException();
}
- synchronized (iToolkit)
- {
+ synchronized (iToolkit) {
NativeError.check(_setDisabledTouchInputModes(getToolkitHandle(),
- iHandle, touchInputModes));
+ iHandle, touchInputModes));
}
}
@@ -395,12 +378,10 @@
* @see #setDisabledTouchInputModes(int)
* @see #setPreferredTouchMode(int)
*/
- public int getDisabledTouchInputModes()
- {
+ public int getDisabledTouchInputModes() {
int disabled = 0;
- synchronized (iToolkit)
- {
+ synchronized (iToolkit) {
disabled = _getDisabledTouchInputModes(getToolkitHandle(), iHandle);
}
@@ -429,20 +410,17 @@
* @see #getPreferredTouchMode()
*
*/
- public void setPreferredTouchMode(int touchInputModes)
- {
+ public void setPreferredTouchMode(int touchInputModes) {
int mask = touchInputModes & MASK;
// Validate touch input mode.
if (touchInputModes == 0 || (touchInputModes & ~MASK) != 0
- || (mask & (mask - 1)) != 0)
- {
+ || (mask & (mask - 1)) != 0) {
throw new IllegalArgumentException();
}
- synchronized (iToolkit)
- {
+ synchronized (iToolkit) {
NativeError.check(_setPreferredTouchMode(getToolkitHandle(),
- iHandle, touchInputModes));
+ iHandle, touchInputModes));
}
}
@@ -458,41 +436,37 @@
* @see #setPreferredTouchMode(int)
* @see #setDisabledTouchInputModes(int)
*/
- public int getPreferredTouchMode()
- {
+ public int getPreferredTouchMode() {
int preferredMode = 0;
- synchronized (iToolkit)
- {
+ synchronized (iToolkit) {
preferredMode = _getPreferredTouchMode(getToolkitHandle(), iHandle);
}
NativeError.check(preferredMode);
return preferredMode;
}
-
+
/*
* Sets the caret in the Editor at x, y location.
- *
+ *
* @param x
* The x coordinate of the wanted caret position.
*
* @param y
* The y coordinate of the wanted caret position.
*/
- public void setCaretXY(int x, int y)
- {
- synchronized (iToolkit)
- {
- NativeError.check(_setCaretXY(getToolkitHandle(), iHandle, x, y));
+ public void setCaretXY(int x, int y) {
+ synchronized (iToolkit) {
+ NativeError.check(_setCaretXY(getToolkitHandle(),
+ iHandle, x, y));
}
}
/*
* Hidden default constructor.
*/
- private TextEditorImpl()
- {
+ private TextEditorImpl() {
}
// Private methods.
--- a/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/javax/microedition/lcdui/CanvasGraphicsItemPainter.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/javax/microedition/lcdui/CanvasGraphicsItemPainter.java Tue May 11 16:07:20 2010 +0300
@@ -154,7 +154,7 @@
if (iGraphics == null)
{
iGraphics = new Graphics(
- (Toolkit)iToolkit, this, iHandle,
+ iToolkit, this, iHandle,
iItem.getWidth(), iItem.getHeight());
}
--- a/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/TextComponent.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/TextComponent.java Tue May 11 16:07:20 2010 +0300
@@ -84,11 +84,12 @@
final int modifier = (aConstraints & ~TextField.CONSTRAINT_MASK);
if (modifier == 0 || (modifier >= 0x10000 && modifier <= 0x3F0000))
return;
+ else
+ throw new IllegalArgumentException();
}
default:
- break;
+ throw new IllegalArgumentException();
}
- throw new IllegalArgumentException();
}
} // class TextComponent
--- a/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Toolkit.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Toolkit.java Tue May 11 16:07:20 2010 +0300
@@ -94,10 +94,7 @@
// NGA specific change
private int iFlags = FLAG_NONE;
-
- // Splash screen specific
- private boolean iFirstPaint = true;
-
+
//
// Event source : must keep in sync with TSourceType in lcdui.h
//
@@ -148,10 +145,7 @@
// NGA specific change.
// Op code indicating M3G content start
private static final int M3G_CONTENT_START = 2;
-
- // Splash screen specific.
- private static final int SYNC_FIRST_PAINT = 3;
-
+
Toolkit(ToolkitInvoker aInvoker)
{
iInvoker = aInvoker;
@@ -666,13 +660,6 @@
final int y2=aY+aH;
iBuffer.write(aDrawable, SYNC_RECT, aX, aY, x2, y2);
iBuffer.sync();
-
- if (iFirstPaint)
- {
- iFirstPaint = false;
- iBuffer.write(aDrawable, SYNC_FIRST_PAINT);
- iBuffer.sync();
- }
}
}
--- a/javauis/lcdui_akn/javalcdui/src/CMIDToolkit.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/javalcdui/src/CMIDToolkit.cpp Tue May 11 16:07:20 2010 +0300
@@ -27,6 +27,10 @@
#include <bautils.h>
#include <s32stor.h>
#include <s32file.h>
+#include <e32property.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+#include <screensaverinternalpskeys.h> // to work with screensaver
#include <gfxtranseffect/gfxtranseffect.h> // For transition effects
#include <akntranseffect.h> // For transition effects
//
@@ -427,6 +431,8 @@
ASSERT(oldDisplayable->Component()->Type() == MMIDComponent::EAlert);
}
+ ResetInactivityTimeL();
+
// Set it, revert will rollback if required.
iCurrentDisplayable = newDisplayable;
@@ -487,6 +493,57 @@
CleanupStack::Pop(); // revert
}
+void CMIDToolkit::ResetInactivityTimeL()
+{
+ TInt status = KErrNotFound;
+ RProperty::Get(KPSUidScreenSaver, KScreenSaverAllowScreenSaver,status);
+
+ // If Screen Saver is enabled and is inactive reset timers
+ // Keep lights on and screensaver disabled. When status is >0 it means
+ // that screen saver is not allowed to be activated
+ if (!status)
+ {
+ TInt isTimeoutEnabled = KErrNone;
+ TInt errPCenrep = KErrNone;
+ CRepository* pCenrep = CRepository::NewLC(KCRUidPersonalizationSettings);
+ if (pCenrep)
+ {
+ errPCenrep = pCenrep->Get(
+ KSettingsScreensaverTimeoutItemVisibility,
+ isTimeoutEnabled);
+ }
+ CleanupStack::PopAndDestroy(pCenrep);
+
+#if defined(__WINSCW__)
+ if (!isTimeoutEnabled)
+ {
+ isTimeoutEnabled = 1;
+ }
+#endif
+
+ // Screen Saver Time out value
+ TInt screenSaverTimeout = KErrNone;
+ TInt errSCenrep = KErrNone;
+ CRepository* securityCenrep = CRepository::NewLC(KCRUidSecuritySettings);
+ if (securityCenrep)
+ {
+ errSCenrep = securityCenrep->Get(
+ KSettingsAutomaticKeyguardTime, screenSaverTimeout);
+ }
+ CleanupStack::PopAndDestroy(securityCenrep);
+
+ // Inactivity time in seconds
+ TInt userInactivity = User::InactivityTime().Int();
+
+ // Check if screen saver is inactive, if so reset timers
+ if (errPCenrep == KErrNone && errSCenrep == KErrNone &&
+ isTimeoutEnabled && userInactivity < screenSaverTimeout)
+ {
+ User::ResetInactivityTime();
+ }
+ }
+}
+
void CMIDToolkit::BringToForeground()
{
LCDUI_DEBUG("**RF**");
@@ -513,10 +570,25 @@
if (appUi && appUi->hasStartScreen())
{
MMIDComponent* content = iCurrentDisplayable ? iCurrentDisplayable->Component() : NULL;
- if (!content || content->Type() != MMIDComponent::ECanvas)
+
+ TBool isCanvas = EFalse;
+ TBool isCanvasReadyToBlit = EFalse;
+ if (content)
+ {
+ if (content->Type() == MMIDComponent::ECanvas)
+ {
+ isCanvas = ETrue;
+ MMIDCanvas* canvas = static_cast<MMIDCanvas*>(content);
+ isCanvasReadyToBlit = canvas->ReadyToBlit();
+ }
+ }
+
+ if (!content || !isCanvas || isCanvasReadyToBlit)
{
if (iCurrentDisplayable)
+ {
iCurrentDisplayable->DrawNow();
+ }
appUi->stopStartScreen();
}
}
--- a/javauis/lcdui_akn/lcdgr/src/LcdGraphics.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdgr/src/LcdGraphics.cpp Tue May 11 16:07:20 2010 +0300
@@ -845,7 +845,13 @@
iSurface->End(iCount);
CHECK_BITMAP_LOCK();
-
+
+ // MMIDCanvas::DrawBackground modifies settings of iContext.
+ // Reset pen and brush settings here, so they
+ // are re-applied again when needed.
+ iState = 0;
+ iContext->SetPenStyle(CGraphicsContext::ENullPen);
+ iContext->SetBrushStyle(CGraphicsContext::ENullBrush);
}
TInt CLcdGraphics::DrawPixels
--- a/javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h Tue May 11 16:07:20 2010 +0300
@@ -382,6 +382,7 @@
MMIDTactileFeedbackComponent* TactileFeedbackComponent();
#endif // RD_TACTILE_FEEDBACK
+ TBool ReadyToBlit() const;
// from base class MMIDBufferProcessor
@@ -1039,9 +1040,27 @@
* returns EFalse.
*/
TBool IsNetworkIndicatorEnabledL() const;
+
+public:
+ /**
+ * Handles switching from foreground to
+ * background and vice versa. Mainly rendering
+ * context and surfaces need to be relased.
+ */
+ void HandleForeground(TBool aForeground);
+
+private:
+ /** States of the first paint */
+ enum TFirstPainState {
+ EFirstPaintNeverOccurred = 0,
+ EFirstPaintInitiated,
+ EFirstPaintPrepared,
+ EFirstPaintOccurred
+ };
#ifdef RD_JAVA_NGA_ENABLED
+private:
/** EGL surface types */
typedef enum
{
@@ -1049,8 +1068,7 @@
EEglWindow,
EEglPbuffer
} TEglType;
-
-
+
// from MAlfBufferProvider
public:
/**
@@ -1080,14 +1098,6 @@
void ContextAboutToSuspend();
void OnActivation();
-public:
- /**
- * Handles switching from foreground to
- * background and vice versa. Mainly rendering
- * context and surfaces need to be relased.
- */
- void HandleForeground(TBool aForeground);
-
// From MMIDComponentNgaExtension
public:
/**
@@ -1550,9 +1560,7 @@
// Stores the control on which was press event generated
MMIDCustomComponent* iPressedComponent;
-
-#ifdef RD_JAVA_NGA_ENABLED
-
+
/**
* Flag incdicating the foreground status of canvas.
* Set to EFalse when some other displayable is made current
@@ -1560,6 +1568,8 @@
*/
TBool iForeground;
+#ifdef RD_JAVA_NGA_ENABLED
+
/**
* CAlfCompositionPixelSource is used for drawing canvas
* content when only basic content is drawn
@@ -1680,6 +1690,12 @@
* All events, which started outside the canvas have to be ignored.
*/
TBool iDragEventsStartedInside;
+
+ /**
+ * Switched after any graphics have been sent to screen.
+ * Those graphics should be really drawn on the screen.
+ */
+ TInt iFirstPaintState;
};
#ifdef RD_JAVA_NGA_ENABLED
--- a/javauis/lcdui_akn/lcdui/inc/CMIDChoiceGroupControl.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDChoiceGroupControl.h Tue May 11 16:07:20 2010 +0300
@@ -280,8 +280,7 @@
* @param aSelected The new selection state of the element
* @param aPostEvent If true, itemStateChanged event is sent to the midlet
*/
- void CMIDChoiceGroupControl::SelectElementL(TInt aIndex, TBool aSelected,
- TBool aPostEvent);
+ void SelectElementL(TInt aIndex, TBool aSelected, TBool aPostEvent);
void UpdateMargins();
void UpdatePopupListAppearanceL(TChoiceGroupModelEvent aEvent);
--- a/javauis/lcdui_akn/lcdui/inc/CMIDChoiceGroupListBox.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDChoiceGroupListBox.h Tue May 11 16:07:20 2010 +0300
@@ -70,6 +70,14 @@
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
#endif
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ /**
+ * Returns index of ChoiceGroup element, which is the first
+ * visible element in ChoiceGroup from top of Form.
+ */
+ TInt TopVisibleItemIndex();
+#endif // RD_JAVA_S60_RELEASE_9_2
+
#ifdef RD_TACTILE_FEEDBACK
private:
MTouchFeedback* iFeedback;
@@ -84,11 +92,21 @@
private:
void SetTextColors();
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ /**
+ * Fuction calculates index of element, which is the first
+ * visible element in ChoiceGroup from top of Form.
+ */
+ void UpdateTopVisibleItemIndex();
+#endif // RD_JAVA_S60_RELEASE_9_2
+
private:
CMIDChoiceGroupControl* iChoiceControl;
#ifdef RD_JAVA_S60_RELEASE_9_2
TBool iUpEventSent;
+ TBool iHighlight;
+ TInt iTopVisibleItemIndex;
#endif // RD_JAVA_S60_RELEASE_9_2
};
--- a/javauis/lcdui_akn/lcdui/inc/CMIDCommandList.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDCommandList.h Tue May 11 16:07:20 2010 +0300
@@ -44,9 +44,11 @@
void Remove(MMIDCommand* aCommand);
TInt FindCommandIndex(MMIDCommand* aCommand);
- TInt HighestNonMappedPriorityCommand(MMIDCommand::TCommandType aType) const;
+ TInt HighestNonMappedPriorityCommand(MMIDCommand::TCommandType aType,
+ TBool aIgnoreForImplicitList = EFalse) const;
TInt HighestPriorityCommand(MMIDCommand::TCommandType aType) const;
- TInt FindCommandForSoftKey(const CMIDSoftKey& aSoftKey) const;
+ TInt FindCommandForSoftKey(const CMIDSoftKey& aSoftKey,
+ TBool aIgnoreForImplicitList = EFalse) const;
void UnMapCommands();
TInt Count() const;
--- a/javauis/lcdui_akn/lcdui/inc/CMIDDisplayable.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDDisplayable.h Tue May 11 16:07:20 2010 +0300
@@ -428,7 +428,6 @@
void RenewFullscreenCanvasLabelCacheL();
-#ifdef RD_JAVA_NGA_ENABLED
/**
* In case content is Canvas, notifies it about changed
* foreground status.
@@ -438,7 +437,6 @@
* @since S60 9.2
*/
void HandleCanvasForeground(TBool aForeground);
-#endif // RD_JAVA_NGA_ENABLED
void HideIndicator(CEikStatusPane* aSp, TInt aId);
void HideIndicators();
--- a/javauis/lcdui_akn/lcdui/inc/CMIDEdwin.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDEdwin.h Tue May 11 16:07:20 2010 +0300
@@ -137,7 +137,7 @@
void ConstructL(const TDesC& aText,TInt aMaxSize);
protected:
- virtual void AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray) = 0;
+ virtual void AddCommandToEdwinL(MMIDCommand& aCommand) = 0;
private:
@@ -146,10 +146,10 @@
void SetFEPModeAndCharFormat();
virtual void CreateNonMidletCommandsL();
- void AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResId, TInt aCommandId);
- void AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResIdShort, TInt aCommandResIdLong, TInt aCommandId);
+ void AddCommandToEdwinL(TInt aCommandResId, TInt aCommandId);
+ void AddCommandToEdwinL(TInt aCommandResIdShort,
+ TInt aCommandResIdLong,
+ TInt aCommandId);
void RemoveNonMidletCommands();
/*
--- a/javauis/lcdui_akn/lcdui/inc/CMIDForm.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDForm.h Tue May 11 16:07:20 2010 +0300
@@ -498,12 +498,13 @@
*/
void DoFeedbackOnFocusChange(CMIDControlItem& aControlItem);
+private:
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
/**
- * Fuction does feedback when dragging/flicking the form content.
+ * Function for feedback on kinetic scrolling .
*/
- void DoFeedbackOnDraggingUp();
- void DoFeedbackOnDraggingDown();
+ void UpdateTactileFeedbackDensity();
+ void DoScrollingFeedback();
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
private: //data
@@ -579,6 +580,15 @@
* The startup trace should be done only once.
*/
mutable TBool iStartUpTraceDone;
+
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ /**
+ * Kinetic scrolling tactile feedback
+ */
+ TInt iLastTactileFeedbackPos;
+ TInt iTactileFeedbackDensity;
+ TInt iLastPointerEventType;
+#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
};
inline void CMIDForm::Dispose()
--- a/javauis/lcdui_akn/lcdui/inc/CMIDGaugeItem.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDGaugeItem.h Tue May 11 16:07:20 2010 +0300
@@ -116,7 +116,7 @@
* from the foreground.
* @note Animation of non-interactive gauges is started/stopped.
*/
- void HandleForegroundL(TBool aForeground);
+ virtual void HandleForegroundL(TBool aForeground);
protected:
/**
@@ -130,13 +130,8 @@
void BaseConstructL(const TDesC& aLabel,TInt aMaxValue,
TInt aInitialValue);
- void SetStateL(TInt aMaxValue,TInt aValue);
-
- void DisposeTimer();
void FocusChanged(TDrawNow aDrawNow);
- virtual void DoSafeDraw() = 0;
-
void CreateBitmapsIfNeededL();
/**
@@ -226,10 +221,6 @@
/** An array of SVG bitmaps stored in the TLS so that it can be shared amongst gauge items*/
TGaugeFrameData* iGaugeFrameData;
- CGaugeTimer* iTimer;
-
- TBool iIsInForeground; // is application in foreground?
-
friend class CGaugeTimer;
};
@@ -275,6 +266,14 @@
//
// From CMIDControlItem
//
+ /**
+ * Handles event when application switches to/from the foreground.
+ *
+ * @param aForeground ETrue to switch to the foreground. EFalse to switch
+ * from the foreground.
+ * @note Animation of non-interactive gauges is started/stopped.
+ */
+ void HandleForegroundL(TBool aForeground);
void ResolutionChange(TInt aType);
/**
@@ -295,6 +294,7 @@
void ColorChange(TInt aType);
void SetGaugeListenerFromAlert(MMIDGaugeToAlertListner* aGaugeToAlertListner);
+
private:
/**
* Ctor
@@ -314,6 +314,12 @@
void UpdateMemberVariables();
/**
+ * Creats new instance of CAknBitmapAnimation for Gauge animation
+ * and sets it to iBitmapAnimation
+ */
+ void CreateNewBitmapAnimationIfNeededL();
+
+ /**
* setting of size of iBitmapAnimation
*/
void SetAnimationSize();
@@ -330,6 +336,28 @@
void ColorChangeL(TInt aType);
+ void DisposeTimer();
+
+ /**
+ * From CMIDGaugeItem.
+ * Starts animation timer (see iTimer) when needed.
+ * In case that timer is not needed, but has been created,
+ * it's disposed by this method.
+ *
+ * @since S60 v5.0
+ */
+ void InstallGaugeTimerWhenNeededL();
+
+ /**
+ * Indicates that the current skin contains the animation and
+ * the animation has been instantiated to iBitmapAnimation.
+ *
+ * @return ETrue iBitmapAnimation has been created
+ * and the animation is useful.
+ * @since S60 v5.0
+ */
+ TBool BitmapAnimationUsed() const;
+
private:
CEikProgressInfo* iProgressInfo;
MMIDGaugeToAlertListner* iGaugeToAlertListner;
@@ -342,6 +370,9 @@
// Note that label height has to be added to the y coordinate
TPoint iProgressInfoWithLabelHeightTl; // Top left point of the progress info
CAknBitmapAnimation* iBitmapAnimation; // Animation for animated Gauge
+ CGaugeTimer* iTimer;
+ // Indicates that the application is in foreground
+ TBool iIsInForeground;
};
NONSHARABLE_CLASS(CMIDInteractiveGauge) : public CMIDGaugeItem
@@ -410,6 +441,7 @@
TBool iPhysicsScrollingTriggered;
};
+
#endif // CMIDGAUGEITEM_H
// End of File
--- a/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxEdwin.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxEdwin.h Tue May 11 16:07:20 2010 +0300
@@ -64,7 +64,7 @@
* @param aLayout multi line layout info
*/
virtual void DoLayout(const TRect& aRect);
- void AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray);
+ void AddCommandToEdwinL(MMIDCommand& aCommand);
private: // Constructors
/**
--- a/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxQueryDialog.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextBoxQueryDialog.h Tue May 11 16:07:20 2010 +0300
@@ -285,12 +285,12 @@
TPtrC Read() const;
void CreateNonMidletCommandsL();
- void AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResIdShort, TInt aCommandResIdLong, TInt aCommandId);
- void AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResId, TInt aCommandId);
+ void AddCommandToEdwinL(TInt aCommandResIdShort,
+ TInt aCommandResIdLong,
+ TInt aCommandId);
+ void AddCommandToEdwinL(TInt aCommandResId, TInt aCommandId);
void RemoveNonMidletCommands();
- void AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray);
+ void AddCommandToEdwinL(MMIDCommand& aCommand);
void CreatePhoneCallL();
void CreatePasswordTextL();
--- a/javauis/lcdui_akn/lcdui/inc/CMIDTextEditorEdwinCustomDraw.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextEditorEdwinCustomDraw.h Tue May 11 16:07:20 2010 +0300
@@ -58,7 +58,7 @@
*/
virtual ~CMIDTextEditorEdwinCustomDraw();
-public: // From
+public: // From CLafEdwinCustomDrawBase
/**
* Called by the editor FW in order to draw the background for
@@ -112,7 +112,35 @@
const TDesC& aText,
const TPoint& aTextOrigin,
TInt aExtraPixels) const;
-
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ /**
+ * Called by the editor FW in order to draw the the content of
+ * the editor.
+ *
+ * Currently delegates the drawing to the parent custom drawer.
+ *
+ * @param aParam Drawing parameters.
+ * @param aLineInfo The line information.
+ * @param aFormat The current character format.
+ * @param aText The content to draw.
+ * @param aStart
+ * @param aEnd
+ * @param aTextOrigin The origin of the text.
+ * @param aExtraPixels The amount of extra pixels.
+ * @since S60 5.0
+ */
+ void DrawText(
+ const TParam& aParam,
+ const TLineInfo& aLineInfo,
+ const TCharFormat& aFormat,
+ const TDesC& aText,
+ const TInt aStart,
+ const TInt aEnd,
+ const TPoint& aTextOrigin,
+ TInt aExtraPixels) const;
+#endif
+
/**
* Retrieves the system color for the specified color index.
*
@@ -120,7 +148,7 @@
* @param aDefaultColor The default color for the specified index.
* @return The system's (or custom) color for the specified color
* index.
- * @since S60 5.0
+ * @since S60 5.0
*/
TRgb SystemColor(
TUint aColorIndex,
--- a/javauis/lcdui_akn/lcdui/inc/CMIDTextFieldEdwin.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDTextFieldEdwin.h Tue May 11 16:07:20 2010 +0300
@@ -56,7 +56,7 @@
void PositionChanged();
protected: // from CMIDEdwin
- void AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray);
+ void AddCommandToEdwinL(MMIDCommand& aCommand);
private: // Constructors
/**
--- a/javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp Tue May 11 16:07:20 2010 +0300
@@ -119,7 +119,6 @@
#define KZeroSize TSize()
-
// ---------------------------------------------------------------------------
// TBitBltData
// BitBlt buffer data datatype.
@@ -776,7 +775,7 @@
#ifdef RD_TACTILE_FEEDBACK
// ---------------------------------------------------------------------------
-// From MMIDCancas.
+// From MMIDCanvas.
// CMIDCanvas::TactileFeedbackComponent
// Retutrns this as tactile feedback component.
// ---------------------------------------------------------------------------
@@ -787,6 +786,16 @@
}
#endif // RD_TACTILE_FEEDBACK
+
+// ---------------------------------------------------------------------------
+// From class MMIDCanvas.
+// ---------------------------------------------------------------------------
+//
+TBool CMIDCanvas::ReadyToBlit() const
+{
+ return iFirstPaintState != EFirstPaintNeverOccurred;
+}
+
#ifdef RD_JAVA_NGA_ENABLED
// ---------------------------------------------------------------------------
@@ -841,20 +850,25 @@
break;
case EDrwOpcBitBltRect:
{
+ if (iFirstPaintState == EFirstPaintNeverOccurred)
+ {
+ iFirstPaintState = EFirstPaintInitiated;
+ }
+
const TBitBltData& data = BitBltData(aRead);
UpdateL(data.iRect);
}
break;
case EDrwOpcBitBlt:
{
+ if (iFirstPaintState == EFirstPaintNeverOccurred)
+ {
+ iFirstPaintState = EFirstPaintInitiated;
+ }
+
UpdateL(iViewRect);
}
break;
- case EDrwOpcFirstPaint:
- {
- java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
- }
- break;
default:
User::Leave(KErrNotSupported);
break;
@@ -941,11 +955,6 @@
Update(rect);
}
break;
- case EDrwOpcFirstPaint:
- {
- java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
- }
- break;
default:
User::Leave(KErrNotSupported);
break;
@@ -954,9 +963,26 @@
aRead += aRead->Size();
}
#endif // CANVAS_DOUBLE_BUFFER
-
+
+ if (iFirstPaintState == EFirstPaintNeverOccurred)
+ {
+ if (iForeground)
+ {
+ // The canvas is current, therefore we can flush
+ // the graphics and take the start screen snapshot.
+ iFirstPaintState = EFirstPaintOccurred;
+ java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
+ }
+ else
+ {
+ // The window is not visible, the start screen snapshot
+ // will be taken when the canvas will be set current.
+ iFirstPaintState = EFirstPaintInitiated;
+ }
+ }
+
DEBUG("- CMIDCanvas::ProcessL");
-
+
return EFalse;
}
#endif // RD_JAVA_NGA_ENABLED
@@ -1699,7 +1725,14 @@
ELOG1(EJavaUI, "eglSwapBuffers() failed, eglError=%d", eglGetError());
ASSERT(EFalse);
}
+
SetCurrentEglType(EEglNone);
+
+ if (iFirstPaintState != EFirstPaintOccurred)
+ {
+ iFirstPaintState = EFirstPaintOccurred;
+ java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
+ }
}
}
#endif // RD_JAVA_NGA_ENABLED
@@ -2160,6 +2193,7 @@
}
if (!consumed && (iFocusedComponent != KComponentFocusedNone) &&
+ (iFocusedComponent < iCustomComponents.Count()) &&
(iCustomComponents[iFocusedComponent]->IsTouchEnabled()))
{
consumed = HandlePointerEventInControlsL(aPointerEvent);
@@ -2359,6 +2393,12 @@
CustomComponentControl(KComponentMainControl)->
SetFocus(EFalse);
}
+
+#ifdef RD_JAVA_NGA_ENABLED
+ // Avoid the situation when the content is drawn over the menu
+ SuspendPixelSource();
+#endif // RD_JAVA_NGA_ENABLED
+
// Repaint to ensure that fading will be displayed correctly for Alert
// or PopupTextBox when DSA is paused.
DrawDeferred();
@@ -2762,8 +2802,8 @@
iPointerEventSuppressor->SetMaxTapMove(TSize(pointerMovementInPixels,
pointerMovementInPixels));
+ iForeground = EFalse;
#ifdef RD_JAVA_NGA_ENABLED
- iForeground = EFalse;
iEglDisplay = EGL_NO_DISPLAY;
iEglWindowSurface = EGL_NO_SURFACE;
iEglWindowSurfaceContext = EGL_NO_CONTEXT;
@@ -3358,8 +3398,6 @@
return enabled;
}
-#ifdef RD_JAVA_NGA_ENABLED
-
// ---------------------------------------------------------------------------
// CMIDCanvas::HandleForeground
// Relases resources in graphics HW (=pixel source or EGL resources)
@@ -3369,8 +3407,10 @@
void CMIDCanvas::HandleForeground(TBool aForeground)
{
DEBUG_INT("CMIDCanvas::HandleForeground(%d) ++", aForeground);
+
iForeground = aForeground;
+#ifdef RD_JAVA_NGA_ENABLED
if (!iForeground)
{
if (IsEglAvailable())
@@ -3388,9 +3428,13 @@
SuspendPixelSource();
}
+#endif // RD_JAVA_NGA_ENABLED
+
DEBUG("CMIDCanvas::HandleForeground --");
}
+#ifdef RD_JAVA_NGA_ENABLED
+
// ---------------------------------------------------------------------------
// CMIDCanvas::InitPixelSourceL()
// ---------------------------------------------------------------------------
@@ -3467,8 +3511,16 @@
return;
}
- iAlfCompositionPixelSource->ActivateSyncL();
+ // ProduceNewFrameL() is called in some cases
+ // directly from ActivateSyncL(), need to set iFrameReady
+ // before ActivateSyncL()
iFrameReady = ETrue;
+ TRAPD(err, iAlfCompositionPixelSource->ActivateSyncL());
+ if (err != KErrNone)
+ {
+ iFrameReady = EFalse;
+ User::Leave(err);
+ }
if (iPixelSourceSuspended)
{
@@ -3527,34 +3579,53 @@
// If iDirectContents.Count() > 0, canvas hasn't received
// MdcNotifyContentAdded in LCDUI thread yet.
+ TBool res;
if (!iFrameReady || iDirectContents.Count() > 0)
{
DEBUG("CMIDCanvas::ProduceNewFrameL - FRAME IS NOT READY --");
NotifyMonitor();
- return EFalse;
+ res = EFalse;
}
-
- NotifyMonitor();
-
- TUint8* from = (TUint8*)iFrameBuffer->DataAddress();
-
- TBool downScaling = IsDownScaling(iContentSize, iViewRect);
- TInt width = downScaling ? iViewRect.Width() : iContentSize.iWidth;
- TInt height = downScaling ? iViewRect.Height() : iContentSize.iHeight;
-
- TUint bytes = width * KBytesPerPixel;
- TInt scanLength = CFbsBitmap::ScanLineLength(
- iFrameBuffer->SizeInPixels().iWidth, iFrameBuffer->DisplayMode());
-
- for (TInt y = 0; y < height; ++y)
+ else
{
- Mem::Copy(aBuffer, from, bytes);
- aBuffer += iAlfBufferAttributes.iStride;
- from += scanLength;
+ NotifyMonitor();
+
+ TUint8* from = (TUint8*)iFrameBuffer->DataAddress();
+
+ TBool downScaling = IsDownScaling(iContentSize, iViewRect);
+ TInt width = downScaling ? iViewRect.Width() : iContentSize.iWidth;
+ TInt height = downScaling ? iViewRect.Height() : iContentSize.iHeight;
+
+ TUint bytes = width * KBytesPerPixel;
+ TInt scanLength = CFbsBitmap::ScanLineLength(
+ iFrameBuffer->SizeInPixels().iWidth, iFrameBuffer->DisplayMode());
+
+ for (TInt y = 0; y < height; ++y)
+ {
+ Mem::Copy(aBuffer, from, bytes);
+ aBuffer += iAlfBufferAttributes.iStride;
+ from += scanLength;
+ }
+
+ res = ETrue;
}
-
+
+ if (iFirstPaintState == EFirstPaintInitiated || iFirstPaintState == EFirstPaintPrepared)
+ {
+ if (iFirstPaintState == EFirstPaintInitiated)
+ {
+ iFirstPaintState = EFirstPaintPrepared;
+ }
+ else
+ {
+ iFirstPaintState = EFirstPaintOccurred;
+ java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
+ }
+ }
+
DEBUG("CMIDCanvas::ProduceNewFrameL --");
- return ETrue;
+
+ return res;
}
// ---------------------------------------------------------------------------
@@ -4710,11 +4781,11 @@
glLoadIdentity();
// position texture screen coordinates
- pos[0] = (GLshort)iViewRect.iTl.iX;
+ pos[0] = (GLshort)iViewRect.iTl.iX - iPositionRelativeToScreen.iX;
pos[1] = (GLshort)iViewRect.Height() + (height - iViewRect.iBr.iY);
pos[2] = pos[0];
pos[3] = (GLshort)height - iViewRect.iBr.iY;
- pos[4] = (GLshort)iViewRect.iBr.iX;
+ pos[4] = (GLshort)iViewRect.iBr.iX - iPositionRelativeToScreen.iX;
pos[5] = pos[1];
pos[6] = pos[4];
pos[7] = pos[3];
--- a/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupControl.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupControl.cpp Tue May 11 16:07:20 2010 +0300
@@ -1254,8 +1254,24 @@
return;
}
+ TInt currentItem = KErrNotFound;
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // First check if top visible item was set (only in case that
+ // ChoiceGroup was panned and now it is partially visible and
+ // got highlight by starting HW keys interaction).
+ // If item was set, do not scroll at all.
+ currentItem = iListBox->TopVisibleItemIndex();
+ if (currentItem == KErrNotFound)
+ {
+ // Top visible item was not set, i.e. ChoiceGroup already
+ // have highlight or it is fully visible or it is fully invisible.
+ currentItem = iListBox->CurrentItemIndex();
+ }
+#else
+ currentItem = iListBox->CurrentItemIndex();
+#endif // RD_JAVA_S60_RELEASE_9_2
+
// Calculate current listbox item rect
- TInt currentItem = iListBox->CurrentItemIndex();
TRect lbitemRect = TRect(
iListBox->View()->ItemPos(currentItem),
iListBox->View()->ItemSize(currentItem));
--- a/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupListBox.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDChoiceGroupListBox.cpp Tue May 11 16:07:20 2010 +0300
@@ -42,7 +42,12 @@
CMIDChoiceGroupListBox::CMIDChoiceGroupListBox(CMIDChoiceGroupControl* aChoiceControl)
- : CAknColumnListBox(), iChoiceControl(aChoiceControl)
+ : CAknColumnListBox()
+ , iChoiceControl(aChoiceControl)
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ , iHighlight(EFalse)
+ , iTopVisibleItemIndex(KErrNotFound)
+#endif // RD_JAVA_S60_RELEASE_9_2
{
ASSERT(iChoiceControl);
}
@@ -109,20 +114,65 @@
// First save the currently selected item
TInt oldCurrent = iView->CurrentItemIndex();
- // Let the listbox handle the key
- TKeyResponse resp =
- CAknColumnListBox::OfferKeyEventL(aKeyEvent, aType);
+ TKeyResponse resp = EKeyWasNotConsumed;
- // If the key was up or down, and the current item did not change,
- // we were apparently already on the first or last item.
- // Return EKeyWasNotConsumed so that the form knows to transfer focus
- // BUT ONLY if not used in a popup (otherwise the form will get it and
- // move focus under the popup)
+#ifdef RD_JAVA_S60_RELEASE_9_2
if (iChoiceControl->ChoiceType() != MMIDChoiceGroup::EPopup)
{
+ if (aType != EEventKey || iHighlight)
+ {
+ // Do not pass the EEventKey to ListBox in case of first
+ // HW key action after highlight was disabled.
+ resp = CAknColumnListBox::OfferKeyEventL(aKeyEvent, aType);
+ }
+ else
+ {
+ // This is first HW key action after highlight was disabled:
+ // highlight should be enabled
+ UpdateTopVisibleItemIndex();
+ if (iTopVisibleItemIndex > KErrNotFound)
+ {
+ // First top visible element should be highlighted
+ iView->SetCurrentItemIndex(iTopVisibleItemIndex);
+ // Item drawer must know, that highlight should be enabled
+ // from now.
+ CColumnListBoxItemDrawer* drawer = ItemDrawer();
+ if (drawer)
+ {
+ drawer->ClearFlags(
+ CListItemDrawer::ESingleClickDisabledHighlight);
+ }
+ // Report, that current highlighted element changed
+ ReportEventL(MCoeControlObserver::EEventStateChanged);
+ resp = EKeyWasConsumed;
+ DrawNow();
+ iTopVisibleItemIndex = KErrNotFound;
+ }
+ // Enable highlight flag for this ChoiceGroup, even if top visible
+ // element wasn't found (ChoiceGroup is now fully invisible).
+ iHighlight = ETrue;
+ }
+ }
+ else
+ {
+ // For popup ChoiceGroup, handle key events in usual way
+ resp = CAknColumnListBox::OfferKeyEventL(aKeyEvent, aType);
+ }
+#else
+ // Let the ListBox handle the key
+ resp = CAknColumnListBox::OfferKeyEventL(aKeyEvent, aType);
+#endif // RD_JAVA_S60_RELEASE_9_2
+
+ if (iChoiceControl->ChoiceType() != MMIDChoiceGroup::EPopup)
+ {
+ // If the key was up or down, and the current item did not change,
+ // we were apparently already on the first or last item.
+ // Return EKeyWasNotConsumed so that the form knows to transfer focus
+ // BUT ONLY if not used in a popup (otherwise the form will get it and
+ // move focus under the popup)
TInt newCurrent = iView->CurrentItemIndex();
TBool change = oldCurrent != newCurrent;
- TInt lastItemIdx = -1;
+ TInt lastItemIdx = KErrNotFound;
if (iModel)
{
lastItemIdx = iModel->NumberOfItems() - 1;
@@ -349,6 +399,8 @@
if (aPointerEvent.iType == TPointerEvent::EButton1Down)
{
iUpEventSent = EFalse;
+ iHighlight = EFalse;
+ UpdateTopVisibleItemIndex();
}
#endif // RD_JAVA_S60_RELEASE_9_2
@@ -417,3 +469,65 @@
}
}
#endif
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+/**
+ * Returns index of ChoiceGroup element, which is the first
+ * visible element in ChoiceGroup from top of Form.
+ * Used in CMIDChoiceGroupControl, which needs to know
+ * current element for possible scrolling
+ * (@see CMIDChoiceGroupControl::RequestScrollIfNeededL()).
+ */
+TInt CMIDChoiceGroupListBox::TopVisibleItemIndex()
+{
+ return iTopVisibleItemIndex;
+}
+
+/**
+ * Fuction calculates index of element, which is the first
+ * visible element in ChoiceGroup from top of Form.
+ */
+void CMIDChoiceGroupListBox::UpdateTopVisibleItemIndex()
+{
+ if (!iHighlight)
+ {
+ // There is touch interaction, so we need index for element,
+ // which will be highlighted, when user starts using HW keys
+ if (iPosition.iY < 0)
+ {
+ // ChoiceGroup is now partially visible and its top edge is
+ // above the Form top edge.
+
+ // Calculate index of first (partially) visible element
+ iTopVisibleItemIndex = Abs(iPosition.iY) / iView->ItemHeight();
+ TRect lbitemRect = TRect(
+ iView->ItemPos(iTopVisibleItemIndex),
+ iView->ItemSize(iTopVisibleItemIndex));
+ if (lbitemRect.iTl.iY < 0)
+ {
+ // Item is really partially visible.
+ // Because we don't want index of partially visible item,
+ // move index to next item
+ iTopVisibleItemIndex++;
+ }
+ if (iTopVisibleItemIndex >= iModel->NumberOfItems())
+ {
+ // ChoiceGroup is fully invisible (whole rect is above
+ // the Form top edge): no element is visible now
+ iTopVisibleItemIndex = KErrNotFound;
+ }
+ }
+ else
+ {
+ // Top item idge is lower than top edge of Form - is visible
+ iTopVisibleItemIndex = 0;
+ }
+ }
+ else
+ {
+ // In case of HW keys interaction, there is no highlight,
+ // so we don't need highlight any element
+ iTopVisibleItemIndex = KErrNotFound;
+ }
+}
+#endif // RD_JAVA_S60_RELEASE_9_2
--- a/javauis/lcdui_akn/lcdui/src/CMIDCommandList.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDCommandList.cpp Tue May 11 16:07:20 2010 +0300
@@ -132,13 +132,20 @@
of a particular type that we find will be the highest priority
command of that type.
*/
-TInt CMIDCommandList::HighestNonMappedPriorityCommand(MMIDCommand::TCommandType aType) const
+TInt CMIDCommandList::HighestNonMappedPriorityCommand(
+ MMIDCommand::TCommandType aType, TBool aIgnoreForImplicitList) const
{
TInt numCommands = Count();
for (TInt i = 0; i < numCommands; i++)
{
CMIDCommand* cmd = At(i).iCommand;
- if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey())
+ // In case of IMPLICIT List without highlight, nor OK
+ // neither ITEM commands are mapped to soft keys.
+ TBool ignore = aIgnoreForImplicitList
+ && (cmd->CommandType() == MMIDCommand::EOk
+ || cmd->CommandType() == MMIDCommand::EItem);
+ if ((cmd->CommandType() == aType) && !cmd->IsMappedToSoftKey()
+ && !ignore)
{
return i;
}
@@ -151,12 +158,14 @@
Given a softkey, return the index of the highest priority command
that is allowed for this softkey.
*/
-TInt CMIDCommandList::FindCommandForSoftKey(const CMIDSoftKey& aSoftKey) const
+TInt CMIDCommandList::FindCommandForSoftKey(const CMIDSoftKey& aSoftKey,
+ TBool aIgnoreForImplicitList) const
{
TInt numTypes = aSoftKey.AllowedCommandTypes().Count();
for (TInt i = 0; i < numTypes; i++)
{
- TInt index = HighestNonMappedPriorityCommand(aSoftKey.AllowedCommandTypes()[i]);
+ TInt index = HighestNonMappedPriorityCommand(
+ aSoftKey.AllowedCommandTypes()[i], aIgnoreForImplicitList);
if (index != KErrNotFound)
{
return index;
--- a/javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp Tue May 11 16:07:20 2010 +0300
@@ -986,9 +986,7 @@
form->HandleForegroundL(aForeground);
}
-#ifdef RD_JAVA_NGA_ENABLED
- HandleCanvasForeground(aForeground);
-#endif // RD_JAVA_NGA_ENABLED
+ HandleCanvasForeground(aForeground);
if (aForeground)
{
@@ -1236,13 +1234,15 @@
{
canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(10).LayoutLine());
}
- else //default mode:Softkeys bottom
+ else
{
- resultRect = TRect(80,0,560,360);//temp code here.LAF correction needed!
- //canvasRect.LayoutRect( resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(9).LayoutLine() );
-
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ canvasRect.LayoutRect( resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(9).LayoutLine() );
+#else
+ resultRect = TRect(80,0,560,360); // Layout data not defined in older releases.
DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
- return resultRect; //Temp code here.LAF correction needed!
+ return resultRect;
+#endif // RD_JAVA_S60_RELEASE_9_2
}
}
}
@@ -1368,9 +1368,7 @@
iActive = aCurrent;
const TType type = iContent->Type();
-#ifdef RD_JAVA_NGA_ENABLED
HandleCanvasForeground(aCurrent);
-#endif // RD_JAVA_NGA_ENABLED
if (aCurrent)
{
@@ -1585,13 +1583,22 @@
CEikStatusPane* pane = iAppUi->StatusPane();
pane->MakeVisible(!iIsFullScreenMode);
- java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi();
+ java::ui::CoreUiAvkonAppUi* appUi =
+ java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi();
if (!iIsFullScreenMode && appUi && appUi->hidesIndicators())
{
HideIndicators();
}
- iCba->MakeVisible(!iIsFullScreenMode);
+ if (iCba)
+ {
+ iCba->MakeVisible(!iIsFullScreenMode);
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // To enable clock pane in landscape after MIDlet was started
+ iCba->SetBoundingRect(TRect(0, 0, 0, 0));
+#endif // RD_JAVA_S60_RELEASE_9_2
+ }
// Close fixed toolbar for full screen Canvas.
CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
@@ -1601,7 +1608,9 @@
}
#ifdef RD_SCALABLE_UI_V2
- if ((iActive && iCanvasKeypad) || (!iActive && this->DrawableWindow()->IsFaded() && iCanvasKeypad))
+ if ((iActive && iCanvasKeypad)
+ || (!iActive && this->DrawableWindow()->IsFaded()
+ && iCanvasKeypad))
{
if (iUseOnScreenKeypad)
{
@@ -2213,6 +2222,21 @@
TInt numSoftKeys = iSoftKeys.Count();
ResetSoftKeysAndCommands(lists);
+ // Variable implicitList is used when mapping commands to soft keys
+ // In case of IMPLICIT List with only OK or ITEM commands,
+ // no command is mapped to soft key and these commands are not
+ // populated to Options menu
+ TBool implicitList = EFalse;
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ if (iContent && iContent->Type() == EList && iContentControl)
+ {
+ CMIDList* list = static_cast<CMIDList*>(iContentControl);
+ // Important: Set to ETrue only if List is IMPLICIT and there is no highlight
+ implicitList = (list->ListChoiceType() == MMIDChoiceGroup::EImplicit) &&
+ !list->IsHighlighted();
+ }
+#endif // RD_JAVA_S60_RELEASE_9_2
+
// First map one command to every softkey if possible,
// sks must have been ordered correctly, ie right key before
// left key or else left key might get BACK cmd if not other
@@ -2223,7 +2247,7 @@
{
if (lists[j])
{
- TInt index = lists[j]->FindCommandForSoftKey(*iSoftKeys[i]);
+ TInt index = lists[j]->FindCommandForSoftKey(*iSoftKeys[i], implicitList);
if (index != KErrNotFound)
{
TInt commandId = lists[j]->CommandOffset() + index;
@@ -2240,14 +2264,26 @@
// Then for the sk that can potentially accept an options menu,
// see if the mapped command must be replaced by the options menu
// when there is at least one command that has not been mapped to any sk.
+ // Important: Do not set Options menu in case of IMPLICIT List
+ // with only OK or ITEM commands
TBool needToDisplayMenu = EFalse;
for (TInt j = 0; j < numLists && !needToDisplayMenu; j++)
{
if (lists[j])
{
+ // Looping trough all commands
for (TInt i = 0; i < lists[j]->Count() && !needToDisplayMenu; i++)
{
- needToDisplayMenu = !CommandIsMappedToSk(lists[j]->At(i).iCommand);
+ CMIDCommand* cmd = lists[j]->At(i).iCommand;
+ // In case that displayable is IMPLICIT List, we need to know,
+ // if it has only OK or ITEM commands
+ if (!(implicitList && (cmd->CommandType() == MMIDCommand::EOk ||
+ cmd->CommandType() == MMIDCommand::EItem)))
+ {
+ // There is at least one command, which is not mapped yet,
+ // so it will be populated to Options menu.
+ needToDisplayMenu = !CommandIsMappedToSk(cmd);
+ }
}
}
}
@@ -3082,7 +3118,6 @@
DEBUG("- CMIDDisplayable::RenewFullscreenCanvasLabelCacheL");
}
-#ifdef RD_JAVA_NGA_ENABLED
void CMIDDisplayable::HandleCanvasForeground(TBool aForeground)
{
if (iContent && iContentControl &&
@@ -3093,7 +3128,6 @@
canvas->HandleForeground(aForeground);
}
}
-#endif // RD_JAVA_NGA_ENABLED
void CMIDDisplayable::HandleApplicationBackground()
{
@@ -3104,9 +3138,7 @@
iCanvasKeypad->HandleApplicationBackground();
}
-#ifdef RD_JAVA_NGA_ENABLED
- HandleCanvasForeground(EFalse);
-#endif // RD_JAVA_NGA_ENABLED
+ HandleCanvasForeground(EFalse);
}
void CMIDDisplayable::ProcessMSKCommandL()
--- a/javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDEdwin.cpp Tue May 11 16:07:20 2010 +0300
@@ -1189,35 +1189,30 @@
to either the displayable or to the item. Commands will be processed in ProcessCommandL(). */
void CMIDEdwin::CreateNonMidletCommandsL()
{
- RPointerArray<MMIDCommand> array;
- CleanupClosePushL(array);
-
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EPhoneNumber) && !(iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_PB_FETCH_NUMBER_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_NUMBER_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchPhoneNumber);
- AddCommandToArrayL(array, R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
+ AddCommandToEdwinL(R_MIDP_PB_FETCH_NUMBER_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_NUMBER_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchPhoneNumber);
+ AddCommandToEdwinL(R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
}
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EPhoneNumber) && (iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
+ AddCommandToEdwinL(R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
}
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EMailAddr) && !(iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_PB_FETCH_EMAIL_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_EMAIL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchEmailAddress);
+ AddCommandToEdwinL(R_MIDP_PB_FETCH_EMAIL_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_EMAIL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchEmailAddress);
}
- AddCommandsToEdwinL(array);
-
- CleanupStack::PopAndDestroy(&array);
}
/**
-Creates and adds new command to array based on shot & long label resource ids
+Creates and adds new command to edwin based on shot & long label resource ids
and other parameters.
*/
-void CMIDEdwin::AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResIdShort, TInt aCommandResIdLong, TInt aCommandId)
+void CMIDEdwin::AddCommandToEdwinL(TInt aCommandResIdShort,
+ TInt aCommandResIdLong,
+ TInt aCommandId)
{
TBuf<64> shortLabel;
iEikonEnv->ReadResourceL(shortLabel, aCommandResIdShort);
@@ -1230,17 +1225,16 @@
STATIC_CAST(CMIDCommand*,cmd)->SetObserver(this);
- aArray.AppendL(cmd);
+ AddCommandToEdwinL(*cmd);
CleanupStack::Pop(cmd);
}
/**
-Creates and adds new command to array, short label is the same as long label.
+Creates and adds new command to edwin, short label is the same as long label.
*/
-void CMIDEdwin::AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResId, TInt aCommandId)
+void CMIDEdwin::AddCommandToEdwinL(TInt aCommandResId, TInt aCommandId)
{
- AddCommandToArrayL(aArray, aCommandResId, aCommandResId, aCommandId);
+ AddCommandToEdwinL(aCommandResId, aCommandResId, aCommandId);
}
/** This method is called from the destructor and removes
--- a/javauis/lcdui_akn/lcdui/src/CMIDForm.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDForm.cpp Tue May 11 16:07:20 2010 +0300
@@ -2328,7 +2328,11 @@
#ifdef RD_TACTILE_FEEDBACK
iFeedback = MTouchFeedback::Instance();
-#endif
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ UpdateTactileFeedbackDensity();
+#endif // RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+#endif // RD_TACTILE_FEEDBACK
+
//index of pointed control is set to not active
iIndexPointedControl=-1;
@@ -3800,6 +3804,10 @@
}
UpdatePhysics();
+
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ UpdateTactileFeedbackDensity();
+#endif // RD_JAVA_ADVANCED_TACTILE_FEEDBACK
}
TBool CMIDForm::TryDetectLongTapL(const TPointerEvent &aPointerEvent)
@@ -4088,6 +4096,10 @@
void CMIDForm::HandlePhysicsPointerEventL(const TPointerEvent& aPointerEvent)
{
+#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+ iLastPointerEventType = aPointerEvent.iType;
+#endif
+
if (iPhysics && iPhysics->CanBeStopped())
{
switch (aPointerEvent.iType)
@@ -4161,7 +4173,10 @@
if (!iPreventPhysicsScrolling && iPointedControl && iPointedControl->iMMidItem &&
iPointedControl->iMMidItem->Type() == MMIDComponent::ETextField)
{
- if ((Abs(dragX) > iPhysics->DragThreshold()) && (Abs(dragY) < iPhysics->DragThreshold()))
+ // If physics scrolling is not ongoing (abs(dragY) < DragTreshold)
+ // then stop flicking and forward event to the item (iPreventPhysicsScrolling = ETrue).
+ if ((Abs(dragX) > iPhysics->DragThreshold()) && (Abs(dragY) < iPhysics->DragThreshold()
+ && !iPanningOngoing))
{
iPreventPhysicsScrolling = ETrue;
}
@@ -4172,8 +4187,9 @@
{
iPanningOngoing = ETrue;
iHighlightTimer->Cancel();
+ // Start panning from aPointerEvent.iPosition with iPhysics->DragThreshold() margin
+ iLastDragPosition = aPointerEvent.iPosition;
iPhysics->SetPanningPosition(iLastDragPosition - aPointerEvent.iPosition);
- iLastDragPosition = aPointerEvent.iPosition;
//Forward one drag event to the focused textField or Gauge when panning is triggered
if ((iFocused != KErrNotFound)
&& IsTextFieldItem(ControlItem(iFocused)))
@@ -4218,6 +4234,7 @@
{
ForwardPointerEventToItemL(aPointerEvent);
}
+
#endif // RD_JAVA_S60_RELEASE_9_2
break;
}
@@ -4225,24 +4242,22 @@
// EButton1Up
case TPointerEvent::EButton1Up:
{
- TPoint distance = iStartPosition - aPointerEvent.iPosition;
- if (Abs(distance.iY) > iPhysics->DragThreshold() && !iPreventPhysicsScrolling)
+ // If physics scrolling is ongoing then start flicking
+ // and forward event to the item.
+ if (iPanningOngoing && !iPreventPhysicsScrolling)
{
+ TPoint distance = iStartPosition - aPointerEvent.iPosition;
iFlickOngoing = iPhysics->StartFlick(distance, iStartTime);
- if (!iUpEventSent)
- {
- ForwardPointerEventToItemL(aPointerEvent);
- iUpEventSent = ETrue;
- }
}
- else
+
+ // If physics scrolling is not ongoing then only
+ // forward event to the item.
+ if (!iUpEventSent)
{
- if (!iUpEventSent)
- {
- ForwardPointerEventToItemL(aPointerEvent);
- iUpEventSent = ETrue;
- }
+ ForwardPointerEventToItemL(aPointerEvent);
+ iUpEventSent = ETrue;
}
+
iPanningOngoing = EFalse;
iCanDragFocus = EFalse;
break;
@@ -4290,21 +4305,6 @@
void CMIDForm::HandlePhysicsScroll(TInt aScroll, TBool aDrawNow, TUint /*aFlags*/)
{
-#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
- //Dragging/flicking of Form content should give tactile feedback.
- //This implementation is similar to native List: during dragging/flicking
- //feedback is given when new item appears ont top/bottom of Form
- //visible area.
- //
- //First we have to reset current visibility for all items in Form.
- TInt count = iItems.Count();
- for (TInt i=0; i<count; i++)
- {
- CMIDControlItem& ci = ControlItem(i);
- ci.SetVisibilityInForm(RectPartiallyVisible(ci.Rect()));
- }
-#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
-
iScroll = iScroll + aScroll;
if (aScroll)
{
@@ -4325,16 +4325,7 @@
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
//Tactile feedback on dragging/flicking.
- if (aScroll > 0)
- {
- //scrolling up (pointer dragged down)
- DoFeedbackOnDraggingUp();
- }
- if (aScroll < 0)
- {
- //scrolling down (pointer dragged up)
- DoFeedbackOnDraggingDown();
- }
+ DoScrollingFeedback();
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
}
@@ -4403,75 +4394,59 @@
}
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
-void CMIDForm::DoFeedbackOnDraggingUp()
+void CMIDForm::UpdateTactileFeedbackDensity()
{
- TInt count = iItems.Count();
- //If dragging/flicking reaches the first/last item in Form,
- //tactile feedback shouldn't be given. There should be only
- //'bounce' effect, when first/last item goes back to to/bottom
- //of screen. Flag firstOrLastItemReached determines this case.
- //NOTE: feedback for 'bounce' is implemented in CAknPhysics.
- TBool firstOrLastItemReached = EFalse;
- for (TInt i = 0; i < count; i++)
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect(TRect(), AknLayoutScalable_Avkon::
+ list_single_heading_pane(0).LayoutLine());
+ iTactileFeedbackDensity = layoutRect.Rect().Height();
+}
+
+void CMIDForm::DoScrollingFeedback()
+{
+ TRect formRect(Rect());
+ TInt topEdgePos = iScroll;
+ TInt bottomEdgePos = iScroll + HeightOfAllItems();
+ // Calculate distance between current Form content position
+ // and previous position, where last feedback happened.
+ TInt lastFeedbackDistanceY = Abs(iLastTactileFeedbackPos - iScroll);
+ TTouchLogicalFeedback feedbackType(ETouchFeedbackNone);
+ if (lastFeedbackDistanceY >= iTactileFeedbackDensity)
{
- //Try find first item from top, which changed its visibility
- CMIDControlItem& ci = ControlItem(i);
- CMIDControlItem& last = ControlItem(count-1);
- TBool visibility = RectPartiallyVisible(ci.Rect());
- //In case of 'bounce' effect, there shouldn't be any feedback
- //on dragging/flicking (as in native side):
- if (RectFullyVisible(last.Rect()))
- {
- firstOrLastItemReached = ETrue;
- }
- if (i == 0 && RectFullyVisible(ci.Rect()))
+ if ((topEdgePos < formRect.iTl.iY)
+ && (bottomEdgePos > formRect.iBr.iY))
{
- firstOrLastItemReached = ETrue;
- }
- if (ci.GetVisibilityInForm() != visibility)
- {
- //item changed its visibility form invisible to visible
- if (visibility && !firstOrLastItemReached)
- {
- //if there isn't 'bounce' effect, do feedback
- iFeedback->InstantFeedback(ETouchFeedbackSensitiveList);
- break;
- }
+ // If top (or bottom) edge of the content is outside
+ // of visible area of Form, do feedback every time.
+ feedbackType = ETouchFeedbackSensitiveList;
}
+ else if (iLastPointerEventType != TPointerEvent::EButton1Up)
+ {
+ // Begining or end of the content reached (i.e. top or bottom
+ // egde of the contont is now visible): feedback is given
+ // only if user do panning. No feedback, if touch release
+ // happened.
+ feedbackType = ETouchFeedbackSensitiveList;
+ }
+ // Store the position of the content.
+ iLastTactileFeedbackPos = iScroll;
}
-}
-
-void CMIDForm::DoFeedbackOnDraggingDown()
-{
- TInt count = iItems.Count();
- //If dragging/flicking reaches the first/last item in Form,
- //tactile feedback shouldn't be given. There should be only
- //'bounce' effect, when first/last item goes back to to/bottom
- //of screen. Flag firstOrLastItemReached determines this case.
- //NOTE: feedback for 'bounce' is implemented in CAknPhysics.
- TBool firstOrLastItemReached = EFalse;
- for (TInt i = count-1; i >= 0; i--)
+
+ if (iFeedback && feedbackType != ETouchFeedbackNone)
{
- CMIDControlItem& ci = ControlItem(i);
- CMIDControlItem& first = ControlItem(0);
- TBool visibility = RectPartiallyVisible(ci.Rect());
- if (RectFullyVisible(first.Rect()))
+ if (iLastPointerEventType != TPointerEvent::EButton1Up)
{
- firstOrLastItemReached = ETrue;
+ iFeedback->EnableFeedbackForControl(this, ETrue, ETrue);
}
- if (i == count-1 && RectFullyVisible(ci.Rect()))
+ else
{
- firstOrLastItemReached = ETrue;
+ // Disable audion feedback on flicking (i.e. user don't pan by
+ // touch input).
+ iFeedback->EnableFeedbackForControl(this, ETrue, EFalse);
}
- if (ci.GetVisibilityInForm() != visibility)
- {
- //item changed its visibility form invisible to visible
- if (visibility && !firstOrLastItemReached)
- {
- iFeedback->InstantFeedback(ETouchFeedbackSensitiveList);
- break;
- }
- }
+ // Do the feedback if needed.
+ iFeedback->InstantFeedback(this, feedbackType);
}
}
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
+
--- a/javauis/lcdui_akn/lcdui/src/CMIDGaugeItem.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDGaugeItem.cpp Tue May 11 16:07:20 2010 +0300
@@ -133,11 +133,9 @@
CMIDGaugeItem::CMIDGaugeItem(CMIDUIManager* aUIManager)
: CMIDControlItem(EDefault, aUIManager),
iIndefiniteState(EIncrementalIdle),
- iGaugeFrameData(NULL),
- iTimer(NULL)
+ iGaugeFrameData(NULL)
{
iMMidItem = this;
- iIsInForeground = ETrue;
}
CMIDGaugeItem::~CMIDGaugeItem()
@@ -175,7 +173,13 @@
iMaxValue = aMaxValue;
iValue = aInitialValue;
- SetStateL(aMaxValue,aInitialValue);
+ iIndefinite = (aMaxValue == EIndefinite) ? ETrue : EFalse;
+
+ if (iIndefinite)
+ {
+ iIndefiniteState = aInitialValue;
+ iValue = 0;
+ }
DEBUG("CMIDGaugeItem::BaseConstructL >");
}
@@ -698,7 +702,6 @@
}
}
-
void CMIDGaugeItem::ColorChange(TInt aType)
{
// call default implementation
@@ -720,62 +723,9 @@
}
}
-void CMIDGaugeItem::HandleForegroundL(TBool aForeground)
-{
- // synchronize foreground flag
- iIsInForeground = aForeground;
-
- // if continuous-running ni-gauge is in foreground and it's timer
- // is not created then create it else if gauge is in background
- // and if it is inserted in form then dispose it's timer
- if (iIsInForeground)
- {
- if ((iIndefiniteState == EContinuousRunning) && (!iTimer))
- {
- iTimer = CGaugeTimer::NewL(*this);
- iTimer->After(TTimeIntervalMicroSeconds32(KDelayInMicroSeconds));
- }
- }
- else if (iForm)
- {
- DisposeTimer();
- }
-}
-
-void CMIDGaugeItem::SetStateL(TInt aMaxValue,TInt aValue)
+void CMIDGaugeItem::HandleForegroundL(TBool /*aForeground*/)
{
- iIndefinite = (aMaxValue == EIndefinite) ? ETrue : EFalse;
-
- if (iIndefinite)
- {
- iIndefiniteState = aValue;
- iValue = 0;
- switch (aValue)
- {
- case EContinuousIdle:
- case EIncrementalIdle:
- DisposeTimer();
- break;
- case EContinuousRunning:
- if (!iTimer)
- {
- iTimer = CGaugeTimer::NewL(*this);
- iTimer->After(TTimeIntervalMicroSeconds32(KDelayInMicroSeconds));
- }
- break;
- case EIncrementalUpdating:
- DisposeTimer();
- break;
- default:
- ASSERT(EFalse);
- }
- }
- else
- {
- }
- //
- // We're now back in normal mode
- //
+ // Empty implementation. Inherited by CMIDNonInteractiveGauge.
}
#ifdef RD_SCALABLE_UI_V2
@@ -801,14 +751,6 @@
return (iCommandList->Count() > 0 || !IsNonFocusing());
}
-void CMIDGaugeItem::DisposeTimer()
-{
- if (iTimer)
- iTimer->Cancel();
- delete iTimer;
- iTimer = NULL;
-}
-
void CMIDGaugeItem::FocusChanged(TDrawNow aDrawNow)
{
CMIDControlItem::FocusChanged(aDrawNow);
@@ -894,7 +836,9 @@
//
CMIDNonInteractiveGauge::CMIDNonInteractiveGauge(CMIDUIManager* aUIManager)
: CMIDGaugeItem(aUIManager),
- iBitmapAnimation(NULL)
+ iBitmapAnimation(NULL),
+ iTimer(NULL),
+ iIsInForeground(ETrue)
{
SetFocusing(EFalse);
}
@@ -926,6 +870,30 @@
iWaitGaugeRect.Rect().iTl.iY - formRect.iTl.iY + ItemContentBottomMargin();
}
+
+// ---------------------------------------------------------------------------
+// CMIDNonInteractiveGauge::InstallGaugeTimerWhenNeededL
+// If continuous-running NonInteractiveGauge is in foreground,
+// appended to form, bitmap animation is not used and
+// animation timer is not created then create it.
+// In all other cases the timer is not needed and disposed.
+// ---------------------------------------------------------------------------
+//
+void CMIDNonInteractiveGauge::InstallGaugeTimerWhenNeededL()
+{
+ if (iForm && iIsInForeground &&
+ iIndefiniteState == EContinuousRunning &&
+ !BitmapAnimationUsed() && !iTimer)
+ {
+ iTimer = CGaugeTimer::NewL(*this);
+ iTimer->After(TTimeIntervalMicroSeconds32(KDelayInMicroSeconds));
+ }
+ else
+ {
+ DisposeTimer();
+ }
+}
+
void CMIDNonInteractiveGauge::ConstructProgressInfoL()
{
ASSERT(!iProgressInfo);
@@ -955,31 +923,36 @@
{
// indefinite gauge will not be updated when it is inserted in form
// and the form is sent to background
- TBool updateGauge = (iForm) ? iIsInForeground : ETrue;
+ TBool updateGauge = (iForm) ? iIsInForeground : EFalse;
// update gauge state
TInt oldIndefiniteState = iIndefiniteState;
iIndefiniteState = aValue;
+ DisposeTimer();
+
+ if (BitmapAnimationUsed() && aValue != EContinuousRunning)
+ {
+ // Stoping of animation.
+ iBitmapAnimation->CancelAnimation();
+ delete iBitmapAnimation;
+ iBitmapAnimation = NULL;
+ }
+ else if (!BitmapAnimationUsed() && aValue == EContinuousRunning)
+ {
+ // Create new bitmap animation
+ CreateNewBitmapAnimationIfNeededL();
+ }
switch (iIndefiniteState)
{
case EContinuousIdle:
- iValue = 0;
- DisposeTimer();
- break;
case EIncrementalIdle:
iValue = 0;
- DisposeTimer();
break;
case EContinuousRunning:
- if (!iTimer && updateGauge)
- {
- iTimer = CGaugeTimer::NewL(*this);
- iTimer->After(TTimeIntervalMicroSeconds32(KDelayInMicroSeconds));
- }
+ InstallGaugeTimerWhenNeededL();
break;
case EIncrementalUpdating:
- DisposeTimer();
// update gauge's state
if (updateGauge)
@@ -1005,13 +978,13 @@
iGaugeToAlertListner->UpdateGaugeInAlertL(iValue);
}
- // eventually notify alert dialog that indefinite state changed
+ // Eventually notify alert dialog that indefinite state changed
if (iGaugeToAlertListner && (iIndefiniteState != oldIndefiniteState))
{
iGaugeToAlertListner->GaugeTypeInAlertChangedL();
}
- // redraw gauge if it should be updated or if it's type changed
+ // Redraw gauge if it should be updated or if it's type changed
if (updateGauge || (iIndefiniteState != oldIndefiniteState))
{
DoSafeDraw();
@@ -1019,6 +992,15 @@
}
else
{
+ // Bitmap animation is used with indefinite only
+ if (BitmapAnimationUsed())
+ {
+ // Stoping of animation.
+ iBitmapAnimation->CancelAnimation();
+ delete iBitmapAnimation;
+ iBitmapAnimation = NULL;
+ }
+
iValue = aValue;
if (iGaugeToAlertListner)
@@ -1056,6 +1038,16 @@
}
else
{
+ // If old value was indefinite and new one is not
+ // recreate progress bar, otherwise progress bar wont be updated
+ if (iMaxValue == EIndefinite && iMaxValue != aMaxValue)
+ {
+ // update progressinfo
+ delete iProgressInfo;
+ iProgressInfo = NULL;
+ ConstructProgressInfoL();
+ }
+
// no timer needed for definite gauge
DisposeTimer();
@@ -1101,6 +1093,11 @@
{
if (iIndefinite)
{
+ if (BitmapAnimationUsed())
+ {
+ return 2; // to be able to access iBitmapAnimation
+ }
+
return 1; // we will draw the gauge in our Draw() method
}
else
@@ -1116,6 +1113,11 @@
case 0:
return iLabelControl;
case 1:
+ if (BitmapAnimationUsed())
+ {
+ return iBitmapAnimation;
+ }
+
return iProgressInfo;
default:
return NULL;
@@ -1141,8 +1143,7 @@
{
// If Gauge animated in current skin, is drawn by iBitmapAnimation.
// Otherwise is drawn in this block of code.
- if ((!iBitmapAnimation) || (!(iBitmapAnimation->BitmapAnimData())) ||
- (!(iBitmapAnimation->BitmapAnimData()->FrameArray().Count()> 0)))
+ if (!BitmapAnimationUsed())
{
CFbsBitmap* bitmap = NULL;
CFbsBitmap* bitmapMask = NULL;
@@ -1238,8 +1239,7 @@
CMIDControlItem::SizeChanged();
// If Gauge is animated, the animation will be resized.
- if (iBitmapAnimation && iBitmapAnimation->BitmapAnimData() &&
- iBitmapAnimation->BitmapAnimData()->FrameArray().Count()> 0)
+ if (BitmapAnimationUsed())
{
// Stoping of animation.
iBitmapAnimation->CancelAnimation();
@@ -1281,6 +1281,14 @@
#endif //RD_SCALABLE_UI_V2
}
+void CMIDNonInteractiveGauge::DisposeTimer()
+{
+ if (iTimer)
+ iTimer->Cancel();
+ delete iTimer;
+ iTimer = NULL;
+}
+
void CMIDNonInteractiveGauge::DoSafeDraw()
{
if (iForm && DrawableWindow())
@@ -1295,6 +1303,14 @@
}
}
+void CMIDNonInteractiveGauge::HandleForegroundL(TBool aForeground)
+{
+ // synchronize foreground flag
+ iIsInForeground = aForeground;
+
+ InstallGaugeTimerWhenNeededL();
+}
+
#ifdef RD_SCALABLE_UI_V2
void CMIDNonInteractiveGauge::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
@@ -1387,48 +1403,40 @@
// Set aAnimation like iBitmapAnimation
iBitmapAnimation = aBitmapAnimation;
+
+ // Timer is not needed when iBitmapAnimation is used
+ DisposeTimer();
}
+
void CMIDNonInteractiveGauge::ItemAddedToFormL()
{
// call parent's implementation
CMIDGaugeItem::ItemAddedToFormL();
- CAknBitmapAnimation* bitmapAnimation = CAknBitmapAnimation::NewL();
- CleanupStack::PushL(bitmapAnimation);
-
- TRect waitGaugeRect;
-
- // setting of window of bitmapAnimation to this
- bitmapAnimation->SetContainerWindowL(*this);
-
- // costruction of bitmapAnimation by ID of Gauge
- bitmapAnimation->ConstructFromSkinL(GetAknsItemID());
+ // Creates new bitmapAnimation, it sets bitmapAnimation to IBitmapAnimation
+ CreateNewBitmapAnimationIfNeededL();
- CleanupStack::Pop(bitmapAnimation);
-
- // If bitmapAnimation exist, set bitmapAnimation to IBitmapAnimation.
- if (bitmapAnimation && bitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0)
+ // If bitmapAnimation does not exist create bitmap in TLS.
+ if (!BitmapAnimationUsed())
{
- ConstructAnimation(bitmapAnimation);
- }
- // Else create Bitmap in TLS.
- else
- {
+ // Create Bitmap in TLS.
CreateBitmapsIfNeededL();
}
- // initially assume that gauge is in foreground so that indefinite ni-gauges
- // can be updated and redrawn (gauge can be inserted into form after form
- // is moved to foreground -> no notification to gauge)
- HandleForegroundL(ETrue);
+ // Install timer when needed and able to be installed.
+ InstallGaugeTimerWhenNeededL();
}
+
void CMIDNonInteractiveGauge::ItemRemovedFromForm()
{
// call parent's implementation
CMIDGaugeItem::ItemRemovedFromForm();
+ // Timer is not needed when item is removed from form.
+ DisposeTimer();
+
// if indefinite ni-gauge is removed from form then no notifications
// about moving to foreground/background are sent and so in order to ensure
// full functionality it is assumed that gauge is in foreground
@@ -1436,7 +1444,8 @@
if (err != KErrNone)
{
- DEBUG_INT("CMIDNonInteractiveGauge::ItemRemovedFromForm() - Exception from HandleForegroundL. Error = %d ", err);
+ DEBUG_INT("CMIDNonInteractiveGauge::ItemRemovedFromForm() - \
+ Exception from HandleForegroundL. Error = %d ", err);
}
// When NonInteractiveGauge was removed from form, then animation
@@ -1448,6 +1457,35 @@
}
}
+void CMIDNonInteractiveGauge::CreateNewBitmapAnimationIfNeededL()
+{
+ if (iMaxValue == EIndefinite && iIndefiniteState == EContinuousRunning
+ && DrawableWindow())
+ {
+ // creating new instance of CAknBitmapAnimation
+ // for Gauge animation in new skin
+ CAknBitmapAnimation* bitmapAnimation = CAknBitmapAnimation::NewL();
+ CleanupStack::PushL(bitmapAnimation);
+
+ // setting of window of bitmapAnimation to this
+ bitmapAnimation->SetContainerWindowL(*this);
+
+ // costruction of bitmapAnimation by ID of Gauge
+ bitmapAnimation->ConstructFromSkinL(GetAknsItemID());
+ CleanupStack::Pop(bitmapAnimation);
+
+ TBool bitmapFrameCount =
+ bitmapAnimation ?
+ bitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0 : EFalse;
+
+ // If bitmapAnimation exist, set bitmapAnimation to IBitmapAnimation.
+ if (bitmapFrameCount)
+ {
+ ConstructAnimation(bitmapAnimation);
+ }
+ }
+}
+
void CMIDNonInteractiveGauge::ColorChange(TInt aType)
{
// The original CMIDNonInteractiveGauge::ColorChange is using
@@ -1456,57 +1494,30 @@
TRAPD(creatingErr, ColorChangeL(aType));
if (creatingErr != KErrNone)
{
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception. Error = %d ", creatingErr);
+ DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - \
+ Exception. Error = %d ", creatingErr);
}
}
void CMIDNonInteractiveGauge::ColorChangeL(TInt aType)
{
// stopping and deleting iBitmapAnimation
- if (iBitmapAnimation && iBitmapAnimation->BitmapAnimData()->FrameArray().Count()> 0)
+ if (BitmapAnimationUsed())
{
iBitmapAnimation->CancelAnimation();
delete iBitmapAnimation;
iBitmapAnimation = NULL;
}
- // creating new instance of CAknBitmapAnimation for Gauge animation in new skin
- CAknBitmapAnimation* bitmapAnimation = NULL;
- TRAPD(creatingErr, bitmapAnimation = CAknBitmapAnimation::NewL());
- if (creatingErr != KErrNone)
- {
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception from CAknBitmapAnimation::NewL. Error = %d ", creatingErr);
- }
-
- // CleanupStack::PushL can not be in TRAPD macro.
- CleanupStack::PushL(bitmapAnimation);
+ // Creates new bitmapAnimation, it sets bitmapAnimation to IBitmapAnimation
+ CreateNewBitmapAnimationIfNeededL();
- // setting of window of bitmapAnimation to this
- TRAPD(setErr, bitmapAnimation->SetContainerWindowL(*this));
- if (setErr != KErrNone)
- {
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception from CAknBitmapAnimation::SetContainerWindowL. Error = %d ", setErr);
- }
-
- // costruction of bitmapAnimation by ID of Gauge
- TRAPD(constructErr, bitmapAnimation->ConstructFromSkinL(GetAknsItemID()));
- if (constructErr != KErrNone)
- {
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception from CAknBitmapAnimation::ConstructFromSkinL. Error = %d ", constructErr);
- }
-
- CleanupStack::Pop(bitmapAnimation);
-
- // If bitmapAnimation exist, it sets bitmapAnimation to IBitmapAnimation and
- // sets correct size iBitmapAnimation.
- if (bitmapAnimation->BitmapAnimData()->FrameArray().Count()> 0)
+ // If bitmapAnimation exist sets correct size iBitmapAnimation.
+ if (BitmapAnimationUsed())
{
// call of parent's implementation
CMIDGaugeItem::ColorChange(aType);
- // setting bitmapAnimation to IBitmapAnimation
- ConstructAnimation(bitmapAnimation);
-
// settting correct size iBitmapAnimation
SetAnimationSize();
@@ -1514,15 +1525,23 @@
TRAPD(errStart, iBitmapAnimation->StartAnimationL());
if (errStart != KErrNone)
{
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception from CAknBitmapAnimation::StartAnimationL(). Error = %d ", errStart);
+ DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - \
+ Exception from CAknBitmapAnimation::StartAnimation. \
+ Error = %d ", errStart);
}
// Setting of animation mode (cycle).
- TRAPD(errSet, iBitmapAnimation->Animation().SetPlayModeL(CBitmapAnimClientData::ECycle));
+ TRAPD(errSet, iBitmapAnimation->Animation().SetPlayModeL(
+ CBitmapAnimClientData::ECycle));
if (errSet != KErrNone)
{
- DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - Exception from RBitmapAnim::SetPlayModeL(). Error = %d ", errSet);
+ DEBUG_INT("CMIDNonInteractiveGauge::ColorChange() - \
+ Exception from RBitmapAnim::SetPlayMode. \
+ Error = %d ", errSet);
}
+
+ // Timer is useless when iBitmapAnimation is used
+ DisposeTimer();
}
else
{
@@ -1614,6 +1633,12 @@
return KAknsIIDNone;
}
+TBool CMIDNonInteractiveGauge::BitmapAnimationUsed() const
+{
+ return iBitmapAnimation && iBitmapAnimation->BitmapAnimData() &&
+ iBitmapAnimation->BitmapAnimData()->FrameArray().Count() > 0;
+}
+
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
--- a/javauis/lcdui_akn/lcdui/src/CMIDList.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDList.cpp Tue May 11 16:07:20 2010 +0300
@@ -629,6 +629,21 @@
}
DoDeleteElement(aIndex);
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ if (!iItems.Count())
+ {
+ // Last element was deleted, highlight is removed at all.
+ // In case of IMPLICIT List without highlight, CBA has to be updated,
+ // so that no ITEM or OK commands are mapped to soft keys
+ // or populated to Options menu.
+ iHighlight = EFalse;
+ if (iChoiceType == MMIDChoiceGroup::EImplicit && iDisplayable)
+ {
+ iDisplayable->InitializeCbasL();
+ }
+ }
+#endif // RD_JAVA_S60_RELEASE_9_2
}
/**
@@ -659,6 +674,18 @@
iIconArray->Delete(firstIcon, iIconArray->Count() - firstIcon);
SetMaxIconSize();
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+ // All items are deleted, highlight is removed.
+ // In case of IMPLICIT List without highlight, CBA has to be updated,
+ // so that no ITEM or OK commands are mapped to soft keys
+ // or populated to Options menu.
+ iHighlight = EFalse;
+ if (iChoiceType == MMIDChoiceGroup::EImplicit && iDisplayable)
+ {
+ iDisplayable->InitializeCbasL();
+ }
+#endif // RD_JAVA_S60_RELEASE_9_2
}
/**
@@ -1221,6 +1248,10 @@
iChoiceType == MMIDChoiceGroup::EImplicit)
{
iHighlight = ETrue;
+ if (iDisplayable)
+ {
+ iDisplayable->InitializeCbasL();
+ }
}
#endif // RD_JAVA_S60_RELEASE_9_2
@@ -1334,6 +1365,10 @@
(iLongTapDetected && aPointerEvent.iType == TPointerEvent::EButton1Up)))
{
iHighlight = EFalse;
+ if (iDisplayable)
+ {
+ iDisplayable->InitializeCbasL();
+ }
}
#endif // RD_JAVA_S60_RELEASE_9_2
@@ -1444,7 +1479,17 @@
if (iSelectCommandId == MMIDCommand::ENullCommand)
{ //setSelectCommand(null) has been called by application
+#ifndef RD_JAVA_S60_RELEASE_9_2
iDisplayable->ShowOkOptionsMenuL();
+#else
+ // If ShowOkOptionsMenuL returned false then we can try to open screen(help) menu
+ if (iHighlight && iDisplayable && !iDisplayable->ShowOkOptionsMenuL() &&
+ aEventType == MEikListBoxObserver::EEventEnterKeyPressed)
+ {
+ // Invoke the SCREEN or HELP command with the highest priority if exists
+ iDisplayable->HandleHighestPriorityScreenOrHelpCommandL();
+ }
+#endif // RD_JAVA_S60_RELEASE_9_2
}
else
{ //either default select cmd - which we may not know
@@ -1731,6 +1776,28 @@
listBox->SetListBoxObserver(this);
listBox->ScrollBarFrame()->SetScrollBarFrameObserver(this);
+ // We need avoid stretching list's elements. This prevents problems
+ // with icon overlaying and bad wrapping.
+ if(type < EDouble2Style)
+ {
+ CEikColumnListBox* clb =
+ (static_cast<CEikColumnListBox*>(listBox));
+ if(clb)
+ {
+ clb->EnableStretching(EFalse);
+ }
+ }
+ else
+ {
+ CEikFormattedCellListBox* fclb =
+ (static_cast<CEikFormattedCellListBox*>(listBox));
+ if(fclb)
+ {
+ fclb->EnableStretching(EFalse);
+ }
+ }
+
+
if (iListBox)
{//Remove icon array before deleting old list box
if (iListBoxType < EDouble2Style)
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextBoxEdwin.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextBoxEdwin.cpp Tue May 11 16:07:20 2010 +0300
@@ -179,12 +179,9 @@
}
-void CMIDTextBoxEdwin::AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray)
+void CMIDTextBoxEdwin::AddCommandToEdwinL(MMIDCommand& aCommand)
{
- for (TInt i = 0; i < aArray.Count(); i++)
- {
- STATIC_CAST(CMIDDisplayable*, iDisplayable)->AddCommandL(aArray[i]);
- }
+ STATIC_CAST(CMIDDisplayable*, iDisplayable)->AddCommandL(&aCommand);
}
// ---------------------------------------------------------
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextBoxQueryDialog.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextBoxQueryDialog.cpp Tue May 11 16:07:20 2010 +0300
@@ -1286,35 +1286,30 @@
to either the displayable or to the item. Commands will be processed in ProcessCommandL(). */
void CMIDTextBoxQueryDialog::CreateNonMidletCommandsL()
{
- RPointerArray<MMIDCommand> array;
- CleanupClosePushL(array);
-
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EPhoneNumber) && !(iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_PB_FETCH_NUMBER_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_NUMBER_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchPhoneNumber);
- AddCommandToArrayL(array, R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
+ AddCommandToEdwinL(R_MIDP_PB_FETCH_NUMBER_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_NUMBER_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchPhoneNumber);
+ AddCommandToEdwinL(R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
}
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EPhoneNumber) && (iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
+ AddCommandToEdwinL(R_MIDP_CREATE_CALL_SHORT_COMMAND_TEXT, R_MIDP_CREATE_CALL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandCreatePhoneCall);
}
if (((iConstraints & MMIDTextField::EConstraintMask) == MMIDTextField::EMailAddr) && !(iConstraints & MMIDTextField::EUneditable))
{
- AddCommandToArrayL(array, R_MIDP_PB_FETCH_EMAIL_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_EMAIL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchEmailAddress);
+ AddCommandToEdwinL(R_MIDP_PB_FETCH_EMAIL_SHORT_COMMAND_TEXT, R_MIDP_PB_FETCH_EMAIL_COMMAND_TEXT, CMIDEdwinUtils::EMenuCommandFetchEmailAddress);
}
- AddCommandsToEdwinL(array);
-
- CleanupStack::PopAndDestroy(&array);
}
/**
-Creates and adds new command to array based on shot & long label resource ids
+Creates and adds new command to edwin based on shot & long label resource ids
and other parameters.
*/
-void CMIDTextBoxQueryDialog::AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResIdShort, TInt aCommandResIdLong, TInt aCommandId)
+void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResIdShort,
+ TInt aCommandResIdLong,
+ TInt aCommandId)
{
TBuf<64> shortLabel;
iEikonEnv->ReadResourceL(shortLabel, aCommandResIdShort);
@@ -1326,17 +1321,17 @@
STATIC_CAST(CMIDCommand*,cmd)->SetObserver(this);
- aArray.AppendL(cmd);
+ AddCommandToEdwinL(*cmd);
CleanupStack::Pop(cmd);
}
/**
-Creates and adds new command to array, short label is the same as long label.
+Creates and adds new command to edwin, short label is the same as long label.
*/
-void CMIDTextBoxQueryDialog::AddCommandToArrayL(RPointerArray<MMIDCommand>& aArray,
- TInt aCommandResId, TInt aCommandId)
+void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResId,
+ TInt aCommandId)
{
- AddCommandToArrayL(aArray, aCommandResId, aCommandResId, aCommandId);
+ AddCommandToEdwinL(aCommandResId, aCommandResId, aCommandId);
}
/** This method is called from the destructor and removes
@@ -1369,12 +1364,9 @@
}
}
-void CMIDTextBoxQueryDialog::AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray)
+void CMIDTextBoxQueryDialog::AddCommandToEdwinL(MMIDCommand& aCommand)
{
- for (TInt i = 0; i < aArray.Count(); i++)
- {
- STATIC_CAST(CMIDDisplayable*, iDisplayable)->AddCommandL(aArray[i]);
- }
+ STATIC_CAST(CMIDDisplayable*, iDisplayable)->AddCommandL(&aCommand);
}
void CMIDTextBoxQueryDialog::CreatePhoneCallL()
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditor.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditor.cpp Tue May 11 16:07:20 2010 +0300
@@ -526,13 +526,13 @@
}
// ---------------------------------------------------------------------------
-// CMIDTextEditor::SetCaretXY
+// CMIDTextEditor::SetCaretXYL
// (other items are commented in the header file)
// ---------------------------------------------------------------------------
//
void CMIDTextEditor::SetCaretXYL(TInt aX, TInt aY)
{
- DEBUG_INT2("CMIDTextEditor::SetCaretXY +, aX=%d, aY=%d", aX, aY);
+ DEBUG_INT2("CMIDTextEditor::SetCaretXYL +, aX=%d, aY=%d", aX, aY);
// Requested point should be already recalculated to be relative
// to editor position on canvas.
@@ -540,14 +540,14 @@
// If position will be found in formatted text, posInfo will be filled
// with desired informations.
TTmPosInfo2 posInfo;
-
+
if (iTextEdwin->TextLayout()->FindXyPos(pos, posInfo))
{
// Position was found. Try to set cursor to found position.
iTextEdwin->SetCursorPosL(posInfo.iDocPos.iPos, EFalse);
}
- DEBUG("CMIDTextEditor::SetCaretXY -");
+ DEBUG("CMIDTextEditor::SetCaretXYL -");
}
// ---------------------------------------------------------------------------
@@ -582,7 +582,7 @@
iTextEdwin->SetCursorVisible(EFalse);
}
else if (iEditingStateIndicator->EnabledState() ==
- CMIDEditingStateIndicator::EIndicatorStateRelative)
+ CMIDEditingStateIndicator::EIndicatorStateRelative)
{
// Enable the custom indicators as in Avkon if not controlled
// by the client application
@@ -1076,7 +1076,7 @@
// if the constraint modifier PASSWORD is set. Passwords are single
// line editors due to CMIDEdwinUtils::CPasswordText implementation.
if (aMultiline == iTextEdwin->IsWrapEnabled() ||
- iConstraints & MMIDTextField::EPassword)
+ iConstraints & MMIDTextField::EPassword)
{
DEBUG("CMIDTextEditor::SetMultilineL -, ignoring request");
@@ -1103,6 +1103,8 @@
// Text has been changed so inform the editor window that
// it needs to redraw itself again.
iTextEdwin->HandleTextChangedL();
+ // Cursor position handling is done in CMIDTextEditorEdwin
+ iTextEdwin->SetCursorPosL(iTextEdwin->CursorPos(), EFalse);
DEBUG("CMIDTextEditor::SetMultilineL -");
}
@@ -1386,7 +1388,6 @@
{
TSize size = EditorSize();
TInt newEditorWindowHeight = iTextEdwin->EditorWindowHeight();
-
if (size.iHeight != newEditorWindowHeight)
{
SetEditorSize(size.iWidth, newEditorWindowHeight);
@@ -1929,7 +1930,7 @@
DEBUG_INT2(
"CMIDTextEditor::UpdateIndicatorPosition, indicatorPos.X=%d, \
-indicatorPos.Y=%d", x, y);
+ indicatorPos.Y=%d", x, y);
iEditingStateIndicator->SetPosition(x, y);
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp Tue May 11 16:07:20 2010 +0300
@@ -257,11 +257,6 @@
// Part of transparency workaround. Set drawing not active.
iDrawInvoked = EFalse;
- if (iObserver)
- {
- iObserver->NotifyInputAction(
- MMIDTextEditorObserver::EActionPaintRequest);
- }
DEBUG("CMIDTextEditorEdwin::Draw -");
}
@@ -530,6 +525,7 @@
//
void CMIDTextEditorEdwin::HandleResourceChange(TInt aType)
{
+ CCoeControl::HandleResourceChange(aType);
// Notification about language change
if (aType == KEikInputLanguageChange)
{
@@ -584,8 +580,7 @@
// Check if cursor has moved. This must be done because
// currently edwin does not report cursor position movement
// when text is changed due to user input.
- if ((iVisibleContentHeight != newVisiblecontentHeight) &&
- (iCursorPosForAction != CursorPos()))
+ if (iVisibleContentHeight != newVisiblecontentHeight)
{
event |= MMIDTextEditorObserver::EActionScrollbarChange;
// Reported, reset here to avoid multiple notifications.
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp Tue May 11 16:07:20 2010 +0300
@@ -122,6 +122,47 @@
aExtraPixels);
}
+#ifdef RD_JAVA_S60_RELEASE_9_2
+// ---------------------------------------------------------------------------
+// CMIDTextEditorEdwinCustomDraw::DrawText
+// (other items were commented in the header file)
+// ---------------------------------------------------------------------------
+//
+void CMIDTextEditorEdwinCustomDraw::DrawText(
+ const TParam& aParam,
+ const TLineInfo& aLineInfo,
+ const TCharFormat& aFormat,
+ const TDesC& aText,
+ const TInt aStart,
+ const TInt aEnd,
+ const TPoint& aTextOrigin,
+ TInt aExtraPixels) const
+{
+ // If transparency is enabled, check that if draw has not been invoked
+ // yet and issue redraw in that case. This removes the issue with
+ // transparency so that the old content does not cause corruption to
+ // the new text drawn on top of the old content. Otherwise it is ok
+ // to draw the text because opaque background draws on top of the old
+ // content in the editor.
+
+ if (iEdwin.IsTransparent() && !iEdwin.DrawOngoing())
+ {
+ iEdwin.Redraw();
+ return;
+ }
+
+ iParentDraw.DrawText(
+ aParam,
+ aLineInfo,
+ aFormat,
+ aText,
+ aStart,
+ aEnd,
+ aTextOrigin,
+ aExtraPixels);
+}
+#endif
+
// ---------------------------------------------------------------------------
// CMIDTextEditorEdwinCustomDraw::SystemColor
// (other items were commented in the header file)
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextFieldEdwin.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextFieldEdwin.cpp Tue May 11 16:07:20 2010 +0300
@@ -252,10 +252,7 @@
}
-void CMIDTextFieldEdwin::AddCommandsToEdwinL(RPointerArray<MMIDCommand>& aArray)
+void CMIDTextFieldEdwin::AddCommandToEdwinL(MMIDCommand& aCommand)
{
- for (TInt i = 0; i < aArray.Count(); i++)
- {
- STATIC_CAST(CMIDTextFieldItem*, iTextFieldItem)->AddCommandL(aArray[i]);
- }
+ STATIC_CAST(CMIDTextFieldItem*, iTextFieldItem)->AddCommandL(&aCommand);
}
--- a/javauis/m2g_akn/build/javam2g_0x2002DCBD.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/m2g_akn/build/javam2g_0x2002DCBD.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -105,6 +104,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/m2g_akn/inc/CM2GRenderContext.h Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/m2g_akn/inc/CM2GRenderContext.h Tue May 11 16:07:20 2010 +0300
@@ -172,7 +172,7 @@
const TRect& aViewbox,
const TPoint& aAnchor);
- void CM2GRenderContext::RenderESWTL(
+ void RenderESWTL(
TM2GSvgDocumentHandle& aSvgDocHandle,
TReal32 aCurrentTime,
const TRect& aViewbox,
--- a/javauis/m3g_akn/build/javam3g_0x2002DCBE.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/m3g_akn/build/javam3g_0x2002DCBE.mmp Tue May 11 16:07:20 2010 +0300
@@ -46,7 +46,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -93,6 +92,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/mmapi_akn/baseline/src/cmmacamerawindow.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/mmapi_akn/baseline/src/cmmacamerawindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -206,7 +206,6 @@
// Stop and start ViewFinder to update position
ResetViewFinder();
}
-
}
@@ -311,8 +310,6 @@
*this, CMMACameraWindow::EResetViewFinder);
}
}
-
-
}
@@ -616,10 +613,6 @@
{
iUICamera->StopViewFinder();
}
- if (iDirectAccess->IsActive())
- {
- iDirectAccess->Cancel();
- }
iViewFinderVisible = EFalse;
}
@@ -717,11 +710,12 @@
}
else
{
- DEBUG_INT(
- "MMA::CMMACameraWindow::StartViewFinder() - \
-StartViewFinderDirectL error=%d", vfError);
+ DEBUG_INT("MMA::CMMACameraWindow::StartViewFinder() - \
+ StartViewFinderDirectL error=%d", vfError);
- TRAP_IGNORE(DrawViewFinderErrorL(vfError, drawRect));
+ TRAPD(error, DrawViewFinderErrorL(vfError, drawRect));
+ DEBUG_INT("MMA::CMMACameraWindow::StartViewFinder, \
+ DrawViewFinderErrorL error = %d", error);
}
DEBUG(" > StartViewFinder");
@@ -738,8 +732,18 @@
const TInt /*aError*/,
const TRect& aDrawRect)
{
+ if (!iDirectAccess)
+ {
+ if (!iWs || !iScreenDevice || !iWindow) return;
- ASSERT(iDirectAccess);
+ DEBUG("MMA::CMMACameraWindow::DrawViewFinderErrorL - \
+ Instantiating CDirectScreenAccess");
+ iDirectAccess = CDirectScreenAccess::NewL(*iWs,
+ *iScreenDevice,
+ *iWindow,
+ *this);
+ }
+
TInt dcError = KErrNone;
if (!iDirectAccess->IsActive())
{
@@ -831,9 +835,12 @@
delete iUICamera;
iUICamera = NULL;
iCameraPowerOn = EFalse;
- iDirectAccess->Cancel();
- delete iDirectAccess;
- iDirectAccess = NULL;
+ if (iDirectAccess)
+ {
+ iDirectAccess->Cancel();
+ delete iDirectAccess;
+ iDirectAccess = NULL;
+ }
delete iErrorIconBitmap;
iErrorIconBitmap = NULL;
delete iErrorIconMaskBitmap;
@@ -882,15 +889,6 @@
CWsScreenDevice &aScreenDevice,
RWindowBase &aWindow)
{
- TRAPD(error, iDirectAccess = CDirectScreenAccess::NewL(aWs,
- aScreenDevice,
- aWindow,
- *this));
- DEBUG_INT("MMA::CMMACameraWindow::MdcDSAResourcesCallback, error = %d", error);
- if (KErrNone != error)
- {
- return;
- }
this->UIStartViewFinder(aWs, aScreenDevice, aWindow);
}
--- a/javauis/mmapi_akn/baseline/src/cmmadisplay.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/mmapi_akn/baseline/src/cmmadisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -151,7 +151,7 @@
// If visible then set a new clip rect
if (iVisible && iContainerVisible)
{
- iClipRect.SetRect(TPoint(0,0),iWindow->WindowRect().Size());
+ iClipRect = iWindow->DrawRect();
if (!iClipRect.IsEmpty())
{
@@ -205,7 +205,7 @@
// If visible then set a new clip rect
if (iVisible)
{
- iClipRect.SetRect(TPoint(0,0),iWindow->WindowRect().Size());
+ iClipRect = iWindow->DrawRect();
if (!iClipRect.IsEmpty())
{
--- a/javauis/mmapi_akn/build/javamobilemedia_0x2002DCC2.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/mmapi_akn/build/javamobilemedia_0x2002DCC2.mmp Tue May 11 16:07:20 2010 +0300
@@ -46,7 +46,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -268,6 +267,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationframepositioningcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements FramePositioningControl for animation
+*
+*/
+
+
+#ifndef CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
+#define CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
+
+// INTERNAL INCLUDES
+#include "cmmaanimationplayer.h"
+#include "cmmaframepositioningcontrol.h" // base class
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class MIHLImageViewer;
+
+// CLASS DECLARATION
+/**
+* This class implements FramePositioningControl for video player
+*/
+NONSHARABLE_CLASS(CMMAAnimationFramePositioningControl) :
+ public CMMAFramePositioningControl
+{
+public:
+ static CMMAAnimationFramePositioningControl* NewL(CMMAAnimationPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAAnimationFramePositioningControl();
+
+protected:
+ /**
+ * Constructor.
+ */
+ CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer);
+
+ void ConstructL(CMMAAnimationPlayer* aPlayer);
+
+public: // From CMMAFramePositioningControl
+ TInt SeekL(TInt aFrameNumber);
+ TInt SkipL(TInt aFramesToSkip);
+ void MapFrameToTimeL(TInt aFrameNumber, TInt64* aMediaTime);
+ TInt MapTimeToFrameL(TInt64* aMediaTime);
+
+private: // New methods
+ TInt FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber);
+
+private: // Data
+ CMMAAnimationPlayer* iPlayer;
+
+};
+
+
+#endif // CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing animated images.
+*
+*/
+
+
+#ifndef CMMAANIMATIONPLAYER_H
+#define CMMAANIMATIONPLAYER_H
+
+// INCLUDES
+#include <w32std.h>
+#include "cmmaplayer.h"
+#include "mmmaguiplayer.h"
+#include "mmmasnapshot.h"
+#include "rmmatempfile.h"
+#include "MIHLViewerObserver.h"
+#include "MIHLImageViewer.h"
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+class CMMAAnimationWindow;
+class MIHLFileImage;
+class MIHLBitmap;
+class CFbsBitmap;
+
+// CONSTANTS
+_LIT(KMMAVideoPlayer, "VideoPlayer");
+
+NONSHARABLE_CLASS(MMMAAnimationObserver)
+{
+public: // new methods
+ /**
+ * Listener for animation advancing
+ * @param aFrame current frame
+ * @param aMediaTime current media time
+ */
+ virtual void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime) = 0;
+};
+
+// CLASS DECLARATION
+/**
+* This class is used for playing animated images.
+*
+*/
+NONSHARABLE_CLASS(CMMAAnimationPlayer): public CMMAPlayer,
+ public MMMAGuiPlayer,
+ public MMMASnapshot,
+ public MIHLViewerObserver
+{
+public: // Construction
+ static CMMAAnimationPlayer* NewLC();
+ static CMMAAnimationPlayer* NewLC(const TDesC& aFileName);
+
+ // Destructor
+ ~CMMAAnimationPlayer();
+
+protected:
+ // C++ constructor
+ CMMAAnimationPlayer();
+ void ConstructL();
+
+public: // from CMMAPlayer
+ void SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster);
+ void RealizeL();
+ void PrefetchL();
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void DeallocateL();
+ void GetDuration(TInt64* aDuration);
+ const TDesC& Type();
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+
+public: // from CMMAPlayer/MMMASourceStreamListener
+ void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+
+public: // new methods
+ void PrefetchFileL();
+ void PrefetchDataL(const TDesC8& aData);
+
+ /**
+ * Check whether this player is playing from a file locator
+ * @return ETrue if is a file player, EFalse otherwise
+ */
+ TBool IsFilePlayer();
+
+ // Finds current frame for given media time
+ TInt FindFrame(TInt64 aTime);
+
+ // Calculates media time for specified frame
+ TInt64 MediaTimeForFrame(TInt aFrameIndex);
+
+ // Frame duration of specified frame
+ TTimeIntervalMicroSeconds32 FrameDuration(TInt aFrameIndex);
+
+ MIHLImageViewer* Viewer();
+
+ // Setter for frame listener, used for stop time control
+ void SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver);
+
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ TInt RateL();
+
+private: // new methods
+ void PrepareViewerL();
+ void ProcessCurrentFrameL();
+
+public: // From MMMAGuiPlayer
+ void SetDisplayL(MMMADisplay* aDisplay);
+ TSize SourceSize();
+ void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData);
+
+ MMMASnapshot* SnapshoterL();
+
+public: // From MMMASnapshot
+ MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings);
+ CFbsBitmap* SnapshotBitmap();
+ HBufC8* SnapshotEncoded();
+
+public: // From MIHLViewerObserver
+ virtual void ViewerBitmapChangedL();
+ virtual void ViewerError(TInt aError);
+
+ private: // Data
+
+ /**
+ * Display to draw animation.
+ */
+ MMMADisplay* iDisplay;
+
+ /**
+ * Window to draw animation.
+ */
+ CMMAAnimationWindow* iWindow;
+
+ /**
+ * Dimensions of animation.
+ */
+ TSize iSourceSize;
+
+ /**
+ * Animated image to play. Owned.
+ */
+ MIHLFileImage* iImage;
+
+ /**
+ * Destination bitmap for animation. Owned.
+ */
+ MIHLBitmap* iBitmap;
+
+ /**
+ * Animation viewer. Owned.
+ */
+ MIHLImageViewer* iViewer;
+
+ /**
+ * Bitmap for snapshot. Ownership is transferred for
+ * snapshot requester, but owned if not null.
+ */
+ CFbsBitmap* iSnapshotBitmap;
+
+ /**
+ * File system session for IHL interfacing
+ */
+ RFs iFSession;
+
+ /**
+ * Animation frame count. Held locally for optimization.
+ */
+ TInt iFrameCount;
+
+ /**
+ * Possible file name, owned
+ */
+ HBufC* iFileName;
+
+ /**
+ * Current Media Time
+ */
+ TInt64 iMediaTime;
+
+ /**
+ * Animation listener
+ */
+ MMMAAnimationObserver* iAnimationObserver;
+
+ /**
+ * Current rate
+ */
+ TInt iCurrentRate;
+
+ /**
+ * Hold the information whether playback should be started
+ * from beginning on next start or from current position
+ */
+ TBool iEndReached;
+
+ /**
+ * EndOfMedia will be delivered when next frame arrives if
+ * iSendEndOfMediaOnNextFrame is true
+ */
+ TBool iSendEndOfMediaOnNextFrame;
+};
+
+#endif // CMMAANIMATIONPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating animation player
+*
+*/
+
+
+#ifndef CMMAANIMATIONPLAYERFACTORY_H
+#define CMMAANIMATIONPLAYERFACTORY_H
+
+// INCLUDES
+#include "mmmaplayerfactory.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CMMAAnimationPlayer;
+
+// CLASS DECLARATION
+/**
+* This class is used for creating animation player.
+*
+*/
+NONSHARABLE_CLASS(CMMAAnimationPlayerFactory): public MMMAPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAAnimationPlayerFactory* NewLC();
+ ~CMMAAnimationPlayerFactory();
+
+private: // Constructor
+ CMMAAnimationPlayerFactory();
+
+public: // From MMMAPlayerFactory
+
+ // Creates new player according to a content type.
+ virtual CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ // Creates new player according to a locator
+ virtual CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ // Creates new player according to a header data
+ virtual CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ // Gets player's supported content types.
+ virtual void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ // Gets player's supported protocols for the content type.
+ virtual void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+private:
+ // Create instance of animation player with sufficient controls
+ CMMAAnimationPlayer* CreateAnimationPlayerL();
+
+ // Create instance of animation player with sufficient controls, with specified file
+ CMMAAnimationPlayer* CreateAnimationPlayerL(const TDesC& aFileName);
+
+ // Add animation controls to player
+ void AddControlsL(CMMAAnimationPlayer* aPlayer);
+
+};
+
+#endif // CMMAANIMATIONPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationratecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements AnimationRateControl functionality.
+*
+*/
+
+
+#ifndef CMMAANIMATIONRATECONTROL_H
+#define CMMAANIMATIONRATECONTROL_H
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include "cmmaratecontrol.h" // base class
+
+// CONSTANTS
+
+class CMMAAnimationPlayer;
+
+// CLASS DECLARATION
+/**
+* This class implements AnimationRateControl interface.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAAnimationRateControl): public CMMARateControl
+{
+public:
+ /**
+ * Creates new CMMAAnimationRateControl.
+ *
+ * @param aPlayer Player that plays the content.
+ */
+ static CMMAAnimationRateControl* NewL(CMMAAnimationPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAAnimationRateControl();
+protected:
+ /**
+ * Constructor.
+ * @param aPlayer Player that plays the content.
+ */
+ CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer);
+
+ /**
+ * Initializes this control.
+ */
+ void ConstructL();
+
+public: // From CMMARateControl
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ TInt RateL();
+
+private: // Data
+ /**
+ * Used to control animation.
+ */
+ CMMAAnimationPlayer* iPlayer;
+
+};
+
+
+#endif // CMMAANIMATIONRATECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationstoptimecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling for animation player
+*
+*/
+
+
+#ifndef CMMAANIMATIONSTOPTIMECONTROL_H
+#define CMMAANIMATIONSTOPTIMECONTROL_H
+
+// INCLUDES
+#include "cmmaanimationplayer.h"
+#include "cmmastoptimecontrol.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for stoptime controlling for animation
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAnimationStopTimeControl): public CMMAStopTimeControl,
+ public MMMAAnimationObserver
+{
+public:
+ static CMMAAnimationStopTimeControl* NewL(CMMAAnimationPlayer* aPlayer);
+ ~CMMAAnimationStopTimeControl();
+
+protected:
+ CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer);
+
+public: // from CMMAStopTimeControl
+ void SetStopTimeL(const TInt64& aTime);
+
+public: // from MMMAAnimationObserver
+ void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime);
+};
+
+#endif // CMMAANIMATIONSTOPTIMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationwindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This abstract class implements MMMADisplayWindow functionality
+* in CFbsBitmap based displays.
+*
+*/
+
+
+#ifndef CMMAANIMATIONWINDOW_H
+#define CMMAANIMATIONWINDOW_H
+
+// INCLUDES
+#include <MIHLImageViewer.h>
+//#include "MMMADisplayWindow.h"
+#include "cmmabitmapwindow.h"
+#include "mmafunctionserver.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+//class CFbsBitmap;
+
+
+// CLASS DECLARATION
+/**
+* This abstract class implements MMMADisplayWindow functionality in
+* CFbsBitmap based displays.
+*
+*
+*/
+
+
+NONSHARABLE_CLASS(CMMAAnimationWindow): public CMMABitmapWindow
+{
+public: // Constructors and destructors
+ ~CMMAAnimationWindow(); // Destructor ()
+
+ static CMMAAnimationWindow* NewL(MMAFunctionServer* aEventSource);
+
+protected: // Constructors and destructors
+ // Default constructor, protected to allow derivation
+ CMMAAnimationWindow(MMAFunctionServer* aEventSource);
+
+public: // new methods
+ /**
+ * Setter for viewer, used for changing the size
+ */
+ void SetViewer(MIHLImageViewer* aViewer);
+
+public: // Methods derived from MMMADisplayWindow
+ void SetDestinationBitmapL(CFbsBitmap* aBitmap);
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDrawRect(const TRect& aRect);
+ void SetDrawRectThread(const TRect& aRect);
+
+ /*private:
+ static void StaticSetDrawRect(
+ CMMAAnimationWindow* aWindow,
+ TRect aRect,
+ MMAFunctionServer* aEventSource );*/
+
+protected: // Data
+ /**
+ * not owned, used for switching from UI thread to MMA thread
+ */
+ MMAFunctionServer* iEventSource;
+
+ /**
+ * Pointer to bitmap context, used for BitBlt instead of
+ * slow DrawRect
+ */
+ CBitmapContext* iBitContext;
+
+ /**
+ * Viewer used for setting new size, not owned
+ */
+ MIHLImageViewer* iViewer;
+};
+
+#endif // CMMAANIMATIONWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationframepositioningcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements FramePositioningControl for animation
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "MIHLImageViewer.h"
+#include "cmmaanimationframepositioningcontrol.h"
+
+CMMAAnimationFramePositioningControl*
+CMMAAnimationFramePositioningControl::NewL(CMMAAnimationPlayer* aPlayer)
+{
+ CMMAAnimationFramePositioningControl* self =
+ new(ELeave) CMMAAnimationFramePositioningControl(aPlayer);
+ return self;
+}
+
+CMMAAnimationFramePositioningControl::
+CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer)
+ : CMMAFramePositioningControl(aPlayer), iPlayer(aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::CMMAAnimationFramePositioningControl");
+}
+
+CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl");
+}
+
+TInt CMMAAnimationFramePositioningControl::SeekL(TInt aFrameNumber)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SeekL");
+ MIHLImageViewer* viewer = iPlayer->Viewer();
+ if (!viewer)
+ {
+ return KErrNotFound;
+ }
+ TInt frameNumber = FindFrame(viewer, aFrameNumber);
+ TInt64 mediaTime = iPlayer->MediaTimeForFrame(frameNumber);
+ // adjust wanted media time to get right frame (equal value returns one too small)
+ mediaTime++;
+ iPlayer->SetMediaTimeL(&mediaTime);
+ frameNumber = viewer->AnimationFrame();
+ return frameNumber;
+}
+
+TInt CMMAAnimationFramePositioningControl::SkipL(TInt aFramesToSkip)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SkipL");
+ MIHLImageViewer* viewer = iPlayer->Viewer();
+ if (!viewer)
+ {
+ return KErrNotFound;
+ }
+
+ TInt frameNumber = viewer->AnimationFrame();
+
+ SeekL(frameNumber + aFramesToSkip);
+
+ // Calculate number of frames skipped
+ return viewer->AnimationFrame() - frameNumber;
+}
+
+void CMMAAnimationFramePositioningControl::MapFrameToTimeL(
+ TInt aFrameNumber,
+ TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapFrameToTimeL");
+ MIHLImageViewer* viewer = iPlayer->Viewer();
+ if (!viewer || (aFrameNumber < 0) ||
+ (aFrameNumber >= viewer->AnimationFrameCount()))
+ {
+ *aMediaTime = KErrNotFound;
+ }
+ else
+ {
+ *aMediaTime = iPlayer->MediaTimeForFrame(aFrameNumber);
+ }
+}
+TInt CMMAAnimationFramePositioningControl::MapTimeToFrameL(
+ TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapTimeToFrameL");
+ MIHLImageViewer* viewer = iPlayer->Viewer();
+ TInt64 duration;
+ iPlayer->GetDuration(&duration);
+ if (!viewer || (*aMediaTime < 0) ||
+ (duration == KErrNotFound))
+ {
+ return KErrNotFound;
+ }
+ return iPlayer->FindFrame(*aMediaTime);
+}
+
+TInt CMMAAnimationFramePositioningControl::FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber)
+{
+ TInt frame = 0;
+ TInt count = aViewer->AnimationFrameCount();
+ if (aFrameNumber >= count)
+ {
+ frame = count - 1;
+ }
+ else if (aFrameNumber > 0)
+ {
+ frame = aFrameNumber;
+ }
+ return frame;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,621 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing animated images.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+// For Image Handling Library (IHL)
+#include "IHLImageFactory.h"
+#include "MIHLFileImage.h"
+#include "IHLViewerFactory.h"
+#include "MIHLImageViewer.h"
+#include "MIHLBitmap.h"
+#include "IHLBitmapUtil.h"
+
+// MMAPI includes
+#include "mmmadisplay.h"
+
+// Class header
+#include "cmmaanimationplayer.h"
+#include "cmmaanimationwindow.h"
+
+namespace
+{
+const TInt64 KMMATimeUnknown = -1;
+_LIT(KMMAAnimationContentType, "image/gif");
+
+// Approximated minimum showing time of each frame is 0.12s
+// this value basically depends on how fast device can load frames
+// it is not quaranteed anyway that the media time is equal to
+// clock time, so this needed to be only somewhat close
+
+_LIT(KVideoControlName, "VideoControl");
+}
+
+CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::NewLC");
+ CMMAAnimationPlayer* self = new(ELeave) CMMAAnimationPlayer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC(const TDesC& aFileName)
+{
+ CMMAAnimationPlayer* self = NewLC();
+ self->iFileName = aFileName.AllocL();
+ return self;
+}
+
+CMMAAnimationPlayer::~CMMAAnimationPlayer()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer +");
+ if (iViewer && iViewer->IsPlaying())
+ {
+ iViewer->Stop();
+ }
+ delete iWindow;
+ delete iSnapshotBitmap;
+ delete iViewer;
+ // viewer has reference to iImage,
+ // thus deletion order is important.
+ delete iBitmap;
+ delete iImage;
+
+ delete iFileName;
+
+ iFSession.Close();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer -");
+}
+
+CMMAAnimationPlayer::CMMAAnimationPlayer()
+ : iFrameCount(0), iMediaTime(KMMATimeUnknown), iEndReached(EFalse),
+ iSendEndOfMediaOnNextFrame(EFalse)
+{
+}
+
+void CMMAAnimationPlayer::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL +");
+ CMMAPlayer::ConstructL();
+ HBufC* contentType = KMMAAnimationContentType().AllocL();
+ SetContentType(contentType);
+
+ // Connect to file session, needed also when playing from data
+ User::LeaveIfError(iFSession.Connect());
+
+ // File session must be share protected for IHL
+ User::LeaveIfError(iFSession.ShareProtected());
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL -");
+}
+
+void CMMAAnimationPlayer::SetPlayerListenerObjectL(
+ jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster)
+{
+ CMMAPlayer::SetPlayerListenerObjectL(aListenerObject,
+ aJni,
+ aEventPoster);
+
+ // this method must be called only ones
+ __ASSERT_DEBUG(!iWindow, User::Invariant());
+
+ // create window for animationplayer
+ // event poster is always MMAFunctionServer type.
+ iWindow = CMMAAnimationWindow::NewL(
+ static_cast< MMAFunctionServer* >(iEventPoster));
+}
+
+void CMMAAnimationPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::RealizeL");
+ // For file locator file must be prefetched here because
+ // FramePositioningControl must know duration of media
+ // in realized state
+ if (iFileName)
+ {
+ TRAPD(err, PrefetchFileL());
+ if (err != KErrNone)
+ {
+ User::Leave(err);
+ }
+ }
+ CMMAPlayer::RealizeL();
+}
+
+void CMMAAnimationPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL +");
+ __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant());
+
+ if (iFileName)
+ {
+ // file data is already fetched in when realizing
+
+ // If initDisplayMode was called before prefetch,
+ // then the display must notified about source size.
+ if (iDisplay)
+ {
+ iDisplay->SourceSizeChanged(iSourceSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+ }
+
+ // ChangeState(EPrefetched);
+ // PostActionCompleted(KErrNone);
+ // we can go to prefetched state immediately
+ PostActionCompletedFile();
+ ChangeState(EPrefetched);
+ }
+ else
+ {
+ // Using TDes -- load the whole animation
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+
+ // CMMASourceStream will notify with ReadCompleted
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL -");
+}
+
+void CMMAAnimationPlayer::StartL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL +");
+
+ // If end of media has been reached, then
+ // start from beginning
+ if (iEndReached)
+ {
+ iEndReached = EFalse;
+ iViewer->SetAnimationFrame(0);
+ iMediaTime = 0;
+ }
+ PostLongEvent(CMMAPlayerEvent::EStarted, iMediaTime);
+
+ // process current frame
+ ProcessCurrentFrameL();
+
+ // progress to next frame (start playback) only if rate is not zero
+ if (iCurrentRate > 0)
+ {
+ iViewer->Play();
+ }
+ ChangeState(EStarted);
+ PostActionCompletedStart();
+ // PostActionCompleted(KErrNone); // java start return
+
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL -");
+}
+
+void CMMAAnimationPlayer::ProcessCurrentFrameL()
+{
+ if (iSendEndOfMediaOnNextFrame)
+ {
+ iSendEndOfMediaOnNextFrame = EFalse;
+ // we are reached the end
+ if (!iRepeatForever)
+ {
+ iRepeatCount++;
+ if (iRepeatCount >= iRepeatNumberOfTimes)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reached repeat count, Stopping");
+ // end looping, do not send stopped event
+ StopL(EFalse);
+ iViewer->SetAnimationFrame(iFrameCount - 1);
+ SetLoopCount(iRepeatNumberOfTimes); // reset loop count
+
+ // Signal that end of media has been reached so on next
+ // start playback will be started from beginning. This is needed
+ // because if user sets media time to end of media, then start
+ // should not start from beginning but just deliver end of media.
+ // After that, the next start should start from beginning.
+ iEndReached = ETrue;
+ }
+ }
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, iMediaTime);
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: sent END_OF_MEDIA");
+
+ // Prevents this frame from being viewed if playback has terminated
+ // (e.g. not looping)
+ if (iEndReached)
+ {
+ return;
+ }
+ }
+
+ // draw current frame to display if we have it
+ if (iDisplay)
+ {
+ const CFbsBitmap& bitmap = iBitmap->Bitmap();
+ iDisplay->DrawFrameL(&bitmap);
+ }
+
+ TInt currentFrame = iViewer->AnimationFrame();
+ if (currentFrame == 0)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reset mediatime");
+ // reset media time when looping
+ iMediaTime = 0;
+ }
+ iMediaTime += FrameDuration(currentFrame).Int();
+
+ // Media time has gone over duration if user has
+ // set media time explicitely to duration.
+ if (iMediaTime > iDuration)
+ {
+ iMediaTime = iDuration;
+ }
+
+ if (currentFrame == (iFrameCount - 1))
+ {
+ // End has been reached, so EndOfMedia is sent when
+ // duration of last frame has passed
+ iSendEndOfMediaOnNextFrame = ETrue;
+ }
+
+ // inform observer
+ if (iAnimationObserver)
+ {
+ iAnimationObserver->AnimationAdvancedL(iViewer->AnimationFrame(), iMediaTime);
+ }
+}
+
+void CMMAAnimationPlayer::StopL(TBool aPostEvent)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL +");
+ iViewer->Stop();
+ // adjust mediatime
+ if (aPostEvent)
+ {
+ PostLongEvent(CMMAPlayerEvent::EStopped, iMediaTime);
+ }
+ ChangeState(EPrefetched);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL -");
+}
+
+void CMMAAnimationPlayer::DeallocateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL +");
+ // If player is in starte state when deallocate is called,
+ // player is stopped from java side -> state is changed to
+ // prefetched.
+ if (iViewer)
+ {
+ if (iViewer->IsPlaying())
+ iViewer->Stop();
+
+ delete iViewer;
+ iViewer = NULL;
+ }
+
+ if (iState == EPrefetched)
+ {
+ ResetSourceStreams();
+ iEndReached = EFalse;
+ iSendEndOfMediaOnNextFrame = EFalse;
+ ChangeState(ERealized);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL -");
+}
+
+void CMMAAnimationPlayer::GetDuration(TInt64* aDuration)
+{
+ *aDuration = iDuration;
+}
+
+TInt CMMAAnimationPlayer::FindFrame(TInt64 aTime)
+{
+ __ASSERT_DEBUG(iImage, User::Invariant());
+
+ // if we are out of bounds
+ if (aTime > iDuration)
+ {
+ return KErrNotFound;
+ }
+
+ TInt64 time = 0;
+ TInt fIndex = 0;
+ while ((time < aTime) && (fIndex < iFrameCount))
+ {
+ time += FrameDuration(fIndex++).Int();
+ }
+
+ // adjust to previous frame
+ if (fIndex > 0)
+ {
+ fIndex--;
+ }
+
+ return fIndex;
+}
+
+TInt64 CMMAAnimationPlayer::MediaTimeForFrame(TInt aFrameIndex)
+{
+ __ASSERT_DEBUG((aFrameIndex <= iFrameCount) && (aFrameIndex >= 0),
+ User::Invariant());
+
+ TInt64 time = 0;
+ for (TInt fIndex = 0; fIndex < aFrameIndex; fIndex++)
+ {
+ time += FrameDuration(fIndex).Int();
+ }
+ return time;
+}
+
+TTimeIntervalMicroSeconds32 CMMAAnimationPlayer::FrameDuration(TInt aFrameIndex)
+{
+ __ASSERT_DEBUG(iImage, User::Invariant());
+ TTimeIntervalMicroSeconds32 fDur = iImage->AnimationFrameDelay(aFrameIndex);
+ const TTimeIntervalMicroSeconds32 KMMAMinimumFrameTime = 120000;
+
+ if (fDur < KMMAMinimumFrameTime)
+ {
+ fDur = KMMAMinimumFrameTime;
+ }
+ return fDur;
+}
+
+void CMMAAnimationPlayer::SetMediaTimeL(TInt64* aTime)
+{
+ if (!iImage && !iViewer)
+ {
+ // not yet prefetched
+ *aTime = KErrNotSupported;
+ }
+ else
+ {
+ // Media time of last frame is not the same as duration of
+ // media, so if media time of duration is requested, then it must
+ // be given out altough media time of last frame is lower than that.
+ if (*aTime >= iDuration)
+ {
+ User::LeaveIfError(iViewer->SetAnimationFrame(iFrameCount - 1));
+ iMediaTime = iDuration;
+ }
+ else
+ {
+ TInt frame = FindFrame(*aTime);
+ User::LeaveIfError(iViewer->SetAnimationFrame(frame));
+ iMediaTime = MediaTimeForFrame(frame);
+ }
+ *aTime = iMediaTime;
+ iEndReached = EFalse;
+ iSendEndOfMediaOnNextFrame = EFalse;
+ }
+
+}
+
+void CMMAAnimationPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ *aMediaTime = iMediaTime;
+}
+
+const TDesC& CMMAAnimationPlayer::Type()
+{
+ return KMMAVideoPlayer;
+}
+
+void CMMAAnimationPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ TRAPD(err, PrefetchDataL(aData));
+ if (err == KErrNone)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(err);
+ }
+}
+
+void CMMAAnimationPlayer::PrefetchFileL()
+{
+ iImage = IHLImageFactory::OpenFileImageL(iFSession, *iFileName);
+ PrepareViewerL();
+}
+
+void CMMAAnimationPlayer::PrefetchDataL(const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchDataL aData size %d",
+ aData.Size());
+
+ // Create source image from data
+ iImage = IHLImageFactory::OpenBufferedFileImageL(iFSession, aData);
+ PrepareViewerL();
+}
+
+TBool CMMAAnimationPlayer::IsFilePlayer()
+{
+ if (iFileName != NULL)
+ {
+ return ETrue;
+ }
+ return EFalse;
+}
+
+void CMMAAnimationPlayer::PrepareViewerL()
+{
+ // Non-animated gifs are not supported
+ if (!(iImage->IsAnimation()))
+ {
+ User::Leave(KErrNotSupported);
+ }
+
+ // Store image dimensions
+ iSourceSize = iImage->Size();
+
+ // Create destination bitmap
+ iBitmap = IHLBitmap::CreateL();
+ User::LeaveIfError(iBitmap->Create(iSourceSize, iImage->DisplayMode()));
+
+ // Create image viewer
+ iViewer = IHLViewerFactory::CreateImageViewerL(
+ iSourceSize,
+ *iImage, // source
+ *iBitmap, // destination
+ *this); // reference to MIHLViewerObserver
+
+ // Set viewer for window
+ iWindow->SetViewer(iViewer);
+
+ // Store animation frame count locally
+ iFrameCount = iViewer->AnimationFrameCount();
+
+ // calculate duration
+ iDuration = MediaTimeForFrame(iFrameCount);
+
+ // set media time to begin
+ iMediaTime = 0;
+
+ // If init has been already done
+ if (iDisplay)
+ {
+ iDisplay->SourceSizeChanged(iSourceSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+ }
+}
+
+MIHLImageViewer* CMMAAnimationPlayer::Viewer()
+{
+ return iViewer;
+}
+
+void CMMAAnimationPlayer::SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver)
+{
+ iAnimationObserver = aAnimationObserver;
+}
+
+TInt CMMAAnimationPlayer::SetRateL(TInt aRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::SetRateL");
+ if ((iState == EStarted) && (iCurrentRate != aRate))
+ {
+ if (aRate <= 0)
+ {
+ iViewer->Stop();
+ }
+ else
+ {
+ iViewer->Play();
+ }
+ }
+ iCurrentRate = aRate;
+ return iCurrentRate;
+}
+
+TInt CMMAAnimationPlayer::RateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::RateL");
+ return iCurrentRate;
+}
+
+void CMMAAnimationPlayer::SetDisplayL(MMMADisplay* aDisplay)
+{
+ // now it is ready to draw
+ iDisplay = aDisplay;
+ iDisplay->SetWindowL(iWindow);
+
+ // if state < prefeteched then we dont know actual source size yet
+ // and it will be set after prefetch
+ if (iState >= EPrefetched ||
+ (iFileName && iState == ERealized))
+ {
+ iDisplay->SourceSizeChanged(iSourceSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+ }
+}
+
+TSize CMMAAnimationPlayer::SourceSize()
+{
+ return iSourceSize;
+}
+
+void CMMAAnimationPlayer::NotifyWithStringEvent(
+ CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData)
+{
+ PostStringEvent(aEventType, aStringEventData);
+}
+
+MMMASnapshot* CMMAAnimationPlayer::SnapshoterL()
+{
+ return this;
+}
+
+MMMASnapshot::TEncoding CMMAAnimationPlayer::TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& /*aSize*/,
+ const CMMAImageSettings& /*aSettings*/)
+{
+ if (iBitmap)
+ {
+ // Bitmap has to be copied to get ownership of the bitmap instance.
+ iSnapshotBitmap = IHLBitmapUtil::CopyBitmapL(iBitmap->Bitmap());
+ }
+ else
+ {
+ // When content comes from a stream, iBitmap is not available
+ // until prefetched state is entered. In this case an empty bitmap
+ // is returned instead.
+ iSnapshotBitmap = new(ELeave) CFbsBitmap();
+ }
+ // notify the caller, error code or KErrNone
+ User::RequestComplete(aStatus, KErrNone);
+
+ // Return raw bitmap encoding and thus SnapshotEncoded() should not
+ // get called later on.
+ return EBitmap;
+}
+
+CFbsBitmap* CMMAAnimationPlayer::SnapshotBitmap()
+{
+ CFbsBitmap* bitmap = iSnapshotBitmap;
+ // ownership is transferred to caller
+ iSnapshotBitmap = NULL;
+ return bitmap;
+}
+
+HBufC8* CMMAAnimationPlayer::SnapshotEncoded()
+{
+ // This method should never be called.
+ // Asserted in debug build to be sure.
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+
+ return NULL;
+}
+
+void CMMAAnimationPlayer::ViewerBitmapChangedL()
+{
+ if (iState == EStarted)
+ {
+ ProcessCurrentFrameL();
+ }
+}
+
+void CMMAAnimationPlayer::ViewerError(TInt /*aError*/)
+{
+ // Not implemented currently because
+ // not implemented by IHL either.
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating animation player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideocontrol.h"
+#include "cmmaanimationratecontrol.h"
+#include "cmmaanimationstoptimecontrol.h"
+#include "cmmaanimationframepositioningcontrol.h"
+#include "cmmaanimationplayer.h"
+#include "cmmaanimationplayerfactory.h"
+
+// Animation type info
+_LIT(KMMAAnimationMimeTypeGIF, "image/gif");
+_LIT(KMMAAnimationSuffixGIF, "gif");
+
+// header data and length
+_LIT8(KMMAAnimationGIFVersion, "GIF89a");
+const TUint8 KMMAGifVersionLength = 6;
+
+CMMAAnimationPlayerFactory* CMMAAnimationPlayerFactory::NewLC()
+{
+ CMMAAnimationPlayerFactory* pFactory =
+ new(ELeave) CMMAAnimationPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAAnimationPlayerFactory::CMMAAnimationPlayerFactory()
+{
+}
+
+
+CMMAAnimationPlayerFactory::~CMMAAnimationPlayerFactory()
+{
+}
+
+// Creates new player according to a content type.
+CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
+ const TDesC& aContentType)
+{
+ CMMAPlayer* player = NULL;
+ if (aContentType == KMMAAnimationMimeTypeGIF)
+ {
+ player = CreateAnimationPlayerL();
+ }
+ return player;
+}
+
+// Creates new player according to a locator
+CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& /*aParameters*/)
+{
+ CMMAPlayer* player = NULL;
+ if (aProtocol == KMMAFileProtocol)
+ {
+ // filename ends to gif suffix
+ if (aMiddlePart.Right(KMMAAnimationSuffixGIF().Length()) ==
+ KMMAAnimationSuffixGIF())
+ {
+ player = CreateAnimationPlayerL(aMiddlePart);
+ }
+ else
+ {
+ // try to recognize from headerdata
+ RFs fs;
+ CleanupClose< RFs >::PushL(fs);
+ User::LeaveIfError(fs.Connect());
+
+ RFile file;
+ CleanupClose< RFile >::PushL(file);
+
+ User::LeaveIfError(file.Open(fs, aMiddlePart, EFileRead));
+
+ TBuf8< KMMAGifVersionLength > header;
+ User::LeaveIfError(file.Read(header));
+
+ CleanupStack::PopAndDestroy(2); // fs, file
+
+ if (header == KMMAAnimationGIFVersion())
+ {
+ player = CreateAnimationPlayerL(aMiddlePart);
+ }
+ }
+ }
+
+ return (CMMAPlayer*) player;
+}
+
+// Creates new player according to a header data
+CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
+ const TDesC8& aHeaderData)
+{
+ CMMAPlayer* player = NULL;
+ TPtrC8 header = aHeaderData.Left(KMMAAnimationGIFVersion().Length());
+ if (header == KMMAAnimationGIFVersion())
+ {
+ player = CreateAnimationPlayerL();
+ }
+ return player;
+}
+
+// Gets player's supported content types.
+void CMMAAnimationPlayerFactory::GetSupportedContentTypesL(
+ const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray)
+{
+ if (aProtocol == KNullDesC ||
+ aProtocol == KMMAHttpProtocol ||
+ aProtocol == KMMAHttpsProtocol ||
+ aProtocol == KMMAFileProtocol)
+ {
+ aMimeTypeArray.AppendL(KMMAAnimationMimeTypeGIF);
+ }
+}
+
+// Gets player's supported protocols for the content type.
+void CMMAAnimationPlayerFactory::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ if (aContentType == KNullDesC ||
+ aContentType == KMMAAnimationMimeTypeGIF)
+ {
+ aProtocolArray.AppendL(KMMAHttpProtocol);
+ aProtocolArray.AppendL(KMMAHttpsProtocol);
+ aProtocolArray.AppendL(KMMAFileProtocol);
+ }
+}
+
+CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL(const TDesC& aFileName)
+{
+ CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC(aFileName);
+ AddControlsL(player);
+ CleanupStack::Pop(); // player
+ return player;
+}
+
+CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL()
+{
+ CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC();
+ AddControlsL(player);
+ CleanupStack::Pop(); // player
+ return player;
+}
+
+void CMMAAnimationPlayerFactory::AddControlsL(CMMAAnimationPlayer* aPlayer)
+{
+ CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(aPlayer);
+ CleanupStack::PushL(videoControl);
+ aPlayer->AddControlL(videoControl);
+ CleanupStack::Pop(videoControl);
+
+ CMMAAnimationStopTimeControl* stopTimeControl =
+ CMMAAnimationStopTimeControl::NewL(aPlayer);
+ CleanupStack::PushL(stopTimeControl);
+ aPlayer->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ // Own RateControl
+ CMMAAnimationRateControl* rateControl =
+ CMMAAnimationRateControl::NewL(aPlayer);
+ CleanupStack::PushL(rateControl);
+ aPlayer->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+
+ // FramePositioningControl is only supported for file locator
+ if (aPlayer->IsFilePlayer())
+ {
+ CMMAAnimationFramePositioningControl* animationFramePositioningControl =
+ CMMAAnimationFramePositioningControl::NewL(aPlayer);
+ CleanupStack::PushL(animationFramePositioningControl);
+ aPlayer->AddControlL(animationFramePositioningControl);
+ CleanupStack::Pop(animationFramePositioningControl);
+ }
+
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmaanimationratecontrol.h"
+#include "cmmaanimationplayer.h"
+
+
+// -----------------------------------------------------------------------------
+// CMMAAnimationRateControl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMMAAnimationRateControl* CMMAAnimationRateControl::NewL(CMMAAnimationPlayer* aPlayer)
+{
+ CMMAAnimationRateControl* self = new(ELeave) CMMAAnimationRateControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMMAAnimationRateControl::CMMAAnimationRateControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMMAAnimationRateControl::CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::CMMAAnimationRateControl");
+ iPlayer = aPlayer;
+}
+
+// Destructor
+CMMAAnimationRateControl::~CMMAAnimationRateControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::~CMMAAnimationRateControl");
+}
+
+// -----------------------------------------------------------------------------
+// CMMAAnimationRateControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMMAAnimationRateControl::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::ConstructL");
+ iPlayer->SetRateL(KMMADefaultRate);
+}
+
+// -----------------------------------------------------------------------------
+// CMMAAnimationRateControl::SetRateL
+// Set rate to minimum or default rate depending on parameter. Informs player
+// that rate has changed. Returns set rate.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CMMAAnimationRateControl::SetRateL(TInt aRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::SetRateL");
+ TInt rate = aRate;
+
+ if (rate <= KMMAMinRate)
+ {
+ rate = KMMAMinRate;
+ }
+ else
+ {
+ rate = KMMADefaultRate;
+ }
+ return iPlayer->SetRateL(rate);
+}
+
+// -----------------------------------------------------------------------------
+// CMMAAnimationRateControl::RateL
+// Returns current rate.
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CMMAAnimationRateControl::RateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::RateL");
+ return iPlayer->RateL();
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationstoptimecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32std.h>
+
+#include "cmmaanimationstoptimecontrol.h"
+#include "cmmaplayer.h"
+
+CMMAAnimationStopTimeControl* CMMAAnimationStopTimeControl::NewL(CMMAAnimationPlayer* aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::NewL");
+ CMMAAnimationStopTimeControl* control =
+ new(ELeave) CMMAAnimationStopTimeControl(aPlayer);
+ aPlayer->SetAnimationObserver(control);
+ return control;
+}
+
+
+CMMAAnimationStopTimeControl::~CMMAAnimationStopTimeControl()
+{
+}
+
+
+CMMAAnimationStopTimeControl::CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer)
+ : CMMAStopTimeControl(aPlayer)
+{
+}
+
+void CMMAAnimationStopTimeControl::SetStopTimeL(const TInt64& aTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::SetStopTimeL");
+ iStopTime = aTime;
+}
+
+void CMMAAnimationStopTimeControl::AnimationAdvancedL(TInt /*aFrame*/, TInt64 aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::AnimationAdvancedL");
+ if (aMediaTime > iStopTime)
+ {
+ iPlayer->StopL(EFalse);
+ iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, aMediaTime);
+ iStopTime = iNoTimer;
+ }
+}
+
+
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationwindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This abstract class implements MMMADisplayWindow functionality
+* in CFbsBitmap based displays.
+*
+*/
+
+
+// Include Files
+#include <logger.h>
+#include <bitdev.h>
+#include "cmmaanimationwindow.h"
+
+// Destructor (virtual by CBase)
+CMMAAnimationWindow::~CMMAAnimationWindow()
+{
+ delete iBitContext;
+}
+
+CMMAAnimationWindow* CMMAAnimationWindow::NewL(
+ MMAFunctionServer* aEventSource)
+{
+ CMMAAnimationWindow* self =
+ new(ELeave)CMMAAnimationWindow(aEventSource);
+ return self;
+}
+
+CMMAAnimationWindow::CMMAAnimationWindow(MMAFunctionServer* aEventSource):
+ iEventSource(aEventSource)
+{
+}
+
+void CMMAAnimationWindow::SetViewer(MIHLImageViewer* aViewer)
+{
+ iViewer = aViewer;
+}
+
+void CMMAAnimationWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
+{
+ CMMABitmapWindow::SetDestinationBitmapL(aBitmap);
+ User::LeaveIfError(iBitmapDevice->CreateBitmapContext(iBitContext));
+}
+
+void CMMAAnimationWindow::DrawFrameL(const CFbsBitmap* aBitmap)
+{
+ if (iBitmap)
+ {
+ iBitContext->BitBlt(iDrawRect.iTl, aBitmap);
+ }
+}
+
+// Local wrapper function to SetDrawRect method
+LOCAL_C void StaticSetDrawRect(
+ CMMAAnimationWindow* aWindow,
+ const TRect* aRect)
+{
+ aWindow->SetDrawRect(*aRect);
+}
+
+void CMMAAnimationWindow::SetDrawRect(const TRect& aRect)
+{
+ iDrawRect = aRect;
+ if (iViewer)
+ {
+ TReal zoomRatio = 1.0;
+ if ((iViewer->SourceSize().iWidth - aRect.Width()) >
+ (iViewer->SourceSize().iHeight - aRect.Height()))
+ {
+ // calculate zoom ratio from width
+ zoomRatio = (TReal)aRect.Width() / (TReal)iViewer->SourceSize().iWidth;
+ }
+ else
+ {
+ // calculate zoom ratio from height
+ zoomRatio = (TReal)aRect.Height() / (TReal)iViewer->SourceSize().iHeight;
+ }
+
+ iViewer->SetViewerSize(iDrawRect.Size());
+ iViewer->SetZoomRatio(zoomRatio);
+ }
+}
+
+void CMMAAnimationWindow::SetDrawRectThread(const TRect& aRect)
+{
+ iEventSource->ExecuteV(&StaticSetDrawRect,
+ this,
+ &aRect);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreammetadatacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAAudioStreamMetaDataControl is a concrete class for getting
+* metadata from an audio media.
+*
+*/
+
+#ifndef CMMAAUDIOSTREAMMETADATACONTROL_H
+#define CMMAAUDIOSTREAMMETADATACONTROL_H
+
+// INCLUDES
+#include <mmfcontroller.h>
+#include <MetaDataUtility.h>
+#include <MetaDataFieldContainer.h>
+#include "cmmametadatacontrol.h"
+
+// Constants
+_LIT(KMetaDataSongTitle, "title");
+_LIT(KMetaDataArtist, "author");
+_LIT(KMetaDataAlbum, "album");
+_LIT(KMetaDataYear, "year of recording");
+_LIT(KMetaDataComment, "comment");
+_LIT(KMetaDataAlbumTrack, "album track");
+_LIT(KMetaDataGenre, "genre");
+_LIT(KMetaDataComposer, "composer");
+_LIT(KMetaDataCopyright, "copyright");
+_LIT(KMetaDataOriginalArtist, "original artist");
+_LIT(KMetaDataUrl, "url");
+_LIT(KMetaDataUserUrl, "user url");
+_LIT(KMetaDataJpeg, "front jpeg");
+_LIT(KMetaDataVendor, "vendor");
+_LIT(KMetaDataRating, "rating");
+_LIT(KMetaDataUniqueFileIdentifier, "unique file identifier");
+_LIT(KMetaDataDuration, "duration");
+_LIT(KMetaDataDate, "date");
+
+const TInt KKeyStringMaxLength = 60;
+
+
+// CLASS DECLARATION
+/**
+* This is a concrete class for getting metadata from an audio media.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioStreamMetaDataControl): public CMMAMetaDataControl
+{
+public:
+ CMMAAudioStreamMetaDataControl(CMetaDataUtility* aMetadaDataUtility);
+ ~CMMAAudioStreamMetaDataControl();
+
+protected: // from CMMAMetaDataControl
+
+ TInt KeyCountL();
+ HBufC* KeyL(TInt aIndex);
+
+ HBufC* KeyValueL(const TDesC& aKey);
+
+private: // new methods
+ HBufC* GetKeyL(TMetaDataFieldId aFieldId);
+ TMetaDataFieldId GetFieldId(const TDesC& aKey, TBool& aCompare);
+
+private: // data owned
+ CMetaDataUtility* iMetaDataUtility;
+
+};
+
+#endif // CMMAAUDIOSTREAMMETADATACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreamplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for streaming audio.
+*
+*/
+
+#ifndef CMMAAUDIOSTREAMPLAYER_H
+#define CMMAAUDIOSTREAMPLAYER_H
+
+// INCLUDES
+#include "cmmaemcaudioplayer.h"
+#include "mmmastreamhandlerlistener.h"
+#include "cmmaemcresolver.h"
+#include <MetaDataUtility.h>
+
+class CMMADataSourceStream;
+class CMMAStreamHandler;
+
+
+// CLASS DECLARATION
+/**
+* This class is used for playing audio from stream source.
+*/
+NONSHARABLE_CLASS(CMMAAudioStreamPlayer): public CMMAEMCAudioPlayer,
+ public MMMAStreamHandlerListener
+{
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAAudioStreamPlayer* NewLC(
+ CMMAEMCResolver* aResolver);
+
+ // Destructor
+ ~CMMAAudioStreamPlayer();
+
+protected:
+ // C++ constructor
+ CMMAAudioStreamPlayer(CMMAEMCResolver* aResolver);
+ void ConstructL();
+
+private: // New methods
+
+ /**
+ * Starts playback and posts started event.
+ */
+ void PrivateStartL();
+
+public: // New methods
+ /**
+ * Pause playback without sending stopped event or changing state
+ */
+ TInt Pause();
+
+public: // from CMMAPlayer
+ void DeallocateL();
+ void StartL();
+ void PrefetchL();
+ CMMASourceStream* AddSourceStreamL(JNIEnv* aJNIEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader);
+
+ void GetDuration(TInt64* aDuration);
+ void StopL(TBool aPostEvent);
+
+protected: // From CMMAEMCAudioPlayer
+ void PlayCompleteL(TInt aError);
+
+public:
+ void AddDataSourceToStreamL();
+ void CreateStreamL();
+ CMetaDataUtility* MetaDataUtilityOwnership();
+
+public: // from MMMAStreamHandlerListener
+ void PrepareComplete(TInt aError);
+ void StartComplete(TInt aError);
+ void HandleError(TInt aError);
+
+public: // from MControlObserver
+ void Event(MControl* aControl,
+ TUint aEventType,
+ TAny* aEventObject);
+
+private: // data
+ // owned stream handler
+ CMMAStreamHandler* iStreamHandler;
+
+ // controller's state, prime panics if called twice
+ TBool iControllerPrimed;
+
+ // created here and ownership is transferred to
+ // CMMAAudioStreamMetaDataControl by call to
+ // MetaDataUtilityOwnership()
+ CMetaDataUtility* iMetaDataUtility;
+};
+
+#endif // CMMAAUDIOSTREAMPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmaaudiostreamplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating stream player.
+*
+*/
+
+
+#ifndef CMMAAUDIOSTREAMPLAYERFACTORY_H
+#define CMMAAUDIOSTREAMPLAYERFACTORY_H
+
+// INCLUDES
+#include "cmmaemcplayerfactory.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating stream player.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAAudioStreamPlayerFactory): public CMMAEMCPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAAudioStreamPlayerFactory* NewLC();
+ ~CMMAAudioStreamPlayerFactory();
+
+private: // Constructor
+ CMMAAudioStreamPlayerFactory();
+
+public: // From CMMAEMCPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& /*aContentType*/);
+ CMMAPlayer* CreatePlayerL(const TDesC8& /*aHeaderData*/);
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+ CMMAPlayer* CreatePlayerL(
+ CMMAEMCResolver* aResolver);
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+public: // new method
+ void SetSourceInfoL(const TUint8* aHeader, TInt aLength);
+
+private: // Data, owned
+ HBufC8* iHeaderData;
+ //
+
+
+};
+
+#endif // CMMAAUDIOSTREAMPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmastreamhandler.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Streams data from Java to controller
+*
+*/
+
+#ifndef CMMASTREAMHANDLER_H
+#define CMMASTREAMHANDLER_H
+
+// INCLUDES
+#include "cmmastreamrequest.h"
+#include "mmmastreamrequestlistener.h"
+#include "mmmastreamhandlerlistener.h"
+#include <MDUChunkDataObserver.h>
+#include <MetaDataUtility.h>
+
+//EMC
+#include "StreamControl.h"
+#include "MMControlFactory.h"
+#include "DataBufferSource.h"
+#include "DataBuffer.h"
+#include "SinkControl.h"
+#include "StreamControlObserver.h"
+#include "SourceControlObserver.h"
+
+
+using namespace multimedia;
+using multimedia ::MStreamControl;
+using multimedia ::MDataBufferSource;
+using multimedia ::MDataBuffer;
+using multimedia ::CMultimediaFactory;
+using multimedia ::MSinkControl;
+using multimedia::MSourceControlObserver;
+using multimedia::MStreamControlObserver;
+using multimedia::MBufferProcessedEvent;
+
+//End EMC
+
+
+// CONSTANTS
+const TInt KMMAStreamHandlerBufferCount = 2;
+
+class CMMADataSourceStream;
+
+// CLASS DECLARATION
+/**
+* This class read data from CMMADataSourceStream and writes it to
+* controller.
+*/
+NONSHARABLE_CLASS(CMMAStreamHandler): public CBase, public MControlObserver,
+ public MMMAStreamRequestListener, public MMDUChunkDataObserver
+{
+private:
+ // Streams internal state
+ enum TMMAStreamState
+ {
+ EMMAStreamPrepare = 0,
+ EMMAStreamPaused,
+ EMMAStreamStart,
+ EMMAStreamStarted,
+ EMMAStreamEof
+ };
+
+ // chunk data processed state
+ enum TMMAProcessedState
+ {
+ EMMANoneProcessed = 0,
+ EMMAMetaDataProcessed,
+ EMMABufferProcessed,
+ EMMABothProcessed
+ };
+
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAStreamHandler* NewL(
+ MMMAStreamHandlerListener& aListener,
+ MStreamControl& aMStreamControl,
+ MDataBufferSource& aMDataBufferSource,
+ CMultimediaFactory& aFactory,
+ CMetaDataUtility& aMetaDataUtility);
+
+ // Destructor
+ ~CMMAStreamHandler();
+
+protected:
+ // C++ constructor
+ CMMAStreamHandler(MMMAStreamHandlerListener& aResolver,
+ MStreamControl& aMStreamControl,
+ MDataBufferSource& aMDataBufferSource,
+ CMultimediaFactory& aFactory,
+ CMetaDataUtility& aMetaDataUtility);
+ void ConstructL();
+
+protected: // New methods
+
+public: // New methods
+ /**
+ * Prepares stream to play.
+ */
+ void Prepare(const TDesC8& aMimeType);
+
+ /**
+ * Stops handling requests. After this call data received from source
+ * stream will be buffered until StartL is called.
+ */
+ void Pause();
+
+ /**
+ * Stops handling requests and frees already read data
+ * without playing it.
+ */
+ void Stop();
+
+ /**
+ * Starts handling requests
+ */
+ void Start();
+
+ /**
+ * Sets source stream to read
+ */
+ void SetSourceStream(CMMADataSourceStream* aSourceStream);
+
+public: // From MMMAStreamRequestListener
+ void WriteComplete(CMMAStreamRequest* aRequest);
+ void ReadComplete(CMMAStreamRequest* aRequest);
+ void HandleError(CMMAStreamRequest* aRequest,
+ TInt aError);
+
+public: // from MControlObserver
+ void Event(MControl* aControl,
+ TUint aEventType,
+ TAny* aEventObject);
+ TBool LastBufferWritten();
+
+public: // from MMDUChunkDataObserver
+ void HandleChunkDataProcessed(TInt aError);
+ void HandleChunkDataReadyToBeParsed();
+ void HandleChunkDataComplete(TInt aError);
+
+private:
+ /**
+ * Writes request to controller
+ */
+ void WriteRequest(CMMAStreamRequest* aRequest);
+
+private: // data
+ // Owned write requests
+ RPointerArray< CMMAStreamRequest > iRequests;
+
+ CMMAStreamRequest* iCurrentRequest;
+
+ // not owned source stream
+ CMMADataSourceStream* iSourceStream;
+
+ // EMC
+ // not owned
+ MStreamControl& iMStreamControl;
+ MDataBufferSource& iMDataBufferSource;
+ CMultimediaFactory& iFactory;
+
+ // owned
+ MDataBuffer *iBuffer;
+ TBool iLastBufferWritten;
+ //
+
+ // not owned listener
+ MMMAStreamHandlerListener& iListener;
+
+ // not owned
+ CMetaDataUtility& iMetaDataUtility;
+
+ // Stream's state
+ TMMAStreamState iState;
+
+ // Processed state of current chunk data
+ TMMAProcessedState iProcessedState;
+
+ // tells if metadata parsing can be started
+ TBool iMetaDataReadyToBeParsed;
+
+ // to be removed once MDU supports all the reqd formats
+ TBool iMimeTypeSupportedByMDU;
+};
+
+#endif // CMMASTREAMHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.emc/cmmastreamrequest.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Request used to write or read data
+*
+*/
+
+#ifndef CMMASTREAMREQUEST_H
+#define CMMASTREAMREQUEST_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mmmastreamrequestlistener.h"
+
+// CONSTANTS
+const TInt KMMAStreamRequestBufferSize = 5120;
+
+/**
+ * - If IsActive returns ETrue, data is procedded in the server.
+ * - If IsActive returns EFalse and DataPtr is empty request is
+ * ready for reuse
+ * - If IsActive returns EFalse and DataPtr is not empty request
+ * is waiting to be written.
+ */
+class CMMAStreamRequest: public CBase
+{
+public:// Constructor and destructor
+ /**
+ * @param aListener will be informed when request completes
+ */
+ static CMMAStreamRequest* NewLC(MMMAStreamRequestListener* aListener);
+
+ /**
+ * Destructor
+ */
+ ~CMMAStreamRequest();
+
+public: // new methods
+ /**
+ * @return TPtr to request's data
+ */
+ TPtr8& DataPtr();
+
+ /**
+ * Completes read request.
+ * @param aError system error code
+ */
+ void CompleteRead(TInt aError);
+
+ /**
+ * MMMAStreamRequestListener will be informed when request is ready.
+ */
+ void SetActive(TBool iActive);
+ TBool IsActive();
+
+ /**
+ * 1 if this is stream's last buffer
+ * @return reference to request buffer
+ */
+ TPckgBuf< TInt >& RequestBuffer();
+public:
+ void WriteRequestComplete(TInt Err);
+
+private: // Constructor
+ CMMAStreamRequest(MMMAStreamRequestListener* aListener);
+ void ConstructL();
+private: // Data
+ // will be informed when request is complete
+ MMMAStreamRequestListener* iListener;
+
+ // owned data
+ HBufC8* iData;
+
+ // ptr to iData or NULL if data is processed.
+ TPtr8 iDataPtr;
+
+ // Request buffer
+ TPckgBuf< TInt > iRequestBuffer;
+
+ // Status of the buffer
+ TBool iActive;
+};
+
+#endif // CMMASTREAMREQUEST_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.mmf/CMMAAudioStreamPlayerFactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating stream player.
+*
+*/
+
+
+#ifndef CMMAAUDIOSTREAMPLAYERFACTORY_H
+#define CMMAAUDIOSTREAMPLAYERFACTORY_H
+
+// INCLUDES
+#include "CMMAMMFPlayerFactory.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating stream player.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAAudioStreamPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAAudioStreamPlayerFactory* NewLC();
+ ~CMMAAudioStreamPlayerFactory();
+
+private: // Constructor
+ CMMAAudioStreamPlayerFactory();
+
+public: // From CMMAMMFPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& /*aContentType*/);
+ CMMAPlayer* CreatePlayerL(const TDesC8& /*aHeaderData*/);
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+
+
+};
+
+#endif // CMMAAUDIOSTREAMPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.mmf/cmmaaudiostreamplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for streaming audio.
+*
+*/
+
+#ifndef CMMAAUDIOSTREAMPLAYER_H
+#define CMMAAUDIOSTREAMPLAYER_H
+
+// INCLUDES
+#include "CMMAAudioPlayer.h"
+#include "MMMAStreamHandlerListener.h"
+
+class CMMADataSourceStream;
+class CMMAStreamHandler;
+
+
+// CLASS DECLARATION
+/**
+* This class is used for playing audio from stream source.
+*/
+NONSHARABLE_CLASS(CMMAAudioStreamPlayer): public CMMAAudioPlayer,
+ public MMMAStreamHandlerListener
+{
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAAudioStreamPlayer* NewLC(
+ CMMAMMFResolver* aResolver);
+
+ // Destructor
+ ~CMMAAudioStreamPlayer();
+
+protected:
+ // C++ constructor
+ CMMAAudioStreamPlayer(CMMAMMFResolver* aResolver);
+ void ConstructL();
+
+private: // New methods
+ /**
+ * Loops through iControllerInfos and tries to open those
+ * @param aSourceUid Data source uid
+ * @param aSourceData Data for source
+ * @param aSinkUid Data sink uid
+ * @param aSinkData Data for sink.
+ * @param aPrioritySettings Controller's priority.
+ * @return KErrNone if controller was opened
+ */
+ TInt DoOpen(TUid aSourceUid,
+ const TDesC8& aSourceData,
+ TUid aSinkUid,
+ const TDesC8& aSinkData,
+ TMMFPrioritySettings aPrioritySettings);
+
+ /**
+ * Starts playback and posts started event.
+ */
+ void PrivateStartL();
+
+public: // New methods
+ /**
+ * Pause playback without sending stopped event or changing state
+ */
+ TInt Pause();
+
+public: // from CMMAPlayer
+ void StartL();
+ void PrefetchL();
+ CMMASourceStream* AddSourceStreamL(JNIEnv* aJNIEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader);
+ void GetDuration(TInt64* aDuration);
+ void StopL(TBool aPostEvent);
+
+protected: // From CMMAAudioPlayer
+ void PlayCompleteL(TInt aError);
+
+public: // from MMMAStreamHandlerListener
+ void PrepareComplete(TInt aError);
+ void StartComplete(TInt aError);
+ void HandleError(TInt aError);
+
+private: // data
+ // owned stream handler
+ CMMAStreamHandler* iStreamHandler;
+
+ // controller's state, prime panics if called twice
+ TBool iControllerPrimed;
+};
+
+#endif // CMMAAUDIOSTREAMPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.mmf/cmmastreamhandler.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Streams data from Java to controller
+*
+*/
+
+#ifndef CMMASTREAMHANDLER_H
+#define CMMASTREAMHANDLER_H
+
+// INCLUDES
+#include <mmf/common/mmfcontroller.h>
+#include "CMMAStreamRequest.h"
+#include "MMMAStreamRequestListener.h"
+#include "MMMAStreamHandlerListener.h"
+
+
+// CONSTANTS
+const TInt KMMAStreamHandlerBufferCount = 2;
+
+class CMMADataSourceStream;
+
+// CLASS DECLARATION
+/**
+* This class read data from CMMADataSourceStream and writes it to
+* controller.
+*/
+NONSHARABLE_CLASS(CMMAStreamHandler): public CBase,
+ public MMMAStreamRequestListener
+{
+private:
+ // Streams internal state
+ enum TMMAStreamState
+ {
+ EMMAStreamPrepare = 0,
+ EMMAStreamPaused,
+ EMMAStreamStart,
+ EMMAStreamStarted,
+ EMMAStreamEof
+ };
+
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAStreamHandler* NewL(
+ MMMAStreamHandlerListener& aListener,
+ RMMFController& aController);
+
+ // Destructor
+ ~CMMAStreamHandler();
+
+protected:
+ // C++ constructor
+ CMMAStreamHandler(MMMAStreamHandlerListener& aResolver,
+ RMMFController& aController);
+ void ConstructL();
+
+protected: // New methods
+
+public: // New methods
+ /**
+ * Prepares stream to play.
+ */
+ void PrepareL();
+
+ /**
+ * Stops handling requests. After this call data received from source
+ * stream will be buffered until StartL is called.
+ */
+ void Pause();
+
+ /**
+ * Starts handling requests
+ */
+ void StartL();
+
+ /**
+ * Data sink destination must be written to this reference
+ * before stream can be started.
+ * @return data sink destination reference
+ */
+ TMMFMessageDestination& MessageDestination();
+
+ /**
+ * Sets source stream to read
+ */
+ void SetSourceStream(CMMADataSourceStream* aSourceStream);
+
+public: // From MMMAStreamRequestListener
+ void WriteComplete(CMMAStreamRequest* aRequest);
+ void ReadComplete(CMMAStreamRequest* aRequest);
+ void HandleError(CMMAStreamRequest* aRequest,
+ TInt aError);
+private:
+ /**
+ * Writes request to controller
+ */
+ void WriteRequest(CMMAStreamRequest* aRequest);
+
+private: // data
+ // Owned write requests
+ RPointerArray< CMMAStreamRequest > iRequests;
+
+ // not owned source stream
+ CMMADataSourceStream* iSourceStream;
+
+ // Controller to write stream
+ RMMFController& iController;
+
+ // added data source
+ TMMFMessageDestination iDataSourceHandle;
+
+ // not owned listener
+ MMMAStreamHandlerListener& iListener;
+
+ // Stream's state
+ TMMAStreamState iState;
+};
+
+#endif // CMMASTREAMHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc.mmf/cmmastreamrequest.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Request used to write or read data
+*
+*/
+
+#ifndef CMMASTREAMREQUEST_H
+#define CMMASTREAMREQUEST_H
+
+// INCLUDES
+#include <e32base.h>
+#include "MMMAStreamRequestListener.h"
+
+// CONSTANTS
+const TInt KMMAStreamRequestBufferSize = 5120;
+
+/**
+ * - If CActive::IsActive returns ETrue, data is procedded in the server.
+ * - If CActive::IsActive returns EFalse and DataPtr is empty request is
+ * ready for reuse
+ * - If CActive::IsActive returns EFalse and DataPtr is not empty request
+ * is waiting to be written.
+ */
+class CMMAStreamRequest: public CActive
+{
+public:// Constructor and destructor
+ /**
+ * @param aListener will be informed when request completes
+ */
+ static CMMAStreamRequest* NewLC(MMMAStreamRequestListener* aListener);
+
+ /**
+ * Destructor
+ */
+ ~CMMAStreamRequest();
+
+public: // new methods
+ /**
+ * @return TPtr to request's data
+ */
+ TPtr8& DataPtr();
+
+ /**
+ * Completes read request.
+ * @param aError system error code
+ */
+ void CompleteRead(TInt aError);
+
+ /**
+ * MMMAStreamRequestListener will be informed when request is ready.
+ */
+ void SetActive();
+
+ /**
+ * 1 if this is stream's last buffer
+ * @return reference to request buffer
+ */
+ TPckgBuf< TInt >& RequestBuffer();
+public: // From CActive
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+private: // Constructor
+ CMMAStreamRequest(MMMAStreamRequestListener* aListener);
+ void ConstructL();
+private: // Data
+ // will be informed when request is complete
+ MMMAStreamRequestListener* iListener;
+
+ // owned data
+ HBufC8* iData;
+
+ // ptr to iData or NULL if data is processed.
+ TPtr8 iDataPtr;
+
+ // Request buffer
+ TPckgBuf< TInt > iRequestBuffer;
+};
+
+#endif // CMMASTREAMREQUEST_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc/cmmaaudiostreamratecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements RateControl for HTTP stream audio player.
+*
+*/
+
+
+#ifndef CMMAAUDIOSTREAMRATECONTROL_H
+#define CMMAAUDIOSTREAMRATECONTROL_H
+
+// INTERNAL INCLUDES
+#include "cmmaratecontrol.h" // base class
+#include "cmmaaudiostreamplayer.h"
+
+// CLASS DECLARATION
+/**
+* This class implements RateControl for http stream audio player.
+*
+*/
+NONSHARABLE_CLASS(CMMAAudioStreamRateControl): public CMMARateControl,
+ public MMMAPlayerStateListener
+{
+public:
+
+ static CMMAAudioStreamRateControl* NewL(
+ CMMAAudioStreamPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAAudioStreamRateControl();
+
+protected:
+
+ /**
+ * Constructor.
+ */
+ CMMAAudioStreamRateControl(CMMAAudioStreamPlayer* aPlayer);
+
+ void ConstructL();
+
+public: // from MMMAPlayerStateListener
+ virtual void StateChanged(TInt aState);
+
+public: // New methods
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ virtual TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ virtual TInt RateL();
+
+
+private: // Member data
+
+ /**
+ * Used to obtain RMMFController reference to stop/start
+ * playback.
+ */
+ CMMAAudioStreamPlayer* iPlayer;
+
+ /**
+ * Hold current rate value.
+ */
+ TInt iCurrentRate;
+
+};
+
+#endif // CMMAAUDIOSTREAMRATECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc/cmmadatasourcestream.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class for reading data from Java SourceStream to native side
+*
+*/
+
+
+#ifndef CMMADATASOURCESTREAM_H
+#define CMMADATASOURCESTREAM_H
+
+#include "cmmasourcestream.h"
+
+class CMMADataSourceStreamEvent;
+class MMMASourceStreamListener;
+class MMMAEventPoster;
+class CMMAStreamRequest;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+* Class for reading data from Java SourceStream to native side
+*
+*/
+NONSHARABLE_CLASS(CMMADataSourceStream): public CMMASourceStream
+{
+public: // Constructors and destructors
+ /**
+ * Object creation. Static method.
+ *
+ * @param aJNIEnv handle to used jni environment
+ * @param aEventPoster handle to event poster
+ * @param aJavaSourceStream handle to java SourceStream object
+ * @param aListener Handle to source stream listener
+ *
+ * @return CMMADataSourceStream object
+ */
+ static CMMADataSourceStream* NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener,
+ MMAFunctionServer* aEventSource);
+
+ /**
+ * Deletes owned objects
+ */
+ ~CMMADataSourceStream(); // Destructor
+
+public: // New methods
+ /**
+ * Reads data from Java
+ */
+ void Read(CMMAStreamRequest* aRequest);
+
+ /**
+ * @return readed request
+ */
+ CMMAStreamRequest* Request();
+
+public: // From CMMASourceStream
+
+ /**
+ * Overwrites CMMASourceStream's ResetData
+ * so iData will not be NULL, does nothing
+ */
+ void ResetData();
+
+protected: // Constructors and destructors
+
+ /**
+ * Set variables
+ * @param aEventPoster handle to event poster
+ * @param aListener handle to source stream listener
+ */
+ CMMADataSourceStream(MMMAEventPoster* aEventPoster,
+ MMMASourceStreamListener* aListener);
+
+ /**
+ * 2nd phase constructor
+ *
+ * @param aJNIEnv used jni environment
+ * @param aJavaSourceStream handle to java source stream object
+ */
+ void ConstructL(JNIEnv* aJNIEnv, MMAFunctionServer* aEventSource,jobject aJavaSourceStream);
+
+
+protected: // From CMMASourceStream
+
+ void WriteL(const TUint8* aData,
+ TInt aLength, TInt aState);
+
+protected:
+ // not owned request
+ CMMAStreamRequest* iRequest;
+};
+
+#endif // CMMADATASOURCESTREAM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc/mmmastreamhandlerlistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Listener for CMMAStreamHandler
+*
+*/
+
+#ifndef MMMASTREAMHANDLERLISTENER_H
+#define MMMASTREAMHANDLERLISTENER_H
+
+/**
+ * Listener for CMMAStreamHandler.
+ */
+NONSHARABLE_CLASS(MMMAStreamHandlerListener)
+{
+public:
+ /**
+ * Called when stream is prepared.
+ * @param aError system error code
+ */
+ virtual void PrepareComplete(TInt aError) = 0;
+
+ /**
+ * Called when stream is started.
+ * @param aError system error code
+ */
+ virtual void StartComplete(TInt aError) = 0;
+
+ /**
+ * Called when error need to be handled.
+ * If stream is starting or preparing PrepareComplete or
+ * StartComplete will be called instead of this method.
+ * @param aError system error code
+ */
+ virtual void HandleError(TInt aError) = 0;
+};
+
+
+#endif // MMMASTREAMHANDLERLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/inc/mmmastreamrequestlistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Used to inform when CMMAStreamRequest completes
+*
+*/
+
+#ifndef MMMASTREAMREQUESTLISTENER_H
+#define MMMASTREAMREQUESTLISTENER_H
+
+
+// INCLUDES
+class CMMAStreamRequest;
+
+/**
+ * MMMAStreamRequestListener will be informed when CMMAStreamRequest is
+ * completed.
+ */
+NONSHARABLE_CLASS(MMMAStreamRequestListener)
+{
+public:
+ /**
+ * Called when when stream write request is completed.
+ * @param aRequest request completed
+ */
+ virtual void WriteComplete(CMMAStreamRequest* aRequest) = 0;
+
+ /**
+ * Called when when stream read request is completed.
+ * @param aRequest request completed
+ */
+ virtual void ReadComplete(CMMAStreamRequest* aRequest) = 0;
+
+ /**
+ * Called when when stream request is completed.
+ * @param aError system error code
+ */
+ virtual void HandleError(CMMAStreamRequest* aRequest,
+ TInt aError) = 0;
+
+};
+
+#endif // MMMASTREAMREQUESTLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.emc/cmmaaudiostreammetadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAAudioStreamMetaDataControl is a concrete class for getting
+* metadata from an audio media.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaaudiostreammetadatacontrol.h"
+
+CMMAAudioStreamMetaDataControl::CMMAAudioStreamMetaDataControl(
+ CMetaDataUtility* aMetadaDataUtility)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioStreamMetaDataControl constructor called.");
+ // this class gets the ownership of MetaDataUtility
+ iMetaDataUtility = aMetadaDataUtility;
+}
+
+CMMAAudioStreamMetaDataControl::~CMMAAudioStreamMetaDataControl()
+{
+ LOG( EJavaMMAPI, EInfo, "~CMMAAudioStreamMetaDataControl called.");
+ delete iMetaDataUtility;
+}
+
+TInt CMMAAudioStreamMetaDataControl::KeyCountL()
+{
+ TInt entries = iMetaDataUtility->MetaDataCount();
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamMetaDataControl::KeyCountL, count = %d", entries);
+
+ return entries;
+}
+
+HBufC* CMMAAudioStreamMetaDataControl::KeyL(TInt aIndex)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::KeyL +");
+ HBufC* key = NULL;
+
+ if (KeyCountL() > 0)
+ {
+ TMetaDataFieldId fieldId;
+ const CMetaDataFieldContainer& fieldcontainer =
+ iMetaDataUtility->MetaDataFieldsL();
+ fieldcontainer.FieldIdAt(aIndex, fieldId);
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamMetaDataControl::KeyL, fieldId = %d", fieldId);
+ key = GetKeyL(fieldId);
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::KeyL -");
+ return key;
+}
+
+/*
+ * Get the value of given audio metadata key. The ownership of the created value
+ * (descriptor) is passed to the caller.
+ */
+HBufC* CMMAAudioStreamMetaDataControl::KeyValueL(const TDesC& aKey)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::KeyValueL +");
+ HBufC* retVal = NULL;
+
+ if (KeyCountL() > 0)
+ {
+ TBool found;
+ TMetaDataFieldId fieldId = GetFieldId(aKey, found);
+ if (found)
+ {
+ const CMetaDataFieldContainer& fieldcontainer =
+ iMetaDataUtility->MetaDataFieldsL();
+ retVal = (fieldcontainer.Field(fieldId)).AllocL();
+ }
+ }
+
+ User::LeaveIfNull(retVal);
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamMetaDataControl::KeyValueL, retVal = %S", retVal->Des().PtrZ());
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::KeyValueL -");
+ return retVal;
+}
+
+/*
+* Get key string for the given fieldId
+*/
+HBufC* CMMAAudioStreamMetaDataControl::GetKeyL(TMetaDataFieldId aFieldId)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::GetKeyL +");
+ HBufC* keyString = NULL;
+ TBuf<KKeyStringMaxLength> tempBuf;
+
+ switch (aFieldId)
+ {
+ case EMetaDataSongTitle:
+ tempBuf.Copy(KMetaDataSongTitle);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataArtist:
+ tempBuf.Copy(KMetaDataArtist);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataAlbum:
+ tempBuf.Copy(KMetaDataAlbum);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataYear:
+ tempBuf.Copy(KMetaDataYear);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataAlbumTrack:
+ tempBuf.Copy(KMetaDataAlbumTrack);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataGenre:
+ tempBuf.Copy(KMetaDataGenre);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataComposer:
+ tempBuf.Copy(KMetaDataComposer);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataCopyright:
+ tempBuf.Copy(KMetaDataCopyright);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataOriginalArtist:
+ tempBuf.Copy(KMetaDataOriginalArtist);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataUrl:
+ tempBuf.Copy(KMetaDataUrl);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataUserUrl:
+ tempBuf.Copy(KMetaDataUserUrl);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataJpeg:
+ tempBuf.Copy(KMetaDataJpeg);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataVendor:
+ tempBuf.Copy(KMetaDataVendor);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataRating:
+ tempBuf.Copy(KMetaDataRating);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataUniqueFileIdentifier:
+ tempBuf.Copy(KMetaDataUniqueFileIdentifier);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataDuration:
+ tempBuf.Copy(KMetaDataDuration);
+ keyString = tempBuf.AllocL();
+ break;
+ case EMetaDataDate:
+ tempBuf.Copy(KMetaDataDate);
+ keyString = tempBuf.AllocL();
+ break;
+ default:
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::GetKeyL, default case should not occur");
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::GetKeyL -");
+ return keyString;
+}
+
+/*
+* Get fieldId for the given key string
+*/
+TMetaDataFieldId CMMAAudioStreamMetaDataControl::GetFieldId(const TDesC& aKey, TBool& aCompare)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::GetFieldId +");
+ TMetaDataFieldId fieldId = EUnknownMetaDataField;
+ aCompare = true; // found
+
+ if (0 == aKey.Compare(KMetaDataSongTitle()))
+ {
+ fieldId = EMetaDataSongTitle;
+ }
+ else if (0 == aKey.Compare(KMetaDataArtist()))
+ {
+ fieldId = EMetaDataArtist;
+ }
+ else if (0 == aKey.Compare(KMetaDataAlbum()))
+ {
+ fieldId = EMetaDataAlbum;
+ }
+ else if (0 == aKey.Compare(KMetaDataArtist()))
+ {
+ fieldId = EMetaDataArtist;
+ }
+ else if (0 == aKey.Compare(KMetaDataYear()))
+ {
+ fieldId = EMetaDataYear;
+ }
+ else if (0 == aKey.Compare(KMetaDataComment()))
+ {
+ fieldId = EMetaDataComment;
+ }
+ else if (0 == aKey.Compare(KMetaDataAlbumTrack()))
+ {
+ fieldId = EMetaDataAlbumTrack;
+ }
+ else if (0 == aKey.Compare(KMetaDataGenre()))
+ {
+ fieldId = EMetaDataGenre;
+ }
+ else if (0 == aKey.Compare(KMetaDataComposer()))
+ {
+ fieldId = EMetaDataComposer;
+ }
+ else if (0 == aKey.Compare(KMetaDataCopyright()))
+ {
+ fieldId = EMetaDataCopyright;
+ }
+ else if (0 == aKey.Compare(KMetaDataOriginalArtist()))
+ {
+ fieldId = EMetaDataOriginalArtist;
+ }
+ else if (0 == aKey.Compare(KMetaDataUrl()))
+ {
+ fieldId = EMetaDataUrl;
+ }
+ else if (0 == aKey.Compare(KMetaDataUserUrl()))
+ {
+ fieldId = EMetaDataUserUrl;
+ }
+ else if (0 == aKey.Compare(KMetaDataJpeg()))
+ {
+ fieldId = EMetaDataJpeg;
+ }
+ else if (0 == aKey.Compare(KMetaDataVendor()))
+ {
+ fieldId = EMetaDataVendor;
+ }
+ else if (0 == aKey.Compare(KMetaDataRating()))
+ {
+ fieldId = EMetaDataRating;
+ }
+ else if (0 == aKey.Compare(KMetaDataUniqueFileIdentifier()))
+ {
+ fieldId = EMetaDataUniqueFileIdentifier;
+ }
+ else if (0 == aKey.Compare(KMetaDataDuration()))
+ {
+ fieldId = EMetaDataDuration;
+ }
+ else if (0 == aKey.Compare(KMetaDataDate()))
+ {
+ fieldId = EMetaDataDate;
+ }
+ else
+ {
+ aCompare = false; // not found
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamMetaDataControl::GetFieldId -");
+ return fieldId;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.emc/cmmaaudiostreamplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,469 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for streaming audio.
+*
+*/
+
+
+// INCLUDE FILES
+#include <AudioPreference.h>
+#include <logger.h>
+
+#include "cmmaaudiostreamplayer.h"
+#include "cmmadatasourcestream.h"
+#include "mmafunctionserver.h"
+#include "cmmastreamhandler.h"
+
+_LIT(KMMAStreamErrorMessage, "Internal error: %d");
+
+
+CMMAAudioStreamPlayer* CMMAAudioStreamPlayer::NewLC(
+ CMMAEMCResolver* aResolver)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::NewLC +");
+ CMMAAudioStreamPlayer* self = new(ELeave) CMMAAudioStreamPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::NewLC -");
+ return self;
+}
+
+CMMAAudioStreamPlayer::~CMMAAudioStreamPlayer()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::~CMMAAudioStreamPlayer +");
+
+ if (iMStreamControl->GetState() > MStreamControl::CLOSED)
+ {
+ iMStreamControl->Close();
+ }
+
+ delete iStreamHandler;
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::~CMMAAudioStreamPlayer -");
+}
+
+
+CMMAAudioStreamPlayer::CMMAAudioStreamPlayer(
+ CMMAEMCResolver* aResolver):
+ CMMAEMCAudioPlayer(aResolver)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::CMMAAudioStreamPlayer");
+}
+
+void CMMAAudioStreamPlayer::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::ConstructL +");
+ iControllerPrimed = EFalse;
+ CMMAEMCAudioPlayer::ConstructL();
+ iMetaDataUtility = CMetaDataUtility::NewL();
+ iStreamHandler = CMMAStreamHandler::NewL(*this,
+ *iMStreamControl,
+ *iMDataBufferSource,
+ *iFactory,
+ *iMetaDataUtility);
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::ConstructL -");
+}
+
+CMMASourceStream* CMMAAudioStreamPlayer::AddSourceStreamL(JNIEnv* aJNIEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::AddSourceStreamL +");
+ CMMADataSourceStream* sourceStream = CMMADataSourceStream::NewLC(aJNIEnv,
+ aEventSource,
+ aReader,
+ this,
+ aEventSource);
+ User::LeaveIfError(iSourceStreams.Append(sourceStream));
+ CleanupStack::Pop(sourceStream);
+ iStreamHandler->SetSourceStream(sourceStream);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::AddSourceStreamL -");
+ return sourceStream;
+}
+
+CMetaDataUtility* CMMAAudioStreamPlayer::MetaDataUtilityOwnership()
+{
+ CMetaDataUtility* temp = iMetaDataUtility;
+ iMetaDataUtility = NULL;
+ return temp;
+}
+
+void CMMAAudioStreamPlayer::DeallocateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::DeallocateL +");
+ iStreamHandler->Stop();
+ iControllerPrimed = EFalse;
+ CMMAEMCPlayerBase::DeallocateL();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::DeallocateL -");
+}
+
+void CMMAAudioStreamPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::PrefetchL +");
+ __ASSERT_DEBUG(iSourceStreams.Count() > 0, User::Invariant());
+ iStreamHandler->Prepare(*iMimeType);
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::PrefetchL -");
+}
+
+void CMMAAudioStreamPlayer::StartL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL +");
+ if (iStreamHandler->LastBufferWritten() &&
+ (iMStreamControl ->GetState() == MStreamControl::PAUSED))
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL If outer+");
+ TInt64 time;
+ GetMediaTime(&time);
+ TInt err = iMStreamControl->Start();
+ if (err == KErrNone && iState != EStarted)
+ { LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL If inner+");
+ // move to started state and post started event
+ ChangeState(EStarted);
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ }
+ else
+ { LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL else inner+");
+ HandleError(err);
+ }
+ }
+ else
+ { LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL else outer+");
+ iStreamHandler->Start();
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartL -");
+}
+
+void CMMAAudioStreamPlayer::StopL(TBool aPostEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::Stop state %d", iState);
+ if (iState == EStarted)
+ {
+ User::LeaveIfError(Pause());
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ if (aPostEvent)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::Stop OK");
+}
+
+TInt CMMAAudioStreamPlayer::Pause()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Pause +");
+ iStreamHandler->Pause();
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer:: iStreamControl State = %d",iMStreamControl->GetState());
+
+ TInt err = KErrNone;
+ if (iMStreamControl->GetState() != MStreamControl::PAUSED)
+ {
+ err = iMStreamControl->Pause();
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer:: iStreamControl Pause error = %d", err);
+ if ((!iActiveSchedulerWait->IsStarted()) && (err == KErrNone))
+ {
+ iActiveSchedulerWait->Start();
+ }
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Pause -");
+ return err;
+}
+
+void CMMAAudioStreamPlayer::PlayCompleteL(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::PlayCompleteL error %d",
+ aError);
+
+ // Before controller is started it must be primed
+ iControllerPrimed = EFalse;
+
+ TInt64 time;
+ GetDuration(&time);
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, time);
+
+ ChangeState(EPrefetched); // ready to play again
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+}
+
+void CMMAAudioStreamPlayer::GetDuration(TInt64* aDuration)
+{
+ CMMAPlayer::GetDuration(aDuration);
+}
+
+void CMMAAudioStreamPlayer::PrepareComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::PrepareComplete error %d",
+ aError);
+
+ if (aError == KErrNone)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(aError); // java prefetch return
+}
+
+void CMMAAudioStreamPlayer::StartComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete error %d",
+ aError);
+
+ // do not start if player is deallocated or closed
+ // RateControl start can start controller in started state
+ if ((iState != EStarted) &&
+ (iState != EPrefetched))
+ {
+ PostActionCompleted(KErrNone); // java start return
+ return;
+ }
+
+ TInt err = aError;
+ if (!iControllerPrimed)
+ {
+ // Prime must be called when player is started first time or restarted
+ err = iMStreamControl->Prime();
+
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete prime error %d",
+ err);
+ }
+ else
+ {
+ err = KErrNone;
+ }
+
+ if (iControllerPrimed && (iState == EPrefetched))
+ {
+
+ TInt64 time;
+ if (err == KErrNone)
+ {
+ // must be primed before media time can be get
+ GetMediaTime(&time);
+ err = iMStreamControl->Start();
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete play error %d",
+ err);
+
+ }
+
+ // RateControl can start controller in started state, then Java event is
+ // not sent
+ if (err == KErrNone && iState != EStarted)
+ { // move to started state and post started event
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ ChangeState(EStarted);
+ }
+ else
+ { // post error event
+ HandleError(aError);
+ PostActionCompleted(aError); // java start return
+ }
+ }
+
+}
+
+void CMMAAudioStreamPlayer::HandleError(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::HandleError error %d",
+ aError);
+
+ TName errorMessage;
+ errorMessage.Format(KMMAStreamErrorMessage, aError);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+}
+
+void CMMAAudioStreamPlayer::Event(MControl* aControl, TUint aEventType, TAny* aEventObject)
+{
+
+ switch (aEventType)
+ {
+
+ case MStreamControlObserver::KStateChangedEvent:
+ {
+ MStateChangedEvent* evt = (MStateChangedEvent*)aEventObject;
+ MStreamControl* control1 = (MStreamControl*)(aControl);
+ switch (control1->GetState())
+ {
+ case MStreamControl::CLOSED:
+ {
+ iPrevStreamControlState = MStreamControl::CLOSED;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :CLOSED");
+ }
+ break;
+
+ case MStreamControl::INITIALIZED:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :INITIALIZED");
+ switch (iPrevStreamControlState)
+ {
+ case MStreamControl::CLOSED:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ }
+ break;
+
+ case MStreamControl::INITIALIZED:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ LOG( EJavaMMAPI, EInfo, "inner Switch case: MStreamControl::INITIALIZED ");
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent:ErrorCode = %d ",evt->GetErrorCode());
+ // error occured during prime operation
+ // move player back to prefetched state
+ if (iState == EStarted)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(evt->GetErrorCode()); // java start return
+ }
+ break;
+
+ case MStreamControl::PRIMED:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ LOG( EJavaMMAPI, EInfo, "inner Switch case: MStreamControl::PRIMED ");
+
+ }
+ break;
+
+ case MStreamControl::EXECUTING:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ LOG( EJavaMMAPI, EInfo, "inner Switch case: MStreamControl::EXECUTING ");
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent:ErrorCode = %d ",evt->GetErrorCode());
+ if (KErrEof == evt->GetErrorCode())
+ {
+ TRAPD(error, PlayCompleteL(KErrNone));
+ if (KErrNone != error)
+ {
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::Event:PlayCompleteL Error = %d", error);
+ }
+ }
+ }
+ break;
+
+ case MStreamControl::BUFFERING:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ LOG( EJavaMMAPI, EInfo, "inner Switch case: MStreamControl::BUFFERING ");
+ }
+ break;
+
+ case MStreamControl::PAUSED:
+ {
+ iPrevStreamControlState = MStreamControl::INITIALIZED;
+ LOG( EJavaMMAPI, EInfo, "inner Switch case: MStreamControl::PAUSED ");
+ }
+ break;
+ }
+ }
+ break;
+
+ case MStreamControl::PRIMED:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :PRIMED");
+ iPrevStreamControlState = MStreamControl::PRIMED;
+ iControllerPrimed = ETrue;
+ TInt64 time;
+ // must be primed before media time can be get
+ GetMediaTime(&time);
+ TInt err = iMStreamControl->Start();
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::Event play error %d",
+ err);
+
+ // RateControl can start controller in started state, then Java event is
+ // not sent
+ if (err == KErrNone && iState != EStarted)
+ { // move to started state and post started event
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ ChangeState(EStarted);
+ }
+ else
+ {
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ }
+ }
+ break;
+
+ case MStreamControl::EXECUTING:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :EXECUTING");
+ iPrevStreamControlState = MStreamControl::EXECUTING;
+ PostActionCompleted(KErrNone); // java start return
+ }
+ break;
+
+ case MStreamControl::BUFFERING:
+ {
+ iPrevStreamControlState = MStreamControl::BUFFERING;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :BUFFERING");
+ }
+ break;
+
+ case MStreamControl::PAUSED:
+ {
+ iPrevStreamControlState = MStreamControl::PAUSED;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :PAUSED");
+ }
+ break;
+
+ default:
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::Event:KStateChangedEvent :DEFAULT");
+ break;
+ }
+ }
+ break;
+
+ case MControlObserver::KErrorEvent:
+ {
+ MErrorCode* evt = (MErrorCode*)aEventObject;
+ if (KErrNone != evt->GetErrorCode())
+ {
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::Event:KErrorEvent, err = %d", evt->GetErrorCode());
+ }
+ }
+ break;
+ }
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.emc/cmmaaudiostreamplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating streaming audio player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cmmaaudiostreamplayerfactory.h"
+#include "cmmaaudiostreamplayer.h"
+#include "cmmaemcaudiovolumecontrol.h"
+#include "cmmastoptimecontrol.h"
+#include <MetaDataUtility.h>
+
+#include "cmmaaudiostreammetadatacontrol.h"
+#include "cmmaemcresolver.h"
+
+#ifdef __MMA_GENERIC_RATE_CONTROL__
+#include "cmmaaudiostreamratecontrol.h"
+#endif // __MMA_GENERIC_RATE_CONTROL__
+
+// CONSTANTS
+_LIT(KMimetypeAMR,"audio/amr");
+_LIT(KMimetypeAMRWB,"audio/amr-wb");
+_LIT(KMimetypeAAC, "audio/aac");
+_LIT(KMimetype3GPP, "audio/3gpp");
+_LIT(KMimetype3GPP2, "audio/3gpp2");
+_LIT(KMimetypeMPEG, "audio/mpeg");
+_LIT(KMimetypeMP4, "audio/mp4");
+_LIT(KMimetypeXMSWMA, "audio/x-ms-wma");
+_LIT(KMimetypeRM, "audio/x-pn-realaudio");
+
+CMMAAudioStreamPlayerFactory* CMMAAudioStreamPlayerFactory::NewLC()
+{
+ CMMAAudioStreamPlayerFactory* pFactory =
+ new(ELeave) CMMAAudioStreamPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAAudioStreamPlayerFactory::CMMAAudioStreamPlayerFactory()
+{
+ iHeaderData = NULL;
+}
+
+
+CMMAAudioStreamPlayerFactory::~CMMAAudioStreamPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC& /*aContentType*/)
+{
+ // only http/https protocol is supported
+ return NULL;
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // only http and https protocols are supported
+ if ((aProtocol != KMMAHttpProtocol) && (aProtocol != KMMAHttpsProtocol))
+ {
+ return NULL;
+ }
+
+ return CMMAEMCPlayerFactory::CreatePlayerL(aProtocol,
+ aMiddlePart,
+ aParameters);
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC8& /*aHeaderData*/)
+{
+ // only http/https protocol is supported
+ return NULL;
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ CMMAEMCResolver* aResolver)
+{
+ aResolver->SetSourceInfoL(iHeaderData);
+
+ HBufC* contentType = aResolver->ContentType();
+ if (!contentType ||
+ ((contentType->Des() != KMimetypeAMR) &&
+ (contentType->Des() != KMimetypeAMRWB) &&
+ (contentType->Des() != KMimetypeAAC) &&
+ (contentType->Des() != KMimetypeXMSWMA) &&
+ (contentType->Des() != KMimetypeRM) &&
+ (contentType->Des() != KMimetypeMPEG) &&
+ (contentType->Des() != KMimetype3GPP2) &&
+ (contentType->Des() != KMimetype3GPP) &&
+ (contentType->Des() != KMimetypeMP4)))
+ {
+ return NULL;
+ }
+
+ CMMAAudioStreamPlayer* player = CMMAAudioStreamPlayer::NewLC(aResolver);
+
+ CMMAEMCAudioVolumeControl* volumeControl = CMMAEMCAudioVolumeControl::NewL(*player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+ CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+#ifdef __MMA_GENERIC_RATE_CONTROL__
+ CMMAAudioStreamRateControl* rateControl = CMMAAudioStreamRateControl::NewL(player);
+ CleanupStack::PushL(rateControl);
+ player->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+#endif // __MMA_GENERIC_RATE_CONTROL__
+
+ CMMAAudioStreamMetaDataControl* metadatacontrol =
+ new(ELeave) CMMAAudioStreamMetaDataControl(player->MetaDataUtilityOwnership());
+ CleanupStack::PushL(metadatacontrol);
+ player->AddControlL(metadatacontrol);
+ CleanupStack::Pop(metadatacontrol);
+
+ // delete isourceinfo;
+ // no longer required, can be destroyed here
+ if (iHeaderData)
+ {
+ delete iHeaderData;
+ iHeaderData = NULL;
+ }
+
+ CleanupStack::Pop(player);
+
+ return player;
+}
+
+void CMMAAudioStreamPlayerFactory::GetSupportedContentTypesL(const TDesC& /*aProtocol*/,
+ CDesC16Array& /*aMimeTypeArray*/)
+{
+ // streaming player does not add new content types
+}
+
+void CMMAAudioStreamPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio));
+}
+
+void CMMAAudioStreamPlayerFactory::SetSourceInfoL(const TUint8* aHeader, TInt aLength)
+{
+ iHeaderData = HBufC8::NewL(aLength);
+ iHeaderData->Des().Copy(aHeader, aLength);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.emc/cmmastreamhandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,416 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Streams data from Java to controller
+*
+*/
+
+
+// INCLUDE FILES
+#include <AudioPreference.h>
+#include <logger.h>
+
+#include "cmmastreamhandler.h"
+#include "cmmadatasourcestream.h"
+#include "mmafunctionserver.h"
+
+
+CMMAStreamHandler* CMMAStreamHandler::NewL(
+ MMMAStreamHandlerListener& aListener,
+ MStreamControl& aMStreamControl,
+ MDataBufferSource& aMDataBufferSource,
+ CMultimediaFactory& aFactory,
+ CMetaDataUtility& aMetaDataUtility)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::NewL +");
+ CMMAStreamHandler* self = new(ELeave) CMMAStreamHandler(aListener,
+ aMStreamControl,
+ aMDataBufferSource,
+ aFactory,
+ aMetaDataUtility);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::NewL -");
+ return self;
+}
+
+CMMAStreamHandler::~CMMAStreamHandler()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::~CMMAStreamHandler() +");
+ iMDataBufferSource.RemoveObserver(*this);
+ if (iBuffer != NULL)
+ {
+ iFactory.DeleteDataBuffer(iBuffer);
+ iBuffer = NULL;
+ }
+ iRequests.ResetAndDestroy();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::~CMMAStreamHandler() -");
+}
+
+CMMAStreamHandler::CMMAStreamHandler(MMMAStreamHandlerListener& aListener,
+ MStreamControl& aMStreamControl,
+ MDataBufferSource& aMDataBufferSource,
+ CMultimediaFactory& aFactory,
+ CMetaDataUtility& aMetaDataUtility)
+ :iMStreamControl(aMStreamControl),
+ iMDataBufferSource(aMDataBufferSource),
+ iFactory(aFactory),
+ iListener(aListener),
+ iMetaDataUtility(aMetaDataUtility),
+ // to be removed once MDU supports all the reqd formats
+ iMimeTypeSupportedByMDU(ETrue)
+{
+ // ignore read/write completed before stream is prepared
+ iState = EMMAStreamPaused;
+ iMetaDataReadyToBeParsed = EFalse;
+}
+
+void CMMAStreamHandler::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::ConstructL +");
+ //Register source control to control observer to get the event
+ iMDataBufferSource.AddObserver(*this);
+ iLastBufferWritten = EFalse;
+ iBuffer = NULL; // initialize MDataBuffer type pointer
+ // create requests
+ for (TInt i = 0; i < KMMAStreamHandlerBufferCount; i++)
+ {
+ CMMAStreamRequest* requestToAppend = CMMAStreamRequest::NewLC(this);
+ iRequests.AppendL(requestToAppend);
+ CleanupStack::Pop(requestToAppend);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::ConstructL -");
+}
+
+void CMMAStreamHandler::Prepare(const TDesC8& aMimeType)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Prepare +");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Prepare state %d", iState);
+ iState = EMMAStreamPrepare;
+ // initialize MetaDataUtility
+ TInt error = iMetaDataUtility.InitChunkData(aMimeType, *this);
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::Prepare, error = %d", error);
+ if (error != KErrNone)
+ {
+ if (error == KErrArgument)
+ {
+ // MDU doesn't support aMimeType
+ // can be removed once MDU supports all the reqd formats
+ iMimeTypeSupportedByMDU = EFalse;
+ }
+ else
+ {
+ // MDU supports but some other error occured
+ iListener.PrepareComplete(error);
+ return;
+ }
+ }
+ else
+ {
+ // to be removed once MDU supports all the reqd formats
+ iMimeTypeSupportedByMDU = ETrue;
+ }
+ //reset request data for reading again from beginning
+ iRequests[0]->DataPtr().SetLength(0);
+
+ // when read completes iListerner.PrepareComplete will be called
+ iSourceStream->Read(iRequests[ 0 ]);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Prepare -");
+}
+
+void CMMAStreamHandler::Start()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start +");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start state %d", iState);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start data source request=%d",(TInt)iSourceStream->Request());
+ iState = EMMAStreamStart;
+ if (iSourceStream->Request())
+ { // when read request is completed it will be written to server
+ iState = EMMAStreamStarted;
+ iListener.StartComplete(KErrNone);
+ return;
+ }
+
+ TInt count = iRequests.Count();
+ TBool started = EFalse;
+ for (TInt i = 0; i < count && !started; i++)
+ {
+ CMMAStreamRequest* r = iRequests[ i ];
+ if (!r->IsActive() && r->DataPtr().Length() > 0)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start write request to server");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start request length=%d",
+ r->DataPtr().Length());
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start last buffer %d",
+ r->RequestBuffer()());
+
+ // data was not yet written to server
+ WriteRequest(r);
+ started = ETrue;
+ }
+ else if (r->IsActive()) // data is in server
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start data is in server");
+ // atleast one request is not processed
+ started = ETrue;
+ }
+ }
+ if (started) // If allready started complete start
+ {
+ iListener.StartComplete(KErrNone);
+ iState = EMMAStreamStarted;
+ }
+ else
+ {
+ // Need to read data before start
+ iSourceStream->Read(iRequests[ 0 ]);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Start -");
+}
+
+void CMMAStreamHandler::Pause()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Pause +");
+ // ignore read/write completes
+ iState = EMMAStreamPaused;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Pause -");
+}
+
+void CMMAStreamHandler::SetSourceStream(CMMADataSourceStream* aSourceStream)
+{
+ iSourceStream = aSourceStream;
+}
+
+void CMMAStreamHandler::WriteComplete(CMMAStreamRequest* aRequest)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete +");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete state=%d", iState);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete request length=%d",
+ aRequest->DataPtr().Length());
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete last buffer %d",
+ aRequest->RequestBuffer()());
+ if (iState == EMMAStreamStarted)
+ {
+ if (aRequest->RequestBuffer()() == 1)
+ {
+ iState = EMMAStreamEof;
+ }
+ else
+ {
+ iSourceStream->Read(aRequest);
+ }
+ }
+ // else, all other states ignore write complete
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete -");
+}
+
+void CMMAStreamHandler::ReadComplete(CMMAStreamRequest* aRequest)
+{
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::ReadComplete +");
+
+ if (iState == EMMAStreamPrepare)
+ {
+
+ WriteRequest(aRequest);
+ iListener.PrepareComplete(KErrNone);
+ iState = EMMAStreamPaused;
+ }
+ else if (iState == EMMAStreamStart)
+ {
+ iState = EMMAStreamStarted;
+ // write first request to server
+ WriteRequest(aRequest);
+ iListener.StartComplete(KErrNone);
+ }
+ else if (iState == EMMAStreamStarted)
+ {
+ WriteRequest(aRequest);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::ReadComplete -");
+ // else, all other states ignore read complete
+}
+
+void CMMAStreamHandler::HandleError(CMMAStreamRequest* /*aRequest*/,
+ TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleError +");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleError state=%d", iState);
+ if (iState == EMMAStreamPrepare)
+ {
+ iListener.PrepareComplete(aError);
+ iState = EMMAStreamPaused;
+ }
+ else if (iState == EMMAStreamStart)
+ {
+ iListener.StartComplete(aError);
+ iState = EMMAStreamStarted;
+ }
+ else
+ {
+ iListener.HandleError(aError);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleError -");
+}
+
+void CMMAStreamHandler::WriteRequest(CMMAStreamRequest* aRequest)
+{
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteRequest +");
+ iCurrentRequest = aRequest; //initialize the current StreamRequest for use in callback function
+ iProcessedState = EMMANoneProcessed;
+
+ TInt state = iMStreamControl.GetState();
+ if (!aRequest->IsActive())
+ {
+ aRequest->SetActive(ETrue);
+ }
+
+ //Create MDataBuffer and then pass it as a parameter of WriteData
+ if (iBuffer != NULL)
+ {
+ iFactory.DeleteDataBuffer(iBuffer);
+ iBuffer= NULL;
+ }
+ iFactory.CreateDataBuffer(KDataBufferSourceControl, KMMAStreamRequestBufferSize, iBuffer);
+ iBuffer->GetBufferPtr().Set(aRequest->DataPtr());
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteRequest: Size of the Data to be written is %d ",aRequest->DataPtr().Length());
+ if (aRequest->RequestBuffer()() == 1) //set that it is the last buffer
+ {
+ iState = EMMAStreamEof;
+ iBuffer->SetLastBuffer(ETrue);
+ iLastBufferWritten = ETrue;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteRequest: LastBuffer");
+ }
+ else
+ {
+ iBuffer->SetLastBuffer(EFalse);
+ iLastBufferWritten = EFalse;
+ }
+
+ // When the buffer is processed by framework KBufferProcessedEvent
+ // will be delivered to registered observers
+ TInt err = iMDataBufferSource.WriteData(*iBuffer);
+ // to be removed once MDU supports all the reqd formats
+ if (iMimeTypeSupportedByMDU && !iMetaDataReadyToBeParsed)
+ {
+ err = iMetaDataUtility.ProcessChunkData(aRequest->DataPtr(), iLastBufferWritten);
+ }
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::WriteRequest, err = %d", err);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteRequest -");
+}
+
+void CMMAStreamHandler::Event(MControl* /*aControl*/, TUint aEventType, TAny* aEventObject)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Event ");
+ switch (aEventType)
+ {
+
+ case MSourceControlObserver::KBufferProcessedEvent:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Event:KBufferProcessedEvent");
+ MBufferProcessedEvent* evt = (MBufferProcessedEvent*)aEventObject;
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::Event:KBufferProcessedEvent:ErrorCode = %d ",evt->GetErrorCode());
+ // can be removed once MDU supports all the reqd formats
+ if (!iMimeTypeSupportedByMDU ||
+ (iProcessedState == EMMAMetaDataProcessed || iMetaDataReadyToBeParsed))
+ {
+ iCurrentRequest->WriteRequestComplete(evt->GetErrorCode());
+ iCurrentRequest->SetActive(EFalse);
+ iProcessedState = EMMABothProcessed;
+ }
+ else
+ {
+ iProcessedState = EMMABufferProcessed;
+ }
+ }
+ break;
+
+ case MSourceControlObserver::KBitRateChangedEvent:
+ {
+ }
+ break;
+
+ case MStreamControlObserver::KDurationChangedEvent:
+ {
+ }
+ break;
+
+ default:
+ break;
+
+ };
+}
+
+void CMMAStreamHandler::HandleChunkDataProcessed(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleChunkDataProcessed + ");
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::HandleChunkDataProcessed, aError = %d", aError);
+ if (iProcessedState == EMMABufferProcessed)
+ {
+ iCurrentRequest->WriteRequestComplete(aError);
+ iCurrentRequest->SetActive(EFalse);
+ iProcessedState = EMMABothProcessed;
+ }
+ else
+ {
+ iProcessedState = EMMAMetaDataProcessed;
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleChunkDataProcessed - ");
+}
+
+void CMMAStreamHandler::HandleChunkDataReadyToBeParsed()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleChunkDataReadyToBeParsed + ");
+ iMetaDataReadyToBeParsed = ETrue;
+ TInt error = iMetaDataUtility.ParseChunkData();
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::HandleChunkDataReadyToBeParsed, error = %d ", error);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleChunkDataReadyToBeParsed - ");
+}
+
+void CMMAStreamHandler::HandleChunkDataComplete(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleChunkDataComplete");
+ if (KErrNone != aError)
+ {
+ ELOG1( EJavaMMAPI, "MMA::CMMAStreamHandler::HandleChunkDataComplete, aError = %d ", aError);
+ iListener.HandleError(aError);
+ }
+
+}
+
+TBool CMMAStreamHandler::LastBufferWritten()
+{
+ return iLastBufferWritten;
+}
+
+void CMMAStreamHandler::Stop()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Stop + ");
+ // forcefully complete all requests
+ // and release already read data.
+ Pause();
+ iMetaDataUtility.CloseChunkData();
+ TInt count = iRequests.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ CMMAStreamRequest* r = iRequests[ i ];
+ r->WriteRequestComplete(KErrNone);
+ r->SetActive(EFalse);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::Stop - ");
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.emc/cmmastreamrequest.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Request used to write or read data
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cmmastreamrequest.h"
+#include "mmmastreamrequestlistener.h"
+
+CMMAStreamRequest* CMMAStreamRequest::NewLC(MMMAStreamRequestListener* aListener)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::NewLC +");
+ CMMAStreamRequest* self = new(ELeave)CMMAStreamRequest(aListener);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::NewLC -");
+ return self;
+}
+
+CMMAStreamRequest::~CMMAStreamRequest()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::~CMMAStreamRequest +");
+ delete iData;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::~CMMAStreamRequest -");
+}
+
+TPtr8& CMMAStreamRequest::DataPtr()
+{
+ return iDataPtr;
+}
+
+void CMMAStreamRequest::CompleteRead(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::CompleteRead +");
+ if (aError < KErrNone)
+ {
+ iListener->HandleError(this, aError);
+ }
+ else // OK
+ {
+ iListener->ReadComplete(this);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::CompleteRead -");
+}
+
+void CMMAStreamRequest::SetActive(TBool aActive)
+{
+ iActive = aActive;
+}
+
+TBool CMMAStreamRequest::IsActive()
+{
+ return iActive;
+}
+
+TPckgBuf< TInt >& CMMAStreamRequest::RequestBuffer()
+{
+ return iRequestBuffer;
+}
+
+void CMMAStreamRequest::WriteRequestComplete(TInt Err)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::WriteRequestComplete +");
+ if (Err == KErrNone)
+ {
+ // data is processed, set ready for reuse
+ iDataPtr.SetLength(0);
+ iListener->WriteComplete(this);
+ }
+ else // error
+ {
+ iListener->HandleError(this, Err);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::WriteRequestComplete -");
+}
+
+CMMAStreamRequest::CMMAStreamRequest(MMMAStreamRequestListener* aListener):
+ iListener(aListener),
+ iDataPtr(NULL, 0),iActive(EFalse)
+{
+ //Do Nothing
+}
+
+void CMMAStreamRequest::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::ConstructL +");
+ iData = HBufC8::NewL(KMMAStreamRequestBufferSize);
+ iDataPtr.Set(iData->Des());
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamRequest::ConstructL -");
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for streaming audio.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmfdes.h>
+#include <audiopreference.h>
+#include <logger.h>
+
+#include "CMMAAudioStreamPlayer.h"
+#include "CMMADataSourceStream.h"
+#include "MMAFunctionServer.h"
+#include "CMMAStreamHandler.h"
+
+const TInt KPlayerPriority = KAudioPriorityRecording;
+_LIT(KMMAStreamErrorMessage, "Internal error: %d");
+
+// Uid must be same as in S60StreamingSourceUIDs.hrh which is not exported from
+// EnhancedAudioPlayerUtility/AudioStreaming/AudioStreamingSource.
+const TUid KMMAMmfS60StreamingSourceUid = { 0x10207AF3 };
+
+
+CMMAAudioStreamPlayer* CMMAAudioStreamPlayer::NewLC(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAAudioStreamPlayer* self = new(ELeave) CMMAAudioStreamPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAAudioStreamPlayer::~CMMAAudioStreamPlayer()
+{
+ delete iStreamHandler;
+}
+
+CMMAAudioStreamPlayer::CMMAAudioStreamPlayer(
+ CMMAMMFResolver* aResolver):
+ CMMAAudioPlayer(aResolver)
+{
+}
+
+void CMMAAudioStreamPlayer::ConstructL()
+{
+ CMMAAudioPlayer::ConstructL();
+ iStreamHandler = CMMAStreamHandler::NewL(*this, iController);
+}
+
+TInt CMMAAudioStreamPlayer::DoOpen(TUid aSourceUid,
+ const TDesC8& aSourceData,
+ TUid aSinkUid,
+ const TDesC8& aSinkData,
+ TMMFPrioritySettings aPrioritySettings)
+{
+ // Make sure any existing controller is closed.
+ iEventMonitor->Cancel();
+ iController.Close();
+
+ // Try opening and configuring each controller in turn
+ TInt error = KErrNotSupported;
+ TInt index = 0;
+
+ // Try controllers until found a good controller or out of list
+ while ((error != KErrNone) &&
+ (index < iControllerInfos->Count()))
+ {
+ // Open the controller
+ error = iController.Open((*iControllerInfos)[ index ]->Uid(),
+ aPrioritySettings);
+
+ // If the controller was opened without error, start receiving events from it.
+ if (!error)
+ {
+ iEventMonitor->Start();
+
+ // Add the data source to the controller.
+ error = iController.AddDataSource(aSourceUid,
+ aSourceData,
+ iStreamHandler->MessageDestination());
+ }
+
+ // Add the data sink
+ if (!error)
+ {
+ error = iController.AddDataSink(aSinkUid, aSinkData);
+ }
+
+ // If an error occurred in any of the above, close the controller.
+ if (error)
+ {
+ iEventMonitor->Cancel();
+ iController.Close();
+ }
+
+ index++;
+ }
+
+ return error;
+}
+
+CMMASourceStream* CMMAAudioStreamPlayer::AddSourceStreamL(JNIEnv* aJNIEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader)
+{
+ CMMADataSourceStream* sourceStream = CMMADataSourceStream::NewLC(aJNIEnv,
+ aEventSource,
+ aReader,
+ this);
+ User::LeaveIfError(iSourceStreams.Append(sourceStream));
+ CleanupStack::Pop(sourceStream);
+ iStreamHandler->SetSourceStream(sourceStream);
+ return sourceStream;
+}
+
+void CMMAAudioStreamPlayer::PrefetchL()
+{
+ __ASSERT_DEBUG(iSourceStreams.Count() > 0, User::Invariant());
+
+ // player priority settings
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = KPlayerPriority;
+ prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality;
+ prioritySettings.iState = EMMFStatePlaying;
+
+ User::LeaveIfError(DoOpen(KMMAMmfS60StreamingSourceUid,
+ KNullDesC8,
+ KUidMmfAudioOutput,
+ KNullDesC8,
+ prioritySettings));
+ iStreamHandler->PrepareL();
+}
+
+void CMMAAudioStreamPlayer::StartL()
+{
+ // If the player is in Prefetched state then it is implied that it has read "KMMAStreamRequestBufferSize"
+ // and it can be played
+ LOG1(EJavaMMAPI,EInfo,"CMMAAudioStreamPlayer::StartL() , state = %d",iState);
+ if (iState == EPrefetched)
+ {
+
+ TInt64 time;
+ GetMediaTime(&time);
+
+ // inform java side
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+
+ // go to started state
+ ChangeState(EStarted);
+
+ PostActionCompleted(KErrNone); // java start return
+ }
+ iStreamHandler->StartL();
+}
+
+void CMMAAudioStreamPlayer::StopL(TBool aPostEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::Stop state %d", iState);
+ if (iState == EStarted)
+ {
+ User::LeaveIfError(Pause());
+
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ if (aPostEvent)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioStreamPlayer::Stop OK");
+}
+
+TInt CMMAAudioStreamPlayer::Pause()
+{
+ iStreamHandler->Pause();
+ return iController.Pause();
+}
+
+void CMMAAudioStreamPlayer::PlayCompleteL(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::PlayCompleteL error %d",
+ aError);
+
+ // Before controller is started it must be primed
+ iControllerPrimed = EFalse;
+
+ TInt64 time;
+ GetDuration(&time);
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, time);
+
+ ChangeState(EPrefetched); // ready to play again
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+}
+
+void CMMAAudioStreamPlayer::GetDuration(TInt64* aDuration)
+{
+ CMMAPlayer::GetDuration(aDuration);
+}
+
+void CMMAAudioStreamPlayer::PrepareComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::PrepareComplete error %d",
+ aError);
+ if (aError == KErrNone)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(aError); // java prefetch return
+}
+
+void CMMAAudioStreamPlayer::StartComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete error %d",
+ aError);
+
+ // do not start if player is deallocated or closed
+ // RateControl start can start controller in started state
+ if ((iState != EStarted) &&
+ (iState != EPrefetched))
+ {
+ return;
+ }
+
+ TInt err = aError;
+ if (!iControllerPrimed)
+ {
+ // Prime must be called when player is started first time or restarted
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioStreamPlayer::StartComplete PRIME");
+ err = iController.Prime();
+ iControllerPrimed = ETrue;
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete prime error %d",
+ err);
+ }
+ else
+ {
+ err = KErrNone;
+ }
+
+ TInt64 time;
+ if (err == KErrNone)
+ {
+ // must be primed before media time can be get
+ GetMediaTime(&time);
+ err = iController.Play();
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::StartComplete play error %d",
+ err);
+ }
+
+ // RateControl can start controller in started state, then Java event is
+ // not sent
+ if (err == KErrNone && iState != EStarted)
+ { // move to started state and post started event
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ ChangeState(EStarted);
+ }
+ else
+ { // post error event
+ HandleError(aError);
+ }
+}
+
+void CMMAAudioStreamPlayer::HandleError(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMAAudioStreamPlayer::HandleError error %d",
+ aError);
+
+ TName errorMessage;
+ errorMessage.Format(KMMAStreamErrorMessage, aError);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmaaudiostreamplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating streaming audio player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "CMMAAudioStreamPlayerFactory.h"
+#include "CMMAAudioStreamPlayer.h"
+#include "CMMAAudioVolumeControl.h"
+#include "CMMAStopTimeControl.h"
+#include "CMMAMMFResolver.h"
+#include "CMMAAudioMetaDataControl.h"
+#include "CMMAAudioStreamRateControl.h"
+
+// CONSTANTS
+_LIT(KMMAAMRMimetype, "audio/amr");
+_LIT(KMMAAMRWBMimetype, "audio/amr-wb");
+
+CMMAAudioStreamPlayerFactory* CMMAAudioStreamPlayerFactory::NewLC()
+{
+ CMMAAudioStreamPlayerFactory* pFactory =
+ new(ELeave) CMMAAudioStreamPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAAudioStreamPlayerFactory::CMMAAudioStreamPlayerFactory()
+{
+}
+
+
+CMMAAudioStreamPlayerFactory::~CMMAAudioStreamPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC& /*aContentType*/)
+{
+ // only http protocol is supported
+ return NULL;
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // only http protocol is supported
+ if (aProtocol != KMMAHttpProtocol)
+ {
+ return NULL;
+ }
+
+ return CMMAMMFPlayerFactory::CreatePlayerL(aProtocol,
+ aMiddlePart,
+ aParameters);
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ const TDesC8& /*aHeaderData*/)
+{
+ // only http protocol is supported
+ return NULL;
+}
+
+CMMAPlayer* CMMAAudioStreamPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ // only amr streaming is supported
+ HBufC* contentType = aResolver->ContentType();
+ if (!contentType ||
+ ((contentType->Des() != KMMAAMRMimetype) &&
+ (contentType->Des() != KMMAAMRWBMimetype)))
+ {
+ return NULL;
+ }
+
+ CMMAAudioStreamPlayer* player = CMMAAudioStreamPlayer::NewLC(aResolver);
+
+ CMMAAudioVolumeControl* volumeControl = CMMAAudioVolumeControl::NewL(player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+// Amr stream player should support METADATACONTROL so adding this control to the player
+ CMMAAudioMetaDataControl* metaDataControl =
+ new(ELeave) CMMAAudioMetaDataControl(player->Controller());
+ CleanupStack::PushL(metaDataControl);
+ player->AddControlL(metaDataControl);
+ CleanupStack::Pop(metaDataControl);
+
+ CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ CMMAAudioStreamRateControl* rateControl = CMMAAudioStreamRateControl::NewL(player);
+ CleanupStack::PushL(rateControl);
+ player->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+
+ CleanupStack::Pop(player);
+
+ return player;
+}
+
+void CMMAAudioStreamPlayerFactory::GetSupportedContentTypesL(const TDesC& /*aProtocol*/,
+ CDesC16Array& /*aMimeTypeArray*/)
+{
+ // streaming player does not add new content types
+}
+
+void CMMAAudioStreamPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio));
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmastreamhandler.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Streams data from Java to controller
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmfdes.h>
+#include <audiopreference.h>
+#include <logger.h>
+
+#include "CMMAStreamHandler.h"
+#include "CMMADataSourceStream.h"
+#include "MMAFunctionServer.h"
+
+CMMAStreamHandler* CMMAStreamHandler::NewL(
+ MMMAStreamHandlerListener& aListener,
+ RMMFController& aController)
+{
+ CMMAStreamHandler* self = new(ELeave) CMMAStreamHandler(aListener,
+ aController);
+ self->ConstructL();
+ return self;
+}
+
+CMMAStreamHandler::~CMMAStreamHandler()
+{
+ iRequests.ResetAndDestroy();
+}
+
+CMMAStreamHandler::CMMAStreamHandler(MMMAStreamHandlerListener& aListener,
+ RMMFController& aController):
+ iController(aController),
+ iListener(aListener)
+{
+ // ignore read/write completed before stream is prepared
+ iState = EMMAStreamPaused;
+}
+
+void CMMAStreamHandler::ConstructL()
+{
+ // create requests
+ for (TInt i = 0; i < KMMAStreamHandlerBufferCount; i++)
+ {
+ CMMAStreamRequest* requestToAppend = CMMAStreamRequest::NewLC(this);
+ iRequests.AppendL(requestToAppend);
+ CleanupStack::Pop(requestToAppend);
+ }
+}
+
+void CMMAStreamHandler::PrepareL()
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::PrepareL state %d", iState);
+ iState = EMMAStreamPrepare;
+
+ //reset request data for reading again from beginning
+ iRequests[0]->DataPtr().SetLength(0);
+
+ // when read completes iListerner.PrepareComplete will be called
+ iSourceStream->Read(iRequests[ 0 ]);
+}
+
+void CMMAStreamHandler::StartL()
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL state %d", iState);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL data source request=%d",
+ (TInt)iSourceStream->Request());
+
+ iState = EMMAStreamStart;
+ if (iSourceStream->Request())
+ { // when read request is completed it will be written to server
+ iState = EMMAStreamStarted;
+ iListener.StartComplete(KErrNone);
+ return;
+ }
+
+ TInt count = iRequests.Count();
+ TBool started = EFalse;
+ for (TInt i = 0; i < count && !started; i++)
+ {
+ CMMAStreamRequest* r = iRequests[ i ];
+ if (!r->IsActive() && r->DataPtr().Length() > 0)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL write request to server");
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL request length=%d",
+ r->DataPtr().Length());
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL last buffer %d",
+ r->RequestBuffer()());
+
+ // data was not yet written to server
+ WriteRequest(r);
+ started = ETrue;
+ }
+ else if (r->IsActive()) // data is in server
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::StartL data is in server");
+ // atleast one request is not processed
+ started = ETrue;
+ }
+ }
+ if (started) // If allready started complete start
+ {
+ iListener.StartComplete(KErrNone);
+ iState = EMMAStreamStarted;
+ }
+ else
+ {
+ // Need to read data before start
+ iSourceStream->Read(iRequests[ 0 ]);
+ }
+}
+
+void CMMAStreamHandler::Pause()
+{
+ // ignore read/write completes
+ iState = EMMAStreamPaused;
+}
+
+TMMFMessageDestination& CMMAStreamHandler::MessageDestination()
+{
+ return iDataSourceHandle;
+}
+
+void CMMAStreamHandler::SetSourceStream(CMMADataSourceStream* aSourceStream)
+{
+ iSourceStream = aSourceStream;
+}
+
+void CMMAStreamHandler::WriteComplete(CMMAStreamRequest* aRequest)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete state=%d", iState);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete request length=%d",
+ aRequest->DataPtr().Length());
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::WriteComplete last buffer %d",
+ aRequest->RequestBuffer()());
+ if (iState == EMMAStreamStarted)
+ {
+ if (aRequest->RequestBuffer()() == 1)
+ {
+ iState = EMMAStreamEof;
+ }
+ else
+ {
+ iSourceStream->Read(aRequest);
+ }
+ }
+ // else, all other states ignore write complete
+}
+
+void CMMAStreamHandler::ReadComplete(CMMAStreamRequest* aRequest)
+{
+ if (iState == EMMAStreamPrepare)
+ {
+ WriteRequest(aRequest);
+ iListener.PrepareComplete(KErrNone);
+ iState = EMMAStreamPaused;
+ }
+ else if (iState == EMMAStreamStart)
+ {
+ iState = EMMAStreamStarted;
+ // write first request to server
+ WriteRequest(aRequest);
+ iListener.StartComplete(KErrNone);
+ }
+ else if (iState == EMMAStreamStarted)
+ {
+ WriteRequest(aRequest);
+ }
+ // else, all other states ignore read complete
+}
+
+void CMMAStreamHandler::HandleError(CMMAStreamRequest* /*aRequest*/,
+ TInt aError)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAStreamHandler::HandleError state=%d", iState);
+ if (iState == EMMAStreamPrepare)
+ {
+ iListener.PrepareComplete(aError);
+ iState = EMMAStreamPaused;
+ }
+ else if (iState == EMMAStreamStart)
+ {
+ iListener.StartComplete(aError);
+ iState = EMMAStreamStarted;
+ }
+ else
+ {
+ iListener.HandleError(aError);
+ }
+}
+
+void CMMAStreamHandler::WriteRequest(CMMAStreamRequest* aRequest)
+{
+ if (aRequest->RequestBuffer()() == 1)
+ {
+ iState = EMMAStreamEof;
+ }
+
+ if (!aRequest->IsActive())
+ {
+ aRequest->SetActive();
+ }
+
+ // Send write request to server, HandleRequestCompleteL is called when finished
+ iController.CustomCommandAsync(iDataSourceHandle,
+ 1, /*EProcessBuffer*/
+ aRequest->DataPtr(),
+ aRequest->RequestBuffer(),
+ aRequest->iStatus);
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src.mmf/cmmastreamrequest.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Request used to write or read data
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "CMMAStreamRequest.h"
+#include "MMMAStreamRequestListener.h"
+
+CMMAStreamRequest* CMMAStreamRequest::NewLC(MMMAStreamRequestListener* aListener)
+{
+ CMMAStreamRequest* self = new(ELeave)CMMAStreamRequest(aListener);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAStreamRequest::~CMMAStreamRequest()
+{
+ Cancel();
+ delete iData;
+}
+
+TPtr8& CMMAStreamRequest::DataPtr()
+{
+ return iDataPtr;
+}
+
+void CMMAStreamRequest::CompleteRead(TInt aError)
+{
+ if (aError < KErrNone)
+ {
+ iListener->HandleError(this, aError);
+ }
+ else // OK
+ {
+ iListener->ReadComplete(this);
+ }
+}
+
+void CMMAStreamRequest::SetActive()
+{
+ CActive::SetActive();
+}
+
+TPckgBuf< TInt >& CMMAStreamRequest::RequestBuffer()
+{
+ return iRequestBuffer;
+}
+
+void CMMAStreamRequest::RunL()
+{
+ if (iStatus.Int() == KErrNone)
+ {
+ // data is processed, set ready for reuse
+ iDataPtr.SetLength(0);
+ iListener->WriteComplete(this);
+ }
+ else // error
+ {
+ iListener->HandleError(this, iStatus.Int());
+ }
+}
+
+TInt CMMAStreamRequest::RunError(TInt aError)
+{
+ iListener->HandleError(this, aError);
+ return KErrNone;
+}
+
+void CMMAStreamRequest::DoCancel()
+{
+ // Complete this request
+ TRequestStatus* s = &iStatus;
+ User::RequestComplete(s, KErrCancel);
+}
+
+CMMAStreamRequest::CMMAStreamRequest(MMMAStreamRequestListener* aListener):
+ CActive(EPriorityStandard),
+ iListener(aListener),
+ iDataPtr(NULL, 0)
+{
+ CActiveScheduler::Add(this);
+}
+
+void CMMAStreamRequest::ConstructL()
+{
+ iData = HBufC8::NewL(KMMAStreamRequestBufferSize);
+ iDataPtr.Set(iData->Des());
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src/cmmaaudiostreamratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements RateControl for HTTP stream audio player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmaaudiostreamratecontrol.h"
+
+namespace
+{
+const TInt KErrorMessageSize = 32;
+_LIT(KErrDefaultError, "Symbian OS Error: %d");
+}
+
+CMMAAudioStreamRateControl* CMMAAudioStreamRateControl::NewL(CMMAAudioStreamPlayer* aPlayer)
+{
+ CMMAAudioStreamRateControl* self = new(ELeave) CMMAAudioStreamRateControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+CMMAAudioStreamRateControl::~CMMAAudioStreamRateControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamRateControl::~CMMAAudioStreamRateControl");
+ if (iPlayer)
+ {
+ iPlayer->RemoveStateListener(this);
+ }
+}
+
+CMMAAudioStreamRateControl::CMMAAudioStreamRateControl(CMMAAudioStreamPlayer* aPlayer) :
+ iPlayer(aPlayer), iCurrentRate(KMMADefaultRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamRateControl::CMMAAudioStreamRateControl");
+}
+
+void CMMAAudioStreamRateControl::ConstructL()
+{
+ iPlayer->AddStateListenerL(this);
+}
+
+void CMMAAudioStreamRateControl::StateChanged(TInt aState)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamRateControl::StateChanged");
+ if (aState == CMMAPlayer::EStarted && iCurrentRate == KMMAMinRate)
+ {
+ // do not post event to Java or change player state
+ TInt err = iPlayer->Pause();
+ if (err != KErrNone)
+ {
+ ELOG1( EJavaMMAPI, "CMMAAudioStreamRateControl::StateChanged: Pause error %d", err);
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+ }
+}
+
+TInt CMMAAudioStreamRateControl::SetRateL(TInt aRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAAudioStreamRateControl::SetRateL");
+ TInt newRate;
+ if (aRate <= KMMAMinRate)
+ {
+ newRate = KMMAMinRate;
+ }
+ else
+ {
+ newRate = KMMADefaultRate;
+ }
+
+ if ((iPlayer->State() == CMMAPlayer::EStarted) &&
+ (newRate != iCurrentRate))
+ {
+ if (newRate == KMMAMinRate)
+ {
+ // do not post event to Java or change player state
+ User::LeaveIfError(iPlayer->Pause());
+ }
+ else
+ {
+ // do not post event to Java or change player state
+ iPlayer->StartL();
+ }
+ }
+ iCurrentRate = newRate;
+ return iCurrentRate;
+}
+
+TInt CMMAAudioStreamRateControl::RateL()
+{
+ return iCurrentRate;
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/audiostreaming/src/cmmadatasourcestream.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class for reading data from Java SourceStream to native side
+*
+*/
+
+#include <logger.h>
+#include "mmafunctionserver.h"
+#include "cmmadatasourcestream.h"
+#include "mmmasourcestreamlistener.h"
+#include "cmmastreamrequest.h"
+#include "cmmasourcestreamevent.h"
+
+
+// CONSTRUCTION
+CMMADataSourceStream* CMMADataSourceStream::NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener,
+ MMAFunctionServer* aEventSource
+ )
+{
+ CMMADataSourceStream* self = new(ELeave) CMMADataSourceStream(aEventPoster,
+ aListener);
+ CleanupStack::PushL(self);
+ self->ConstructL(aJNIEnv, aEventSource, aJavaSourceStream);
+ return self;
+}
+
+
+CMMADataSourceStream::~CMMADataSourceStream()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADataSourceStream::~");
+}
+
+
+// Default constructor
+CMMADataSourceStream::CMMADataSourceStream(MMMAEventPoster* aEventPoster,
+ MMMASourceStreamListener* aListener):
+ CMMASourceStream(aEventPoster, aListener)
+{
+}
+
+
+inline void CMMADataSourceStream::ConstructL(JNIEnv* aJNIEnv,MMAFunctionServer* /*aEventSource*/,
+ jobject aJavaSourceStream)
+{
+ CMMASourceStream::ConstructL(aJNIEnv, aJavaSourceStream);
+ CreateDataBufferL(KMMAStreamRequestBufferSize);
+}
+
+void CMMADataSourceStream::WriteL(const TUint8* aData,
+ TInt aLength,
+ TInt aState)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADataSourceStream::WriteL data length %d", aLength);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADataSourceStream::WriteL state %d", aState);
+
+ if (!iRequest)
+ {
+ // there is no request to write
+ return;
+ }
+
+ if (aState >= KErrNone)
+ {
+ if ((aState == CMMASourceStream::ECompleted) &&
+ aLength == -1)
+ {
+ // Stream ended
+ iRequest->RequestBuffer() = 1;
+ }
+ else if ((iData->Length() == 0) &&
+ (iRequest->DataPtr().Length() == 0))
+ {
+ iRequest->DataPtr().Append(aData, aLength);
+ // read next
+ iEventPoster->PostEvent(iReadEvent,
+ CMMAEvent::ENotifyPriority);
+ return;
+ }
+ else if (iData->Length() == 0)
+ {
+ iData->Des().Append(aData, aLength);
+ }
+ }
+
+ // complete read operation
+ CMMAStreamRequest* r = iRequest;
+ iRequest = NULL;
+ r->CompleteRead(aState);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADataSourceStream::WriteL completed");
+}
+
+void CMMADataSourceStream::ResetData()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADataSourceStream::ResetData");
+}
+
+CMMAStreamRequest* CMMADataSourceStream::Request()
+{
+ return iRequest;
+}
+
+void CMMADataSourceStream::Read(CMMAStreamRequest* aRequest)
+{
+ // Setting NULL, means that all read completes are ignored
+ if (!aRequest)
+ {
+ iRequest = NULL;
+ return;
+ }
+
+ if (!iRequest)
+ {
+ iRequest = aRequest;
+ iRequest->RequestBuffer() = 0;
+ iReadEvent->SetLength(aRequest->DataPtr().MaxLength());
+
+ if (iData->Length() > 0)
+ {
+ // Previous read buffered data
+ iRequest->DataPtr().Append(*iData);
+
+ // re-use buffer
+ iData->Des().SetLength(0);
+ }
+
+ // data has been requested, note will be sent
+ iEventPoster->PostEvent(iReadEvent, CMMAEvent::ENotifyPriority);
+ }
+ // else java is already reading
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.dsa/cmmadsawindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* in Direct Screen Access based displays for Helix engine.
+*
+*/
+
+
+#ifndef CMMADSAWINDOW_H
+#define CMMADSAWINDOW_H
+
+
+// INCLUDES
+#include <w32std.h>
+#include <e32std.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "mmmadisplaywindow.h"
+#include "mmafunctionserver.h"
+#include "cmmaplayer.h"
+
+// CONSTANTS
+const TInt KMMAVideoMinDimension = 32; // minimum video width and height
+
+// CLASS DECLARATION
+/**
+* This class implements MMMADisplayWindow functionality
+* in Direct Screen Access based displays for Helix engine.
+*/
+NONSHARABLE_CLASS(CMMADSAWindow): public CBase,
+ public MMMADisplayWindow
+{
+public: // Constructors and destructors
+ static CMMADSAWindow* NewL(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer,
+ RMMFVideoPlayControllerCustomCommands* aVPCustomCommand);
+
+ virtual ~CMMADSAWindow();
+
+private: // Constructors and destructors
+ CMMADSAWindow(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer,
+ RMMFVideoPlayControllerCustomCommands* aVPCustomCommand);
+
+ void ConstructL();
+
+public: // New methods
+ TBool IsVisible() const;
+
+public: // Methods derived from MMMADisplayWindow
+ void SetDestinationBitmapL(CFbsBitmap* aBitmap);
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDrawRect(const TRect& aRect);
+ void SetDrawRectThread(const TRect& aRect);
+ const TRect& DrawRect();
+ TSize WindowSize();
+ void SetPosition(const TPoint& aPosition);
+ void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue);
+ void SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType aThreadType);
+ const TRect& WindowRect();
+ void ContainerDestroyed();
+ /**
+ * Notifies window that any drawing
+ * via direct screen access must be aborted
+ */
+ void AbortDSA();
+
+ /**
+ * Allows window to draw
+ * via direct screen access after MdcAbortDSA
+ */
+ void ResumeDSA();
+
+private:
+ static void StaticSetWindowPosition(
+ CMMADSAWindow* aWindow,
+ TPoint aPosition,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+
+ static void SetWindowVisible(
+ CMMADSAWindow* aWindow,
+ TBool aVisible,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+
+ static void StaticAbortDSA(
+ CMMADSAWindow* aWindow,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+
+ static void StaticResumeDSA(
+ CMMADSAWindow* aWindow,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+private: // Data
+ TRect iDrawRect;
+ TRect iClientRect;
+
+ /**
+ * not owned, used for switching from UI thread to MMA thread
+ */
+ MMAFunctionServer* iEventSource;
+
+ /**
+ * We must depend on player's state because direct screen access may
+ * not be resumed before player is started.
+ */
+ CMMAPlayer* iPlayer;
+
+ /**
+ * not owned, used for controlling video position and visibility
+ */
+ RMMFVideoPlayControllerCustomCommands* iVideoPlayControllerCustomCommands;
+
+ /**
+ * Indicates if content need to be drawn.
+ */
+ TBool iVisible;
+
+ /**
+ * Indicates if DSA is aborted.
+ */
+ TBool iDSAAborted;
+};
+
+#endif // CMMADSAWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.dsa/cmmavideoplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing video.
+*
+*/
+
+
+#ifndef CMMAVIDEOPLAYER_H
+#define CMMAVIDEOPLAYER_H
+
+// INCLUDES
+#include "cmmaaudioplayer.h"
+#include "mmmaguiplayer.h"
+#include "mmmasnapshot.h"
+#include "cmmadsawindow.h"
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+
+// CONSTANTS
+// Error code from MMF meaning that video is missing sound,
+// but still can be played.
+const TInt KNotCompleteVideoError = -12017;
+_LIT(KMMAVideoPlayer, "VideoPlayer");
+
+// CLASS DECLARATION
+/**
+* This class is used for playing video.
+*
+*/
+
+NONSHARABLE_CLASS(CMMAVideoPlayer): public CMMAAudioPlayer,
+ public MMMAGuiPlayer,
+ public MMMASnapshot
+{
+public: // Construction
+ static CMMAVideoPlayer* NewLC(
+ CMMAMMFResolver* aResolver);
+
+ // Destructor
+ ~CMMAVideoPlayer();
+
+protected:
+ // C++ constructor
+ CMMAVideoPlayer(CMMAMMFResolver* aResolver);
+
+ void ConstructL();
+
+public: // from CMMAPlayer
+ IMPORT_C void SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster);
+ void RealizeL();
+ void PrefetchL();
+
+protected: // from CMMAudioPlayer
+ IMPORT_C void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+ void HandleEvent(const TMMFEvent& aEvent);
+ IMPORT_C const TDesC& Type();
+
+public: // From MMMAGuiPlayer
+ IMPORT_C void SetDisplayL(MMMADisplay* aDisplay);
+ IMPORT_C TSize SourceSize();
+ IMPORT_C void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData);
+
+ IMPORT_C MMMASnapshot* SnapshoterL();
+
+public: // From MMMASnapshot
+ IMPORT_C MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings);
+ IMPORT_C CFbsBitmap* SnapshotBitmap();
+ IMPORT_C HBufC8* SnapshotEncoded();
+
+protected: // New methods
+ void CompletePrefetch(TInt aError);
+ void PrepareDisplay();
+ void SourceSizeChanged();
+
+protected: // Data
+ CMMADSAWindow* iDSAWindow;
+ RMMFVideoControllerCustomCommands iVideoControllerCustomCommands;
+ RMMFVideoPlayControllerCustomCommands iVideoPlayControllerCustomCommands;
+
+private: // Data
+ MMMADisplay* iDisplay;
+
+ TSize iSourceSize;
+
+ TFileName iFileExtension;
+ CFbsBitmap* iEmptySnapshotImage;
+
+ CActiveSchedulerWait* iActiveSchedulerWait;
+};
+
+#endif // CMMAVIDEOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudioplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+#ifndef CMMAEMCAUDIOPLAYER_H
+#define CMMAEMCAUDIOPLAYER_H
+
+// INCLUDES
+#include "cmmaemcplayerbase.h"
+#include "mmfbase.h"
+
+// CONSTANTS
+
+const TMdaPriorityPreference KMMAEMCPriorityPreference =
+ EMdaPriorityPreferenceTimeAndQuality;
+
+_LIT(KMMAEMCAudioPlayer, "EMCAudioPlayer");
+
+// CLASS DECLARATION
+/**
+* This class is used for playing sounds
+*
+*/
+
+NONSHARABLE_CLASS(CMMAEMCAudioPlayer): public CMMAEMCPlayerBase
+{
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAEMCAudioPlayer* NewLC(
+ CMMAEMCResolver* aResolver);
+
+ // Destructor
+ IMPORT_C ~CMMAEMCAudioPlayer();
+
+protected:
+ // C++ constructor
+ IMPORT_C CMMAEMCAudioPlayer(CMMAEMCResolver* aResolver);
+ IMPORT_C void ConstructL();
+
+protected: // New methods
+ IMPORT_C virtual void PrefetchDataL(const TDesC8& aData);
+ IMPORT_C virtual void PrefetchFileL();
+ IMPORT_C virtual void PlayCompleteL(TInt aError);
+
+public: // from CMMAPlayer
+ IMPORT_C void RealizeL();
+ IMPORT_C void PrefetchL();
+
+ IMPORT_C const TDesC& Type();
+
+public: // from CMMAPlayer/MMMASourceStreamListener
+ IMPORT_C void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+};
+
+#endif // CMMAEMCAUDIOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcaudiovolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#ifndef CMMAEMCAUDIOVOLUMECONTROL_H
+#define CMMAEMCAUDIOVOLUMECONTROL_H
+
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "VolumeControl.h"
+#include "cmmavolumecontrol.h"
+
+using multimedia::MVolumeControl;
+
+class CMMAEMCAudioPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+ This class is used for setting volume to audio player
+
+-----------------------------------------------------------------------------
+*/
+
+NONSHARABLE_CLASS(CMMAEMCAudioVolumeControl): public CMMAVolumeControl
+{
+public: // constructors and destructors
+ IMPORT_C static CMMAEMCAudioVolumeControl* NewL(CMMAEMCAudioPlayer& aPlayer);
+
+protected:
+ IMPORT_C CMMAEMCAudioVolumeControl(CMMAEMCAudioPlayer& aPlayer);
+ void ConstructL();
+
+ ~CMMAEMCAudioVolumeControl();
+
+public: // from CMMAVolumeControl
+ IMPORT_C void DoSetLevelL(TInt aLevel);
+ IMPORT_C TInt DoGetLevelL();
+
+private: // data
+ MVolumeControl* iVolCntrl;
+
+ // not owned
+ CMMAEMCAudioPlayer& iPlayer;
+};
+
+#endif // CMMAEMCAUDIOVOLUMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcplayerbase.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+#ifndef CMMAEMCPLAYERBASE_H
+#define CMMAEMCPLAYERBASE_H
+
+// INCLUDES
+#include <mmf/common/mmfbase.h>
+#include "cmmaplayer.h"
+#include "e32base.h"
+#include "f32file.h"
+#include "StreamControl.h"
+#include "Events.h"
+#include "ProgDLSource.h"
+#include "MMControlFactory.h"
+#include "ControlObserver.h"
+#include "DataBufferSource.h"
+#include "FileSource.h"
+#include "DescriptorSource.h"
+#include "DataBuffer.h"
+#include "SinkControl.h"
+#include "badesca.h"
+#include "MimeTypes.h"
+#include "StreamControlObserver.h"
+#include "SourceControlObserver.h"
+
+
+using multimedia ::MStreamControl;
+using multimedia ::MControlObserver;
+using multimedia ::MProgDLSource;
+using multimedia ::MDataBufferSource;
+using multimedia ::MDescriptorSource;
+using multimedia ::MDataBuffer;
+using multimedia ::MControl;
+using multimedia ::CMultimediaFactory;
+using multimedia ::MSinkControl;
+using multimedia ::MFileSource;
+using multimedia::MSourceControlObserver;
+using multimedia::MStreamControlObserver;
+
+class CMMAEMCResolver;
+// CLASS DECLARATION
+/**
+* This is base class for players those use EMC
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAEMCPlayerBase): public CMMAPlayer,
+ public MControlObserver
+{
+protected:
+ // C++ constructor
+ CMMAEMCPlayerBase(CMMAEMCResolver* aResolver);
+ void ConstructL();
+
+ ~CMMAEMCPlayerBase();
+public: // new methods
+ /**
+ * Getter for StreamControl
+ */
+ IMPORT_C MStreamControl * StreamControl();
+
+ /**
+ * Multimedia Factory getter
+ */
+ IMPORT_C CMultimediaFactory* MMFactory();
+
+ /**
+ * Check whether this player is playing from a file locator
+ * @return ETrue if is a file player, EFalse otherwise
+ */
+ TBool IsFilePlayer();
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void DeallocateL();
+ void GetDuration(TInt64* aDuration);
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+ void CloseL();
+
+private: //New methods
+ void CreateStreamL();
+ void DetermineMimeTypeL(const TDesC& aFileName, TDes8& aMimeType);
+ void CleanupSource();
+ void AddDataSourceToStreamL();
+
+public: // from MControlObserver
+ void Event(MControl* aControl,
+ TUint aEventType,
+ TAny* aEventObject);
+
+protected:
+
+ CActiveSchedulerWait* iActiveSchedulerWait;
+
+ /**
+ * StreamControl infos, owned
+ */
+ MStreamControl* iMStreamControl;
+ MDataBufferSource* iMDataBufferSource;
+ MDescriptorSource* iMDescriptorSource;
+ MFileSource* iMFileSource;
+ MSinkControl* iMAudioSink;
+ MStreamControl::TStreamState iPrevStreamControlState;
+ enum TSourceType
+ {
+ EFILESOURCE,
+ EDATABUFFERSOURCE,
+ EDESCRIPTORSOURCE
+ };
+ TSourceType iSourceType;
+ RPointerArray<MDataBuffer> iBuffers;
+ RArray<TInt> iAvailable;
+ TBool iIsEOFReached;
+ TBool iAutoWriteBuffer;
+ TInt iBytesReadFromFile;
+ TInt iFileSizeInBytes;
+ CMultimediaFactory* iFactory;
+
+ HBufC8* iMimeType;
+ HBufC8* iDescData;
+
+ /**
+ * Filename used for playing directly from file, owned
+ */
+ HBufC* iFileName;
+
+ /**
+ * Cached media time
+ */
+ TInt64 iMediaTime;
+
+ /**
+ * The time that will be sent with CMMAPlayerEvent::EStarted
+ * (may be different from iMediaTime).
+ */
+ TInt64 iStartedEventTime;
+};
+
+#endif // CMMAEMCPLAYERBASE_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating EMC-based players.
+*
+*/
+
+
+#ifndef CMMAEMCPLAYERFACTORY_H
+#define CMMAEMCPLAYERFACTORY_H
+
+// INCLUDES
+// #include <mmf/common/mmfcontrollerpluginresolver.h> Remove and replace with proper header file
+#include "mmmaplayerfactory.h"
+
+class CMMAEMCResolver;
+
+// CLASS DECLARATION
+/**
+* This class is used for creating EMC-based players.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAEMCPlayerFactory): public CBase, public MMMAPlayerFactory
+{
+public: // Constructor and destructor
+ CMMAEMCPlayerFactory();
+ ~CMMAEMCPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+protected:
+ /**
+ * Creates new CMMAPlayer instance with given resolver.
+ * @param aResolver Resolver that contains needed infos
+ * for creating player.
+ */
+ virtual CMMAPlayer* CreatePlayerL(CMMAEMCResolver* aResolver) = 0;
+
+ /**
+ * Returns list of allowed media IDs
+ */
+ virtual void MediaIdsL(RArray<TUid>& aMediaIds) = 0;
+
+ /**
+ * Checks that is this protocol supported by this factory
+ */
+ TBool IsSupportedProtocolL(const TDesC& aProtocol);
+
+ /**
+ * Checks that is this content-type supported by this factory
+ */
+ TBool IsSupportedContentTypeL(const TDesC& aContentType);
+private:
+ /**
+ * File version of creating player from content type
+ */
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType,
+ const TDesC* aFileName);
+#ifndef RD_JAVA_OMA_DRM_V2
+ /**
+ * Tries to open DRM file
+ */
+ CMMAPlayer* TryOpenDRMFileL(const TDesC& aFileName);
+#endif // RD_JAVA_OMA_DRM_V2
+
+};
+
+#endif // CMMAEMCPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmaemcresolver.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CMMAEMCRESOLVER_H
+#define CMMAEMCRESOLVER_H
+
+#include <MimeTypes.h>
+#include "cmmaplayer.h"
+
+//Supported file extensions
+
+_LIT(K3g2FileExtension, ".3g2");
+_LIT(K3gpFileExtension, ".3gp");
+_LIT(KAacFileExtension, ".aac");
+_LIT(KAmrFileExtension, ".amr");
+_LIT(KAwbFileExtension, ".awb");
+_LIT(KM4aFileExtension, ".m4a");
+_LIT(KMp3FileExtension, ".mp3");
+_LIT(KMp4FileExtension, ".mp4");
+_LIT(KWmaFileExtension, ".wma");
+_LIT(KRmFileExtension, ".rm");
+_LIT(KRaFileExtension, ".ra");
+
+const TInt KContentTypeMaxLength = 30;
+
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS(CMMAEMCResolver): public CBase
+
+{
+public: // Construction
+ /**
+ * Constructs a new mmf resolver object.
+ * @return The new object created. Note that the new object will be
+ * left on the cleanup stack.
+ */
+ static CMMAEMCResolver* NewLC();
+
+public: // New methods.
+
+ HBufC* ContentTypeOwnership();
+
+ HBufC8* MimeTypeOwnership();
+
+ /**
+ * Returns content type
+ */
+ HBufC* ContentType();
+
+ /**
+ * Sets filename
+ * @param aFileName File name to be set or NULL
+ */
+
+ void SetFileNameL(const TDesC* aFileName);
+
+ /**
+ * Sets Mime Type
+ * @param aFileName File name to be set or NULL
+ */
+
+ void SetMimeTypeL(const TDesC* aFileName);
+
+ /**
+ * Returns possible filename or NULL if not set
+ * Ownership is transfered.
+ * @return Content type or NULL if type is not available.
+ */
+ HBufC* FileNameOwnership();
+
+ /**
+ * Get all supported content types.
+ * @param aMimeTypeArray Will contain supported mime types.
+ */
+ void GetSupportedContentTypesL(CDesC16Array& aMimeTypeArray);
+
+
+private:
+
+ /** Finds content type from given File name.
+ */
+ void ResolveContentTypeL(const TDesC& aFileName, TDes8& aMimeType);
+
+ void ResolveContentTypeL();
+
+private:
+ ~CMMAEMCResolver();
+
+private:
+
+ // Owned. Ownership can be transferred with ContentType method.
+ HBufC* iContentType;
+
+ // Owned. Ownership can be transferred with MimeType method.
+ HBufC8* iMimeType;
+
+ // Owned. Ownership can be transferred with FileName method.
+ HBufC* iFileName;
+
+public: // new method
+ void SetSourceInfoL(const HBufC8* aHeaderData);
+
+private:
+ TBool IsRealVideoTypeL(const TDesC8& aHeader);
+
+ TBool IsRealMimeTypeSupported(const TDesC& aMimeType);
+
+private: // Data
+ const HBufC8* iHeaderData; // not owned
+};
+
+#endif // CMMAEMCRESOLVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.emc/cmmamanager.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class uses player factories to generate different players
+*
+*/
+
+
+#ifndef CMMAMANAGER_H
+#define CMMAMANAGER_H
+
+// EXTERNAL INCLUDES
+#include <badesca.h>
+
+// INTERNAL INCLUDES
+#include "mmafunctionserver.h"
+#include "mmmaplayerfactory.h"
+//#include <jutils.h>
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+// CLASS DECLARATION
+/**
+* This class uses player factories to generate different types of players.
+*/
+
+NONSHARABLE_CLASS(CMMAManager): public CBase, public MMMAPlayerFactory
+{
+public: // Constructors and destructors
+ /**
+ * Deletes all owned members.
+ */
+ virtual ~CMMAManager();
+
+ /**
+ * Static constructor
+ */
+ static void StaticCreateManagerL(CMMAManager** aManager,
+ TInt aMIDletSuiteID);
+
+protected:
+ /**
+ * Initializes member variables to defaults.
+ */
+ CMMAManager();
+
+ /**
+ * Second phase construct.
+ */
+ void ConstructL(TInt aMIDletSuiteID);
+
+public: // From MMMAPlayerFactory
+
+ /**
+ * @see MMAPlayerFactory
+ */
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+public: // new methods
+
+ void SetSourceInfoL(const TUint8* header, TInt aLength);
+
+ /**
+ * Adds player factory to manager
+ *
+ * @param aPlayerFactory handle to player factory
+ */
+ IMPORT_C void AddPlayerFactoryL(MMMAPlayerFactory* aPlayerFactory);
+
+private:
+ /**
+ * Array of player factories. Owned.
+ */
+ RPointerArray< MMMAPlayerFactory > iPlayerFactories;
+};
+
+#endif // CMMAMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.mmf/cmmamanager.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class uses player factories to generate different players
+*
+*/
+
+
+#ifndef CMMAMANAGER_H
+#define CMMAMANAGER_H
+
+// EXTERNAL INCLUDES
+#include <badesca.h>
+
+// INTERNAL INCLUDES
+#include "MMAFunctionServer.h"
+#include "MMMAPlayerFactory.h"
+
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+// CLASS DECLARATION
+/**
+* This class uses player factories to generate different types of players.
+*/
+
+NONSHARABLE_CLASS(CMMAManager): public CBase, public MMMAPlayerFactory
+{
+public: // Constructors and destructors
+ /**
+ * Deletes all owned members.
+ */
+ virtual ~CMMAManager();
+
+ /**
+ * Static constructor
+ */
+ static void StaticCreateManagerL(CMMAManager** aManager,
+ TInt aMIDletSuiteID);
+
+protected:
+ /**
+ * Initializes member variables to defaults.
+ */
+ CMMAManager();
+
+ /**
+ * Second phase construct.
+ */
+ void ConstructL(TInt aMIDletSuiteID);
+
+public: // From MMMAPlayerFactory
+
+ /**
+ * @see MMAPlayerFactory
+ */
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+public: // new methods
+
+ /**
+ * Adds player factory to manager
+ *
+ * @param aPlayerFactory handle to player factory
+ */
+ IMPORT_C void AddPlayerFactoryL(MMMAPlayerFactory* aPlayerFactory);
+
+private:
+ /**
+ * Array of player factories. Owned.
+ */
+ RPointerArray< MMMAPlayerFactory > iPlayerFactories;
+};
+
+#endif // CMMAMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,364 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* in graphics surface based displays for Helix engine.
+*
+*/
+
+#ifndef CMMASURFACEWINDOW_H
+#define CMMASURFACEWINDOW_H
+
+
+// INCLUDES
+#include <w32std.h>
+//#include <reflcdui.h>
+#include <graphics/surface.h>
+#include <mmf/common/mmfvideosurfacecustomcommands.h>
+#include <mediaclientvideodisplay.h>
+
+#include <e32std.h>
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "mmmadisplaywindow.h"
+#include "mmafunctionserver.h"
+#include "cmmaplayer.h"
+#include "cmmacanvasdisplay.h"
+
+// FORWARD DECLARATIONS
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class MMMADisplay;
+
+// CONSTANTS
+const TInt KMMAVideoMinDimension = 32; // minimum video width and height
+
+// CLASS DECLARATION
+/**
+* This class implements MMMADisplayWindow functionality
+* in video display to graphics surface based displays for Helix engine.
+*/
+NONSHARABLE_CLASS(CMMASurfaceWindow): public CBase,
+ public MMMADisplayWindow/*,
+ public MUiEventConsumer*/
+{
+public:
+ /**
+ * indicates what method needs to be called in UI thread context.
+ */
+ enum TUiCallbackType
+ {
+ ERemoveSurface = 1,
+ ESetDrawRect,
+ EInitVideoDisplay,
+ EResetSurfaceParameters,
+ ESetChangedSurfaceParameters,
+ ECleanVideoDisplay,
+ EDestroyWindow
+ };
+
+private:
+ /**
+ * indicates different video display initialization states
+ *
+ * video display state transition can happen in following order:
+ * 1. when MIDlet code is:
+ * Player player = Manager.createPlayer(..);
+ * player.realize();
+ * VideoControl vc = (VideoControl)player.getControl("VideoControl");
+ * vc.initDisplayMode(..);
+ * player.start();
+ *
+ * EUIResourcesAndSurfaceParametersNotSet
+ * EUIResourcesSetAndSurfaceParametersNotSet
+ * EUIResourcesAndSurfaceParametersSet
+ *
+ * OR
+ *
+ * 2. when MIDlet code is:
+ * Player player = Manager.createPlayer(..);
+ * player.start();
+ * VideoControl vc = (VideoControl)player.getControl("VideoControl");
+ * vc.initDisplayMode(..);
+ *
+ * EUIResourcesAndSurfaceParametersNotSet
+ * ESurfaceParametersSetAndUIResourcesNotSet
+ * EUIResourcesAndSurfaceParametersSet
+ *
+ * InitVideoDisplayL() should be called only after EUIResourcesAndSurfaceParametersSet
+ * state is reached. ie both UI resources and surface parameters becomes available.
+ *
+ * 3. for below mentioned MIDlet code case:
+ * Player player = Manager.createPlayer(..);
+ * player.start(); // state transition is
+ *
+ * EUIResourcesAndSurfaceParametersNotSet
+ * ESurfaceParametersSetAndUIResourcesNotSet
+ * note that InitVideoDisplayL() is not called and video is not displayed in this case.
+ */
+ enum TVideoDisplayInitState
+ {
+ /**
+ * indicates ui resources and surface parameters are not yet set.
+ * UI resources are RWindowBase, CWsScreenDevice and RWsSession.
+ * Surface parameters are TSurfaceId, TRect and TVideoAspectRatio.
+ */
+ EUIResourcesAndSurfaceParametersNotSet = 1,
+ /**
+ * indicates UI resources are set and surface parameters not yet set.
+ * UI resources are set when initDisplayMode() is called and RWindow becomes available.
+ */
+ EUIResourcesSetAndSurfaceParametersNotSet,
+ /**
+ * indicates UI resources are not yet set and surface parameters are set.
+ * Surface parameters are set when player.start() is called.
+ */
+ ESurfaceParametersSetAndUIResourcesNotSet,
+ /**
+ * indicates UI resources and surface parameters are set.
+ */
+ EUIResourcesAndSurfaceParametersSet
+ };
+
+public: // Constructors and destructors
+ static CMMASurfaceWindow* NewL(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+
+ virtual ~CMMASurfaceWindow();
+
+private: // Constructors and destructors
+ CMMASurfaceWindow(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer);
+
+public: // Methods derived from MMMADisplayWindow
+ void SetDestinationBitmapL(CFbsBitmap* aBitmap);
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDrawRect(const TRect& aRect);
+ void SetDrawRectThread(const TRect& aRect);
+ const TRect& DrawRect();
+ TSize WindowSize();
+ void SetPosition(const TPoint& aPosition);
+ void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue);
+ void SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType aThreadType);
+ void SetVideoCropRegion(const TRect& aRect);
+ void SetRWindowRect(const TRect& aRect, MMMADisplay::TThreadType aThreadType);
+ const TRect& WindowRect();
+ void ContainerDestroyed();
+ void ContainerSet();
+/*
+public: // from base class MUiEventConsumer
+ void MdcDSAResourcesCallback(RWsSession &aWs,
+ CWsScreenDevice &aScreenDevice,
+ RWindowBase &aWindow);
+
+*/
+ void UICallback(TInt aCallbackId);
+ public:
+ virtual void ProcureWindowResourcesFromQWidget(RWsSession * aWs,
+ CWsScreenDevice* aScreenDevice,
+ RWindowBase* aWindow);
+
+ virtual CMMAPlayer* UiPlayer();
+
+public: // New methods
+ TBool IsVisible() const;
+ void SetDisplay(MMMADisplay *aDisplay);
+
+ /**
+ * copies surface paramaters and intializes video display if
+ * RWindow is already set, ie if intDisplayMode already called in midlet.
+ * invokes InitVideoDisplayL() in UI thread context.
+ *
+ * @params aSurfaceId, aCropRect, aPixelAspectRatio surface paramaters.
+ */
+ void SetSurfaceParameters(const TSurfaceId& aSurfaceId,
+ const TRect& aCropRect,
+ const TVideoAspectRatio& aPixelAspectRatio);
+
+ /**
+ * invokes DoRemoveSurface() in UI thread context.
+ */
+ void RemoveSurface();
+
+ /**
+ * updates members variables with new surface parameters and invokes
+ * DoSetChangedSurfaceParameters() in UI thread context.
+ *
+ * @params aSurfaceId, aCropRect, aPixelAspectRatio surface paramaters.
+ */
+ void SetChangedSurfaceParameters(const TSurfaceId& aSurfaceId,
+ const TRect& aCropRect,
+ const TVideoAspectRatio& aPixelAspectRatio);
+
+private: // New methods
+ /**
+ * scales video to the required size.
+ * This method must always be executed in UI-Thread context.
+ *
+ * @param aRect rectangular size to which the video has to be scaled.
+ */
+ void ScaleVideoL(const TRect& aRect);
+
+ /**
+ * starts video rendering to a graphics surface.
+ * restarts video rendering to a graphics surafce with changed parameters.
+ * This method must always be executed in UI-Thread context.
+ */
+ void RedrawVideoL();
+
+ /**
+ * utility function to invoke RedrawVideoL() function with in a TRAP harness.
+ *
+ * @param aSurfaceWindow reference to CMMASurfaceWindow instance on which RedrawVideoL()
+ * has to be invoked
+ * @return TInt Symbian OS error code, KErrNone if no error
+ */
+ static TInt StaticRedrawVideo(CMMASurfaceWindow& aSurfaceWindow);
+
+ /**
+ * creates new instance of CMediaClientVideoDisplay and intializes it with
+ * surfaces and windows.
+ * This method must always be executed in UI-Thread context.
+ */
+ void InitVideoDisplayL();
+
+ /**
+ * updates CMediaClientVideoDisplay instance with new surface parameters.
+ * This method must always be executed in UI-Thread context.
+ */
+ void DoSetChangedSurfaceParameters();
+
+ /**
+ * resets CMediaClientVideoDisplay instance with new surface parameters.
+ * This method must always be executed in UI-Thread context.
+ */
+ void DoResetSurfaceParameters();
+
+ /**
+ * Removes Surface from RWindow
+ * This method must always be executed in UI-Thread context.
+ */
+ void DoRemoveSurface();
+
+ /**
+ * removes surfaces and windows from CMediaClientVideoDisplay instance
+ * and deletes the instance.
+ * This method must always be executed in UI-Thread context.
+ */
+ void CleanVideoDisplay();
+
+ /**
+ * Deletes this object.
+ *
+ * @since S60 v5.2
+ */
+ void Destroy();
+
+private: // Data
+ /**
+ * drawing area where video is rendered.
+ */
+ TRect iContentRect;
+
+ /**
+ * parent rectangle used for positioning contentRect.
+ */
+ TRect iParentRect;
+
+ /**
+ * Symbian RWindow rect
+ */
+ TRect iRWindowRect;
+
+ /**
+ * not owned, used for switching from UI thread to MMA thread
+ */
+ MMAFunctionServer* iEventSource;
+
+ /**
+ * We must depend on player's state because direct screen access may
+ * not be resumed before player is started.
+ * not owned.
+ */
+ CMMAPlayer* iPlayer;
+
+ /**
+ * crop rectangle of video
+ */
+ TRect iVideoCropRegion;
+
+ /**
+ * owned, used for video display on surface
+ * this instance is created & accessed in UI thread only.
+ */
+ CMediaClientVideoDisplay* iMediaClientVideoDisplay;
+
+ /**
+ * Display instance used to invoke UI callbacks.
+ * Not owned.
+ */
+ MMMADisplay* iDisplay;
+
+ /**
+ * Window server session used by UI thread.
+ * Adjustable and usable from UI thread only.
+ * Not owned.
+ */
+ RWsSession* iWs;
+
+ /**
+ * Screen device used by UI thread.
+ * Adjustable and usable from UI thread only.
+ * Not owned.
+ */
+ CWsScreenDevice* iScreenDevice;
+
+ /**
+ * Window where video is displayed.
+ * Adjustable and usable from UI thread only.
+ * From UI thread.
+ * Not owned.
+ */
+ RWindowBase* iWindow;
+
+ /**
+ * The surface to be created for composition.
+ */
+ TSurfaceId iSurfaceId;
+
+ /**
+ * The dimensions of the crop rectangle, relative to the video image.
+ */
+ TRect iCropRect;
+
+ /**
+ * The pixel aspect ratio to display video picture.
+ */
+ TVideoAspectRatio iPixelAspectRatio;
+
+ /**
+ * indicates the video display initialization state.
+ *
+ */
+ TVideoDisplayInitState iVideoDisplayInitState;
+
+ /**
+ * Indicates if content need to be drawn.
+ */
+ TBool iVisible;
+
+};
+
+#endif // CMMASURFACEWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc.nga/cmmavideoplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing video.
+*
+*/
+
+#ifndef CMMAVIDEOPLAYER_H
+#define CMMAVIDEOPLAYER_H
+
+// INCLUDES
+#include "cmmaaudioplayer.h"
+#include "mmmaguiplayer.h"
+#include "mmmasnapshot.h"
+#include "cmmasurfacewindow.h"
+//#include <jutils.h>
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+
+// CONSTANTS
+// Error code from MMF meaning that video is missing sound,
+// but still can be played.
+const TInt KNotCompleteVideoError = -12017;
+_LIT(KMMAVideoPlayer, "VideoPlayer");
+
+// CLASS DECLARATION
+/**
+* This class is used for playing video.
+*
+*/
+NONSHARABLE_CLASS(CMMAVideoPlayer): public CMMAAudioPlayer,
+ public MMMAGuiPlayer,
+ public MMMASnapshot
+{
+public: // Construction
+ static CMMAVideoPlayer* NewLC(
+ CMMAMMFResolver* aResolver);
+
+ // Destructor
+ ~CMMAVideoPlayer();
+
+protected:
+ // C++ constructor
+ CMMAVideoPlayer(CMMAMMFResolver* aResolver);
+
+ void ConstructL();
+
+public: // from CMMAPlayer
+ IMPORT_C void SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster);
+ void RealizeL();
+ void PrefetchL();
+
+protected: // from CMMAudioPlayer
+ IMPORT_C void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+ void HandleEvent(const TMMFEvent& aEvent);
+ IMPORT_C const TDesC& Type();
+
+public: // From MMMAGuiPlayer
+ IMPORT_C void SetDisplayL(MMMADisplay* aDisplay);
+ IMPORT_C TSize SourceSize();
+ IMPORT_C void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData);
+
+ IMPORT_C MMMASnapshot* SnapshoterL();
+
+public: // From MMMASnapshot
+ IMPORT_C MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings);
+ IMPORT_C CFbsBitmap* SnapshotBitmap();
+ IMPORT_C HBufC8* SnapshotEncoded();
+
+ protected: // New methods
+ void CompletePrefetch( TInt aError );
+ void PrepareDisplay();
+ public:
+ void SourceSizeChanged();
+
+protected: // Data
+ CMMASurfaceWindow* iSurfaceWindow;
+ RMMFVideoControllerCustomCommands iVideoControllerCustomCommands;
+ RMMFVideoPlayControllerCustomCommands iVideoPlayControllerCustomCommands;
+ RMMFVideoPlaySurfaceSupportCustomCommands iVideoPlaySurfaceSupportCustomCommands;
+
+private: // Data
+ // not owned
+ MMMADisplay* iDisplay;
+
+ TSize iSourceSize;
+
+ TFileName iFileExtension;
+
+ /**
+ * struct to keep track of Surface
+ */
+ struct MMASurface
+ {
+ // owned, should be freed using
+ // RMMFVideoPlaySurfaceSupportCustomCommands::SurfaceRemoved().
+ TSurfaceId iPrevSurfaceId;
+ TBool iPrevSurfaceAvailable;
+ } iMMASurface;
+
+ // owned
+ CFbsBitmap* iEmptySnapshotImage;
+
+ // owned
+ CActiveSchedulerWait* iActiveSchedulerWait;
+};
+
+#endif // CMMAVIDEOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiometadatacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAAudioMetaDataControl is a concrete class for getting
+* metadata from an audio media.
+*
+*/
+
+
+#ifndef CMMAAUDIOMETADATACONTROL_H
+#define CMMAAUDIOMETADATACONTROL_H
+
+// INCLUDES
+#include <mmfcontroller.h>
+
+#include "cmmametadatacontrol.h"
+
+// CLASS DECLARATION
+/**
+* This is a concrete class for getting metadata from an audio media.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioMetaDataControl): public CMMAMetaDataControl
+{
+public:
+ CMMAAudioMetaDataControl(RMMFController& aController);
+
+protected: // from CMMAMetaDataControl
+
+ TInt KeyCountL();
+ HBufC* KeyL(TInt aIndex);
+
+ HBufC* KeyValueL(const TDesC& aKey);
+
+private:
+ RMMFController& iController;
+};
+
+#endif // CMMAAUDIOMETADATACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudioplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+#ifndef CMMAAUDIOPLAYER_H
+#define CMMAAUDIOPLAYER_H
+
+// INCLUDES
+#include "cmmammfplayerbase.h"
+//#include <jutils.h>
+
+
+_LIT(KMMAAudioPlayer, "AudioPlayer");
+
+/**
+Mixin class for playback complete notifications.
+*/
+class MPlaybackCompletedCallback
+{
+public:
+ virtual void HandlePlaybackCompleteL() = 0;
+ virtual void ErrorPlaybackComplete(TInt aError) = 0;
+};
+
+/**
+Active object used for give MMF server time to complete its playback
+*/
+class CPlaybackCompletedCallback : public CTimer
+{
+public:// Constructor and destructor
+ static CPlaybackCompletedCallback* NewL(MPlaybackCompletedCallback& aObs);
+ ~CPlaybackCompletedCallback();
+
+public: // new methods
+ void Callback();
+
+public: // From CTimer
+ void RunL();
+ TInt RunError(TInt aError);
+
+private: // Constructor
+ CPlaybackCompletedCallback(MPlaybackCompletedCallback& aObs);
+
+private: // Data
+ MPlaybackCompletedCallback& iObs;
+};
+
+// CLASS DECLARATION
+/**
+* This class is used for playing sounds
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioPlayer): public CMMAMMFPlayerBase,
+ public MPlaybackCompletedCallback
+
+{
+public: // Construction
+ /**
+ * Creates new player.
+ */
+ static CMMAAudioPlayer* NewLC(
+ CMMAMMFResolver* aResolver);
+
+ // Destructor
+ ~CMMAAudioPlayer();
+
+protected:
+ // C++ constructor
+ CMMAAudioPlayer(CMMAMMFResolver* aResolver);
+ void ConstructL();
+
+protected: // New methods
+ IMPORT_C virtual void PrefetchDataL(const TDesC8& aData);
+ IMPORT_C virtual void PrefetchFileL();
+ IMPORT_C virtual void PlayCompleteL(TInt aError);
+
+public: // from CMMAPlayer
+ void RealizeL();
+ void PrefetchL();
+
+ const TDesC& Type();
+
+public: // from CMMAPlayer/MMMASourceStreamListener
+ void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+
+public: // from MMMFControllerEventMonitorObserver
+ void HandleEvent(const class TMMFEvent& aEvent);
+
+public: // from MPlaybackCompletedCallback
+ IMPORT_C void HandlePlaybackCompleteL();
+ IMPORT_C void ErrorPlaybackComplete(TInt aError);
+
+private: // data
+ // Owned playback callback active object
+ CPlaybackCompletedCallback* iPlaybackCompleted;
+};
+
+#endif // CMMAAUDIOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudioplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating wav player.
+*
+*/
+
+
+#ifndef CMMAAUDIOPLAYERFACTORY_H
+#define CMMAAUDIOPLAYERFACTORY_H
+
+// INCLUDES
+#include "cmmammfplayerfactory.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating wav player.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAAudioPlayerFactory* NewLC();
+ ~CMMAAudioPlayerFactory();
+
+private: // Constructor
+ CMMAAudioPlayerFactory();
+
+public: // From CMMAMMFPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+};
+
+#endif // CMMAAUDIOPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiorecordcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RecordControl for AudioRecorder
+*
+*/
+
+
+#ifndef CMMAAUDIORECORDCONTROL_H
+#define CMMAAUDIORECORDCONTROL_H
+
+// INCLUDES
+#include "cmmarecordcontrol.h"
+#include "cmmaaudiorecorder.h"
+
+// CLASS DECLARATION
+/**
+* RecordControl for AudioRecorder
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioRecordControl): public CMMARecordControl,
+ public MMMFControllerEventMonitorObserver
+{
+public:
+ static CMMAAudioRecordControl* NewL(CMMAAudioRecorder* aRecorder);
+ ~CMMAAudioRecordControl();
+
+protected:
+ CMMAAudioRecordControl(CMMAAudioRecorder* aRecorder);
+
+public: // From CMMARecordControl
+ void InitializeL();
+ void DoStartRecordL();
+ void DoStopRecordL();
+ void DoResetL();
+ TInt SetRecordSizeLimitL(TInt aSize);
+
+public: // From MMMFControllerEventMonitorObserver
+ void HandleEvent(const TMMFEvent& aEvent);
+
+private: // data
+ CMMAAudioRecorder* iRecorder; // not owned
+};
+
+
+#endif // CMMAAUDIORECORDCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiorecorder.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for recording Audio
+*
+*/
+
+
+#ifndef CMMAAUDIORECORDER_H
+#define CMMAAUDIORECORDER_H
+
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "cmmammfplayerbase.h"
+#include "cmmaplayerproperties.h"
+#include "tmmaparametervalidator.h"
+#include "rmmatempfile.h"
+
+class CMMAOutputStream;
+
+_LIT(KMMAAudioRecorder, "AudioRecorder");
+
+// CLASS DECLARATION
+/**
+* This class is used for recording Audio
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAAudioRecorder): public CMMAMMFPlayerBase
+{
+public: // Construction
+ static CMMAAudioRecorder* NewLC(
+ CMMAMMFResolver* aResolver,
+ CMMAAudioSettings* aAudioSettings,
+ TInt aMIDletSuiteID);
+
+ // Destructor
+ ~CMMAAudioRecorder();
+
+protected:
+ // C++ constructor
+ CMMAAudioRecorder(
+ CMMAMMFResolver* aResolver, TInt aMIDletSuiteID);
+
+protected: // new methods
+ void DoOpenL();
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent = ETrue);
+ void PrefetchL();
+ void GetDuration(TInt64* aDuration);
+ const TDesC& Type();
+ void DeallocateL();
+
+public: // new methods, for CMMAAudioRecordControl
+ void InitializeL(RFile* aFile,
+ MMMFControllerEventMonitorObserver* aObserver);
+ void Deinitialize();
+
+ void StartRecordL();
+ void StopRecordL();
+ void ResetL();
+ TInt SetRecordSizeLimitL(TInt aSize);
+
+public: // from MMMFControllerEventMonitorObserver
+ void HandleEvent(const class TMMFEvent& aEvent);
+
+private:
+ // owned
+ CMMAAudioSettings* iSettings;
+
+ RMMFAudioRecordControllerCustomCommands iAudioRecordControllerCustomCommands;
+ RMMFAudioControllerCustomCommands iAudioControllerRecCustomCommands;
+
+ CMMAOutputStream* iOutputStream;
+
+ TInt iRecordSizeLimit;
+
+ // error code returned from RMMFController::Pause method. Used check if
+ // setting position is needed before recording.
+ TInt iPauseError;
+
+ // Data sink info
+ TMMFMessageDestination iSinkInfo;
+
+ // File to record
+ RFile iFile;
+
+ // Pass events ahead
+ MMMFControllerEventMonitorObserver* iObserver;
+
+ // Supplier of current controller
+ TPtrC iSupplier;
+
+ // Wait for native events
+ CActiveSchedulerWait* iWait;
+ TInt iError;
+
+ TBool iResetController;
+
+ // flag to hold EOF status
+ TBool iEOFReached;
+};
+
+#endif // CMMAAUDIORECORDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiorecorderfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating audio recorder
+*
+*/
+
+
+#ifndef CMMAAUDIORECORDERFACTORY_H
+#define CMMAAUDIORECORDERFACTORY_H
+
+// INCLUDES
+#include "cmmammfplayerfactory.h"
+#include "tmmaparametervalidator.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating audio recorder
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAAudioRecorderFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructors and destructor
+ static CMMAAudioRecorderFactory* NewLC(TInt aMIDletSuiteID);
+ ~CMMAAudioRecorderFactory();
+
+private: // Constructor
+ CMMAAudioRecorderFactory(TInt aMIDletSuiteID);
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+public: // From CMMAMMFPlayerFactory
+
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+
+
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+
+ void PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection);
+
+private: // Data
+ CMMAAudioSettings* iSettings; // Owned settings
+ TInt iMIDletSuiteID;
+
+};
+
+#endif // CMMAAUDIORECORDERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaaudiovolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#ifndef CMMAAUDIOVOLUMECONTROL_H
+#define CMMAAUDIOVOLUMECONTROL_H
+
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "cmmavolumecontrol.h"
+//#include <jutils.h>
+class CMMAAudioPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+ This class is used for setting volume to audio player
+
+-----------------------------------------------------------------------------
+*/
+
+NONSHARABLE_CLASS(CMMAAudioVolumeControl): public CMMAVolumeControl
+{
+public:
+ IMPORT_C static CMMAAudioVolumeControl* NewL(CMMAAudioPlayer* aPlayer);
+
+protected:
+ CMMAAudioVolumeControl(CMMAAudioPlayer* aPlayer);
+ void ConstructL();
+
+public: // from CMMAVolumeControl
+ void DoSetLevelL(TInt aLevel);
+ TInt DoGetLevelL();
+
+private:
+ RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands;
+};
+
+#endif // CMMAAUDIOVOLUMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmabitmapwindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This abstract class implements MMMADisplayWindow functionality
+* in CFbsBitmap based displays.
+*
+*/
+
+
+#ifndef CMMABITMAPWINDOW_H
+#define CMMABITMAPWINDOW_H
+
+// INCLUDES
+#include "mmmadisplaywindow.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CFbsBitmapDevice;
+class CGraphicsContext;
+
+// CLASS DECLARATION
+/**
+* This abstract class implements MMMADisplayWindow functionality in
+* CFbsBitmap based displays.
+*
+*
+*/
+
+
+NONSHARABLE_CLASS(CMMABitmapWindow): public CBase,
+ public MMMADisplayWindow
+{
+public: // Constructors and destructors
+ ~CMMABitmapWindow(); // Destructor ()
+
+ static CMMABitmapWindow* NewL();
+
+protected: // Constructors and destructors
+ // Default constructor, protected to allow derivation
+ CMMABitmapWindow();
+
+public: // Methods derived from MMMADisplayWindow
+ void SetDestinationBitmapL(CFbsBitmap* aBitmap);
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDrawRect(const TRect& aRect);
+ void SetDrawRectThread(const TRect& aRect);
+ const TRect& DrawRect();
+ TSize WindowSize();
+ void SetPosition(const TPoint& aPosition);
+ void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue);
+ void SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType aThreadType);
+ const TRect& WindowRect();
+
+protected: // Data
+ /**
+ * Pointer to the bitmap that is used for drawing.
+ * iBitmap is owned by this class.
+ */
+ CFbsBitmap* iBitmap;
+
+ /**
+ * Owned bitmap device
+ */
+ CFbsBitmapDevice* iBitmapDevice;
+
+ /**
+ * Owned bitmap context
+ */
+ CGraphicsContext* iBitmapContext;
+
+ /**
+ * Actual area used for drawing. Set by SetDrawRect method.
+ */
+ TRect iDrawRect;
+ TRect iClientRect;
+
+ inline TDisplayWindowType GetDisplayWindowType() const
+ {
+ return EDisplayWindowTypeIsBitmap;
+ }
+};
+
+#endif // CMMABITMAPWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmacameraplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing camera.
+*
+*/
+
+
+#ifndef CMMACAMERAPLAYER_H
+#define CMMACAMERAPLAYER_H
+
+// INCLUDES
+#include <ecam.h>
+#include "cmmaplayer.h"
+#include "mmmaguiplayer.h"
+#include "mmmasnapshot.h"
+#include "cmmacamerawindow.h"
+
+// CONSTANTS
+_LIT(KMMACameraPlayer, "CameraPlayer");
+
+// CLASS DECLARATION
+/**
+* This class is used for playing camera.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMACameraPlayer): public CMMAPlayer,
+ public MMMAGuiPlayer,
+ public MMMASnapshot,
+ public MCameraObserver
+{
+public: // Construction
+ /**
+ * Creates new CMMACameraPlayer for the camera at certain index.
+ * Index must be smaller CCamera::CamerasAvailable().
+ * @param aCameraIndex Index of the camera.
+ */
+ static CMMACameraPlayer* NewLC(TInt aCameraIndex);
+
+ // Destructor
+ ~CMMACameraPlayer();
+
+protected:
+ // C++ constructor
+ CMMACameraPlayer();
+ void ConstructL(TInt aCameraIndex);
+
+private: // new methods
+ TInt64 CurrentTime();
+ void ResolveViewFinderSizeL(TSize& aSize);
+ void ResolveScreenSizeL(TSize& aSize);
+ void ResolveCaptureSizes(const CCamera::TFormat aFormat,
+ const TInt aNumImageSizesSupported,
+ const TSize& aRequestSize,
+ TSize& aSourceSize,
+ TInt& aSourceIndex,
+ TInt& aLargestIndex);
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void DeallocateL();
+ void RealizeL();
+ void PrefetchL();
+ void GetDuration(TInt64* aDuration);
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+ void CloseL();
+ const TDesC& Type();
+public: // From MCameraObserver
+ void ReserveComplete(TInt aError);
+ void PowerOnComplete(TInt aError);
+ void ViewFinderFrameReady(CFbsBitmap& aFrame);
+
+ void ImageReady(CFbsBitmap* aBitmap,
+ HBufC8* aData,
+ TInt aError);
+
+ void FrameBufferReady(MFrameBuffer* aFrameBuffer,
+ TInt aError);
+
+public: // From MMMAGuiPlayer
+ void SetDisplayL(MMMADisplay* aDisplay);
+ TSize SourceSize();
+ void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData);
+ MMMASnapshot* SnapshoterL();
+
+public: // From MMMASnapshot
+ MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings);
+ CFbsBitmap* SnapshotBitmap();
+ HBufC8* SnapshotEncoded();
+
+public: // New methods
+ TInt CameraHandle();
+ /**
+ * Disables or enables viewfinder stopping.
+ * Needed when using recording.
+ *
+ * @param aStopViewFinder If true viewfinder will be really stopped.
+ */
+ void SetViewFinderMode(TBool aStopViewFinder);
+
+private: // Data
+ /**
+ * Window used to render viewfinder.
+ * Owned.
+ */
+ CMMACameraWindow* iWindow;
+
+ /**
+ * Camera instance used for taking snapshots and recording.
+ * iWindow uses this to create duplicated camera instance.
+ * Owned.
+ */
+ CCamera* iCamera;
+ MMMADisplay* iDisplay;
+
+ // index to be used for size enumeration
+ TInt iSourceSizeIndex;
+
+ TInt64 iMediaTime;
+ TInt64 iStartTime;
+
+ TRequestStatus* iSnapshotStatus;
+
+ // Owned.
+ CFbsBitmap* iSnapshotBitmap;
+ HBufC8* iSnapshotEncoded;
+
+ TSize iSize;
+ TBool iStopViewFinder;
+
+ // inner class for waiting realize, owned
+ class CRealizeWait : public CActiveSchedulerWait
+ {
+ public:
+ TInt iError;
+ };
+ CRealizeWait* iRealizeWait;
+};
+
+#endif // CMMACAMERAPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmacameraplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating camera players.
+*
+*/
+
+
+#ifndef CMMACAMERAPLAYERFACTORY_H
+#define CMMACAMERAPLAYERFACTORY_H
+
+// INCLUDES
+#include <e32base.h>
+#include "cmmammfplayerfactory.h"
+#include "tmmaparametervalidator.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating camera players.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMACameraPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Construction
+ static CMMACameraPlayerFactory* NewLC();
+ ~CMMACameraPlayerFactory();
+
+private:
+ CMMACameraPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+public: // From CMMAMMFPlayerFactory
+
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+
+
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+ void PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection);
+
+private: // Data
+ CMMAAudioSettings* iAudioSettings; // Owned audio settings
+ TMMAVideoSettings iVideoSettings; // Video settings
+ TInt iCameraIndex;
+};
+
+#endif // CMMACAMERAPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmacamerawindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* for Camera viewfinder usage.
+*
+*/
+
+
+#ifndef CMMACAMERAWINDOW_H
+#define CMMACAMERAWINDOW_H
+
+// INCLUDES
+#include <ecam.h>
+//#include <reflcdui.h>
+#include <w32std.h>
+#include "mmmadisplaywindow.h"
+#include "mmmadisplay.h"
+#include "jni.h"
+#include "cmmacanvasdisplay.h"
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class MMMADisplay;
+class CMMACanvasDisplay;
+
+// CLASS DECLARATION
+/**
+* This class implements MMMADisplayWindow functionality
+* to use with CMMACameraPlayer.
+* It duplicates its camera instance within the UI thread
+* and displays the viewfinder using the UI
+* DirectScreenAccess resources.
+*
+* @since S60 v5.0
+*/
+
+
+NONSHARABLE_CLASS(CMMACameraWindow): public CBase,
+ public MMMADisplayWindow,
+ public MCameraObserver,
+ // public MUiEventConsumer,
+ public MDirectScreenAccess
+{
+public:
+ enum TUiCallbackType
+ {
+ EDeleteViewFinder = 1,
+ EHideViewFinder,
+ EShowViewFinder,
+ EResetViewFinder,
+ EDestroyWindow
+ };
+
+ /**
+ * Two-phased constructor.
+ *
+ * @param aCameraHandle A handle to existing CCamera instance.
+ */
+ static CMMACameraWindow* NewL(TInt aCameraHandle);
+
+
+ /**
+ * Destructor.
+ */
+ ~CMMACameraWindow();
+
+ /**
+ * Gets an information if the DirectViewFinder is started
+ *
+ * @since S60 v5.0
+ * @return ETrue if DirectViewFinder is active
+ */
+ TBool ViewFinderActive();
+
+ /**
+ * Notifies window about Started state change
+ *
+ * @since S60 v5.0
+ * @param aStarted Indicates that camera player is in started state
+ */
+ void SetStarted(TBool aStarted);
+
+ /**
+ * Sets iDisplay
+ * Used to invoke callbacks in UI thread
+ *
+ * @since S60 v5.0
+ * @param "aDisplay" A Display to be used for callbacks.
+ * When set, the duplicated CCamera is created in UI thread
+ * and the necessary DSA resources are got.
+ * When replacing an old Display (set earlier)
+ * all the old resources are deleted.
+ * NULL deletes all allocated UI resources.
+ */
+ void SetDisplay(MMMADisplay *aDisplay);
+
+
+// from base class MMMADisplayWindow
+ void SetDestinationBitmapL(CFbsBitmap* aBitmap);
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDrawRect(const TRect& aRect);
+ void SetDrawRectThread(const TRect& aRect);
+ const TRect& DrawRect();
+ TSize WindowSize();
+ void SetPosition(const TPoint& aPosition);
+ void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue);
+ void SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType aThreadType);
+ void SetRWindowRect(const TRect& aRect, MMMADisplay::TThreadType aThreadType);
+ const TRect& WindowRect();
+ TDisplayWindowType GetDisplayWindowType() const;
+ TBool IsVisible() const;
+ void ContainerSet();
+ void ContainerDestroyed();
+
+
+// from base class MCameraObserver
+ void ReserveComplete(TInt aError);
+ void PowerOnComplete(TInt aError);
+ void ViewFinderFrameReady(CFbsBitmap& aFrame);
+
+ void ImageReady(CFbsBitmap* aBitmap,
+ HBufC8* aData,
+ TInt aError);
+
+ void FrameBufferReady(MFrameBuffer* aFrameBuffer,
+ TInt aError);
+
+
+// from base class MUiEventConsumer
+ /* void MdcDSAResourcesCallback(
+ RWsSession &aWs,
+ CWsScreenDevice &aScreenDevice,
+ RWindowBase &aWindow);
+ */
+ void UICallback(TInt aCallbackId);
+
+
+// from base class MDirectScreenAccess
+ void AbortNow(RDirectScreenAccess::TTerminationReasons aReasons);
+ void Restart(RDirectScreenAccess::TTerminationReasons aReasons);
+
+
+private:
+ /**
+ * Constructor.
+ * @see CMMACameraWindow::NewL()
+ */
+ CMMACameraWindow(TInt aCameraIndex);
+
+ /**
+ * Creates UI Camera -
+ * a new CCamera instance (duplicated from handle
+ * given to the constructor)
+ * Have to be called from the thread which UI Camera
+ * will be controlled from
+ *
+ * @since S60 v5.0
+ * @param "aWs" WS session from the last MdcDSAResourcesCallback
+ * @param "aScreenDevice" Screen from the last MdcDSAResourcesCallback
+ * @param "aWindow" Window from the last MdcDSAResourcesCallback
+ */
+ void UIStartViewFinder(RWsSession &aWs, CWsScreenDevice &aScreenDevice, RWindowBase &aWindow);
+
+ /**
+ * If UI Camera have been created
+ * it starts/hides the DirectViewFinder
+ * Have to be called from UI thread in which UI Camera
+ * have been created!
+ *
+ * @since S60 v5.0
+ * @param "aVisible" If true DirectViewFinder is started, else stopped
+ */
+ void SetViewFinderVisibility(TBool aVisible);
+
+ /**
+ * Stops the DirectViewFinder and deletes UI Camera instance
+ * Have to be called from UI thread in which UI Camera
+ * have been created before the CMMACameraWindow instance
+ * is deleted!
+ *
+ * @since S60 v5.0
+ */
+ void ReleaseUiResources();
+
+ /**
+ * The callback method invoked by starter timer
+ *
+ * @since S60 v5.0
+ * @param aThis An instance of CMMACameraWindow
+ * @return Always returns EFalse
+ */
+ static TInt StarterTimerCallback(TAny* aThis);
+
+ /**
+ * Starts viewfinder.
+ *
+ * @since S60 v5.0
+ */
+ void StartViewFinder();
+
+ /**
+ * Resets (stops and starts) viewfinder
+ *
+ * @since S60 v5.0
+ */
+ void ResetViewFinder();
+
+ /**
+ * Draws the error message to specified area.
+ * Used in cases when viewfinder is unable to start
+ *
+ * @since S60 v5.0
+ * @param aError Viewfinder error id
+ * @param aDrawRect Area to draw to
+ */
+ void DrawViewFinderErrorL(const TInt aError, const TRect& aDrawRect);
+
+ /**
+ * Deletes this object.
+ *
+ * @since S60 v5.0
+ */
+ void Destroy();
+
+private: // data
+ /**
+ * Indicates the window visibility.
+ */
+ TBool iVisible;
+
+ /**
+ * Indicated that owning player is in Started state.
+ */
+ TBool iStarted;
+
+ /**
+ * Indicates that Direct viewfinder is displayed on screen.
+ */
+ TBool iViewFinderVisible;
+
+ /**
+ * Indicates that duplicated camera (iUICamera) is powered on.
+ */
+ TBool iCameraPowerOn;
+
+ /**
+ * Rectangle to display viewfinder on (Window coordinates).
+ */
+ TRect iDrawRect;
+
+ /**
+ * The area of the window.
+ */
+ TRect iClientRect;
+
+ /**
+ * The handle of original camera instance.
+ */
+ TInt iCameraHandle;
+
+ /**
+ * UI Camera instance
+ * Duplicated from iCameraHandle.
+ * Adjustable and usable from UI thread only.
+ * Own.
+ */
+ CCamera* iUICamera;
+
+ /**
+ * Display instance used to invoke UI callbacks.
+ * Not owned.
+ */
+ MMMADisplay* iDisplay;
+
+ /**
+ * Window server session used by UI thread.
+ * Adjustable and usable from UI thread only.
+ * Not owned.
+ */
+ RWsSession* iWs;
+
+ /**
+ * Screen device used by UI thread.
+ * Adjustable and usable from UI thread only.
+ * Not owned.
+ */
+ CWsScreenDevice* iScreenDevice;
+
+ /**
+ * Window to draw viewfinder on.
+ * Adjustable and usable from UI thread only.
+ * From UI thread.
+ * Not owned.
+ */
+ RWindowBase* iWindow;
+
+ /**
+ * The timer to delay viewfinder start
+ * to avoid many showing/hidding request
+ * (for instance when scrolling the viewfinder)
+ * Adjustable and usable from UI thread only.
+ * Own.
+ */
+ CPeriodic* iStarterTimer;
+
+ /**
+ * Direct screen access used to draw the error message.
+ * Adjustable and usable from UI thread only.
+ * Own.
+ */
+ CDirectScreenAccess* iDirectAccess;
+
+ /**
+ * Count of remaining allowed DSA restarts.
+ * In some cases (like screen orientation change)
+ * the DSA fails to start for some time.
+ * Therefore the start is tried more times.
+ */
+ TUint iRemainingDSAStartAttempts;
+
+ /**
+ * An icon used to display instead of viewfinder.
+ * in case that viewfinder start fails.
+ * Own.
+ */
+ CFbsBitmap* iErrorIconBitmap;
+
+ /**
+ * Bitmap mask of iErrorIconBitmap.
+ * Own.
+ */
+ CFbsBitmap* iErrorIconMaskBitmap;
+
+
+ /**
+ * Symbian RWindow rect
+ */
+ TRect iRWindowRect;
+
+ /**
+ * jobject to MMACanvasDisplay java class
+ */
+ jobject iJavaDisplayObject;
+
+ /*
+ * class name of MMACanvasDisplay java class
+ */
+ jclass iJavaDisplayClass;
+
+ JNIEnv * iJni;
+};
+
+#endif // CMMACAMERAWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmacanvasdisplay.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Draws to Canvas.
+*
+*/
+
+
+#ifndef CMMACANVASDISPLAY_H
+#define CMMACANVASDISPLAY_H
+
+// INCLUDES
+#include "cmmadisplay.h"
+#include "jni.h"
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CMMABitmapWindow;
+//class MMAFunctionServer;
+//class MMIDCanvas;
+
+// CLASS DECLARATION
+/**
+* Display for MMIDCanvas objects.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMACanvasDisplay): public CMMADisplay
+{
+public: // Constructors and destructors
+ static CMMACanvasDisplay* NewLC(MMAFunctionServer* aEventSource , jobject obj/*MMIDCanvas* aCanvas*/);
+
+ ~CMMACanvasDisplay(); // Destructor ()
+
+
+public: // From MMMADisplay
+ //void SourceSizeChanged(const TSize& aSourceSize);
+ void SetFullScreenL(TBool aFullScreen);
+ void SetDisplayLocationL(const TPoint& aPosition);
+ TPoint DisplayLocation();
+ void SetWindowL(MMMADisplayWindow* aWindow);
+
+private:
+ /** ask java side peer about the bound
+ Returns a rectangle describing the receiver's size
+ and location relative to its parent (or its display if its parent is null),
+ unless the receiver is a shell. In this case, the location is relative to the display
+ */
+ TRect& CMMACanvasDisplay::BoundRect();
+ TRect& CMMACanvasDisplay::ContainerWindowRect();
+
+//public:
+// void MdcContentBoundsChanged(const TRect& aRect);
+protected: // Constructors and destructors
+
+ // Default constructor, protected to allow derivation
+ CMMACanvasDisplay(MMAFunctionServer* aEventSource , jobject aJavaDisplayRef/*MMIDCanvas* aCanvas*/);
+
+private: // Data
+// MMIDCanvas* iCanvas;
+
+//MMAFunctionServer* iEventSource; // not owned
+
+};
+
+#endif // CMMACANVASDISPLAY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is base interface for all controls.
+*
+*/
+
+
+#ifndef CMMACONTROL_H
+#define CMMACONTROL_H
+
+// INCLUDES
+// #include <mevents.h>
+// #include <jutils.h>
+#include "mmapiutils.h"
+// CLASS DECLARATION
+/**
+* This is base interface for all controls.
+*
+*
+*/
+class CMMAControl : public CBase
+{
+public:
+ /**
+ * Static getter for Java class name. Java object will be created
+ * according to this name. Derived classes defines the class names.
+ *
+ * @see ClassName
+ * @param aControl Control to use.
+ * @return Java control class name.
+ */
+ static const TDesC* ClassNameJni(CMMAControl* aControl);
+
+ /**
+ * Sets associated Java object.
+ *
+ * @param aControl Control to use.
+ * @param aControlObject Java side control object.
+ */
+ static void StaticSetHandle(CMMAControl* aControl,
+ jobject aControlObject);
+public:
+ /**
+ * @see ClassNameJni
+ * @return Java control class name.
+ */
+ virtual const TDesC& ClassName() const = 0;
+
+ /**
+ * Return public class name.
+ */
+ IMPORT_C virtual const TDesC& PublicClassName() const;
+
+ /**
+ * Refresh this control.
+ */
+ virtual void RefreshControl()
+ {
+ // do nothing
+ }
+
+private:
+ /**
+ * @see StaticSetHandle
+ * @param aControlObject Java side control object.
+ */
+ void SetHandle(jobject aControlObject);
+
+protected:
+ /**
+ * Java side control object.
+ */
+ jobject iControlObject;
+};
+
+#endif // CMMACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmadeleterefevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMADELETEREFEVENT_H
+#define CMMADELETEREFEVENT_H
+
+//#include <mevents.h>
+#include "cmmaevent.h"
+
+class MMAFunctionServer;
+
+// CLASS DECLARATION
+/**
+* This class is used to delete references created with JNIEnv.
+* Reference deletion needs JNI environvent, which can't be stored
+* as an member variable. JNI environment is delivered to Dispatch
+* method that deletes the reference.
+*
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMADeleteRefEvent): public CMMAEvent
+{
+public:
+ /**
+ * Default constructor. This event is always disposable.
+ * @param aDeleteRefObject Object which reference will be deleted.
+ */
+ CMMADeleteRefEvent(jobject aDeleteRefObject);
+
+private: // from CJavaEvent
+ /**
+ * This method deletes iDeleteRefObject reference with JNIEnv::DeleteGlobalRef method.
+ * @param aJni JNI environment which is used to delete reference.
+ */
+ void Dispatch(JNIEnv& aJni);
+
+protected:
+ // Object reference which will be deleted.
+ jobject iDeleteRefObject;
+};
+
+#endif // CMMADELETEREFEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmadisplay.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplay
+*
+*/
+
+
+#ifndef CMMADISPLAY_H
+#define CMMADISPLAY_H
+
+// INCLUDES
+//#include <reflcdui.h>
+#include "mmmadisplay.h"
+#include "mmafunctionserver.h"
+#include "qwidget.h"
+#include "jni.h"
+#include "jutils.h"
+#include "mmmaguiplayer.h"
+
+// FORWARD DECLARATIONS
+class MMMADisplayWindow;
+
+// CLASS DECLARATION
+/**
+* This class implements MMMADisplay
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMADisplay): public CBase,public MMMADisplay
+ /*,
+ public MDirectContent*/
+{
+public:
+ // Constructors and destructors
+ ~CMMADisplay(); // Destructor ()
+
+protected: // Constructors and destructors
+ // Default constructor, protected to allow derivation
+ CMMADisplay();
+
+ void Construct(MMAFunctionServer* eventSource ,jobject javadisplayref);
+
+public: // Methods derived from MMMADisplay
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ TSize DisplaySize();
+ void SetDisplaySizeL(const TSize& aSize);
+ void SetVisible(TBool aValue);
+ void SetWindowL(MMMADisplayWindow* aWindow);
+ MMMADisplayWindow* Window();
+ TBool IsVisible();
+ TBool IsFullScreen();
+ virtual void SetForeground(TBool aIsForeground, TBool aUseEventServer);
+ void SourceSizeChanged(const TSize& aSourceSize);
+ void SetUIPlayer(MMMAGuiPlayer* player);
+ TSize SourceSize();
+
+ /**
+ * Gets notification that there is container to draw assigned
+ *
+ * @return ETrue if container have been set
+ * EFalse if container is not set
+ */
+ virtual TBool HasContainer();
+
+ /**
+ * Gets resources necessary to start DirectScreenAccess
+ * Doesn't run in mmapi event server thread!
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aThreadType" Indicates the thread type (UI or MMAPI)
+ */
+ // void UIGetDSAResources(
+ // MUiEventConsumer& aConsumer,
+ // MMMADisplay::TThreadType aThreadType);
+
+ /**
+ * Invokes a callback in UI thread
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aCallbackId" A number identifying the callback
+ */
+ //virtual void UIGetCallback(
+ // MUiEventConsumer& aConsumer,
+ // TInt aCallbackId);
+public: // Methods derived from MDirectContent
+ /**
+ * Not used method.
+ */
+ // virtual void MdcContainerWindowChangedL(RWindow* aWindow);
+
+ /**
+ * Same functionality is shared in canvas and item displays.
+ */
+ // virtual void MdcContainerVisibilityChanged(TBool aVisible);
+
+ /**
+ * Default implementation, panics in debug build. Must be written in
+ * derived classes if needed.
+ */
+ // virtual void MdcItemContentRectChanged(const TRect& aContentRect,
+// const TRect& aScreenRect);
+
+ /**
+ * Notify content that container is about to be destoryed.
+ */
+ // virtual void MdcContainerDestroyed();
+ /**
+ * Notify player's window that any drawing
+ * via direct screen access must be aborted
+ */
+ // void MdcAbortDSA();
+
+ /**
+ * Allow player's window to draw
+ * via direct screen access after MdcAbortDSA
+ */
+ // void MdcResumeDSA();
+
+protected:// New Methods
+ /**
+ * Scales drawarea to full screen. Aspect ratio of the source size
+ * will be maintained.
+ */
+ TRect ScaleToFullScreen(const TSize& aFullScreenSize,
+ const TSize& aSourceSize);
+
+ /**
+ * Set clipping region to LCDUI UI component according
+ * to current window drawrect so that the LCDUI component
+ * does not paint over the area that is occupied by video.
+ * Based on current visibility of video image, this method
+ * either sets or removes the clipping region.
+ * LCDUI component is then redrawn.
+ */
+ void SetClippingRegion();
+ /**
+ * MMAPI_UI 3.x req
+ * set content bound to eSWT control
+ */
+ void SetContentBoundToJavaControl(const TRect& aRect);
+ /**
+ * Remove currently set clip region and refresh canvas
+ */
+ void RemoveClippingRegion();
+
+ /**
+ * MMAPI_UI 3.x req
+ * removes content bound from eSWT control
+ */
+ void RemoveContentBoundFromJavaControl(const TRect& aRect);
+ /**
+ * Add clip region
+ */
+ void AddClippingRegion();
+ /**
+ * MMAPI_UI 3.x req
+ * Redraw the java side eSWT control
+ */
+ void RefreshJavaControl(const TRect& aRect);
+
+ /**
+ * MMAPI_UI 3.x req
+ * Reset the rectangle dimension in eSWT control
+ */
+ void ResetJavaRectObject(const TRect& aRect);
+
+ /**
+ * Handling the change in container visibility
+ */
+ void HandleContainerVisibilityChanged( TBool aVisible );
+
+public:
+ /**
+ * called from java when shell visibility gets change
+ */
+ void SetContainerVisibility(TBool aValue);
+ /**
+ * called from java to set the window resources
+ */
+ void SetWindowResources(QWidget* qtWidget);
+
+ /**
+ * Trigger a function call CalledBackInUiThread() from java in UI thread
+ * arg 'placeholder' is used to identify the function, to be called back from UI Thread
+ */
+ void GetCallbackInUiThread(TInt placeholder);
+
+ /**
+ * Called from java in UI thread context
+ * arg 'placeholder' is used to identify the function, to be called back from UI Thread
+ */
+ void CalledBackInUiThread(TInt placeholder);
+
+ void SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight);
+ void SetSourceSizeToDisplay(const TSize& aSourceSize);
+ void SetDisplayPosition(TInt uiControlLocationX,TInt uiControlLocationY,TInt videoControlLocationX,TInt videoControlLocationY);
+
+protected: // Data
+
+ /**
+ * Not owned.
+ * Actual drawing place of the content.
+ */
+ MMMADisplayWindow* iWindow;
+
+ /**
+ * Source contents size.
+ */
+ TSize iSourceSize;
+
+ /**
+ * Indicates visibility set from from Java.
+ */
+ TBool iVisible;
+
+ /**
+ * Screenmode set from Java.
+ */
+ TBool iFullScreen;
+
+ /**
+ * Is native container visible.
+ */
+ TBool iContainerVisible;
+
+ /**
+ * Draw rect set from java.
+ */
+ TRect iUserRect;
+
+ /**
+ * Not owned, obtained from lcdui components.
+ */
+ //MDirectContainer* iDirectContainer;
+
+ /**
+ * Clip rectangle currently set to LCDUI.
+ * NOTE: need to be removed at last during destruction phase!
+ */
+ TRect iClipRect;
+ /**
+ * Is midlet is in foreground ?
+ */
+ TBool iIsForeground;
+
+ /**
+ * Indicates that iUserRect has been changed
+ * during container invisibility
+ */
+ TBool iResetDrawRect;
+ // not owned
+ MMAFunctionServer* iEventSource;
+ JNIEnv* iJni;
+ jobject iJavaDisplayObject;
+ jclass iJavaDisplayClass;
+ TSize fullScreenSize;
+ MMMAGuiPlayer* iUiPlayer;
+};
+
+#endif // CMMADISPLAY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmadurationupdater.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Send update duration event if needed when player state changes
+*
+*/
+
+
+#ifndef CMMADURATIONUPDATER_H
+#define CMMADURATIONUPDATER_H
+
+// INCLUDES
+#include "mmmaplayerstatelistener.h"
+#include "cmmaplayer.h"
+
+// CLASS DECLARATION
+/**
+* Checks if media duration has changed when player state changes and sends
+* DURATION_UPDATED event to Java.
+*
+*/
+NONSHARABLE_CLASS(CMMADurationUpdater):
+ public CBase, public MMMAPlayerStateListener
+{
+public: // Construction
+ static CMMADurationUpdater* NewL(CMMAPlayer& aPlayer);
+ ~CMMADurationUpdater();
+
+private: // Construction
+ CMMADurationUpdater(CMMAPlayer& aPlayer);
+ void ConstructL();
+
+public: // from MMMAPlayerStateListener
+ virtual void StateChanged(TInt aState);
+
+private: // Data
+
+ /* The player which is monitored for duration changes */
+ CMMAPlayer& iPlayer;
+
+ /* Last obtained duration value */
+ TInt iDuration;
+
+ // to avoid event posting with streamable medias after first start
+ TBool iSecondStart;
+};
+
+#endif // CMMADURATIONUPDATER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMAEVENT_H
+#define CMMAEVENT_H
+
+// #include <mevents.h>
+#include "mmapiutils.h"
+
+class MMAFunctionServer;
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAEvent) // public CJavaEvent< MMAFunctionServer >
+{
+public:
+
+ enum {EEventPriority = 0, ENotifyPriority = 1, ELastPriority = 1};
+ enum TDisposability { EDisposableEvent, EReusableEvent };
+
+ CMMAEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable = EDisposableEvent);
+
+protected:
+ CMMAEvent(TDisposability aDisposable);
+
+public:
+ void SetEventData(TInt aEventData);
+
+
+public: // from CJavaEvent
+ virtual void Dispatch(JNIEnv& aJni);
+
+protected:
+ jobject iListenerObject;
+ jmethodID iHandleEventMethod;
+ TInt iEventData;
+};
+
+#endif // CMMAEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaframepositioningcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for FramePositioningControl
+*
+*/
+
+
+#ifndef CMMAFRAMEPOSITIONINGCONTROL_H
+#define CMMAFRAMEPOSITIONINGCONTROL_H
+
+// EXTERNAL INCLUDES
+#include "mmfcontroller.h"
+#include "mmfstandardcustomcommands.h"
+
+// INTERNAL INCLUDES
+#include "cmmacontrol.h" // base class
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+// CONSTANTS
+
+
+// Constant for control name. Name is used in Java side to instantiate
+// Java Class which uses CMMAFramePositioningControl.
+_LIT(KMMAFramePositioningControlName, "FramePositioningControl");
+
+// CLASS DECLARATION
+/**
+* Abstract base class for FramePositioningControls
+*/
+NONSHARABLE_CLASS(CMMAFramePositioningControl): public CMMAControl
+{
+public:
+ /**
+ * Destructor.
+ */
+ ~CMMAFramePositioningControl();
+
+protected:
+ /**
+ * Constructor.
+ */
+ CMMAFramePositioningControl(CMMAPlayer* aPlayer);
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+public: // New methods
+ virtual TInt SeekL(TInt aFrameNumber) = 0;
+ virtual TInt SkipL(TInt aFramesToSkip) = 0;
+ virtual void MapFrameToTimeL(TInt aValue, TInt64* aMediaTime) = 0;
+ virtual TInt MapTimeToFrameL(TInt64* aMediaTime) = 0;
+
+protected: // New methods
+
+ /**
+ * Clamp media time between 0 and duration of media
+ * @param aMediaTime media time value to clamp
+ * @return KErrNotFound if duration of media is not known,
+ * otherwise KErrNone.
+ */
+ virtual TInt ClampMediaTime(TInt64& aMediaTime);
+
+private: // Data
+
+ // To be used by this class and not by children.
+ CMMAPlayer* iPlayer;
+
+};
+
+#endif // CMMAFRAMEPOSITIONINGCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaitemdisplay.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Bitmap display that draws to the Java CustomItem's bitmap.
+*
+*/
+
+
+#ifndef CMMAITEMDISPLAY_H
+#define CMMAITEMDISPLAY_H
+
+// INCLUDES
+#include "cmmadisplay.h" // base class
+
+//class MMIDCustomItem;
+
+// CLASS DECLARATION
+/**
+* Display that uses MMIDCustomItem.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAItemDisplay): public CMMADisplay
+{
+public: // Constructors and destructors
+ static CMMAItemDisplay* NewLC(/*MMIDCustomItem* aCustomItem*/);
+
+ ~CMMAItemDisplay(); // Destructor ()
+
+protected: // Constructors and destructors
+ // Default constructor, protected to allow derivation
+ CMMAItemDisplay(/*MMIDCustomItem* aCustomItem*/);
+
+public: // New methods
+ /**
+ * To be called when java display's size is changed.
+ * This method also informs when context for the item is
+ * created for the first time.
+ */
+ static void SizeChangedL(CMMAItemDisplay* aDisplay,
+ TInt aWidth,
+ TInt aHeight);
+
+ /**
+ * Sets source size to aSize.
+ */
+ static void StaticSourceSize(CMMAItemDisplay* aDisplay,
+ TSize* aSize);
+
+public: // Methods derived from MMMADisplay
+ void SourceSizeChanged(const TSize& aSourceSize);
+ void SetFullScreenL(TBool aFullScreen);
+ void SetDisplayLocationL(const TPoint& aPosition);
+ TPoint DisplayLocation();
+ void SetWindowL(MMMADisplayWindow* aWindow);
+/*
+public: // From MDirectContent
+ void MdcContentBoundsChanged(const TRect& aRect);
+ void MdcItemContentRectChanged(const TRect& aContentRect,
+ const TRect& aScreenRect);
+private: // Data
+ MMIDCustomItem* iItem;
+ */
+};
+
+#endif // CMMAITEMDISPLAY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmametadatacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This interface is for getting metadata from a media.
+*
+*/
+
+
+#ifndef CMMAMETADATACONTROL_H
+#define CMMAMETADATACONTROL_H
+
+// INCLUDES
+#include "cmmacontrol.h"
+
+// CLASS DECLARATION
+/**
+* This class is an abstract interface for getting metadata from a media.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAMetaDataControl): public CMMAControl
+{
+protected:
+ CMMAMetaDataControl();
+
+public:
+ /**
+ * Get the number of all metadata keys from given metadata control.
+ *
+ * @param aMetaDataControl Metadata control.
+ * @param aCount Address of an integer to store the metadata keys count
+ */
+ static void StaticKeysCountL(CMMAMetaDataControl* aMetaDataControl, TInt *aCount);
+
+ /**
+ * Get one metadata key from given metadata control.
+ *
+ * @param aMetaDataControl Metadata control.
+ * @param aValue Address of a pointer to a descriptor to which the
+ * value is put. Ownership of the descriptor is transferred to
+ * the caller.
+ * @param aIndex The index of the key to be fetched.
+ */
+ static void StaticKeyL(CMMAMetaDataControl* aMetaDataControl, HBufC** aKey, TInt aIndex);
+
+ /**
+ * Get the value associated with a single metadata key.
+ *
+ * @param aMetaDataControl Metadata control.
+ * @param aValue Address of a pointer to a descriptor to which the
+ * value is put. Ownership of the descriptor is transferred to
+ * the caller.
+ * @param aKey The key for which the value is to be fetched.
+ */
+ static void StaticKeyValueL(CMMAMetaDataControl* aMetaDataControl,
+ HBufC** aValue,
+ TDesC* aKey);
+
+protected:
+ virtual TInt KeyCountL() = 0;
+ virtual HBufC* KeyL(TInt aIndex) = 0;
+
+ virtual HBufC* KeyValueL(const TDesC& aKey) = 0;
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+};
+
+#endif // CMMAMETADATACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidicontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a MIDIControl.
+*
+*/
+
+
+#ifndef CMMAMIDICONTROL_H
+#define CMMAMIDICONTROL_H
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include "cmmacontrol.h" // base class
+#include "mmmaplayerstatelistener.h"
+#include <midiclientutility.h> // MMidiClientUtilityObserver
+#include <TimeOutTimer.h>
+
+// CONSTANTS
+
+// Constant for control name. Name is used in Java side to instantiate
+// Java Class which uses CMMAMIDIControl.
+_LIT(KMIDIControlName, "MIDIControl");
+
+class CMMAMIDIPlayer;
+
+// Maximum volume defined in the Java API.
+// It is used to convert volume values between native and java values.
+static const TInt KMAXVolume = 127;
+
+
+
+// CLASS DECLARATION
+/**
+* This class implements MIDIControl interface.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAMIDIControl): public CMMAControl,
+ public MMidiClientUtilityObserver
+{
+private:
+
+ class CChannelVolumeEventWait : public CBase,
+ public MTimeOutNotify
+ {
+ public: // Constructor and destructor
+
+ static CChannelVolumeEventWait* NewL();
+
+ ~CChannelVolumeEventWait();
+
+ public: // Methods from base classes
+
+ /**
+ * From MTimeOutNotify Timer expiration call back method
+ */
+ void TimerExpired();
+
+ public: // New methods
+
+ void StartWait(TInt aChannel);
+
+ void StopWait();
+
+ void HandleVolumeChangedEvent(TInt aChannel);
+
+ private: // Constructor
+
+ CChannelVolumeEventWait();
+
+ void ConstructL();
+
+ private: // Data
+
+ // Own. For waiting the correct volume changed event
+ CActiveSchedulerWait* iWait;
+
+ // Own. Time-out for waiting volume changed event
+ CTimeOutTimer* iTimer;
+
+ // Expected channel for volume event
+ TInt iChannel;
+
+ };
+
+public:
+ /**
+ * Creates new CMMAMIDIControl.
+ *
+ * @param aPlayer Player that plays the MIDI.
+ */
+ static CMMAMIDIControl* NewL(CMMAMIDIPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAMIDIControl();
+protected:
+ /**
+ * Constructor.
+ * @param aPlayer Player that plays the MIDI.
+ */
+ CMMAMIDIControl(CMMAMIDIPlayer* aPlayer);
+
+ /**
+ * Initializes this control.
+ */
+ void ConstructL();
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+public: // From MMMAPlayerStateListener
+ void StateChanged(TInt aState);
+
+public: // Static new methods
+
+ /**
+ * Get volume for the given channel. The return value is
+ * independent of the player's volume.
+ *
+ * @param aChannel 0-15
+ */
+ TInt ChannelVolumeL(TInt aChannel);
+
+ /**
+ * Set volume for given channel.
+ *
+ * @param aChannel 0-15
+ * @param aVolume 0-127
+ */
+ void SetChannelVolumeL(TInt aChannel, TInt aVolume);
+
+ /**
+ * Set program of a channel.
+ *
+ * @param aChannel 0-15
+ * @param aBank 0-16383, or -1 for default bank
+ * @param aProgram 0-127
+ */
+ void SetProgramL(TInt aChannel,
+ TInt aBank,
+ TInt aProgram);
+
+ /**
+ * Sends a long MIDI event to the device.
+ * This method passes the data directly to the receiving device.
+ * The data array's contents are not checked for validity.
+ *
+ * @param aData array of the bytes to send
+ * @return the number of bytes actually sent to the device
+ */
+ TInt SendMIDIEventL(const TDesC8* aData);
+
+ /**
+ * Reinitializes native midi engine with new sequence data.
+ * First closes midi engine and then opens it again with new
+ * data. The data array's contents are not checked for validity.
+ *
+ * @param aData midi sequence data for initialization
+ * @return KErrNone (return value is present only for
+ * method footprint)
+ */
+ TInt ReInitializeMidiL(const TDesC8* aData);
+
+public: // from MMidiClientUtilityObserver
+ void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
+ void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
+ void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
+ void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
+ void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
+ void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
+ void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aMessage);
+ void MmcuoPolyphonyChanged(TInt aNewPolyphony);
+ void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
+
+private: // Data
+ /**
+ * Used to control MIDI events.
+ */
+ CMMAMIDIPlayer* iPlayer;
+
+ /**
+ * Own. Utility for waiting for channel volume events
+ */
+ CChannelVolumeEventWait* iVolumeEventWait;
+
+};
+
+
+#endif // CMMAMIDICONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidimetadatacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAMIDIMetaDataControl is a concrete class for getting
+* metadata from midi engine.
+*
+*/
+
+
+#ifndef CMMAMIDIMETADATACONTROL_H
+#define CMMAMIDIMETADATACONTROL_H
+
+// INCLUDES
+#include <mmfcontroller.h>
+
+#include "cmmamidiplayer.h"
+#include "cmmametadatacontrol.h"
+
+// CLASS DECLARATION
+/**
+* This is a concrete class for getting metadata from midi engine.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAMIDIMetaDataControl): public CMMAMetaDataControl
+{
+public:
+ CMMAMIDIMetaDataControl(CMMAMIDIPlayer* aPlayer);
+
+protected: // from CMMAMetaDataControl
+
+ TInt KeyCountL();
+ HBufC* KeyL(TInt aIndex);
+
+ HBufC* KeyValueL(const TDesC& aKey);
+
+private:
+ /**
+ * Used to query metadata
+ */
+ CMMAMIDIPlayer* iPlayer;
+};
+
+#endif // CMMAMIDIMETADATACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidipitchcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements PitchControl functionality.
+*
+*/
+
+
+#ifndef CMMAMIDIPITCHCONTROL_H
+#define CMMAMIDIPITCHCONTROL_H
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include "cmmacontrol.h" // base class
+
+// CONSTANTS
+
+// Constant for control name. Name is used in Java side to instantiate
+// Java Class which uses CMMAMIDIPitchControl.
+_LIT(KMIDIPitchControlName, "PitchControl");
+
+// Maximum and minimun pitch values
+const TInt KMIDIPitchControlMaxPitch = 2400;
+const TInt KMIDIPitchControlMinPitch = -2400;
+
+
+class CMMAMIDIPlayer;
+
+// CLASS DECLARATION
+/**
+* This class implements MIDIPitchControl interface.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAMIDIPitchControl): public CMMAControl
+{
+public:
+ /**
+ * Creates new CMMAMIDIPitchControl.
+ *
+ * @param aPlayer Player that plays the content.
+ */
+ static CMMAMIDIPitchControl* NewL(CMMAMIDIPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAMIDIPitchControl();
+protected:
+ /**
+ * Constructor.
+ * @param aPlayer Player that plays the content.
+ */
+ CMMAMIDIPitchControl(CMMAMIDIPlayer* aPlayer);
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+public: // New methods
+ /**
+ * @return Pitch, if not available the default.
+ */
+ TInt PitchL();
+
+ /**
+ * @param aPitch Pitch to set in milli-beats per minute.
+ * @return Actual Pitch set.
+ */
+ TInt SetPitchL(TInt aPitch);
+
+ /**
+ * @return The maximum rate supported.
+ */
+ TInt MaxPitchL();
+
+ /**
+ * @return The minimum rate supported.
+ */
+ TInt MinPitchL();
+
+private: // Data
+ /**
+ * Used to control MIDI playback.
+ */
+ CMMAMIDIPlayer* iPlayer;
+};
+
+
+#endif // CMMAMIDIPITCHCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidiplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing MIDI.
+*
+*/
+
+
+#ifndef CMMAMIDIPLAYER_H
+#define CMMAMIDIPLAYER_H
+
+
+// INCLUDES
+#include "cmmaplayer.h"
+#include <midiclientutility.h>
+#include <e32base.h>
+
+// CONSTANTS
+_LIT(KMMAMIDIPlayer, "MIDIPlayer");
+
+const TMdaPriorityPreference KMMAMIDIPriorityPreference =
+ EMdaPriorityPreferenceTimeAndQuality;
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+
+// CLASS DECLARATION
+/**
+* This class is used for playing MIDI.
+*
+*
+*/
+
+class CMMAMIDIPlayer : public CMMAPlayer, public MMidiClientUtilityObserver
+{
+public: // Construction
+ static CMMAMIDIPlayer* NewLC(const TDesC& aContentType,
+ TFileName aFileName);
+
+ // Destructor
+ ~CMMAMIDIPlayer();
+
+protected:
+ // C++ constructor
+ CMMAMIDIPlayer(TFileName aFileName);
+ void ConstructL(const TDesC& aContentType);
+
+public: // new methods
+ IMPORT_C CMidiClientUtility* MidiClient() const;
+ void ReInitializeMidiEngineL(const TDesC8* aMidiSequence);
+ void addObserverL(MMidiClientUtilityObserver* aObserver);
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void RealizeL();
+ void PrefetchL();
+ void DeallocateL();
+ void GetDuration(TInt64* aDuration);
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+ void CloseL();
+ const TDesC& Type();
+
+public: // from CMMAPlayer/MMMASourceStreamListener
+ void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+ void PlayCompleteL(TInt aError);
+
+public: // from MMidiClientUtilityObserver
+ void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
+ void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
+ void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
+ void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
+ void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
+ void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
+ void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aMessage);
+ void MmcuoPolyphonyChanged(TInt aNewPolyphony);
+ void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
+
+protected:
+ void CloseClientUtility();
+
+private: // Data
+ CMidiClientUtility* iMidi;
+
+ // CActiveShedulerWait object for reinitializing midi engine
+ CActiveSchedulerWait* iActiveSchedulerWait;
+
+ // Array for subsequent MMidiClientUtilityObservers
+ RPointerArray<MMidiClientUtilityObserver> iObservers;
+
+ TFileName iFileName;
+
+ /**
+ * Cached media time
+ */
+ TInt64 iMediaTime;
+
+ /**
+ * The time that will be sent with CMMAPlayerEvent::EStarted
+ * (may be different from iMediaTime).
+ */
+ TInt64 iStartedEventTime;
+};
+
+#endif // CMMAMIDIPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidiplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating MIDI player.
+*
+*/
+
+
+#ifndef CMMAMIDIPLAYERFACTORY_H
+#define CMMAMIDIPLAYERFACTORY_H
+
+// INCLUDES
+#include "cmmammfplayerfactory.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for creating MIDI player.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAMIDIPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructor and destructot
+ static CMMAMIDIPlayerFactory* NewLC();
+ ~CMMAMIDIPlayerFactory();
+
+private: // constructor
+ CMMAMIDIPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+public: // From CMMAMMFPlayerFactory
+
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+
+private: // new methods
+ CMMAPlayer* CreateMidiFilePlayerL(const TDesC& aContentType, TFileName aFileName);
+ CMMAPlayer* CreateMidiSynthPlayerL(const TDesC& aContentType);
+};
+
+#endif // CMMAMIDIPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidistoptimecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling
+*
+*/
+
+
+#ifndef CMMAMIDISTOPTIMECONTROL_H
+#define CMMAMIDISTOPTIMECONTROL_H
+
+// INCLUDES
+#include "cmmastoptimecontrol.h"
+
+// CLASS DECLARATION
+/**
+* This class is used for stoptime controlling for MIDI
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAMIDIStopTimeControl): public CMMAStopTimeControl
+{
+public:
+ static CMMAMIDIStopTimeControl* NewL(CMMAPlayer* aPlayer);
+ ~CMMAMIDIStopTimeControl();
+
+protected:
+ CMMAMIDIStopTimeControl(CMMAPlayer* aPlayer);
+
+public: // from CMMAStopTimeControl
+ virtual void StopAtTimeL();
+};
+
+#endif // CMMAMIDISTOPTIMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamiditempocontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MIDITempoControl functionality.
+*
+*/
+
+
+#ifndef CMMAMIDITEMPOCONTROL_H
+#define CMMAMIDITEMPOCONTROL_H
+
+// EXTERNAL INCLUDES
+#include <midiclientutility.h> // MMidiClientUtilityObserver
+
+// INTERNAL INCLUDES
+#include "cmmaratecontrol.h" // base class
+#include "mmmaplayerstatelistener.h"
+
+// CONSTANTS
+
+// Constant for control name. Name is used in Java side to instantiate
+// Java Class which uses CMMAMIDITempoControl.
+_LIT(KMIDITempoControlName, "TempoControl");
+
+class CMMAMIDIPlayer;
+
+// CLASS DECLARATION
+/**
+* This class implements MIDITempoControl interface.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAMIDITempoControl): public CMMARateControl,
+ public MMidiClientUtilityObserver, public MMMAPlayerStateListener
+{
+public:
+ /**
+ * Creates new CMMAMIDITempoControl.
+ *
+ * @param aPlayer Player that plays the content.
+ */
+ static CMMAMIDITempoControl* NewL(CMMAMIDIPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAMIDITempoControl();
+protected:
+ /**
+ * Constructor.
+ * @param aPlayer Player that plays the content.
+ */
+ CMMAMIDITempoControl(CMMAMIDIPlayer* aPlayer);
+
+ /**
+ * Initializes this control.
+ */
+ void ConstructL();
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+public: // From CMMARateControl
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ TInt RateL();
+
+ /**
+ * @return The maximum rate supported.
+ */
+ TInt MaxRateL();
+
+ /**
+ * @return The minimum rate supported.
+ */
+ TInt MinRateL();
+
+public: // New methods
+ /**
+ * @return Tempo, if not available the default.
+ */
+ TInt TempoL();
+
+ /**
+ * @param aTempo Tempo to set in milli-beats per minute.
+ * @return Actual Tempo set.
+ */
+ TInt SetTempoL(TInt aTempo);
+
+public: // From MMMAPlayerStateListener
+ void StateChanged(TInt aState);
+
+public: // from MMidiClientUtilityObserver
+ void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError);
+ void MmcuoTempoChanged(TInt aMicroBeatsPerMinute);
+ void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels);
+ void MmcuoMuteChanged(TInt aChannel,TBool aMuted);
+ void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats);
+ void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition);
+ void MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aMessage);
+ void MmcuoPolyphonyChanged(TInt aNewPolyphony);
+ void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId);
+
+private: // Data
+ /**
+ * Used to control MIDI playback.
+ */
+ CMMAMIDIPlayer* iPlayer;
+
+ /**
+ * Current tempo. Unit of the variable is milli-beat.
+ * Tempo cannot be set to the midi client before the player is
+ * prefetched. Thus, when the player is in REALIZED state, tempo is
+ * saved to this variable and set to the client when the player is
+ * prefetched.
+ */
+ TInt iTempo;
+
+};
+
+
+#endif // CMMAMIDITEMPOCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmamidivolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to midi player
+*
+*/
+
+
+#ifndef CMMAMIDIVOLUMECONTROL_H
+#define CMMAMIDIVOLUMECONTROL_H
+
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "cmmavolumecontrol.h"
+
+class CMMAMIDIPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+ This class is used for setting volume to audio player
+
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(CMMAMIDIVolumeControl): public CMMAVolumeControl
+{
+public:
+ static CMMAMIDIVolumeControl* NewL(CMMAMIDIPlayer* aPlayer);
+
+protected:
+ CMMAMIDIVolumeControl(CMMAMIDIPlayer* aPlayer);
+ void ConstructL();
+
+
+public: // from CMMAVolumeControl
+ void DoSetLevelL(TInt aLevel);
+ TInt DoGetLevelL();
+
+private:
+ CMMAMIDIPlayer* iPlayer;
+};
+
+#endif // CMMAMIDIVOLUMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmammfplayerbase.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+#ifndef CMMAMMFPLAYERBASE_H
+#define CMMAMMFPLAYERBASE_H
+
+// INCLUDES
+#include <mmf/common/mmfstandardcustomcommands.h>
+#include "cmmaplayer.h"
+
+class CMMAMMFResolver;
+// CLASS DECLARATION
+/**
+* This is base class for players those use MMF
+*
+*
+*/
+
+class CMMAMMFPlayerBase : public CMMAPlayer,
+ public MMMFControllerEventMonitorObserver
+{
+protected:
+ // C++ constructor
+ CMMAMMFPlayerBase(CMMAMMFResolver* aResolver);
+ void ConstructL();
+
+ ~CMMAMMFPlayerBase();
+public: // new methods
+ /**
+ * Getter for RMMFController
+ */
+ IMPORT_C RMMFController& Controller();
+
+ /**
+ * Check whether this player is playing from a file locator
+ * @return ETrue if is a file player, EFalse otherwise
+ */
+ TBool IsFilePlayer();
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void DeallocateL();
+ IMPORT_C void GetDuration(TInt64* aDuration);
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+ void CloseL();
+
+protected: // New methods
+
+ /**
+ * Loops through iControllerInfos and tries to open those
+ * @param aSourceUid Data source uid
+ * @param aSourceData Data for source
+ * @param aSinkUid Data sink uid
+ * @param aSinkData Data for sink.
+ * @param aPrioritySettings Controller's priority.
+ * @return KErrNone if controller was opened
+ */
+ IMPORT_C virtual TInt DoOpen(TUid aSourceUid,
+ const TDesC8& aSourceData,
+ TUid aSinkUid,
+ const TDesC8& aSinkData,
+ TMMFPrioritySettings aPrioritySettings);
+
+public: // from MMMFControllerEventMonitorObserver
+ void HandleEvent(const class TMMFEvent& aEvent);
+
+protected:
+
+ /**
+ * Controller infos, owned
+ */
+ RMMFControllerImplInfoArray* iControllerInfos;
+
+ /**
+ * Used to control mmf plugin.
+ */
+ RMMFController iController;
+
+ /**
+ * Owned member.
+ * Event monitor is used to monitor iController for events.
+ * If an event occurs, this class will be notified via the
+ * MMMFControllerEventMonitorObserver interface
+ */
+ CMMFControllerEventMonitor* iEventMonitor;
+
+ /**
+ * Filename used for playing directly from file, owned
+ */
+ HBufC* iFileName;
+
+ /**
+ * Cached media time
+ */
+ TInt64 iMediaTime;
+
+ /**
+ * The time that will be sent with CMMAPlayerEvent::EStarted
+ * (may be different from iMediaTime).
+ */
+ TInt64 iStartedEventTime;
+};
+
+#endif // CMMAMMFPLAYERBASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmammfplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating MMF-based players.
+*
+*/
+
+
+#ifndef CMMAMMFPLAYERFACTORY_H
+#define CMMAMMFPLAYERFACTORY_H
+
+// INCLUDES
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include "mmmaplayerfactory.h"
+
+class CMMAMMFResolver;
+
+// CLASS DECLARATION
+/**
+* This class is used for creating MMF-based players.
+*
+*
+*/
+class CMMAMMFPlayerFactory: public CBase, public MMMAPlayerFactory
+{
+public: // Constructor and destructor
+ IMPORT_C CMMAMMFPlayerFactory();
+ IMPORT_C ~CMMAMMFPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+protected:
+
+ /**
+ * Creates new CMMAPlayer instance with given resolver.
+ * @param aResolver Resolver that contains needed mmf controller infos
+ * for creating player.
+ */
+ virtual CMMAPlayer* CreatePlayerL(CMMAMMFResolver* aResolver) = 0;
+
+ /**
+ * Returns list of allowed media IDs
+ */
+ virtual void MediaIdsL(RArray<TUid>& aMediaIds) = 0;
+
+ /**
+ * Returns Match type for media IDs.
+ * CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds is the default.
+ */
+ virtual CMMFPluginSelectionParameters::TMediaIdMatchType
+ MediaIdMatchType();
+
+ /**
+ * This method is called before mmf controller implementation array
+ * is created. With this the actual factories can e.g. select either
+ * set required play or record format support. Play format support is
+ * the default.
+ */
+ IMPORT_C virtual void PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection);
+
+ /**
+ * Creates CMMAPlayer with given format selection parameters
+ */
+ IMPORT_C virtual CMMAPlayer* CreatePlayerL(CMMFFormatSelectionParameters* aFormatSelect,
+ const TDesC* aFileName = NULL);
+
+ /**
+ * Checks that is this protocol supported by this factory
+ */
+ TBool IsSupportedProtocolL(const TDesC& aProtocol);
+
+ /**
+ * Checks that is this content-type supported by this factory
+ */
+ TBool IsSupportedContentTypeL(const TDesC& aContentType);
+private:
+ /**
+ * File version of creating player from content type
+ */
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType,
+ const TDesC* aFileName);
+#ifndef RD_JAVA_OMA_DRM_V2
+ /**
+ * Tries to open DRM file
+ */
+ CMMAPlayer* TryOpenDRMFileL(const TDesC& aFileName);
+#endif // RD_JAVA_OMA_DRM_V2
+
+};
+
+#endif // CMMAMMFPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmammfratecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements RateControl for MMF players.
+*
+*/
+
+
+#ifndef CMMAMMFRATECONTROL_H
+#define CMMAMMFRATECONTROL_H
+
+// INTERNAL INCLUDES
+#include "cmmaratecontrol.h" // base class
+#include "cmmammfplayerbase.h"
+
+// CLASS DECLARATION
+/**
+* This class implements RateControl for MMF players.
+*
+*/
+NONSHARABLE_CLASS(CMMAMMFRateControl): public CMMARateControl,
+ public MMMAPlayerStateListener
+{
+public:
+
+ static CMMAMMFRateControl* NewL(CMMAMMFPlayerBase* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAMMFRateControl();
+
+protected:
+
+ /**
+ * Constructor.
+ */
+ CMMAMMFRateControl(CMMAMMFPlayerBase* aPlayer);
+
+ void ConstructL();
+
+public: // from MMMAPlayerStateListener
+ virtual void StateChanged(TInt aState);
+
+public: // New methods
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ virtual TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ virtual TInt RateL();
+
+
+private: // Member data
+
+ /**
+ * Used to obtain RMMFController reference to stop/start
+ * playback.
+ */
+ CMMAMMFPlayerBase* iPlayer;
+
+ /**
+ * Hold current rate value.
+ */
+ TInt iCurrentRate;
+
+};
+
+#endif // CMMAMMFRATECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmammfresolver.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CMMAMMFRESOLVER_H
+#define CMMAMMFRESOLVER_H
+
+// INCLUDES
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include "cmmaplayer.h"
+
+
+_LIT(KRmFileExtension, ".rm");
+_LIT(KRaFileExtension, ".ra");
+
+// CLASS DECLARATION
+/**
+* This class can be used to get RMMFControllerImplInfoArray and content
+* types from MMF.
+*/
+NONSHARABLE_CLASS(CMMAMMFResolver): public CBase
+
+{
+public: // Construction
+ /**
+ * Constructs a new mmf resolver object.
+ * @return The new object created. Note that the new object will be
+ * left on the cleanup stack.
+ */
+ static CMMAMMFResolver* NewLC();
+
+public: // New methods.
+ /**
+ * Retrieves all controller plugins that support the requirements of
+ * the caller.
+ */
+ void ListImplementationsL();
+
+ /**
+ * Returns implementations.
+ * Array will not contain any implementation if ListImplementationsL()
+ * is not called.
+ * @return Found implementations.
+ */
+ RMMFControllerImplInfoArray* Implementations();
+
+ /**
+ * Returns implementations. Notice: Ownership is transferred to caller.
+ * Array will not contain any implementation if ListImplementationsL()
+ * is not called.
+ * @return Found implementations. Ownership is transferred.
+ */
+ RMMFControllerImplInfoArray* ImplementationsOwnership();
+
+ /**
+ * Returns content type that was found in ListImplementationsL method.
+ * Ownership is transfered.
+ * @return Content type or NULL if type is not available.
+ */
+ HBufC* ContentTypeOwnership();
+
+ /**
+ * Returns content type that was found in ListImplementationsL method.
+ * @return Content type or NULL if type is not available.
+ */
+ HBufC* ContentType();
+
+ /**
+ * Sets filename
+ * @param aFileName File name to be set or NULL
+ */
+
+ void SetFileNameL(const TDesC* aFileName);
+
+ /**
+ * Returns possible filename or NULL if not set
+ * Ownership is transfered.
+ * @return Content type or NULL if type is not available.
+ */
+ HBufC* FileNameOwnership();
+
+ /**
+ * Get all supported content types.
+ * @param aMimeTypeArray Will contain supported mime types.
+ */
+ void GetSupportedContentTypesL(CDesC16Array& aMimeTypeArray);
+
+ /**
+ * Return selection parameters.
+ */
+ CMMFControllerPluginSelectionParameters*
+ SelectionParameters();
+
+ /**
+ * Sets the play format support required.
+ * @param aRequiredSupport The play format support required.
+ */
+ void SetRequiredPlayFormatSupportL(
+ CMMFFormatSelectionParameters& aRequiredSupport);
+
+ /**
+ * Sets the record format support required.
+ * @param aRequiredSupport The record format support required.
+ */
+ void SetRequiredRecordFormatSupportL(
+ CMMFFormatSelectionParameters& aRequiredSupport);
+
+private:
+ /**
+ * Returns record or play formats according to the setup.
+ */
+ const RMMFFormatImplInfoArray* Formats(
+ CMMFControllerImplementationInformation* aImplementation);
+ /**
+ * Finds content type from iImplementations array.
+ */
+ void ResolveContentTypeL();
+
+private:
+ TBool IsRealVideoTypeL(const TDesC& aFileName);
+
+ TBool IsRealMimeTypeSupported(const TDesC& aMimeType);
+
+protected:
+ // C++ constructor
+ CMMAMMFResolver();
+ void ConstructL();
+
+private:
+ ~CMMAMMFResolver();
+
+private:
+ // Owned. Ownership can be tranferred with ImplementationsOwnership
+ // method.
+ RMMFControllerImplInfoArray* iImplementations;
+
+ // Owned. Ownership can be transferred with ContentType method.
+ HBufC* iContentType;
+
+ // Owned. Ownership can be transferred with FileName method.
+ HBufC* iFileName;
+
+ // Owned.
+ CMMFControllerPluginSelectionParameters* iControllerSelection;
+
+ // The required play format support
+ CMMFFormatSelectionParameters* iRequiredPlayFormatSupport;
+
+ // The required record format support
+ CMMFFormatSelectionParameters* iRequiredRecordFormatSupport;
+};
+
+#endif // CMMAMMFRESOLVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaoutputstream.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class to handle OutputStream operations.
+*
+*/
+
+
+#ifndef CMMAOUTPUTSTREAM_H
+#define CMMAOUTPUTSTREAM_H
+
+// EXTERNAL INCLUDES
+//#include <jutils.h>
+#include <s32mem.h>
+#include "MMAFunctionServer.h"
+
+// FORWARD DECLARATIONS
+class CMMAOutputStreamEvent;
+class MMMAEventPoster;
+
+// CLASS DECLARATION
+/**
+* Class to handle OutputStream operations.
+* MMF writes to the stream and Java-class reads the stream.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAOutputStream): public CBase
+{
+private:
+ /**
+ * Status code to be delivered to Java
+ */
+ enum TStatus
+ {
+ EMoreData = 1,
+ ECompleted = 2
+ };
+
+public: // Constructors and destructors
+ /**
+ * Object creation. Static method.
+ *
+ * @param aJNIEnv handle to used jni environment
+ * @param aEventPoster handle to event poster
+ * @param aJavaOutputStreamWriter handle to java Outputstream object
+ *
+ * @return CMMAOutputStream object
+ */
+ static CMMAOutputStream* NewL(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter);
+
+ /**
+ * The same as NewL with cleanup stack
+ * @see NewL
+ */
+ static CMMAOutputStream* NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter);
+
+
+ /**
+ * Object creation. Static method.
+ *
+ * @param aOutputStream handle to used output stream
+ * @param aJNIEnv handle to used jni environment
+ * @param aEventPoster handle to event poster
+ * @param aJavaOutputStreamWriter handle to java Outputstream object
+ */
+ static void CreateL(CMMAOutputStream** aOutputStream,
+ MMAFunctionServer* aEventSource,
+ JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter);
+
+ /**
+ * Deletes owned objects
+ */
+ ~CMMAOutputStream(); // Destructor
+
+private: // Constructors and destructors
+ /**
+ * Default constructor, initializes variables
+ */
+ CMMAOutputStream(MMMAEventPoster* aEventPoster);
+
+ /**
+ * Finishes construction
+ *
+ * @param aJNIEnv handle to used jni environment
+ * @param aJavaOutputStreamWriter handle to java Outputstream object
+ */
+ void ConstructL(JNIEnv* aJNIEnv,
+ jobject aJavaOutputStreamWriter);
+
+public: // New methods
+ /**
+ * Read data from c++ to aOutputData (passed from java side)
+ */
+ virtual void ReadDataL(TUint8* aOutputData,
+ TInt* aBufferSize,
+ TInt* aReadStatus);
+
+public: // New methods
+ /**
+ * Write data to a stream.
+ */
+ void WriteL(const TDesC8& aData);
+
+ /**
+ * Commit Java stream
+ */
+ void Commit();
+
+private: // Data
+ /**
+ * Owned.
+ * Event which notifies Java when data is available or read continues.
+ */
+ CMMAOutputStreamEvent* iWriteEvent;
+
+ /**
+ * Pointer to event source
+ */
+ MMMAEventPoster* iEventSource;
+
+ /**
+ * Ptr to iData member. Moved when data is read.
+ */
+ TPtr8 iPtr;
+
+ /**
+ * Owned.
+ * Pointer to data to be written to Java side.
+ */
+ HBufC8* iData;
+};
+
+
+#endif // CMMAOUTPUTSTREAM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaoutputstreamevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMAOUTPUTSTREAMEVENT_H
+#define CMMAOUTPUTSTREAMEVENT_H
+
+#include "cmmaevent.h"
+
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAOutputStreamEvent): public CMMAEvent
+{
+public:
+ enum TMMAOutputStreamState
+ {
+ EMMAEventActive, // event is waiting dispatching
+ EMMAEventNotActive, // not added to event server
+ EMMADeleteEvent // dispatch deletes this event
+ };
+public:
+ CMMAOutputStreamEvent(jmethodID aHandleEventMethod,
+ jobject aNotifyObject);
+
+ // status of the source stream
+ void SetStatus(TInt aStatus);
+
+ // length of the available output stream data
+ void SetLength(TInt aLength);
+
+ /**
+ * Sets new state.
+ * @param aState TMMAOutputStreamState.
+ */
+ void SetState(TMMAOutputStreamState aState);
+
+ TMMAOutputStreamState State();
+private: // from CJavaEvent
+ void Dispatch(JNIEnv& aJni);
+
+private:
+ jmethodID iHandleEventMethod;
+ jobject iListenerObject;
+ TInt iLength;
+ TInt iStatus;
+
+ /**
+ * State of this event.
+ */
+ TMMAOutputStreamState iState;
+};
+
+#endif // CMMAOUTPUTSTREAMEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,475 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is base class for all players.
+*
+*/
+
+
+#ifndef CMMAPLAYER_H
+#define CMMAPLAYER_H
+
+// INCLUDES
+#include "cmmacontrol.h"
+#include "cmmasourcestream.h"
+#include "cmmaplayerevent.h"
+#include "mmmasourcestreamlistener.h"
+#include "mmmaplayerstatelistener.h"
+
+// FORWARD DECLARATIONS
+class CMMADurationUpdater;
+
+// CONTANTS
+
+// Not enough stream to realize to player
+const TInt KErrNotEnoughStreams = -7002;
+
+/**
+ * Used in set loop count to indicate forever loop.
+ */
+const TInt KJavaRepeatForever = -1;
+
+/**
+ * Returned to Java if duration or mediatime is unknown.
+ */
+const TInt KTimeUnknown = -1;
+
+// CLASS DECLARATION
+/**
+* This class is base class for all players.
+*
+*
+*/
+
+class CMMAPlayer : public CBase,
+ public MMMASourceStreamListener
+
+{
+public:
+ /**
+ * Player state. Same that in Java side.
+ */
+ enum TPlayerState
+ {
+ EClosed = 0,
+ EUnrealized = 100,
+ ERealized = 200,
+ EPrefetched = 300,
+ EStarted = 400
+ };
+
+public:
+ /**
+ * Deletes all owned members.
+ */
+ virtual ~CMMAPlayer();
+protected:
+ /**
+ * Initializes member variables to defaults.
+ */
+ CMMAPlayer();
+
+ /**
+ * Second phase construct.
+ */
+ void ConstructL();
+
+public: // static methods
+ /**
+ * Creates and adds source stream to the player. New stream will be
+ * owned by this player.
+ *
+ * @param aJniEnv Used to create source stream.
+ * @param aPlayer Player to use.
+ * @param aEventSource Used to create source stream.
+ * @param aReader Java side stream object.
+ * @param aSourceStream New stream's pointer will be set to this.
+ */
+ static void StaticAddSourceStreamL(JNIEnv* aJniEnv,
+ CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aReader,
+ CMMASourceStream** aSourceStream);
+
+ /**
+ * Sets Java listener object that will be used to post player events
+ * and control specific events.
+ *
+ * @param aPlayer Player to use.
+ * @param aListenerObject Java side listener object.
+ * @param aJni Used to get method ids.
+ * @param aPoster Used to post events.
+ */
+ static void StaticSetPlayerListenerObjectL(CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventsource,
+ jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aPoster);
+
+ /**
+ * Initializes action completed callbacks.
+ *
+ * @param aPlayer Player to use.
+ * @param aPlayerObject Java side Player object.
+ * @param aJni Used to get method id.
+ */
+ static void StaticInitPlayerL(CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventsource,
+ jobject aPlayerObject,
+ JNIEnv* aJni);
+
+ /**
+ * Static getter for control objects.
+ *
+ * @param aPlayer Player to use.
+ * @param aIndex Control's index.
+ */
+ IMPORT_C static CMMAControl* StaticControl(CMMAPlayer* aPlayer,
+ TInt aIndex);
+
+public: // New methods
+
+ /**
+ * Realizes the player. Implementations do not necessarily add
+ * functionality in this method. If successful player is in
+ * ERealized state.
+ */
+ virtual void RealizeL();
+
+ /**
+ * Prefetches data. Usually data from source stream will be read. When
+ * prefetch completes action completed event will be delivered. If
+ * successful player is in EPrefetched state.
+ */
+ virtual void PrefetchL() = 0;
+
+ /**
+ * Start playing. Started event will be posted. If there is no error
+ * player will be in EStarted state.
+ */
+ virtual void StartL() = 0;
+
+ /**
+ * Stops playing. After this player may be restarted with StartL method.
+ * After this player is in EPrefetched state.
+ *
+ * @param aPostEvent Indicates if java be informed.
+ */
+ virtual void StopL(TBool aPostEvent) = 0;
+
+ /**
+ * Releases resources. Player state can be changed.
+ */
+ virtual void DeallocateL() = 0;
+
+ /**
+ * Close the Player and release its resources. After this player is in
+ * EClosed state and cannot be used anymore.
+ */
+ virtual void CloseL();
+
+ /**
+ * Gets duration.
+ *
+ * @param aDuration Duration or KTimeUnknown if not specified.
+ */
+ virtual void GetDuration(TInt64* aDuration);
+
+ /**
+ * Sets media time.
+ *
+ * @param aTime Time to set. When method returns parameter contains
+ * actual media time set.
+ */
+ virtual void SetMediaTimeL(TInt64* aTime);
+
+ /**
+ * Gets media time.
+ *
+ * @param aMediaTime When method returns parameter contains the media
+ * time.
+ */
+ virtual void GetMediaTime(TInt64* aMediaTime);
+
+ /**
+ * Sets loop count.
+ *
+ * @param aCount Indicates the number of times the content will be
+ * played. KJavaRepeatForever indicates looping
+ * indefintely.
+ */
+ IMPORT_C virtual void SetLoopCount(TInt aCount);
+
+ /**
+ * Get the content type of the media that's being played back by this
+ * Player.
+ * @return The content type being played back by this Player. NULL if
+ * content type is not available.
+ */
+ HBufC* ContentType() const;
+
+public: // new methods
+ /**
+ * Sets Java listener object that will be used to post player events
+ * and control specific events.
+ *
+ * @param aListenerObject Java side listener object.
+ * @param aJni Used to get method ids.
+ * @param aPoster Used to post events.
+ */
+ virtual void SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aPoster);
+
+ /**
+ * Returns total count of the controls owned by this player.
+ *
+ * @return Count of the controls.
+ */
+ IMPORT_C TInt ControlCount();
+
+ /**
+ * Gets control. Ownership is not tranferred.
+ *
+ * @param aIndex Control index.
+ */
+ IMPORT_C CMMAControl* Control(TInt aIndex);
+
+ /**
+ * Adds new control. Ownership is transferred to this class.
+ *
+ * @param aControl New control.
+ */
+ IMPORT_C virtual void AddControlL(CMMAControl* aControl);
+
+ /**
+ * Adds listener. All listeners will informed when player state changes.
+ *
+ * @param aListener New listener.
+ */
+ IMPORT_C void AddStateListenerL(MMMAPlayerStateListener* aListener);
+
+ /**
+ * Removes a player state listener.
+ *
+ * @param aListener Listener to be removed.
+ */
+ IMPORT_C void RemoveStateListener(MMMAPlayerStateListener* aListener);
+
+ /**
+ * @return Player's state.
+ */
+ inline TInt State();
+
+ /**
+ * Returns player's type. Player types are defined in derived player
+ * headers.
+ * @return Player type.
+ */
+ virtual const TDesC& Type();
+
+ /**
+ * Sets player's content type, which can be queried with ContentType
+ * method. Ownership is transfered.
+ * @param aContentType Player's content type.
+ */
+ void SetContentType(HBufC* aContentType);
+
+ /**
+ * Reset all source streams.
+ */
+ void ResetSourceStreams();
+
+ /**
+ * Refresh all the controls.
+ */
+ void RefreshControls();
+ /**
+ * delete all the controls.
+ */
+ void DeleteControls();
+
+public: // methods for informing java player listeners
+
+ /**
+ * Post event which event data will be Long java object.
+ *
+ * @param aEventType Event's type specified in CMMAPlayerEvent.
+ * @param aLongEventData Event data context.
+ */
+ void PostLongEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TInt64& aLongEventData);
+
+ /**
+ * Post event which event data will be string.
+ *
+ * @param aEventType Event's type specified in CMMAPlayerEvent.
+ * @param aStringEventData Event data context.
+ */
+ IMPORT_C void PostStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData);
+
+ /**
+ * Post event which event data will be a java object.
+ *
+ * @param aEventType Event's type specified in CMMAPlayerEvent.
+ * @param aEventData Java object.
+ */
+ IMPORT_C void PostObjectEvent(CMMAPlayerEvent::TEventType aEventType,
+ const jobject aEventData);
+
+ /**
+ * Completes action and allows Java side to continue.
+ *
+ * @param aError of the action or KErrNone.
+ */
+ IMPORT_C void PostActionCompleted(TInt aError);
+
+ IMPORT_C void PostActionCompletedFile(); //LC work for S60 3.2
+
+ IMPORT_C void PostActionCompletedStart();
+protected: // new methods
+ /**
+ * @see StaticAddSourceStreamL
+ */
+ IMPORT_C virtual CMMASourceStream* AddSourceStreamL(JNIEnv* aJniEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader);
+
+ /**
+ * Changes player's state and informs all MMMAPlayerStateListeners.
+ *
+ * @param aState New state.
+ */
+ void ChangeState(TPlayerState aState);
+
+public: // from MMMASourceStreamListener
+ virtual void ReadCompletedL(TInt aStatus, const TDesC8& aData);
+
+protected: // Memeber data
+ /**
+ * Array of controls. All controls are owned by this class.
+ */
+ RPointerArray< CMMAControl > iControls;
+
+ /**
+ * Array of streams. All streams are owned by this class.
+ */
+ RPointerArray< CMMASourceStream > iSourceStreams;
+
+
+ /**
+ * Array of listeners. Not owned.
+ */
+ RPointerArray< MMMAPlayerStateListener > iStateListeners;
+
+ /**
+ * Used to inform java side of completion.
+ * Owned.
+ */
+ CMMAEvent* iActionCompletedEvent;
+
+ /**
+ * Used to inform java side of completion.
+ * Owned.
+ */
+ CMMAEvent* iActionCompletedFileEvent;
+
+ CMMAEvent* iActionCompletedStartEvent;
+
+ /**
+ * Player state listener object.
+ */
+ jobject iListenerObject;
+
+ /**
+ * java method postEvent(String,Object)
+ */
+ jmethodID iPostEvent;
+ /**
+ * java method postObjectEvent(int,Object)
+ */
+ jmethodID iPostObjectEvent;
+
+ /**
+ * java method postLongEvent(int,long)
+ */
+ jmethodID iPostLongEvent;
+
+ /**
+ * java method postStringEvent(int,String)
+ */
+ jmethodID iPostStringEvent;
+
+ /**
+ * java method postControlEvent(int,String)
+ */
+ jmethodID iPostControlEvent;
+
+ /**
+ * Not owned.
+ */
+ MMMAEventPoster* iEventPoster;
+
+ /**
+ * Total number of wanted loops.
+ */
+ TInt iRepeatNumberOfTimes;
+
+ /**
+ * Indicates if looping indefintely.
+ */
+ TBool iRepeatForever;
+
+ /**
+ * Current loop count.
+ */
+ TInt iRepeatCount;
+
+ /**
+ * Content duration in microseconds.
+ */
+ TInt64 iDuration;
+
+ /**
+ * Current state of the player.
+ */
+ TPlayerState iState;
+
+ /**
+ * Event for notificating Java that memory allocation has failed.
+ * Owned.
+ */
+ CMMAPlayerEvent* iOOMErrorEvent;
+
+ /**
+ * The content type being played back by this Player.
+ * Owned. May be NULL until type is available.
+ */
+ HBufC* iContentType;
+
+ /**
+ * Player state listener that sends duration update event to Java
+ * if duration has changed when player state changes.
+ */
+ CMMADurationUpdater* iDurationUpdater;
+
+};
+
+
+inline TInt CMMAPlayer::State()
+{
+ return iState;
+}
+
+#endif // CMMAPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaplayerevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMAPLAYEREVENT_H
+#define CMMAPLAYEREVENT_H
+
+// INCLUDES
+#include "cmmaevent.h"
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*/
+
+NONSHARABLE_CLASS(CMMAPlayerEvent): public CMMAEvent
+{
+public:
+ enum TEventType
+ {
+ EStarted = 0,
+ EStopped = 1,
+ EStoppedAtTime = 2,
+ EEndOfMedia = 3,
+ EDurationUpdated = 4,
+ EAudioDeviceUnavailable = 5,
+ EVolumeChanged = 6,
+ ESizeChanged = 7,
+ EError = 8,
+ EClosed = 9,
+ ERecordStarted = 10,
+ ERecordStopped = 11,
+ EPrivateDataAvailable = 12,
+ EPrivateDataOverwritten = 13,
+ EBufferingStarted = 14,
+ EBufferingEStopped = 15,
+ ERecordError = 16,
+ ENOKIA_EXTERNAL_VOLUME_EVENT = 17, // Event ID for Nokia volume key
+ EAudioOutputPreferenceChangeEvent =18 // Event ID for Audio Routing Preference Change
+ };
+
+private:
+ enum TEventParams
+ {
+ ENormal = 0, // string and object
+ EString, // int and string
+ ELong, // int and long
+ EObject // int and object
+ };
+
+public:
+ /**
+ * Constructor. One of set methods must be called before sending this
+ * event.
+ * @param aNotifyObject Java Objects.
+ * @param aHandleEventMethod Java method.
+ * @param aDisposable Defaults to disposable event.
+ */
+ CMMAPlayerEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable = EDisposableEvent);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAPlayerEvent();
+
+ /**
+ * Sets event data.
+ * @param aEventType Type of the event.
+ * @param aEventData Data to be send to Java
+ */
+ void SetLongEvent(TEventType aEventType, const TInt64& aEventData);
+
+ /**
+ * Sets event data.
+ * @param aEventType Type of the event.
+ * @param aEventData Data to be send to Java
+ */
+ void SetStringEventL(TEventType aEventType, const TDesC& aEventData);
+
+ /**
+ * Sets event data.
+ * @param aEventType Type of the event.
+ * @param aEventData Data to be send to Java
+ */
+ void SetObjectEventL(TEventType aEventType, const jobject aEventData);
+private: // from CJavaEvent
+ void Dispatch(JNIEnv& aJni);
+
+private: // Data
+ TEventType iEventType;
+ TEventParams iEventParams;
+
+ // Used when sending ELong event.
+ TInt64 iLongEventData;
+
+ // Owned event data. Used when sending EString event.
+ HBufC* iStringEventData;
+ // Owned event type. Used when sending ENormal event.
+ HBufC* iStringEventType;
+
+ // Used when sending ENormal or EObject event.
+ jobject iObjectEventData;
+};
+
+#endif // CMMAPLAYEREVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaplayerproperties.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for storing and parsing properties
+*
+*/
+
+
+#ifndef CMMAPLAYERPROPERTIES_H
+#define CMMAPLAYERPROPERTIES_H
+
+// INCLUDES
+#include <e32base.h>
+
+// STRUCTS
+
+/**
+ * These structs are used for storing array of strings
+ */
+NONSHARABLE_STRUCT(TMMAStaticStr)
+{
+ TInt iLength;
+ const TText* iStr;
+
+ inline const TPtrC operator()() const
+ {
+ return TPtrC(iStr, iLength);
+ }
+};
+
+NONSHARABLE_STRUCT(TMMAStaticStrArray)
+{
+ const TMMAStaticStr* iStr;
+ inline const TPtrC operator()() const
+ {
+ return TPtrC(iStr->iStr, iStr->iLength);
+ }
+};
+
+#define MMA_PARAMETER_ARRAY(name) const TMMAStaticStrArray name[] =
+#define MMA_PARAMETER_STR(name, s) static const TMMAStaticStr name = {sizeof(L##s)/sizeof(TText)-1, (TText*)L##s}
+#define MMA_PARAMETER_ARRAY_SIZE(name) (sizeof(name)/sizeof((name)[0]))
+
+// CLASS DECLARATION
+/**
+* This class is base class for storing and validating
+*/
+
+NONSHARABLE_CLASS(MMMAParameterRule)
+{
+public:
+ /**
+ * Validates key-value pair based on rule. If derived class is leaf with specified key
+ * then it must store value if it is valid.
+ */
+ virtual TBool ValidateAndStoreL(const TDesC& aKey, const TDesC& aValue) = 0;
+
+ /**
+ * Compares key-value pair based on rule and stored value.
+ */
+ virtual TBool Compare(const TDesC& aKey, const TDesC& aValue) = 0;
+ virtual TBool Compare(const TDesC& aKey, const TInt aValue) = 0;
+
+ /**
+ * Gets value for specified key, returns EFalse if specified key is not found
+ */
+ virtual TBool FindProperty(const TDesC& aKey, TPtrC& aValue) = 0;
+ virtual TBool FindProperty(const TDesC& aKey, TInt& aValue) = 0;
+};
+
+// CLASS DECLARATION
+/**
+* This class is used for storing and parsing properties
+* The property string is in format "name=value&name=value&..."
+*
+*/
+
+NONSHARABLE_CLASS(CMMAPlayerProperties): public CBase
+{
+public:// Construction and destruction
+ /**
+ * Two-phased constructor.
+ */
+ static CMMAPlayerProperties* NewL(const TDesC& aProperties,
+ MMMAParameterRule& aRule);
+ /**
+ * Destructor.
+ */
+ ~CMMAPlayerProperties();
+
+protected: // default constructor and second phase construction
+ CMMAPlayerProperties(const TDesC& aProperties, MMMAParameterRule& aRule);
+
+public: // new methods
+ /**
+ * Gets property for given key. Returns EFalse if key cannot
+ * be found
+ */
+ TBool GetProperty(const TDesC& aKey, TInt& aValue) const;
+ TBool GetProperty(const TDesC& aKey, TPtrC& aValue) const;
+
+ /**
+ * Compares that given key and value pair can be found in
+ * given properties string. Notice that this returns EFalse also
+ * if given key is not found.
+ */
+ TBool Compare(const TDesC& aKey, const TInt& aValue) const;
+ TBool Compare(const TDesC& aKey, const TDesC& aValue) const;
+
+ /**
+ * Validates given properties with given rule(s), leaves with
+ * KErrArgument if properties was not valid.
+ */
+
+ void ValidateL() const;
+
+private: //data
+ // properties
+ const TDesC& iProperties;
+ // rule composition
+ MMMAParameterRule& iRule;
+};
+
+
+
+// CLASS DECLARATION
+/**
+* Composite class for storing rule set
+*/
+
+NONSHARABLE_CLASS(CMMAParameterRuleSet): public CBase, public MMMAParameterRule
+{
+public: // Construction and destruction
+ /**
+ * Two-phased constructor.
+ */
+ static CMMAParameterRuleSet* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CMMAParameterRuleSet();
+
+protected: // default constructor and second phase construction
+ CMMAParameterRuleSet();
+ virtual void ConstructL();
+
+public: // From MMMAParameterRule
+ TBool ValidateAndStoreL(const TDesC& aKey, const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TInt aValue);
+ TBool FindProperty(const TDesC& aKey, TPtrC& aValue);
+ TBool FindProperty(const TDesC& aKey, TInt& aValue);
+
+public: // new methods
+ void AppendRuleL(MMMAParameterRule* aRule);
+
+private: // data
+ // list of rules in this composite, owned
+ CArrayPtrSeg< MMMAParameterRule >* iRules;
+};
+
+// CLASS DECLARATION
+/**
+* Base class for property rules
+*/
+NONSHARABLE_CLASS(TMMAParameterRuleBase): public MMMAParameterRule
+{
+public: // constructor
+ TMMAParameterRuleBase(const TDesC& aKey);
+
+public: // From MMMAParameterRule
+ TBool ValidateAndStoreL(const TDesC& aKey, const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TInt aValue);
+ TBool FindProperty(const TDesC& aKey, TPtrC& aValue);
+ TBool FindProperty(const TDesC& aKey, TInt& aValue);
+
+protected: // new methods
+ /**
+ * Returns EFalse if value is not valid for this rule
+ * Derived class must also store value if it is accepted
+ */
+ virtual TBool ValidateValueL(const TDesC& aValue) = 0;
+
+protected: //data
+ const TDesC& iKey;
+ TBool iAssigned;
+};
+
+// CLASS DECLARATION
+/**
+* Rule for TInt
+*/
+NONSHARABLE_CLASS(TMMAParameterRuleInt): public TMMAParameterRuleBase
+{
+public: // constructors
+ TMMAParameterRuleInt(const TDesC& aKey);
+
+ TMMAParameterRuleInt(const TDesC& aKey,
+ const TInt aLowerLimit);
+
+ TMMAParameterRuleInt(const TDesC& aKey,
+ const TInt aLowerLimit,
+ const TInt aUpperLimit);
+
+public: // From MMMAParameterRule
+ TBool ValidateValueL(const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TInt aValue);
+ TBool FindProperty(const TDesC& aKey, TInt& aValue);
+
+
+
+private: // data
+ TInt iValue;
+ const TInt iUpperLimit;
+ const TInt iLowerLimit;
+};
+
+// CLASS DECLARATION
+/**
+* Rule for TDesC
+*/
+NONSHARABLE_CLASS(TMMAParameterRuleDes): public TMMAParameterRuleBase
+{
+public: // constructors
+ TMMAParameterRuleDes(const TDesC& aKey);
+
+ TMMAParameterRuleDes(const TDesC& aKey,
+ const TMMAStaticStrArray* aValidValues,
+ const TInt aArraySize);
+
+public: // From MMMAParameterRule
+ TBool ValidateValueL(const TDesC& aValue);
+ TBool Compare(const TDesC& aKey, const TDesC& aValue);
+ TBool FindProperty(const TDesC& aKey, TPtrC& aValue);
+
+
+private: // data
+ TPtrC iValue;
+ // not owned
+ const TMMAStaticStrArray* iValidValues;
+ const TInt iArraySize;
+};
+#endif // CMMAPLAYERPROPERTIES_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmaratecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for RateControl implementations.
+*
+*/
+
+
+#ifndef CMMARATECONTROL_H
+#define CMMARATECONTROL_H
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include "cmmacontrol.h" // base class
+
+// CONSTANTS
+
+static const TInt KMMADefaultRate = 100000;
+static const TInt KMMAMinRate = 0;
+
+// Constant for control name. Name is used in Java side to instantiate
+// Java Class which uses CMMARateControl.
+_LIT(KMMARateControlName, "RateControl");
+
+
+// CLASS DECLARATION
+/**
+* This class is the base class for RateControl implementations.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMARateControl): public CMMAControl
+{
+public:
+ /**
+ * Destructor.
+ */
+ ~CMMARateControl();
+
+protected:
+ /**
+ * Constructor.
+ */
+ CMMARateControl();
+
+public: // From CMMAControl
+ virtual const TDesC& ClassName() const;
+
+public: // New methods
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ virtual TInt SetRateL(TInt aRate) = 0;
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ virtual TInt RateL() = 0;
+
+ /**
+ * @return The maximum rate supported.
+ */
+ virtual TInt MaxRateL();
+
+ /**
+ * @return The minimum rate supported.
+ */
+ virtual TInt MinRateL();
+
+};
+
+
+#endif // CMMARATECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmarecordcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a RecordControl.
+*
+*/
+
+
+#ifndef CMMARECORDCONTROL_H
+#define CMMARECORDCONTROL_H
+
+// INTERNAL INCLUDES
+#include <f32file.h>
+#include "cmmaoutputstream.h"
+#include "cmmacontrol.h"
+#include "mmmaplayerstatelistener.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+// CONSTANTS
+
+// Too fast start and stop can cause problems,
+// 0.5s is enough to make pause work.
+const TInt KMinRecordPauseInterval = 500000;
+
+_LIT(KMMARecordTempDirectory, "d:\\"); // CSI: 25 dir for temporary recording file #
+_LIT(KMMARecordErrorMsg, "Recording error: %d");
+const TInt KRecordErrorMessageSize = 25;
+
+// CLASS DECLARATION
+/**
+* This class is the native side of the RecordControl Java class. This class
+* delegates static method calls to virtual methods which are implemented in
+* derived classes. This class only implements ClassName method.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMARecordControl):
+ public CMMAControl,
+ public MMMAPlayerStateListener
+{
+protected:
+ // Internal state of this class.
+ enum TRecordState
+ {
+ // recorder has not been initialized (startRecord has not been called)
+ ERecordUninitialized = 1, //Recorder uninitialized
+ // recorder has been initialized (startRecord) however,
+ // recodring has been stopped after that (stopRecord)
+ ERecordInitialized,
+ // recorder has been initialized (startRecord) but player is not in
+ // STARTED state
+ ERecordStandBy,
+ // recorder has been initialized (startRecord) and player is in
+ // STARTED state. i.e. recording is ON
+ ERecordRecording
+ };
+
+protected: // proteced constructor and destructor for preventing direct use
+ CMMARecordControl(CMMAPlayer* aPlayer);
+ ~CMMARecordControl();
+ void ConstructL();
+
+ /**
+ * Waits until recording can be paused after start.
+ * @param aMediaTime Current media time.
+ */
+ void WaitForPauseL(const TInt64& aMediaTime);
+
+public: // new methods
+ /**
+ * Start recording.
+ */
+ virtual void StartRecordL();
+
+ /**
+ * Stops recording.
+ */
+ virtual void StopRecordL();
+
+ /**
+ * Completes current recording. The rest of the data will written
+ * to the output stream. This method may not be called when recording.
+ */
+ virtual void CommitL();
+
+ /**
+ * Erase current recording.
+ */
+ virtual void ResetL();
+
+ /**
+ * Set the output stream where the data will be recorded.
+ * Existing stream will be deleted.
+ * @param aStream New stream to use.
+ */
+ virtual void SetRecordStream(CMMAOutputStream* aStream);
+
+ /**
+ * Return the content type of the recorded media.
+ * @return Content type used for recording.
+ */
+ virtual HBufC* GetContentTypeL();
+
+public: // new pure virtual methods
+
+ /**
+ * Set the record size limit. This limits the size of the recorded
+ * media to the number of bytes specified.
+ *
+ * When recording is in progress, commit will be called implicitly
+ * in the following cases:
+ * - Record size limit is reached
+ * - If the requested size is less than the already recorded size
+ * - No more space is available.
+ *
+ * Once a record size limit has been set,
+ * it will remain so for future recordings until it is
+ * changed by another setRecordSizeLimit call.
+ *
+ * @param aSize New size limit.
+ * @return Actual value set.
+ */
+ virtual TInt SetRecordSizeLimitL(TInt aSize) = 0;
+
+ /**
+ * Start the recording in implementation
+ */
+ virtual void DoStartRecordL() = 0;
+
+ /**
+ * Start the recording in implementation
+ */
+ virtual void DoStopRecordL() = 0;
+
+ /**
+ * Initialize native recorder
+ */
+ virtual void InitializeL() = 0;
+
+ /**
+ * Reset recorder
+ */
+ virtual void DoResetL() = 0;
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+
+public: // from MMMAPlayerListener
+ void StateChanged(TInt aState);
+
+protected: // new methods
+ /**
+ * Sends record error event to Java
+ */
+ void Error(TInt aErrorCode);
+
+ /**
+ * Handles situation when record size limit is reached
+ */
+ void HandleRecordSizeLimit();
+
+private: // new methods
+ void NextStateL(TInt aPlayerState);
+
+protected: // Members
+ // Current state of recording
+ TRecordState iState;
+
+ // Where to record
+ RFile iFile;
+ TFileName iFilename;
+
+ // Recording player
+ CMMAPlayer* iPlayer;
+
+ // Rfs used for creating temp file and deleting it
+ RFs iFs;
+private: // Members
+
+ // Stream to write data, owned
+ CMMAOutputStream* iOutputStream;
+
+ /**
+ * Start time of recording.
+ */
+ TInt64 iStartTime;
+
+ /**
+ * Owned. Used to wait before pause if it
+ * is called too fast after starting.
+ */
+ RTimer iRecordPauseTimer;
+};
+
+
+#endif // CMMARECORDCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmasnapshot.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class takes snapshot and resizes bitmap if needed.
+*
+*/
+
+#ifndef CMMASNAPSHOT_H
+#define CMMASNAPSHOT_H
+
+// INCLUDES
+#include <bitmaptransforms.h>
+#include "tmmaparametervalidator.h"
+#include "mmmasnapshot.h"
+
+// FORWARD DECLARATIONS
+class MMMAGuiPlayer;
+class MMMAEventPoster;
+class MMMASnapshotReadyCallback;
+
+
+// CLASS DECLARATION
+/**
+* This class takes snapshot from MMMAGuiPlayer and resizes bitmap
+* if needed. Then bitmap is converted to wanted image format and posted
+* to java side. This class is used only from CMMAVideoControl and
+* this class is made to separate many asynchronous calls from control and
+* resource releasing.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMASnapshot): public CActive
+{
+private: // private state
+ enum TMMASnapshotState
+ {
+ EIdle,
+ ETakingSnapshot,
+ EResizing,
+ EEncoding
+ };
+public:
+ /**
+ * Creates new CMMASnapshot which will be associated to gui player.
+ *
+ * @param aGuiPlayer Player used to take snapshot bitmap.
+ * @param aCallBack Will be informed when completed.
+ */
+ static CMMASnapshot* NewL(MMMAGuiPlayer* aGuiPlayer,
+ MMMASnapshotReadyCallback& aCallBack);
+ /**
+ * Destructor.
+ */
+ virtual ~CMMASnapshot();
+
+private:
+ /**
+ * Creates required member variables.
+ */
+ void ConstructL();
+
+ /**
+ * Contructs new CMMASnapshot.
+ *
+ * @param aGuiPlayer Used to take snapshot bitmap.
+ * @param aCallBack Will be informed when completed.
+ */
+ CMMASnapshot(MMMAGuiPlayer* aGuiPlayer,
+ MMMASnapshotReadyCallback& aCallBack);
+
+public: // new methods
+ /**
+ * Takes snapshot from player and converts it to according to
+ * the properties.
+ *
+ * @param aProperties Snapshot's properties.
+ */
+ void TakeSnapShotL(const TDesC& aProperties);
+
+ /**
+ * Caller takes the ownership of the buffer.
+ *
+ * @return Image buffer. Ownership is transferred.
+ */
+ HBufC8* ImageBuffer();
+
+
+private:// New methods
+ /**
+ * Resizing image to size of settings
+ */
+ void ResizeL();
+
+ /**
+ * Encodes bitmap to wanted mime-type
+ */
+ void EncodeL();
+
+ /**
+ * Called when snapshot is ready or error occures. This method will
+ * inform also the MMMASnapshotReadyCallback interface.
+ *
+ * @param aError Error code for the caller class.
+ */
+ void Completed(TInt aError);
+
+public: // CActive
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+private:
+ /**
+ * Bitmap encoder, owned
+ */
+ CImageEncoder* iEncoder;
+
+ /**
+ * Bitmap will be got from gui player and ownership is
+ * transfers to this class, owned
+ */
+ CFbsBitmap* iBitmap;
+
+ /**
+ * Bitmap scaler, owned
+ */
+ CBitmapScaler* iScaler;
+
+ /**
+ * Buffer used for storing encoded data, owned
+ */
+ HBufC8* iBuffer;
+
+ /**
+ * Bitmap settings, owned
+ */
+ CMMAImageSettings* iSettings;
+
+ /**
+ * Snapshot encoding
+ */
+ MMMASnapshot::TEncoding iEncoding;
+
+ /**
+ * GUI player interface, used for taking snapshot, not owned
+ */
+ MMMAGuiPlayer* iGUIPlayer;
+
+ /**
+ * When snapshot is ready or error occures callback will be informed.
+ */
+ MMMASnapshotReadyCallback& iCallBack;
+
+ /**
+ * Internal state
+ */
+ TMMASnapshotState iState;
+};
+
+#endif // CMMASNAPSHOT_H
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmasnapshotevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMASNAPSHOTEVENT_H
+#define CMMASNAPSHOTEVENT_H
+
+// INCLUDES
+#include "cmmaevent.h"
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMASnapshotEvent): public CMMAEvent
+{
+public:
+ CMMASnapshotEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TInt aError,
+ HBufC8* aImage,
+ TDisposability aDisposable = EDisposableEvent);
+
+ ~CMMASnapshotEvent();
+
+private: // from CJavaEvent
+ void Dispatch(JNIEnv& aJni);
+
+private: // data
+ HBufC8* iImageBuffer;
+};
+
+#endif // CMMASNAPSHOTEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmasourcestream.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class for reading data from Java SourceStream to native side
+*
+*/
+
+
+#ifndef CMMASOURCESTREAM_H
+#define CMMASOURCESTREAM_H
+
+//#include <jutils.h>
+#include "MMAFunctionServer.h"
+
+class CMMASourceStreamEvent;
+class MMMASourceStreamListener;
+class MMMAEventPoster;
+
+// CONSTANTS
+const TInt KMMAReadAllData = -1;
+
+// CLASS DECLARATION
+/**
+* Class for reading data from Java SourceStream to native side
+*
+*
+*/
+NONSHARABLE_CLASS(CMMASourceStream): public CBase
+{
+public:
+ /**
+ * Status of the source stream reader
+ */
+ enum TStatus
+ {
+ EReadAll = 1,
+ ERead = 2,
+ EMoreData = 3,
+ ECompleted = 4,
+ EClosed = 5
+ };
+
+public: // Constructors and destructors
+ /**
+ * Object creation. Static method.
+ *
+ * @param aJNIEnv handle to used jni environment
+ * @param aEventPoster handle to event poster
+ * @param aJavaSourceStream handle to java SourceStream object
+ * @param aListener Handle to source stream listener
+ *
+ * @return CMMASourceStream object
+ */
+ static CMMASourceStream* NewL(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener);
+
+ /**
+ * The same as NewL with cleanup stack
+ * @see NewL
+ */
+ static CMMASourceStream* NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener);
+
+ /**
+ * Deletes owned objects
+ */
+ ~CMMASourceStream(); // Destructor
+
+protected: // Constructors and destructors
+
+ /**
+ * Set variables
+ * @param aEventPoster handle to event poster
+ * @param aListener handle to source stream listener
+ */
+ CMMASourceStream(MMMAEventPoster* aEventPoster,
+ MMMASourceStreamListener* aListener);
+
+ /**
+ * 2nd phase constructor
+ *
+ * @param aJNIEnv used jni environment
+ * @param aJavaSourceStream handle to java source stream object
+ */
+ void ConstructL(JNIEnv* aJNIEnv, jobject aJavaSourceStream);
+
+public: // New methods
+ /**
+ * Writes data to from java buffer to native side
+ *
+ * @param aData data passed by Java side
+ * @param aLength size of passed data
+ * @param state of this class
+ */
+ virtual void WriteL(const TUint8* aData,
+ TInt aLength, TInt aState);
+ /**
+ * Read aLength bytes from Java source stream
+ *
+ * @param aLength size of read
+ */
+ void ReadL(TInt aLength);
+
+ /**
+ * Read all data from Java source stream, clears buffer
+ */
+ void ReadAllL();
+
+ /**
+ * Reset all data
+ */
+ virtual void ResetData();
+
+ /**
+ * Creates data buffer
+ *
+ * @param aBufferSize data buffer size
+ */
+ void CreateDataBufferL(TInt aBufferSize);
+
+
+protected: // New methods
+
+ /**
+ * Prepare whatever is necessary for reading
+ */
+ virtual void PrepareReadL();
+
+protected:
+ CMMASourceStreamEvent* iReadEvent;
+ MMMAEventPoster* iEventPoster;
+ MMMASourceStreamListener* iListener;
+
+protected:
+ /**
+ * Buffer where data from java side will be read, Owned
+ */
+ HBufC8* iData;
+
+ /**
+ * number of bytes coming from java stream, KMMAReadAllData is whole stream
+ */
+ TInt iReadLength;
+
+ /**
+ * current position
+ */
+ TInt iBufferPosition;
+};
+
+#endif // CMMASOURCESTREAM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmasourcestreamevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+#ifndef CMMASOURCESTREAMEVENT_H
+#define CMMASOURCESTREAMEVENT_H
+
+// INCLUDES
+#include "cmmaevent.h"
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMASourceStreamEvent): public CMMAEvent
+{
+public:
+ CMMASourceStreamEvent(jmethodID aHandleEventMethod,
+ jobject aNotifyObject);
+
+ // length of the requested source stream data
+ void SetLength(TInt aLength);
+
+private: // from CJavaEvent
+ void Dispatch(JNIEnv& aJni);
+
+private:
+ jmethodID iHandleEventMethod;
+ jobject iListenerObject;
+ TInt iLength;
+};
+
+#endif // CMMASOURCESTREAMEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmastoptimecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling
+*
+*/
+
+
+#ifndef CMMASTOPTIMECONTROL_H
+#define CMMASTOPTIMECONTROL_H
+
+// INCLUDES
+#include "cmmacontrol.h"
+#include "mmmaplayerstatelistener.h"
+
+class CMMAPlayer;
+
+// CLASS DECLARATION
+/**
+* This class is used for stoptime controlling
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAStopTimeControl): public CMMAControl, MMMAPlayerStateListener
+{
+protected:
+ /**
+ * Protected class for timing.
+ */
+ class CStopTimer : public CTimer
+ {
+ public:
+ static CStopTimer* NewL(CMMAStopTimeControl* aControl);
+
+ private:
+ CStopTimer(CMMAStopTimeControl* aControl);
+ void ConstructL();
+
+ public: // From CTimer
+ void RunL();
+
+ protected:
+ CMMAStopTimeControl* iControl;
+ };
+
+public:
+ static CMMAStopTimeControl* NewL(CMMAPlayer* aPlayer);
+ ~CMMAStopTimeControl();
+
+protected:
+ CMMAStopTimeControl(CMMAPlayer* aPlayer);
+ void ConstructL();
+
+public: // new methods
+ static void StaticGetStopTime(CMMAStopTimeControl* aControl,
+ TInt64* aTime);
+ static void StaticSetStopTimeL(CMMAStopTimeControl* aControl,
+ TInt64* aTime);
+ virtual void StopAtTimeL();
+
+protected:
+ virtual void GetStopTime(TInt64& aTime);
+ virtual void SetStopTimeL(const TInt64& aTime);
+ virtual void StartTimer(const TInt64& aTime);
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+public: // From MMMAPlayerStateListener
+ void StateChanged(TInt aState);
+
+protected:
+ CMMAPlayer* iPlayer;
+ TInt64 iStopTime; // Stop time in microseconds
+ const TInt64 iNoTimer;
+
+private:
+ CStopTimer* iTimer;
+
+};
+
+#endif // CMMASTOPTIMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a VideoControl.
+*
+*/
+
+
+#ifndef CMMAVIDEOCONTROL_H
+#define CMMAVIDEOCONTROL_H
+
+// INCLUDES
+#include "cmmacontrol.h"
+#include "mmmasnapshotreadycallback.h"
+
+// mobitv fix // 3.x QT based UI
+//#include "CMIDToolkit.h"
+//#include "lcdui.h"
+// FORWARD DECLARATIONS
+class MMIDComponent;
+class MMMAEventPoster;
+class MMMAGuiPlayer;
+class MMMADisplay;
+class CMMASnapshot;
+class MMAFunctionServer;
+class CMMAEvent;
+
+// CLASS DECLARATION
+/**
+* This class is native side of the VideoControl java object.
+*
+*
+*/
+class CMMAVideoControl :
+ public CMMAControl,
+ public MMMASnapshotReadyCallback/*, // 3.x QT based UI
+ public MMIDEnvObserver*/
+{
+public:
+ /**
+ * @param aGuiPlayer Player that will be used.
+ */
+ IMPORT_C CMMAVideoControl(MMMAGuiPlayer* aGuiPlayer);
+
+ /**
+ * Deletes owned objects and removes global reference to
+ * associated displayable object.
+ */
+ IMPORT_C ~CMMAVideoControl();
+
+ /**
+ * Finishes video control construction. This construction step
+ * must be called from JNI, because JNIEnv is needed to create
+ * callback methods to Java side.
+ *
+ * @param aVideoControl Used video control.
+ * @param aControlObject Corresponding Java object.
+ * @param aJni JNI environment used.
+ * @param aEventPoster Used to post repaint and
+ * snapshot ready events.
+ */
+ static void ConstructL(CMMAVideoControl* aVideoControl,
+ jobject aControlObject,
+ MMAFunctionServer* aEventSource,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster/*,
+ CMIDToolkit* aToolkit*/); // mobitv fix // 3.x QT based UI
+
+public: // New methods
+ /**
+ * Initializes display. Called when java display mode is initialized.
+ * Created MMMADisplay object and sets it to associated gui player.
+ *
+ * @param aVideoControl Used video control.
+ * @param aComponent Component that will be used to create display.
+ * @param aDisplayHandle Java handle to created display will be set to
+ * this variable. Still owned by video control.
+ * @param aDeleteRefEvent Event posted in the destructor.
+ */
+ static void StaticInitL(CMMAVideoControl* aVideoControl,
+ jobject javaDisplayObject,
+ MMAFunctionServer* aEventSource,
+ TInt* aDisplayHandle,
+ CMMAEvent* aDeleteRefEvent);
+
+ /**
+ * Dynamic display mode initialization.
+ * @see StaticInitL
+ * @param aVideoControl Used video control.
+ * @param aContentHandle Will contain handle to MMMADirectContent
+ * @param aDeleteRefEvent Event posted in the destructor.
+ */
+ static void StaticInitDynamicModeL(CMMAVideoControl* aVideoControl,
+ TInt* aContentHandle,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject,
+ CMMAEvent* aDeleteRefEvent);
+
+
+ /**
+ * Gets property according to property type.
+ *
+ * @param aControl Used video control.
+ * @param aPropertyType Type defined in Java header.
+ * @param aReturnValue Property value will be set to this parameter.
+ */
+ static void StaticGetPropertyL(CMMAVideoControl* aControl,
+ TInt aPropertyType,
+ TInt* aReturnValue);
+
+ /**
+ * Sets property that is defined by type. Amount of propery
+ * parameters used depends on property type.
+ *
+ * @param aControl Used video control.
+ * @param aPropertyType Type defined in Java header.
+ * @param aPropertyA First value.
+ * @param aPropertyB Second value.
+ */
+ static void StaticSetPropertyL(CMMAVideoControl* aControl,
+ TInt aPropertyType,
+ TInt aPropertyA,
+ TInt aPropertyB);
+
+ /**
+ * Takes snapshot from the associated gui player. When ready
+ * Java side will be informed with iSnapshotReadyMethod.
+ *
+ * @param aControl Used video control.
+ * @param aProperties Properties used to create snapshot.
+ */
+ static void TakeSnapShotL(CMMAVideoControl* aControl,
+ const TDesC* aProperties);
+ static void StaticSetForegroundL(CMMAVideoControl* aControl,
+ TInt aForeground) ;
+
+public: // From MMMASnapshotReadyCallback
+ IMPORT_C void SnapshotReady();
+
+public: // From CMMAControl
+ IMPORT_C const TDesC& ClassName() const;
+public:
+ TBool IsForeground();
+ void SetDisplayHandleToJavaPeer(MMAFunctionServer* eventSource ,jobject javaVideoControlPeer);
+
+protected:
+ // 3.x QT based UI
+ // void RegisterForegroundListenerL(CMIDToolkit* aToolkit); // mobitv fix
+
+//public: // from MMIDEnvObserver
+
+ // void HandleSwitchOnL(TBool /*aSwitchOn*/);
+
+ //Handles the case when the MIDlet is brought to the foreground.
+ // void HandleForegroundL(TBool /*aForeground*/);
+
+ // Handles a change to resources which are shared accross the environment.
+// void HandleResourceChangeL(TInt /*aType*/);
+
+private:
+
+ void SetForeground(TBool aForeground, TBool aUseEventServer);
+
+protected:
+ /**
+ * Not owned.
+ */
+ MMMAEventPoster* iEventPoster;
+
+ /**
+ * Not owned.
+ */
+ MMMAGuiPlayer* iGuiPlayer;
+
+ /**
+ * Not owned.
+ */
+ JNIEnv* iJni;
+
+ /**
+ * Owned object. Used to control displayable object.
+ */
+ MMMADisplay* iDisplay;
+
+ /**
+ * Owned object. Created when snapshot is taken and destroyed
+ * when snapshot is ready. Destroyed also in destuctor if control is
+ * destroyed when taking snapshot.
+ */
+ CMMASnapshot* iSnapshot;
+
+ /**
+ * Java video control object.
+ */
+ jobject iListenerObject;
+
+ /**
+ * Used inform Java side when snapshot is ready or error occures.
+ */
+ jmethodID iSnapshotReadyMethod;
+
+ /**
+ * Owned object. Not created by the class.
+ * Event is used to destroy reference to associated displayable object,
+ * when video control is destroyed.
+ */
+ CMMAEvent* iDeleteRefEvent;
+
+ /**
+ * When video display is set to full screen mode, old
+ * video position & size is stored to this member. When
+ * full screen mode is turned off, this member is used to
+ * find out if display size has been changed during full
+ * screen mode. This is needed to generate a SIZE_CHANGED
+ * event.
+ */
+ TSize iOldDisplaySize;
+ // mobitv fix
+ //CMIDToolkit* iToolkit;
+ // MMIDEnv* iMidEnv;
+ TBool iIsForeground;
+
+};
+
+#endif // CMMAVIDEOCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideoframepositioningcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements FramePositioningControl for video player
+*
+*/
+
+
+#ifndef CMMAVIDEOFRAMEPOSITIONINGCONTROL_H
+#define CMMAVIDEOFRAMEPOSITIONINGCONTROL_H
+
+// INTERNAL INCLUDES
+#include "cmmavideoplayer.h"
+#include "cmmaframepositioningcontrol.h" // base class
+
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+* This class implements FramePositioningControl for video player
+*/
+NONSHARABLE_CLASS(CMMAVideoFramePositioningControl) :
+ public CMMAFramePositioningControl
+{
+public:
+ static CMMAVideoFramePositioningControl* NewL(CMMAVideoPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMAVideoFramePositioningControl();
+
+protected:
+ /**
+ * Constructor.
+ */
+ CMMAVideoFramePositioningControl(CMMAVideoPlayer* aPlayer);
+
+public: // From CMMAFramePositioningControl
+ TInt SeekL(TInt aFrameNumber);
+ TInt SkipL(TInt aFramesToSkip);
+ void MapFrameToTimeL(TInt aFrameNumber, TInt64* aMediaTime);
+ TInt MapTimeToFrameL(TInt64* aMediaTime);
+
+private: // New methods
+ /**
+ * Get framerate of video and check that it is > 0 .
+ */
+ void GetAndCheckFrameRateL(TReal32& aFrameRate);
+
+private:
+ CMMAVideoPlayer* iPlayer;
+
+};
+
+
+#endif // CMMAVIDEOFRAMEPOSITIONINGCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideoplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating video player.
+*
+*/
+
+
+#ifndef CMMAVIDEOPLAYERFACTORY_H
+#define CMMAVIDEOPLAYERFACTORY_H
+
+// INCLUDES
+#include "cmmammfplayerfactory.h"
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+* This class is used for creating video player.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAVideoPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAVideoPlayerFactory* NewLC();
+ ~CMMAVideoPlayerFactory();
+
+private: // Constructor
+ CMMAVideoPlayerFactory();
+
+public: // New methods
+
+#ifdef RD_JAVA_OMA_DRM_V2
+ CMMAPlayer* CreatePlayerWithFileL(const TDesC& aContentType,
+ const TDesC* aFileName);
+#endif // RD_JAVA_OMA_DRM_V2
+
+public: // From CMMAMMFPlayerFactory
+
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+
+
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+private: //data
+#ifdef RD_JAVA_OMA_DRM_V2
+ const TDesC* iFileName;
+#endif // RD_JAVA_OMA_DRM_V2
+};
+
+#endif // CMMAVIDEOPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideorecordcontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a RecordControl.
+*
+*/
+
+
+#ifndef CMMAVIDEORECORDCONTROL_H
+#define CMMAVIDEORECORDCONTROL_H
+
+// EXTERNAL INCLUDES
+#include <videorecorder.h>
+
+// INTERNAL INCLUDES
+#include "cmmarecordcontrol.h"
+#include "tmmaparametervalidator.h"
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+class CMMAPlayerProperties;
+class CMMAMMFResolver;
+
+// CLASS DECLARATION
+/**
+* This class implements RecordControl interface for camera player.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMAVideoRecordControl): public CMMARecordControl,
+ public MVideoRecorderUtilityObserver
+{
+
+public:
+ /**
+ * Creates new CMMAVideoRecordControl.
+ *
+ * @param aPlayer Player that controls the camera.
+ * @param aProperties Properties given in java player creation.
+ * @param aCameraHandle Handle to a camera, which is used as a source.
+ */
+ static CMMAVideoRecordControl* NewL(CMMAPlayer* aPlayer,
+ CMMAMMFResolver* aResolver,
+ const TMMAVideoSettings& aVideoSettings,
+ CMMAAudioSettings* aAudioSettings,
+ TInt aCameraHandle);
+protected:
+ CMMAVideoRecordControl(CMMAPlayer* aPlayer,
+ TInt aCameraHandle);
+ ~CMMAVideoRecordControl();
+
+ /**
+ * Initializes this control.
+ * @param aProperties Properties given in java player creation.
+ */
+ void ConstructL(RMMFControllerImplInfoArray& aRMMFControllerInfos,
+ const TMMAVideoSettings& aVideoSettings,
+ CMMAAudioSettings* aAudioSettings);
+
+public: // From CMMARecordControl
+ void InitializeL();
+ void DoStartRecordL();
+ void DoStopRecordL();
+ void DoResetL();
+ TInt SetRecordSizeLimitL(TInt aSize);
+
+public: // From MVideoRecorderUtilityObserver
+ /**
+ * Notification to the client that the opening of the video clip has completed,
+ * successfully, or otherwise
+ *
+ * @param "aError"
+ * The status of the video recorder after initialisation.
+ * This is either KErrNone if the open has completed successfully,
+ * or one of the system wide error codes
+ */
+ void MvruoOpenComplete(TInt aError);
+
+ /**
+ * Notification that video recorder is ready to begin recording. This callback
+ * is generated in response to a call to Prepare.
+ *
+ * @param "aError"
+ * This is either KErrNone if the video recorder has been prepared for
+ * recording successfully, or one of the system wide error codes
+ */
+ void MvruoPrepareComplete(TInt aError);
+
+ /**
+ * Notification that video recording has completed. This is not called if
+ * recording is explicitly stopped by calling Stop.
+ *
+ * @param "aError"
+ * This is either KErrNone if recording was completed successfully,
+ * or one of the system wide error codes
+ */
+ void MvruoRecordComplete(TInt aError);
+
+ /**
+ * General event notification from controller. These events are specified by
+ * the supplier of the controller
+ *
+ * @param "aEvent"
+ * The event sent by the controller
+ */
+ void MvruoEvent(const TMMFEvent& aEvent);
+
+private: // New methods
+
+ /**
+ * Actually sets record size limit
+ * Will set local member to KNoUserDefinedRecordSize (-1)
+ * @param aSize New record size limit
+ */
+ void DoSetRecordSizeLimitL(TInt aSize);
+
+private: // Data
+ TInt iCameraHandle; // camera that is used as an image source
+
+ // Actual recording utility, owned
+ CVideoRecorderUtility* iRecorder;
+
+ CActiveSchedulerWait* iActiveSchedulerWait;
+
+ /**
+ * Global error code, used for getting error codes from callbacks
+ */
+ TInt iError;
+
+ /**
+ * Record size limit, will be KNoUserDefinedRecordSize (-1) when
+ * user has not set limits
+ */
+ TInt iRecordSizeLimit;
+
+ TMMAVideoSettings iVideoSettings; // Video settings
+
+};
+
+
+#endif // CMMAVIDEORECORDCONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideourlplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing URL videos
+*
+*/
+
+
+#ifndef CMMAVIDEOURLPLAYER_H
+#define CMMAVIDEOURLPLAYER_H
+
+
+// INCLUDES
+#include "cmmavideoplayer.h"
+#include "mmmaguiplayer.h"
+#include <es_sock.h>
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+
+// CLASS DECLARATION
+/**
+* This class is used for playing video.
+*
+*
+*/
+
+class CMMAVideoUrlPlayer: public CMMAVideoPlayer
+{
+protected:
+ /**
+ * Protected abstract base class for url player delegates.
+ */
+ class CMMAVideoUrlPlayerDelegate : public CBase
+ {
+ public:
+ virtual ~CMMAVideoUrlPlayerDelegate();
+
+ protected:
+ /**
+ * C++ constructor
+ */
+ CMMAVideoUrlPlayerDelegate(CMMAVideoUrlPlayer& aPlayer);
+
+ public:
+ /**
+ * Handles StartL call for url player.
+ */
+ virtual void StartL() = 0;
+
+ /**
+ * Handles StopL call for url player.
+ *
+ * @param aPostEvent post event to Java side
+ */
+ virtual void StopL(TBool aPostEvent) = 0;
+
+ /**
+ * Gets media time for url player.
+ *
+ * @param aMediaTime When method returns parameter contains the media
+ * time.
+ */
+ virtual void GetMediaTime(TInt64* aMediaTime) = 0;
+
+ /**
+ * Handles events for url player.
+ *
+ * @param aEvent event type
+ */
+ virtual void HandleEvent(const TMMFEvent& aEvent) = 0;
+
+ protected: // data
+ CMMAVideoUrlPlayer& iPlayer;
+ };
+
+ /**
+ * Delegate class for non-live video streams
+ */
+ class CMMAVideoUrlPlayerClipStreamDelegate :
+ public CMMAVideoUrlPlayerDelegate
+ {
+ public:
+ CMMAVideoUrlPlayerClipStreamDelegate(CMMAVideoUrlPlayer& aPlayer);
+ virtual ~CMMAVideoUrlPlayerClipStreamDelegate();
+
+ public: // from CMMAVideoUrlPlayerDelegate
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void GetMediaTime(TInt64* aMediaTime);
+ void HandleEvent(const TMMFEvent& aEvent);
+ };
+
+ /**
+ * Delegate class for live video streams
+ */
+ class CMMAVideoUrlPlayerLiveStreamDelegate :
+ public CMMAVideoUrlPlayerDelegate
+ {
+ public:
+ static CMMAVideoUrlPlayerLiveStreamDelegate*
+ NewL(CMMAVideoUrlPlayer& aPlayer);
+
+ virtual ~CMMAVideoUrlPlayerLiveStreamDelegate();
+
+ protected:
+ CMMAVideoUrlPlayerLiveStreamDelegate(CMMAVideoUrlPlayer& aPlayer);
+ void ConstructL();
+
+ public: // from CMMAVideoUrlPlayerDelegate
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void GetMediaTime(TInt64* aMediaTime);
+ void HandleEvent(const TMMFEvent& aEvent);
+
+ private: // data
+ CActiveSchedulerWait* iActiveSchedulerWait;
+
+ /**
+ * RTSP live stream returns current media time
+ * from the server, but local media time must
+ * start from zero. Thus start media time is
+ * cached here.
+ */
+ TInt64 iMediaStartTime;
+
+ /**
+ * Hold player stop time value. It is otherwise
+ * forgotten when player is stopped.
+ */
+ TInt64 iStoppedAtTime;
+ };
+
+public: // Construction
+ static CMMAVideoUrlPlayer* NewLC(
+ CMMAMMFResolver* aResolver,
+ const TDesC& aUrl);
+
+ // Destructor
+ IMPORT_C ~CMMAVideoUrlPlayer();
+
+protected:
+ // C++ constructor
+ IMPORT_C CMMAVideoUrlPlayer(CMMAMMFResolver* aResolver);
+ IMPORT_C void ConstructL(const TDesC& aUrl);
+
+public: // from CMMAPlayer
+ IMPORT_C void RealizeL();
+ IMPORT_C void PrefetchL();
+ IMPORT_C void StartL();
+ IMPORT_C void StopL(TBool aPostEvent);
+ IMPORT_C void GetMediaTime(TInt64* aMediaTime);
+ IMPORT_C void DeallocateL();
+ IMPORT_C void CloseL();
+
+protected: // New Methods
+ void FindActiveIap(const TUint aConnectionCount, TUint& aActiveIap);
+ virtual TBool IsLiveStreamL();
+
+ /**
+ * Handles events from delegate classes to
+ * superclass HandleEvent.
+ *
+ * @param aEvent event data
+ */
+ void HandleEventToParent(const TMMFEvent& aEvent);
+
+protected: // From CMMAVideoPlayer
+ IMPORT_C void HandleEvent(const TMMFEvent& aEvent);
+
+protected: // Data
+ HBufC* iUrl; // Owned url
+ RConnection iConnection;
+ RSocketServ iSocketServ;
+ TThreadPriority iOrigPriority;
+ CMMAVideoUrlPlayerDelegate* iPlayerDelegate;
+};
+
+#endif // CMMAVIDEOURLPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavideourlplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating video player.
+*
+*/
+
+
+#ifndef CMMAVIDEOURLPLAYERFACTORY_H
+#define CMMAVIDEOURLPLAYERFACTORY_H
+
+// INCLUDES
+#include "cmmammfplayerfactory.h"
+// CONSTANTS
+
+
+// CLASS DECLARATION
+/**
+* This class is used for creating URL video players
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAVideoUrlPlayerFactory): public CMMAMMFPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMAVideoUrlPlayerFactory* NewLC();
+ ~CMMAVideoUrlPlayerFactory();
+
+private: // Constructor
+ CMMAVideoUrlPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+public: // From CMMAMMFPlayerFactory
+ CMMAPlayer* CreatePlayerL(
+ CMMAMMFResolver* aResolver);
+
+
+ void MediaIdsL(RArray<TUid>& aMediaIds);
+
+ CMMFPluginSelectionParameters::TMediaIdMatchType
+ MediaIdMatchType();
+
+private: // Data
+ HBufC* iUrl; // owned url
+};
+
+#endif // CMMAVIDEOURLPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/cmmavolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for volume setting
+*
+*/
+
+
+#ifndef CMMAVOLUMECONTROL_H
+#define CMMAVOLUMECONTROL_H
+
+// INCLUDES
+#include "cmmacontrol.h"
+#include "mmmaplayerstatelistener.h"
+
+// CONSTANS
+_LIT(KMMAVolumeControlName, "VolumeControl");
+const TInt KMMAVolumeMaxLevel = 100;
+
+class CMMAPlayer;
+
+// CLASS DECLARATION
+/**
+* This class is used for volume setting
+*
+*
+*/
+
+class CMMAVolumeControl : public CMMAControl,
+ public MMMAPlayerStateListener
+{
+public:
+ static void StaticSetLevelL(CMMAVolumeControl* aVolumeControl,
+ TInt aLevel);
+ static void StaticGetLevelL(CMMAVolumeControl* aVolumeControl,
+ TInt* aLevel);
+
+ ~CMMAVolumeControl();
+
+protected:
+ CMMAVolumeControl(CMMAPlayer* aPlayer);
+ void ConstructBaseL();
+
+ /**
+ * Sets the level to player.
+ * @param aLevel Sound level to set.
+ */
+ virtual void DoSetLevelL(TInt aLevel) = 0;
+
+ /**
+ * Get volume level from player.
+ * @return Current level.
+ */
+ virtual TInt DoGetLevelL() = 0;
+
+public: // From CMMAControl
+ const TDesC& ClassName() const;
+
+ /**
+ * Refresh volume control.
+ */
+ void RefreshControl();
+
+public: // From MMMAPlayerStateListener
+ void StateChanged(TInt aState);
+
+
+public: // New methods
+ /**
+ * Adds new volume level to volume control. Actual volume level will
+ * be calculated using all levels added to the control.
+ * @return Index for new level.
+ */
+ IMPORT_C TInt AddLevelL();
+
+ /**
+ * Sets new volume level for certain level index. After level is set
+ * new actual level is calculated and commited to player in derived
+ * class.
+ * @param aLevelIndex Level's index
+ * @param aVolumeLevel New volume level for level index. Level must be
+ * between 0 and 100.
+ */
+ IMPORT_C void SetVolumeLevelL(TInt aLevelIndex,
+ TInt aVolumeLevel);
+ void GetVolumeLevelL(TInt aLevelIndex,
+ TInt* aVolumeLevel);
+
+
+
+private: // New methods
+
+ /**
+ * Refresh volume level, basically set the volume level again.
+ */
+ void RefreshVolume();
+
+ /**
+ * Sets level if player is started and sends java event level
+ * changed.
+ * @param aLevel Sound level to set.
+ */
+ void SetLevelL(TInt aLevel);
+
+ /**
+ * Calculates new overall level using all values in iLevels array.
+ * @return Current level.
+ */
+ TInt CalculateLevel();
+protected: // data
+ CMMAPlayer* iPlayer;
+
+ // Previous level setted to player. Used to check if level is changed.
+ TInt iLevel;
+
+ // Array containing all levels.
+ RArray< TInt > iLevels;
+
+};
+
+#endif // CMMAVOLUMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmafunctionserver.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class provides CJavaEventSource services
+*
+*/
+
+
+#ifndef CMMAEVENTSOURCE_H
+#define CMMAEVENTSOURCE_H
+
+// INCLUDES
+#include "mmmaeventposter.h"
+//#include <jutils.h>
+#include "functionserver.h"
+#include "legacyeventserverwrapper.h"
+#include <logger.h>
+// FORWARD DECLARATIONS
+class CApaWindowGroupName;
+class CMMAPlayer;
+class MMMAPlayerInstanceObserver;
+#ifdef RD_JAVA_VOLUME_CONTROL
+class CMMAGlobalVolume;
+#endif // RD_JAVA_VOLUME_CONTROL
+
+// CLASS DECLARATION
+/**
+* This class provides CJavaEventSource services.
+*
+*
+*/
+
+class MMAFunctionServer : public java::util::FunctionServer,public LegacyEventServerWrapper,
+ public MMMAEventPoster
+{
+public:
+ /**
+ * Default constructor.
+ */
+ MMAFunctionServer(JNIEnv& aJni, jobject aPeer);
+
+ /**
+ * Destructor.
+ */
+ ~MMAFunctionServer();
+
+public: // From CJavaEventSource, construction
+ /**
+ * Normal construction, Invoked from base class.
+ * Method is defined in the base class.
+ */
+ void ConstructL(JNIEnv& aJni,
+ jobject aPeer
+ );
+
+ /**
+ * Server side construction.
+ */
+ void ConstructSvrL();
+ static TInt NewL(JNIEnv& aJni, jobject aPeer);
+
+ void Dispose();
+
+ TBool IsDisposed() const
+ {
+ return iDisposed;
+ }
+
+public: // new methods
+ /**
+ * Adds object to cleanup. Added objects are deleted when event source
+ * is deleted.
+ *
+ * @param aEventSource Event source to use.
+ * @param aHandle Java handle to CBase object
+ */
+ IMPORT_C static void StaticAddObjectFromHandleL(MMAFunctionServer* aEventSource,
+ TInt aHandle);
+
+ /**
+ * Adds player object to cleanup. Added objects are deleted when event
+ * source is deleted. An object added to the event source must be
+ * deleted with DisposePlayer method.
+ *
+ * @param aEventSource Event source to use.
+ * @param aHandle Java handle to CBase object
+ */
+ void AddPlayerL(CMMAPlayer* aPlayer);
+
+ /**
+ * Removes player from array and deletes it.
+ *
+ * @param aPlayer Player to be deleted.
+ */
+ void DisposePlayer(CMMAPlayer* aPlayer);
+
+ /**
+ * Sets player instance observer.
+ * @param aObserver Will be informed when player is created or deleted.
+ */
+ IMPORT_C void SetPlayerInstanceObserver(MMMAPlayerInstanceObserver* aObserver);
+
+ /**
+ * Return reference to the array containing all players.
+ * @return All players
+ */
+ IMPORT_C RPointerArray< CMMAPlayer >& Players();
+
+ /**
+ * Realeases resources.
+ */
+ void Release();
+
+ /**
+ * Returns player pointer for java player handle if the native player
+ * peer exists. Otherwise returns null.
+ * @param aPlayerHandle Java side player handle integer
+ * @param CMMAPlayer* player pointer
+ */
+ CMMAPlayer* FindPlayer(TInt aPlayerHandle);
+
+ /**
+ * Sets MMA global volume handler
+ * @param aGlobalVolume Global volume handler. The onwership is
+ * transferred to this class
+ */
+#ifdef RD_JAVA_VOLUME_CONTROL
+ void SetGlobalVolume(CMMAGlobalVolume* aGlobalVolume);
+#endif // RD_JAVA_VOLUME_CONTROL
+
+ java::util::FunctionServer* getFunctionServer() const;
+
+ JNIEnv* getValidJniEnv();
+ jobject getPeer();
+private:
+ /**
+ * @see StaticAddObjectFromHandleL
+ * @param aHandle Java handle to CBase object
+ */
+ void AddObjectFromHandleL(TInt aHandle);
+
+private: // from CJavaEventSource
+ void FinalizeSvr();
+
+public: // MMMAEventPoster
+ void PostEvent(CMMAEvent* aEvent, TInt aPriority);
+
+private:
+ bool mVmAttached;
+ java::util::FunctionServer* iServer;
+private:
+ /**
+ * Objects added with StaticAddObjectFromHandleL. Will be destroyed
+ * in server finalization.
+ */
+ RPointerArray< CBase > iObjects;
+
+ // Owned array of players.
+ RPointerArray< CMMAPlayer > iPlayers;
+
+ /**
+ * MMA needs ui framework. Window group must be hidden from the
+ * user.
+ */
+ CApaWindowGroupName* iWgName;
+
+ /**
+ * Used to check if session was connected in the constructor.
+ */
+ TBool iFbsSessionConnected;
+ TBool iDisposed;
+
+ // Not owned. Will be informed if it is set.
+ MMMAPlayerInstanceObserver* iInstanceObserver;
+
+ JavaVM* iJavaVM;
+
+ // Global volume handler. Owned
+#ifdef RD_JAVA_VOLUME_CONTROL
+ CMMAGlobalVolume* iGlobalVolume;
+#endif // RD_JAVA_VOLUME_CONTROL
+};
+
+#endif // CMMAEVENTSOURCE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmacontainer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef MMMACONTAINER_H
+#define MMMACONTAINER_H
+
+class MMMADirectContent;
+class MUiEventConsumer;
+
+/**
+A container on which content can be displayed.
+Content can be drawn to container using direct screen access or frame buffer
+mode.
+*/
+class MMMAContainer
+{
+public:
+ /**
+ Remove the content. This will called when the Player is closed.
+ */
+ virtual void MdcRemoveContent() = 0;
+
+ /**
+ Get the visiblity of the container. The content must not be displayed
+ when it's container is invisible.
+ If this changes MdcContainerVisibilityChanged should be called.
+ @returns "aVisible" ETrue if the container is visible, EFalse if it is invisible.
+ */
+ virtual TBool MdcContainerVisibility() const = 0;
+
+ /**
+ Repaint frame buffer to screen.
+ */
+ virtual void MdcRepaint() const = 0;
+
+ /**
+ Get the bounds of the area that the content can occupy.
+ The content should be clipped to this area.
+ @param aContentRect Maximum area the content can occupy in screen co-ordinates.
+ @param aParentRect Visible part of the parent in screen co-ordinates.
+ */
+ virtual void MdcGetContentRect(TRect& aControlRect,
+ TRect& aParentRect) const = 0;
+
+ /**
+ This method is called when content knows its preferred size. This method
+ will be called for example when video content obtains its size. Container
+ must inform new content rect using content's MdcContentBoundsChanged method.
+ @param aPreferredSize preferred size for the content.
+ */
+ virtual void MdcInvalidate(const TSize& aPreferredSize) = 0;
+
+ /**
+ Set the size of the render region for the video clip to be fullscreen.
+ After this call MESWTDirectContent must be informed about new draw area.
+ @param aFullScreen Indicates whether or not to render in full screen mode
+ */
+ virtual void MdcSetDisplayFullScreen(TBool aFullScreen) = 0;
+
+ /**
+ * Invokes callback aConsumer->MdcDSAResourcesCallback in UI thread.
+ * Used in case when MMAPI needs to start DSA within UI thread.
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aIsInUiThread" Notifies that the method runs in UI thread
+ */
+ virtual void MdcGetDSAResources(
+ MUiEventConsumer& aConsumer,
+ TBool aIsInUiThread) = 0;
+
+ /**
+ * Invokes callback aConsumer->MdcUICallback in UI thread.
+ * Used in case when MMAPI needs to run some operation within UI thread.
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aCallbackId" A number identifying the callback
+ */
+ virtual void MdcGetUICallback(
+ MUiEventConsumer& aConsumer,
+ const TInt aCallbackId) = 0;
+
+ /**
+ * Get the bounds of the content window.
+ *
+ * @returns The rect of the content window in screen co-ordinates.
+ */
+ virtual TRect MdcContainerWindowRect() const = 0;
+};
+
+
+#endif // MMMACONTAINER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmadirectcontent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef MMMADIRECTCONTENT_H
+#define MMMADIRECTCONTENT_H
+
+class MMMAContainer;
+
+/**
+ * Content, such as a video clip or camera view finder, which is displayed on
+ * a container.
+ */
+class MMMADirectContent
+{
+public:
+ /**
+ * Notify content that container visiblity has changed. The content must not
+ * be displayed when it's container is invisible.
+ * @param "aVisible" ETrue if the container is visible, EFalse if it is invisible.
+ */
+ virtual void MdcContainerVisibilityChanged(TBool aVisible) = 0;
+
+ /**
+ * Notify content that content rect is changed.
+ * @param aContentRect Maximum area the content can occupy in screen
+ * co-ordinates.
+ * @param aParentRect area that can be used to draw content in screen
+ * co-ordinates.
+ */
+ virtual void MdcContentRectChanged(const TRect& aContentRect,
+ const TRect& aParentRect) = 0;
+
+ /**
+ * Notify content that container is about to be destoryed.
+ */
+ virtual void MdcContainerDestroyed() = 0;
+
+ /**
+ * Sets new container for content. Content may not support changing
+ * container.
+ * @parma aContainer New container for content
+ */
+ virtual void MdcSetContainer(MMMAContainer* aContainer) = 0;
+
+ /**
+ * This is used in bitmap mode. DSA mode content return allways NULL.
+ * @return Bitmap to draw or NULL if not available.
+ */
+ virtual CFbsBitmap* MdcFrameBuffer() const = 0;
+
+ /**
+ * This is used get preferred size when container need content size
+ * @return source size which preferred size for container
+ */
+ virtual TSize MdcSourceSize() = 0;
+
+ /**
+ * Notify content that the rect of a window has changed.
+ *
+ * @param aRect New rect of a window.
+ */
+ virtual void MdcContainerWindowRectChanged(const TRect& aRect) = 0;
+};
+
+#endif // MMMADIRECTCONTENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplay.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for displays, which can show images.
+*
+*/
+
+
+#ifndef MMMADISPLAY_H
+#define MMMADISPLAY_H
+
+#include "jni.h"
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class MMMADisplayWindow;
+class MUiEventConsumer;
+class MMMAGuiPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+
+ Interface for displays, which can show images. Display properties
+ can be changed through this interface.
+
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(MMMADisplay)
+{
+public:
+ /**
+ * Describes the currently running thread type.
+ */
+ enum TThreadType
+ {
+ EMmaThread = 0, // MMAPI thread
+ EUiThread = 1 // UI thread (LCDUI or ESWT)
+ };
+
+ /**
+ * Display can be deleted through this interface.
+ */
+ virtual ~MMMADisplay()
+ {
+ };
+
+ /**
+ * Draws bitmap. Implementation may ignore <code>aBitmap</code>
+ * parameter and implements own drawing procedure. This method must also redraw
+ * the display if needed.
+ *
+ * @param aBitmap Bitmap to be drawn.
+ */
+ virtual void DrawFrameL(const CFbsBitmap* aBitmap) = 0;
+
+ /**
+ * Getter for display's size.
+ *
+ * @return Display size.
+ */
+ virtual TSize DisplaySize() = 0;
+
+ /**
+ * Sets display size or leaves if not supported or
+ * size cannot be changed.
+ *
+ * @param aSize New size for the display.
+ */
+ virtual void SetDisplaySizeL(const TSize& aSize) = 0;
+
+ /**
+ * Sets display location.
+ *
+ * @param aPosition New position for the display.
+ */
+ virtual void SetDisplayLocationL(const TPoint& aPosition) = 0;
+
+ /**
+ * Returns position where display is drawn.
+ *
+ * @return Display location.
+ */
+ virtual TPoint DisplayLocation() = 0;
+
+ /**
+ * Sets display fullscreen mode on/off.
+ *
+ * @param aFullScreen Fullscreen mode.
+ */
+ virtual void SetFullScreenL(TBool aFullScreen) = 0;
+
+ /**
+ * Sets display visible or hides it.
+ *
+ * @param aVisible ETrue if display is visible,
+ * EFalse if display is invisible.
+ */
+ virtual void SetVisible(TBool aVisible) = 0;
+
+ /**
+ * Called when source size is changed. This is also called when
+ * source size is available for the first time.
+ *
+ * @param aSourceSize New content's size.
+ */
+ virtual void SourceSizeChanged(const TSize& aSourceSize) = 0;
+
+ virtual TSize SourceSize() = 0;
+
+ virtual void SetUIPlayer(MMMAGuiPlayer* player) = 0;
+ /**
+ * Sets display's window. Ownership is not transfered.
+ *
+ * @param aWindow New window used for drawing.
+ **/
+ virtual void SetWindowL(MMMADisplayWindow* aWindow) = 0;
+
+ /**
+ * Getter for window.
+ *
+ * @return Display's window or NULL if not set.
+ */
+ virtual MMMADisplayWindow* Window() = 0;
+
+ /**
+ * Returns visibility of the display.
+ *
+ * @return ETrue if display is visible,
+ * EFalse if display is invisible.
+ */
+ virtual TBool IsVisible() = 0;
+
+ /**
+ * Returns fullscreen state of the display.
+ *
+ * @return ETrue if display is fullscreen,
+ * EFalse if display is not fullscreen.
+ */
+ virtual TBool IsFullScreen() = 0;
+ /**
+ *Sets the foreground state of the midlet
+ *
+ * @param ETrue if midlet is in foreground,
+ * EFalse if midlet is in background
+ */
+ virtual void SetForeground(TBool aForeground, TBool aUseEventServer) = 0;
+
+ /**
+ * Gets notification that there is container to draw assigned
+ *
+ * @return ETrue if container have been set
+ * EFalse if container is not set
+ */
+ virtual TBool HasContainer() = 0;
+
+ /**
+ * Gets resources necessary to start DirectScreenAccess
+ * Doesn't run in mmapi event server thread!
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aThreadType" Indicates the thread type (UI or MMAPI)
+ */
+ /* virtual void UIGetDSAResources(
+ MUiEventConsumer& aConsumer,
+ TThreadType aThreadType) = 0;
+*/
+ /**
+ * Invokes a callback in UI thread
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aCallbackId" A number identifying the callback
+ */
+ /* virtual void UIGetCallback(
+ MUiEventConsumer& aConsumer,
+ TInt aCallbackId) = 0;
+ */
+
+ /**
+ * Trigger a function call CalledBackInUiThread() from java in UI thread
+ * arg 'placeholder' is used to identify the function, to be called back from UI Thread
+ */
+ virtual void GetCallbackInUiThread(TInt placeholder) = 0;
+
+ /**
+ * Called from java in UI thread context
+ * arg 'placeholder' is used to identify the function, to be called back from UI Thread
+ */
+ virtual void CalledBackInUiThread(TInt placeholder) = 0;
+};
+
+#endif // MMMADISPLAY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for windows.
+*
+*/
+
+
+#ifndef MMMADISPLAYWINDOW_H
+#define MMMADISPLAYWINDOW_H
+
+
+#include "mmmadisplay.h"
+#include "qwidget.h"
+#include "COECNTRL.h"
+#include "COEMAIN.h"
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CMMAPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+
+ Abstract base class for windows.
+
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(MMMADisplayWindow)
+{
+public:
+
+ enum TDisplayWindowType
+ {
+ EDisplayWindowTypeNotSet = -1,
+ EDisplayWindowTypeIsDSA,
+ EDisplayWindowTypeIsBitmap,
+ EDisplayWindowTypeIsCamera,
+ };
+
+ /**
+ * Can be deleted through this interface.
+ */
+ virtual ~MMMADisplayWindow()
+ {
+ };
+
+ /**
+ * Sets destination bitmap for <code>DrawFrameL</code> method
+ *
+ * @param aBitmap destination Bitmap where DrawFrameL draws.
+ */
+ virtual void SetDestinationBitmapL(CFbsBitmap* aBitmap) = 0;
+
+ /**
+ * Draws bitmap to the rect set with <code>SetDrawRectL</code>
+ * method. Bitmap may be scaled to fill whole rect. Implementation
+ * may ignore <code>aBitmap</code> parameter and implements own
+ * drawing procedure.
+ *
+ * @param aBitmap Bitmap to be drawn.
+ */
+ virtual void DrawFrameL(const CFbsBitmap* aBitmap) = 0;
+
+ /**
+ * Sets drawing area which is used in <code>DrawFrameL</code> method.
+ *
+ * THE CALL CANNOT ORIGINATE FROM UI THREAD.
+ * (including the call via MMA event server)
+ *
+ * use SetDrawRectThread when in UI thread
+ *
+ * @param aRect New drawing area.
+ */
+ virtual void SetDrawRect(const TRect& aRect) = 0;
+
+ /**
+ * Calls SetDrawRect method through event source. This method must
+ * be called instead of SetDrawRect if not executing in MMA
+ * thread.
+ *
+ * THE CALL CANNOT ORIGINATE FROM MMA THREAD.
+ * (including the call via UI event server)
+ *
+ * @param aRect New drawing area.
+ */
+ virtual void SetDrawRectThread(const TRect& aRect) = 0;
+
+ /**
+ * Sets drawing position which is used in <code>DrawFrameL</code> method.
+ *
+ * @param aPosition New drawing position.
+ */
+ virtual void SetPosition(const TPoint& aPosition) = 0;
+
+ /**
+ * Sets window visible or invisible. This method can be called from
+ * MMA event server thread or from other context. aUseEventServer
+ * must be set to EFalse if caller is already in MMA event server.
+ *
+ * @param aVisible visiblity
+ * @param aUseEventServer Indicates if method must called through event
+ * server.
+ */
+ virtual void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue) = 0;
+
+ /**
+ * Returns rect which is used for drawing frames.
+ *
+ * @return Drawing area
+ */
+ virtual const TRect& DrawRect() = 0;
+
+ /**
+ * Returns whole window's size.
+ *
+ * @return Size of the window.
+ */
+ virtual TSize WindowSize() = 0;
+
+ /**
+ * Sets window size.
+ *
+ * @param aRect Windows size.
+ */
+ virtual void SetWindowRect(const TRect& aRect, MMMADisplay::TThreadType aThreadType) = 0;
+
+ /**
+ * Gets window rect.
+ *
+ * @returns Windows rect.
+ */
+ virtual const TRect& WindowRect() = 0;
+
+ virtual CMMAPlayer* UiPlayer()
+ {
+ }
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ /**
+ * Sets Crop region. used only in CMMASurfaceWindow
+ *
+ * @since S60 v5.2
+ */
+ virtual void SetVideoCropRegion(const TRect& /*aRect*/)
+ {
+ // Empty
+ }
+
+ /**
+ * Sets RWindow rect. used only in CMMASurfaceWindow.
+ * can be called from either MMA ES thread context or
+ * UI thread context.
+ *
+ * @since S60 v5.2
+ */
+ virtual void SetRWindowRect(const TRect& /*aRect*/,
+ MMMADisplay::TThreadType /*aThreadType*/)
+ {
+ // Empty
+ }
+#endif
+
+ /**
+ *
+ */
+ virtual TDisplayWindowType GetDisplayWindowType() const
+ {
+ return EDisplayWindowTypeNotSet;
+ }
+
+ /**
+ * Gets window visible or invisible.
+ * @retrun ETrue if visible else EFalse. Default implementation always returns ETrue
+ */
+ virtual TBool IsVisible() const
+ {
+ return ETrue;
+ }
+
+ /**
+ * Informs window that container which is window drawn on
+ * is set from now. Implementation is now able to invoke
+ * any UI callbacks
+ *
+ * @since S60 v5.0
+ */
+ virtual void ContainerSet()
+ {
+ // Empty
+ }
+
+ /**
+ * Informs window that container which is window drawn on
+ * is going to be deleted. Implementation should abort any
+ * DirectScreenAccess and delete all the objects
+ * instantiated within UI thread.
+ * Called wihout mmapi event server directly from UI thread.
+ * By default it doesn't do anything.
+ *
+ * @since S60 v5.0
+ */
+ virtual void ContainerDestroyed()
+ {
+ // Empty
+ }
+
+ /**
+ * Notifies window that any drawing
+ * via direct screen access must be aborted
+ */
+ virtual void AbortDSA()
+ {
+ // default empty implementation
+ }
+
+ /**
+ * Allows window to draw
+ * via direct screen access after MdcAbortDSA
+ */
+ virtual void ResumeDSA()
+ {
+ // default empty implementation
+ }
+
+ /**
+ * gets window resources from QT
+ */
+ virtual void ProcureWindowResourcesFromQWidget(RWsSession * aWs,
+ CWsScreenDevice* aScreenDevice,
+ RWindowBase* aWindow)
+ {
+ // default empty implementation
+ }
+
+ virtual void UICallback( TInt aCallbackId )
+ {
+ }
+};
+
+#endif // MMMADISPLAYWINDOW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmaeventposter.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header is event poster
+*
+*/
+
+
+#ifndef MMMAEVENTPOSTER_H
+#define MMMAEVENTPOSTER_H
+
+// INCLUDES
+#include "cmmaevent.h"
+#include <jni.h>
+
+NONSHARABLE_CLASS(MMMAEventPoster)
+{
+public:
+ /**
+ * Posts event to the Java side.
+ *
+ * @param aEvent Event to be sent.
+ * @param aPriority Priority used to send the event.
+ */
+ virtual void PostEvent(CMMAEvent* aEvent,
+ TInt aPriority = CMMAEvent::EEventPriority) = 0;
+ virtual JNIEnv* getValidJniEnv() = 0;
+};
+
+
+#endif // MMMAEVENTPOSTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmaguiplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for players which shows picture.
+*
+*/
+
+
+#ifndef MMMAGUIPLAYER_H
+#define MMMAGUIPLAYER_H
+
+#include "cmmaplayerevent.h"
+
+// FORWARD DECLARATIONS
+class MMMADisplay;
+class CFbsBitmap;
+class MMMASnapshot;
+class MMAFunctionServer;
+class CMIDToolkit;
+
+// CLASS DEFINITION
+/**
+ Interface for players which shows picture. Player will be notified
+ throw this interface when display state is changed.
+*/
+NONSHARABLE_CLASS(MMMAGuiPlayer)
+{
+protected: // Constructors and destructors
+ /**
+ * Do not allow delete through this interface
+ */
+ virtual ~MMMAGuiPlayer() {};
+
+public: // Abstract methods
+ /**
+ * Sets display to the player. Player must likely will create window
+ * for the display. Called when display is available for the player.
+ *
+ * @param aDisplay Display which can be used.
+ */
+ virtual void SetDisplayL(MMMADisplay* aDisplay) = 0;
+
+ /**
+ * Returns size of the content. Content size may not available
+ * before player is initialized.
+ *
+ * @return Size of the source content.
+ */
+ virtual TSize SourceSize() = 0;
+
+ /**
+ * Returns inferface that is used for taking snapshots from the player.
+ * Method can leave if player creates a snapshoter object when this
+ * method is called.
+ *
+ * @return Interface for taking snaphots.
+ */
+ virtual MMMASnapshot* SnapshoterL() = 0;
+
+ /**
+ * Method sends event to the Java. This can be used to notify errors
+ * to the Java side.
+ *
+ * @param aEventType Type of the event.
+ * @param aStringEventData Data of the event.
+ */
+ virtual void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData) = 0;
+
+ // No data in MClass!!
+
+};
+
+#endif // MMMAGUIPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmamuteobserver.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for mute observers
+*
+*/
+
+#ifndef MMMAMUTEOBSERVER_H
+#define MMMAMUTEOBSERVER_H
+
+// CLASS DECLARATION
+/**
+* Interface for receiving mute notification from CMMAMuteNotifier.
+*
+*
+*/
+
+class MMMAMuteObserver
+{
+public:
+
+ /**
+ * Handles mute notification according to received parameter.
+ * @param aMuted true if mute should be on, false if not
+ */
+ virtual void HandleMuteNotification(TBool aMuted) = 0;
+
+};
+
+#endif // MMMAMUTEOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmaplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for all player factories.
+*
+*/
+
+
+#ifndef MMMAPLAYERFACTORY_H
+#define MMMAPLAYERFACTORY_H
+
+// INCLUDES
+#include <badesca.h> // CDesC16Array
+
+// CONSTANTS
+_LIT(KMMAHttpProtocol, "http");
+_LIT(KMMAHttpsProtocol, "https");
+_LIT(KMMAFileProtocol, "file");
+_LIT(KMMACaptureProtocol, "capture");
+_LIT(KMMADeviceProtocol, "device");
+
+// CLASS DEFINITION
+class CMMAPlayer;
+
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+ Interface for all player factories.
+
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(MMMAPlayerFactory)
+{
+public:
+
+ /**
+ * Allow delete through this interface.
+ */
+ virtual ~MMMAPlayerFactory() {};
+
+ /**
+ * Creates new player according to a content type.
+ *
+ * @param aContentType Player's content type.
+ * @return New instance of CMMAPlayer or null if factory cannot
+ * create it
+ */
+ virtual CMMAPlayer* CreatePlayerL(const TDesC& aContentType) = 0;
+
+ /**
+ * Creates new player according to a locator
+ *
+ * @param aProtocol protocol part from the locator.
+ * @param aMiddlePart middle part from the locator.
+ * @param aParameters parameters part from the locator.
+ * @return New instance of CMMAPlayer or null if factory cannot
+ * create it
+ */
+ virtual CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters) = 0;
+
+ /**
+ * Creates new player according to a header data
+ *
+ * @param aHeaderData Header data from the content
+ * @return New instance of CMMAPlayer or null if factory cannot
+ * create it
+ */
+ virtual CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData) = 0;
+
+ /**
+ * Gets player's supported content types.
+ *
+ * @param aProtocol The input protocol for the supported content types.
+ * @param aMimeTypeArray Will contain supported mime types for protocol.
+ */
+ virtual void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray) = 0;
+
+ /**
+ * Gets player's supported protocols for the content type.
+ *
+ * @param aContentType The content type for the supported protocols.
+ * @param aProtocolArray Will contain supported protocols for content type.
+ */
+ virtual void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray) = 0;
+};
+
+#endif // MMMAPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmaplayerinstanceobserver.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef MMMAPLAYERINSTANCEOBSERVER_H
+#define MMMAPLAYERINSTANCEOBSERVER_H
+
+// FORWARD DECLARATIONS
+class CMMAPlayer;
+
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+
+ Interface used to inform external components about player instances.
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(MMMAPlayerInstanceObserver)
+{
+public:
+ /**
+ * Adds new player to observer.
+ *
+ * @param aPlayer Player instance to add.
+ */
+ virtual void AddPlayerNotifyL(CMMAPlayer* aPlayer) = 0;
+
+ /**
+ * Removes player from observer.
+ *
+ * @param aPlayer Player instance to remove.
+ */
+ virtual void RemovePlayerNotify(CMMAPlayer* aPlayer) = 0;
+
+protected:
+ /**
+ * Deletion through this interface is not allowed.
+ */
+ virtual ~MMMAPlayerInstanceObserver() {};
+};
+
+#endif // MMMAPLAYERINSTANCEOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmaplayerstatelistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This interface is used for informing player state changes
+*
+*/
+
+
+#ifndef MMMAPLAYERSTATELISTENER_H
+#define MMMAPLAYERSTATELISTENER_H
+
+#include <e32def.h>
+
+// CLASS DEFINITION
+/**
+
+ This interface is used for informing player state changes
+
+*/
+NONSHARABLE_CLASS(MMMAPlayerStateListener)
+{
+public:
+ /**
+ * Called when player state is changed. Used states are defined in
+ * the player header file. Enumeration is not used to provide
+ * expandability.
+ *
+ * @param aState New state of the player.
+ */
+ virtual void StateChanged(TInt aState) = 0;
+
+protected: // Constructors and destructors
+ /**
+ * May not delete through this interface,
+ * because destructor is protected.
+ */
+ virtual ~MMMAPlayerStateListener()
+ {
+ };
+};
+
+
+#endif // MMMAPLAYERSTATELISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmasnapshot.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header is for shapshots.
+*
+*/
+
+
+#ifndef MMMASNAPSHOT_H
+#define MMMASNAPSHOT_H
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CMMAImageSettings;
+
+// CLASS DEFINITION
+/**
+
+*/
+
+NONSHARABLE_CLASS(MMMASnapshot)
+{
+public: // Type definitions
+ enum TEncoding
+ {
+ EBitmap = 0, // Raw image format
+ EEncoded // Encoded image format
+ };
+
+protected: // Constructors and destructors
+ virtual ~MMMASnapshot() {}; // Do not allow delete through this interface
+
+public: // Abstract methods
+ /**
+ * Takes snapshot.
+ *
+ * @param aStatus Status will be informed when
+ * bitmap is ready or error occures.
+ * @param aSize Snapshot size. If size is not specified (width=-1 or
+ * height=-1) default size is used.
+ * @return Returns snapshot image's encoding type based on the requested MIME-type and
+ * snapshot size. Returned encoding type may differ from the requested as
+ * raw bitmap type is used if possibly requested encoding type is not found.
+ */
+ virtual TEncoding TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings) = 0;
+
+ /**
+ * Returns snapshot image.
+ *
+ * @returns Snapshot bitmap or NULL if TakeSnapshotL is not called or it failed.
+ * Caller takes ownership of the bitmap.
+ */
+ virtual CFbsBitmap* SnapshotBitmap() = 0;
+
+ /**
+ * Returns encoded snapshot image
+ *
+ * @return Encoded snapshot image or NULL if TakeSnapshotL is not called or if it failed
+ * Caller takes ownership of the pointer.
+ */
+ virtual HBufC8* SnapshotEncoded() = 0;
+
+ // No data in MClass!!
+
+};
+
+#endif // MMMASNAPSHOT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmasnapshotreadycallback.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header is snapshot callback
+*
+*/
+
+
+#ifndef MMMASNAPSHOTREADYCALLBACK_H
+#define MMMASNAPSHOTREADYCALLBACK_H
+
+NONSHARABLE_CLASS(MMMASnapshotReadyCallback)
+{
+public:
+ /**
+ * Called when snapshot is ready. Error situations
+ * must be checked separately.
+ */
+ virtual void SnapshotReady() = 0;
+
+protected:
+ virtual ~MMMASnapshotReadyCallback()
+ {
+ };
+};
+
+#endif // MMMASNAPSHOTREADYCALLBACK_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/mmmasourcestreamlistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This interface is used for informing player that
+* CMMASourceStream is ready
+*
+*/
+
+
+#ifndef MMMASOURCESTREAMLISTENER_H
+#define MMMASOURCESTREAMLISTENER_H
+
+// CLASS DEFINITION
+/**
+
+ This interface is used for informing player that CMMASourceStream is ready
+
+*/
+NONSHARABLE_CLASS(MMMASourceStreamListener) // usually not derived
+{
+public: // New methods
+ /**
+ * This method will be called when source stream read operation
+ * is ready or error occures.
+ *
+ * @param aStatus Status of the reading operation or one of the system
+ * error codes.
+ * @param aData Reference to read data. If an error occured reference
+ * to zero length descriptor.
+ */
+ virtual void ReadCompletedL(TInt aStatus, const TDesC8& aData) = 0;
+
+protected: // Destructor
+ /**
+ * Do not allow delete trough this interface.
+ */
+ virtual ~MMMASourceStreamListener()
+ {
+ };
+};
+
+#endif // MMMASOURCESTREAMLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/rmmatempfile.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef RMMATEMPFILE_H
+#define RMMATEMPFILE_H
+
+// INCLUDES
+#include <f32file.h>
+#include <e32std.h>
+
+// CLASS DECLARATION
+/**
+* This is used to create and delete temporary files.
+*/
+NONSHARABLE_CLASS(RMMATempFile): public RSessionBase
+{
+public:
+ /**
+ * Default constructor.
+ */
+ RMMATempFile();
+
+ /**
+ * Connects to systemams server. This method must be called before
+ * other methods may be used.
+ */
+ void ConnectL();
+
+ /**
+ * Creates temp file to server. After this call reference to file can
+ * be obtained with File() method.
+ */
+ void CreateL();
+
+ /**
+ * Return reference to created file.
+ * @return Reference to created file object.
+ */
+ RFile& File();
+
+ /**
+ * Sets midlet suite. Used to create temp file folder in systemams
+ * server.
+ * @param aMIDletSuiteID midlet suite id
+ */
+ void SetMIDletSuiteID(TInt aMIDletSuiteID);
+
+ /**
+ * Closes server session and deletes temp file.
+ */
+ void Close();
+
+private:
+ // temp file's path
+ TFileName iFileName;
+
+ // file created in CreateL method.
+ RFile iFile;
+
+ // Handle to file.
+ TInt iFileHandle;
+
+ // midlet suite id
+ TInt iMidletSuiteID;
+};
+
+#endif // RMMATEMPFILE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for parsing and validating properties
+*
+*/
+
+
+#ifndef TMMAPARAMETERVALIDATOR_H
+#define TMMAPARAMETERVALIDATOR_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mmfutilities.h>
+#include <imageconversion.h>
+// STRUCTS
+
+/**
+ * These structs are used for storing settings
+ */
+
+// Default values for recorder
+const TInt KDefaultBits = -1;
+const TInt KDefaultRate = -1;
+const TInt KDefaultChannels = -1;
+
+
+NONSHARABLE_STRUCT(CMMAAudioSettings): public CBase
+{
+
+ ~CMMAAudioSettings();
+
+ TUid iController;
+ TUid iEncoding;
+ TFourCC iDataType;
+ TInt iRate;
+ TInt iChannels;
+ TBool iStreamableFormat;
+ HBufC *iContentType;
+};
+
+NONSHARABLE_STRUCT(TMMAVideoSettings)
+{
+ TPtrC iEncoding;
+ TReal32 iFps;
+ TInt iWidth;
+ TInt iHeight;
+ inline void operator=(const TMMAVideoSettings& aSettings)
+ {
+ iEncoding.Set(aSettings.iEncoding);
+ iFps = aSettings.iFps;
+ iHeight = aSettings.iHeight;
+ iWidth = aSettings.iWidth;
+ }
+};
+/**
+ * Container for image settings
+ */
+
+NONSHARABLE_CLASS(CMMAImageSettings): public CBase
+{
+public: // destructor
+ ~CMMAImageSettings();
+ // this is basicly struct owning some data
+ // so there is no point to make getters/setters
+public:
+ HBufC8* iMimeType; //owned
+ HBufC8* iType; // owned
+ TInt iWidth;
+ TInt iHeight;
+ CFrameImageData* iImageData; //owned
+};
+
+// CLASS DECLARATION
+/**
+* This class is used for parsing and validating properties
+* The property string is in format "name=value&name=value&..."
+*
+*/
+
+NONSHARABLE_CLASS(TMMAParameterValidator)
+{
+public:// New methods
+ /**
+ * Validates audio properties. Accepted keys are:
+ * "encoding", "rate", "bits", "channels", "endian", "signed"
+ * Properties string must start with "encoding" parameter
+ * Leaves with KErrArgument if parameters are not valid.
+ */
+ static CMMAAudioSettings *ValidateAudioPropertiesL(const TDesC& aProperties);
+
+ /**
+ * Validates video properties. Accepted keys are:
+ * "encoding", "fps", "width", "height"
+ * Properties string must start with "encoding" parameter
+ * Leaves with KErrArgument if parameters are not valid.
+ */
+ static TMMAVideoSettings ValidateVideoPropertiesL(const TDesC& aProperties);
+
+ /**
+ * Validates image properties. Accepted keys are:
+ * "encoding", "width", "height", "quality", "progressive", "interlaced", "type", "colors"
+ * Properties string must start with "encoding" parameter
+ * Leaves with KErrArgument if parameters are not valid.
+ */
+ static CMMAImageSettings* ValidateImagePropertiesL(const TDesC& aProperties);
+
+private: // New methods
+ /**
+ * Every properties must start with "encoding="
+ */
+ static void CheckEncodingL(const TDesC& aProperties);
+
+ /**
+ * Creates new HBufC8 and copies data to it from aDes.
+ */
+ static HBufC8* CreateHBufC8FromUnicodeL(const TDesC& aDes);
+};
+
+#endif // TMMAPARAMETERVALIDATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/BufferDataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Buffered DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.protocol.SourceStream;
+import java.io.IOException;
+
+/**
+ * BufferDataSource is used to read header from DataSource's SourceStream.
+ * This class delegates all method calls to DataSource given in constructor
+ * except getStream method which returns buffered SourceStream.
+ */
+public class BufferDataSource extends DataSource
+{
+ // delegated source
+ protected DataSource iDataSource;
+
+ // buffers DataSource's first stream.
+ protected BufferSourceStream iSourceStream;
+
+ /**
+ * Constructor.
+ * @param aDataSource delegated DataSource
+ */
+ public BufferDataSource(DataSource aDataSource) throws IOException
+ {
+ super(aDataSource.getLocator());
+ iDataSource = aDataSource;
+ SourceStream ss = aDataSource.getStreams()[ 0 ];
+ iSourceStream = new BufferSourceStream(ss);
+ }
+
+ /**
+ * Return header data.
+ * @return header data
+ */
+ public byte[] getHeader() throws IOException
+ {
+ return iSourceStream.getHeader();
+ }
+
+ public int readAndBuffer(byte[] aBuffer, int aOffset, int aLength) throws IOException
+ {
+ return iSourceStream.readAndBuffer(aBuffer, aOffset, aLength);
+ }
+
+ /**
+ * from DataSource
+ * @return Content Type
+ * @see DataSource
+ */
+ public String getContentType()
+ {
+ return iDataSource.getContentType();
+ }
+
+ /**
+ * from DataSource
+ * Connect to the stream
+ * @throws IOException
+ * @see DataSource
+ */
+ public void connect() throws IOException
+ {
+ iDataSource.connect();
+ }
+
+ /**
+ * from DataSource
+ * Disconnect from the stream
+ */
+ public void disconnect()
+ {
+ iDataSource.disconnect();
+ }
+
+ /**
+ * from DataSource
+ * Put DataSource to STARTED state
+ * @throws IOException Throw if DataSource is in wrong state
+ * @see DataSource
+ */
+ public void start() throws IOException
+ {
+ iDataSource.start();
+ }
+
+ /**
+ * from DataSource
+ * Stops DataSource
+ * @see DataSource
+ */
+ public void stop() throws IOException
+ {
+ iDataSource.stop();
+ }
+
+ /**
+ * from DataSource
+ * return sourceStreams of the DataSource
+ *
+ * @return set of source streams
+ * @see DataSource
+ */
+ public SourceStream[] getStreams()
+ {
+ // return all streams from delegated DataSource except first
+ // buffered stream.
+ SourceStream[] originalStreams = iDataSource.getStreams();
+ SourceStream[] streams = new SourceStream[ originalStreams.length ];
+ System.arraycopy(originalStreams, 0,
+ streams, 0, originalStreams.length);
+ streams[ 0 ] = iSourceStream;
+ return streams;
+ }
+
+ /**
+ * from interface Controllable
+ * Method return controls of the DataSource
+ * @return Control
+ * @see Controllable
+ * @see DataSource
+ */
+ public Control[] getControls()
+ {
+ return iDataSource.getControls();
+ }
+
+ /**
+ * from interface Controllable
+ * Return a control by the Control Type, not supported
+ * @param controlType type of the control
+ * @return Control
+ */
+ public Control getControl(String aControlType)
+ {
+ return iDataSource.getControl(aControlType);
+ }
+ /**
+ * @author d35kumar
+ * @return
+ */
+ public DataSource getDataSource(){
+ return iDataSource;
+ }
+
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/BufferSourceStream.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SourceStream that buffers data from another SourceStream.
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import javax.microedition.media.protocol.SourceStream;
+
+/**
+ * SourceStream that buffers data from another SourceStream.
+ *
+ */
+public class BufferSourceStream extends InputStreamSourceStream
+{
+ // Deferred buffer size
+ private static final int BUFFER_SIZE = 5120;
+
+ // Stream to buffer
+ SourceStream iSourceStream;
+
+ byte[] iBuffer;
+
+ // stream read position
+ int iPos;
+
+ /**
+ * Constructor.
+ * @param aInputStream An InputStream
+ */
+ public BufferSourceStream(SourceStream aSourceStream)
+ {
+ iSourceStream = aSourceStream;
+ }
+
+ /**
+ * Return header data.
+ * @return header data
+ */
+ public byte[] getHeader() throws IOException
+ {
+ byte[] tmpBuffer = new byte[ BUFFER_SIZE ];
+ int bytesInBuffer = BUFFER_SIZE;
+
+ // Read into iBuffer first if iBuffer doesn't already contain
+ // first 256 bytes
+ if (iBuffer == null)
+ {
+ bytesInBuffer = readAndBuffer(tmpBuffer, 0, 256);
+
+ if (bytesInBuffer < 0)
+ {
+ throw new IOException();
+ }
+ }
+ else if (iBuffer.length < 256)
+ {
+ bytesInBuffer = readAndBuffer(tmpBuffer, iBuffer.length, (256 - iBuffer.length));
+
+ if (bytesInBuffer == -1)
+ {
+ bytesInBuffer = iBuffer.length;
+ }
+ }
+
+ // tmpBuffer will be overwritten here
+ System.arraycopy(iBuffer, 0,
+ tmpBuffer, 0, bytesInBuffer);
+
+ return tmpBuffer;
+ }
+
+
+ public int readAndBuffer(byte[] aBuffer, int aOffset, int aLength) throws IOException
+ {
+ int bytesInBuffer = iSourceStream.read(aBuffer, aOffset, aLength);
+
+ if (iBuffer == null)
+ {
+ iBuffer = new byte[bytesInBuffer];
+
+ System.arraycopy(aBuffer, aOffset,
+ iBuffer, 0, bytesInBuffer);
+ }
+ else if (bytesInBuffer >= 0)
+ {
+ byte[] tempBuffer = iBuffer;
+ iBuffer = new byte[iBuffer.length + bytesInBuffer];
+
+ System.arraycopy(tempBuffer, 0,
+ iBuffer, 0, tempBuffer.length);
+ System.arraycopy(aBuffer, aOffset,
+ iBuffer, tempBuffer.length, bytesInBuffer);
+ tempBuffer = null; // relese tempBuffer
+ }
+
+ return bytesInBuffer;
+ }
+
+ /**
+ * Read from Input Stream
+ * @param buffer Input Stream
+ * @param offset where reading starts
+ * @param length length of read data
+ * @return bytes read
+ * @throws IOException
+ */
+ public int read(byte[] aBuffer, int aOffset, int aLength) throws IOException
+ {
+ // bytes read from internal buffer
+ int bytesFromBuffer = 0;
+
+
+ if ((iBuffer != null) && // read from iBuffer if getHeader is called
+ (iPos < iBuffer.length))
+ {
+ // Need to read from buffer
+ if (aLength < iBuffer.length - iPos)
+ {
+ // aLength bytes can be read from buffer
+ bytesFromBuffer = aLength;
+ }
+ else
+ {
+ // aLength cannot be read from buffer
+ // read all there is available
+ bytesFromBuffer = iBuffer.length - iPos;
+ }
+
+ System.arraycopy(iBuffer, iPos,
+ aBuffer, aOffset, bytesFromBuffer);
+
+ // move stream position
+ iPos += bytesFromBuffer;
+ return bytesFromBuffer;
+ }
+
+ // bytes read from iSourceStream
+ int bytesFromStream = 0;
+ // Check if bytes are needed from SourceStream
+ if (bytesFromBuffer < aLength)
+ {
+ bytesFromStream = iSourceStream.read(aBuffer,
+ bytesFromBuffer,
+ aLength - bytesFromBuffer);
+ if (bytesFromStream != -1)
+ {
+ // move stream position, if not end of stream
+ iPos += bytesFromStream;
+ }
+ }
+
+ return bytesFromStream;
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,668 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Vector;
+import java.util.Enumeration;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.TimeBase;
+import javax.microedition.media.Player;
+import javax.microedition.media.MediaException;
+//import com.symbian.lcdjava.lang.ObjectExtensions;
+//import com.symbian.epoc.events.MIDEventServer;
+//import com.symbian.midp.runtime.ToolkitInvoker;
+//import com.symbian.midp.runtime.ToolkitObserver;
+
+import com.nokia.microedition.media.animation.AnimationPlayerFactory;
+import com.nokia.microedition.media.protocol.ProtocolFactory;
+import com.nokia.microedition.media.tone.PlayToneImpl;
+
+import com.nokia.microedition.volumekeys.ForegroundListener;
+import com.nokia.mj.impl.rt.support.Finalizer;
+
+//To get the shutdown event from the midlet
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+import com.nokia.mj.impl.rt.support.ApplicationInfo;
+import com.nokia.mj.impl.rt.support.ShutdownListener;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * ManagerImpl implements the functionality specified in
+ * javax.microedition.media.Manager class.
+ * This class is a singleton and instance can be got with getInstance method.
+ */
+public class ManagerImpl implements PlugIn
+{
+ // ManagerImpl native instance
+ private static int sManagerHandle;
+
+ // CMMAEventSource
+ private static int iFunctionSourceHandle;
+
+ // Static instance, can be got with getInstace method
+ private static ManagerImpl sManager;
+
+ private final TimeBase iSystemTimeBase = new SystemTimeBase();
+
+ private final Vector iPlugIns = new Vector();
+ private final ProtocolFactory iProtocolFactory = new ProtocolFactory();
+ private final ForegroundListener iForegroundListener;
+ private Finalizer iFinalizer;
+
+ Finalizer registerForFinalization()
+ {
+ return new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+ }
+
+ // Play tone implementation
+ private PlayToneImpl iPlayToneImpl = new PlayToneImpl();
+
+ static
+ {
+ // This is called when class is loaded for the first time
+ sManager = new ManagerImpl();
+
+ try
+ {
+ // Invoke external components
+ Setup.setup(iFunctionSourceHandle);
+ }
+ catch (OutOfMemoryError oome)
+ {
+ // External setup failed clean MMA native resources and throw oome
+ sManager.doFinalize();
+ throw oome;
+ }
+ }
+
+ /**
+ * This private constructor can be called only from staic block.
+ */
+ private ManagerImpl()
+ {
+ // Will cause registeredFinalize() to be called when ObjectExtensions
+ // is finalized.
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"ManagerImpl constructor before loading library");
+ com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javamobilemedia");
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"ManagerImpl constructor library loaded.. going to register for finalizer");
+ //ObjectExtensions.registerForFinalization(this);
+ iFinalizer = registerForFinalization();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"ManagerImpl constructor ... after registering for finalizer");
+
+ // Event server contructor needs new String object,
+ // otherwise it don't work..
+
+ iFunctionSourceHandle = _createEventSource();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"ManagerImpl.java : iFunctionSourceHandle is " + iFunctionSourceHandle);
+ if (iFunctionSourceHandle < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError("SymbianOS error: " + iFunctionSourceHandle);
+ }
+
+ sManagerHandle = _createManager(iFunctionSourceHandle,
+ ApplicationInfo.getInstance().getSuiteUid().hashCode());
+ if (sManagerHandle < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError();
+ }
+ //Use ShutdownListener to get notification of exit and release the resource
+ //MMAPI UI 3.x work
+
+ setShutdownListener();
+ // support for gif animation player
+ iPlugIns
+ .addElement(new com.nokia.microedition.media.animation.AnimationPlayerFactory());
+
+ // ManagerImpl is also a PlugIn that getAllSupportedContentTypes,
+ // getAllSupportedProtocols and createPlayer methods can be used
+ // through PlugIn interface.
+ iPlugIns.addElement(this);
+
+ // support for device://tone and jts
+ iPlugIns.addElement(
+ new com.nokia.microedition.media.protocol.device.tone.Protocol());
+
+ // Create foreground listener which listens the state of the midlet
+ // This feature is a part of the media keys feature so it is flagged
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"before constructing ForegroundListener....");
+ iForegroundListener = new ForegroundListener(iFunctionSourceHandle);
+ iForegroundListener.init();
+ }
+
+
+ private void setShutdownListener()
+ {
+ // Get the insatnce of ApplicationUtils.
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+
+ // Get the name of the application.
+ appUtils.addShutdownListener(new ShutdownListener()
+ {
+ //The method that gets called when Application is shutting down
+ public void shuttingDown()
+ {
+
+ doFinalize();
+
+
+ }
+ });
+
+ }
+
+ /**
+ * Returns MMA event source handle
+ */
+ public static int getEventSource()
+ {
+ return iFunctionSourceHandle;
+ }
+ /**
+ * Returns native handle to Manager
+ */
+ public static int getHandle()
+ {
+ return sManagerHandle;
+ }
+
+ /**
+ * Return ManagerImpl instance
+ */
+ public static ManagerImpl getInstance()
+ {
+ return sManager;
+ }
+
+ /**
+ * Adds new PlugIn to PlugIns array.
+ * @param aPlugIn New PlugIn.
+ */
+ public void addPlugIn(PlugIn aPlugIn)
+ {
+ iPlugIns.addElement(aPlugIn);
+ }
+
+
+
+
+ /**
+ * This will be called when ObjectExtensions is finalized.
+ */
+ synchronized final void doFinalize()
+ {
+ _dispose(iFunctionSourceHandle);
+ iFunctionSourceHandle = 0;
+ }
+
+ /**
+ * This method is called in Toolkit's destroyNotify call.
+ * This will release convenient native resources. All native resource
+ * will be deleted in registeredFinalize() method.
+ */
+ synchronized final void release()
+ {
+ // _release(iFunctionSourceHandle);
+ }
+
+ /**
+ * Create String array from Vector and remove String duplicates.
+ * @param aVector Vector containing String objects.
+ */
+ private String[] createStringArray(Vector aVector)
+ {
+ // remove all duplicates from the vector
+ for (int i = 0; i < aVector.size(); i++)
+ {
+ String element = (String)aVector.elementAt(i);
+ for (int j = i + 1; j < aVector.size();)
+ {
+ if (element.equals((String)aVector.elementAt(j)))
+ {
+ aVector.removeElementAt(j);
+ }
+ else
+ {
+ j++;
+ }
+ }
+ }
+
+ // Create new array for vector elements and copy elements
+ String[] s = new String[ aVector.size()];
+ aVector.copyInto(s);
+ return s;
+ }
+
+ /**
+ * Return the list of supported content types for the given protocol.
+ * <p>
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content types returned.
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocol used.
+ * <p>
+ * For example, if the given <code>protocol</code>
+ * is <code>"http"</code>,
+ * then the supported content types that can be played back
+ * with the <code>http</code> protocol will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the <code>protocol</code>,
+ * all the supported content types for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>protocol</code> is an invalid or
+ * unsupported protocol, then an empty array will be returned.
+ *
+ * @param aProtocol The input protocol for the supported content types.
+ * @return The list of supported content types for the given protocol.
+ */
+ public String[] getAllSupportedContentTypes(String aProtocol)
+ {
+ if ((aProtocol != null) && (aProtocol.length() == 0))
+ {
+ // No supported types for 0 length string.
+ return new String[ 0 ];
+ }
+ Vector contentTypes = new Vector();
+
+ Enumeration plugIns = iPlugIns.elements();
+
+ // go through all plugins and get content types
+ while (plugIns.hasMoreElements())
+ {
+ PlugIn plugIn = (PlugIn)plugIns.nextElement();
+ String[] types = plugIn.getSupportedContentTypes(aProtocol);
+
+ // Add all types to vector
+ for (int i = 0; i < types.length; i++)
+ {
+ contentTypes.addElement(types[ i ]);
+ }
+ }
+ return createStringArray(contentTypes);
+ }
+
+ /**
+ * Return the list of supported protocols given the content
+ * type. The protocols are returned
+ * as strings which identify what locators can be used for creating
+ * <code>Player</code>'s.
+ * <p>
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocols returned.
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content type used.
+ * <p>
+ * For example, if the given <code>content_type</code>
+ * is <code>"audio/x-wav"</code>, then the supported protocols
+ * that can be used to play back <code>audio/x-wav</code>
+ * will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the
+ * <code>content_type</code>,
+ * all the supported protocols for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>content_type</code> is an invalid or
+ * unsupported content type, then an empty array will be returned.
+ *
+ * @param aContentType The content type for the supported protocols.
+ * @return The list of supported protocols for the given content type.
+ */
+ public String[] getAllSupportedProtocols(String aContentType)
+ {
+ String contentType = aContentType;
+ if ((contentType != null) && contentType.equals(""))
+ {
+ return new String[ 0 ];
+ }
+
+ Vector protocols = new Vector();
+ Enumeration plugIns = iPlugIns.elements();
+ while (plugIns.hasMoreElements())
+ {
+ PlugIn plugIn = (PlugIn)plugIns.nextElement();
+ String[] types = plugIn.getSupportedProtocols(aContentType);
+ for (int i = 0; i < types.length; i++)
+ {
+ protocols.addElement(types[ i ]);
+ }
+ }
+ return createStringArray(protocols);
+ }
+
+ /**
+ * From PlugIn. Get MMA supported protocols.
+ */
+ public String[] getSupportedProtocols(String aContentType)
+ {
+ String[] protocols = _getSupportedProtocols(iFunctionSourceHandle,
+ sManagerHandle,
+ aContentType);
+ NativeError.checkOOM(protocols);
+ return protocols;
+ }
+
+ /**
+ * From PlugIn. Get MMA supported types.
+ */
+ public String[] getSupportedContentTypes(String aProtocol)
+ {
+ String[] types = _getSupportedContentTypes(iFunctionSourceHandle,
+ sManagerHandle,
+ aProtocol);
+ NativeError.checkOOM(types);
+ return types;
+ }
+
+ /**
+ * From PlugIn.
+ */
+ public InternalPlayer createPlayer(DataSource aSource)
+ throws MediaException, IOException
+ {
+ InternalPlayer player = null;
+ if (aSource.getContentType() != null)
+ {
+ // Create player from content type
+ if (isValidContentType(aSource.getContentType()))
+ {
+ player = NativePlayerFactory.createPlayer(aSource.getContentType(),
+ aSource);
+ }
+ else
+ {
+ throw new MediaException(
+ "Content type not supported: " + aSource.getContentType());
+ }
+ }
+
+ if ((player == null) &&
+ (aSource.getLocator() != null))
+ {
+ // Create player from locator
+ player = NativePlayerFactory.createPlayer(
+ new Locator(aSource.getLocator()),
+ aSource);
+ }
+
+ if (player == null)
+ {
+ // Could not create player from content-type or locator,
+ // try to create player from header data
+ player = NativePlayerFactory.createPlayer(
+ ((BufferDataSource)aSource).getHeader(),
+ aSource);
+ }
+
+ return player;
+ }
+
+ /**
+ * From PlugIn. Empty implemation.
+ */
+ public void preparePlayer(InternalPlayer aPlayer) throws MediaException
+ {
+ }
+
+ /**
+ * This method calls preparePlayer to all PlugIns.
+ */
+ private void pluginsPreparePlayer(InternalPlayer aPlayer)
+ throws MediaException
+ {
+
+
+ // Call preparePlayer to all plugins
+ Enumeration plugins = iPlugIns.elements();
+ while (plugins.hasMoreElements())
+ {
+ ((PlugIn)plugins.nextElement()).preparePlayer(aPlayer);
+ }
+ }
+
+ /**
+ * Create a <code>Player</code> from an input locator.
+ *
+ * @param aLocator A locator string in URI syntax that describes
+ * the media content.
+ * @return A new <code>Player</code>.
+ * @exception IllegalArgumentException Thrown if <code>locator</code>
+ * is <code>null</code>.
+ * @exception MediaException Thrown if a <code>Player</code> cannot
+ * be created for the given locator.
+ * @exception IOException Thrown if there was a problem connecting
+ * with the source pointed to by the <code>locator</code>.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to create the <code>Player</code>.
+ */
+ public Player createPlayer(String aLocator)
+ throws IOException, MediaException
+ {
+ if (aLocator == null)
+ {
+ throw new IllegalArgumentException("Locator is null.");
+ }
+ InternalPlayer player = iProtocolFactory.createPlayer(
+ new Locator(aLocator));
+ if (player == null)
+ {
+ throw new MediaException("Locator not supported: " +
+ aLocator);
+ }
+ pluginsPreparePlayer(player);
+ return player;
+ }
+
+ /**
+ * Create a <code>InternalPlayer</code> for a <code>DataSource</code>.
+ */
+ public InternalPlayer createInternalPlayer(DataSource aSource)
+ throws IOException, MediaException
+ {
+ // Throw IllegalArgumentException if source is null.
+ if (aSource == null)
+ {
+ throw new IllegalArgumentException("DataSource is null.");
+ }
+ aSource.connect(); // Ensure that external source is connected.
+ if (aSource.getStreams() == null ||
+ aSource.getStreams().length == 0)
+ {
+ // There must be atleast one stream in the DataSource
+ throw new MediaException(
+ "There must be at least one stream in datasource");
+ }
+
+ BufferDataSource bdc = null;
+ if (aSource instanceof BufferDataSource)
+ {
+ bdc = (BufferDataSource)aSource;
+ }
+ else
+ {
+ bdc = new BufferDataSource(aSource);
+ }
+
+ InternalPlayer player = null;
+ Enumeration plugins = iPlugIns.elements();
+ // Loop through all plugins, stop if player was created
+ while (plugins.hasMoreElements() &&
+ (player == null))
+ {
+ PlugIn tmp = (PlugIn)plugins.nextElement();
+ player = tmp.createPlayer(bdc);
+ }
+
+ if (player == null)
+ {
+ // MMA or plugins could not create player
+ bdc.disconnect();
+
+ throw new MediaException("Could not create player.");
+ }
+
+ return player;
+ }
+
+ /**
+ * Create a <code>Player</code> to play back media from an
+ * <code>InputStream</code>.
+ * <p>
+ * The <code>type</code> argument
+ * specifies the content-type of the input media. If
+ * <code>null</code> is given, <code>Manager</code> will
+ * attempt to determine the type. However, since determining
+ * the media type is non-trivial for some media types, it
+ * may not be feasible in some cases. The
+ * <code>Manager</code> may throw a <code>MediaException</code>
+ * to indicate that.
+ *
+ * @param aStream The <code>InputStream</code> that delivers the
+ * input media.
+ * @param aType The <code>ContentType</code> of the media.
+ * @return A new <code>Player</code>.
+ * @exception IllegalArgumentException Thrown if <code>stream</code>
+ * is <code>null</code>.
+ * @exception MediaException Thrown if a <code>Player</code> cannot
+ * be created for the given stream and type.
+ * @exception IOException Thrown if there was a problem reading data
+ * from the <code>InputStream</code>.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to create the <code>Player</code>.
+ */
+ public Player createPlayer(InputStream aStream, String aType)
+ throws IOException, MediaException
+ {
+ if (aStream == null)
+ {
+ throw new IllegalArgumentException("InputStream is null.");
+ }
+
+ InputStreamSourceStream sourceStream =
+ new InputStreamSourceStream(aStream);
+
+ // Create data source without locator.
+ DataSource dataSource = new InputStreamDataSource(sourceStream,
+ aType);
+ InternalPlayer player = createInternalPlayer(dataSource);
+
+ if (player != null)
+ {
+ // Call preparePlayer to all plugins
+ pluginsPreparePlayer(player);
+ }
+
+ return player;
+ }
+
+ /**
+ * Play back a tone as specified by a note and its duration.
+ * A note is given in the range of 0 to 127 inclusive. The frequency
+ * of the note can be calculated from the following formula:
+ * <pre>
+ * SEMITONE_CONST = 17.31234049066755 = 1/(ln(2^(1/12)))
+ * note = ln(freq/8.176)*SEMITONE_CONST
+ * The musical note A = MIDI note 69 (0x45) = 440 Hz.
+ * </pre>
+ * This call is a non-blocking call. Notice that this method may
+ * utilize CPU resources significantly on devices that don't
+ * have hardware support for tone generation.
+ *
+ * @param aNote Defines the tone of the note as specified by the
+ * above formula.
+ * @param aDuration The duration of the tone in milli-seconds.
+ * Duration must be positive.
+ * @param aVolume Audio volume range from 0 to 100. 100 represents
+ * the maximum
+ * volume at the current hardware level. Setting the volume to a
+ * value less
+ * than 0 will set the volume to 0. Setting the volume to greater than
+ * 100 will set the volume to 100.
+ *
+ * @exception IllegalArgumentException Thrown if the given note or
+ * duration is out of range.
+ * @exception MediaException Thrown if the tone cannot be played
+ * due to a device-related problem.
+ */
+ public void playTone(int aNote, int aDuration, int aVolume)
+ throws MediaException
+ {
+ iPlayToneImpl.playTone(aNote, aDuration, aVolume);
+ }
+
+ /**
+ * Get the time-base object for the system.
+ * @return The system time base.
+ */
+ public TimeBase getSystemTimeBase()
+ {
+ return iSystemTimeBase;
+ }
+
+ public boolean isValidContentType(String contentType)
+ {
+ for (int i=0; i < contentType.length(); i++)
+ {
+ if ((contentType.charAt(i) >= 0 && contentType.charAt(i) <= 31) || contentType.charAt(i) == 127)
+ return false;
+ }
+ return true;
+ }
+
+
+
+// MMAPI UI 3.x req
+/**
+ * get midlet state
+ */
+
+ public boolean isForground()
+ {
+ return iForegroundListener.isForeground();
+ }
+
+ private native int _createManager(int aEventSourceHandle,
+ int aMIDletSuiteID);
+ private native int _createEventSource();
+ private native void _dispose(int aEventSourceHandle);
+
+ /**
+ * Releases native resources.
+ * @param aEventSourceHandle Handle to native CMMAEventSource instance.
+ */
+ private native void _release(int aFunctionSourceHandle);
+
+ private static native String[] _getSupportedContentTypes(int aFunctionSourceHandle,
+ int aManagerHandle,
+ String aContentType);
+
+ private static native String[] _getSupportedProtocols(int aFunctionSourceHandle,
+ int aManagerHandle,
+ String aProtocol);
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/control/MetaDataControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements functionalities defined in the
+* MetaDataControl interface (included in
+* javax.microedition.media.control package).
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+// CLASS DEFINITION
+/**
+ * The <code>MetaDataControl</code> class implements functionalities defined
+ * in the <code>MetaDataControl</code> interface (included in
+ * <code>javax.microedition.media.control</code> package).
+ */
+
+public class MetaDataControl
+ extends ControlImpl
+ implements javax.microedition.media.control.MetaDataControl
+{
+
+ /**
+ * The metadata keys received from the native side. It is assumed that
+ * the keys will not change during the lifetime of a media clip or
+ * stream. Key data is used so frequently that we want to buffer it
+ * here at Java side.
+ */
+ private String[] iKeys = null;
+ private static final String[] DEFAULT_DATA = { MetaDataControl.AUTHOR_KEY,
+ MetaDataControl.COPYRIGHT_KEY,
+ MetaDataControl.DATE_KEY,
+ MetaDataControl.TITLE_KEY
+ };
+ private static final String DEFAULT_DATA_VALUE = "unknown";
+
+ // Static initialization
+
+ /**
+ * Creates an instance of <code>MetaDataControl</code>.
+ */
+ public MetaDataControl()
+ {
+ }
+
+ /**
+ * Returns acceptable metadata keys.
+ *
+ * The keys can be used for getting specific metadata value associated to each key.
+ *
+ * @See <code>javax.microedition.media.control.MetaDataControl</code>
+ * interface documentation for details.
+ *
+ * @return Acceptable key values.
+ *
+ */
+ public String[] getKeys()
+ {
+ checkState();
+
+ int keyCount = _getKeysCount(iEventSource, iControlHandle);
+
+ if (keyCount < 0) // can't read key count
+ {
+ iKeys = DEFAULT_DATA;
+ return iKeys;
+ }
+
+ Vector keys = new Vector(keyCount + 1);
+
+ for (int i = 0; i < keyCount; i++)
+ {
+ String currentKey = _getKey(iEventSource, iControlHandle, i);
+ if (currentKey == null) // can't read key value
+ {
+ iKeys = DEFAULT_DATA;
+ return iKeys;
+ }
+ keys.addElement(currentKey);
+ }
+
+ // Check if the default keys are already in the key vector
+ // and if not, then add them
+
+ for (int i = 0; i < DEFAULT_DATA.length; i++)
+ {
+ checkAddKey(keys, DEFAULT_DATA[ i ]);
+ }
+
+ iKeys = new String[ keys.size()];
+ keys.copyInto(iKeys);
+
+ return iKeys;
+ }
+
+ /**
+ * Check if there is already a key in vector and if not, then
+ * add one.
+ * @param aKeys vector containing keys to be checked and which to add
+ * new key
+ * @param aKey key string to be added if not already present in aKeys
+ */
+ private void checkAddKey(Vector aKeys, String aKey)
+ {
+ for (Enumeration e = aKeys.elements(); e.hasMoreElements();)
+ {
+ String currentElement = (String)e.nextElement();
+ if (currentElement.equals(aKey))
+ {
+ return;
+ }
+ }
+ // Otherwise add the key
+ aKeys.addElement(new String(aKey));
+ }
+
+ /**
+ * Fetches a value of the given metadata key.
+ *
+ * See <code>javax.microedition.media.control.MetaDataControl</code>
+ * interface documentation for details.
+ *
+ * @param aKey Key of the metadata value to be returned.
+ *
+ * @return Value of the metadata.
+ *
+ * @exception IllegalArgumentException Thrown if the given key is
+ * <code>null</code> or invalid.
+ */
+ public String getKeyValue(String aKey)
+ {
+ checkState();
+ if (null == aKey)
+ {
+ throw new IllegalArgumentException("Key cannot be null");
+ }
+
+ getKeys(); // Buffer the keys if not present
+
+ int arrLen = iKeys.length;
+ int i = 0;
+
+ // Check if the given key is valid and return the value.
+ while (i < arrLen)
+ {
+ if (iKeys[ i ].equals(aKey))
+ {
+ String value = _getKeyValue(iEventSource, iControlHandle, aKey);
+
+ // if key is ok but value is null then this key does not really
+ // exist and it must be checked whether it is one from DEFAULT_DATA
+ if (value == null)
+ {
+ for (int j = 0; j < DEFAULT_DATA.length; j++)
+ {
+ if (aKey.equals(DEFAULT_DATA[ j ]))
+ {
+ return(DEFAULT_DATA_VALUE);
+ }
+ }
+ }
+ return value;
+ }
+ ++i;
+ }
+
+ // No match - invalid key.
+ throw new IllegalArgumentException("Invalid non-null key");
+ }
+
+ private native int _getKeysCount(int aEventSource,
+ int aControlHandle);
+ private native String _getKey(int aEventSource,
+ int aControlHandle,
+ int aIndex);
+ private native String _getKeyValue(int aEventSource,
+ int aControlHandle,
+ String aKey);
+} //end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/protocol/EMCSourceInfo.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.media.protocol;
+
+import javax.microedition.media.protocol.SourceStream;
+import com.nokia.microedition.media.HttpDataSource;
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.BufferDataSource;
+import java.io.IOException;
+
+public class EMCSourceInfo
+{
+
+ // media file header
+ byte[] header;
+
+ public EMCSourceInfo(BufferDataSource datasource) throws IOException, MediaException
+ {
+ // datasource.getLocator().getMiddlePart() check if it is 3gp/mp4/rm
+ Locator locator = new Locator(datasource.getLocator());
+ String extension = getExtension(locator.getMiddlePart());
+
+
+ if (extension.equals("rm"))
+ {
+
+ // read first 5120 bytes of data and pass to native side*/
+ header = new byte[ 5120 ];
+ int bytesRead = datasource.readAndBuffer(header, 0, 5120);
+ if (bytesRead != 5120)
+ {
+ throw new IOException("Reading from HTTP server failed");
+ }
+
+ }
+ else if (extension.equals("3gp") || extension.equals("mp4")) // 3gp/mp4
+ {
+
+ byte[] moovbox = new byte[ 512 ];
+ int bytesRead = datasource.readAndBuffer(moovbox, 0, 512);
+ if (bytesRead != 512)
+ {
+ throw new IOException("Reading from HTTP server failed");
+ }
+ String str = new String(moovbox);
+ int pos = str.indexOf("moov");
+
+ if (pos == -1)
+ {
+
+ return; // moov box not in first 512 bytes, not a streaming profile
+
+ }
+ else
+ {
+
+ // ************** extract filetype length
+ int byte1 = moovbox[0]<0?(256 + moovbox[0]):moovbox[0];
+ int byte2 = moovbox[1]<0?(256 + moovbox[1]):moovbox[1];
+ int byte3 = moovbox[2]<0?(256 + moovbox[2]):moovbox[2];
+ int byte4 = moovbox[3]<0?(256 + moovbox[3]):moovbox[3];
+
+ byte1 = byte1 * 16777216;
+ byte2 = byte2 * 65536;
+ byte3 = byte3 * 256;
+ byte4 = byte4 * 1;
+
+ int filetype = byte1 + byte2 + byte3 + byte4;
+ if (filetype < 0)
+ {
+
+ return;
+ }
+
+ // ************** extract moovbox length
+ byte1 = moovbox[pos-4]<0?(256 + moovbox[pos-4]):moovbox[pos-4];
+ byte2 = moovbox[pos-3]<0?(256 + moovbox[pos-3]):moovbox[pos-3];
+ byte3 = moovbox[pos-2]<0?(256 + moovbox[pos-2]):moovbox[pos-2];
+ byte4 = moovbox[pos-1]<0?(256 + moovbox[pos-1]):moovbox[pos-1];
+
+ byte1 = byte1 * 16777216;
+ byte2 = byte2 * 65536;
+ byte3 = byte3 * 256;
+ byte4 = byte4 * 1;
+
+ int moovboxlen = byte1 + byte2 + byte3 + byte4;
+ if (moovboxlen < 0)
+ {
+
+ return;
+ }
+
+ // **************
+
+ // no. of bytes: total header length
+ int nob = filetype + moovboxlen;
+ if (nob < 0)
+ {
+
+ return;
+ }
+
+ header = new byte[nob];
+ System.arraycopy(moovbox, 0, header, 0, 512);
+ moovbox = null;
+ bytesRead = datasource.readAndBuffer(header, 512, nob-512);
+ if (bytesRead != nob-512)
+ {
+ throw new IOException();
+ }
+ }
+ }
+ else
+ {
+
+ return;
+ }
+ }
+
+ private String getExtension(String locator)
+ {
+ int index = locator.lastIndexOf('.');
+ if (index == -1) return "";
+
+ try
+ {
+
+ return locator.substring(index + 1);
+
+ }
+ catch (IndexOutOfBoundsException ex)
+ {
+ //ignore
+ }
+
+ return "";
+ }
+
+ public void writeInfo(int eventsourcehandle, int managerhandle) throws MediaException
+ {
+ int err = 0;
+
+ if (header != null)
+ {
+
+ err = _writeHeaderData(eventsourcehandle, managerhandle, header);
+
+ }
+
+ if (err != 0)
+ {
+
+ throw new MediaException(
+ "Could not create player, Symbian OS error: " + err);
+ }
+ }
+
+ private native int _writeHeaderData(int aEventsourcehandle, int aManagerHandle, byte[] header);
+
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/protocol/http/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements TimeBase
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.http;
+
+
+
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.protocol.ConnectorProtocol;
+import com.nokia.microedition.media.HttpDataSource;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.BufferDataSource;
+import com.nokia.microedition.media.protocol.EMCSourceInfo;
+
+public class Protocol extends ConnectorProtocol
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ HttpDataSource dataSource = new HttpDataSource(aLocator);
+ BufferDataSource bdc = new BufferDataSource(dataSource);
+ (new EMCSourceInfo(bdc)).writeInfo(ManagerImpl.getEventSource(), ManagerImpl.getHandle());
+ return ManagerImpl.getInstance().createInternalPlayer(bdc);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/protocol/https/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements TimeBase
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.https;
+
+
+
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.protocol.ConnectorProtocol;
+import com.nokia.microedition.media.HttpDataSource;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.BufferDataSource;
+import com.nokia.microedition.media.protocol.EMCSourceInfo;
+
+public class Protocol extends ConnectorProtocol
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ HttpDataSource dataSource = new HttpDataSource(aLocator);
+ BufferDataSource bdc = new BufferDataSource(dataSource);
+ (new EMCSourceInfo(bdc)).writeInfo(ManagerImpl.getEventSource(), ManagerImpl.getHandle());
+ return ManagerImpl.getInstance().createInternalPlayer(bdc);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/BufferDataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Buffered DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.protocol.SourceStream;
+import java.io.IOException;
+
+/**
+ * BufferDataSource is used to read header from DataSource's SourceStream.
+ * This class delegates all method calls to DataSource given in constructor
+ * except getStream method which returns buffered SourceStream.
+ */
+public class BufferDataSource extends DataSource
+{
+ // delegated source
+ protected DataSource iDataSource;
+
+ // buffers DataSource's first stream.
+ protected BufferSourceStream iSourceStream;
+
+ /**
+ * Constructor.
+ * @param aDataSource delegated DataSource
+ */
+ public BufferDataSource(DataSource aDataSource) throws IOException
+ {
+ super(aDataSource.getLocator());
+ iDataSource = aDataSource;
+ SourceStream ss = aDataSource.getStreams()[ 0 ];
+ iSourceStream = new BufferSourceStream(ss);
+ }
+
+ /**
+ * Return header data.
+ * @return header data
+ */
+ public byte[] getHeader() throws IOException
+ {
+ return iSourceStream.getHeader();
+ }
+
+ /**
+ * from DataSource
+ * @return Content Type
+ * @see DataSource
+ */
+ public String getContentType()
+ {
+ return iDataSource.getContentType();
+ }
+
+ /**
+ * from DataSource
+ * Connect to the stream
+ * @throws IOException
+ * @see DataSource
+ */
+ public void connect() throws IOException
+ {
+ iDataSource.connect();
+ }
+
+ /**
+ * from DataSource
+ * Disconnect from the stream
+ */
+ public void disconnect()
+ {
+ iDataSource.disconnect();
+ }
+
+ /**
+ * from DataSource
+ * Put DataSource to STARTED state
+ * @throws IOException Throw if DataSource is in wrong state
+ * @see DataSource
+ */
+ public void start() throws IOException
+ {
+ iDataSource.start();
+ }
+
+ /**
+ * from DataSource
+ * Stops DataSource
+ * @see DataSource
+ */
+ public void stop() throws IOException
+ {
+ iDataSource.stop();
+ }
+
+ /**
+ * from DataSource
+ * return sourceStreams of the DataSource
+ *
+ * @return set of source streams
+ * @see DataSource
+ */
+ public SourceStream[] getStreams()
+ {
+ // return all streams from delegated DataSource except first
+ // buffered stream.
+ SourceStream[] originalStreams = iDataSource.getStreams();
+ SourceStream[] streams = new SourceStream[ originalStreams.length ];
+ System.arraycopy(originalStreams, 0,
+ streams, 0, originalStreams.length);
+ streams[ 0 ] = iSourceStream;
+ return streams;
+ }
+
+ /**
+ * from interface Controllable
+ * Method return controls of the DataSource
+ * @return Control
+ * @see Controllable
+ * @see DataSource
+ */
+ public Control[] getControls()
+ {
+ return iDataSource.getControls();
+ }
+
+ /**
+ * from interface Controllable
+ * Return a control by the Control Type, not supported
+ * @param controlType type of the control
+ * @return Control
+ */
+ public Control getControl(String aControlType)
+ {
+ return iDataSource.getControl(aControlType);
+ }
+
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/BufferSourceStream.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SourceStream that buffers data from another SourceStream.
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import javax.microedition.media.protocol.SourceStream;
+
+/**
+ * SourceStream that buffers data from another SourceStream.
+ *
+ */
+public class BufferSourceStream extends InputStreamSourceStream
+{
+ // Deferred buffer size
+ private static final int BUFFER_SIZE = 5120;
+
+ // Stream to buffer
+ SourceStream iSourceStream;
+
+ byte[] iBuffer;
+
+ // stream read position
+ int iPos;
+
+ /**
+ * Constructor.
+ * @param aInputStream An InputStream
+ */
+ public BufferSourceStream(SourceStream aSourceStream)
+ {
+ iSourceStream = aSourceStream;
+ }
+
+ /**
+ * Return header data.
+ * @return header data
+ */
+ public byte[] getHeader() throws IOException
+ {
+ // Read header if this method is called for the first time
+ if (iBuffer == null)
+ {
+ byte[] tmpBuffer = new byte[ BUFFER_SIZE ];
+
+ int bytesInBuffer = iSourceStream.read(tmpBuffer, 0, BUFFER_SIZE);
+
+ // bytesInBuffer is the total number of bytes read into the buffer,
+ // or -1 if there is no more data because the end of the stream has
+ // been reached.
+ if (bytesInBuffer >= 0)
+ {
+ iBuffer = new byte[ bytesInBuffer ];
+
+ System.arraycopy(tmpBuffer, 0,
+ iBuffer, 0, bytesInBuffer);
+ }
+ else
+ {
+ throw new IOException();
+ }
+ }
+ return iBuffer;
+ }
+
+ /**
+ * Read from Input Stream
+ * @param buffer Input Stream
+ * @param offset where reading starts
+ * @param length length of read data
+ * @return bytes read
+ * @throws IOException
+ */
+ public int read(byte[] aBuffer, int aOffset, int aLength) throws IOException
+ {
+ // bytes read from internal buffer
+ int bytesFromBuffer = 0;
+
+
+ if ((iBuffer != null) && // read from iBuffer if getHeader is called
+ (iPos < iBuffer.length))
+ {
+ // Need to read from buffer
+ if (aLength < iBuffer.length - iPos)
+ {
+ // aLength bytes can be read from buffer
+ bytesFromBuffer = aLength;
+ }
+ else
+ {
+ // aLength cannot be read from buffer
+ // read all there is available
+ bytesFromBuffer = iBuffer.length - iPos;
+ }
+
+ System.arraycopy(iBuffer, iPos,
+ aBuffer, aOffset, bytesFromBuffer);
+
+ // move stream position
+ iPos += bytesFromBuffer;
+ return bytesFromBuffer;
+ }
+
+ // bytes read from iSourceStream
+ int bytesFromStream = 0;
+ // Check if bytes are needed from SourceStream
+ if (bytesFromBuffer < aLength)
+ {
+ bytesFromStream = iSourceStream.read(aBuffer,
+ bytesFromBuffer,
+ aLength - bytesFromBuffer);
+ if (bytesFromStream != -1)
+ {
+ // move stream position, if not end of stream
+ iPos += bytesFromStream;
+ }
+ }
+
+ return bytesFromStream;
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/ManagerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,675 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Vector;
+import java.util.Enumeration;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.TimeBase;
+import javax.microedition.media.Player;
+import javax.microedition.media.MediaException;
+
+//import com.symbian.lcdjava.lang.ObjectExtensions;
+//import com.symbian.epoc.events.MIDEventServer;
+//import com.symbian.midp.runtime.ToolkitInvoker;
+//import com.symbian.midp.runtime.ToolkitObserver;
+
+import com.nokia.microedition.media.protocol.ProtocolFactory;
+import com.nokia.microedition.media.tone.PlayToneImpl;
+import com.nokia.microedition.volumekeys.ForegroundListener;
+import com.nokia.mj.impl.rt.support.Finalizer;
+
+//To get the shutdown event from the midlet
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+import com.nokia.mj.impl.rt.support.ApplicationInfo;
+import com.nokia.mj.impl.rt.support.ShutdownListener;
+
+/**
+ * ManagerImpl implements the functionality specified in
+ * javax.microedition.media.Manager class.
+ * This class is a singleton and instance can be got with getInstance method.
+ */
+public class ManagerImpl implements PlugIn
+{
+ // ManagerImpl native instance
+ private static int sManagerHandle;
+
+ // CMMAEventSource
+ private static int iFunctionSourceHandle;
+
+ // Static instance, can be got with getInstace method
+ private static ManagerImpl sManager;
+
+ private final TimeBase iSystemTimeBase = new SystemTimeBase();
+
+ private final Vector iPlugIns = new Vector();
+ private final ProtocolFactory iProtocolFactory = new ProtocolFactory();
+ private final ForegroundListener iForegroundListener;
+ private Finalizer iFinalizer;
+
+ Finalizer registerForFinalization()
+ {
+ return new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+ }
+
+ // Play tone implementation
+ private PlayToneImpl iPlayToneImpl = new PlayToneImpl();
+
+ static
+ {
+
+ try{
+ com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javalegacyutils");
+ }
+ catch(Exception e)
+ {
+ System.out.println("loading javalegacyutils failed.....");
+ }
+ System.out.println("inside static block of ManagerImpl.java");
+ // This is called when class is loaded for the first time
+ sManager = new ManagerImpl();
+ try
+ {
+ // Invoke external components
+ Setup.setup(iFunctionSourceHandle);
+ }
+ catch (OutOfMemoryError oome)
+ {
+ // External setup failed clean MMA native resources and throw oome
+ sManager.doFinalize();
+ throw oome;
+ }
+ }
+
+ /**
+ * This private constructor can be called only from staic block.
+ */
+ private ManagerImpl()
+ {
+ // Will cause registeredFinalize() to be called when ObjectExtensions
+ // is finalized.
+
+
+ com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javamobilemedia");
+ //ObjectExtensions.registerForFinalization(this);
+ iFinalizer = registerForFinalization();
+
+ // Event server contructor needs new String object,
+ // otherwise it don't work..
+
+ iFunctionSourceHandle = _createEventSource();
+ if (iFunctionSourceHandle < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError("Symbian OS error: " + sEventSourceHandle);
+ }
+
+ sManagerHandle = _createManager(iFunctionSourceHandle,
+ ApplicationInfo.getInstance().getSuiteUid().hashCode());
+ if (sManagerHandle < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError();
+ }
+ //Use ShutdownListener to get notification of exit and release the resource
+ //MMAPI UI 3.x work
+
+ setShutdownListener();
+
+ // ManagerImpl is also a PlugIn that getAllSupportedContentTypes,
+ // getAllSupportedProtocols and createPlayer methods can be used
+ // through PlugIn interface.
+ iPlugIns.addElement(this);
+
+ // support for device://tone and jts
+ iPlugIns.addElement(
+ new com.nokia.microedition.media.protocol.device.tone.Protocol());
+
+ // Create foreground listener which listens the state of the midlet
+ // This feature is a part of the media keys feature so it is flagged
+ System.out.println("before constructing ForegroundListener....");
+ iForegroundListener = new ForegroundListener(iFunctionSourceHandle);
+ iForegroundListener.init();
+ }
+
+ /**
+ * Returns MMA event source handle
+ */
+ public static int getEventSource()
+ {
+ return iFunctionSourceHandle;
+ }
+ /**
+ * Returns native handle to Manager
+ */
+ public static int getHandle()
+ {
+ return sManagerHandle;
+ }
+
+ /**
+ * Return ManagerImpl instance
+ */
+ public static ManagerImpl getInstance()
+ {
+ return sManager;
+ }
+
+ /**
+ * Adds new PlugIn to PlugIns array.
+ * @param aPlugIn New PlugIn.
+ */
+ public void addPlugIn(PlugIn aPlugIn)
+ {
+ iPlugIns.addElement(aPlugIn);
+ }
+
+
+
+
+ /**
+ * This will be called when ObjectExtensions is finalized.
+ */
+ synchronized final void doFinalize()
+ {
+ _dispose(iFunctionSourceHandle);
+ iFunctionSourceHandle = 0;
+ }
+
+ /**
+ * This method is called in Toolkit's destroyNotify call.
+ * This will release convenient native resources. All native resource
+ * will be deleted in registeredFinalize() method.
+ */
+ synchronized final void release()
+ {
+ _release(iFunctionSourceHandle);
+ }
+
+ /**
+ * Create String array from Vector and remove String duplicates.
+ * @param aVector Vector containing String objects.
+ */
+ private String[] createStringArray(Vector aVector)
+ {
+ // remove all duplicates from the vector
+ for (int i = 0; i < aVector.size(); i++)
+ {
+ String element = (String)aVector.elementAt(i);
+ for (int j = i + 1; j < aVector.size();)
+ {
+ if (element.equals((String)aVector.elementAt(j)))
+ {
+ aVector.removeElementAt(j);
+ }
+ else
+ {
+ j++;
+ }
+ }
+ }
+
+ // Create new array for vector elements and copy elements
+ String[] s = new String[ aVector.size()];
+ aVector.copyInto(s);
+ return s;
+ }
+
+ /**
+ * Return the list of supported content types for the given protocol.
+ * <p>
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content types returned.
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocol used.
+ * <p>
+ * For example, if the given <code>protocol</code>
+ * is <code>"http"</code>,
+ * then the supported content types that can be played back
+ * with the <code>http</code> protocol will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the <code>protocol</code>,
+ * all the supported content types for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>protocol</code> is an invalid or
+ * unsupported protocol, then an empty array will be returned.
+ *
+ * @param aProtocol The input protocol for the supported content types.
+ * @return The list of supported content types for the given protocol.
+ */
+ public String[] getAllSupportedContentTypes(String aProtocol)
+ {
+ if ((aProtocol != null) && (aProtocol.length() == 0))
+ {
+ // No supported types for 0 length string.
+ return new String[ 0 ];
+ }
+ Vector contentTypes = new Vector();
+
+ Enumeration plugIns = iPlugIns.elements();
+
+ // go through all plugins and get content types
+ while (plugIns.hasMoreElements())
+ {
+ PlugIn plugIn = (PlugIn)plugIns.nextElement();
+ String[] types = plugIn.getSupportedContentTypes(aProtocol);
+
+ // Add all types to vector
+ for (int i = 0; i < types.length; i++)
+ {
+ contentTypes.addElement(types[ i ]);
+ }
+ }
+ return createStringArray(contentTypes);
+ }
+
+ /**
+ * Return the list of supported protocols given the content
+ * type. The protocols are returned
+ * as strings which identify what locators can be used for creating
+ * <code>Player</code>'s.
+ * <p>
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocols returned.
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content type used.
+ * <p>
+ * For example, if the given <code>content_type</code>
+ * is <code>"audio/x-wav"</code>, then the supported protocols
+ * that can be used to play back <code>audio/x-wav</code>
+ * will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the
+ * <code>content_type</code>,
+ * all the supported protocols for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>content_type</code> is an invalid or
+ * unsupported content type, then an empty array will be returned.
+ *
+ * @param aContentType The content type for the supported protocols.
+ * @return The list of supported protocols for the given content type.
+ */
+ public String[] getAllSupportedProtocols(String aContentType)
+ {
+ String contentType = aContentType;
+ if ((contentType != null) && contentType.equals(""))
+ {
+ return new String[ 0 ];
+ }
+
+ Vector protocols = new Vector();
+ Enumeration plugIns = iPlugIns.elements();
+ while (plugIns.hasMoreElements())
+ {
+ PlugIn plugIn = (PlugIn)plugIns.nextElement();
+ String[] types = plugIn.getSupportedProtocols(aContentType);
+ for (int i = 0; i < types.length; i++)
+ {
+ protocols.addElement(types[ i ]);
+ }
+ }
+ return createStringArray(protocols);
+ }
+
+ /**
+ * From PlugIn. Get MMA supported protocols.
+ */
+ public String[] getSupportedProtocols(String aContentType)
+ {
+ String[] protocols = _getSupportedProtocols(iFunctionSourceHandle,
+ sManagerHandle,
+ aContentType);
+ NativeError.checkOOM(protocols);
+ return protocols;
+ }
+
+ /**
+ * From PlugIn. Get MMA supported types.
+ */
+ public String[] getSupportedContentTypes(String aProtocol)
+ {
+ String[] types = _getSupportedContentTypes(iFunctionSourceHandle,
+ sManagerHandle,
+ aProtocol);
+ NativeError.checkOOM(types);
+ return types;
+ }
+
+ /**
+ * From PlugIn.
+ */
+ public InternalPlayer createPlayer(DataSource aSource)
+ throws MediaException, IOException
+ {
+ InternalPlayer player = null;
+ if (aSource.getContentType() != null)
+ {
+ // Create player from content type
+ if (isValidContentType(aSource.getContentType()))
+ {
+ player = NativePlayerFactory.createPlayer(aSource.getContentType(),
+ aSource);
+ }
+ else
+ {
+ throw new MediaException(
+ "Content type not supported: " + aSource.getContentType());
+ }
+ }
+
+ if ((player == null) &&
+ (aSource.getLocator() != null))
+ {
+ // Create player from locator
+ player = NativePlayerFactory.createPlayer(
+ new Locator(aSource.getLocator()),
+ aSource);
+ }
+
+ if (player == null)
+ {
+ // Could not create player from content-type or locator,
+ // try to create player from header data
+ player = NativePlayerFactory.createPlayer(
+ ((BufferDataSource)aSource).getHeader(),
+ aSource);
+ }
+
+ return player;
+ }
+
+ /**
+ * From PlugIn. Empty implemation.
+ */
+ public void preparePlayer(InternalPlayer aPlayer) throws MediaException
+ {
+
+ }
+
+ /**
+ * This method calls preparePlayer to all PlugIns.
+ */
+ private void pluginsPreparePlayer(InternalPlayer aPlayer)
+ throws MediaException
+ {
+ // Call preparePlayer to all plugins
+ Enumeration plugins = iPlugIns.elements();
+ while (plugins.hasMoreElements())
+ {
+ ((PlugIn)plugins.nextElement()).preparePlayer(aPlayer);
+ }
+ }
+
+ /**
+ * Create a <code>Player</code> from an input locator.
+ *
+ * @param aLocator A locator string in URI syntax that describes
+ * the media content.
+ * @return A new <code>Player</code>.
+ * @exception IllegalArgumentException Thrown if <code>locator</code>
+ * is <code>null</code>.
+ * @exception MediaException Thrown if a <code>Player</code> cannot
+ * be created for the given locator.
+ * @exception IOException Thrown if there was a problem connecting
+ * with the source pointed to by the <code>locator</code>.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to create the <code>Player</code>.
+ */
+ public Player createPlayer(String aLocator)
+ throws IOException, MediaException
+ {
+ if (aLocator == null)
+ {
+ throw new IllegalArgumentException("Locator is null.");
+ }
+ InternalPlayer player = iProtocolFactory.createPlayer(
+ new Locator(aLocator));
+ if (player == null)
+ {
+ throw new MediaException("Locator not supported: " +
+ aLocator);
+ }
+ pluginsPreparePlayer(player);
+ return player;
+ }
+
+ /**
+ * Create a <code>InternalPlayer</code> for a <code>DataSource</code>.
+ */
+ public InternalPlayer createInternalPlayer(DataSource aSource)
+ throws IOException, MediaException
+ {
+ // Throw IllegalArgumentException if source is null.
+ if (aSource == null)
+ {
+ throw new IllegalArgumentException("DataSource is null.");
+ }
+ aSource.connect(); // Ensure that external source is connected.
+ if (aSource.getStreams() == null ||
+ aSource.getStreams().length == 0)
+ {
+ // There must be atleast one stream in the DataSource
+ throw new MediaException(
+ "There must be at least one stream in datasource");
+ }
+
+ BufferDataSource bdc = new BufferDataSource(aSource);
+
+ InternalPlayer player = null;
+ Enumeration plugins = iPlugIns.elements();
+ // Loop through all plugins, stop if player was created
+ while (plugins.hasMoreElements() &&
+ (player == null))
+ {
+ PlugIn tmp = (PlugIn)plugins.nextElement();
+ player = tmp.createPlayer(bdc);
+ }
+
+ if (player == null)
+ {
+ // MMA or plugins could not create player
+ bdc.disconnect();
+
+ throw new MediaException("Could not create player.");
+ }
+
+ return player;
+ }
+
+ /**
+ * Create a <code>Player</code> to play back media from an
+ * <code>InputStream</code>.
+ * <p>
+ * The <code>type</code> argument
+ * specifies the content-type of the input media. If
+ * <code>null</code> is given, <code>Manager</code> will
+ * attempt to determine the type. However, since determining
+ * the media type is non-trivial for some media types, it
+ * may not be feasible in some cases. The
+ * <code>Manager</code> may throw a <code>MediaException</code>
+ * to indicate that.
+ *
+ * @param aStream The <code>InputStream</code> that delivers the
+ * input media.
+ * @param aType The <code>ContentType</code> of the media.
+ * @return A new <code>Player</code>.
+ * @exception IllegalArgumentException Thrown if <code>stream</code>
+ * is <code>null</code>.
+ * @exception MediaException Thrown if a <code>Player</code> cannot
+ * be created for the given stream and type.
+ * @exception IOException Thrown if there was a problem reading data
+ * from the <code>InputStream</code>.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to create the <code>Player</code>.
+ */
+ public Player createPlayer(InputStream aStream, String aType)
+ throws IOException, MediaException
+ {
+ if (aStream == null)
+ {
+ throw new IllegalArgumentException("InputStream is null.");
+ }
+
+ InputStreamSourceStream sourceStream =
+ new InputStreamSourceStream(aStream);
+
+ // Create data source without locator.
+ DataSource dataSource = new InputStreamDataSource(sourceStream,
+ aType);
+ InternalPlayer player = createInternalPlayer(dataSource);
+
+ if (player != null)
+ {
+ // Call preparePlayer to all plugins
+ pluginsPreparePlayer(player);
+ }
+
+ return player;
+ }
+
+ /**
+ * Play back a tone as specified by a note and its duration.
+ * A note is given in the range of 0 to 127 inclusive. The frequency
+ * of the note can be calculated from the following formula:
+ * <pre>
+ * SEMITONE_CONST = 17.31234049066755 = 1/(ln(2^(1/12)))
+ * note = ln(freq/8.176)*SEMITONE_CONST
+ * The musical note A = MIDI note 69 (0x45) = 440 Hz.
+ * </pre>
+ * This call is a non-blocking call. Notice that this method may
+ * utilize CPU resources significantly on devices that don't
+ * have hardware support for tone generation.
+ *
+ * @param aNote Defines the tone of the note as specified by the
+ * above formula.
+ * @param aDuration The duration of the tone in milli-seconds.
+ * Duration must be positive.
+ * @param aVolume Audio volume range from 0 to 100. 100 represents
+ * the maximum
+ * volume at the current hardware level. Setting the volume to a
+ * value less
+ * than 0 will set the volume to 0. Setting the volume to greater than
+ * 100 will set the volume to 100.
+ *
+ * @exception IllegalArgumentException Thrown if the given note or
+ * duration is out of range.
+ * @exception MediaException Thrown if the tone cannot be played
+ * due to a device-related problem.
+ */
+ public void playTone(int aNote, int aDuration, int aVolume)
+ throws MediaException
+ {
+ iPlayToneImpl.playTone(aNote, aDuration, aVolume);
+ }
+
+ /**
+ * Get the time-base object for the system.
+ * @return The system time base.
+ */
+ public TimeBase getSystemTimeBase()
+ {
+ return iSystemTimeBase;
+ }
+
+ public boolean isValidContentType(String contentType)
+ {
+ for (int i=0; i < contentType.length(); i++)
+ {
+ if ((contentType.charAt(i) >= 0 && contentType.charAt(i) <= 31) || contentType.charAt(i) == 127)
+ return false;
+ }
+ return true;
+ }
+
+
+
+/**
+ * Registers for shutdown listener
+ */
+ private void setShutdownListener()
+ {
+ // Get the instance of ApplicationUtils.
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+
+ // add the listener
+ appUtils.addShutdownListener(new ShutdownListener()
+ {
+ public void shuttingDown()
+ {
+ try
+ {
+ System.out.println("Shutting down..........");
+ // Do cleaning...
+ release();
+ }
+ catch (Exception ex)
+ {
+ // catch the exception and call dispose
+ }
+
+ if (iFunctionSourceHandle != 0)
+ {
+ _dispose(iFunctionSourceHandle);
+ iFunctionSourceHandle = 0;
+ }
+ }
+
+ });
+ } // end setShutdownListener()
+
+
+// MMAPI UI 3.x req
+/**
+ * get midlet state
+ */
+
+ public boolean isForground()
+ {
+ return iForegroundListener.isForeground();
+ }
+
+
+ private native int _createManager(int aEventSourceHandle,
+ int aMIDletSuiteID);
+ private native int _createEventSource();
+ private native void _dispose(int aEventSourceHandle);
+
+ /**
+ * Releases native resources.
+ * @param aEventSourceHandle Handle to native CMMAEventSource instance.
+ */
+ private native void _release(int aFunctionSourceHandle);
+
+ private static native String[] _getSupportedContentTypes(int aFunctionSourceHandle,
+ int aManagerHandle,
+ String aContentType);
+
+ private static native String[] _getSupportedProtocols(int aFunctionSourceHandle,
+ int aManagerHandle,
+ String aProtocol);
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/control/MetaDataControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements functionalities defined in the
+* MetaDataControl interface (included in
+* javax.microedition.media.control package).
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+// CLASS DEFINITION
+/**
+ * The <code>MetaDataControl</code> class implements functionalities defined
+ * in the <code>MetaDataControl</code> interface (included in
+ * <code>javax.microedition.media.control</code> package).
+ */
+
+public class MetaDataControl
+ extends ControlImpl
+ implements javax.microedition.media.control.MetaDataControl
+{
+
+ /**
+ * The metadata keys received from the native side. It is assumed that
+ * the keys will not change during the lifetime of a media clip or
+ * stream. Key data is used so frequently that we want to buffer it
+ * here at Java side.
+ */
+ private String[] iKeys = null;
+ private static final String[] DEFAULT_DATA = { MetaDataControl.AUTHOR_KEY,
+ MetaDataControl.COPYRIGHT_KEY,
+ MetaDataControl.DATE_KEY,
+ MetaDataControl.TITLE_KEY
+ };
+ private static final String DEFAULT_DATA_VALUE = "unknown";
+
+ // Static initialization
+
+ /**
+ * Creates an instance of <code>MetaDataControl</code>.
+ */
+ public MetaDataControl()
+ {
+ }
+
+ /**
+ * Returns acceptable metadata keys.
+ *
+ * The keys can be used for getting specific metadata value associated to each key.
+ *
+ * @See <code>javax.microedition.media.control.MetaDataControl</code>
+ * interface documentation for details.
+ *
+ * @return Acceptable key values.
+ *
+ */
+ public String[] getKeys()
+ {
+ checkState();
+ // Get the keys only if not yet buffered.
+ if (null == iKeys)
+ {
+ int keyCount = _getKeysCount(iEventSource, iControlHandle);
+
+ if (keyCount < 0) // can't read key count
+ {
+ iKeys = DEFAULT_DATA;
+ return iKeys;
+ }
+
+ Vector keys = new Vector(keyCount + 1);
+
+ for (int i = 0; i < keyCount; i++)
+ {
+ String currentKey = _getKey(iEventSource, iControlHandle, i);
+ if (currentKey == null) // can't read key value
+ {
+ iKeys = DEFAULT_DATA;
+ return iKeys;
+ }
+ keys.addElement(currentKey);
+ }
+
+ // Check if the default keys are already in the key vector
+ // and if not, then add them
+
+ for (int i = 0; i < DEFAULT_DATA.length; i++)
+ {
+ checkAddKey(keys, DEFAULT_DATA[ i ]);
+ }
+
+ iKeys = new String[ keys.size()];
+ keys.copyInto(iKeys);
+ }
+ return iKeys;
+ }
+
+ /**
+ * Check if there is already a key in vector and if not, then
+ * add one.
+ * @param aKeys vector containing keys to be checked and which to add
+ * new key
+ * @param aKey key string to be added if not already present in aKeys
+ */
+ private void checkAddKey(Vector aKeys, String aKey)
+ {
+ for (Enumeration e = aKeys.elements(); e.hasMoreElements();)
+ {
+ String currentElement = (String)e.nextElement();
+ if (currentElement.equals(aKey))
+ {
+ return;
+ }
+ }
+ // Otherwise add the key
+ aKeys.addElement(new String(aKey));
+ }
+
+ /**
+ * Fetches a value of the given metadata key.
+ *
+ * See <code>javax.microedition.media.control.MetaDataControl</code>
+ * interface documentation for details.
+ *
+ * @param aKey Key of the metadata value to be returned.
+ *
+ * @return Value of the metadata.
+ *
+ * @exception IllegalArgumentException Thrown if the given key is
+ * <code>null</code> or invalid.
+ */
+ public String getKeyValue(String aKey)
+ {
+ checkState();
+ if (null == aKey)
+ {
+ throw new IllegalArgumentException("Key cannot be null");
+ }
+
+ getKeys(); // Buffer the keys if not present
+
+ int arrLen = iKeys.length;
+ int i = 0;
+
+ // Check if the given key is valid and return the value.
+ while (i < arrLen)
+ {
+ if (iKeys[ i ].equals(aKey))
+ {
+ String value = _getKeyValue(iEventSource, iControlHandle, aKey);
+
+ // if key is ok but value is null then this key does not really
+ // exist and it must be checked whether it is one from DEFAULT_DATA
+ if (value == null)
+ {
+ for (int j = 0; j < DEFAULT_DATA.length; j++)
+ {
+ if (aKey.equals(DEFAULT_DATA[ j ]))
+ {
+ return(DEFAULT_DATA_VALUE);
+ }
+ }
+ }
+ return value;
+ }
+ ++i;
+ }
+
+ // No match - invalid key.
+ throw new IllegalArgumentException("Invalid non-null key");
+ }
+
+ private native int _getKeysCount(int aEventSource,
+ int aControlHandle);
+ private native String _getKey(int aEventSource,
+ int aControlHandle,
+ int aIndex);
+ private native String _getKeyValue(int aEventSource,
+ int aControlHandle,
+ String aKey);
+} //end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/protocol/http/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements TimeBase
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.http;
+
+
+
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.protocol.ConnectorProtocol;
+import com.nokia.microedition.media.HttpDataSource;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ManagerImpl;
+
+public class Protocol extends ConnectorProtocol
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ HttpDataSource dataSource = new HttpDataSource(aLocator);
+ return ManagerImpl.getInstance().createInternalPlayer(dataSource);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc.mmf/com/nokia/microedition/media/protocol/https/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements TimeBase
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.https;
+
+
+
+
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.protocol.ConnectorProtocol;
+import com.nokia.microedition.media.HttpDataSource;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ManagerImpl;
+
+public class Protocol extends ConnectorProtocol
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ HttpDataSource dataSource = new HttpDataSource(aLocator);
+ return ManagerImpl.getInstance().createInternalPlayer(dataSource);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/ConnectorDataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is an imlementation of DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.MediaException;
+import java.io.IOException;
+import javax.microedition.io.StreamConnection;
+import javax.microedition.io.Connection;
+import javax.microedition.io.Connector;
+import javax.microedition.io.ConnectionNotFoundException;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * DataSource that uses Connector to create connections and
+ * InputStreams.
+ */
+public class ConnectorDataSource extends InputStreamDataSource
+{
+ // Connection object.
+ StreamConnection iConnection;
+
+ /**
+ * Constructor.
+ * @param aLocator Locator to connect.
+ */
+ public ConnectorDataSource(Locator aLocator)
+ throws IOException, MediaException
+ {
+ super(aLocator.getLocatorString());
+ open(); // open iConnection
+ iSourceStream = new InputStreamSourceStream(
+ iConnection.openInputStream());
+ }
+
+ /**
+ * Open connection and initialize
+ */
+ protected void open() throws IOException, MediaException
+ {
+ try
+ {
+ Connection connection = Connector.open(getLocator(),
+ Connector.READ);
+
+ // derived classes may do additional checks
+ checkConnection(connection);
+
+ // Only StreamConnection is supported
+ iConnection = (StreamConnection)connection;
+ }
+ catch (ConnectionNotFoundException cnfe)
+ {
+ // ConnectionNotFoundException extends IOException,
+ // we must throw MediaException in this case.
+ throw new MediaException(
+ "Connection could not be found, " + cnfe.getMessage());
+ }
+ catch (IllegalArgumentException iae)
+ {
+ // IllegalArgumentException can be thrown only if
+ // connector or stream is null.
+ throw new MediaException(
+ "Connector stream is null, " + iae.getMessage());
+ }
+ catch (ClassCastException cce)
+ {
+ // Returned connection object was not StreamConnection
+ // or connection was not supported in checkConnection method.
+ throw new MediaException(cce.getMessage());
+ }
+ }
+
+ /**
+ * from DataSource
+ * Connect to the stream
+ * @throws IOException
+ * @see DataSource
+ */
+ public void connect() throws IOException
+ {
+ // if connection is not null source is already connected.
+ if (iConnection == null)
+ {
+ try
+ {
+ open();
+ iSourceStream.setStream(iConnection.openInputStream());
+ }
+ catch (MediaException me)
+ {
+ // MediaException cannot be thrown from this method.
+ throw new IOException(
+ "failed to connect to stream, " + me.getMessage());
+ }
+ }
+ }
+
+ /**
+ * from DataSource
+ * Disconnect from the stream
+ */
+ public void disconnect()
+ {
+ // If iConnection is null disconnect is already called.
+ if (iConnection != null)
+ {
+ try
+ {
+ iSourceStream.close();
+ }
+ catch (IOException ioe)
+ {
+ // disconnect cannot throw any exception and because source will
+ // be disconnected in Player's close or deallocate which can't
+ // throw exceptions we have to hide the exception.
+ Logger.WLOG(Logger.EJavaMMAPI,
+ "MMA::ConnectorDataSource::disconnect failed ", ioe);
+ }
+ try
+ {
+ iConnection.close();
+ // source is disconnected and may be reconnected
+ iConnection = null;
+ }
+ catch (IOException ioe)
+ {
+ // disconnect cannot throw any exception and because source will
+ // be disconnected in Player's close or deallocate which can't
+ // throw exceptions we have to hide the exception.
+ Logger.WLOG(Logger.EJavaMMAPI,
+ "MMA::ConnectorDataSource::disconnect failed ", ioe);
+ }
+ }
+ }
+
+ /**
+ * Protected method to connection object in derived classes.
+ * @param aConnection Connection to check
+ */
+ protected void checkConnection(Connection aConnection) throws IOException
+ {
+ // This class does not do additional checks.
+ }
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/ControlContainer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.Controllable;
+import com.nokia.microedition.media.control.ControlImpl;
+import javax.microedition.media.Player;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * ControlContainer class creates java control objects according to a classname
+ * which is got from native control object. Created controls are accessible
+ * through Controllable interface which is implemented in this class.
+ */
+public class ControlContainer implements Controllable
+{
+ /**
+ * Default control package. Used when getting control with
+ * getControl method which appends default control package if package is
+ * not specified.
+ */
+ static final String CONTROL_DEFAULT_PACKAGE =
+ "javax.microedition.media.control.";
+
+
+ /**
+ * Default control package. Used when getting control with
+ * getControl method which appends default control package if package is
+ * not specified.
+ */
+ static final String CONTROL_IMPLEMENTATION_PACKAGE =
+ "com.nokia.microedition.media.control.";
+ /**
+ * Hashtable containing controls identified with a full package name.
+ * All control names starts with iDefaultPackage.
+ */
+ private final Hashtable iControls = new Hashtable();
+
+ /**
+ * Creates new ControlContainer.
+ */
+ private ControlContainer()
+ {
+ }
+
+ /**
+ * Create new ControlContainer and populates the controls.
+ *
+ * If native control name does not contain package name default
+ * com.nokia.microedition.media.control. package is used.
+ * If control name starts with . (.package.ClassName), Java control is not
+ * created. If control name contains valid package name and classname Java
+ *instance will be created.
+ *
+ *
+ * @param aPlayer Player which will contain the controls.
+ * @param aEventSourceHandle Handle to native event source.
+ * @param aNativeHandle Handle to native control source.
+ */
+ public static final ControlContainer populateControls(
+ Player aPlayer,
+ int aEventSourceHandle,
+ int aNativeHandle)
+ {
+ ControlContainer container = new ControlContainer();
+
+ // Get amount of controls in native object.
+ int controlCount = _getControlsCount(aNativeHandle);
+
+ // Create java object for each native objects.
+ for (int i = 0; i < controlCount; i++)
+ {
+ // Get handle to native object at index i
+ int controlHandle = _getControlHandle(aNativeHandle,
+ i);
+
+ // Get public class name for the control.
+ String realClassName = _getPublicControlClassName(controlHandle);
+
+ // If null public control name was returned, Java control is not
+ // created. This allows extensions to use existing Player's
+ // native control array.
+ if (realClassName == null)
+ {
+ continue;
+ }
+
+ // Get the implementation class name for the control which will
+ // be used to create java object.
+ String className = _getControlClassName(controlHandle);
+
+ // Add package if it does not exists
+ if (className.indexOf('.') < 0)
+ {
+ className = CONTROL_IMPLEMENTATION_PACKAGE + className;
+ realClassName = CONTROL_DEFAULT_PACKAGE + className;
+ }
+
+ // create java instance
+ Control control = createControl(aPlayer,
+ className,
+ controlHandle,
+ aEventSourceHandle);
+ container.iControls.put(realClassName, control);
+ }
+
+ // population succeed, return created collection
+ return container;
+ }
+
+ /**
+ * Adds new control
+ */
+ public void addControl(Control aControl, String aControlName)
+ {
+ iControls.put(aControlName, aControl);
+ }
+
+ /**
+ * Disposes all the controls
+ */
+ public void dispose()
+ {
+ Enumeration controls = iControls.elements();
+ while (controls.hasMoreElements())
+ {
+ Object control = controls.nextElement();
+
+ // only ControlImpl derived classes need to be notified.
+ if (control instanceof ControlImpl)
+ {
+ ((ControlImpl)control).notifyDispose();
+ }
+ }
+ }
+
+ /**
+ * Implements method defined in javax.microedition.media.Controllable.
+ *
+ * @see javax.microedition.media.Controllable
+ * @param aControlType the class name of the Control. The class name should
+ * be given either as the fully-qualified name of the class; or if the
+ * package of the class is not given, the package
+ * javax.microedition.media.control is assumed.
+ * @return the object that implements the control, or null.
+ */
+ public Control getControl(String aControlType)
+ {
+ if (aControlType == null)
+ {
+ throw new IllegalArgumentException("argument is null");
+ }
+
+ String controlType = aControlType;
+
+ // check if package name exists
+ if (controlType.indexOf(".") == -1)
+ {
+ // add package name
+ controlType = CONTROL_DEFAULT_PACKAGE + aControlType;
+ }
+ Control control = (Control)iControls.get(controlType);
+
+ // If control does not exists with default name, check if there is
+ // is a control with same type ( extends the given class name ).
+ if (control == null)
+ {
+ try
+ {
+ // try to create class for control
+ Class controlClass = Class.forName(controlType);
+
+ Enumeration elements = iControls.elements();
+
+ // search if any control is same type that requested control
+ while (elements.hasMoreElements() &&
+ control == null)
+ {
+ Control tmpControl = (Control)elements.nextElement();
+ if (controlClass.isInstance(tmpControl))
+ {
+ // control is found
+ control = tmpControl;
+ }
+ }
+ }
+ catch (ClassNotFoundException cnfe) // the class could not be found
+ {
+ // Exception is ignored and null is returned from this method
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "ControlContainer::getControl ", cnfe);
+ }
+ catch (Error e) // the function failed for any other reason.
+ {
+ // Error is ignored and null is returned from this method
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "ControlContainer::getControl " , e);
+ }
+ }
+ return control;
+ }
+
+ /**
+ * Implements method defined in javax.microedition.media.Controllable.
+ *
+ * @see javax.microedition.media.Controllable
+ * @return the collection of Control objects.
+ */
+ public Control[] getControls()
+ {
+ Control[] controls = new Control[ iControls.size()];
+ Enumeration elements = iControls.elements();
+ int i = 0;
+ // Put all controls to array
+ while (elements.hasMoreElements())
+ {
+ controls[ i ] = (Control)elements.nextElement();
+ i++;
+ }
+ return controls;
+ }
+
+ /**
+ * Creates new Control instance.
+ * All control classes must be in iPrivatePackage package and
+ * extend the ControlImpl base class. Created control is initialized
+ * with native control handle and eventsource handle.
+ *
+ * @param aPlayer Player which will contain the controls.
+ * @param aClassName Control's class name without the package.
+ * @param aControlHandle Handle to native control.
+ * @param aEventSourceHandle Handle to native control source.
+ * @return created control
+ */
+ static private final Control createControl(Player aPlayer,
+ String aClassName,
+ int aControlHandle,
+ int aEventSourceHandle)
+ {
+ ControlImpl control = null;
+
+ // Try to make control instance. If instantion fails, it is an internal
+ // error and can only occur in development time.
+ try
+ {
+ Class controlClass =
+ Class.forName(aClassName);
+ control = (ControlImpl)controlClass.newInstance();
+ control.setHandles(aPlayer, aEventSourceHandle, aControlHandle);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new OutOfMemoryError("Instantiation failed, " + ie.getMessage());
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new OutOfMemoryError("Illegal access, " + iae.getMessage());
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new OutOfMemoryError("Class not found, " + cnfe.getMessage());
+ }
+ return control;
+ }
+
+ /**
+ * Return the amount of controls in native control source.
+ *
+ * @param aNativeHandle Handle to native control source object.
+ */
+ private static native int _getControlsCount(int aNativeHandle);
+
+ /**
+ * Return native handle to control at specified index.
+ *
+ * @param aNativeHandle Handle to native control source object.
+ * @param aControlIndex Control's index.
+ */
+ private static native int _getControlHandle(int aNativeHandle,
+ int aControlIndex);
+
+
+ /**
+ * Returns the control class name that can be used to instantiate Java
+ * object.
+ *
+ * @param aControlHandle Handle to native control.
+ */
+ private static native String _getControlClassName(int aControlHandle);
+
+ /**
+ * Returns the control class name that is the public name for the control.
+ *
+ * @param aControlHandle Handle to native control.
+ */
+ private static native String _getPublicControlClassName(int aControlHandle);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/HttpDataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is an imlementation of DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.MediaException;
+import java.io.IOException;
+import javax.microedition.io.Connection;
+import javax.microedition.io.HttpConnection;
+import javax.microedition.media.Control;
+
+/**
+ * This class extends ConnectorDataSource and adds http connection
+ * return value checking.
+ */
+public class HttpDataSource extends ConnectorDataSource implements SeekControl
+{
+ private static final String SEEK_CONTROL = "SeekControl";
+
+ // true when closed
+ boolean iClosed = false;
+
+ /**
+ * Default constructor
+ */
+ public HttpDataSource(Locator aLocator)
+ throws IOException, MediaException
+ {
+ super(aLocator);
+ }
+
+ /**
+ * From ConnectorDataSource
+ * @see ConnectorDataSource
+ */
+ protected void checkConnection(Connection aConnection) throws IOException
+ {
+ // Must handle also HTTP response codes
+ HttpConnection httpConnection = (HttpConnection)aConnection;
+ if (httpConnection.getResponseCode() != HttpConnection.HTTP_OK)
+ {
+ throw new IOException(
+ "Could not connect to source, " + httpConnection.getResponseMessage());
+ }
+ }
+
+ /**
+ * From SeekControl
+ */
+ public void seek(int aWhere) throws IOException
+ {
+ // Only seek to start is supported.
+ if (aWhere == 0)
+ {
+ disconnect();
+
+ // do not connect if stream is closed
+ if (!iClosed)
+ {
+ connect();
+ }
+
+ if (iClosed)
+ {
+ // disconnect if stream was closed during connect operation
+ disconnect();
+ }
+ }
+ else
+ {
+ throw new IOException("Internal error, invalid position: " + aWhere);
+ }
+ }
+
+ /**
+ * From SeekControl
+ */
+ public void close()
+ {
+ iClosed = true;
+ }
+
+ /**
+ * From Controllable
+ */
+ public Control getControl(String aControlType)
+ {
+ Control control = null;
+ if (aControlType.equals(SEEK_CONTROL))
+ {
+ control = this;
+ }
+ // else return null
+ return control;
+ }
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/InputStreamDataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is an imlementation of DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.protocol.SourceStream;
+import java.io.IOException;
+
+/**
+ * DataSource which has InputStreamSourceStream.
+ */
+public class InputStreamDataSource extends DataSource
+{
+ // DataSource's stream
+ protected InputStreamSourceStream iSourceStream;
+
+ // string that describes the content-type of the media that the source
+ // is providing.
+ protected String iContentType;
+
+ /**
+ * Constructor.
+ * @param aSourceStream SourceSteam
+ * @param aType Content type.
+ */
+ public InputStreamDataSource(InputStreamSourceStream aSourceStream,
+ String aType)
+ {
+ super(null); // no locator
+ iSourceStream = aSourceStream;
+ iContentType = aType;
+ }
+
+ /**
+ * Constructor with Locator and stream
+ * @param aLocator Locator
+ * @param aSourceStream SourceSteam
+ * @param aType Content type.
+ */
+ public InputStreamDataSource(String aLocator,
+ InputStreamSourceStream aSourceStream,
+ String aType)
+ {
+ super(aLocator);
+ iSourceStream = aSourceStream;
+ iContentType = aType;
+ }
+
+
+ /**
+ * Constructor with locator
+ * @param aLocator Locator
+ */
+ public InputStreamDataSource(String aLocator)
+ {
+ super(aLocator);
+ }
+
+ /**
+ * from DataSource
+ * @return Content Type
+ * @see DataSource
+ */
+ public String getContentType()
+ {
+ return iContentType;
+ }
+
+ /**
+ * from DataSource
+ * Connect to the stream
+ * @throws IOException
+ * @see DataSource
+ */
+ public void connect() throws IOException
+ {
+ }
+
+ /**
+ * from DataSource
+ * Disconnect from the stream
+ */
+ public void disconnect()
+ {
+ }
+
+ /**
+ * from DataSource
+ * Put DataSource to STARTED state
+ * @throws IOException Throw if DataSource is in wrong state
+ * @see DataSource
+ */
+ public void start() throws IOException
+ {
+ }
+
+ /**
+ * from DataSource
+ * Stops DataSource
+ * @see DataSource
+ */
+ public void stop()
+ {
+ }
+
+ /**
+ * from DataSource
+ * return sourceStreams of the DataSource
+ *
+ * @exception IllegalStateException Thrown if the source is not connected.
+ * @return set of source streams
+ * @see DataSource
+ */
+ public SourceStream[] getStreams()
+ {
+ SourceStream[] streams = new SourceStream[ 1 ];
+ streams[ 0 ] = iSourceStream;
+ return streams;
+ }
+
+ /**
+ * from interface Controllable
+ * Method return controls of the DataSource
+ * @return Control
+ * @see Controllable
+ * @see DataSource
+ */
+ public Control[] getControls()
+ {
+ return new Control[ 0 ];
+ }
+
+ /**
+ * from interface Controllable
+ * Return a control by the Control Type, not supported
+ * @param aControlType type of the control
+ * @return Control
+ */
+ public Control getControl(String aControlType)
+ {
+ return iSourceStream.getControl("SeekControl");
+ }
+
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/InputStreamSeekControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to mark and seek the inputstream. At present it is
+* implemented to mark and seek to the front of the stream and not anywhere
+* in the middle as the use case only demands such a beahaviour.
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Class InputStreamSeekControl used to mark and seek the inputstream
+ */
+public class InputStreamSeekControl implements SeekControl
+{
+
+
+ private InputStream iInputStream;
+
+ /**
+ * Constructor
+ */
+ public InputStreamSeekControl()
+ {
+
+ iInputStream = null;
+ }
+
+ /*
+ * Constructor
+ * @param aInputStream - inputstream used by the InputStream class
+ * that needs to be marked and streamed
+ */
+ public InputStreamSeekControl(InputStream aInputStream)
+ {
+
+ iInputStream = aInputStream;
+
+ if (iInputStream.markSupported() == true)
+ {
+ iInputStream.mark(0);
+ }
+ }
+
+ /*
+ * Method seeks to the start of the inputstream.
+ * @param aWhere - is ignored as the seeking takes place to
+ * the begining always
+ */
+ public void seek(int aWhere) throws IOException
+ {
+
+
+ if (iInputStream.markSupported() == true)
+ {
+ iInputStream.reset();
+ }
+ }
+
+ public void close()
+ {
+
+ // intentionally left blank
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/InputStreamSourceStream.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SourceStream that reads InputStream
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import com.nokia.microedition.media.InputStreamSeekControl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.microedition.media.protocol.ContentDescriptor;
+import javax.microedition.media.protocol.SourceStream;
+import javax.microedition.media.Control;
+
+/**
+ * This class implements SourceStream interface. From the interface
+ * only read and getSeekType method will be used. This class is used
+ * to read InputStream.
+ */
+public class InputStreamSourceStream implements SourceStream
+{
+ // Stream used to read the content.
+ protected InputStream iInputStream = null;
+
+ private static final String SEEK_CONTROL = "SeekControl";
+
+ private InputStreamSeekControl iSeekControl;
+ /**
+ * Constructor.
+ * @param aInputStream An InputStream
+ */
+ public InputStreamSourceStream(InputStream aInputStream)
+ {
+ setStream(aInputStream);
+ iSeekControl = new InputStreamSeekControl(aInputStream);
+ }
+
+ /**
+ * Constructor.
+ */
+ public InputStreamSourceStream()
+ {
+ }
+
+ /**
+ * Sets new InputStream.
+ * @param aInputStream An InputStream
+ */
+ public final void setStream(InputStream aInputStream)
+ {
+ iInputStream = aInputStream;
+ }
+
+ /**
+ * Closes the InputStream. This method can only be called if MMA
+ * must close the stream.
+ *
+ * @throws NullPointerException if setStream is not called.
+ * @throws IOException If an I/O error occurs
+ */
+ public void close() throws IOException
+ {
+ iInputStream.close();
+ }
+
+ /**
+ * Read from Input Stream
+ * @param aBuffer Input Stream
+ * @param aOffset where reading starts
+ * @param aLength length of read data
+ * @return bytes read
+ * @throws IOException
+ */
+ public int read(byte[] aBuffer, int aOffset, int aLength) throws IOException
+ {
+ return iInputStream.read(aBuffer, aOffset, aLength);
+ }
+
+ /**
+ * Seek type of the stream
+ * @return seek type based on the inputstream's capability
+ */
+ public int getSeekType()
+ {
+ if (iInputStream != null && iInputStream.markSupported() == true)
+ {
+
+ return SEEKABLE_TO_START;
+ }
+ else
+ {
+ return NOT_SEEKABLE;
+ }
+ }
+
+ /**
+ * From interface SourceStream. Method not implemented.
+ * @see SourceStream
+ * @return size of the stream available
+ */
+ public int getTransferSize()
+ {
+ return 0;
+ }
+
+ /**
+ * From interface SourceStream. Method not implemented.
+ * @see SourceStream
+ * @param aWhere where to seek
+ * @return seeked position, allways the current position
+ * @throws IOException
+ */
+ public long seek(long aWhere) throws IOException
+ {
+ return 0;
+ }
+
+ /**
+ * From interface SourceStream. Method not implemented.
+ * @see SourceStream
+ * @return current position
+ */
+ public long tell()
+ {
+ return 0;
+ }
+
+ /**
+ * From interface SourceStream. Method not implemented.
+ * @see SourceStream
+ * @return The content type
+ * @see ContentDescriptor
+ */
+ public ContentDescriptor getContentDescriptor()
+ {
+ // Return empty content descriptor.
+ // This method is not used.
+ return new ContentDescriptor("");
+ }
+
+ /**
+ * From interface SourceStream. Method not implemented.
+ * @see SourceStream
+ * @return content length which is allways 0
+ */
+ public long getContentLength()
+ {
+ return 0;
+ }
+
+ /**
+ * From interface Controllable. Method not implemented.
+ * @see SourceStream
+ * @see Controllable
+ */
+ public Control[] getControls()
+ {
+ Control [] aControls = new Control[1];
+
+ aControls[0] = iSeekControl;
+
+ return aControls;
+ }
+
+ /**
+ * From interface Controllable. Method not implemented.
+ * @param aControlType wanted control type
+ * @return Control null
+ * @See Controllable
+ */
+ public Control getControl(String aControlType)
+ {
+ if (aControlType == SEEK_CONTROL && getSeekType() == SEEKABLE_TO_START)
+ {
+ return iSeekControl;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ /**
+ * @author d35kumar
+ * @return
+ */
+ public InputStream getInputStream(){
+ return iInputStream;
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/InternalPlayer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: InternalPlayer
+*
+*/
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.Player;
+import javax.microedition.media.MediaException;
+
+/**
+ * Internal inteface for MMA players. All players used in MMA must implement
+ * this interface.
+ */
+public interface InternalPlayer extends Player
+{
+ /**
+ * Adds new <code>Control</code> to player.
+ * @param aControl New <code>Control</code> to add.
+ * @param aControlType Fully-qualified name of the control class.
+ * @exception MediaException Thrown if new Control cannot be added to
+ * <code>InternalPlayer</code>.
+ */
+ void addControl(Control aControl, String aControlType)
+ throws MediaException;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/Locator.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.MediaException;
+
+/**
+ * Locator parsing class
+ */
+public class Locator
+{
+ private static final String PROTOCOL_SEPARATOR = "://";
+ private static final char PARAMETER_SEPARATOR = '?';
+ private final String iLocator;
+
+ /**
+ * Constructor
+ * @param aLocator Locator to be parsed
+ */
+ public Locator(String aLocator)
+ {
+ iLocator = aLocator;
+ }
+ /**
+ * Parses the protocol part of the locator e.g. returns
+ * "capture" from "capture://audio?encoding=amr" locator
+ * @return parsed protocol
+ * @throw MediaException if Protocol cannot
+ * be parsed from the locator
+ */
+ public String getProtocol() throws MediaException
+ {
+ // Find protocol separator
+ int pSep = iLocator.indexOf(PROTOCOL_SEPARATOR);
+
+ // Protocol must exist
+ if (pSep == -1)
+ {
+ throw new MediaException(
+ "Could not create player, URI separator not found");
+ }
+ return iLocator.substring(0, pSep);
+ }
+
+ /**
+ * Parses the middle part of the locator e.g. returns
+ * "audio" from "capture://audio?encoding=amr" locator
+ * @return parsed middle part
+ * @throw MediaException if middle part cannot
+ * be parsed from the locator
+ */
+ public String getMiddlePart() throws MediaException
+ {
+ // Find possible parameter separator
+ int parSep = iLocator.indexOf(PARAMETER_SEPARATOR);
+
+ // No parameters
+ if (parSep == -1)
+ {
+ parSep = iLocator.length();
+ }
+
+ return iLocator.substring(getProtocol().length() +
+ PROTOCOL_SEPARATOR.length(), parSep);
+ }
+
+ /**
+ * Parses possible parameters of the locator e.g. returns
+ * "encoding=amr" from "capture://audio?encoding=amr" locator
+ * @return parsed parameters or <code>null</code> if there is
+ * not parameters
+ */
+ public String getParameters()
+ {
+ // Find possible parameter separator
+ int parSep = iLocator.indexOf(PARAMETER_SEPARATOR);
+
+ String locator = null;
+
+ // Null is returned if there is no parameters
+ if (parSep != -1)
+ {
+ locator = iLocator.substring(parSep + 1);
+ }
+
+ return locator;
+ }
+
+ /**
+ * Returns the whole locator string
+ * @return locator used to create this instance
+ */
+ public String getLocatorString()
+ {
+ return iLocator;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/MMAInvokeListener.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+/**
+ * This interface is used notify other components when MMA event source is
+ * created.
+ */
+public interface MMAInvokeListener
+{
+ /**
+ * This method is called when MMA is invoked for the first time.
+ * @param aEventSourceHandle Handle to native MMA event source.
+ */
+ void notifyInvoke(int aEventSourceHandle);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/NativeError.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Landmark store manager for handling landmark stores
+ *
+*/
+
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+
+/**
+ * A utility class for declaring and handling native SymbianOS error codes. All
+ * error codes that are used in Java from native code should be declared here
+ * and referenced from this class.
+ */
+public final class NativeError
+{
+ public static final String NATIVE_ERROR_MESSAGE = "OS error = ";
+
+ // SymbianOS error codes
+ public static final int KErrNone = 0;
+
+ public static final int KErrNotFound = -1;
+
+ public static final int KErrGeneral = -2;
+
+ public static final int KErrCancel = -3;
+
+ public static final int KErrNoMemory = -4;
+
+ public static final int KErrNotSupported = -5;
+
+ public static final int KErrArgument = -6;
+
+ public static final int KErrOverflow = -9;
+
+ public static final int KErrAlreadyExists = -11;
+
+ public static final int KErrPathNotFound = -12;
+
+ public static final int KErrDied = -13;
+
+ public static final int KErrNotReady = -18;
+
+ public static final int KErrCorrupt = -20;
+
+ public static final int KErrAccessDenied = -21;
+
+ public static final int KErrWrite = -23;
+
+ public static final int KErrEof = -25;
+
+ public static final int KErrDiskFull = -26;
+
+ public static final int KErrBadName = -28;
+
+ public static final int KErrCommsLineFail = -29;
+
+ public static final int KErrTimedOut = -33;
+
+ public static final int KErrDisconnected = -36;
+
+ public static final int KErrTooBig = -40;
+
+ public static final int KErrDivideByZero = -41;
+
+ public static final int KErrHardwareNotAvailable = -44;
+
+ // Not intended to be constructed
+ private NativeError()
+ {
+ }
+
+ /**
+ * Checks for basic native error codes that map to standard Java exceptions
+ * and throws the exception if the error code matches. Otherwise throws an
+ * IOException.
+ *
+ * @param aError
+ * Possible error code.
+ * @return Value passed in is returned if not an error.
+ */
+ public static int checkIO(int aError,
+ String aErrorMessage) throws IOException
+ {
+ if (aError < KErrNone)
+ {
+ switch (aError)
+ {
+ case KErrNoMemory:
+ throw new OutOfMemoryError(aErrorMessage +
+ Integer.toString(aError));
+ // KErrArgument must throw IllegalArgumentException
+ // otherwise lcdui will break, so don't change this.
+ case KErrArgument:
+ throw new IllegalArgumentException(aErrorMessage +
+ Integer.toString(aError));
+ case KErrDivideByZero:
+ throw new ArithmeticException(aErrorMessage +
+ Integer.toString(aError));
+ default:
+ throw new IOException(aErrorMessage + errorMessage(aError));
+ }
+ }
+ return aError;
+ }
+
+ /**
+ * Checks for basic native error codes that map to standard Java exceptions
+ * and throws the exception if the error code matches. Otherwise throws
+ * basic Error class.
+ *
+ * @param aError
+ * Possible error code.
+ * @param aThrowAlways
+ * Determines whether a default exception is thrown if the error
+ * code is not recognised.
+ * @return Value passed in is returned if not an error.
+ * @throws Error
+ * If the error code does not match any exception thrown in
+ * checkExplicitOnly, a default exception is thrown here.
+ */
+ public static int check(int aError, String aErrorMessage)
+ {
+ if (aError < KErrNone)
+ {
+ checkExplicitOnly(aError);
+ throw new Error(aErrorMessage + errorMessage(aError));
+ }
+ return aError;
+ }
+
+
+ /**
+ * Checks if the object is a null reference, and throws OutOfMemoryError
+ * if this is the case. Useful for checking for OOM when Java objects
+ * returned from a native method.
+ *
+ * @param aObject Object that may be null.
+ * @return Value passed in is returned if not an error.
+ */
+ public static Object checkOOM( Object aObject )
+ {
+ if ( aObject == null )
+ {
+ throw new OutOfMemoryError();
+ }
+ return aObject;
+ }
+
+ /**
+ * Checks if the error code represents out of memory, and throws Java Error
+ * if true. Does not throw anything otherwise.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an out of memory error.
+ */
+ public static int checkOOMOnly(int aError)
+ {
+ if (aError == KErrNoMemory)
+ {
+ throw new OutOfMemoryError();
+ }
+ return aError;
+ }
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise throws basic Error class.
+ *
+ * @param aError Possible error code.
+ * @param aThrowAlways Determines whether a default exception is thrown
+ * if the error code is not recognised.
+ * @return Value passed in is returned if not an error.
+ * @throws Error If the error code does not match any exception thrown
+ * in checkExplicitOnly, a default exception is thrown here.
+ */
+ public static int check(int aError)
+ {
+ if (aError < KErrNone)
+ {
+ checkExplicitOnly(aError);
+ throw new Error(errorMessage(aError));
+ }
+ return aError;
+ }
+
+ /**
+ * Checks for basic native error codes that map to standard Java
+ * exceptions and throws the exception if the error code matches.
+ * Otherwise just returns the error.
+ *
+ * @param aError Possible error code.
+ * @return Value passed in is returned if not an error.
+ * @throws OutOfMemoryError If aError equals KErrNoMemory.
+ * @throws IllegalArgumentException If aError equals KErrArgument
+ * @throws ArithmeticException If aError equals KErrDivideByZero
+ */
+ public static int checkExplicitOnly( int aError )
+ {
+ if ( aError < KErrNone )
+ {
+ switch ( aError )
+ {
+ case KErrNoMemory:
+ throw new OutOfMemoryError();
+ // KErrArgument must throw IllegalArgumentException
+ // otherwise lcdui will break, so don't change this.
+ case KErrArgument:
+ throw new IllegalArgumentException();
+ case KErrDivideByZero:
+ throw new ArithmeticException();
+ default:
+ // Do nothing
+ }
+ }
+ return aError;
+ }
+
+ /**
+ * Returns a string formatted with generic text to indicate where the error
+ * code comes from and the error code given.
+ *
+ * @param A
+ * native error code.
+ * @return A string containing the error code.
+ */
+ public static String errorMessage(int aError)
+ {
+ String result = NATIVE_ERROR_MESSAGE.concat(Integer.toString(aError));
+ return result;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/NativePlayerFactory.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.protocol.DataSource;
+
+/**
+ * Factory for creating native and java instances of the players
+ */
+public class NativePlayerFactory
+{
+ /**
+ * Do not allow contruction.
+ */
+ private NativePlayerFactory()
+ {
+ }
+
+ /**
+ * Creates native and java instances with Locator
+ * @param aLocator Locator used for creating native player
+ * @param aSource The DataSource that provides the media content.
+ * @return new instance of <code>InternalPlayer</code>
+ */
+ public static InternalPlayer createPlayer(Locator aLocator,
+ DataSource aSource)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ int playerHandle = _createPlayerLocator(ManagerImpl.getEventSource(),
+ ManagerImpl.getHandle(),
+ aLocator.getProtocol(),
+ aLocator.getMiddlePart(),
+ aLocator.getParameters());
+ return createPlayer(playerHandle, aSource);
+ }
+
+ /**
+ * Creates native and java instances with Locator
+ * @param aLocator Locator used for creating native player
+ * @return new instance of <code>InternalPlayer</code>
+ */
+ public static InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ return createPlayer(aLocator, null);
+ }
+
+ /**
+ * Creates native and java instances with content-type
+ * @param aContentType Content type for creating native counter-part
+ * @param aSource The DataSource that provides the media content.
+ * @return new instance of <code>InternalPlayer</code>
+ */
+ public static InternalPlayer createPlayer(String aContentType,
+ DataSource aSource)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ int playerHandle = _createPlayerContentType(ManagerImpl.getEventSource(),
+ ManagerImpl.getHandle(),
+ aContentType);
+ return createPlayer(playerHandle, aSource);
+ }
+
+ /**
+ * Creates native and java instances with header data
+ * @param aHeaderData HeaderData used for recognizing content
+ * @param aSource The DataSource that provides the media content.
+ * @return new instance of <code>InternalPlayer</code>
+ */
+ public static InternalPlayer createPlayer(byte[] aHeaderData,
+ DataSource aSource)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ int playerHandle = _createPlayerHeaderData(ManagerImpl.getEventSource(),
+ ManagerImpl.getHandle(),
+ aHeaderData);
+ return createPlayer(playerHandle, aSource);
+ }
+
+ /**
+ * Creates java instance from native handle and DataSource
+ */
+ private static InternalPlayer createPlayer(int aPlayerHandle,
+ DataSource aSource)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ // if aPlayerHandle is 0 null will be returned
+ InternalPlayer player = null;
+
+ if (aPlayerHandle < 0)
+ {
+ // negative handle indicates native error code
+ throw new MediaException(
+ "Could not create player, Symbian OS error: " +
+ aPlayerHandle);
+ }
+ else if (aPlayerHandle > 0)
+ {
+ // Native player was created
+ if (aSource == null)
+ {
+ player = new PlayerImpl(aPlayerHandle);
+ }
+ else
+ {
+ player = new SourcePlayer(aSource, aPlayerHandle);
+ }
+ }
+ return player;
+ }
+
+ private static native int _createPlayerLocator(int aEventSource,
+ int aManagerHandle,
+ String aProtocol,
+ String aMiddlePart,
+ String aParameters);
+
+ private static native int _createPlayerContentType(int aEventSource,
+ int aManagerHandle,
+ String aContentType);
+
+ private static native int _createPlayerHeaderData(int aEventSource,
+ int aManagerHandle,
+ byte[] aHeaderData);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/PlayerBase.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is general player implementation of Player interface
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.TimeBase;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Manager;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * This abstract player implementation must be derived. This class implements
+ * general player functionality such as state checking.
+ */
+public abstract class PlayerBase implements InternalPlayer
+{
+ protected TimeBase iTimeBase;
+
+ // state as defined in Player interface
+ // at first player is unrealized
+ protected int iState = UNREALIZED;
+
+ /**
+ * Constructor
+ */
+ protected PlayerBase()
+ {
+ }
+
+ /**
+ * Every method has to check if player is closed with this method
+ */
+ protected void closeCheck()
+ {
+ if (iState == CLOSED)
+ {
+ throw new IllegalStateException("Player is CLOSED.");
+ }
+ }
+
+ /**
+ * This method is from methods that are
+ * not allowed to be called, when player
+ * is in UNREALIZED state
+ */
+ protected void unrealizedCheck()
+ {
+ if (getState() == UNREALIZED)
+ {
+ throw new IllegalStateException("Player is UNREALIZED.");
+ }
+ }
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public TimeBase getTimeBase()
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ // set default timebase
+ if (iTimeBase==null)
+ {
+ iTimeBase = Manager.getSystemTimeBase();
+ }
+
+ return iTimeBase;
+ }
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public void setTimeBase(TimeBase aMaster) throws MediaException
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ // A MediaException is thrown if
+ // setTimeBase is called on a STARTED Player.
+ if (getState() == STARTED)
+ {
+ throw new IllegalStateException("Player is STARTED");
+ }
+
+ if (aMaster == null)
+ {
+ // set default timebase
+ iTimeBase = Manager.getSystemTimeBase();
+ }
+ else
+ {
+ if (aMaster instanceof SystemTimeBase)
+ {
+ iTimeBase = aMaster;
+ return;
+ }
+ else
+ {
+ // default doesn't support any other TimeBases
+ throw new MediaException("Invalid timebase or timebase not supported");
+ }
+ }
+ }
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public void realize() throws MediaException
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"+ PlayerBase.realize() ");
+ closeCheck();
+ int state = getState();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"+ PlayerBase.realize() after getstate() ");
+
+ // If realize is called when the Player is in the
+ // REALIZED, PREFETCHTED or STARTED state,
+ // the request will be ignored.
+ if (state == UNREALIZED)
+ {
+ doRealize();
+ }
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"- PlayerBase.realize() ");
+ }
+
+ /**
+ * Called from realize method. This method must be implemented in
+ * derived class.
+ * @see realize
+ */
+ abstract protected void doRealize() throws MediaException;
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public void prefetch() throws MediaException
+ {
+ realize();
+
+ // prefetch must be ignored in other states
+ if (getState() == REALIZED)
+ {
+ doPrefetch();
+ }
+ }
+
+ /**
+ * Called from prefetch method.
+ * @see prefetch
+ */
+ abstract protected void doPrefetch() throws MediaException;
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void deallocate()
+ {
+ try
+ {
+ stop();
+ }
+ catch (MediaException me)
+ {
+ // if stop fails we can do nothing
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA::PlayerBase: Stop failed in deallocate.", me);
+ }
+ if (getState() == PREFETCHED)
+ {
+ doDeallocate();
+ }
+ }
+
+ /**
+ * Called from deallocate method.
+ */
+ abstract protected void doDeallocate();
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void stop() throws MediaException
+ {
+ closeCheck();
+ if (getState() == STARTED)
+ {
+ doStop();
+ }
+ }
+
+ /**
+ * Called from realize method.
+ */
+ abstract protected void doStop() throws MediaException;
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void close()
+ {
+ /*
+ Releases all resources and cease all activity.
+ The close method indicates that the Player will no
+ longer be used and can shut itself down.
+ Methods invoked on a closed Player will throw RuntimeExceptions.
+ */
+ if (iState != CLOSED)
+ {
+ deallocate();
+ iState = CLOSED;
+ doClose();
+ }
+ }
+
+ /**
+ * Called from close method.
+ */
+ abstract protected void doClose();
+
+ /**
+ * interface Player.
+ * Derived classes may use this method to check parameter and state.
+ * @see Player
+ */
+ public void setLoopCount(int aCount)
+ {
+ closeCheck();
+ // -1 is valid count value meaning indefinitely looping
+ if ((aCount == 0) ||
+ (aCount < -1))
+ {
+ throw new java.lang.IllegalArgumentException(
+ "Invalid loop count " + aCount + ", loop count cannot be 0 or < -1");
+ }
+ if (getState() == STARTED)
+ {
+ throw new IllegalStateException("Player is STARTED");
+ }
+ }
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public long setMediaTime(long aNow) throws MediaException
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ long now = aNow;
+
+ if (now < 0)
+ {
+ // Setting the media time to negative values
+ // will effectively set the media time to zero.
+ now = 0;
+ }
+ return now;
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/PlayerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,487 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is native player implementation of Player interface
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.MediaException;
+import com.nokia.microedition.media.NativeError;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.utils.Logger;
+
+public class PlayerImpl extends PlayerBase
+{
+ // CMMAPlayer handle
+ protected int iPlayerHandle;
+
+ // Controls container
+ protected ControlContainer iControls;
+
+ // object for waiting native asynchronous method calls
+ protected Object iLockObject = new Object();
+ protected Object iPrefetchLockObject = new Object();
+
+ // native error code
+ protected int iError;
+
+ protected PlayerListenerImpl iPlayerListenerImpl;
+
+ private Finalizer mFinalizer;
+
+ private boolean iWaitFlag = true;
+
+ private boolean iStartWaitFlag = true;
+
+ /**
+ * Constructor
+ * @param aPlayerHandle handle to player (CMMAPlayer)
+ */
+ public PlayerImpl(int aPlayerHandle)
+ {
+ iPlayerHandle = aPlayerHandle;
+
+ iPlayerListenerImpl = new PlayerListenerImpl(this);
+
+ // Initialize player
+ int err = _initPlayer(iPlayerListenerImpl,
+ ManagerImpl.getEventSource(),
+ iPlayerHandle);
+ if (err < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError(NativeError.errorMessage(err));
+ }
+
+ mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+
+ iControls = ControlContainer.populateControls(this,
+ ManagerImpl.getEventSource(),
+ iPlayerHandle);
+ }
+
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ /**
+ * This method is called when garbage collection occurs
+ * to delete native object
+ */
+ protected void registeredFinalize()
+ {
+ close();
+ }
+
+ /**
+ * Returns native player handle.
+ * @return Native player handle.
+ */
+ public int getPlayerHandle()
+ {
+ return iPlayerHandle;
+ }
+
+ /**
+ * @return Player's PlayerListenerImpl
+ */
+ public PlayerListenerImpl getPlayerListenerImpl()
+ {
+ return iPlayerListenerImpl;
+ }
+
+ /**
+ * Adds control to the player.
+ * @param aControl Player's control
+ * @param aControlName Identifies the control. Name must contain
+ * full package information
+ */
+ public void addControl(javax.microedition.media.Control aControl,
+ String aControlName)
+ {
+ iControls.addControl(aControl, aControlName);
+ }
+
+ /**
+ * interface Controllable
+ * Return controls
+ * @return list of controls
+ * @see Controllable
+ */
+ public javax.microedition.media.Control[] getControls()
+ {
+ closeCheck();
+ unrealizedCheck();
+ return iControls.getControls();
+ }
+
+ /**
+ * interface Controllable
+ * get control by content type
+ * @param aControlType content type of wanted control
+ * @return control
+ * @see Controllable
+ * @see Control
+ */
+ public javax.microedition.media.Control getControl(String aControlType)
+ {
+ closeCheck();
+ unrealizedCheck();
+ return iControls.getControl(aControlType);
+ }
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void addPlayerListener(PlayerListener aPlayerListener)
+ {
+ closeCheck();
+ iPlayerListenerImpl.addPlayerListener(aPlayerListener);
+ }
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public void removePlayerListener(PlayerListener aPlayerListener)
+ {
+ closeCheck();
+ iPlayerListenerImpl.removePlayerListener(aPlayerListener);
+ }
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public int getState()
+ {
+ int state = CLOSED;
+ if (iState != CLOSED)
+ {
+ state = _getState(ManagerImpl.getEventSource(), iPlayerHandle);
+ }
+ return state;
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doRealize() throws MediaException
+ {
+ int err = _realize(ManagerImpl.getEventSource(), iPlayerHandle);
+
+ if (err < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Realize failed, Symbian OS error: " + err);
+ }
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doPrefetch() throws MediaException
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doPrefetch");
+ synchronized(iPrefetchLockObject)
+ {
+ if (PREFETCHED == getState())
+ return;
+ synchronized (iLockObject)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doPrefetch inside try"+Thread.currentThread().getName());
+ //int retval[] = new int[1];
+ int err = _prefetch(ManagerImpl.getEventSource(), iPlayerHandle);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doPrefetch err = " + err);
+ if (err < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Prefetch failed, Symbian OS error: " + err);
+ }
+ if(iWaitFlag)
+ {
+ try
+ {
+ // wait until actionCompleted( int aError ) is called
+ iLockObject.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ // cannot occur
+ }
+ }
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doPrefetch Sync end");
+ } // end synchronized (iLockObject)
+ }
+ if (iError < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Prefetch failed, Symbian OS error: " + iError);
+ }
+ }
+
+ /**
+ * Notify that action is completed. Called from native side.
+ * @param aError error code
+ */
+ private void actionCompleted(int aError)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"actionCompleted callback11 aError ="+ aError + " "+Thread.currentThread().getName());
+ iError = aError;
+
+ synchronized (iLockObject)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"actionCompleted callback inside synchronized (iLockObject)");
+ iLockObject.notify();
+ }
+ }
+
+ private void actionCompletedFile()
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : actionCompletedFile");
+ iWaitFlag = false;
+
+ }
+
+ private void actionCompletedStart()
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : actionCompletedStart");
+ iStartWaitFlag = false;
+
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doDeallocate()
+ {
+ int ret = _deallocate(ManagerImpl.getEventSource(), iPlayerHandle);
+ if (ret < NativeError.KErrNone)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
+ "_deallocate() failed: err=" + ret);
+ }
+ }
+
+ /**
+ * From Player.
+ * @see Player
+ */
+ public void start() throws MediaException
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : start()");
+ prefetch();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl, start, state = "+getState());
+ // Only preteched player may be started. If player is already started
+ // this method returns silently.
+ if (getState() == PREFETCHED)
+ {
+ synchronized (iLockObject)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl, before calling native _start() thread is =" +Thread.currentThread().getName());
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl, before calling native _start()");
+ int err = _start(ManagerImpl.getEventSource(), iPlayerHandle);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl, before calling native _start( ) returned : err = "+err);
+ if (err < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Start failed, Symbian OS error: " + err);
+ }
+ if (iError < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Start failed, Symbian OS error: " + iError);
+ }
+ if(iStartWaitFlag)
+ {
+ try
+ {
+ // wait until actionCompleted( int aError ) is called
+ iLockObject.wait(); // only for tck run
+ }
+ catch (InterruptedException ie)
+ {
+ // cannot occur
+ }
+
+ }
+ }
+ }
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doStop() throws MediaException
+ {
+ /*
+ Stops the Player. It will pause the playback at the current media time.
+ Calling start will resume the playback from where it is stopped.
+ If stop is called on a stopped Player, the request is ignored.
+ */
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doStop()");
+ int err = _stop(ManagerImpl.getEventSource(), iPlayerHandle);
+ if (err < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Stop failed, Symbian OS error: " + err);
+ }
+ // After this request is completed,
+ // the Player is in the PREFETCHED state.
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doClose()
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doclose() 1");
+ _close(ManagerImpl.getEventSource(), iPlayerHandle);
+
+ if (iPlayerHandle > NativeError.KErrNone) // construction has succeed
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doclose() 2");
+ // notify the controls
+ iControls.dispose();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doclose() 3");
+
+ // delete the native object
+ _dispose(ManagerImpl.getEventSource(), iPlayerHandle);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerImpl.java : doclose() 4");
+ iPlayerHandle = 0; // Do not use native object anymore
+ }
+ }
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void setLoopCount(int aCount)
+ {
+ super.setLoopCount(aCount);
+ _setLoopCount(ManagerImpl.getEventSource(), iPlayerHandle, aCount);
+ }
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public long getDuration()
+ {
+ closeCheck();
+ long duration = _duration(ManagerImpl.getEventSource(), iPlayerHandle);
+ if (duration < NativeError.KErrNone)
+ {
+ duration = TIME_UNKNOWN;
+ }
+ return duration;
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public long setMediaTime(long aNow) throws MediaException
+ {
+ long time = _setMediaTime(ManagerImpl.getEventSource(),
+ iPlayerHandle,
+ super.setMediaTime(aNow));
+ if (time < NativeError.KErrNone)
+ {
+ throw new MediaException(
+ "Could not set media time, Symbian OS error: " + time);
+ }
+ return time;
+ }
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public long getMediaTime()
+ {
+ closeCheck();
+ long time = _getMediaTime(ManagerImpl.getEventSource(), iPlayerHandle);
+ if (time < NativeError.KErrNone)
+ {
+ time = TIME_UNKNOWN;
+ }
+ return time;
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public String getContentType()
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ return _getContentType(iPlayerHandle);
+ }
+
+ // JNI
+ private native int _initPlayer(Object aPlayerListenerObject,
+ int aEventSource,
+ int aPlayerHandle);
+
+ private static native int _start(int aEventPoster, int aPlayer);
+ private static native int _stop(int aEventPoster, int aPlayer);
+ private static native int _close(int aEventPoster, int aPlayer);
+ private static native int _prefetch(int aEventPoster, int aPlayer);
+
+ private static native int _setLoopCount(int aEventPoster, int aPlayer,
+ int aLoopCount);
+
+ private static native int _realize(int aEventPoster, int aPlayer);
+ private static native long _duration(int aEventPoster, int aPlayer);
+ private static native long _setMediaTime(int aEventPoster, int aPlayer,
+ long aNow);
+
+ private static native int _deallocate(int aEventPoster, int aPlayer);
+ private static native long _getMediaTime(int aEventPoster, int aPlayer);
+ private static native int _getState(int aEventPoster, int aPlayer);
+
+ protected static native int _addSourceStream(int aEventPoster,
+ int aPlayerHandle,
+ Object aSourceStreamReader);
+
+ private static native String _getContentType(int aPlayerHandle);
+
+ private static native void _dispose(int aEventSourceHandle,
+ int aObjectHandle);
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/PlayerListenerImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is player listener implementation
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.Player;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.Control;
+import javax.microedition.media.control.VideoControl;
+import java.util.Vector;
+import java.util.Enumeration;
+//import com.symbian.midp.runtime.MIDletExecutor;
+//import com.symbian.midp.runtime.MIDletInstance;
+import com.nokia.mj.impl.utils.Logger;
+
+
+public class PlayerListenerImpl
+{
+ // PlayerListener event types that come from native side
+ protected static final int E_STARTED = 0;
+ protected static final int E_STOPPED = 1;
+ protected static final int E_STOPPED_AT_TIME = 2;
+ protected static final int E_END_OF_MEDIA = 3;
+ protected static final int E_DURATION_UPDATED = 4;
+ protected static final int E_AUDIO_DEVICE_UNAVAILABLE = 5;
+ protected static final int E_VOLUME_CHANGED = 6;
+ protected static final int E_SIZE_CHANGED = 7;
+ protected static final int E_ERROR = 8;
+ protected static final int E_CLOSED = 9;
+ protected static final int E_RECORD_STARTED = 10;
+ protected static final int E_RECORD_STOPPED = 11;
+ protected static final int E_PRIVATE_DATA_AVAILABLE = 12;
+ protected static final int E_PRIVATE_DATA_OVERWRITTEN = 13;
+ protected static final int E_BUFFERING_STARTED = 14;
+ protected static final int E_BUFFERING_STOPPED = 15;
+ protected static final int E_RECORD_ERROR = 16;
+ // For global volume info
+ protected static final int E_NOKIA_EXTERNAL_VOLUME_EVENT = 17;
+ // for Audio Routing preferences change
+ protected static final int E_AUDIO_ROUTING_PREFERENCE_CHANGED_EVENT = 18;
+
+ private static final String KVideoControlClassName =
+ "javax.microedition.media.control.VideoControl";
+
+ // maps int event types to String event types
+ private static Vector sEventTypes;
+
+ static
+ {
+ sEventTypes = new Vector(19); // there's 17 event types + 1 global volume event + 1 Audio Routing Preference Change Event
+ sEventTypes.addElement(PlayerListener.STARTED); // E_STARTED
+ sEventTypes.addElement(PlayerListener.STOPPED); // E_STOPPED
+ sEventTypes.addElement(PlayerListener.STOPPED_AT_TIME); // E_STOPPED_AT_TIME
+ sEventTypes.addElement(PlayerListener.END_OF_MEDIA); // E_END_OF_MEDIA
+ sEventTypes.addElement(PlayerListener.DURATION_UPDATED); // E_DURATION_UPDATED
+ sEventTypes.addElement(PlayerListener.DEVICE_UNAVAILABLE); // E_AUDIO_DEVICE_UNAVAILABLE
+ sEventTypes.addElement(PlayerListener.VOLUME_CHANGED); // E_VOLUME_CHANGED
+ sEventTypes.addElement(PlayerListener.SIZE_CHANGED); // E_SIZE_CHANGED
+ sEventTypes.addElement(PlayerListener.ERROR); // E_ERROR
+ sEventTypes.addElement(PlayerListener.CLOSED); // E_CLOSED
+ sEventTypes.addElement(PlayerListener.RECORD_STARTED); // E_RECORD_STARTED
+ sEventTypes.addElement(PlayerListener.RECORD_STOPPED); // E_RECORD_STOPPED
+ sEventTypes.addElement(null); // E_PRIVATE_DATA_AVAILABLE
+ sEventTypes.addElement(null); // E_PRIVATE_DATA_OVERWRITTEN
+ sEventTypes.addElement(PlayerListener.BUFFERING_STARTED); // E_BUFFERING_STARTED
+ sEventTypes.addElement(PlayerListener.BUFFERING_STOPPED); // E_BUFFERING_STOPPED
+ sEventTypes.addElement(PlayerListener.RECORD_ERROR); // E_RECORD_ERROR
+ sEventTypes.addElement("com.nokia.external.volume.event"); // E_NOKIA_EXTERNAL_VOLUME_EVENT
+ sEventTypes.addElement("com.nokia.audiooutputchange.event"); // E_AUDIO_ROUTING_PREFERENCE_CHANGED_EVENT
+ }
+
+ private Vector iPlayerListeners = new Vector();
+ private Player iPlayer;
+
+ /**
+ * Constructor
+ * @param aPlayer Handle to player
+ */
+ public PlayerListenerImpl(Player aPlayer)
+ {
+ iPlayer = aPlayer;
+ }
+
+ /**
+ * Adds PlayerListener
+ * @param aPlayerListener Listener that will be added
+ * @see PlayerListener
+ */
+ public synchronized void addPlayerListener(PlayerListener aPlayerListener)
+ {
+ if (aPlayerListener == null)
+ {
+ return;
+ }
+ if (!iPlayerListeners.contains(aPlayerListener))
+ {
+ iPlayerListeners.addElement(aPlayerListener);
+ }
+ }
+
+
+ /**
+ * Removes PlayerListener
+ * @param aPlayerListener Listener that will be removed
+ * @see PlayerListener
+ */
+ public synchronized void removePlayerListener(PlayerListener aPlayerListener)
+ {
+ iPlayerListeners.removeElement(aPlayerListener);
+ }
+
+ /**
+ * Deliveres event to all registered PlayerListeners
+ * @param aEventType type defined in PlayerListener
+ * @param aEventData data for event
+ */
+ public synchronized void postEvent(String aEventType, Object aEventData)
+ {
+ Enumeration listeners = iPlayerListeners.elements();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerListenerImpl.java::PostEvent" + listeners);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlayerListenerImpl.java::PostEvent" + aEventType + aEventData );
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"PlaerListenerImpl.java::PostEvent, this = "+this +" iPlayerListeners = "+iPlayerListeners);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Listeners count = "+iPlayerListeners.size());
+ while (listeners.hasMoreElements())
+ {
+ PlayerListener listener = (PlayerListener)listeners.nextElement();
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"listener = "+listener);
+
+ CallBackThread obj = new CallBackThread(aEventType,aEventData,listener,iPlayer);
+ Thread t = new Thread(obj);
+ t.start();
+ }
+ }
+
+ /**
+ * Posts a long event. Called from native implementation.
+ * @param aEventType Event type
+ * @param aEventData Event data
+ */
+ private void postLongEvent(int aEventType, long aEventData)
+ {
+ // event has come after this has been gc'd
+ if (this == null)
+ {
+ return;
+ }
+ Long eventData = new Long(aEventData);
+ postEvent(getEventType(aEventType), eventData);
+ }
+
+ /**
+ * Posts a string event. Called from native implementation.
+ * @param aEventType Event type
+ * @param aEventData Event data
+ */
+ private void postStringEvent(int aEventType, String aEventData)
+ {
+ // event has come after this has been gc'd
+ if (this == null)
+ {
+ return;
+ }
+ if (aEventType == E_SIZE_CHANGED)
+ {
+ VideoControl vc = (VideoControl)iPlayer.getControl(KVideoControlClassName);
+ postEvent(getEventType(aEventType), vc);
+ }
+ else
+ {
+ postEvent(getEventType(aEventType), aEventData);
+ }
+ }
+
+ /**
+ * Posts object event. Called from native implementation.
+ * @param aEventType Event type
+ * @param aEventData Event data
+ */
+ private void postObjectEvent(int aEventType, Object aEventData)
+ {
+ // event has come after this has been gc'd
+ if (this == null)
+ {
+ return;
+ }
+ postEvent(getEventType(aEventType), aEventData);
+ }
+
+ /**
+ * Posts a control event. Called from native implementation.
+ * @param aEventType Event type
+ * @param aEventData Event data
+ */
+ private void postControlEvent(int aEventType, String aEventData)
+ {
+ // event has come after this has been gc'd
+ if (this == null)
+ {
+ return;
+ }
+ Control eventData = iPlayer.getControl(aEventData);
+ postEvent(getEventType(aEventType), eventData);
+ }
+
+ /**
+ * Converts int eventType to String eventType
+ * @param aEventType event type to be converted
+ * @return converted event type
+ */
+ private String getEventType(int aEventType)
+ {
+ String eventType = null;
+ eventType = (String)sEventTypes.elementAt(aEventType);
+ return eventType;
+ }
+
+ class CallBackThread extends Thread
+ {
+ private String iEventType;
+ private Object iEventData;
+ private PlayerListener iListener;
+ private Player iPlayer;
+
+ public CallBackThread(String aEventType, Object aEventData, PlayerListener aListener, Player aPlayer)
+ {
+ iEventType = aEventType;
+ iEventData = aEventData;
+ iListener = aListener;
+ iPlayer = aPlayer;
+
+
+ }
+
+ public void doCallBack()
+ {
+
+
+ }
+ public void run()
+ {
+ iListener.playerUpdate(iPlayer,
+ iEventType,
+ iEventData);
+
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"after calling midlet playerupdate");
+
+
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/PlugIn.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PlugIn used to extend mma
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.MediaException;
+
+/**
+ * This interface can be used extend Mobile Media API. This interface must
+ * be registered to <code>ManagerImpl</code> with <code>addPlugIn</code>
+ * method. <code>ManagerImpl</code> instance can be obtained with
+ * <code>ManagerImpl.getInstance</code> method.
+ * <code>getSupportedContentTypes</code> and <code>getSupportedProtocols</code>
+ * methods will be called when equivalent Manager methods are called.
+ *
+ * @see ManagerImpl.addPlugin
+ */
+public interface PlugIn
+{
+ /**
+ * Return the list of supported content types for the given protocol.
+ * <p>
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content types returned.
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocol used.
+ * <p>
+ * For example, if the given <code>protocol</code>
+ * is <code>"http"</code>,
+ * then the supported content types that can be played back
+ * with the <code>http</code> protocol will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the <code>protocol</code>,
+ * all the supported content types for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>protocol</code> is an invalid or
+ * unsupported protocol, then an empty array will be returned.
+ *
+ * @param aProtocol The input protocol for the supported content types.
+ * @return The list of supported content types for the given protocol.
+ */
+ String[] getSupportedContentTypes(String aProtocol);
+
+ /**
+ * Return the list of supported protocols given the content
+ * type. The protocols are returned
+ * as strings which identify what locators can be used for creating
+ * <code>Player</code>'s.
+ * <p>
+ * See <a href="#media-protocol">protocol name</a> for the syntax
+ * of the protocols returned.
+ * See <a href="#content-type">content types</a> for the syntax
+ * of the content type used.
+ * <p>
+ * For example, if the given <code>content_type</code>
+ * is <code>"audio/x-wav"</code>, then the supported protocols
+ * that can be used to play back <code>audio/x-wav</code>
+ * will be returned.
+ * <p>
+ * If <code>null</code> is passed in as the
+ * <code>content_type</code>,
+ * all the supported protocols for this implementation
+ * will be returned. The returned array must be non-empty.
+ * <p>
+ * If the given <code>content_type</code> is an invalid or
+ * unsupported content type, then an empty array will be returned.
+ *
+ * @param aContentType The content type for the supported protocols.
+ * @return The list of supported protocols for the given content type.
+ */
+ String[] getSupportedProtocols(String aContentType);
+
+ /**
+ * Create a <code>Player</code> for a <code>DataSource</code>.
+ * This method will be called if MMA was not able to create
+ * Player for the DataSource.
+ *
+ * @param aDataSource The <CODE>DataSource</CODE> that provides
+ * the media content.
+ * @return A new <code>Player</code>.
+ * @exception IllegalArgumentException Thrown if <code>source</code>
+ * is <code>null</code>.
+ * @exception MediaException Thrown if a <code>Player</code> cannot
+ * be created for the given <code>DataSource</code>.
+ * @exception IOException Thrown if there was a problem connecting
+ * with the source.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to create the <code>Player</code>.
+ */
+ InternalPlayer createPlayer(DataSource aDataSource)
+ throws MediaException, IOException;
+
+ /**
+ * Method used to prepare player. This method is used only for
+ * MMA internal extensions. If PlugIn does not support given player
+ * this method must not do anything.
+ *
+ * @param aPlayer Player to prepare.
+ * @exception MediaException Thrown if a <code>InternalPlayer</code> cannot
+ * be prepared.
+ */
+ void preparePlayer(InternalPlayer aPlayer) throws MediaException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/SeekControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface to seek stream.
+*
+*/
+
+package com.nokia.microedition.media;
+
+import java.io.IOException;
+import javax.microedition.media.Control;
+
+/**
+ * Interface to seek stream to wanted position.
+ */
+public interface SeekControl extends Control
+{
+ /**
+ * Seeks stream to wanted position.
+ * @param aWhere position in the stream.
+ * @throw IOException Thrown if an I/O error occurs.
+ */
+ void seek(int aWhere) throws IOException;
+
+ /**
+ * Close controlled stream.
+ */
+ void close();
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/Setup.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class setup MMA plugins.
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * Class used to setup external components.
+ */
+public class Setup
+{
+ // Class names used to invoke external components.
+ private static final String[] MMA_PLUGINS =
+ {
+ //"com.nokia.amms.MMAInvokeListenerImpl"
+ };
+
+ /**
+ * Private constructor not to allow construction.
+ */
+ private Setup()
+ {
+ }
+
+ /**
+ * Setup external components.
+ * @param aEventSourceHandle Native handle MMA event source.
+ */
+ public static void setup(int aEventSourceHandle)
+ {
+ // Go through all plugins
+ for (int i = 0; i < MMA_PLUGINS.length; i++)
+ {
+ invokeComponent(aEventSourceHandle, MMA_PLUGINS[ i ]);
+ }
+ }
+
+ /**
+ * Invokes other component. This method returns without creating the
+ * components if the class is not found.
+ *
+ * @param aEventSourceHandle Handle to native mma event source.
+ * @param aClassName Full class name to create. Class must have public
+ * default constructor and implement MMAInvokeListener interface.
+ * @throws OutOfMemoryError if component cannot be created.
+ */
+ private static void invokeComponent(int aEventSourceHandle, String aClassName)
+ {
+ try
+ {
+ Class invokerClass =
+ Class.forName(aClassName);
+ MMAInvokeListener invoker =
+ (MMAInvokeListener)invokerClass.newInstance();
+ invoker.notifyInvoke(aEventSourceHandle);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new OutOfMemoryError("Instantiation failed, " + ie.toString());
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new OutOfMemoryError("Illegal access, " + iae.toString());
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // If invoker class cannot be found, plugin is not added to J2ME
+ // build and MMA is used without it.
+ Logger.ELOG(Logger.EJavaMMAPI, "MMA::Setup:: ", cnfe);
+ }
+ }
+}
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/SourcePlayer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is player with DataSource
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.protocol.SourceStream;
+import javax.microedition.media.MediaException;
+import java.io.IOException;
+import com.nokia.microedition.media.protocol.SourceStreamReader;
+import com.nokia.mj.impl.utils.Logger;
+/**
+ * This class add to PlayerImpl DataSource handling.
+ */
+public class SourcePlayer extends PlayerImpl
+{
+ //
+ protected DataSource iDataSource;
+
+ // Used to SourceStream to native side
+ protected SourceStreamReader iSourceStreamReader;
+
+ /**
+ * Constructor
+ * @param aDataSource Handle to DataSource
+ * @param aPlayerHandle handle to player (CMMAPlayer)
+ */
+ public SourcePlayer(DataSource aDataSource,
+ int aPlayerHandle) throws MediaException
+ {
+ super(aPlayerHandle);
+ iDataSource = aDataSource;
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"SourcePlayer player handle = " + aPlayerHandle);
+ // Create reader for the stream
+ iSourceStreamReader = new SourceStreamReader(
+ aDataSource.getStreams()[ 0 ],
+ aDataSource, // Controllable object
+ ManagerImpl.getEventSource(),
+ aPlayerHandle);
+
+ // Create SourceStreamReader in native side
+ int nativeHandle = _addSourceStream(ManagerImpl.getEventSource(),
+ iPlayerHandle,
+ iSourceStreamReader);
+
+ // Failed to create a native-side CMMASourceStream
+ if (nativeHandle <= 0)
+ {
+ throw new MediaException("Could not create Player, Symbian OS error: "
+ + nativeHandle);
+ }
+
+ // Assing java object to corresponding native object
+ iSourceStreamReader.setHandle(nativeHandle);
+ }
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doPrefetch() throws MediaException
+ {
+ // DataSource connect must reset its SourceStream if DataSource is
+ // disconnected.
+ try
+ {
+ iDataSource.connect();
+ }
+ catch (IOException ioe)
+ {
+ throw new MediaException("IOException occurred, " + ioe.getMessage());
+ }
+
+ super.doPrefetch();
+ }
+
+ /**
+ * interface PlayerImpl
+ * @see PlayerImpl
+ */
+ public void doDeallocate()
+ {
+ if (iDataSource.getStreams()[ 0 ].getSeekType() ==
+ SourceStream.NOT_SEEKABLE)
+ {
+ // if stream is not seekable we have to disconnect the whole source
+ // and re-connect it if prefetch is called
+ iDataSource.disconnect();
+ }
+ else
+ {
+ // stream is RANDOM_ACCESSIBLE or SEEKABLE_TO_START and can be
+ // seeked to beginning of the stream
+ iSourceStreamReader.resetStream();
+ }
+
+ super.doDeallocate();
+ }
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void close()
+ {
+ super.close();
+ // close threads from SourceStreamReaders
+ iSourceStreamReader.close();
+ iDataSource.disconnect();
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/SystemTimeBase.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements TimeBase
+*
+*/
+
+
+package com.nokia.microedition.media;
+
+import javax.microedition.media.TimeBase;
+
+public class SystemTimeBase implements TimeBase
+{
+
+ /**
+ * Constructor
+ */
+ public SystemTimeBase()
+ {
+ }
+
+ /**
+ * From TimeBase interface
+ * @return current time
+ */
+ public long getTime()
+ {
+ return System.currentTimeMillis();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,576 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.microedition.media.Control;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.protocol.DataSource;
+
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.microedition.media.BufferDataSource;
+import com.nokia.microedition.media.InputStreamDataSource;
+import com.nokia.microedition.media.InputStreamSourceStream;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.PlayerBase;
+import com.nokia.microedition.media.PlayerListenerImpl;
+
+/**
+ * @author d35kumar
+ *
+ */
+public class AnimationPlayer extends PlayerBase {
+ // GIF image information, array length will be equal to the number of frames in image
+ protected ImageData [] iImageData;
+ // number of times we need to repeat the animation
+ // by default it's value is one
+ private int iTotalLoopCount=1;
+ // this holds all control related to this player
+ Hashtable iControls= new Hashtable();
+ // Current frame index of the Animation file
+ private int iFrameindex;
+ // Current Loop Count
+ private int iCurrentLoopCount;
+ // Display object of the eSWT API, creating this object will integrate the current java code with eSWT API.
+ Display iDisplay;
+ // Control object of ESWT API, return from LCDUIInvoker.
+ org.eclipse.swt.widgets.Control iControl;
+ // Constants used everywhere to compare the string
+ private static final String ANIMATION_CONTENT_TYPE = "image/gif";
+
+ private final String fVideoControl=VideoControl.class.getName();
+ private final String fFramePositioningControl=FramePositioningControl.class.getName();
+ private final String fStopTimeControl=StopTimeControl.class.getName();
+ private final String fRateControl=RateControl.class.getName();
+ /**
+ * Default control package. Used when getting control with
+ * getControl method which appends default control package if package is
+ * not specified.
+ */
+ static final String CONTROL_DEFAULT_PACKAGE =
+ "javax.microedition.media.control.";
+
+ //For Player listener
+ protected PlayerListenerImpl iPlayerListenerImpl;
+ //Image to be displayed, again object of eSWT API.
+ protected Image iImage;
+ // Actual dimension of the image, this should be initialized while creating the player
+ // as user can change the size of the image later, in that case too, getSourceheight and getSourceWidth
+ // of VideoControl should return the actual width and height of the image
+ Point iSourceDimension;
+ long iMediaTime;
+
+ // Display Location, of the image
+ private Point iDisplayLocation= new Point(0,0);
+
+
+ /**
+ *
+ * @param ds DataSource which contains the data to be displayed
+ */
+ public AnimationPlayer(DataSource ds){
+ final String DEBUG_STR="AnimationPlayer::AnimationPlayer(DataSource)";
+ System.out.println(DEBUG_STR+"+");
+ iPlayerListenerImpl= new PlayerListenerImpl(this);
+ //TODO check if we can do it in better way
+ // this is temporary solution
+ // for this I have written two functions getDataSource and getInputStream function
+ BufferDataSource bds =(BufferDataSource )ds;
+ InputStreamDataSource isds=(InputStreamDataSource)bds.getDataSource();
+ InputStreamSourceStream isss=(InputStreamSourceStream )isds.getStreams()[0];
+ InputStream is = isss.getInputStream();
+
+ if(is!=null){
+ ImageLoader imageLoader= new ImageLoader();
+ iImageData=imageLoader.load(is);
+ //iRepeatCount=imageLoader.repeatCount;
+ iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+ }
+ pupulateControl();
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ /**
+ *
+ * @param locator
+ * @throws SWTException
+ */
+ public AnimationPlayer(String locator) throws SWTException{
+ final String DEBUG_STR="AnimationPlayer::AnimationPlayer(Locator )";
+ System.out.println(DEBUG_STR+"+");
+ ImageLoader imageLoader= new ImageLoader();
+ System.out.println(DEBUG_STR+"Locator string is "+locator);
+ // Following line may throw SWTException
+ iImageData=imageLoader.load(locator);
+ //iRepeatCount=imageLoader.repeatCount;
+ iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+ pupulateControl();
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ /**
+ * Moved the player to close state and releases all resources, called from PlayerBase class
+ */
+ protected void doClose() {
+ final String DEBUG_STR="AnimationPlayer::doClose()";
+ System.out.println(DEBUG_STR+"+");
+ iState=CLOSED;
+ iPlayerListenerImpl.postEvent(PlayerListener.CLOSED, null);
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ protected void doDeallocate() {
+ // what to do here, nullify image data and display etc???
+ }
+
+ protected void doPrefetch() throws MediaException {
+ final String DEBUG_STR="AnimationPlayer::doPrefetch()";
+ System.out.println(DEBUG_STR+"+");
+ iState=PREFETCHED;
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ protected void doRealize() throws MediaException {
+ final String DEBUG_STR="AnimationPlayer::doRealize()";
+ System.out.println(DEBUG_STR+"+");
+ iState=REALIZED;
+ // this is temporary solution implement it in proper way
+ iImage=new Image(iDisplay, iImageData[0]);
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ protected void doStop() throws MediaException {
+ final String DEBUG_STR="AnimationPlayer::doStop()";
+ System.out.println(DEBUG_STR+"+");
+ // since after stopping the player the player state will move to pre-fetched state
+ iState=PREFETCHED;
+ iPlayerListenerImpl.postEvent(PlayerListener.STOPPED, new Long(iMediaTime * 10000));
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ public void addControl(Control aControl, String aControlType)
+ throws MediaException {
+ iControls.put(aControlType, aControl);
+ }
+
+ public void addPlayerListener(PlayerListener aPlayerListener) {
+ closeCheck();
+ iPlayerListenerImpl.addPlayerListener(aPlayerListener);
+ }
+
+ /**
+ * Returns the Content type("image/GIF") supported for by this player,
+ */
+ public String getContentType() {
+ closeCheck();
+ unrealizedCheck();
+ return ANIMATION_CONTENT_TYPE;
+ }
+
+ /**
+ * This function will return, total time in microseconds this player can be played
+ */
+ public long getDuration() {
+ closeCheck();
+ long time = TIME_UNKNOWN;
+ int totalNoOfFrames = iImageData.length;
+ for (int i = 0; i < totalNoOfFrames; i++) {
+ time += iImageData[i].delayTime;
+ }
+ // Since we have to return it in microsecond multiply it with 1000;
+ return time * 10000;
+ }
+
+ /**
+ * This returned the total time taken, till now, to play the video.
+ */
+ public long getMediaTime() {
+ return iMediaTime*10000;
+ }
+
+ public int getState() {
+ return iState;
+ }
+
+ /**
+ * Removes the specified playerListner from this player
+ */
+ public void removePlayerListener(PlayerListener aPlayerListener) {
+ closeCheck();
+ iPlayerListenerImpl.removePlayerListener(aPlayerListener);
+ }
+ public void start() throws MediaException {
+ final String DEBUG_STR = "AnimationPlayer::start()";
+// prefetch();
+ initialize();
+ addPaintListener(iControl);
+ iState = STARTED;
+ Thread thread = new Thread("Animation") {
+ int frameIndex = iFrameindex;
+ int loopCount = iCurrentLoopCount;
+ GC gc=null;
+ public void run() {
+ final int noOfFrames = iImageData.length;
+ while (frameIndex < noOfFrames && (loopCount < iTotalLoopCount)
+ && (iState == STARTED)) {
+ final int delayTimeForNextFrame = iImageData[frameIndex].delayTime;
+ System.out.println("\n\n\n************" + DEBUG_STR
+ + "Inside the while loop " + frameIndex + "/"
+ + noOfFrames);
+ // Since we are going to display first frame, notify all
+ // PlayerListener that Player has started
+ if (frameIndex == 0) {
+ iPlayerListenerImpl.postEvent(PlayerListener.STARTED,
+ new Long(iMediaTime * 10000));
+ }
+ iDisplay.asyncExec(new Runnable() {
+ public void run() {
+ System.out.println(DEBUG_STR+"Inside run method");
+ try {
+ if (gc == null)gc = new GC(iImage);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.println(DEBUG_STR+"Inside run method246");
+ Image tempImage = new Image(iDisplay,
+ iImageData[frameIndex]);
+ System.out.println(DEBUG_STR+"Inside run method246");
+ gc.drawImage(tempImage, 0, 0);
+ tempImage.dispose();
+ frameIndex = (frameIndex + 1) % noOfFrames;
+ System.out.println(DEBUG_STR+"Inside run method253>>>>>>>>>"+frameIndex);
+ iControl.redraw();
+ // update the mediaTime, as Animation progress
+ iMediaTime += delayTimeForNextFrame;
+ // If imageIndex becomes zero it means, all frames
+ // has been displayed
+ // So increase the loopCount
+ if (frameIndex == 0) {
+ // send the END_OF_MEDIA event to all listener
+ iPlayerListenerImpl.postEvent(
+ PlayerListener.END_OF_MEDIA, new Long(
+ iMediaTime * 10000));
+ loopCount++;
+ // since player is again going to start from the
+ // first frame
+ // so media time should be set to zero
+ iMediaTime = 0;
+ }
+ System.out
+ .println(DEBUG_STR
+ + "end of asynchronous block imageIndex is "
+ + frameIndex + " and loop count is"
+ + loopCount );
+ }
+ });
+ try {
+ Thread.sleep(delayTimeForNextFrame * 10);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out
+ .println("**********************End of while loop\n\n\n");
+ }
+ iCurrentLoopCount=loopCount;
+ System.out.println(DEBUG_STR + "Came out side the while loop "
+ + iState);
+ }
+ };
+ thread.start();
+ System.out.println(DEBUG_STR + "-");
+ // }catch(Exception e){
+ // System.out.println(DEBUG_STR+"Exception caught"+e);
+ // e.printStackTrace();
+ // }
+ }
+
+ /**
+ * This function is also being called from VideoControl class,
+ * Since on each event
+ * @param aControl
+ * @throws MediaException
+ */
+ void addPaintListener(org.eclipse.swt.widgets.Control aControl) throws MediaException{
+ final String DEBUG_STR="AnimationPlayer::addPaintListener()";
+ iControl=aControl;
+ // iDisplay and IControl shouldn't be null here
+ System.out.println(DEBUG_STR+" Control is "+iControl+" Display "+iDisplay);
+ // Following line should never execute
+ // TODO check what message to provide in case of Exception
+ if(iControl==null)
+ throw new MediaException("Update this message");
+ iDisplay.syncExec(new Runnable(){
+ public void run() {
+ // if user is writing his MIDlet using eSWT API, then the Control object will be MobileShell
+ // and in that case it is mandatory to open the shell
+// if(iControl instanceof MobileShell){
+ if(iControl instanceof Shell){
+ ((Shell)iControl).open();
+ }
+ iControl.addPaintListener(new PaintListener(){
+ public void paintControl(PaintEvent pe) {
+// System.out.println(DEBUG_STR+"paintControl() paintEvent is "+pe);
+// System.out.println(DEBUG_STR+"paintControl() Display location is "+iDisplayLocation.x+", "+iDisplayLocation.y);
+ if(iImage!=null){
+ pe.gc.drawImage(iImage, iDisplayLocation.x, iDisplayLocation.y);
+ }
+ }
+ });
+ }
+ });
+ }
+ /**
+ *
+ */
+ public Control getControl(String aControlType) {
+ if (aControlType == null) {
+ throw new IllegalArgumentException("argument is null");
+ }
+
+ String controlType = aControlType;
+
+ // check if package name exists
+ if (controlType.indexOf(".") == -1)
+ {
+ // add package name
+ controlType = CONTROL_DEFAULT_PACKAGE + aControlType;
+ }
+ Control control = (Control)iControls.get(controlType);
+ // If control does not exists with default name, check if there is
+ // is a control with same type ( extends the given class name ).
+ if (control == null) {
+ try {
+ // try to create class for control
+ Class controlClass = Class.forName(controlType);
+ Enumeration elements = iControls.elements();
+ // search if any control is same type that requested control
+ while (elements.hasMoreElements()) {
+ Control tmpControl = (Control) elements.nextElement();
+ if (controlClass.isInstance(tmpControl)) {
+ // control is found
+ control = tmpControl;
+ }
+ }
+ } catch (ClassNotFoundException cnfe) // the class could not be
+ // found
+ {
+ // Exception is ignored and null is returned from this method
+ } catch (Error e) // the function failed for any other reason.
+ {
+ // Error is ignored and null is returned from this method
+ }
+ }
+ return control;
+ }
+ /**
+ * Returns all the control associated with this player
+ */
+ public Control[] getControls() {
+ Control control[]= new Control[iControls.size()];
+ Enumeration enumeration= iControls.elements();
+ byte index=0;
+ while(enumeration.hasMoreElements()){
+ control[index++]=(Control)enumeration.nextElement();
+ }
+ return control;
+ }
+ /**
+ *
+ */
+ public void setLoopCount(int aCount){
+ super.setLoopCount(aCount);
+ iTotalLoopCount=aCount;
+ }
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public long setMediaTime(long aNow) throws MediaException {
+ long now = super.setMediaTime(aNow);
+ int totalFrames = iImageData.length;
+ int totalTime = 0;
+ for (int i = 0; i < totalFrames; i++) {
+ if (now < totalTime) {
+ iFrameindex=i;
+ break;
+ }
+ totalTime += iImageData[i].delayTime * 10000;
+ }
+ return totalTime;
+ }
+ //////////////////////////////////////////////////////////////////////////////////////
+ // Following functions are for internal use, and not exposed to MIDlet developer//////
+ /////////////////////////////////////////////////////////////////////////////////////
+ /**
+ *
+ */
+ private void doStart(){
+
+ }
+
+
+ /**
+ * This function is responsible for creating all controls and adding it into Controls hashtable.
+ */
+ private void pupulateControl(){
+ final String DEBUG_STR="AnimationPlayer::pupulateControl()";
+ System.out.println(DEBUG_STR+"+");
+ VideoControl videoControl= new VideoControl(this);
+ FramePositioningControl fpc= new FramePositioningControl(this);
+ StopTimeControl stc= new StopTimeControl(this);
+ RateControl rc= new RateControl(this);
+ try {
+ addControl(videoControl, fVideoControl);
+ addControl(fpc, fFramePositioningControl);
+ addControl(stc, fStopTimeControl);
+ addControl(rc,fRateControl);
+ } catch (MediaException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.println(DEBUG_STR+"-");
+ }
+ /**
+ * This function initialize iControl and iDisplay object if it is null,
+ * otherwise return immediately.
+ *
+ * In case of Canvas, eSWT control will be returned immediately from VideoControl(vc.getControl()),
+ * but in case of CustomItem we need to keep polling, eSWT doesn't return the control for CustomItem
+ * until CustomItem is appended to Form.
+ */
+
+ private void initialize() {
+ final String DEBUG_STR = "AnimationPlayer::initialize()";
+ System.out.println(DEBUG_STR + "+");
+ System.out.println(DEBUG_STR + " Control is " + iControl
+ + " display is " + iDisplay);
+ if (iControl == null || iDisplay == null) {
+ VideoControl vc = (VideoControl) getControl(fVideoControl);
+ iDisplay = vc.getiDisplay();
+ // in case of CustomItem,
+ while ((iControl = vc.getControl()) == null) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ System.out.println(DEBUG_STR + "-");
+ }
+
+ /**
+ * This function will be called from setDisplaySize(int width, int height) of animation/VideoControl class
+ * When MIDlet developer will try to alter the size of the image
+ * @param width : to be set of the video(Animated GIF)
+ * @param height : height to be set of video(Animated GIF)
+ */
+ void updateImageData(int width, int height){
+ final String DEBUG_STR= "AnimationPlayer::updateImageData(int width, int height)";
+ System.out.println(DEBUG_STR+"+");
+ int noOfFrames= iImageData.length;
+ for(int i=0;i<noOfFrames;i++){
+ iImageData[i]=iImageData[i].scaledTo(width, height);
+ }
+ iImage=new Image(iDisplay, iImageData[0]);
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ /**
+ * This function will be called from getSnapshot() function of VideoControl class
+ * to get the snap shot of the video
+ *
+ * @param format
+ */
+ // This function is not implemented fully
+ int[] getCurrentFrame(String format){
+ final String DEBUG_STR="AnimationPlayer::getCurrentFrame()";
+ System.out.println(DEBUG_STR+"+");
+ ImageData currentFrameImageData=iImage.getImageData();
+ int data[][]= new int[currentFrameImageData.height][currentFrameImageData.width];
+ System.out.println("Width of the current Image is "+data[0].length+" height "+data.length);
+
+ int imageWidth=data[0].length;
+ int imageHeight=data.length;
+ System.out.println("Image Width "+imageWidth+", "+currentFrameImageData.width+" height "+imageHeight+", "+currentFrameImageData.height);
+
+ for(int i=0;i<imageHeight;i++){
+ currentFrameImageData.getPixels(0, i, imageWidth, data[i], 0);
+ System.out.println(DEBUG_STR+"=========>"+data[i]);
+ }
+ System.out.println(DEBUG_STR+"After reading all pixel value");
+ int[] byteArray=new int[imageWidth*imageHeight];
+ //int dataLength=data.length;
+
+ for(int i=0;i<imageHeight;i++){
+ System.arraycopy(data[i], 0, byteArray, i*imageWidth, imageWidth);
+ }
+ System.out.println(DEBUG_STR+"After merging all array into single array ");
+ System.out.println(DEBUG_STR+"-"+byteArray+">>>>>"+byteArray.length);
+ return byteArray;
+ }
+
+ /**
+ * Returns Point object, which contains the width and height of the image
+ * Called from VideoControl to get the image width and height,
+ * so that Item will be created exactly of same dimension
+ */
+ org.eclipse.swt.graphics.Point getImageDimension(){
+ return new org.eclipse.swt.graphics.Point(iImageData[0].width, iImageData[0].height);
+ }
+
+ /**
+ * This returns the imageData array,
+ * called from FramePositioningControl class to calculate the frame time
+ */
+ ImageData[] getImageData(){
+ return iImageData;
+ }
+
+ /**
+ *
+ * @param aDisplayLocation x,y coordinate where image is to be displayed
+ */
+ void setDisplayLocation(int aX, int aY){
+ iDisplayLocation=new Point(aX,aY);
+ }
+
+ /**
+ * @return the position of the image to be displayed
+ */
+ Point getiDisplayLocation() {
+ return iDisplayLocation;
+ }
+ /**
+ * Called from VideoControl to get the dimension of original image size
+ * @return
+ */
+ Point getSourceDimension() {
+ return iSourceDimension;
+ }
+
+ /**
+ * @return the iPlayerListenerImpl
+ */
+ PlayerListenerImpl getiPlayerListenerImpl() {
+ return iPlayerListenerImpl;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: This class has been implemented for playing the GIF animation
+ * Earlier implementation were dependent on native API, but now AnimationPlayer
+ * will be not use any native code, and all the implementation here is using eswt API
+ *
+ */
+
+package com.nokia.microedition.media.animation;
+
+import java.io.IOException;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.protocol.DataSource;
+
+import org.eclipse.swt.SWTException;
+
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.PlugIn;
+
+/**
+ * This class is used for playing GIF image animation. This class also
+ * implements PlugIn interface which is used from ManagerImpl.
+ * Entire Animation playing is written using eSWT API.
+ * There is no call to native.
+ *
+ */
+public class AnimationPlayerFactory implements PlugIn {
+
+ // Used to recognize supported locators.
+ // private static final String ANIMATION_FILE_EXTENSION = ".gif";
+
+ // Used to get supported protocols and content type.
+ private static final String ANIMATION_CONTENT_TYPE = "image/gif";
+ private static final String ANIMATION_HTTP_PROTOCOL = "http";
+ private static final String ANIMATION_HTTPS_PROTOCOL = "https";
+ private static final String ANIMATION_FILE_PROTOCOL = "file";
+ // There is no need to read the first 6 byte and compare it with following string
+// private static final String ANIMATION_GIF_HEADER="GIF89a";
+
+ /**
+ * From PlugIn
+ */
+ public InternalPlayer createPlayer(DataSource aDataSource)
+ throws MediaException, IOException {
+ final String DEBUG_STR="AnimationPlayerFactory::createPlayer()";
+ System.out.println(DEBUG_STR+"+");
+ InternalPlayer player = null;
+ System.out.println(DEBUG_STR+"data source object is "+aDataSource);
+ String contentType = aDataSource.getContentType();
+ System.out.println(DEBUG_STR+"Content type is "+contentType);
+ // There is no difference in if and else block
+ // in first if block only checking if the content type is available
+ // Player is being created in the same way
+
+ // First try to create player from content type
+ if (contentType != null){
+ if(contentType.equals(ANIMATION_CONTENT_TYPE)) {
+ player = new AnimationPlayer(aDataSource);
+ System.out.println(DEBUG_STR+"Player created from content type"+contentType);
+ }
+// else{
+// throw new MediaException("Content type not supported: " + contentType);
+// }
+ } //Since it was not possible to identify the player from content type, identify it from it's header
+ // Is there any need to create player through Locator?
+
+ else {
+ // We need only 6 bytes to identify whether it's GIF image data or not.
+ // But the problem here is that if we will read even a single byte from stream
+ // that stream won't be useful for loading the image data through ImageLoader class
+ // So better solution is to let the ImageLoader.load(InputStream ) get called
+ // if it successfully load the image, then it means that stream is intended for this player only
+ // otherwise it will throw the SWTException, catch it and return properly
+ try{
+ player = new AnimationPlayer(aDataSource);
+ System.out.println(DEBUG_STR+"Player created from content type");
+ }catch(SWTException e){
+ // Simply ignore the exception
+ e.printStackTrace();
+ }
+ }
+ System.out.println(DEBUG_STR+"-");
+ return player;
+ }
+
+ /**
+ * @param locator
+ * @return Interplayer object
+ */
+ public InternalPlayer createPlayer(String locator ){
+ final String DEBUG_STR="AnimationPlayerFactory::createPlayer(String locator )";
+ System.out.println(DEBUG_STR+"+");
+ InternalPlayer player = null;
+ try{
+ player = new AnimationPlayer(locator);
+ }catch(SWTException e){
+ // just ignore it
+ e.printStackTrace();
+ }
+ System.out.println(DEBUG_STR+"returning player "+player);
+ System.out.println(DEBUG_STR+"-");
+ return player;
+ }
+
+
+ /**
+ * From PlugIn
+ */
+ public String[] getSupportedContentTypes(String aProtocol) {
+ String[] types = new String[0];
+ if (aProtocol == null || aProtocol.equals(ANIMATION_HTTP_PROTOCOL)
+ || aProtocol.equals(ANIMATION_HTTPS_PROTOCOL)
+ || aProtocol.equals(ANIMATION_FILE_PROTOCOL)) {
+ types = new String[1];
+ types[0] = ANIMATION_CONTENT_TYPE;
+ }
+ return types;
+ }
+
+ /**
+ * From PlugIn
+ */
+ public String[] getSupportedProtocols(String aContentType) {
+ String[] protocols = new String[0];
+ if ((aContentType == null)
+ || aContentType.equals(ANIMATION_CONTENT_TYPE)) {
+ protocols = new String[3];
+ protocols[0] = ANIMATION_HTTP_PROTOCOL;
+ protocols[1] = ANIMATION_HTTPS_PROTOCOL;
+ protocols[2] = ANIMATION_FILE_PROTOCOL;
+ }
+ // else empty array is returned
+ return protocols;
+ }
+
+ /**
+ * From PlugIn. Empty implementation.
+ */
+ public void preparePlayer(InternalPlayer aPlayer) throws MediaException {
+ // tone does not extend existing players
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/FramePositioningControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import javax.microedition.media.Player;
+
+import org.eclipse.swt.graphics.ImageData;
+
+import com.nokia.microedition.media.control.ControlImpl;
+
+/**
+ * @author d35kumar
+ *
+ */
+public class FramePositioningControl extends ControlImpl implements
+ javax.microedition.media.control.FramePositioningControl {
+
+ ImageData[] iImagedata;
+ /**
+ *
+ */
+ FramePositioningControl(Player aPlayer) {
+ iPlayer=aPlayer;
+ iImagedata=((AnimationPlayer)iPlayer).getImageData();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.FramePositioningControl#mapFrameToTime(int)
+ */
+ public long mapFrameToTime(int aFrameNumber) {
+ checkState();
+ long time=0;
+ int totalNoOfFrames=iImagedata.length;
+ // if invalid parameter is passed
+ if(aFrameNumber<0 || aFrameNumber>totalNoOfFrames)
+ return -1;
+ for(int i=0;i<totalNoOfFrames;i++){
+ if(i==aFrameNumber)
+ break;
+ time+=iImagedata[i].delayTime;
+ }
+ return time*10000;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.FramePositioningControl#mapTimeToFrame(long)
+ */
+ public int mapTimeToFrame(long aMediaTime) {
+ checkState();
+ int frameNumber=-1;
+ int totalNoOfFrames=iImagedata.length;
+ long time=0;
+ for(int i=0;i<totalNoOfFrames;i++){
+ if(time > aMediaTime){
+ frameNumber=i-1;
+ break;
+ }
+ time+=iImagedata[i].delayTime*10000;
+ }
+ return frameNumber;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.FramePositioningControl#seek(int)
+ */
+ public int seek(int aFrameNumber) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.FramePositioningControl#skip(int)
+ */
+ public int skip(int aFramesToSkip) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/ProxyControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,307 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This class will act like a proxy Control
+ * @author d35kumar
+ */
+class ProxyControl extends Control {
+
+ /**
+ * this will be actual Shell, for which this class is acting like proxy
+ */
+ Control iControl;
+
+ public ProxyControl() {
+ super(Display.getDefault().getActiveShell(), SWT.BORDER);
+ }
+
+ /**
+ * Actual Control will be created here
+ */
+ public boolean setParent(Composite parent){
+ iControl= new Shell((Shell)parent);
+ return true;
+ }
+
+ /**
+ *
+ */
+ public void addControlListener(ControlListener aListener){
+ if(iControl!=null){
+ iControl.addControlListener(aListener);
+ }
+ }
+ /**
+ *
+ */
+ public void addFocusListener(FocusListener listener){
+ if(iControl!=null)iControl.addFocusListener(listener);
+ }
+ /**
+ *
+ */
+ public void addKeyListener(KeyListener listener){
+ if(iControl!=null)iControl.addKeyListener(listener);
+ }
+ public void addMouseListener(MouseListener listener){
+ if(iControl!=null)iControl.addMouseListener(listener);
+ }
+ public void addMouseMoveListener(MouseMoveListener listener){
+ if(iControl!=null)iControl.addMouseMoveListener(listener);
+ }
+ /**
+ *
+ */
+ public void addPaintListener(PaintListener aListener){
+ if(iControl!=null)iControl.addPaintListener(aListener);
+
+ }
+
+ public void addTraverseListener(TraverseListener listener){
+ if(iControl!=null)iControl.addTraverseListener(listener);
+ }
+ public Point computeSize(int wHint,
+ int hHint){
+ Point point=null;
+ if(iControl!=null)point=iControl.computeSize(wHint, hHint);
+ System.out.println("ProxyControl::computeSize()"+point);
+ return point;
+ }
+
+ public Point computeSize(int wHint,
+ int hHint,
+ boolean changed){
+ Point point=null;
+ if(iControl!=null)point=iControl.computeSize(wHint, hHint,changed);
+ System.out.println("ProxyControl::computeSize()"+point+"Bolean changed "+changed);
+ return point;
+ }
+
+ public Color getBackground(){
+ Color color=null;
+ if(iControl!=null)color=iControl.getBackground();
+ System.out.println("ProxyControl::getBackground()");
+ return color;
+ }
+ public int getBorderWidth(){
+ if(iControl!=null)return iControl.getBorderWidth();
+ else return 0;
+ }
+ public Rectangle getBounds(){
+ if(iControl!=null) return iControl.getBounds();
+ else return null;
+ }
+ public boolean getEnabled(){
+ if(iControl!=null) return iControl.getEnabled();
+ else return false;
+ }
+ public Font getFont(){
+ if(iControl!=null)return iControl.getFont();
+ else return null;
+ }
+ public Color getForeground(){
+ if(iControl!=null) return iControl.getForeground();
+ else return null;
+ }
+
+ public java.lang.Object getLayoutData(){
+ if(iControl!=null) return iControl.getLayoutData();
+ else return null;
+ }
+
+ public Point getLocation(){
+ if(iControl!=null) return iControl.getLocation();
+ else return null;
+ }
+
+ public Menu getMenu(){
+ if(iControl!=null) return iControl.getMenu();
+ else return null;
+ }
+ public Composite getParent(){
+ if(iControl!=null) return iControl.getParent();
+ else return null;
+ }
+ public Shell getShell(){
+ if(iControl!=null) return iControl.getShell();
+ else return null;
+ }
+ public Point getSize(){
+ if(iControl!=null) return iControl.getSize();
+ else return null;
+ }
+
+ public java.lang.String getToolTipText(){
+ if(iControl!=null) return iControl.getToolTipText();
+ else return null;
+ }
+ public boolean getVisible(){
+ if(iControl!=null) return iControl.getVisible();
+ else return false;
+ }
+ public boolean isEnabled(){
+ if(iControl!=null) return iControl.isEnabled();
+ else return false;
+ }
+
+ public boolean isFocusControl(){
+ if(iControl!=null) return iControl.isFocusControl();
+ else return false;
+ }
+ public boolean isReparentable(){
+ if(iControl!=null) return iControl.isReparentable();
+ else return false;
+ }
+
+ public boolean isVisible(){
+ if(iControl!=null)return iControl.isVisible();
+ else return false;
+ }
+ public void moveAbove(Control control){
+ if(iControl!=null) iControl.moveAbove(control);
+ }
+ public void moveBelow(Control control){
+ if(iControl!=null) iControl.moveBelow(control);
+ }
+ public void pack(){
+ if(iControl!=null) iControl.pack();
+ }
+ public void pack(boolean changed){
+ if(iControl!=null) iControl.pack(changed);
+ }
+ public void redraw(){
+ if(iControl!=null) iControl.redraw();
+ }
+ public void redraw(int x,
+ int y,
+ int width,
+ int height,
+ boolean all){
+ if(iControl!=null) iControl.redraw(x,y,width,height, all);
+ }
+ public void removeControlListener(ControlListener listener){
+ if(iControl!=null) iControl.removeControlListener(listener);
+ }
+ public void removeFocusListener(FocusListener listener){
+ if(iControl!=null) iControl.removeFocusListener(listener);
+ }
+ public void removeMouseListener(MouseListener listener){
+ if(iControl!=null) iControl.removeMouseListener(listener);
+ }
+ public void removeMouseMoveListener(MouseMoveListener listener){
+ if(iControl!=null) iControl.removeMouseMoveListener(listener);
+ }
+ public void removePaintListener(PaintListener listener){
+ if(iControl!=null)iControl.removePaintListener(listener);
+ }
+ public void removeTraverseListener(TraverseListener listener){
+ if(iControl!=null)iControl.removeTraverseListener(listener);
+ }
+ public void setBounds(int x,
+ int y,
+ int width,
+ int height){
+ if(iControl!=null)iControl.setBounds(x, y, width, height);
+ }
+ public void setBounds(Rectangle rect){
+ if(iControl!=null)iControl.setBounds(rect);
+ }
+ public void setCapture(boolean capture){
+ if(iControl!=null)iControl.setCapture(capture);
+ }
+ public void setEnabled(boolean enabled){
+ if(iControl!=null)iControl.setEnabled(enabled);
+ }
+ public boolean setFocus(){
+ if(iControl!=null) return iControl.setFocus();
+ else return false;
+ }
+ public void setFont(Font font){
+ if(iControl!=null)iControl.setFont(font);
+ }
+ public void setForeground(Color color){
+ if(iControl!=null)iControl.setForeground(color);
+ }
+ public void setLayoutData(java.lang.Object layoutData){
+ if(iControl!=null)iControl.setLayoutData(layoutData);
+ }
+ public void setLocation(int x,
+ int y){
+ if(iControl!=null)iControl.setLocation(x, y);
+ }
+
+ public void setLocation(Point location){
+ if(iControl!=null)iControl.setLocation(location);
+ }
+ public void setMenu(Menu menu){
+ if(iControl!=null)iControl.setMenu(menu);
+ }
+ public void setRedraw(boolean redraw){
+ if(iControl!=null)iControl.setRedraw(redraw);
+ }
+ public void setSize(int width,
+ int height){
+ if(iControl!=null) iControl.setSize(width, height);
+ }
+
+ public void setSize(Point size){
+ if(iControl!=null) iControl.setSize(size);
+ }
+ public void setToolTipText(java.lang.String string){
+ if(iControl!=null)iControl.setToolTipText(string);
+ }
+ public void setVisible(boolean visible){
+ if(iControl!=null)iControl.setVisible(visible);
+ }
+ public Point toControl(int x,
+ int y){
+ if(iControl!=null)return iControl.toControl(x, y);
+ else return null;
+ }
+ public Point toControl(Point point){
+ if(iControl!=null) return iControl.toControl(point);
+ else return null;
+ }
+ public Point toDisplay(int x,
+ int y){
+ if(iControl!=null)return iControl.toDisplay(x,y);
+ else return null;
+ }
+ public Point toDisplay(Point point){
+ if(iControl!=null)return iControl.toDisplay(point);
+ else return null;
+ }
+ public boolean traverse(int traversal){
+ if(iControl!=null)return iControl.traverse(traversal);
+ else return false;
+ }
+ public void update(){
+ if(iControl!=null)iControl.update();
+ }
+
+ public void checkSubclass() {
+ // do nothing,sub-classing allowed
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/RateControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import javax.microedition.media.Player;
+
+import com.nokia.microedition.media.control.ControlImpl;
+
+/**
+ * @author d35kumar
+ *
+ */
+public class RateControl extends ControlImpl implements
+ javax.microedition.media.control.RateControl {
+
+
+ /**
+ *
+ * @param aPlayer
+ */
+ public RateControl(Player aPlayer){
+ this.iPlayer=aPlayer;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.RateControl#getMaxRate()
+ */
+ public int getMaxRate() {
+ checkState();
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.RateControl#getMinRate()
+ */
+ public int getMinRate() {
+ checkState();
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.RateControl#getRate()
+ */
+ public int getRate() {
+ checkState();
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.RateControl#setRate(int)
+ */
+ public int setRate(int aMillirate) {
+ checkState();
+ return 0;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/StopTimeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import javax.microedition.media.Player;
+
+import com.nokia.microedition.media.control.ControlImpl;
+
+/**
+ * @author d35kumar
+ *
+ */
+public class StopTimeControl extends ControlImpl implements
+ javax.microedition.media.control.StopTimeControl {
+
+ long iStopTime=RESET;
+ /**
+ *
+ */
+ public StopTimeControl(Player aPlayer) {
+ this.iPlayer=aPlayer;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.StopTimeControl#getStopTime()
+ */
+ public long getStopTime() {
+ checkState();
+ return iStopTime;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.StopTimeControl#setStopTime(long)
+ */
+ public void setStopTime(long aStopTime) {
+ checkState();
+ if (iPlayer.getState() == Player.STARTED && getStopTime() != RESET) {
+ throw new IllegalStateException(
+ "Player is STARTED or setStopTime() is already called successfully");
+ }
+ iStopTime = aStopTime;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,532 @@
+/**
+ *
+ */
+package com.nokia.microedition.media.animation;
+
+import javax.microedition.lcdui.Item;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Player;
+import javax.microedition.media.PlayerListener;
+
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+//import com.nokia.microedition.media.control.ApplicationUtils;
+import com.nokia.microedition.media.control.ControlImpl;
+import com.nokia.microedition.media.control.MMAGUIFactory;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.media.PlayerPermission;
+import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
+import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
+
+//import com.nokia.mj.impl.media.PlayerPermission;
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+
+/**
+ * @author d35kumar
+ *
+ */
+public class VideoControl extends ControlImpl implements
+ javax.microedition.media.control.VideoControl , ItemControlStateChangeListener{
+
+ // Following variable has been taken from VideoControl class
+ private static final String GUI_OBJECT_CLASS_NAME =
+ "javax.microedition.lcdui.Item";
+ // lcdui package used with UiToolkitRegister
+ private static String LCDUI_PACKAGE =
+ "javax.microedition.lcdui";
+ // eswt package used with UiToolkitRegister
+ private static String ESWT_PACKAGE = "org.eclipse.swt.widgets";
+ // ToolkitRegister class name used with eswt and lcdui
+ private static String DISPLAY = ".Display";
+
+ // class name used to check if eswt is included
+ private static String LISTENER = ".Listener";
+
+ // class name used to check if eswt is included
+ private static String ESWT_CONTROL = ".control";
+ // class name used with dynamic display mode initialization
+ private static String GUI_FACTORY_CLASS_NAME = ".Factory";
+
+ private static final int NOT_INITIALIZED = -1;
+ protected int iStatus = NOT_INITIALIZED;
+ private static final int UNDEFINED_RETURN_VALUE=0;
+ // For integrating with eSWT API
+ private Display iDisplay;
+// private Shell iShell;
+
+ private Control iControl;
+
+ // Global??? yes because we need to remove it from player listener, while finalizer will be called
+ private VideoItem iVideoItem;
+
+ private Finalizer mFinalizer = new Finalizer(){
+ public void finalizeImpl(){
+ doFinalize();
+ }
+ };
+
+ /**
+ * Constructor of VideoControl
+ * @param player
+ */
+ public VideoControl(Player player){
+ this.iPlayer=player;
+ }
+
+ /**
+ *
+ */
+ private void doFinalize() {
+ if (mFinalizer != null) {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ /**
+ *
+ */
+ final void registeredFinalize() {
+ if (iVideoItem != null) {
+ iPlayer.removePlayerListener(iVideoItem);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getDisplayHeight()
+ */
+ public int getDisplayHeight() {
+ checkState();
+ if (iStatus == NOT_INITIALIZED) {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ return ((AnimationPlayer)iPlayer).getImageDimension().x;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getDisplayWidth()
+ */
+ public int getDisplayWidth() {
+ checkState();
+ if (iStatus == NOT_INITIALIZED) {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ return ((AnimationPlayer)iPlayer).getImageDimension().x;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getDisplayX()
+ */
+ public int getDisplayX() {
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return UNDEFINED_RETURN_VALUE;
+ }
+ return ((AnimationPlayer)iPlayer).getiDisplayLocation().x;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getDisplayY()
+ */
+ public int getDisplayY() {
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return UNDEFINED_RETURN_VALUE;
+ }
+ return ((AnimationPlayer)iPlayer).getiDisplayLocation().y;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getSnapshot(java.lang.String)
+ */
+ public byte[] getSnapshot(String aImageType) throws MediaException {
+ final String DEBUG_STR="VideoControl::getSnapshot(String aImageType)";
+ System.out.println(DEBUG_STR+"+");
+ checkState();
+ if (iStatus == NOT_INITIALIZED) {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ int imageData[]=((AnimationPlayer)iPlayer).getCurrentFrame(aImageType);
+ byte bytArry[]= new byte[imageData.length];
+ int pixelCount=bytArry.length;
+ System.out.println(DEBUG_STR+"imageData receved is "+imageData);
+ for(int i=0;i<pixelCount;i++)
+ bytArry[i]=(byte)imageData[i];
+ // Check the permission here, so 'the moment' is not lost?
+ //Security.ensurePermission(PERMISSION, PERMISSION, PERM_ARGS);
+// ApplicationUtils appUtils = ApplicationUtils.getInstance();
+// PlayerPermission per = new PlayerPermission("audio/video recording","snapshot");
+// appUtils.checkPermission(per);
+ return bytArry;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getSourceHeight()
+ */
+ public int getSourceHeight() {
+ checkState();
+ return ((AnimationPlayer)iPlayer).getSourceDimension().y;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#getSourceWidth()
+ */
+ public int getSourceWidth() {
+ checkState();
+ return ((AnimationPlayer)iPlayer).getSourceDimension().x;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#initDisplayMode(int, java.lang.Object)
+ */
+ public Object initDisplayMode(int aMode, Object aArg) {
+ final String DEBUG_STRING = "VideoControl::initDisplayMode(int, Object)";
+ System.out.println(DEBUG_STRING + "+");
+ // To check if state is in not closed state
+ checkState();
+ System.out.println(DEBUG_STRING+"After checking state ");
+ if (iStatus != NOT_INITIALIZED) {
+ // IllegalStateException - Thrown if initDisplayMode is
+ // called again after it has previously been called successfully.
+ throw new IllegalStateException(
+ "initDisplayMode() already called successfully");
+ }
+ System.out.println(DEBUG_STRING+"Going to get the eswtDisplay, mode is "+aMode+" argument is "+aArg);
+ // Get the Display object of ESWT
+ if(aArg!=null && aArg.equals(Control.class.getName())){
+ iDisplay =Display.getDefault();
+// System.out.println(DEBUG_STRING+"Display object created"+iDisplay );
+ }else{
+ iDisplay = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ }
+// System.out.println(DEBUG_STRING+"After getting the display"+iDisplay);
+ if (aMode == USE_GUI_PRIMITIVE) {
+ System.out.println(DEBUG_STRING + " mode is USE_GUI_PRIMITIVE");
+ Object guiObject = null;
+ if (aArg == null) {
+ guiObject = initNullMode();
+ } else {
+ if (aArg.equals(GUI_OBJECT_CLASS_NAME)) {
+ guiObject = initLCDUI();
+ } else // try load dynamic display mode
+ {
+ guiObject = initDynamicDisplayMode(aArg);
+ System.out.println(DEBUG_STRING+"After returning from the initDynamicDisplayMode() "+guiObject);
+ // Since it is eswtControl itself so no need of LCDUIInvoker here
+ // assign it in iControl and return immediately from here
+ iControl=(Control)guiObject;
+ // Now we will change the status, when MIDlet developer will call the setParent
+ iStatus = USE_GUI_PRIMITIVE;
+ return iControl;
+ }
+ }
+ // this will return the control as null, because the item might not
+ // have been appended in form
+ // Solution to this is as:- Add the listener through LCDUIInvoker
+ // and when item will be appended
+ // by midlet developer, notifyControlAvailable function of
+ // ItemStateChangeListener will be called
+ iControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker
+ .getEswtControl(guiObject);
+ // add this class as item state change listener
+ com.nokia.mj.impl.nokialcdui.LCDUIInvoker
+ .setItemControlStateChangeListener(this, (Item)guiObject);
+ iStatus = USE_GUI_PRIMITIVE;
+ return guiObject;
+ } else if (aMode == USE_DIRECT_VIDEO) {
+ if (aArg != null) {
+ if (!(aArg instanceof javax.microedition.lcdui.Canvas)) {
+ throw new java.lang.IllegalArgumentException(
+ "For USE_DIRECT_VIDEO mode argument should be of type Canvas");
+ }
+ } else {
+ throw new java.lang.IllegalArgumentException(
+ "For USE_DIRECT_VIDEO mode argument should not be null");
+ }
+ iControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker
+ .getEswtControl(aArg);
+ System.out.println(DEBUG_STRING
+ + "This is USE_DIRECT_VIDEO mode, control is " + iControl);
+ iStatus = USE_DIRECT_VIDEO;
+ } else {
+ throw new java.lang.IllegalArgumentException(
+ "Mode not supported or invalid, "
+ + "valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
+ }
+ System.out.println(DEBUG_STRING + "-");
+ return null;
+ }
+ /**
+ *
+ * @return
+ */
+ private Object initLCDUI(){
+ final String DEBUG_STR="VideoControl::initLCDUI()";
+ System.out.println(DEBUG_STR+"+");
+ iVideoItem = new VideoItem(((AnimationPlayer)iPlayer).getImageDimension());
+ iPlayer.addPlayerListener(iVideoItem);
+ iStatus = USE_GUI_PRIMITIVE;
+ System.out.println(DEBUG_STR+"-");
+ return iVideoItem;
+ }
+
+ /**
+ * Initializes USE_GUI_PRIMITIVE mode when null parameter is given to
+ * initDisplayMode method.
+ * UI toolkit gets selected when application uses UI toolkit
+ * first time. After this selection null parameter must be
+ * interpreted as the selected UI toolkit. initDisplayMode call
+ * with null parameter before the selection must cause
+ * IllegalArgumentException if there are several toolkits.
+ * @return GUI object
+ */
+ private Object initNullMode() {
+ String DEBUG_STR = "VideoControl::initNullMode()";
+
+ String toolkit = null;
+
+ Object guiObject = null;
+
+ // If lcdui was selected init it even if there might be several
+ // toolkits. This is done to support existing applications.
+ if ((LCDUI_PACKAGE + DISPLAY).equals(toolkit)) {
+ System.out.println(DEBUG_STR + "going to use initLCDUI function ");
+ guiObject = initLCDUI();
+ } else {
+ try {
+ System.out.println(DEBUG_STR + "Seems it is ESWT toolkit ");
+ // Several UI toolkits are supported if there are eSWT classes
+ // and eSWT direct content component
+ // Trying to load eSWT Listener interface or eSWT GUI factory
+ // does not cause any initialization to eSWT.
+ Class.forName(ESWT_PACKAGE + LISTENER);
+ Class.forName(ESWT_PACKAGE + ESWT_CONTROL
+ + GUI_FACTORY_CLASS_NAME);
+
+ // check if eSWT was selected
+ if ((ESWT_PACKAGE + DISPLAY).equals(toolkit))
+ {
+ System.out
+ .println(DEBUG_STR
+ + "It is eswtPackage going to call initDynamicDisplay ");
+ guiObject = initDynamicDisplayMode(ESWT_PACKAGE
+ + ESWT_CONTROL + GUI_FACTORY_CLASS_NAME);
+ } else {
+ // If no toolkit is registered and if lcdui library exists
+ // select it
+ try {
+ Class.forName(LCDUI_PACKAGE + DISPLAY);
+
+ guiObject = initLCDUI();
+ } catch (ClassNotFoundException cnfe) {
+ // If there are several toolkits and none is selected
+ // IllegalArgumentException must be thrown
+ throw new IllegalArgumentException(
+ "UI toolkit is not available or found.");
+ }
+ }
+ } catch (ClassNotFoundException cnfe) {
+ System.out.println(DEBUG_STR
+ + "Exception caought, going to call initLCDUI funtion");
+ // Only lcdui is supported
+ guiObject = initLCDUI();
+ }
+ }
+ return guiObject;
+ }
+
+ /**
+ *
+ * @param aMode class name of the component
+ * @return
+ */
+ //MobileShell iMobileShell=null;
+ ProxyControl control=null;
+ private Object initDynamicDisplayMode(Object aMode) {
+ final String DEBUG_STR="VideoControl::initDynamicDisplayMode()";
+ //MMAGUIFactory guiFactory = null;
+ try {
+// String className = ((String) aMode).toLowerCase();
+ // there is no more any Factory class
+// + GUI_FACTORY_CLASS_NAME;
+ System.out.println(DEBUG_STR+"Class name is "+aMode);
+ // Following line make sure that class name provided in aMode is proper
+ Class guiClass = Class.forName((String)aMode);
+ iDisplay.syncExec(new Runnable() {
+ public void run() {
+ control=new ProxyControl();
+ }
+ });
+
+ System.out.println(DEBUG_STR+"Class instantiated is "+control);
+ //guiFactory = (MMAGUIFactory) guiClass.newInstance();
+ } catch (ClassNotFoundException cnfe) {
+ // if the class could not be found
+ throw new IllegalArgumentException(
+ "Mode not supported or invalid, "
+ + "valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
+// } catch (IllegalAccessException iae) {
+// // if the class or initializer is not accessible
+// throw new IllegalArgumentException("Mode: " + aMode + " caused "
+// + iae);
+// } catch (InstantiationException ie) {
+// // if an application tries to instantiate an abstract class or an
+// // interface, or if the instantiation fails for some other reason
+// throw new IllegalArgumentException("Mode: " + aMode + " caused "
+// +[= ie);
+ } catch (ClassCastException cce) {
+ // Thrown to indicate that the code has attempted to cast an
+ // object to a subclass of which it is not an instance.
+ throw new IllegalArgumentException("Mode: " + aMode + " caused "
+ + cce);
+ }catch(Exception e){
+ System.out.println("Exception thrown while creating the control object"+e);
+ e.printStackTrace();
+ }
+// Object guiObject = guiFactory.initDisplayMode();
+// return guiObject;
+ return control;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#setDisplayFullScreen(boolean)
+ */
+ public void setDisplayFullScreen(final boolean aFullScreenMode)
+ throws MediaException {
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ if(aFullScreenMode){
+ //Image size should be resized to maximum width,
+ //so that the aspect ratio should be maintained
+
+ ((AnimationPlayer)iPlayer).updateImageData(360, 360);
+ // when the size is set to full screen, set the location to 0,0
+ // but what if user will exit from the full screen mode,
+ //we will have to revert back to the original position
+ // Image should be drawn at the center of the screen
+ setDisplayLocation(0, 140);
+ }
+ iDisplay.syncExec(new Runnable(){
+ public void run(){
+ MobileShell shell= (MobileShell)iControl.getShell();
+ shell.setFullScreenMode(aFullScreenMode);
+ }
+ });
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#setDisplayLocation(int, int)
+ */
+ public void setDisplayLocation(int aX, int aY) {
+ final String DEBUG_STR="VideoControl::setDisplayLocation";
+ System.out.println(DEBUG_STR+">>>>>>> Control is "+iControl);
+ // in case of customItem, we are getting canvasExtension as control
+ // and in this case we need to ignore the setDisplayLocation call.
+ // it is also possible that iControl may be null( it will be null until and unless
+ // notifyControlAvailable function is not get called)
+ if(iControl==null || (iControl instanceof org.eclipse.swt.internal.extension.CanvasExtension))
+ return ;
+ ((AnimationPlayer)iPlayer).setDisplayLocation(aX, aY);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#setDisplaySize(int, int)
+ */
+ public void setDisplaySize(int aWidth, int aHeight) throws MediaException {
+ final String DEBUG_STR="VideoControl::setDisplaySize(int aWidth, int aHeight)";
+ System.out.println(DEBUG_STR+"width "+aWidth+" aHeight "+aHeight);
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ if (aWidth <= 0 || aHeight <= 0)
+ {
+ throw new IllegalArgumentException(
+ "Width and height must be positive");
+ }
+ ((AnimationPlayer) iPlayer).updateImageData(aWidth,aHeight);
+ // Since the DisplaySize is being changed, we need to change the
+ // size of VideoItem as well
+ // if the videoItem is not null, it means currently we are playing animation on form
+ if(iVideoItem!=null)// means it is for customItem
+ iVideoItem.setPreferredSize(aWidth, aHeight);
+ // Notify to all player listener that video Size has been changed
+ ((AnimationPlayer) iPlayer).getiPlayerListenerImpl().postEvent(PlayerListener.SIZE_CHANGED, this);
+ System.out.println(DEBUG_STR+"-");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.microedition.media.control.VideoControl#setVisible(boolean)
+ */
+ public void setVisible(final boolean aVisible) {
+ if (iControl != null) {
+ iDisplay.syncExec(new Runnable() {
+ public void run() {
+ iControl.setVisible(aVisible);
+ System.out.println("VideoControl::setVisible()"+aVisible);
+ }
+ });
+ }
+ }
+ /**
+ *
+ * @return Display object retrieved from ESWT
+ */
+ public Display getiDisplay() {
+ return iDisplay;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Control getControl() {
+ return iControl;
+ }
+ /**
+ * Function of ItemStateChangeListener
+ * @param ctrl
+ * @param item
+ */
+ public void notifyControlAvailable(Control ctrl,Item item){
+ final String DEBUG_STR= "VideoControl::notifyControlAvailable(Control ctrl,Item item)";
+ System.out.println(DEBUG_STR+"+");
+ iControl=ctrl;
+ System.out.println(DEBUG_STR+"Control is "+ctrl.hashCode()+ " Item is "+item);
+ //TODO is it proper here to put the below line in try/catch?, remove if we can
+ // otherwise it may deteriorate the performance, as in case of CustomItem on each
+ // repaint, eSWT control is getting destroyed, and reconstructed
+ try {
+ ((AnimationPlayer)iPlayer).addPaintListener(iControl);
+ } catch (MediaException e) {
+ // TODO What to do here
+ e.printStackTrace();
+ }
+ System.out.println(DEBUG_STR+"-");
+ }
+ /**
+ * Function of ItemStateChangeListener
+ * We don't need to do anything in this function
+ * @param item
+ */
+ public void notifyControlDisposed(Item item){
+ final String DEBUG_STR= "VideoControl::notifyControlDisposed(Item item)";
+ System.out.println(DEBUG_STR+"+");
+// System.out.println(DEBUG_STR+"Item Disposed is "+item);
+// System.out.println(DEBUG_STR+"-");
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoItem.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,101 @@
+package com.nokia.microedition.media.animation;
+
+import javax.microedition.lcdui.CustomItem;
+import javax.microedition.lcdui.Graphics;
+import javax.microedition.media.Player;
+import javax.microedition.media.PlayerListener;
+import org.eclipse.swt.graphics.Point;
+
+
+/**
+ *
+ */
+/**
+ * @author d35kumar
+ *
+ */
+
+public class VideoItem extends CustomItem implements PlayerListener {
+
+ /**
+ * Width of this item
+ */
+
+ int iWidth;
+
+ /**
+ * Height of this item
+ */
+ int iHeight;
+
+ /**
+ *
+ * @param dimension
+ */
+ protected VideoItem(Point dimension ) {
+ super("");
+ iWidth=dimension.x;
+ iHeight=dimension.y;
+ }
+
+ /**
+ *
+ * @param w
+ * @param h
+ */
+ protected VideoItem(int w, int h) {
+ super("");
+ iWidth=w;
+ iHeight=h;
+ }
+ /**
+ * @return the minimum content width of the item, used by form while layouting the item
+ */
+ protected int getMinContentWidth() {
+ return iWidth;
+ }
+
+ /**
+ * @return the minimum content height of the item, used by form while layouting the item
+ */
+ protected int getMinContentHeight() {
+ return iHeight;
+ }
+
+ /**
+ * @return the preferred content width of the item, used by form while layouting the item
+ */
+ protected int getPrefContentWidth(int height) {
+ return iWidth;
+ }
+
+ /**
+ * @return the preferred content height of the item, used by form while layouting the item
+ */
+
+ protected int getPrefContentHeight(int width) {
+ return iHeight;
+ }
+ /**
+ * This is dummy implementation of the paint method.
+ */
+ int count;
+ protected void paint(Graphics g, int w, int h) {
+ //TODO remove this code later
+ // this is added just for testing purpose
+ g.setColor(0x00a000);
+ g.fillRect(0,0,w,h);
+ g.setColor(0xFFFFFF);
+ g.drawString("paint"+(count++), w>>1, h>>1, Graphics.BASELINE|Graphics.HCENTER);
+ }
+
+ /**
+ * Whenever player will be resized this function will be invoked and it will call the invalidate method of custom item
+ */
+ public void playerUpdate(Player aPlayer, String aEvent, Object aEventData) {
+ System.out.println("VideoItem::playerUpdate() Event is "+aEvent+"Event Data is "+aEventData);
+ if (aEvent == SIZE_CHANGED) {
+ invalidate();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import org.eclipse.swt.widgets.*;
+import javax.microedition.lcdui.*;
+import org.eclipse.swt.graphics.Rectangle;
+
+
+public abstract class BaseDisplay
+{
+ // represents native side of display and initialized by derived class
+ protected int nativeDisplayHandle;
+ protected org.eclipse.swt.widgets.Control eswtCanvasControl;
+ private Rectangle rect;
+ private int[] rectDimension = new int[ 4 ];
+ public BaseDisplay()
+ {
+ rect = new Rectangle(0,0,0,0);
+ }
+/* protected void setESWTControl()
+ {
+ eswtCanvasControl =
+ }
+ */
+ public void GetCallbackInUiThread(int placeholder)
+ {
+ System.out.println("inside BaseDisplay : GetCallbackInUiThread +");
+ final int val = placeholder;
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ _nativeMethodCallInUiThread(nativeDisplayHandle , val);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside BaseDisplay : GetCallbackInUiThread....exception is " + e.toString());
+ }
+ System.out.println("inside BaseDisplay : GetCallbackInUiThread -");
+ }
+
+ public void setContentBound()
+ {
+ System.out.println("inside BaseDisplay : setContentBound +");
+ try{
+
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ eswtCanvasControl.setBounds(rect);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside BaseDisplay : setContentBound....exception is " + e.toString());
+ }
+ System.out.println("inside BaseDisplay : setContentBound -");
+ }
+
+
+ public void removeContentBound()
+ {
+ System.out.println("inside BaseDisplay : removeContentBound +");
+ try{
+
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ Rectangle emptyRect = new Rectangle(0,0,0,0);
+ eswtCanvasControl.setBounds(emptyRect);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside BaseDisplay : removeContentBound....exception is " + e.toString());
+ }
+ System.out.println("inside BaseDisplay : removeContentBound -");
+ }
+
+ public void redrawControl()
+ {
+ System.out.println("inside BaseDisplay : redrawControl +");
+ try{
+
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ // redraw entire bounds of receiver
+ eswtCanvasControl.redraw();
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside BaseDisplay : redrawControl....exception is " + e.toString());
+ }
+ System.out.println("inside BaseDisplay : redrawControl -");
+ }
+ /* called from native to reset the java side rect
+ Before the call of this function array is updated from native side
+ which can be used to refresh the UI screen rect and/or
+ set/remove bound rect
+ */
+ public void setRect()
+ {
+
+ rect.x = rectDimension[0];
+ rect.y = rectDimension[1];
+ rect.width = rectDimension[2];
+ rect.height = rectDimension[3];
+
+ System.out.println("BaseDisplay : setRect rect is reset with values: x =" + rect.x +"y ="+ rect.y +"width ="+rect.width+"height = "+ rect.height);
+
+ }
+
+ // abstract functions implemented by concrete class
+ protected abstract void setDisplaySize(int aWidth, int aHeight);
+ protected abstract void setDisplayFullScreen(final boolean aFullScreenMode);
+ protected abstract void setDisplayLocation(int aX, int aY);
+ protected abstract void setVisible(boolean aVisible);
+ protected abstract int getDisplayHeight();
+ protected abstract int getDisplayWidth();
+ protected abstract int getDisplayX();
+ protected abstract int getDisplayY();
+ protected abstract int getSourceWidth();
+ protected abstract int getSourceHeight();
+ protected abstract void getBoundRect();
+ protected abstract void setWindowResources();
+ protected abstract void setNativeHandle(int handle);
+ // Native methods
+ private native void _nativeMethodCallInUiThread(int nativeDisplayHandle , int placeholder);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ControlImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is an implementation of control
+*
+*/
+
+package com.nokia.microedition.media.control;
+
+import javax.microedition.media.Player;
+
+public class ControlImpl implements javax.microedition.media.Control
+{
+ protected Player iPlayer;
+ protected int iControlHandle;
+ protected int iEventSource;
+
+ /**
+ * Constructor
+ */
+ public ControlImpl()
+ {
+ }
+
+ /**
+ * Called when the Player is disposed
+ */
+ public void notifyDispose()
+ {
+ }
+
+ /**
+ * Set handles
+ * @param aPlayer Player instance
+ * @param aEventSource Handle to event source
+ * @param aControlHandle Handle Handle to control
+ */
+ public void setHandles(Player aPlayer,
+ int aEventSource,
+ int aControlHandle)
+ {
+ iPlayer = aPlayer;
+ iEventSource = aEventSource;
+ iControlHandle = aControlHandle;
+
+ _setHandle(aEventSource, aControlHandle, this);
+ }
+
+ /**
+ * Throws IllegalStateException if player is closed and control
+ * cannot be used anymore.
+ * @throws IllegalStateException if Player is closed.
+ */
+ protected void checkState()
+ {
+ if (iPlayer.getState() == Player.CLOSED)
+ {
+ throw new IllegalStateException("Player is CLOSED.");
+ }
+ }
+
+ private static native void _setHandle(int aEventSourceHandle,
+ int aControlHandle,
+ Object aControl);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/FramePositioningControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: FramePositioningControl controls frame position.
+*
+*/
+
+package com.nokia.microedition.media.control;
+import javax.microedition.media.Player;
+import javax.microedition.media.MediaException;
+
+
+/**
+ * FramePositioningControl methods cannot throw any exceptions.
+ * If an error occurs in native side, native side return default value.
+ */
+public class FramePositioningControl extends ControlImpl
+ implements javax.microedition.media.control.FramePositioningControl
+{
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+ protected static final int NOT_FOUND = -1; // value to return on error condition
+
+ /**
+ * @see FramePositioningControl
+ */
+ public int seek(int aFrameNumber)
+ {
+ checkState();
+
+ int frameNumber = _seek(iControlHandle, iEventSource, aFrameNumber);
+
+ // in case of error
+ if (frameNumber < 0)
+ {
+ if (aFrameNumber <= 0)
+ {
+ frameNumber = 0;
+ }
+ else
+ {
+ frameNumber = Integer.MAX_VALUE;
+ }
+ }
+
+ return frameNumber;
+ }
+
+ /**
+ * @see FramePositioningControl
+ */
+ public int skip(int aFramesToSkip)
+ {
+ checkState();
+
+ // Array will be used for input and output.
+ // For output, room is needed for return value
+ // and error code, thus length of 2.
+
+ int[] values = new int[ 2 ];
+ values[ 0 ] = aFramesToSkip;
+ values[ 1 ] = NO_ERROR;
+
+ int[] framesSkipped =
+ _skip(iControlHandle,
+ iEventSource,
+ values);
+
+ if (framesSkipped[ 1 ] != NO_ERROR)
+ {
+ throw new Error("skip() failed");
+ }
+
+ return framesSkipped[ 0 ];
+ }
+
+ /**
+ * @see FramePositioningControl
+ */
+ public long mapFrameToTime(int aFrameNumber)
+ {
+ checkState();
+
+ long frameMediaTime =
+ _mapFrameToTime(iControlHandle,
+ iEventSource,
+ aFrameNumber);
+ if (frameMediaTime < NO_ERROR)
+ {
+ frameMediaTime = NOT_FOUND; // error value
+ }
+
+ return frameMediaTime; // -1 if error
+ }
+
+ /**
+ * @see FramePositioningControl
+ */
+ public int mapTimeToFrame(long aMediaTime)
+ {
+ checkState();
+
+ // mapTimeToFrame(0) must not fail and must return
+ // the frame number of the first frame.
+
+ if (aMediaTime == 0)
+ {
+ return 0;
+ }
+
+ int frameNumber =
+ _mapTimeToFrame(iControlHandle,
+ iEventSource,
+ aMediaTime);
+ if (frameNumber < NO_ERROR)
+ {
+ frameNumber = NOT_FOUND; // error value
+ }
+
+ return frameNumber;
+ }
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native FramePositioningControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aFrameNumber Frame number to seek
+ * @return Number of frame that is actually seeked to
+ */
+ private native int _seek(int iControlHandle,
+ int iEventSource,
+ int aFrameNumber);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native FramePositioningControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aValues element 0 Number of frames to skip
+ * @return element 0 Actual number of frames skipped.
+ * element 1 Error code
+ */
+ private native int[] _skip(int iControlHandle,
+ int iEventSource,
+ int[] aValues);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native FramePositioningControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aFrameNumber The input frame number for conversion
+ * @return The converted media time in microseconds for the given frame
+ * (-1 on error).
+ */
+ private native long _mapFrameToTime(int iControlHandle,
+ int iEventSource,
+ int aFrameNumber);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native FramePositioningControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aMediaTime The input media time for the conversion in microseconds.
+ * @return The converted frame number for the given media time (-1 on error).
+ */
+ private native int _mapTimeToFrame(int iControlHandle,
+ int iEventSource,
+ long aMediaTime);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MIDIControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,469 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MIDIControl.
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Player;
+
+
+public class MIDIControl extends ControlImpl
+ implements javax.microedition.media.control.MIDIControl
+{
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+ protected static final int NOT_FOUND = -1;
+
+ /**
+ * Max data value for midi events.
+ */
+ private static final int MAX_VALUE = 127;
+
+ /**
+ * Min data value for midi event types.
+ */
+ private static final int MIN_TYPE = 0x80;
+
+ /**
+ * Max data value for midi event types.
+ */
+ private static final int MAX_TYPE = 0xFF;
+
+ /**
+ * Midi type reserved for system.
+ */
+ private static final int RESERVED_TYPE_A = 0xF0;
+
+ /**
+ * Midi type reserved for system.
+ */
+ private static final int RESERVED_TYPE_B = 0xF7;
+
+ /**
+ * Max channel number.
+ */
+ private static final int MAX_CHANNEL = 15;
+
+ /**
+ * Max bank number.
+ */
+ private static final int MAX_BANK = 16383;
+
+ /**
+ * Constant to use the default bank. Also the minimum bank value accepted.
+ */
+ private static final int DEFAULT_BANK = -1;
+
+ /**
+ * Constant value for the default bank.
+ */
+ private static final int DEFAULT_BANK_NUMBER = 0x3c80;
+
+ /**
+ * Constant MIDI control ID value for volume.
+ */
+ private static final int CONTROL_VOLUME = 0x07;
+
+ /**
+ * @see MIDIControl
+ */
+ public boolean isBankQuerySupported()
+ {
+ return false;
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public int[] getProgram(int aChannel)
+ throws MediaException
+ {
+ checkPlayerState();
+ checkChannel(aChannel);
+ // this method is not currently supported
+ throw new MediaException("Not supported");
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public int getChannelVolume(int aChannel)
+ {
+ checkPlayerState();
+ checkChannel(aChannel);
+
+ // Native side returns -1 if current volume cannot be
+ // determined for sure
+
+ int volume =
+ _getChannelVolume(iControlHandle, iEventSource, aChannel);
+
+ // return 0-127, or -1 if not known
+ if (volume < NOT_FOUND)
+ {
+ volume = NOT_FOUND;
+ }
+ return volume;
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public void setProgram(int aChannel, int aBank, int aProgram)
+ {
+ checkPlayerState();
+ checkChannel(aChannel);
+ checkBank(aBank);
+ checkProgram(aProgram);
+
+ // Handle query for default bank
+ if (aBank == DEFAULT_BANK)
+ {
+ aBank = DEFAULT_BANK_NUMBER;
+ }
+
+ int err = _setProgram(iControlHandle, iEventSource, aChannel, aBank, aProgram);
+
+ if (err < NO_ERROR)
+ {
+ throw new Error("setProgram() failed, Symbian OS error: " + err);
+ }
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public synchronized void setChannelVolume(int aChannel, int aVolume)
+ {
+ checkPlayerState();
+ checkChannel(aChannel);
+
+ // Volume must be between 0 - MAX_VALUE
+ if (aVolume < 0 ||
+ aVolume > MAX_VALUE)
+ {
+ throw new IllegalArgumentException("Invalid volume " + aVolume +
+ ", valid range is 0 <= volume <= 127");
+ }
+
+ int err = _setChannelVolume(iControlHandle, iEventSource, aChannel, aVolume);
+ if (err < NO_ERROR)
+ {
+ throw new Error("setChannelVolume() failed, SymbianO S error: " + err);
+ }
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public int[] getBankList(boolean aCustom)
+ throws MediaException
+ {
+ checkPlayerState();
+ // this method is not currently supported
+ throw new MediaException("Not supported");
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public int[] getProgramList(int aBank)
+ throws MediaException
+ {
+ checkPlayerState();
+ checkBank(aBank);
+ // this method is not currently supported
+ throw new MediaException("Not supported");
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public String getProgramName(int aBank, int aProg)
+ throws MediaException
+ {
+ checkPlayerState();
+ checkBank(aBank);
+ checkProgram(aProg);
+ // this method is not currently supported
+ throw new MediaException("Not supported");
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public String getKeyName(int aBank, int aProg, int aKey)
+ throws MediaException
+ {
+ checkPlayerState();
+ checkBank(aBank);
+ checkProgram(aProg);
+ checkKey(aKey);
+ // this method is not currently supported
+ throw new MediaException("Not supported");
+ }
+
+ /**
+ * Short midi events are delegated to the longMidiEvent method.
+ *
+ * @see MIDIControl
+ */
+ public void shortMidiEvent(int aType, int aData1, int aData2)
+ {
+ checkPlayerState();
+
+ // Data parameters must be between 0 to MAX_VALUE
+ if (aData1 < 0 ||
+ aData1 > MAX_VALUE ||
+ aData2 < 0 ||
+ aData2 > MAX_VALUE)
+ {
+ throw new IllegalArgumentException(
+ "Invalid data, valid range is 0 <= data <= 127");
+ }
+
+ // Check type:
+ // must be MIN_TYPE..MAX_TYPE, excluding RESERVED_TYPE_A and
+ // RESERVED_TYPE_B, which are reserved for system exclusive.
+ if (aType == RESERVED_TYPE_A ||
+ aType == RESERVED_TYPE_B ||
+ aType < MIN_TYPE ||
+ aType > MAX_TYPE)
+ {
+ throw new IllegalArgumentException("Invalid midi type " + aType +
+ ", valid range is 0x80 <= type <= 0xFF or 0xF0 or 0xF7");
+ }
+
+ // Format to long MIDI event
+ byte[] data = new byte[ 3 ];
+
+ // aType and datas are checked to fit in a byte range 0..127
+ data[ 0 ] = (byte)aType;
+ data[ 1 ] = (byte)aData1;
+ data[ 2 ] = (byte)aData2;
+
+ // Send short midi event as a long midi event.
+ // Length of short midi event is 3.
+ longMidiEvent(data, 0, 3);
+ }
+
+ /**
+ * @see MIDIControl
+ */
+ public int longMidiEvent(byte[] aData, int aOffset, int aLength)
+ {
+ checkPlayerState();
+
+ // Check parameters
+ if ((aData == null) ||
+ (aData.length < aOffset + aLength) || // Do not exceed array length
+ (aOffset < 0) || // Offset may not be negative
+ (aLength < 0)) // Length may not be negative
+ {
+ throw new IllegalArgumentException("Illegal array");
+ }
+
+ // Zero length, just return
+ if (aLength == 0)
+ {
+ return 0;
+ }
+
+ // Send to the native side.
+ int retVal = _sendMidiEvent(iControlHandle,
+ iEventSource,
+ aData,
+ aOffset,
+ aLength);
+
+ if (retVal < NO_ERROR)
+ {
+ return -1;
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Restarts native MIDI engine and initializes it with specified sequence.
+ * For internal use.
+ */
+ public void reInitializeMidi(byte[] aMidiSequence, int aOffset, int aLength)
+ {
+ int retVal = _reInitializeMidi(iControlHandle,
+ iEventSource,
+ aMidiSequence,
+ aOffset,
+ aLength);
+ if (retVal < NO_ERROR)
+ {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ /**
+ * Checks program parameter.
+ */
+ private void checkProgram(int aProgram)
+ {
+ // Program must be between 0 - MAX_VALUE
+ if (aProgram < 0 ||
+ aProgram > MAX_VALUE)
+ {
+ throw new IllegalArgumentException("Invalid program "
+ + aProgram + ", valid range is 0 <= program <= 127");
+ }
+ }
+
+ /**
+ * Checks bank parameter.
+ */
+ private void checkBank(int aBank)
+ {
+ // Bank must be between DEFAULT_BANK - MAX_BANK
+ if (aBank < DEFAULT_BANK ||
+ aBank > MAX_BANK)
+ {
+ throw new IllegalArgumentException("Invalid bank "
+ + aBank + ", valid range is 1 <= bank <= 16383");
+ }
+ }
+
+ /**
+ * Checks channel parameter.
+ */
+ private void checkChannel(int aChannel)
+ {
+ // Channel must be between 0 - MAX_CHANNEL
+ if (aChannel < 0 ||
+ aChannel > MAX_CHANNEL)
+ {
+ throw new IllegalArgumentException("Invalid channel "
+ + aChannel + ", valid range is 0 <= channel <= 15");
+ }
+ }
+
+ /**
+ * Checks key number parameter.
+ */
+ private void checkKey(int aKey)
+ {
+ // Channel must be between 0 - MAX_VALUE
+ if (aKey < 0 ||
+ aKey > MAX_VALUE)
+ {
+ throw new IllegalArgumentException("Invalid key "
+ + aKey + ", valid range is 0 <= key <= 127");
+ }
+ }
+
+ /**
+ * Checks that player has been prefetched.
+ */
+ private void checkPlayerState()
+ {
+ // Player must be in PREFETCHED or STARTED state.
+ int state = iPlayer.getState();
+ if (state != Player.PREFETCHED &&
+ state != Player.STARTED)
+ {
+ throw new IllegalStateException(
+ "Player must be in PREFETCHED or STARTED state");
+ }
+ }
+
+ //
+ // Native methods
+ //
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native MIDIControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aChannel number of channel which is subject to program change.
+ * @param aBank bank to be set.
+ * @param aProgram program to be set.
+ * @return error code. Negative is error occured.
+ */
+ private native int _setProgram(int aControlHandle,
+ int aEventSourceHandle,
+ int aChannel,
+ int aBank,
+ int aProgram);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native MIDIControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aChannel channel which volume to get
+ * @return The channel volume. -1 if an error occured or if not known.
+ */
+ private native int _getChannelVolume(int aControlHandle,
+ int aEventSourceHandle,
+ int aChannel);
+
+ /**
+ * Native Implementation.
+ * @param aControlHandle Pointer to the native MIDIControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aChannel channel which volume to set
+ * @param aVolume volume to set
+ */
+ private native int _setChannelVolume(int aControlHandle,
+ int aEventSource,
+ int aChannel,
+ int aVolume);
+
+ /**
+ * Native implementation. Array length will asserted only in debug builds.
+ *
+ * @param aControlHandle Pointer to the native MIDIControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aData Array of the bytes to send.
+ * @param aOffset Start offset in data array.
+ * @param aLength Number of bytes to be sent.
+ * @return The number of bytes actually sent to the device.
+ * -1 if an error occured.
+ * KErrArgument if IllegalArgument exception must be thrown
+ */
+ private native int _sendMidiEvent(int aControlHandle,
+ int aEventSourceHandle,
+ byte[] aData,
+ int aOffset,
+ int aLength);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native MIDIControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aMidiSequence Array of the bytes containing midi sequence
+ * for initialization
+ * @param aOffset Start offset in data array.
+ * @param aLength Number of bytes to be sent.
+ * @return Native error code.
+ */
+ private native int _reInitializeMidi(int aControlHandle,
+ int aEventSourceHandle,
+ byte[] aMidiSequence,
+ int aOffset,
+ int aLength);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMACanvasDisplay.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import javax.microedition.lcdui.*;
+import org.eclipse.ercp.swt.mobile.MobileShell;
+import org.eclipse.swt.graphics.Rectangle;
+
+
+
+public class MMACanvasDisplay extends BaseDisplay
+{
+
+ private int iEventSourceHandle;
+ private MMAPIeSWTObserver eswtObserver;
+ private int x;
+ private int y;
+ private int qwidgetHandle;
+ private int eSWTcontrolLocationX;
+ private int eSWTcontrolLocationY;
+
+ // index 0 : x-coordinate of topleft corner of display
+ // index 1 : y-coordinate of topleft corner of display
+ // index 3 : width of display
+ // index 4 : height of display
+
+ private int[] displayboundarr = new int[ 4 ];
+ // represents native side of display
+
+
+ public MMACanvasDisplay(int aEventSourceHandle , javax.microedition.lcdui.Canvas canvas)
+ {
+ iEventSourceHandle = aEventSourceHandle;
+ eswtObserver = new MMAPIeSWTObserver();
+ eswtCanvasControl = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtControl(canvas);
+ //super.setESWTControl(eswtCanvasControl);
+ }
+
+ private void addListeners()
+ {
+ eswtObserver.addControlListenerToControl(eswtCanvasControl);
+ eswtObserver.addShellListenerToControl(eswtCanvasControl);
+ eswtObserver.addDisposeListenerToControl(eswtCanvasControl);
+ }
+
+ public void setNativeHandle( int handle)
+ {
+ System.out.println("MMACanvasDisplay.java : setNativeHandle :" + handle);
+ nativeDisplayHandle = handle;
+ eswtObserver.setDisplayToObserver(this);
+ addListeners();
+ }
+
+ public void setDisplaySize(int aWidth, int aHeight)
+ {
+ final int width = aWidth;
+ final int height = aHeight;
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ org.eclipse.swt.graphics.Point size = new org.eclipse.swt.graphics.Point(width,height);
+ eswtCanvasControl.redraw();
+
+ System.out.println("inside videoControl's setDisplaySize redraw called");
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+
+
+System.out.println("inside videoControl's setDisplaySize +");
+ _setDisplaySize(nativeDisplayHandle,
+ iEventSourceHandle,
+ aWidth,
+ aHeight);
+System.out.println("inside videoControl's setDisplaySize -");
+ }
+
+ public void setDisplayFullScreen(final boolean aFullScreenMode)
+ {
+ try{
+
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ eswtCanvasControl.setBounds(disp.getClientArea());
+ new MobileShell(disp).setFullScreenMode(aFullScreenMode);
+ // instruct native to switch to full screen mode
+ _setFullScreenMode(nativeDisplayHandle,aFullScreenMode);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+
+ }
+
+ public void setDisplayLocation(int aX, int aY)
+ {
+
+ final int videoControlLocationX = aX;
+ final int videoControlLocationY = aY;
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ org.eclipse.swt.graphics.Point topleftposition = eswtCanvasControl.getLocation();
+ eSWTcontrolLocationX = topleftposition.x;
+ eSWTcontrolLocationY = topleftposition.y;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ // To Avoid UI thread block
+ System.out.println("inside videoControl's setDisplaySize before calling _setPosition " );
+ _setPosition(nativeDisplayHandle,
+ iEventSourceHandle,
+ eSWTcontrolLocationX,
+ eSWTcontrolLocationY,
+ videoControlLocationX,
+ videoControlLocationY);
+ System.out.println("inside videoControl's setDisplaySize after calling _setPosition " );
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ System.out.println("inside videoControl's setDisplaySize before redraw() " );
+ eswtCanvasControl.redraw();
+ System.out.println("inside videoControl's setDisplaySize after redraw() " );
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplayLocation in redraw()....exception is " + e.toString());
+ }
+
+
+ System.out.println("inside videoControl's setDisplayLocation coming out of setDisplayLocation()");
+ }
+
+
+ public void setVisible(boolean aVisible)
+ {
+ try{
+ final boolean visible = aVisible;
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.asyncExec(new Runnable() {
+ public void run() {
+ //eswtCanvasControl.setVisible(visible);
+ // call native side to set the visibiity
+ _setVisible(nativeDisplayHandle,visible);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ //System.out.println("inside videoControl's setVisible before native call");
+ // _setVisible(nativeDisplayHandle,aVisible);
+ // System.out.println("inside videoControl's setVisible after native call");
+ }
+
+ public int getDisplayHeight()
+ {
+
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+
+ public void run() {
+ y = eswtCanvasControl.getSize().y;
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ return y;
+
+ }
+
+ public int getDisplayWidth()
+ {
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ x = eswtCanvasControl.getSize().x;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+
+ return x;
+
+ }
+ public int getDisplayX()
+ {
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ x = eswtCanvasControl.getLocation().x;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ return x;
+
+ }
+
+ public int getDisplayY()
+ {
+
+
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ y = eswtCanvasControl.getLocation().y;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ return y;
+ }
+
+ public int getSourceWidth()
+ {
+ // return width of the source video
+
+ return 0;
+
+ }
+
+ public int getSourceHeight()
+ {
+ // return height of the source video
+
+ return 0;
+ }
+
+ public void getBoundRect()
+ {
+ System.out.println("MMACanvasDisplay.java :getBoundRect()");
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ Rectangle boundrect = eswtCanvasControl.getBounds();
+ displayboundarr[0] = boundrect.x ;
+ displayboundarr[1] = boundrect.y ;
+ displayboundarr[2] = boundrect.width ;
+ displayboundarr[3] = boundrect.height ;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ System.out.println("MMACanvasDisplay.java :getBoundRect() x =" + displayboundarr[0] + "y ="+ displayboundarr[1] +"width ="+ displayboundarr[2] +"height =" + displayboundarr[3] );
+ }
+
+
+public void getContainerRect()
+ {
+ // this function is not used for canvas case assuming that in case of canvas Bound rect and container rect is same.
+ // to do: need to confirm
+ getBoundRect();
+
+ }
+
+public void setContainerVisibilityToNative(final boolean active)
+ {
+ System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative + ");
+ new Thread(){
+ public void run(){
+ System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+ _setContainerVisible(iEventSourceHandle,nativeDisplayHandle,active);
+ }
+ }.start();
+
+ System.out.println("MMACanvasDisplay.java : SetContainerVisibilityToNative - ");
+ }
+
+public void setWindowResources()
+{
+ System.out.println("MMACanvasDisplay.java: setWindowResources windowHandle ");
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+
+ disp.syncExec(new Runnable() {
+ public void run() {
+ Shell shell = eswtCanvasControl.getShell();
+ qwidgetHandle = Internal_PackageSupport.topHandle(shell);
+ x = eswtCanvasControl.getSize().x;
+ y = eswtCanvasControl.getSize().y;
+ _setWindowToNative(nativeDisplayHandle,qwidgetHandle);
+ System.out.println("MMACanvasDisplay.java: setWindowResources qwidgetHandle is " + qwidgetHandle);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+ _setNativeWindowSize(nativeDisplayHandle,iEventSourceHandle,x,y);
+
+}
+
+/*
+// dummy
+
+public void dummy()
+{
+ _nativeDummy();
+}
+*/
+/*
+ public void getDisplaySize(int width, int height)
+ {
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ x = eswtCanvasControl.getSize().x;
+ y = eswtCanvasControl.getSize().y;
+
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("inside videoControl's setDisplaySize....exception is " + e.toString());
+ }
+
+ width = x;
+ height = y;
+ }
+
+ */
+ // Native methods
+
+
+ private native void _setVisible(int nativeDisplayHandle,
+ boolean value);
+
+ private native void _setContainerVisible(int iEventSourceHandle,
+ int nativeDisplayHandle,
+ boolean value);
+ private native void _setFullScreenMode(int nativeDisplayHandle, boolean value);
+ private native void _setWindowToNative(int nativeDisplayHandle,int qwidgetHandle);
+ private native void _setNativeWindowSize(int nativeDisplayHandle,int iEventSourceHandle, int width,int height);
+ private native void _setPosition(int nativeDisplayHandle,
+ int iEventSourceHandle,
+ int uiControlLocationX,
+ int uiControlLocationY,
+ int videoControlLocationX,
+ int videoControlLocationY);
+ private native void _setDisplaySize(int nativeDisplayHandle,
+ int iEventSourceHandle,
+ int eSWTcontrolLocationX,
+ int eSWTcontrolLocationY);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAGUIFactory.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.microedition.media.control;
+
+/**
+ * This interface provides extension point for GUIControl.USE_GUI_PRIMITIVE
+ * display mode.
+ */
+public interface MMAGUIFactory
+{
+ /**
+ * Initializes display mode and returns Object that can be used with
+ * GUI.
+ * @return Associated GUI object
+ */
+ Object initDisplayMode();
+
+ /**
+ * MMA will set content for container with this method after display
+ * mode is initialized.
+ * @param aHandle MMMADirectContent native handle.
+ * @throw NullPointerException if initDisplayMode has not been called.
+ */
+ void setContentHandle(int aHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAPIeSWTObserver.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,202 @@
+package com.nokia.microedition.media.control;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.events.*;
+import com.nokia.microedition.volumekeys.*;
+
+
+public class MMAPIeSWTObserver
+{
+ //MMAPILCDUIInvokerImpl mmapiLcduiInvoker;
+
+ mmacontrollistener cntrlsner ;
+ mmashelllistener shellsner ;
+ mmadisposelistener displsner;
+
+MMACanvasDisplay display;
+
+
+ public MMAPIeSWTObserver()
+ {
+ //mmapiLcduiInvoker = new MMAPILCDUIInvokerImpl();
+ }
+
+ public void setDisplayToObserver(MMACanvasDisplay display)
+ {
+ this.display = display;
+ cntrlsner = new mmacontrollistener(display);
+ shellsner = new mmashelllistener(display);
+ displsner = new mmadisposelistener(display);
+ }
+
+ public void addControlListenerToControl(final Control eSWTControl)
+ {
+
+ System.out.println("MMAPIeSWTObserver.java :addControlListenerToControl +");
+ //mmapiLcduiInvoker.AddControlListenerToControl(eSWTControl,(org.eclipse.swt.events.ControlListener)this);
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ eSWTControl.addControlListener(cntrlsner);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("addControlListenerToControl....exception is " + e.toString());
+ }
+
+ System.out.println("MMAPIeSWTObserver.java :addControlListenerToControl -");
+
+ }
+
+ public void addShellListenerToControl(final Control eSWTControl)
+ {
+ System.out.println("MMAPIeSWTObserver.java :addShellListenerToControl +");
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ eSWTControl.getShell().addShellListener(shellsner);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("addShellListenerToControl....exception is " + e.toString());
+ }
+
+ System.out.println("MMAPIeSWTObserver.java :addShellListenerToControl -");
+
+ }
+
+
+ public void addDisposeListenerToControl(final Control eSWTControl)
+ {
+ System.out.println("MMAPIeSWTObserver.java :addDisposeListenerToControl +");
+ //mmapiLcduiInvoker.AddDisposeListenerToControl(eSWTControl,(org.eclipse.swt.events.DisposeListener)this);
+
+ try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.syncExec(new Runnable() {
+ public void run() {
+ eSWTControl.addDisposeListener(displsner);
+ }
+ });
+ }
+ catch(Exception e)
+ {
+ System.out.println("addShellListenerToControl....exception is " + e.toString());
+ }
+ System.out.println("MMAPIeSWTObserver.java :addDisposeListenerToControl -");
+
+ }
+
+ public void removeControlListenerToControl(Control eSWTControl)
+ {
+ System.out.println("MMAPIeSWTObserver.java :removeControlListenerToControl +");
+ //mmapiLcduiInvoker.RemoveControlListenerToControl(eSWTControl,(org.eclipse.swt.events.ControlListener)this);
+ System.out.println("MMAPIeSWTObserver.java :removeControlListenerToControl -");
+
+ }
+ public void removeShellListenerToControl(Control eSWTControl)
+ {
+ System.out.println("MMAPIeSWTObserver.java :removeShellListenerToControl +");
+ //mmapiLcduiInvoker.RemoveShellListenerToControl(eSWTControl,(org.eclipse.swt.events.ShellListener)this);
+ System.out.println("MMAPIeSWTObserver.java :removeShellListenerToControl -");
+
+ }
+ public void removeDisposeListenerToControl(Control eSWTControl)
+ {
+ System.out.println("MMAPIeSWTObserver.java :removeDisposeListenerToControl +");
+ //mmapiLcduiInvoker.RemoveDisposeListenerToControl(eSWTControl,(org.eclipse.swt.events.DisposeListener)this);
+ System.out.println("MMAPIeSWTObserver.java :removeDisposeListenerToControl -");
+
+ }
+
+}
+
+
+// Control Listener
+
+class mmacontrollistener implements ControlListener
+{
+
+ private MMACanvasDisplay display;
+ mmacontrollistener(MMACanvasDisplay display)
+ {
+ this.display = display;
+
+ }
+ // from ControlListener
+ public void controlMoved(ControlEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :controlMoved callback");
+ }
+
+ public void controlResized(ControlEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :controlResized callback");
+ }
+}
+
+// ShellListener
+class mmashelllistener implements ShellListener
+{
+ private MMACanvasDisplay display;
+ mmashelllistener(MMACanvasDisplay display)
+ {
+ this.display = display;
+
+ }
+ // from ShellListener
+ public void shellActivated(ShellEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :shellActivated callback");
+ display.setContainerVisibilityToNative(true);
+ }
+
+ public void shellClosed(ShellEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :shellClosed callback");
+ }
+
+ public void shellDeactivated(ShellEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :shellDeactivated callback");
+ display.setContainerVisibilityToNative(false);
+ }
+
+ public void shellDeiconified(ShellEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :shellDeiconified callback");
+ }
+
+ public void shellIconified(ShellEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :shellIconified callback");
+ }
+
+
+}
+
+// DisposeListener
+
+class mmadisposelistener implements DisposeListener
+{
+ private MMACanvasDisplay display;
+ mmadisposelistener(MMACanvasDisplay display)
+ {
+ this.display = display;
+ }
+
+ // from DisposeListener
+ public void widgetDisposed(DisposeEvent e)
+ {
+ System.out.println("MMAPIeSWTObserver.java :widgetDisposed callback");
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/PitchControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PitchControl controls the pitch.
+*
+*/
+
+package com.nokia.microedition.media.control;
+
+/**
+ * TempoControl or RateControl methods cannot throw any exceptions.
+ * If an error occurs in native side, native side return default value.
+ */
+public class PitchControl extends ControlImpl
+ implements javax.microedition.media.control.PitchControl
+{
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+ protected static final int PITCH_OFFSET = 1000000;
+
+ /**
+ * @see PitchControl
+ */
+ public int setPitch(int aMillisemitones)
+ {
+ checkState();
+ int pitch =
+ _setPitch(iControlHandle, iEventSource, aMillisemitones);
+ if (pitch < NO_ERROR)
+ {
+ throw new Error("setPitch() failed, Symbian OS error: "
+ + pitch);
+ }
+ return pitch - PITCH_OFFSET;
+ }
+
+ /**
+ * @see PitchControl
+ */
+ public int getPitch()
+ {
+ checkState();
+ int pitch = _getPitch(iControlHandle, iEventSource);
+ if (pitch < NO_ERROR)
+ {
+ throw new Error(
+ "getPitch() failed, SymbianOS error: " + pitch);
+ }
+ return pitch - PITCH_OFFSET;
+ }
+
+ /**
+ * @see PitchControl
+ */
+ public int getMaxPitch()
+ {
+ checkState();
+ int pitch = _getMaxPitch(iControlHandle, iEventSource);
+ if (pitch < NO_ERROR)
+ {
+ throw new Error(
+ "getMaxPitch() failed, SymbianOS error: "
+ + pitch);
+ }
+ return pitch - PITCH_OFFSET;
+ }
+
+ /**
+ * @see PitchControl
+ */
+ public int getMinPitch()
+ {
+ checkState();
+ int pitch = _getMinPitch(iControlHandle, iEventSource);
+ if (pitch < NO_ERROR)
+ {
+ throw new Error(
+ "getMinPitch() failed, SymbianOS error: "
+ + pitch);
+ }
+ return pitch - PITCH_OFFSET;
+ }
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native PitchControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aMillisemitones The number of semi tones to raise the playback
+ * pitch.
+ * @return The actual pitch raise set
+ */
+ private native int _setPitch(int aControlHandle,
+ int aEventSourceHandle,
+ int aMillisemitones);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native PitchControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return the current playback pitch raise in "milli-semitones".
+ */
+ private native int _getPitch(int aControlHandle,
+ int aEventSourceHandle);
+
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native PitchControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return the maximum pitch raise in "milli-semitones".
+ */
+ private native int _getMaxPitch(int aControlHandle,
+ int aEventSourceHandle);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native PitchControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return the minimum pitch raise in "milli-semitones".
+ */
+ private native int _getMinPitch(int aControlHandle,
+ int aEventSourceHandle);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/RateControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RateControl controls the rate.
+*
+*/
+
+package com.nokia.microedition.media.control;
+import javax.microedition.media.Player;
+
+/**
+ * RateControl or RateControl methods cannot throw any exceptions.
+ * If an error occurs in native side, native side return default value.
+ */
+public class RateControl extends ControlImpl
+ implements javax.microedition.media.control.RateControl
+{
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+
+ /**
+ * @see RateControl
+ */
+ public int setRate(int aMilliRate)
+ {
+ checkState();
+ int rate = _setRate(iControlHandle, iEventSource, aMilliRate);
+ if (rate < NO_ERROR)
+ {
+ throw new Error(
+ "setRate() failed, Symbian OS error: " + rate);
+ }
+ return rate;
+ }
+
+ /**
+ * @see RateControl
+ */
+ public int getRate()
+ {
+ checkState();
+ int rate = _getRate(iControlHandle, iEventSource);
+ if (rate < NO_ERROR)
+ {
+ throw new Error(
+ "getRate() failed, Symbian OS error: " + rate);
+ }
+ return rate;
+ }
+
+ /**
+ * @see RateControl
+ */
+ public int getMaxRate()
+ {
+ checkState();
+ int rate = _getMaxRate(iControlHandle, iEventSource);
+ if (rate < NO_ERROR)
+ {
+ throw new Error(
+ "getMaxRate() failed, Symbian OS error: "
+ + rate);
+ }
+ return rate;
+ }
+
+ /**
+ * @see RateControl
+ */
+ public int getMinRate()
+ {
+ checkState();
+ int rate = _getMinRate(iControlHandle, iEventSource);
+ if (rate < NO_ERROR)
+ {
+ throw new Error(
+ "getMinRate() failed, Symbian OS error: "
+ + rate);
+ }
+ return rate;
+ }
+
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native RateControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aMilliRate The playback rate to set
+ * @return The actual rate set.
+ */
+ private native int _setRate(int aControlHandle,
+ int aEventSourceHandle,
+ int aMilliRate);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native RateControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return The current playback rate.
+ */
+ private native int _getRate(int aControlHandle,
+ int aEventSourceHandle);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native RateControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return The maximum rate.
+ */
+ private native int _getMaxRate(int aControlHandle,
+ int aEventSourceHandle);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native RateControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return The minimum rate.
+ */
+ private native int _getMinRate(int aControlHandle,
+ int aEventSourceHandle);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/RecordControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,634 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class controls the recording of the media from a Player.
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.io.Connector;
+import javax.microedition.io.Connection;
+import javax.microedition.io.StreamConnection;
+import javax.microedition.io.HttpConnection;
+import javax.microedition.io.ConnectionNotFoundException;
+import com.nokia.microedition.media.protocol.OutputStreamWriter;
+import com.nokia.microedition.media.PlayerImpl;
+import com.nokia.mj.impl.media.PlayerPermission;
+import com.nokia.mj.impl.utils.Logger;
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+
+/**
+ * <code>RecordControl</code> controls the recording of media
+ * from a <code>Player</code>. <code>RecordControl</code> records
+ * what's currently being played by the <code>Player</code>.
+ * <p>
+ * <h2>Example</h2>
+ * <blockquote>
+ * <pre>
+ * try {
+ * // Create a Player that captures live audio.
+ * Player p = Manager.createPlayer("capture://audio");
+ * p.realize();
+ * // Get the RecordControl, set the record stream,
+ * // start the Player and record for 5 seconds.
+ * RecordControl rc = (RecordControl)p.getControl("RecordControl");
+ * ByteArrayOutputStream output = new ByteArrayOutputStream();
+ * rc.setRecordStream(output);
+ * rc.startRecord();
+ * p.start();
+ * Thread.currentThread().sleep(5000);
+ * rc.commit();
+ * p.close();
+ * } catch (IOException ioe) {
+ * } catch (MediaException me) {
+ * } catch (InterruptedException ie) { }
+ * </pre>
+ * </blockquote>
+ *
+ * @see javax.microedition.media.Player
+ */
+public class RecordControl extends ControlImpl
+ implements javax.microedition.media.control.RecordControl, Runnable
+{
+
+ protected static final int ERROR_NONE = 0; // native side returns if OK
+
+ private OutputStreamWriter iOutputStreamWriter;
+ private Connection iConnection;
+ private boolean iStarted = false;
+
+ // commit() must be allowed when RecordControl is already
+ // committed from native side
+ private boolean iIgnoreCommitState = false;
+
+ private static final String REQUEST_NAME = "User-Agent";
+ private static final String REQUEST_VALUE =
+ "Profile/MIDP-2.0 Configuration/CLDC-1.0";
+ private static final String CONTENT_TYPE = "Content-Type";
+
+ private static final String RECORD_CONTROL_PERMISSION =
+ "javax.microedition.media.control.RecordControl";
+
+ /**
+ * RecordControl constructor
+ */
+ public RecordControl()
+ {
+ }
+
+ /**
+ * Called when the Player is disposed
+ */
+ public void notifyDispose()
+ {
+ try
+ {
+ closeStream();
+ }
+ catch (IOException ioe)
+ {
+ // cannot throw error here
+ Logger.WLOG(Logger.EJavaMMAPI,
+ "Closing stream failed: ", ioe);
+ }
+ }
+
+ private void closeStream() throws IOException
+ {
+ if (iOutputStreamWriter != null)
+ {
+ // wait until the StreamWriter events are fully handled
+ iOutputStreamWriter.close();
+ }
+ try
+ {
+ if (iConnection != null)
+ {
+ // If stream was created with setRecordLocation( String aLocator )
+ // method there is connection object and we have to close
+ // the OutputStream. Stream set with setRecordStream may not be
+ // closed. Any open streams would cause the connection to be
+ // held open until they themselves are closed.
+ iOutputStreamWriter.closeStream();
+ }
+ }
+ finally
+ {
+ iOutputStreamWriter = null;
+ if (iConnection != null)
+ {
+ iConnection.close();
+ iConnection = null;
+ }
+ }
+ }
+
+ /**
+ * Set the output stream where the data will be
+ * recorded.
+ *
+ * @param aStream The output stream where the data will be recorded.
+ * @exception IllegalStateException Thrown if one of the following
+ * conditions is true:
+ * <ul>
+ * <li>
+ * <code>startRecord</code> has been called and <code>commit</code> has
+ * not been called.
+ * <li>
+ * <code>setRecordLocation</code> has been called and <code>commit</code> has
+ * not been called.
+ * </ul>
+ *
+ * @exception IllegalArgumentException Thrown if
+ * <code>stream</code> is null.
+ *
+ */
+ public void setRecordStream(OutputStream aStream)
+ {
+ checkState();
+ if (null == aStream)
+ {
+ throw new IllegalArgumentException("Stream is null");
+ }
+
+ // Stream is already set (and not commited)
+ if (iOutputStreamWriter != null)
+ {
+ throw new IllegalStateException(
+ "Stream is already set but not commited yet");
+ }
+
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PlayerPermission per = new PlayerPermission("audio/video recording","record");
+ appUtils.checkPermission(per);
+
+ privateSetRecordStream(aStream);
+ }
+
+ /**
+ * Private method for setting record stream.
+ * Called from setRecordStream and setRecordLocation methods.
+ * @param aStream The output stream where the data will be recorded.
+ */
+ private void privateSetRecordStream(OutputStream aStream)
+ {
+ int playerHandle = ((PlayerImpl)iPlayer).getPlayerHandle();
+ // Create a writer for OutputStream
+ iOutputStreamWriter = new OutputStreamWriter(aStream,
+ iEventSource,
+ this,
+ playerHandle);
+
+ // Set the writer to the native object
+ int handle = _setRecordStream(iEventSource,
+ iControlHandle,
+ iOutputStreamWriter);
+ if (handle < ERROR_NONE)
+ {
+ iOutputStreamWriter = null;
+ throw new IllegalArgumentException(
+ "setRecordStream() failed, Symbian OS error: " + handle);
+ }
+ else
+ {
+ iOutputStreamWriter.start(handle);
+ }
+ }
+
+ /**
+ * Set the output location where the data will be recorded.
+ *
+ * @param aLocator The locator specifying where the
+ * recorded media will be saved. The locator must be
+ * specified as a URL.
+ * @exception IllegalStateException Thrown if one of the following
+ * conditions is true:
+ * <ul>
+ * <li>
+ * <code>startRecord</code> has been called and <code>commit</code> has
+ * not been called.
+ * <li>
+ * <code>setRecordStream</code> has been called and <code>commit</code> has
+ * not been called.
+ * </ul>
+ * @exception IllegalArgumentException Thrown if <code>locator</code>
+ * is null.
+ * @exception IOException Thrown if protocol is valid but the
+ * media cannot be created at the specified location.
+ * @exception MediaException Thrown if the locator is not in URL syntax
+ * or it specifies a protocol that is not supported.
+ * @exception SecurityException Thrown if the caller does not
+ * have security permission to set the record location.
+ */
+ public void setRecordLocation(String aLocator)
+ throws IOException, MediaException
+ {
+ checkState();
+ if (aLocator == null)
+ {
+ throw new IllegalArgumentException("Locator is null");
+ }
+
+ // Stream is already set (and not commited)
+ if (iOutputStreamWriter != null)
+ {
+ throw new IllegalStateException(
+ "Record location is already set but not commited yet");
+ }
+
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PlayerPermission per = new PlayerPermission("audio/video recording","record");
+ appUtils.checkPermission(per);
+
+ Connection conn;
+ try
+ {
+ conn = Connector.open(aLocator, Connector.WRITE);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ throw new MediaException("Locator not supported: " + aLocator);
+ }
+ catch (ConnectionNotFoundException cnfe)
+ {
+ throw new MediaException("" + cnfe);
+ }
+
+ // Using HTTP post
+ if (conn instanceof HttpConnection)
+ {
+ HttpConnection hc = (HttpConnection)conn;
+
+ // Set the request method and headers
+ hc.setRequestMethod(HttpConnection.POST);
+ hc.setRequestProperty(REQUEST_NAME, REQUEST_VALUE);
+ hc.setRequestProperty(CONTENT_TYPE, getContentType());
+
+ // Getting the output stream may flush the headers
+ privateSetRecordStream(hc.openOutputStream());
+ }
+ else if (conn instanceof StreamConnection)
+ {
+ // Using StreamConnection
+ StreamConnection sc = (StreamConnection)conn;
+ privateSetRecordStream(sc.openOutputStream());
+ }
+ else
+ {
+ conn.close();
+ throw new MediaException("Unsupported connection type");
+ }
+ iConnection = conn;
+ }
+
+
+ /**
+ * Return the content type of the recorded media.
+ *
+ * The content type is given in the
+ * <a HREF="../Manager.html#content-type">content type syntax</a>.
+ *
+ * @return The content type of the media.
+ */
+ public String getContentType()
+ {
+ checkState();
+ return _getContentType(iEventSource, iControlHandle);
+ }
+
+
+ /**
+ * Start recording the media.
+ * <p>
+ * If the <code>Player</code> is already started, <code>startRecord</code>
+ * will immediately start the recording. If the <code>Player</code>
+ * is not already started, <code>startRecord</code> will not
+ * record any media. It will put the recording in a "standby" mode.
+ * As soon as the <code>Player</code> is started,
+ * the recording will start right away.
+ * <p>
+ * If <code>startRecord</code> is called when the recording has
+ * already started, it will be ignored.
+ * <p>
+ * When <code>startRecord</code> returns, the recording has started
+ * and a <i>RECORD_STARTED</i> event will be delivered through the
+ * <code>PlayerListener</code>.
+ * <p>
+ * If an error occurs while recording is in progress,
+ * <i>RECORD_ERROR</i> event will be delivered via the PlayerListener.
+ *
+ * @exception IllegalStateException Thrown if any of the following
+ * conditions is true:
+ * <ul>
+ * <li>
+ * if <code>setRecordLocation</code> or <code>setRecordStream</code> has
+ * not been called for the first time.
+ * <li>
+ * If <code>commit</code> has been called and
+ * <code>setRecordLocation</code> or <code>setRecordStream</code>
+ * has not been called.
+ * </ul>
+ */
+ public void startRecord()
+ {
+ checkState();
+ // Ignore if startRecord is called when the recording has already started
+ if (iStarted)
+ {
+ return;
+ }
+
+ if (iOutputStreamWriter==null)
+ {
+ throw new IllegalStateException(
+ "Output stream or location not set yet");
+ }
+
+ int rval = _startRecord(iEventSource, iControlHandle);
+ if (rval != ERROR_NONE)
+ {
+ throw new RuntimeException("startRecord() failed, Symbian OS error: " + rval);
+ }
+ iStarted = true;
+ iIgnoreCommitState = false;
+ }
+
+ /**
+ * Stop recording the media. <code>stopRecord</code> will not
+ * automatically stop the <code>Player</code>. It only stops
+ * the recording.
+ * <p>
+ * Stopping the <code>Player</code> does not imply
+ * a <code>stopRecord</code>. Rather, the recording
+ * will be put into a "standby" mode. Once the <code>Player</code>
+ * is re-started, the recording will resume automatically.
+ * <p>
+ * After <code>stopRecord</code>, <code>startRecord</code> can
+ * be called to resume the recording.
+ * <p>
+ * If <code>stopRecord</code> is called when the recording has
+ * already stopped, it will be ignored.
+ * <p>
+ * When <code>stopRecord</code> returns, the recording has stopped
+ * and a <i>RECORD_STOPPED</i> event will be delivered through the
+ * <code>PlayerListener</code>.
+ */
+ public void stopRecord()
+ {
+ checkState();
+ // If stopRecord is called when the recording has already stopped,
+ // it will be ignored.
+ if (!iStarted)
+ {
+ return;
+ }
+
+ int rval = _stopRecord(iEventSource, iControlHandle);
+ if (rval != ERROR_NONE)
+ {
+ throw new RuntimeException("stopRecord() failed, Symbian OS error: " + rval);
+ }
+ iStarted = false;
+ }
+
+ /**
+ * Complete the current recording.
+ * <p>
+ * If the recording is in progress, <code>commit</code>
+ * will implicitly call <code>stopRecord</code>.
+ * <p>
+ * To record again after <code>commit</code> has been called,
+ * <code>setRecordLocation</code> or <code>setRecordStream</code>
+ * must be called.
+ *
+ * @exception IOException Thrown if an I/O error occurs during commit.
+ * The current recording is not valid. To record again,
+ * <code>setRecordLocation</code> or <code>setRecordStream</code>
+ * must be called.
+ *
+ */
+ public void commit() throws IOException
+ {
+ checkState();
+ // If commit has been called and setRecordLocation or setRecordStream
+ // has not been called.
+ if (null == iOutputStreamWriter)
+ {
+ if (iIgnoreCommitState)
+ {
+ return;
+ }
+ throw new IllegalStateException(
+ "setRecordLocation() or setRecordStream() not called before calling commit()");
+ }
+
+ // If the recording is in progress, commit will implicitly call stopRecord
+ if (iStarted)
+ {
+ stopRecord();
+ }
+
+ int rval = _commit(iEventSource, iControlHandle);
+
+ try
+ {
+ // Do not commit Java stream if native commit failed.
+ if (rval == ERROR_NONE)
+ {
+ iOutputStreamWriter.commit();
+ }
+ }
+ finally
+ {
+ closeStream();
+ }
+ if (rval != ERROR_NONE)
+ {
+ throw new IOException("commit() failed, Symbian OS error: " + rval);
+ }
+ }
+
+ /**
+ * From Runnable.
+ * This method is called when commit is started from native code
+ * (record size limit is reached).
+ */
+ public void run()
+ {
+ // Recording is already stopped.
+ iStarted = false;
+ try
+ {
+ commit();
+ }
+ catch (Exception e)
+ {
+ // Because this method is called from new Thread no exceptions
+ // can be thrown.
+ ((PlayerImpl)iPlayer).getPlayerListenerImpl().postEvent(
+ PlayerListener.RECORD_ERROR, "Commit failed" + e);
+
+ Logger.ELOG(Logger.EJavaMMAPI, "MMA::RecordControl::run failed: ", e);
+ }
+ iIgnoreCommitState = true;
+ }
+
+ /**
+ * Set the record size limit. This limits the size of the
+ * recorded media to the number of bytes specified.
+ * <p>
+ * When recording is in progress, <code>commit</code> will be
+ * called implicitly in the following cases:
+ * <ul>
+ * <li>Record size limit is reached
+ * <li>If the requested size is less than the already recorded size
+ * <li>No more space is available.
+ * </ul>
+ * <p>
+ * Once a record size limit has been set, it will remain so
+ * for future recordings until it is changed by another
+ * <code>setRecordSizeLimit</code> call.
+ * <p>
+ * To remove the record size limit, set it to
+ * <code>Integer.MAX_VALUE</code>.
+ * By default, the record size limit is not set.
+ * <p>
+ * Only positive values can be set. Zero or negative values
+ * are invalid and an <code>IllegalArgumentException</code>
+ * will be thrown.
+ *
+ * @param aSize The record size limit in number of bytes.
+ * @return The actual size limit set.
+ * @exception IllegalArgumentException Thrown if the given size
+ * is invalid.
+ * @exception MediaException Thrown if setting the record
+ * size limit is not supported.
+ */
+ public int setRecordSizeLimit(int aSize) throws MediaException
+ {
+ checkState();
+ if (aSize <= 0)
+ {
+ throw new IllegalArgumentException("Size should be > 0");
+ }
+ int rval = _setRecordSizeLimit(iEventSource,
+ iControlHandle,
+ aSize);
+
+ // @exception MediaException Thrown if setting the record
+ // size limit is not supported.
+
+ // Negative values are errors
+ if (rval < ERROR_NONE)
+ {
+ throw new MediaException(
+ "Setting record size limit is not supported, Symbian OS error: " + rval);
+ }
+
+ // Returns 0, if the buffer cannot be resized
+ // Commit the buffer now
+ if (rval==0)
+ {
+ try
+ {
+ commit();
+ }
+ catch (IOException ioe)
+ {
+ // Converts IOE to ME
+ throw new MediaException("IOException occurred during commit, " + ioe);
+ }
+
+ rval = aSize; // return the requested size
+ }
+
+ // Special case; do not return the actual size set when using MAX_VALUE
+ // (this was in TCK tests; RecordControl/SetRecordSizeLimit )
+ if (aSize == Integer.MAX_VALUE)
+ {
+ return Integer.MAX_VALUE;
+ }
+
+ return rval;
+ }
+
+ /**
+ * Erase the current recording.
+ * <p>
+ * If the recording is in progress, <code>reset</code>
+ * will implicitly call <code>stopRecord</code>.
+ * <p>
+ * Calling <code>reset</code> after <code>commit</code>
+ * will have no effect on the current recording.
+ * <p>
+ * If the <code>Player</code> that is associated with this
+ * <code>RecordControl</code> is closed, <code>reset</code>
+ * will be called implicitly.
+ *
+ * @exception IOException Thrown if the current recording
+ * cannot be erased. The current recording is not valid.
+ * To record again, <code>setRecordLocation</code> or
+ * <code>setRecordStream</code> must be called.
+ *
+ */
+ public void reset() throws IOException
+ {
+ checkState();
+ if (null == iOutputStreamWriter)
+ {
+ return;
+ }
+
+ // If the recording is in progress, reset will implicitly call stopRecord
+ if (iStarted)
+ {
+ stopRecord();
+ }
+
+ int rval = _reset(iEventSource, iControlHandle);
+ if (rval < ERROR_NONE)
+ {
+ // IOException thrown if the current recording cannot be erased.
+ // To record again, setRecordLocation or setRecordStream must be called.
+ // closing the stream
+ closeStream();
+ throw new IOException("reset() failed, Symbian OS error: " + rval);
+ }
+ }
+
+
+ private static native int _startRecord(int aEventSource, int aControlHandle);
+ private static native int _stopRecord(int aEventSource, int aControlHandle);
+
+ private static native int _setRecordStream(int aEventSource,
+ int aControlHandle,
+ OutputStreamWriter aWriter);
+
+ private static native String _getContentType(int aEventSource,
+ int aControlHandle);
+
+ private static native int _commit(int aEventSource, int aControlHandle);
+
+ private static native int _setRecordSizeLimit(int aEventSource,
+ int aControlHandle,
+ int aSize);
+
+ private static native int _reset(int aEventSource, int aControlHandle);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/StopTimeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class allows one to specify a preset stop time for a Player
+*
+*/
+
+package com.nokia.microedition.media.control;
+
+/**
+ * <code>StopTimeControl</code> allows one to specify a preset stop time for
+ * a <code>Player</code>.
+ * <p>
+ */
+public class StopTimeControl extends ControlImpl
+ implements javax.microedition.media.control.StopTimeControl
+{
+ /**
+ * StopTimeControl constructor
+ */
+ public StopTimeControl()
+ {
+ }
+
+ /**
+ * Gets the last value successfully set by <CODE>setStopTime</CODE>.
+ *
+ * Returns the constant <CODE>RESET</CODE> if no stop time is set.
+ * This is the default.
+ *
+ * @return The current stop time in microseconds.
+ * @see #setStopTime
+ */
+ public long getStopTime()
+ {
+ checkState();
+ long time = _getStopTime(iEventSource, iControlHandle);
+ return time;
+ }
+
+ /**
+ *
+ * Sets the <i>media time</i> at which you want the <code>Player</code>
+ * to stop.
+ * The <code>Player</code> will stop when its <i>media time</i>
+ * reaches the stop-time.
+ * A <code>STOPPED_AT_TIME</code> event
+ * will be delivered through the <code>PlayerListener</code>.
+ * <p>
+ * The <code>Player</code> is guaranteed
+ * to stop within one second past the preset stop-time
+ * (i.e. <code>stop-time <= current-media-time <= stop-time + 1 sec.</code>);
+ * unless the current media time is already passed the preset stop time
+ * when the stop time is set.
+ * If the current media time is already past the stop time set,
+ * the <code>Player</code> will stop immediately. A
+ * <code>STOPPED_AT_TIME</code> event will be delivered.
+ * After the <code>Player</code> stops due to the stop-time set,
+ * the previously set stop-time will be cleared automatically.
+ * Alternatively, the stop time can be explicitly removed by
+ * setting it to: <code>RESET</code>.
+ * <p>
+ *
+ * You can always call <code>setStopTime</code> on a stopped
+ * <code>Player</code>.
+ * To avoid a potential race condition, it is illegal to
+ * call <code>setStopTime</code> on a started <code>Player</code> if a
+ * <i>media stop-time</i> has already been set.
+ *
+ * @param aStopTime The time in microseconds at which you want the
+ * <code>Player</code> to stop, in <i>media time</i>.
+ * @exception IllegalStateException Thrown if
+ * <code>aStopTime</code> is called on a started
+ * <code>Player</code> and the
+ * <i>media stop-time</i> has already been set.
+ * @see #getStopTime
+ */
+ public void setStopTime(long aStopTime) throws IllegalStateException
+ {
+ checkState();
+ if (iPlayer.getState() == iPlayer.STARTED && getStopTime() != RESET)
+ {
+ throw new IllegalStateException(
+ "Player is STARTED or setStopTime() is already called successfully");
+ }
+
+ // Set native object to stop at time
+ _setStopTime(iEventSource, iControlHandle, aStopTime);
+ }
+
+ private static native long _getStopTime(int aEventSourceHandle,
+ int aControlHandle);
+
+ private static native int _setStopTime(int aEventSourceHandle,
+ int aControlHandle,
+ long aTime);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/TempoControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TempoControl is used to control the tempo.
+*
+*/
+
+package com.nokia.microedition.media.control;
+import javax.microedition.media.Player;
+
+/**
+ * TempoControl or RateControl methods cannot throw any exceptions.
+ * If an error occurs in native side, native side return default value.
+ */
+public class TempoControl extends RateControl
+ implements javax.microedition.media.control.TempoControl
+{
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+
+ // Tempo holder for PREFETCHED state. Initially set to default value.
+ private static final int DEFAULT_TEMPO = 120000;
+
+ /**
+ * @see TempoControl
+ */
+ public int setTempo(int aMilliTempo)
+ {
+ checkState();
+ // _setTempo returns real value (STARTED) or user set value
+ // (PREFETCHED). In latter case user set value is adjusted
+ // in native side according to max/min bounds of tempo.
+ int tempo = _setTempo(iControlHandle, iEventSource, aMilliTempo);
+
+ if (tempo < NO_ERROR)
+ {
+ throw new Error(
+ "setTempo() failed, Symbian OS error: " + tempo);
+ }
+ return tempo;
+ }
+
+ /**
+ * @see TempoControl
+ */
+ public int getTempo()
+ {
+ checkState();
+
+ int tempo = _getTempo(iControlHandle, iEventSource);
+ return tempo;
+ }
+
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native TempoControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @param aMilliTempo The tempo specified in milli-beats per minute
+ * @return The actual tempo set.
+ */
+ private native int _setTempo(int aControlHandle,
+ int aEventSourceHandle,
+ int aMilliTempo);
+
+ /**
+ * Native implementation.
+ *
+ * @param aControlHandle Pointer to the native TempoControl object.
+ * @param aEventSourceHandle Pointer to the native event source object.
+ * @return The tempo.
+ */
+ private native int _getTempo(int aControlHandle,
+ int aEventSourceHandle);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,881 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoControl is used to control the display of video.
+*
+*/
+
+package com.nokia.microedition.media.control;
+
+import javax.microedition.media.Player;
+import javax.microedition.media.MediaException;
+import javax.microedition.lcdui.Canvas;
+import javax.microedition.lcdui.Display;
+import javax.microedition.midlet.MIDlet;
+import com.nokia.microedition.media.NativeError;
+
+//import com.symbian.midp.runtime.MIDletExecutor;
+import com.nokia.mj.impl.media.PlayerPermission;
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+
+
+import javax.microedition.lcdui.Displayable;
+import javax.microedition.lcdui.Display;
+//import com.symbian.midp.runtime.MIDletInstance;
+
+//import com.symbian.midp.runtime.ToolkitInvoker;
+
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.utils.Logger;
+
+// MMAPI 3.x UI req.
+import com.nokia.microedition.media.*;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import javax.microedition.lcdui.*;
+import org.eclipse.ercp.swt.mobile.MobileShell;
+
+
+
+
+public class VideoControl
+ extends ControlImpl
+ implements javax.microedition.media.control.VideoControl
+{
+ private static final String GUI_OBJECT_CLASS_NAME =
+ "javax.microedition.lcdui.Item";
+ private static final int NOT_INITIALIZED = -1;
+ private static final int ERROR_ARGUMENT = -6; // KErrArgument
+
+ // use contans to avoid making native methods
+ // which has same prototypes
+
+ // getter constants for native side
+ private static final int PROPERTY_DISPLAY_WIDTH = 1;
+ private static final int PROPERTY_DISPLAY_HEIGHT = 2;
+ private static final int PROPERTY_DISPLAY_X = 3;
+ private static final int PROPERTY_DISPLAY_Y = 4;
+ private static final int PROPERTY_SOURCE_WIDTH = 5;
+ private static final int PROPERTY_SOURCE_HEIGHT = 6;
+
+ // setter constants for native side
+ private static final int SET_DISPLAY_SIZE = 20;
+ private static final int SET_DISPLAY_LOCATION = 21;
+ private static final int SET_DISPLAY_VISIBLE_TRUE = 22;
+ private static final int SET_DISPLAY_VISIBLE_FALSE = 23;
+ private static final int SET_DISPLAY_FULLSCREEN_TRUE = 24;
+ private static final int SET_DISPLAY_FULLSCREEN_FALSE = 25;
+
+ // MMA API defines return values like 'return value is undefined'
+ // then UNDEFINED_RETURN_VALUE is returned
+ private static final int UNDEFINED_RETURN_VALUE = 0;
+
+ // class name used with dynamic display mode initialization
+ private static String GUI_FACTORY_CLASS_NAME = ".Factory";
+
+ // lcdui package used with UiToolkitRegister
+ private static String LCDUI_PACKAGE =
+ "javax.microedition.lcdui";
+
+ // eswt package used with UiToolkitRegister
+ private static String ESWT_PACKAGE = "org.eclipse.swt.widgets";
+
+ // ToolkitRegister class name used with eswt and lcdui
+ private static String DISPLAY = ".Display";
+
+ // class name used to check if eswt is included
+ private static String LISTENER = ".Listener";
+
+ // class name used to check if eswt is included
+ private static String ESWT_CONTROL = ".control";
+
+ protected int iStatus = NOT_INITIALIZED;
+
+ // Needed for getting native handle from lcdui components
+ //com.symbian.midp.runtime.ToolkitInvoker iToolkitInvoker;
+
+ private VideoItem iVideoItem;
+ private Canvas iVideoCanvas;
+
+ BaseDisplay display;
+// private MIDletInstance iMIDletInstance;
+
+ // error code used asynchronous native calls
+ private int iError;
+
+ // used in asynchronous getSnapshot method
+ private byte[] iImageData;
+ private int iToolkitHandle = 0;
+
+ // toolkit, stored as object as we don't have access to Toolkit class.
+ private Object iToolkit;
+ // for midlet foreground statelistening
+ //ToolkitInvoker iTlkitInvoker;
+
+ private Finalizer mFinalizer = new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ doFinalize();
+ }
+ };
+
+ public VideoControl()
+ {
+ // iToolkitInvoker = com.symbian.midp.runtime.ToolkitInvoker.getToolkitInvoker();
+// lcduiinvoker = new com.nokia.microedition.volumekeys.MMAPILCDUIInvokerImpl();
+ // eswtObserver = new MMAPIeSWTObserver();
+ }
+
+ private void doFinalize()
+ {
+ if (mFinalizer != null)
+ {
+ registeredFinalize();
+ mFinalizer = null;
+ }
+ }
+
+ final void registeredFinalize()
+ {
+ if (iVideoItem != null)
+ {
+ iPlayer.removePlayerListener(iVideoItem);
+ iVideoItem.iNativeHandle = 0;
+ }
+ }
+
+ public void setHandles(Player aPlayer, int aEventSource, int aControlHandle)
+ {
+ iPlayer = aPlayer;
+ iEventSource = aEventSource;
+ iControlHandle = aControlHandle;
+ iToolkitHandle = 0; // TODO: remove once implementation is done.
+ int error = _construct(iControlHandle,
+ aEventSource,
+ iToolkitHandle);
+
+ NativeError.check(error);
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public void setDisplaySize(int aWidth, int aHeight) throws MediaException
+ {
+ // checkState();
+
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ if (aWidth <= 0 || aHeight <= 0)
+ {
+ throw new IllegalArgumentException(
+ "Width and height must be positive");
+ }
+
+
+
+ System.out.println("before display.setDisplaySize()");
+
+
+ //canvasdisplay.setDisplaySize( aWidth, aHeight);
+ display.setDisplaySize( aWidth, aHeight);
+
+ System.out.println("after display.setDisplaySize()");
+ /*
+ int ret = setDisplayProperty(aWidth, aHeight, SET_DISPLAY_SIZE);
+ if (ret < 0)
+ {
+ throw new MediaException("setDisplaySize() failed, SymbianOS error: "
+ + ret);
+ }
+ if (iStatus == USE_GUI_PRIMITIVE &&
+ iVideoItem != null) // with dynamic display mode item can be null
+ {
+ iVideoItem.privateInvalidate();
+ }
+
+ */
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public void setDisplayFullScreen(boolean aFullScreenMode) throws MediaException
+ {
+ // checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ /*
+ int ret;
+ if (aFullScreenMode)
+ {
+ ret = setDisplayProperty(SET_DISPLAY_FULLSCREEN_TRUE);
+ }
+ else
+ {
+ ret = setDisplayProperty(SET_DISPLAY_FULLSCREEN_FALSE);
+ }
+
+ if (ret < 0)
+ {
+ throw new MediaException();
+ }
+
+ */
+ System.out.println("inside setDisplayFullScreen()");
+ //canvasdisplay.setDisplayFullScreen( aFullScreenMode);
+ display.setDisplayFullScreen( aFullScreenMode);
+
+
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public void setDisplayLocation(int aX, int aY)
+ {
+ // checkState();
+ System.out.println("VideoControl.java :: setDisplayLocation x, y = " + aX + ","+ aY);
+ if (iStatus == USE_GUI_PRIMITIVE)
+ {
+ // In USE_GUI_PRIMITIVE mode, this call will be ignored.
+ return;
+ }
+ if (iStatus != USE_DIRECT_VIDEO)
+ {
+ // This method only works when the USE_DIRECT_VIDEO mode is set.
+ throw new IllegalStateException();
+ }
+ /*
+ // cannot fail -> ignore return value
+ setDisplayProperty(aX, aY, SET_DISPLAY_LOCATION);
+ */
+
+ System.out.println("inside setDisplayLocation()");
+ //canvasdisplay.setDisplayLocation( aX , aY);
+ display.setDisplayLocation( aX , aY);
+
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public void setVisible(boolean aVisible)
+ {
+ // checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ /*if (aVisible)
+ {
+ // Update the foreground or background state of the midlet before
+ // setting the visibility of the control
+ updateForeground();
+ // cannot fail -> ignore return value
+ setDisplayProperty(SET_DISPLAY_VISIBLE_TRUE);
+ }
+ else
+ {
+ // cannot fail -> ignore return value
+ setDisplayProperty(SET_DISPLAY_VISIBLE_FALSE);
+ }
+ */
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
+ " before display.setVisible()");
+ System.out.println("inside setVisible()");
+ if(aVisible)
+ {
+ // set the Midlet BG/FG status to native
+ updateForeground();
+ }
+ display.setVisible( aVisible );
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
+ "after display.setVisible()");
+
+
+
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getDisplayWidth()
+ {/*
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ int width = getControlProperty(PROPERTY_DISPLAY_WIDTH);
+ return width;
+ */
+ //return canvasdisplay.getDisplayWidth( );
+ return display.getDisplayWidth( );
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getDisplayHeight()
+ {
+ /* checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+ int height = getControlProperty(PROPERTY_DISPLAY_HEIGHT);
+ return height;
+
+ */
+ return display.getDisplayHeight( );
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getDisplayX()
+ {
+ /* checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return UNDEFINED_RETURN_VALUE;
+ }
+ int x = getControlProperty(PROPERTY_DISPLAY_X);
+ return x;
+ */
+ return display.getDisplayX( );
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getDisplayY()
+ {
+ /*
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return UNDEFINED_RETURN_VALUE;
+ }
+ int y = getControlProperty(PROPERTY_DISPLAY_Y);
+ return y;
+
+ */
+ return display.getDisplayY( );
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getSourceWidth()
+ {
+ /* checkState();
+ int width = getControlProperty(PROPERTY_SOURCE_WIDTH);
+ if (width <= 0)
+ {
+ width = 1;
+ }
+ return width;
+
+ */
+ return display.getSourceWidth( );
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public int getSourceHeight()
+ {
+ /*checkState();
+ int height = getControlProperty(PROPERTY_SOURCE_HEIGHT);
+ if (height <= 0)
+ {
+ height = 1;
+ }
+ return height;
+ */
+ return display.getSourceHeight( );
+
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ synchronized public byte[] getSnapshot(String aImageType) throws MediaException
+ {
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ throw new IllegalStateException(
+ "VideoControl.initDisplayMode() not called yet");
+ }
+
+ // starts native side. Native will release wait lock if
+ // _getSnapshot doesn't leave.
+ int error = _getSnapshot(iControlHandle,
+ iEventSource, aImageType);
+ if (error == ERROR_ARGUMENT)
+ {
+ throw new MediaException("Unsupported image type: " + aImageType);
+ }
+ else if (error < 0)
+ {
+ throw new MediaException("getSnapshot() failed, Symbian OS error: " + error);
+ }
+
+ synchronized (this)
+ {
+ try
+ {
+ // wait native side
+ wait();
+ }
+ catch (Exception e)
+ {
+ throw new MediaException("" + e);
+ }
+ }
+ if (iError < 0)
+ {
+ throw new MediaException("Symbian OS error: " + iError);
+ }
+
+ // Check the permission here, so 'the moment' is not lost?
+ //Security.ensurePermission(PERMISSION, PERMISSION, PERM_ARGS);
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PlayerPermission per = new PlayerPermission("audio/video recording","snapshot");
+ appUtils.checkPermission(per);
+
+ return iImageData;
+ }
+
+ /**
+ * from Interface VideoControl
+ *
+ */
+ public Object initDisplayMode(int aMode, Object aArg)
+ {
+ checkState();
+ if (iStatus != NOT_INITIALIZED)
+ {
+ // IllegalStateException - Thrown if initDisplayMode is
+ // called again after it has previously been called successfully.
+ throw new IllegalStateException(
+ "initDisplayMode() already called successfully");
+ }
+
+ if (aMode == USE_GUI_PRIMITIVE)
+ {
+ Object guiObject = null;
+ if (aArg == null)
+ {
+ guiObject = initNullMode();
+ }
+ else
+ {
+ if (aArg.equals(GUI_OBJECT_CLASS_NAME))
+ {
+ guiObject = initLCDUI();
+ }
+ else // try load dynamic display mode
+ {
+ guiObject = initDynamicDisplayMode(aArg);
+ }
+ }
+
+ iStatus = USE_GUI_PRIMITIVE;
+ return guiObject;
+ }
+ else if (aMode == USE_DIRECT_VIDEO)
+ {
+ if (aArg != null)
+ {
+ if (!(aArg instanceof javax.microedition.lcdui.Canvas))
+ {
+ throw new java.lang.IllegalArgumentException(
+ "For USE_DIRECT_VIDEO mode argument should be of type Canvas");
+ }
+ }
+ else
+ {
+ throw new java.lang.IllegalArgumentException(
+ "For USE_DIRECT_VIDEO mode argument should not be null");
+ }
+ iVideoCanvas = (Canvas)aArg;
+ // MMAPI UI 3.x req.
+
+ display = new MMACanvasDisplay(iEventSource , iVideoCanvas);
+
+ System.out.println("VideoControl.java: after eswt control got from canvas has added observer");
+
+ int handle = initNativeDisplay(iVideoCanvas, display);
+ // here actual listener is added to display
+ display.setNativeHandle(handle);
+ // Window resource initialization is done to the native video player
+ display.setWindowResources();
+ iStatus = USE_DIRECT_VIDEO;
+
+ /*( try
+ {
+ this.setVisible(false);
+ }
+
+ catch (IllegalStateException ex) { }
+ */
+ return null;
+ }
+ else
+ {
+ // java.lang.IllegalArgumentException - Thrown if the mode is invalid.
+ throw new java.lang.IllegalArgumentException(
+ "Mode not supported or invalid, " +
+ "valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
+ }
+ }
+
+ /**
+ * Called from java for early initialization of native handle to java peer
+ * Because it will be used to make a jni call
+ */
+ public void setNativeDisplayHandleToJavaPeer(int handle)
+ {
+ System.out.println("VideoControl.java: setNativeDisplayHandleToJavaPeer handle =" + handle);
+ display.setNativeHandle(handle);
+ }
+
+ /**
+ * Initializes native display.
+ *
+ */
+ private int initNativeDisplay(Object aGuiObject, Object mmadisplay)
+ {
+ int handle = _initDisplayMode(iControlHandle,
+ iEventSource,
+ mmadisplay,
+ aGuiObject);
+ NativeError.check(handle);
+ return handle;
+ }
+
+ /**
+ * Gets control property from native side.
+ * @param aPropertyType One of the types defined in this class
+ *
+ */
+ private int getControlProperty(int aPropertyType)
+ {
+ return _getControlProperty(iControlHandle,
+ iEventSource,
+ aPropertyType);
+ }
+
+ /**
+ * Sets two properties to native side.
+ *
+ * @param aParamA Specific parameter A for property type.
+ * @param aParamB Specific parameter B for property type.
+ * @param aPropertyType One of the types defined in this class
+ */
+ private int setDisplayProperty(int aParamA, int aParamB, int aPropertyType)
+ {
+ return _setDisplayProperty(iControlHandle,
+ iEventSource,
+ aParamA,
+ aParamB,
+ aPropertyType);
+ }
+
+ /**
+ * Sets one property to native side.
+ *
+ * @param aPropertyType One of the types defined in this class
+ */
+ private int setDisplayProperty(int aPropertyType)
+ {
+ return _setDisplayProperty(iControlHandle,
+ iEventSource,
+ 0,
+ 0,
+ aPropertyType);
+ }
+
+ /**
+ * Called from native side when snapshot is ready
+ *
+ */
+ private void snapshotReady(int aError, byte[] aImageData)
+ {
+ iImageData = aImageData;
+ iError = aError;
+
+ synchronized (this)
+ {
+ notify();
+ }
+ }
+
+ /**
+ * This method will try to use dynamic class loading to instantiate GUI
+ * object for given mode.
+ * @param aMode parameter for display mode
+ * @return GUI object
+ */
+ private Object initDynamicDisplayMode(Object aMode)
+ {
+ MMAGUIFactory guiFactory = null;
+ try
+ {
+ String className = ((String)aMode).toLowerCase() +
+ GUI_FACTORY_CLASS_NAME;
+ Class guiClass = Class.forName(className);
+ guiFactory = (MMAGUIFactory)guiClass.newInstance();
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // if the class could not be found
+ throw new IllegalArgumentException(
+ "Mode not supported or invalid, " +
+ "valid modes are USE_DIRECT_VIDEO and USE_GUI_PRIMITIVE");
+ }
+ catch (IllegalAccessException iae)
+ {
+ // if the class or initializer is not accessible
+ throw new IllegalArgumentException("Mode: " + aMode +
+ " caused " + iae);
+ }
+ catch (InstantiationException ie)
+ {
+ // if an application tries to instantiate an abstract class or an
+ // interface, or if the instantiation fails for some other reason
+ throw new IllegalArgumentException("Mode: " + aMode +
+ " caused " + ie);
+ }
+ catch (ClassCastException cce)
+ {
+ // Thrown to indicate that the code has attempted to cast an
+ // object to a subclass of which it is not an instance.
+ throw new IllegalArgumentException("Mode: " + aMode +
+ " caused " + cce);
+ }
+
+ Object guiObject = guiFactory.initDisplayMode();
+ // initNativeDisplay return handle MMMADirectContainer, 0 parameter
+ // indicates that dynamic display will be used
+ // MMAPI UI 3.x req.
+ // guiFactory.setContentHandle(initNativeDisplay(guiObject, 0));
+ return guiObject;
+ }
+
+ /**
+ * Initializes LCDUI display mode.
+ * @return LCDUI Item
+ */
+ private Object initLCDUI()
+ {
+ iVideoItem = new VideoItem(iEventSource);
+ iPlayer.addPlayerListener(iVideoItem);
+
+ // MMAPI UI 3.x req.
+ // int handle = initNativeDisplay(iVideoItem,
+ // 1 /*iToolkitInvoker.itemGetHandle(iVideoItem)*/);
+
+ // iVideoItem.setNativeHandle(handle);
+
+ iStatus = USE_GUI_PRIMITIVE;
+ return iVideoItem;
+ }
+
+ /**
+ * Initializes USE_GUI_PRIMITIVE mode when null parameter is given to
+ * initDisplayMode method.
+ * UI toolkit gets selected when application uses UI toolkit
+ * first time. After this selection null parameter must be
+ * interpreted as the selected UI toolkit. initDisplayMode call
+ * with null parameter before the selection must cause
+ * IllegalArgumentException if there are several toolkits.
+ * @return GUI object
+ */
+ private Object initNullMode()
+ {
+ String toolkit = null;
+
+ Object guiObject = null;
+
+ // If lcdui was selected init it even if there might be several
+ // toolkits. This is done to support existing applications.
+ if ((LCDUI_PACKAGE + DISPLAY).equals(toolkit))
+ {
+ guiObject = initLCDUI();
+ }
+ else
+ {
+ try
+ {
+ // Several UI toolkits are supported if there are eSWT classes
+ // and eSWT direct content component
+ // Trying to load eSWT Listener interface or eSWT GUI factory
+ // does not cause any initialization to eSWT.
+ Class.forName(ESWT_PACKAGE + LISTENER);
+ Class.forName(ESWT_PACKAGE +
+ ESWT_CONTROL +
+ GUI_FACTORY_CLASS_NAME);
+
+ // check if eSWT was selected
+ if ((ESWT_PACKAGE + DISPLAY).equals(toolkit))
+
+ {
+ guiObject = initDynamicDisplayMode(
+ ESWT_PACKAGE +
+ ESWT_CONTROL +
+ GUI_FACTORY_CLASS_NAME);
+ }
+ else
+ {
+ // If no toolkit is registered and if lcdui library exists select it
+ try
+ {
+ Class.forName(LCDUI_PACKAGE + DISPLAY);
+
+ guiObject = initLCDUI();
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // If there are several toolkits and none is selected
+ // IllegalArgumentException must be thrown
+ throw new IllegalArgumentException(
+ "UI toolkit is not available or found.");
+ }
+ }
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Only lcdui is supported
+ guiObject = initLCDUI();
+ }
+ }
+ return guiObject;
+ }
+
+
+ // private int updateForeground() // MMAPI UI 3.x changes
+ private void updateForeground()
+ {
+
+ int isFG = 1;
+/*
+ // Check whether display is initialized
+ checkState();
+ if (iStatus == NOT_INITIALIZED)
+ {
+ return visible;
+ }
+
+ iMIDletInstance = MIDletExecutor.getCurrentMIDlet();
+ MIDlet midlet = iMIDletInstance.getMIDlet();
+ //Displayable displayable;
+ if (midlet == null)
+ {
+ return visible;
+ }
+ else
+ {
+ Displayable displayable = Display.getDisplay(midlet).getCurrent();
+
+ if (displayable != null && displayable.isShown())
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
+ "VideoControl.updateForeground isShown() = 1");
+ // visible
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,
+ "VideoControl.updateForeground isShown() = 0");
+ // not visible
+ visible = 0;
+ }
+
+ // Set the foreground state
+ _setForeground(iControlHandle,
+ iEventSource,
+ visible);
+ }
+
+ return visible;
+ */
+
+ // MMAPI UI 3.x req.
+ // Get the midlet position BG/FG
+ boolean visible = ManagerImpl.getInstance().isForground();
+ if(visible)
+ isFG = 1;
+ else
+ isFG = 0;
+
+ _setForeground(iControlHandle,
+ iEventSource,
+ isFG);
+ // return visible;
+ }
+
+ private native int _construct(int aControlHandle,
+ int aEventSourceHandle,
+ int aToolkitHandle);
+
+ private native int _getControlProperty(int aControlHandle,
+ int aEventSourceHandle,
+ int aPropertyType);
+
+ private native int _setDisplayProperty(int aControlHandle,
+ int aEventSourceHandle,
+ int aParamA,
+ int aParamB,
+ int aPropertyType);
+
+ private native int _getSnapshot(int aControlHandle,
+ int aEventSourceHandle,
+ String aProperties);
+
+ private native int _initDisplayMode(int aControlHandle,
+ int aEventSourceHandle,
+ Object aJavaDisplay,
+ Object aJavaDisplayObject);
+ private native int _setForeground(int aControlHandle,
+ int aEventSourceHandle,
+ int aIsForeground);
+
+ private native boolean _isESWT();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoItem.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Item for VideoControl.
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+import javax.microedition.lcdui.CustomItem;
+import javax.microedition.lcdui.Graphics;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.Player;
+import javax.microedition.lcdui.*;
+
+/**
+ * Item for VideoControl.
+ * This class native equivalent is CMIDItemDisplay.
+ * All drawing is done in native.
+ * CustomItem has its native bitmap after it is layouted to
+ * the form and then SizeChanged method is called and native side
+ * gets the bitmap for item.
+ *
+ */
+public class VideoItem extends CustomItem implements PlayerListener
+{
+ int iNativeHandle;
+
+ private int iEventSourceHandle;
+
+ public VideoItem(int aEventSourceHandle)
+ {
+ super(""); // we don't have title
+ iEventSourceHandle = aEventSourceHandle;
+ }
+
+ // from PlayerListener
+ public void playerUpdate(Player aPlayer, String aEvent, Object aEventData)
+ {
+ if (aEvent == SIZE_CHANGED)
+ {
+ invalidate();
+ }
+ }
+
+ /**
+ * From class CustomItem
+ *
+ */
+ protected int getMinContentHeight()
+ {
+ int minHeight = 0;
+ if (iNativeHandle != 0)
+ {
+ minHeight = _getMinContentHeight(iEventSourceHandle,
+ iNativeHandle);
+ }
+ return minHeight;
+ }
+
+ /**
+ * From class CustomItem
+ *
+ */
+ protected int getMinContentWidth()
+ {
+ int minWidth = 0;
+ if (iNativeHandle != 0)
+ {
+ minWidth = _getMinContentWidth(iEventSourceHandle,
+ iNativeHandle);
+ }
+ return minWidth;
+ }
+
+ /**
+ * From class CustomItem
+ *
+ */
+ protected int getPrefContentHeight(int aWidth)
+ {
+ int prefHeight = 0;
+ if (iNativeHandle != 0)
+ {
+ prefHeight = _getPrefContentHeight(iEventSourceHandle,
+ iNativeHandle,
+ aWidth);
+ }
+ return prefHeight;
+ }
+
+ /**
+ * From class CustomItem
+ *
+ */
+ protected int getPrefContentWidth(int aHeight)
+ {
+ int prefWidth = 0;
+ if (iNativeHandle != 0)
+ {
+ prefWidth = _getPrefContentWidth(iEventSourceHandle,
+ iNativeHandle,
+ aHeight);
+ }
+ return prefWidth;
+ }
+
+ /**
+ * From class CustomItem
+ *
+ * Empty implementation because drawing is done in native side.
+ * Must be implemented because this method is abstract.
+ *
+ */
+ protected void paint(Graphics aGrapchics, int aWidth, int aHeight)
+ {
+ }
+
+ /**
+ * From class CustomItem
+ *
+ */
+ protected void sizeChanged(int aWidth, int aHeight)
+ {
+ if (iNativeHandle != 0)
+ {
+ _sizeChanged(iEventSourceHandle,
+ iNativeHandle,
+ aWidth,
+ aHeight);
+ }
+ }
+
+ /**
+ * Package private method for invalidating the Form owning this item.
+ */
+ void privateInvalidate()
+ {
+ invalidate();
+ }
+
+ /**
+ * Sets native CMIDItemDisplay handle.
+ */
+ void setNativeHandle(int aHandle)
+ {
+ iNativeHandle = aHandle;
+ }
+
+ // Native methods
+
+ /**
+ * Informs got size to native side.
+ */
+ private native int _sizeChanged(int aEventSourceHandle,
+ int aNativeHandle,
+ int aWidth,
+ int aHeight);
+
+ // Getters for layout.
+ private native int _getMinContentWidth(int aEventSourceHandle,
+ int aNativeHandle);
+ private native int _getMinContentHeight(int aEventSourceHandle,
+ int aNativeHandle);
+ private native int _getPrefContentWidth(int aEventSourceHandle,
+ int aNativeHandle,
+ int aTentativeWidth);
+ private native int _getPrefContentHeight(int aEventSourceHandle,
+ int aNativeHandle,
+ int aTentativeHeigth);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VolumeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Item for VideoControl.
+*
+*/
+
+
+package com.nokia.microedition.media.control;
+
+public class VolumeControl extends ControlImpl
+ implements javax.microedition.media.control.VolumeControl
+{
+ private static final int MAX_VOLUME = 100;
+ private static final int UNDEFINED_VOLUME = -1;
+
+ // these constants come from native side
+ protected static final int NO_ERROR = 0; // native side returns if OK
+
+ private int iLevel;
+ private boolean iMuted;
+
+ public VolumeControl()
+ {
+ iLevel = UNDEFINED_VOLUME;
+ }
+
+ public boolean isMuted()
+ {
+ checkState();
+ return iMuted;
+ }
+
+ public int getLevel()
+ {
+ checkState();
+
+ // If the control is muted the cached volume level is returned
+ // because the native implemnetation doesn't directly support
+ // muting. The mute is applied by setting volume level to zero
+ if (!iMuted)
+ {
+ int level = _getLevel(iEventSource, iControlHandle);
+ if (level < NO_ERROR)
+ {
+ throw new Error("getLevel() failed, Symbian OS error: " + level);
+ }
+ // Cache the returned volume level due to mute handling
+ iLevel = level;
+ }
+
+ return iLevel;
+ }
+
+
+ public int setLevel(int aLevel)
+ {
+ checkState();
+ int level = aLevel;
+
+ if (level < 0)
+ {
+ level = 0;
+ }
+ else if (level > MAX_VOLUME)
+ {
+ level = MAX_VOLUME;
+ }
+
+ if (!iMuted)
+ {
+ int error = _setLevel(iEventSource, iControlHandle, level);
+ if (error < NO_ERROR)
+ {
+ throw new Error("setLevel() failed, Symbian OS error: " + error);
+ }
+ }
+ iLevel = level;
+ return level;
+ }
+
+ public void setMute(boolean aMuted)
+ {
+ checkState();
+ if (aMuted != iMuted)
+ {
+ if (iLevel == UNDEFINED_VOLUME)
+ {
+ getLevel();
+ }
+ iMuted = aMuted;
+ int level = 0;
+ if (!iMuted)
+ {
+ level = iLevel;
+ }
+ // else level is 0
+
+ int error = _setLevel(iEventSource, iControlHandle, level);
+ if (error < NO_ERROR)
+ {
+ throw new Error("setMute() failed, Symbian OS error: " + error);
+ }
+ }
+ }
+
+ private static native int _setLevel(int aEventSource, int aControlHandle,
+ int aLevel);
+ private static native int _getLevel(int aEventSource, int aControlHandle);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/ConnectorProtocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Protocol used with locators that needs Connector.
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import javax.microedition.media.MediaException;
+
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ConnectorDataSource;
+import com.nokia.microedition.media.ManagerImpl;
+
+/**
+ * Protocol used with locators that needs Connector.
+ */
+public class ConnectorProtocol implements Protocol
+{
+ /**
+ * Default constructor.
+ */
+ public ConnectorProtocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ ConnectorDataSource dataSource = new ConnectorDataSource(aLocator);
+ return ManagerImpl.getInstance().createInternalPlayer(dataSource);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/NativeBase.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.NativePlayerFactory;
+import javax.microedition.media.MediaException;
+
+/**
+ * Base class for native based protocols
+ */
+public class NativeBase implements Protocol
+{
+ /**
+ * Protected constructor.
+ */
+ protected NativeBase()
+ {
+ }
+
+ /**
+ * From Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ return NativePlayerFactory.createPlayer(aLocator);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/OutputStreamWriter.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class gets data from java classes and passes stream
+* to CMMASourceStream on C++ side
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class OutputStreamWriter extends Thread
+{
+ /**
+ * Private helper class to handle case when notify comes before
+ * wait
+ */
+ private class WaitObject
+ {
+ static final int NOTIFIED = 1;
+ public int iStatus = NO_ERROR;
+
+ public synchronized void doWait()
+ {
+ if (iStatus == OutputStreamWriter.NO_ERROR)
+ {
+ try
+ {
+ super.wait();
+ }
+ catch (InterruptedException ex)
+ {
+ iStatus = OutputStreamWriter.GENERAL_ERROR;
+ }
+ }
+ }
+
+ public synchronized void doNotify()
+ {
+ super.notify();
+ iStatus = NOTIFIED;
+ }
+ }
+ /**
+ * Size of the buffer (transferred bytes) the same size as in c++ side
+ */
+ private static final int BUFFER_MAXSIZE = 4096;
+
+ /**
+ * Status code. Negative values are error codes.
+ * Values >= NO_ERROR are status codes.
+ */
+ private static final int NO_ERROR = 0;
+
+ /**
+ * Status code. Stream is ended.
+ */
+ private static final int COMPLETED = 2;
+
+ /**
+ * Status code. Stream is closed.
+ */
+ private static final int CLOSED = -2002;
+
+ /**
+ * Error status code.
+ */
+ private static final int GENERAL_ERROR = -2003;
+
+ /**
+ * IO error status code.
+ */
+ private static final int IO_ERROR = -2004;
+
+ /**
+ * This constant indicates native commit.
+ */
+ private static final int COMMIT = -10000;
+
+ /**
+ * Stream status.
+ * >= 0 indicates no error
+ * < 0 indicates error
+ */
+ private int iStatus = NO_ERROR;
+
+ /**
+ * Stream where output will be written.
+ */
+ private OutputStream iOutputStream;
+
+ /**
+ * Native handle.
+ */
+ private int iHandle;
+
+ /**
+ * Native event source handle.
+ */
+ private int iEventSourceHandle;
+
+ /**
+ * Used to wait native object to start writing.
+ */
+ private WaitObject iWaitObject = new WaitObject();
+
+ /**
+ * Used to wait in commit method until all data is read.
+ */
+ private WaitObject iCommitWaitObject = new WaitObject();
+
+ /**
+ * Runnable object that does stream commit.
+ */
+ private Runnable iRunnable;
+
+ /**
+ * Player handle is needed to check if native player object is deleted.
+ */
+ private int iPlayerHandle;
+
+ /**
+ * Constructor
+ *
+ * @param aOutputStream a Stream to be passed to C++ side
+ * @param aEventsourceHandle handle to event source
+ * @param aRunnable is called when native commit is done
+ * @param aPlayerHandle Used to check if player is already deleted.
+ */
+ public OutputStreamWriter(OutputStream aOutputStream,
+ int aEventSourceHandle,
+ Runnable aRunnable,
+ int aPlayerHandle)
+ {
+ iOutputStream = aOutputStream;
+ iEventSourceHandle = aEventSourceHandle;
+ iRunnable = aRunnable;
+ iPlayerHandle = aPlayerHandle;
+ }
+
+ /**
+ * Sets handle to native object (CMMAOutputStream) and starts read thread.
+ *
+ * @param aHandle handle (CMMAOutputStream)
+ */
+ public void start(int aHandle)
+ {
+ if (aHandle <= 0)
+ {
+ // Handle must be positive integer.
+ throw new IllegalArgumentException("Could not start player, " + aHandle);
+ }
+ iHandle = aHandle;
+ start();
+ }
+
+ /**
+ * From Thread
+ */
+ public void run()
+ {
+ // buffer for the data copied from native
+ byte[] buffer = new byte[ BUFFER_MAXSIZE ];
+
+ // used get read size from native
+ int[] outputStreamSize = new int[ 1 ];
+
+ // Wait until native side starts writing or
+ // stream is closed.
+ iWaitObject.doWait();
+ if (iWaitObject.iStatus != WaitObject.NOTIFIED)
+ {
+ // some error has occured
+ iStatus = iWaitObject.iStatus;
+ }
+ // Read data until stream is completed or error occures.
+ while (iStatus >= NO_ERROR &&
+ iStatus != COMPLETED)
+ {
+ // Read data from native.
+ iStatus = _readData(iHandle,
+ iEventSourceHandle,
+ buffer,
+ outputStreamSize,
+ BUFFER_MAXSIZE,
+ iPlayerHandle);
+
+ // Write data to Java stream.
+ try
+ {
+ // Don't write if no bytes was read or error occured
+ if (outputStreamSize[ 0 ] > 0 &&
+ iStatus >= NO_ERROR)
+ {
+ iOutputStream.write(buffer, 0, outputStreamSize[ 0 ]);
+ }
+ }
+ catch (IOException ioe)
+ {
+ // Error writing to stream
+ iStatus = IO_ERROR;
+ }
+ catch (Throwable t)
+ {
+ // For example when OutputStream is closed
+ iStatus = IO_ERROR;
+ }
+ }
+
+ // Notify object waiting commit to complete.
+ iCommitWaitObject.doNotify();
+ }
+
+ /**
+ * Close stops run() thread
+ */
+ public void close()
+ {
+ iStatus = CLOSED;
+ // release wait
+ iWaitObject.doNotify();
+ }
+
+ /**
+ * Close the OutputStream.
+ * @throws IOException If an I/O error occurs
+ */
+ public void closeStream() throws IOException
+ {
+ iOutputStream.close();
+ }
+
+ /**
+ * Wait until all data is written from native side and flush the stream.
+ */
+ public void commit() throws IOException
+ {
+ if (iStatus < NO_ERROR)
+ {
+ throw new IOException(
+ "Current recording cannot be completed, Symbian OS error: " + iStatus);
+ }
+ iCommitWaitObject.doWait();
+ if (iCommitWaitObject.iStatus != WaitObject.NOTIFIED)
+ {
+ // error happened in waiting
+ iStatus = iCommitWaitObject.iStatus;
+ }
+ if (iStatus < NO_ERROR)
+ {
+ throw new IOException(
+ "Current recording cannot be completed, Symbian OS error: " + iStatus);
+ }
+ iOutputStream.flush();
+ iStatus = CLOSED;
+ }
+
+ /**
+ * C++ side notifies that data is available. Java makes a byte array
+ * and passes it to c++ side. Native side fills the byte array.
+ *
+ * @param alength native side notifies how many bytes are ready to be read
+ * @param aStatus Status of the stream reading
+ *
+ */
+ private void write(int aLength, int aStatus)
+ {
+ if (aStatus == COMMIT && iStatus >= NO_ERROR)
+ {
+ (new Thread(iRunnable)).start();
+ }
+ else if (this != null &&
+ iStatus >= NO_ERROR)
+ {
+ iStatus = aStatus;
+
+ // notify the write-loop that data is available
+ iWaitObject.doNotify();
+ }
+ }
+
+ /**
+ * _readData passes c++ side a byte array and native side
+ * fills it with output stream data.
+ *
+ * @param aHandle Handle
+ * @param aEventSourceHandle Event source
+ * @param aData byte array for output stream data
+ * @param aLength length of byte array
+ * @param aStatus status
+ * @return return value
+ */
+ static private native int _readData(int aHandle,
+ int aEventSourceHandle,
+ byte[] aData,
+ int[] aOutputStreamSize,
+ int aLength,
+ int aPlayerHandle);
+
+}
+
+//end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.Locator;
+import javax.microedition.media.MediaException;
+
+/**
+ * Interface for player creation from locator
+ */
+public interface Protocol
+{
+ /**
+ * Creates a new instance of the player from given locator
+ * @param aLocator Locator for creating Player.
+ * @return Fully constructed new Player
+ */
+ abstract InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/ProtocolFactory.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.Locator;
+import javax.microedition.media.MediaException;
+
+/**
+ * Factory for creating the Protocols
+ */
+public class ProtocolFactory
+{
+ private Protocol iConnectorProtocol = null;
+
+ public static final String PROTOCOL_CLASS_NAME = ".Protocol";
+ public static final String PROTOCOL_BASE_PACKAGE =
+ "com.nokia.microedition.media.protocol.";
+
+ /**
+ * Constructor
+ */
+ public ProtocolFactory()
+ {
+ iConnectorProtocol = new ConnectorProtocol();
+ }
+
+ /**
+ * Factory method for creating player from locator
+ * Tries to load assosiated <code>Protocol</code> first, if this fails
+ * then we try to create player by using <code>Connector</code>
+ * @param aLocator Media locator
+ * @return Player according to locator or null if cannot create
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ InternalPlayer player = null;
+ try
+ {
+ Class protocolClass =
+ Class.forName(PROTOCOL_BASE_PACKAGE +
+ aLocator.getProtocol() + PROTOCOL_CLASS_NAME);
+ Protocol protocol = (Protocol)protocolClass.newInstance();
+ player = protocol.createPlayer(aLocator);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new MediaException("Instantiation failed: " + ie);
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new MediaException("Illegal access: " + iae);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // we did not find specified Protocol, trying to create player
+ // with connector
+ player = iConnectorProtocol.createPlayer(aLocator);
+ }
+ return player;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/ProtocolPackage.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.Locator;
+import javax.microedition.media.MediaException;
+
+/**
+ * Base class for Protocols those can contain different Protocols
+ * e.g. "capture" protocol can handle also sub-protocols, depending
+ * on what type of Player is created.
+ * This class instantiates those automatically
+ */
+public class ProtocolPackage implements Protocol
+{
+ /**
+ * Protected to allow this class class to be extended.
+ */
+ protected ProtocolPackage()
+ {
+ }
+
+ /**
+ * Implementation from Protocol class, this method will create
+ * new protocol and call it's createPlayer
+ * @param aLocator identifies player
+ * @return new player
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ InternalPlayer player = null;
+ try
+ {
+ Class protocolClass =
+ Class.forName(ProtocolFactory.PROTOCOL_BASE_PACKAGE +
+ getProtocolName(aLocator) + "." +
+ getPackageName(aLocator) +
+ ProtocolFactory.PROTOCOL_CLASS_NAME);
+ Protocol protocol = (Protocol)protocolClass.newInstance();
+ player = protocol.createPlayer(aLocator);
+ }
+ catch (InstantiationException ie)
+ {
+ throw new MediaException("Internal error: " + ie);
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new MediaException("Internal error: " + iae);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new MediaException("Unable to create Player with locator: "
+ + aLocator.getLocatorString());
+ }
+ return player;
+ }
+
+ /**
+ * Returns the name of the package, this will be used for
+ * creating sub-protocol with name. e.g. with locator "capture://audio"
+ * this will return "audio"
+ *
+ * This method can be overridden if there is need for returning something else
+ * than middle part of the locator
+ * @return Middle part of the locator
+ */
+ protected String getPackageName(Locator aLocator) throws MediaException
+ {
+ return aLocator.getMiddlePart();
+ }
+
+ /**
+ * Returns the name of the protocol, this will be used for
+ * creating sub-protocol with name. e.g. with locator "capture://audio"
+ * this will return "capture"
+ *
+ * This method can be overridden if there is need for returning something else
+ * than protocol of the locator
+ * @return Protocol of the locator
+ */
+ protected String getProtocolName(Locator aLocator) throws MediaException
+ {
+ return aLocator.getProtocol();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/SeekThread.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Thread that calls SeekControl's seek method.
+*
+*/
+
+package com.nokia.microedition.media.protocol;
+
+import com.nokia.microedition.media.SeekControl;
+import com.nokia.mj.impl.utils.Logger;
+
+/**
+ * Thread that calls SeekControl's seek method.
+ */
+class SeekThread extends Thread
+{
+ // control to call in run method
+ final private SeekControl iSeekControl;
+
+ // object to notify when seek is ready
+ final private Object iWaitObject;
+
+ /**
+ * Public constructor.
+ * @param aWwaitObject Object to notify when ready
+ * @param aSeekControl Control to seek.
+ */
+ public SeekThread(Object aWaitObject,
+ SeekControl aSeekControl)
+ {
+ iWaitObject = aWaitObject;
+ iSeekControl = aSeekControl;
+ }
+
+ /**
+ * From Thread class.
+ */
+ public void run()
+ {
+ try
+ {
+ iSeekControl.seek(0);
+ }
+ catch (Exception e)
+ {
+ // If seek fails, stream cannot be read and SeekControl's target
+ // read must return -1 or throw an exception.
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA::SourceStreamReader::read seek exception ", e);
+ }
+
+ // notify that seek is ready
+ synchronized (iWaitObject)
+ {
+ iWaitObject.notify();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/SourceStreamReader.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SourceStreamReader gets data from java classes and passes
+* stream to CMMASourceStream on C++ side
+*
+*/
+
+
+package com.nokia.microedition.media.protocol;
+
+import java.io.IOException;
+import javax.microedition.media.protocol.SourceStream;
+import javax.microedition.media.Controllable;
+import javax.microedition.media.Control;
+import com.nokia.microedition.media.SeekControl;
+import com.nokia.microedition.media.InputStreamSeekControl;
+import com.nokia.mj.impl.utils.Logger;
+
+public class SourceStreamReader extends Thread
+{
+ Thread t1 = null;
+ // these states are the same in c++ side
+ private static final int NO_ERROR = 0;
+ private static final int ERR_GENERAL = -2; // KErrGeneral
+ private static final int ERR_EOF = -25; // KErrEof
+ private static final int READ_ALL = -1;
+ private static final int MORE_DATA = 3;
+ private static final int COMPLETED = 4;
+ private static final int CLOSED = -45; // KErrSessionClosed
+
+ // size of the buffer (transferred bytes)
+ // MMF currently requests data in 4k blocks
+ private static final int BUFFER_SIZE = 4096;
+
+ private static final String SEEK_CONTROL = "SeekControl";
+
+ private SourceStream iSourceStream;
+ private byte[] iBuffer;
+ private int iLength; // Length of stream c++ requested
+ private int iHandle; // handle to CMMASourceStream
+ private int iStatus = NO_ERROR; // source stream status
+ private int iEventSourceHandle;
+ private boolean iIsActive;
+ private int iPlayerHandle;
+
+ private Object iWaitObject = new Object();
+
+ // DataSource that SourceStream belongs to
+ private Controllable iControllable;
+
+ /**
+ * Constructor
+ *
+ * @param aSourceStream a Stream to be passed to C++ side
+ * @param aEventSourceHandle handle to the event source
+ */
+ public SourceStreamReader(SourceStream aSourceStream,
+ Controllable aControllable,
+ int aEventSourceHandle,
+ int aPlayerHandle)
+ {
+ iSourceStream = aSourceStream;
+ iControllable = aControllable;
+ iEventSourceHandle = aEventSourceHandle;
+ iBuffer = new byte[ BUFFER_SIZE ];
+ iPlayerHandle = aPlayerHandle;
+ }
+
+ /**
+ * Sets handle to CMMASourceStream
+ *
+ * @param aHandle handle to CMMASourceStream
+ */
+ public void setHandle(int aHandle)
+ {
+ iHandle = aHandle;
+ }
+
+ /**
+ * Run method for a thread which writes data to C++
+ */
+ public void run()
+ {
+ int length = 0;
+ do
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run()");
+ iStatus = MORE_DATA;
+ try
+ {
+ length = iSourceStream.read(iBuffer, 0, iLength);
+ }
+ catch (IOException ioe)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), io exception");
+ ioe.printStackTrace();
+ iStatus = ERR_GENERAL;
+ }
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), length = "+length);
+ if (iStatus == CLOSED)
+ {
+ return;
+ }
+ // no more data because end of file has been reach
+ if (length == -1)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"no more data because end of file has been reach");
+ iStatus = COMPLETED;
+ }
+ // synchronized (iWaitObject)
+ // {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), calling jni _write"+"status =" + iStatus + "length =" + length);
+
+ int err = _write(iHandle,
+ iEventSourceHandle,
+ iBuffer,
+ length,
+ iStatus,
+ iPlayerHandle);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), calling jni _write ret = "+err);
+ if (err != 0)
+ {
+ // error in writing, closing thread
+ iIsActive = false;
+ iStatus = CLOSED;
+ break;
+ }
+ // wait for next native read
+ // try
+ // {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), calling wait()");
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"Source stream reader run(), calling wait() thread is =" +Thread.currentThread().getName());
+ // iWaitObject.wait();
+ //}
+ /*catch (InterruptedException ex)
+ {
+ // MIDP's object does not have interrupt
+ }*/
+ // }
+ }
+ while (length>0);
+ }
+
+ /**
+ * Close stops run() thread
+ */
+ public void close()
+ {
+ iIsActive = false;
+ iStatus = CLOSED;
+
+ // If Controllable has SeekControl it must be closed
+ Control control = iControllable.getControl(SEEK_CONTROL);
+ if (control != null)
+ {
+ SeekControl sc = (SeekControl)control;
+ sc.close();
+ }
+
+ synchronized (iWaitObject)
+ {
+ iWaitObject.notify();
+ }
+ }
+
+ /**
+ * Resets streams to point start of the media. Player deallocate needs
+ * this.
+ */
+ public void resetStream()
+ {
+ try
+ {
+ SeekControl control = (SeekControl)iControllable.getControl(SEEK_CONTROL);
+ control.seek(0);
+ }
+ catch (IOException ioe)
+ {
+ // Stream may be broken, we can't do anything for it here.
+ // It will be noticed by the player when changing state from deallocate
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "SourceStreamReader: resetStream: ", ioe);
+ }
+ }
+
+
+ /**
+ * Native side request data from Java with read method.
+ *
+ * @param aBytes native side notifies how many bytes should be sent to it
+ * @param aStatus Status of the stream reading
+ */
+ private void read(int aBytes, int aStatus)
+ {
+ // Try to read but SourceStream is already completed or closed?
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"SourceStreamReader:: read() , callback detected ,iStatus = "+iStatus+" aBytes = "+aBytes);
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"thread id = "+Thread.currentThread().getName());
+ if (iStatus == CLOSED)
+ {
+ // Inform the native object; attempting to read pass the end of the stream
+ _write(iHandle, iEventSourceHandle, new byte[ 0 ], 0, ERR_EOF, iPlayerHandle);
+ return;
+ }
+
+ if (aBytes == READ_ALL)
+ {
+ iLength = BUFFER_SIZE;
+ }
+ else
+ {
+ iLength = aBytes;
+ }
+
+ if (aBytes > iBuffer.length)
+ {
+ // native request larger buffer
+ iBuffer = new byte[ aBytes ];
+ }
+
+ if (iStatus == COMPLETED)
+ {
+ // Stream is already read ones and need to be seeked to start
+ Control control = iControllable.getControl(SEEK_CONTROL);
+ if (control != null)
+ {
+ // start new seak thread, thread will notify iWaitObject
+ // when completed
+ (new SeekThread(iWaitObject,
+ (SeekControl)control)).start();
+ }
+ else
+ {
+ // stream is not seekable, so informing native object
+ _write(iHandle, iEventSourceHandle, new byte[ 0 ], 0,
+ ERR_EOF, iPlayerHandle);
+ }
+ }
+ else if (iIsActive)
+ {
+ // notify to while() write -loop that data is requested
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"SourceStreamReader:: read() before sync(iWaitObjet() ");
+ synchronized (iWaitObject)
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"SourceStreamReader:: read() notifying iWaitObject");
+ iWaitObject.notify();
+ }
+ }
+ else
+ {
+ Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"SourceStreamReader, creating new Thread");
+ iIsActive = true;
+ t1 = new Thread(this);
+ t1.start();
+ // start();
+ }
+
+ }
+
+
+ /**
+ * _write writes data to the C++ side
+ *
+ * @param aHandle Handle
+ * @param aEventSourceHandle EventSourceHandle
+ * @param aData Source stream
+ * @param aBytesRead how many bytes is read
+ * @param aStatus stream status
+ * @return return value
+ */
+ static private native int _write(int aHandle,
+ int aEventSourceHandle,
+ byte[] aData,
+ int aBytesRead,
+ int aStatus,
+ int aPlayerHandle);
+
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/capture/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.capture;
+
+/**
+ * Protocol class for handling "capture://" protocol
+ */
+public class Protocol extends com.nokia.microedition.media.protocol.ProtocolPackage
+{
+
+ /**
+ * Constructor
+ */
+ public Protocol()
+ {
+ };
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/capture/audio/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is capture://audio protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.capture.audio;
+
+import com.nokia.microedition.media.protocol.NativeBase;
+
+/**
+ * This class is capture://audio protocol.
+ */
+public class Protocol extends NativeBase
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/capture/devcam0/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is capture://devcam0 protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.capture.devcam0;
+
+import com.nokia.microedition.media.protocol.NativeBase;
+
+/**
+ * This class is capture://devcam0 protocol.
+ */
+public class Protocol extends NativeBase
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/capture/devcam1/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is capture://devcam1 protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.capture.devcam1;
+
+import com.nokia.microedition.media.protocol.NativeBase;
+
+/**
+ * This class is capture://devcam1 protocol.
+ */
+public class Protocol extends NativeBase
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/capture/video/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is capture://video protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.capture.video;
+
+import com.nokia.microedition.media.protocol.NativeBase;
+
+/**
+ * This class is capture://video protocol.
+ */
+public class Protocol extends NativeBase
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/device/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.device;
+
+/**
+ * Protocol class for handling "capture://" protocol
+ */
+public class Protocol extends com.nokia.microedition.media.protocol.ProtocolPackage
+{
+
+ /**
+ * Constructor
+ */
+ public Protocol()
+ {
+ };
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/device/midi/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is device://midi protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.device.midi;
+
+import com.nokia.microedition.media.protocol.NativeBase;
+
+/**
+ * This class is device://midi protocol.
+ */
+public class Protocol extends NativeBase
+{
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/device/tone/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is device://tone protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.device.tone;
+
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.PlugIn;
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.tone.TonePlayer;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.Manager;
+import java.io.IOException;
+import javax.microedition.media.protocol.DataSource;
+
+/**
+ * This class is device://tone protocol. This class also implements PlugIn
+ * interface which is used from ManagerImpl.
+ */
+public class Protocol
+ implements com.nokia.microedition.media.protocol.Protocol,
+ PlugIn
+{
+ // Used to recognize supported locators.
+ private static final String TONE_FILE_EXTENSION = ".jts";
+
+ // Used to get supported protocols. jts supports same protocols than midi.
+ private static final String MIDI_CONTENT_TYPE = "audio/midi";
+
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ if (aLocator.getParameters() != null)
+ {
+ // device://tone may not have properties.
+ throw new MediaException(
+ "Could not create player, parameters not supported: " +
+ aLocator.getParameters());
+ }
+ return new TonePlayer();
+ }
+
+ /**
+ * From PlugIn
+ */
+ public String[] getSupportedContentTypes(String aProtocol)
+ {
+ String[] types = new String[ 0 ];
+
+ if ((aProtocol == null) ||
+ isSupportedProtocol(aProtocol))
+ {
+ types = new String[ 1 ];
+ types[ 0 ] = TonePlayer.TONE_CONTENT_TYPE;
+ }
+ // else empty array is returned
+ return types;
+ }
+
+ /**
+ * Returns true if protocol is supported.
+ * @return true if protocol is supported.
+ */
+ private boolean isSupportedProtocol(String aProtocol)
+ {
+ // get all supported protocols
+ String[] protocols = getSupportedProtocols(null);
+ boolean isSupported = false;
+ // protocol is supported if it is found from protols array
+ for (int i = 0; i < protocols.length &&
+ !isSupported; i++)
+ {
+ if (protocols[ i ].equals(aProtocol))
+ {
+ isSupported = true;
+ }
+ }
+ return isSupported;
+ }
+
+ /**
+ * From PlugIn
+ */
+ public String[] getSupportedProtocols(String aContentType)
+ {
+ String[] protocols = new String[ 0 ];
+ if ((aContentType == null) ||
+ aContentType.equals(TonePlayer.TONE_CONTENT_TYPE))
+ {
+ // tone and midi supports same protocols.
+ protocols = Manager.getSupportedProtocols(
+ MIDI_CONTENT_TYPE);
+ }
+ // else empty array is returned
+ return protocols;
+ }
+
+ /**
+ * From PlugIn
+ */
+ public InternalPlayer createPlayer(DataSource aDataSource)
+ throws MediaException, IOException
+ {
+ InternalPlayer player = null;
+ String contentType = aDataSource.getContentType();
+ String locator = aDataSource.getLocator();
+ if ((contentType != null &&
+ contentType.equals(TonePlayer.TONE_CONTENT_TYPE)) ||
+ (locator != null &&
+ locator.endsWith(TONE_FILE_EXTENSION)))
+ {
+ player = new TonePlayer(aDataSource);
+ }
+ return player;
+ }
+
+ /**
+ * From PlugIn. Empty implementation.
+ */
+ public void preparePlayer(InternalPlayer aPlayer) throws MediaException
+ {
+ // tone does not extend existing players
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/file/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: file protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.file;
+
+import javax.microedition.media.MediaException;
+
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.ManagerImpl;
+import com.nokia.microedition.media.NativePlayerFactory;
+import com.nokia.microedition.media.ConnectorDataSource;
+import com.nokia.microedition.media.tone.TonePlayer;
+import javax.microedition.io.file.FileConnection;
+import javax.microedition.io.Connector;
+import java.io.IOException;
+
+
+/**
+ * This class presents file protocol
+ */
+public class Protocol implements
+ com.nokia.microedition.media.protocol.Protocol
+{
+ private static final String FILE = "file://";
+ private static final String DRM_SUFFIX = "dcf";
+ private static final String DRM_PARAMS = "?drm=enc";
+ private static final String JTS_SUFFIX = "jts";
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ FileConnection fileConnection = null;
+ try
+ {
+ if ((aLocator.getParameters() == null) &&
+ (aLocator.getMiddlePart().endsWith(DRM_SUFFIX)
+ ))
+ {
+ // DRM file, adding parameters to locator
+ fileConnection = (FileConnection)Connector.open(aLocator.getLocatorString(),Connector.READ);
+ }
+ else if (aLocator.getMiddlePart().endsWith(JTS_SUFFIX))
+ {
+ // JTS file, this format is handled in Java side, so creating player in traditional way
+ ConnectorDataSource dataSource = new ConnectorDataSource(aLocator);
+ return new TonePlayer(dataSource);
+ }
+ else
+ {
+ fileConnection = (FileConnection)Connector.open(aLocator.getLocatorString(),
+ Connector.READ);
+ }
+ String fileAndPath = getPathAndFileName(fileConnection);
+ Locator newLocator = new Locator(fileAndPath);
+ return NativePlayerFactory.createPlayer(newLocator, null);
+ }
+ finally
+ {
+ if (null != fileConnection)
+ {
+ fileConnection.close();
+ }
+ }
+ }
+
+ /**
+ * Internal operation to construct path + fileName from the URI of the file.
+ * Note: This operation removes parameter of the URI just like old
+ * FileConnectionImpl.getPathAndFileName() operation (used in older releases).
+ */
+ private String getPathAndFileName(FileConnection aFileConn)
+ {
+ String path = aFileConn.getPath();
+ // Path always starts with '/' character. This has to be skipped away because
+ // otherwise this is converted to '\\' below. FILE constant contains this first
+ // character('/') of the path.
+ path = path.substring(1);
+ String pathAndFileName = path + aFileConn.getName();
+ pathAndFileName = pathAndFileName.replace('/','\\');
+ return FILE + pathAndFileName;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/protocol/rtsp/Protocol.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: rtsp protocol
+*
+*/
+
+
+package com.nokia.microedition.media.protocol.rtsp;
+
+import javax.microedition.media.MediaException;
+
+import com.nokia.microedition.media.Locator;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.protocol.NativeBase;
+import com.nokia.mj.impl.media.RTSPPermission;
+import com.nokia.mj.impl.rt.support.ApplicationUtils;
+
+/**
+ * This class presents rtsp protocol and adds security prompt.
+ */
+public class Protocol extends NativeBase
+{
+ private static final String RTSP_CONNECTION_PERMISSION =
+ "javax.microedition.io.Connector.rtsp";
+
+ /**
+ * Default constructor.
+ */
+ public Protocol()
+ {
+ }
+
+ /**
+ * From interface Protocol
+ * @see Protocol
+ */
+ public InternalPlayer createPlayer(Locator aLocator)
+ throws java.io.IOException,
+ MediaException,
+ java.lang.SecurityException
+ {
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ RTSPPermission per = new RTSPPermission("network usage");
+ appUtils.checkPermission(per);
+ return super.createPlayer(aLocator);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/BlockEndEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence BLOCK_END events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Event processor class for tone sequence BLOCK_END events
+ */
+public class BlockEndEvent extends Event
+{
+ BlockEndEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ public int advance(int aPosition)
+ throws MidiSequenceException, IllegalArgumentException
+ {
+ int retVal = doValidate(aPosition);
+ if (retVal == 0)
+ {
+ return 0;
+ }
+ // if stack is already empty, we cannot revert back. Thus
+ // this BLOCK_END must be invalid
+ if (iReturnPositionStack.empty())
+ {
+ throw new IllegalArgumentException("Illegal BLOCK_END");
+ }
+ // If valid, go back to last position before entering block
+ int lastPos = ((Integer)iReturnPositionStack.pop()).intValue();
+ retVal = lastPos - aPosition;
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ int type = iSequence[ aPosition ];
+ int data = iSequence[ aPosition + 1 ];
+ int retVal = 0;
+
+ if (type == ToneControl.BLOCK_END)
+ {
+ leaveBlock(data); // fails if block number is incorrect
+ retVal = EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, BlockStart, PlayBlock, Volume, Repeat
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ throw new IllegalArgumentException(
+ "Validation failed, invalid position found in sequence");
+ }
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.BLOCK_START ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+
+ throw new IllegalArgumentException(
+ "Illegal event found; sequence is corrupted");
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/BlockStartEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence BLOCK_START events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Event processor class for tone sequence BLOCK_START events
+ */
+public class BlockStartEvent extends Event
+{
+ BlockStartEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ public int advance(int aPosition)
+ throws MidiSequenceException, IllegalArgumentException
+ {
+ return doValidate(aPosition);
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ int type = iSequence[ aPosition ];
+ int data = iSequence[ aPosition + 1 ];
+ int retVal = 0;
+
+ if (type == ToneControl.BLOCK_START)
+ {
+ if (data > MidiToneConstants.TONE_MAX_BLOCK ||
+ data < MidiToneConstants.TONE_MIN_BLOCK)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, block number not in range, valid range is 0 <= tempo <= 127");
+ }
+ enterBlock(data);
+ retVal = EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, PlayBlock, Volume, Repeat
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ throw new IllegalArgumentException(
+ "Validation failed, invalid position found in sequence");
+ }
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+ throw new IllegalArgumentException(
+ "Illegal event found; sequence is corrupted");
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/Event.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Base class for tone event processors
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+import java.util.Stack;
+import java.util.Hashtable;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * Base class for tone event processors
+ */
+public abstract class Event
+{
+ // CONSTANTS
+
+ /* Size of single tone event in bytes */
+ public static final byte EVENT_SIZE = 2;
+
+ // MEMBER DATA
+
+ /* Hold original tone sequence bytes */
+ protected byte[] iSequence;
+
+ /* Holds the new tone sequence converted to MIDI */
+ protected MidiSequence iMidiSequence;
+
+ /* Holds block position index in iSequence associated with block
+ number as key. Both are Integer. */
+ protected static Hashtable iBlocksHashtable;
+
+ /* Stack for tone event processors. Used by the method advance. */
+ protected static Stack iReturnPositionStack;
+
+ /* Current block number holder for validating blocks. If not in any
+ block, the value is -1. Manipulated by accessor methods. */
+ private static Stack iCurrentBlockNumStack;
+
+ /* Defines which event types (byte code) are accepted after this event.
+ List is very probably overridden by child events. Defaults to none. */
+// protected int[] ACCEPTED_EVENTS = {};
+
+ // Static initialization
+ static
+ {
+ iBlocksHashtable = new Hashtable();
+ iReturnPositionStack = new Stack();
+ iCurrentBlockNumStack = new Stack();
+ }
+
+ protected Event(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ iSequence = aSequence;
+ iMidiSequence = aMidiSequence;
+ }
+
+ /**
+ * Reset events for reuse
+ */
+ public void reset()
+ {
+ if (!iReturnPositionStack.empty())
+ {
+ iReturnPositionStack = new Stack();
+ }
+ if (!iBlocksHashtable.isEmpty())
+ {
+ iBlocksHashtable = new Hashtable();
+ }
+ if (!iCurrentBlockNumStack.isEmpty())
+ {
+ iCurrentBlockNumStack = new Stack();
+ }
+ }
+
+ /**
+ * Process events step by step. Does not validate and does not go
+ * through whole sequence, but only those positions that are
+ * needed for playing.
+ * @param aPosition position where to process
+ * @return int offset of position after processing, relative to aPosition.
+ * If zero, no processing has happened.
+ */
+ public abstract int advance(int aPosition)
+ throws MidiSequenceException, IllegalArgumentException;
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected abstract int doValidate(int aPosition)
+ throws IllegalArgumentException;
+
+ /**
+ * Validate sequence step by step. Does not process events, but can do
+ * initialization along validation. Validation includes: Check event
+ * type, parameters and that next event type after this one is allowed
+ * to be there.
+ * @param aPosition position where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ public int validate(int aPosition)
+ throws IllegalArgumentException
+ {
+ int nextPos = 0;
+ try
+ {
+ nextPos = doValidate(aPosition);
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ Logger.WLOG(Logger.EJavaMMAPI, "MMA: Event: validate: AIOOBE");
+ // just return
+ return nextPos;
+ }
+
+ if (nextPos < 0)
+ {
+ // doValidate must never return negative value
+ throw new Error();
+ }
+
+ if (nextPos != 0)
+ {
+ // check that event type in next position is allowed
+ checkEventAtNextPosition(aPosition + nextPos);
+ }
+ return nextPos;
+ }
+
+ /**
+ * Check whether event or end of sequence at next position
+ * is legal after this type of event. Throws
+ * IllegalArgumentException if not accepted.
+ * @param aPosition position of next event
+ */
+
+ protected abstract void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException;
+
+ /**
+ * Called when entering a block.
+ * @param aBlockNum number of block to enter
+ */
+ protected void enterBlock(int aBlockNum)
+ {
+ iCurrentBlockNumStack.push(new Integer(aBlockNum));
+ }
+
+ /**
+ * Called when leaving a block.
+ * @param aBlockNum number of block to leave
+ * @exception IllegalArgumentException if aBlockNum does not
+ * correspond to last block entered or if no block has been
+ * entered.
+ */
+ protected void leaveBlock(int aBlockNum) throws IllegalArgumentException
+ {
+ if (iCurrentBlockNumStack.isEmpty())
+ {
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA: Event: leaveBlock: Not inside block, IAE");
+ throw new IllegalArgumentException(
+ "Illegal Sequence, invalid block number found");
+ }
+
+ if (aBlockNum !=
+ (((Integer)iCurrentBlockNumStack.pop()).intValue()))
+ {
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA: Event: leaveBlock: Incorrect block number, IAE");
+ throw new IllegalArgumentException(
+ "Illegal Sequence, invalid block number found");
+ }
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/EventList.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is holder/handler for other event types
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+import java.util.Vector;
+import java.util.Enumeration;
+
+/**
+ * This class is holder/handler for other event types
+ */
+public class EventList extends Event
+{
+
+ // CONSTANTS
+
+ private static final int EVENT_PROCESSOR_COUNT = 6;
+
+ // MEMBERS
+
+ private Vector iEvents;
+
+ EventList(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+
+ iEvents = new Vector(EVENT_PROCESSOR_COUNT);
+
+ iEvents.addElement(
+ new ToneEvent(aSequence, aMidiSequence));
+ iEvents.addElement(
+ new BlockStartEvent(aSequence, aMidiSequence));
+ iEvents.addElement(
+ new BlockEndEvent(aSequence, aMidiSequence));
+ iEvents.addElement(
+ new PlayBlockEvent(aSequence, aMidiSequence));
+ iEvents.addElement(
+ new RepeatEvent(aSequence, aMidiSequence));
+ iEvents.addElement(
+ new VolumeEvent(aSequence, aMidiSequence));
+ }
+
+ public int advance(int aPosition) throws MidiSequenceException
+ {
+ // first check that we have at least two bytes left in iSequence
+ // in aPosition.
+ if (iSequence.length - aPosition < EVENT_SIZE)
+ {
+ // return with 0 if end of sequence is reached
+ return 0;
+ }
+
+ Event event = null;
+ int retVal = 0;
+
+ for (Enumeration e = iEvents.elements(); e.hasMoreElements();)
+ {
+ event = (Event)e.nextElement();
+ retVal = event.advance(aPosition);
+ if (retVal != 0)
+ {
+ return retVal;
+ }
+ }
+ // if none of event processors accepts data at current position,
+ // parameter data is illegal.
+ throw new IllegalArgumentException("Illegal event found, sequence is corrupted");
+ }
+
+
+ /**
+ * Inherited from Event.
+ * Special definition for validate. EventList is the main
+ * class performing the actual validation and is thus
+ * excempt from the usual validation process.
+ * @param aPosition position to validate
+ */
+ public int validate(int aPosition)
+ throws IllegalArgumentException
+ {
+ Event event = null;
+ int retVal = 0;
+ for (Enumeration e = iEvents.elements(); e.hasMoreElements();)
+ {
+ event = (Event)e.nextElement();
+ retVal = event.validate(aPosition);
+ if (retVal != 0)
+ {
+ return retVal;
+ }
+ }
+ // if none of event processors accepts data at current position,
+ // parameter data is illegal.
+ throw new IllegalArgumentException("Illegal event found, sequence is corrupted");
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ throw new Error("Illegal validation call");
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ throw new Error("Illegal validation call");
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/MidiSequence.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class represents midi sequence
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+/**
+ * This class represents midi sequence
+ */
+public class MidiSequence
+{
+ // CONSTANTS
+
+ /* Value of minute expressed as microseconds */
+ private static final int MINUTE_AS_MICROSECONDS = 60000000;
+
+ /* MIDI events track stream granularity */
+ private static final int MIDI_EVENTS_TRACK_GRANULARITY = 100;
+
+ // MIDI constants
+
+ /* Note value used for silence events. This will not be audible */
+ public static final byte MIDI_SILENCE_NOTE = 0;
+
+ // MIDI file constants
+
+ /* Maximum length of midi sequence events. After this has been
+ met, no new events are accepted by writeMidiEvent. This is not
+ a hard limit anyway (may be exceeded by the last written event),
+ so it's only here to guard memory use and possible infinite
+ sequence */
+
+ private static final int MIDI_EVENTS_MAX_BYTE_COUNT = 32768;
+
+ /* Length of MIDI file header. This includes following:
+ MThd block id, MThd length, midi format, MTrk chunk amount and PPQN */
+ private static final byte FILE_HEADER_LENGTH = 14;
+
+ /* Length of MTrk block. This includes: MTrk block id, MTrk length */
+ private static final byte MTRK_HEADER_LENGTH = 8;
+
+ /* Length of MIDI track header. This includes:
+ tempo change, tempo value, program change */
+ private static final int TRACK_HEADER_LENGTH = 10;
+
+ /* Length of MIDI track trailer */
+ private static final int TRACK_TRAILER_LENGTH = 4;
+
+ // MIDI file header constants
+
+ /* Header block for MThd */
+ private static final byte[] MIDI_HEADER_MTHD =
+ { 0x4D, 0x54, 0x68, 0x64 };
+
+ /* Header block for MThd block length; value is 6 */
+ private static final byte[] MIDI_HEADER_MTHD_LENGTH =
+ { 0x00, 0x00, 0x00, 0x06 };
+
+ /* Header block for used MIDI format; format is 0 */
+ private static final byte[] MIDI_HEADER_MIDI_FORMAT =
+ { 0x00, 0x00 };
+
+ /* Header block for amount of MTrk blocks used */
+ private static final byte[] MIDI_HEADER_MTRK_CHUNK_AMOUNT =
+ { 0x00, 0x01 };
+
+ /* Value for first byte in PPQN block in midi file header */
+ private static final byte MIDI_HEADER_PPQN_FIRST_BYTE = 0x00;
+
+ // MIDI track constants
+
+ /* Header block for MTrk */
+ private static final byte[] MIDI_HEADER_MTRK =
+ { 0x4D, 0x54, 0x72, 0x6B };
+
+ /* Tempo change command. Includes delta time ( 0x00 )
+ and command (0xFF5103) */
+ private static final byte[] TRACK_HEADER_TEMPO_CHANGE =
+ { 0x00, (byte)0xFF, 0x51, 0x03 };
+
+ /* Track end meta event */
+ private static final byte[] TRACK_TRAILER =
+ { 0x00, (byte)0xFF, 0x2F, 0x00 };
+
+ /* Length of single midi event without the variable length
+ delta time */
+ private static final int MIDI_EVENT_COMMAND_LENGTH = 3;
+
+ /* Channel mask for setting correct channel in writeMidiEvent */
+ private static final byte MIDI_EVENT_CHANNEL_MASK = (byte)0xF0;
+
+ /* Maximum value for midi variable length quantity */
+ private static final int MIDI_VARIABLE_LENGTH_MAX_VALUE = 0x0FFFFFFF;
+
+ // Tone constants
+
+ /* Tone resolution is expressed in pulses per full note, whereas
+ midi resolution is pulses per quarter note. Thus we must divide tone
+ empo by 4. For tone, 64 is considered default */
+ private static final byte TONE_DEFAULT_RESOLUTION = 64; // 64/4 = 16(ppqn)
+
+ /* Default tempo for tone is 30. For bpm value it is multiplied by 4 */
+ private static final byte TONE_DEFAULT_TEMPO = 30; // 4*30 = 120 (bpm)
+
+ /* Tone multiplier is used for both dividing resolution and multiplying
+ tempo to get equivalent midi values */
+ private static final byte TONE_MULTIPLIER = 1;
+
+ // MEMBER DATA
+
+ /* Midi channel for generated MIDI sequence */
+ private byte iChannel;
+
+ /* Tempo in MIDI terms */
+ private int iTempo;
+
+ /* Resolution in MIDI terms */
+ private int iResolution;
+
+ /* Instrument used to represent tone */
+ private byte iInstrument;
+
+ /* Counter for written midi events */
+ private int iMidiEventsByteCount;
+
+ /* MIDI sequence written using writeEvent( ) */
+ private ByteArrayOutputStream iMidiTrackEvents;
+
+ /* Tone sequence duration */
+ private int iDuration;
+
+ /**
+ * Constructor
+ * @param aChannel MIDI channel which is assigned to generate track
+ * @param aInstrument Instrument used to represent tone
+ */
+ MidiSequence(byte aChannel, byte aInstrument)
+ {
+ iChannel = aChannel;
+ iInstrument = aInstrument;
+ iTempo = TONE_DEFAULT_TEMPO * TONE_MULTIPLIER;
+ iResolution = TONE_DEFAULT_RESOLUTION / TONE_MULTIPLIER;
+ iMidiTrackEvents = new ByteArrayOutputStream(
+ MIDI_EVENTS_TRACK_GRANULARITY);
+ }
+
+ /**
+ * Get midi stream
+ */
+ public ByteArrayInputStream getStream() throws IOException
+ {
+ iMidiTrackEvents.flush();
+ byte[] midiTrackEvents = iMidiTrackEvents.toByteArray();
+ ByteArrayOutputStream concateStream =
+ new ByteArrayOutputStream(
+ FILE_HEADER_LENGTH +
+ MTRK_HEADER_LENGTH +
+ TRACK_HEADER_LENGTH +
+ midiTrackEvents.length +
+ TRACK_TRAILER_LENGTH);
+
+ writeHeader(concateStream, midiTrackEvents.length);
+ concateStream.write(midiTrackEvents);
+ writeTrailer(concateStream);
+
+ ByteArrayInputStream midi = new ByteArrayInputStream(
+ concateStream.toByteArray());
+
+ concateStream.close();
+ return midi;
+ }
+
+ /**
+ * Get midi file data as byte[]
+ */
+ public byte[] getByteArray() throws IOException
+ {
+ iMidiTrackEvents.flush();
+ byte[] midiTrackEvents = iMidiTrackEvents.toByteArray();
+ ByteArrayOutputStream concateStream =
+ new ByteArrayOutputStream(
+ FILE_HEADER_LENGTH +
+ MTRK_HEADER_LENGTH +
+ TRACK_HEADER_LENGTH +
+ midiTrackEvents.length +
+ TRACK_TRAILER_LENGTH);
+
+ writeHeader(concateStream, midiTrackEvents.length);
+ concateStream.write(midiTrackEvents);
+ writeTrailer(concateStream);
+
+ byte[] midi = concateStream.toByteArray();
+ concateStream.close();
+ return midi;
+ }
+
+ /**
+ * Set tempo
+ * @param aTempo tempo in tone sequence terms
+ */
+ public void setTempo(int aTempo)
+ {
+ if (aTempo < MidiToneConstants.TONE_TEMPO_MIN ||
+ aTempo > MidiToneConstants.TONE_TEMPO_MAX)
+ {
+ throw new IllegalArgumentException("Tempo is out of range, " +
+ "valid range is 5 <= tempo <= 127");
+ }
+ iTempo = aTempo * TONE_MULTIPLIER;
+ }
+
+ /**
+ * Set resolution
+ * @param aResolution resolution in tone sequence terms
+ */
+ public void setResolution(int aResolution)
+ {
+ if (aResolution < MidiToneConstants.TONE_RESOLUTION_MIN ||
+ aResolution > MidiToneConstants.TONE_RESOLUTION_MAX)
+ {
+ throw new IllegalArgumentException("Resolution is out of range, " +
+ "valid range is 1 <= resolution <= 127");
+ }
+ iResolution = aResolution / TONE_MULTIPLIER;
+ }
+
+ /*
+ * Write midi event to stream. This method writes both variable length
+ * delta time and midi event.
+ * @param aLength time between last event and this event (delta time)
+ * @param aCommand MIDI command byte
+ * @param aEvent First MIDI command parameter
+ * @param aData Second MIDI command parameter
+ */
+ public void writeMidiEvent(int aLength,
+ byte aCommand,
+ byte aEvent,
+ byte aData)
+ throws MidiSequenceException
+ {
+ if (iMidiEventsByteCount > MIDI_EVENTS_MAX_BYTE_COUNT)
+ {
+ throw new MidiSequenceException();
+ }
+ iMidiEventsByteCount += writeVarLen(iMidiTrackEvents, aLength);
+
+ // Write down cumulative count of event lengths (sum will
+ // make up duration of this midi sequence. Only audible events
+ // are counted, which means only those delta times which
+ // are associated to NOTE_OFF events
+ if (aCommand == MidiToneConstants.MIDI_NOTE_OFF)
+ {
+ iDuration += aLength;
+ }
+
+ // attach correct channel number
+ aCommand &= MIDI_EVENT_CHANNEL_MASK;
+ aCommand |= iChannel;
+
+ iMidiTrackEvents.write(aCommand);
+ iMidiTrackEvents.write(aEvent);
+ iMidiTrackEvents.write(aData);
+ iMidiEventsByteCount += MIDI_EVENT_COMMAND_LENGTH;
+ }
+
+ /**
+ * Write time interval value as MIDI variable length data to byte array.
+ * @param aOut output stream
+ * @param aValue time before the event in question happens, relative to
+ * current time. Must be between 0 and 0x0FFFFFFF
+ */
+ private int writeVarLen(ByteArrayOutputStream aOut, int aValue)
+ {
+ if ((aValue > MIDI_VARIABLE_LENGTH_MAX_VALUE) || (aValue < 0))
+ {
+ throw new IllegalArgumentException("Input(time) value is not within range");
+ }
+
+ // Variable to hold count of bytes written to output stream.
+ // Value range is 1-4.
+ int byteCount = 0;
+
+ // variable length quantity can any hold unsigned integer value which
+ // can be represented with 7-28 bits. It is written out so that 7 low
+ // bytes of each byte hold part of the value and 8th byte indicates
+ // whether it is last byte or not (0 if is, 1 if not). Thus a variable
+ // length quantity can be 1-4 bytes long.
+
+ int buffer = aValue & 0x7F; // put low 7 bytes to buffer
+
+ // check if bits above 7 first are significant, 7 bits at time. If
+ // they are, buffer is shifted 8 bits left and the new 7 bits are
+ // appended to beginning of buffer. The eigth byte from right is
+ // set 1 to indicate that that there is at least another 7 bits
+ // on left (bits 9-15) which are part of the quantity.
+
+ // Example. Integer 00000100 11111010 10101010 01010101
+ // 1) Set low 7 bytes to buffer => 1010101
+ // 2) Check if there is more significant bytes in the integer. If
+ // is, continue.
+ // 3) Shift buffer 8 left => 1010101 00000000
+ // 4) Append next 7 bytes to beginning of buffer
+ // buffer => 1010101 01010100
+ // 5) Set 8th bit 1 to indicate that there is another 7 bits on left
+ // buffer => 1010101 11010100
+ // 6) repeat from step 2
+
+ aValue >>= 7;
+ while (aValue != 0)
+ {
+ buffer <<= 8;
+ buffer |= ((aValue & 0x7F) | 0x80);
+ aValue >>= 7;
+ }
+
+ // write the buffer out as 1-4 bytes.
+ while (true)
+ {
+ aOut.write(buffer);
+ byteCount++;
+
+ // check if the indicator bit (8th) is set.
+ // If it is, continue writing.
+ int tempBuf = buffer & 0x80;
+ if (tempBuf != 0)
+ {
+ buffer >>= 8;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return byteCount;
+ }
+
+ /**
+ * Writes midi header
+ * @param aOut output stream
+ * @param aMidiEventsLength lenght of midi event content in bytes
+ */
+ private void writeHeader(
+ ByteArrayOutputStream aOut,
+ int aMidiEventsLength)
+ throws IOException
+ {
+ // MIDI FILE HEADER
+
+ // write 'MThd' block id
+ aOut.write(MIDI_HEADER_MTHD);
+
+ // write MThd block length
+ aOut.write(MIDI_HEADER_MTHD_LENGTH);
+
+ // write midi format; format is 0
+ aOut.write(MIDI_HEADER_MIDI_FORMAT);
+
+ // write MTrk chunk amount; only one track
+ aOut.write(MIDI_HEADER_MTRK_CHUNK_AMOUNT);
+
+ // write PPQN resolution (pulses per quarternote)
+ aOut.write(MIDI_HEADER_PPQN_FIRST_BYTE);
+ aOut.write(iResolution);
+
+ // MTrk HEADER
+
+ // write 'MTrk' for the only track
+ aOut.write(MIDI_HEADER_MTRK);
+
+ // calculate real track length
+ int trackLength = TRACK_HEADER_LENGTH +
+ aMidiEventsLength +
+ TRACK_TRAILER_LENGTH;
+
+ // write track length in bytes.
+ // Literal numeric values (24,16,8) indicate shift offset in bits
+ // 0xFF is used to mask out everything but the lowest byte.
+ aOut.write((trackLength >> 24) & 0xFF);
+ aOut.write((trackLength >> 16) & 0xFF);
+ aOut.write((trackLength >> 8) & 0xFF);
+ aOut.write(trackLength & 0xFF);
+
+ // TRACK HEADER
+
+ // write tempo change at beginning
+ aOut.write(TRACK_HEADER_TEMPO_CHANGE);
+
+ // calculate tempo in microseconds per quarter note
+ int mpqn = MINUTE_AS_MICROSECONDS / iTempo;
+
+ // write tempo value
+ // Literal numeric values (16,8) indicate shift offset in bits
+ // 0xFF is used to mask out everything but the lowest byte.
+ aOut.write((mpqn >> 16) & 0xFF);
+ aOut.write((mpqn >> 8) & 0xFF);
+ aOut.write(mpqn & 0xFF);
+
+ // change program at beginning (at delta time 0)
+ writeVarLen(aOut, 0);
+ aOut.write((byte)(MidiToneConstants.MIDI_PROGRAM_CHANGE | iChannel));
+ aOut.write(iInstrument); // instrument number
+ }
+
+ /**
+ * Write midi trailer
+ * @param aOut output stream
+ */
+ private void writeTrailer(ByteArrayOutputStream aOut) throws IOException
+ {
+ aOut.write(TRACK_TRAILER);
+ }
+
+ /**
+ * Return duration accumulated so far.
+ * @return long duration in microseconds
+ */
+ public long getCumulativeDuration()
+ {
+ // duration * seconds in minute * microseconds in second /
+ // (resolution * tempo)
+ long duration = (long)iDuration * 60 * 1000000 / (iResolution * iTempo);
+ return duration;
+ }
+
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/MidiSequenceException.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Exception class for internal use
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+/**
+ * Exception class for internal use
+ */
+public class MidiSequenceException extends Exception
+{
+
+} // end of class
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/MidiToneConstants.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Midi and tone related constants
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+/**
+ * MIDI and tone related common constants
+ */
+public class MidiToneConstants
+{
+ // Fully qualified name for ToneControl
+ public static final String TONE_CONTROL_FULL_NAME =
+ "javax.microedition.media.control.ToneControl";
+
+ // Fully qualified name for MIDIControl
+ public static final String MIDI_CONTROL_FULL_NAME =
+ "javax.microedition.media.control.MIDIControl";
+
+ // MIDI constants
+
+ // Note on message ID
+ public static final byte MIDI_NOTE_ON = (byte)0x90;
+
+ // Note off message ID
+ public static final byte MIDI_NOTE_OFF = (byte)0x80;
+
+ // Control change message ID
+ public static final byte MIDI_CONTROL_CHANGE = (byte)0xB0;
+
+ // Program change message ID
+ public static final byte MIDI_PROGRAM_CHANGE = (byte)0xC0;
+
+ // MIDI Main volume control ID for control change message
+ public static final byte MIDI_CONTROL_MAIN_VOLUME = 0x07;
+
+ // MIDI velocity for tone notes
+ public static final byte MIDI_MAX_VELOCITY = 127;
+ public static final byte MIDI_MIN_VELOCITY = 0;
+
+ // Maximum and minimum MIDI volume values
+ public static final byte MIDI_MAX_VOLUME = 127;
+ public static final byte MIDI_MIN_VOLUME = 0;
+
+ // Maximum and minimum MIDI volume values
+ public static final byte MIDI_MAX_TONE = 127;
+ public static final byte MIDI_MIN_TONE = 0;
+
+ // MIDI instrument used to play tone events
+ public static final byte MIDI_TONE_INSTRUMENT = 39;
+
+ // MIDI bank for instrument used to play tone events
+ public static final byte MIDI_TONE_BANK = -1;
+
+ // MIDI channel used to play tone events
+ public static final byte MIDI_TONE_CHANNEL = 0;
+
+ // Tone MidiToneConstants
+
+ // Maximum and minimum tone volume values
+ public static final byte TONE_MAX_VOLUME = 100;
+ public static final byte TONE_MIN_VOLUME = 0;
+
+ // Maximum and minimum tone note values
+ public static final byte TONE_MAX_NOTE = 127;
+ public static final byte TONE_MIN_NOTE = 0;
+
+ // Maximum and minimum block number values
+ public static final byte TONE_MAX_BLOCK = 127;
+ public static final byte TONE_MIN_BLOCK = 0;
+
+ /* Minimum and maximum values for note duration */
+ public static final int TONE_SEQUENCE_NOTE_MAX_DURATION = 127;
+ public static final int TONE_SEQUENCE_NOTE_MIN_DURATION = 1;
+
+ /* Minimun tone sequence length */
+ public static final int TONE_SEQUENCE_MIN_LENGTH = 4;
+
+ /* Supported tone version number */
+ public static final int TONE_SEQUENCE_SUPPORTED_VERSION = 1;
+
+ /* Minimum and maximum tone tempo values */
+ public static final int TONE_TEMPO_MIN = 5;
+ public static final int TONE_TEMPO_MAX = 127;
+
+ /* Minimum and maximum tone resolution values */
+ public static final int TONE_RESOLUTION_MIN = 1;
+ public static final int TONE_RESOLUTION_MAX = 127;
+
+
+} // end of class
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/PlayBlockEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence PLAY_BLOCK events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Processor for play block events
+ */
+public class PlayBlockEvent extends Event
+{
+
+ // CONSTANTS
+
+ /* Maximum and minimum values for block number */
+ public static final int PLAY_BLOCK_MAX_VALUE = 127;
+ public static final int PLAY_BLOCK_MIN_VALUE = 0;
+
+ PlayBlockEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ /**
+ * Inherited from Event
+ */
+ public int advance(int aPosition)
+ {
+ int retVal = doValidate(aPosition);
+ if (retVal != 0)
+ {
+ // Push the position to stack that is going to be
+ // played after this play block has completed
+ iReturnPositionStack.push(new Integer(aPosition + EVENT_SIZE));
+
+ int data = iSequence[ aPosition + 1 ];
+ retVal = findBlock(data) - aPosition;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ // it is already checked that there is at least two bytes left
+ int type = iSequence[ aPosition ];
+ int data = iSequence[ aPosition + 1 ];
+ int retVal = 0;
+
+ if (type == ToneControl.PLAY_BLOCK)
+ {
+ if (data < PLAY_BLOCK_MIN_VALUE ||
+ data > PLAY_BLOCK_MAX_VALUE)
+ {
+ throw new IllegalArgumentException(
+ "Block number out of range");
+ }
+ findBlock(data); // for check only
+ retVal = EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Find block
+ * @param block number
+ * @return position of corresponding BLOCK_START event
+ * @exception IllegalArgumentException if block is not found
+ */
+ private int findBlock(int aBlockNumber)
+ {
+ for (int i = 0; i < iSequence.length; i += EVENT_SIZE)
+ {
+ if (iSequence[ i ] == ToneControl.BLOCK_START &&
+ iSequence[ i + 1 ] == aBlockNumber)
+ {
+ return i;
+ }
+ }
+ // if block is not found, input is illegal
+ throw new IllegalArgumentException("No block found, sequence is corrupted");
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, BlockEnd PlayBlock, Volume, Repeat or end of sequence
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ return; // end of sequence is OK
+ }
+
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.BLOCK_END ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+ throw new IllegalArgumentException("Illegal event found, sequence is corrupted");
+ }
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/PlayToneImpl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Manager.playTone implementation
+*
+*/
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.Manager;
+import javax.microedition.media.Player;
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.control.ToneControl;
+import javax.microedition.media.MediaException;
+import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.util.Vector;
+
+/**
+ * Manager.playTone implementation
+ *
+ */
+public class PlayToneImpl implements PlayerListener
+{
+
+ // MEMBERS
+ private static final String TONE_SEQUENCE_CONTENT_TYPE = "audio/x-tone-seq";
+ private static final int TONE_SEQUENCE_VERSION = 1;
+ private static final int TONE_SEQUENCE_RESOLUTION = 64;
+ private static final int TONE_SEQUENCE_TEMPO = 30;
+ private static final int DURATION_DIVIDE = 240000;
+ private static final String CANNOT_PLAY_TONE = "Cannot play tone";
+
+ // Holds tone players
+ private Vector iPlayers = new Vector();
+
+ /**
+ * Constructor
+ */
+ public PlayToneImpl()
+ {
+ }
+
+ /**
+ * Play tone.
+ * @see javax.microedition.media.Manager.playTone()
+ */
+ synchronized public void playTone(int aNote, int aDuration, int aVolume)
+ throws MediaException
+ {
+ if (aVolume < MidiToneConstants.TONE_MIN_VOLUME)
+ {
+ aVolume = MidiToneConstants.TONE_MIN_VOLUME;
+ }
+ else if (aVolume > MidiToneConstants.TONE_MAX_VOLUME)
+ {
+ aVolume = MidiToneConstants.TONE_MAX_VOLUME;
+ }
+
+ if (aNote > MidiToneConstants.TONE_MAX_NOTE ||
+ aNote < MidiToneConstants.TONE_MIN_NOTE)
+ {
+ throw new IllegalArgumentException("Note is out of range, " +
+ "valid range is 0 <= Note <= 127");
+ }
+
+ if (aDuration <= 0)
+ {
+ throw new IllegalArgumentException("Duration must be positive");
+ }
+
+ int duration = aDuration * TONE_SEQUENCE_RESOLUTION *
+ TONE_SEQUENCE_TEMPO / DURATION_DIVIDE;
+
+ if (duration < MidiToneConstants.TONE_SEQUENCE_NOTE_MIN_DURATION)
+ {
+ duration = MidiToneConstants.TONE_SEQUENCE_NOTE_MIN_DURATION;
+ }
+ else if (duration > MidiToneConstants.TONE_SEQUENCE_NOTE_MAX_DURATION)
+ {
+ duration = MidiToneConstants.TONE_SEQUENCE_NOTE_MAX_DURATION;
+ }
+
+ byte[] sequence =
+ {
+ ToneControl.VERSION, TONE_SEQUENCE_VERSION,
+ ToneControl.TEMPO, TONE_SEQUENCE_TEMPO,
+ ToneControl.RESOLUTION, TONE_SEQUENCE_RESOLUTION,
+ ToneControl.SET_VOLUME, (byte)aVolume,
+ (byte)aNote, (byte)duration
+ };
+
+ Player p = null;
+ try
+ {
+ p = Manager.createPlayer(
+ new ByteArrayInputStream(sequence),
+ TONE_SEQUENCE_CONTENT_TYPE);
+ }
+ catch (IOException ioe)
+ {
+ iPlayers.removeElement(p);
+ throw new MediaException(CANNOT_PLAY_TONE + " " + ioe.getMessage());
+ }
+
+ p.addPlayerListener(this);
+ iPlayers.addElement(p);
+ try
+ {
+ p.start();
+ }
+ catch (MediaException me)
+ {
+ iPlayers.removeElement(p);
+ throw me;
+ }
+ }
+
+ /**
+ * @see javax.microedition.media.PlayerListener.playerUpdate()
+ */
+ public void playerUpdate(Player aPlayer, java.lang.String aEvent,
+ java.lang.Object aEventData)
+ {
+ if ((aEvent == END_OF_MEDIA) || (aEvent == ERROR))
+ {
+ aPlayer.close();
+ iPlayers.removeElement(aPlayer);
+ }
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/RepeatEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence REPEAT events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Event processor class for tone sequence REPEAT events
+ */
+public class RepeatEvent extends Event
+{
+
+ // CONSTANTS
+
+ /* Maximum and minimum tone repeat multiplier values */
+ public static final int REPEAT_MIN_MULTIPLIER = 2;
+ public static final int REPEAT_MAX_MULTIPLIER = 127;
+
+ /**
+ * RepeatEvent constructor
+ * @param aSequence tone sequence byte array (input)
+ * @param aMidiSequence midi sequence object where to output midi events.
+ */
+
+ RepeatEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ /**
+ * Inherited from Event
+ */
+ public int advance(int aPosition)
+ throws MidiSequenceException
+ {
+ // it is already checked that there is at least two bytes left
+ byte type = iSequence[ aPosition ];
+ byte data = iSequence[ aPosition + 1 ];
+ int retVal = doValidate(aPosition);
+ if (retVal == 0)
+ {
+ return 0;
+ }
+ for (int i = 0; i < data; i++)
+ {
+ retVal = ToneEvent.staticAdvance(aPosition + EVENT_SIZE,
+ iSequence,
+ iMidiSequence);
+ // This would go unnoticed if not checked here.
+ if (retVal == 0)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, processing events for playing failed");
+ }
+ retVal = EVENT_SIZE + EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ byte type = iSequence[ aPosition ];
+ byte data = iSequence[ aPosition + 1 ];
+ int retVal = 0;
+ if (type == ToneControl.REPEAT)
+ {
+ if (data < REPEAT_MIN_MULTIPLIER || data > REPEAT_MAX_MULTIPLIER)
+ {
+ throw new IllegalArgumentException(
+ "Repeat multiplier out of range, valid range is 2 <= multiplier <= 127");
+ }
+
+ // Check that there is two more bytes available
+ if (iSequence.length - (aPosition + EVENT_SIZE) < EVENT_SIZE)
+ {
+ throw new IllegalArgumentException(
+ "Illegal ToneControl.REPEAT event, " +
+ "there should be two more bytes available after REPEAT event");
+ }
+ retVal = EVENT_SIZE + EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, BlockEnd, PlayBlock, Volume, Repeat or
+ // end of sequence
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ return; // end of sequence is ok for this event
+ }
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.BLOCK_END ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+
+ throw new IllegalArgumentException(
+ "Illegal event found; sequence is corrupted");
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/ToneEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence audible note events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Event processor class for tone sequence note events (both audible & silent)
+ */
+public class ToneEvent extends Event
+{
+ /**
+ * ToneEvent constructor
+ * @param aSequence tone sequence byte array (input)
+ * @param aMidiSequence midi sequence object where to output midi events.
+ */
+ ToneEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ /**
+ * Inherited from Event
+ */
+ public int advance(int aPosition)
+ throws MidiSequenceException
+ {
+ return staticAdvance(aPosition, iSequence, iMidiSequence);
+ }
+
+ /**
+ * Static version of advance( ) to be used by RepeatEvent
+ */
+ public static int staticAdvance(int aPosition,
+ byte[] aToneSequence,
+ MidiSequence aMidiSequence)
+ throws MidiSequenceException
+ {
+ int retVal = doStaticValidate(aPosition, aToneSequence);
+ if (retVal == 0)
+ {
+ return 0;
+ }
+ // it is already checked that there is at least two bytes left
+ byte type = aToneSequence[ aPosition ];
+ byte data = aToneSequence[ aPosition + 1 ];
+
+ if (type == ToneControl.SILENCE)
+ {
+ retVal = processToneEvent(type, data, true, aMidiSequence);
+ }
+ else if (type >= MidiToneConstants.TONE_MIN_NOTE &&
+ type <= MidiToneConstants.TONE_MAX_NOTE)
+ {
+ retVal = processToneEvent(type, data, false, aMidiSequence);
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ return doStaticValidate(aPosition, iSequence);
+ }
+
+ /**
+ * Implementation for doValidate, for static context.
+ * @param aPosition position where to validate
+ * @param aToneSequence sequence which to validate
+ */
+ private static int doStaticValidate(int aPosition, byte[] aToneSequence)
+ {
+ byte type = aToneSequence[ aPosition ];
+ byte data = aToneSequence[ aPosition + 1 ];
+ int retVal = 0;
+
+ if (type >= ToneControl.SILENCE &&
+ type <= MidiToneConstants.TONE_MAX_NOTE)
+ {
+ if (data < MidiToneConstants.TONE_SEQUENCE_NOTE_MIN_DURATION ||
+ data > MidiToneConstants.TONE_SEQUENCE_NOTE_MAX_DURATION)
+ {
+ throw new IllegalArgumentException(
+ "Note duration out of range, valid range is 1 <= duration <=127");
+ }
+ retVal = EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Writes tone event into MIDI sequence.
+ * @param aType tone event type
+ * @param aData tone event parameter
+ * @param aSilent whether this event is silent (note value -1) or not.
+ * @param aMidiSequence midi sequence to write midi events to
+ */
+ private static int processToneEvent(
+ byte aType,
+ byte aData,
+ boolean aSilent,
+ MidiSequence aMidiSequence) throws MidiSequenceException
+ {
+ // If this is a silent note, two NOTE_OFFs are written into midi sequence.
+ // otherwise NOTE_ON and NOTE_OFF.
+
+ byte firstMidiEventType = MidiToneConstants.MIDI_NOTE_ON;
+ if (aSilent)
+ {
+ firstMidiEventType = MidiToneConstants.MIDI_NOTE_OFF;
+ }
+
+ // write 'note on' on delta time 0
+ aMidiSequence.writeMidiEvent(0,
+ firstMidiEventType,
+ aType,
+ MidiToneConstants.MIDI_MAX_VELOCITY);
+ // write 'note off' after delta time represented by 'data' variable
+ aMidiSequence.writeMidiEvent(aData,
+ MidiToneConstants.MIDI_NOTE_OFF,
+ aType,
+ MidiToneConstants.MIDI_MAX_VELOCITY);
+
+ // N.B.! Above MIDI_NOTE_ON and MIDI_NOTE_OFF can be written without channel
+ // value because MidiSequence attached correct channel value to them anyway.
+ return EVENT_SIZE;
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, BlockEnd, PlayBlock, Volume, Repeat or
+ // end of sequence
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ return; // end of sequence is ok for this event
+ }
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.BLOCK_END ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+
+ throw new IllegalArgumentException(
+ "Illegal event found; sequence is corrupted");
+ }
+
+} // end of class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/TonePlayer.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,509 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.PlayerListener;
+import javax.microedition.media.MediaException;
+import javax.microedition.media.control.ToneControl;
+import javax.microedition.media.protocol.DataSource;
+import javax.microedition.media.protocol.SourceStream;
+import javax.microedition.media.Manager;
+import javax.microedition.media.Player;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import com.nokia.microedition.media.PlayerBase;
+import com.nokia.microedition.media.InternalPlayer;
+import com.nokia.microedition.media.tone.ToneSequence;
+import com.nokia.microedition.media.control.MIDIControl;
+import com.nokia.microedition.media.PlayerListenerImpl;
+import java.util.Vector;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * Player that is created with Manager.TONE_DEVICE_LOCATOR locator or
+ * with jts content.
+ */
+public class TonePlayer extends PlayerBase implements ToneControl, PlayerListener
+{
+ // This is allways tone's content type
+ public static final String TONE_CONTENT_TYPE =
+ "audio/x-tone-seq";
+
+ private static final String TONE_LOCATOR_SUFFIX = ".jts";
+
+ // MIDI player used to play tone
+ private InternalPlayer iMidiPlayer;
+
+ // Internal MIDI player listener
+ private PlayerListenerImpl iPlayerListenerImpl;
+
+ // MIDI control used to reset native midi engine.
+ private MIDIControl iMIDIControl;
+
+ // Tone sequence processed to midi sequence
+ private byte[] iMidiSequence;
+
+ // Tone sequence duration
+ private long iDuration;
+
+ // Granularity for tone sequence reader
+ private static final int SEQUENCE_READ_GRANULARITY = 1024; // 1 KB
+
+ // Empty midi sequence for midi player initialization
+ private static final byte[] EMPTY_MIDI_SEQUENCE =
+ {
+ 0x4D,0x54,0x68,0x64,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x01,0x00,0x10,
+ 0x4D,0x54,0x72,0x6B,0x00,0x00,0x00,0x12,0x00,(byte)0xFF,0x51,0x03,
+ 0x07,(byte)0xA1,0x20,0x00,(byte)0xC0,0x01,0x00,(byte)0x80,0x40,
+ 0x7F,0x00,(byte)0xFF,0x2F,0x00
+ };
+
+ private static final String[] TONE_FORBIDDEN_CONTROLS =
+ { "javax.microedition.media.control.MetaDataControl" };
+
+ // For checking whether a control is allowed for tone player
+ static final String CONTROL_DEFAULT_PACKAGE =
+ "javax.microedition.media.control.";
+
+ /**
+ * Create player without content.
+ */
+ public TonePlayer() throws MediaException
+ {
+ initializeMidi();
+ }
+
+
+ /**
+ * Create player from DataSource.
+ * @param aDataSource DataSource with audio/x-tone-seq content.
+ */
+ public TonePlayer(DataSource aDataSource) throws MediaException
+ {
+ initializeMidi();
+
+ // Read .JTS file data from data source
+ SourceStream input = (aDataSource.getStreams())[ 0 ];
+ byte[] sequenceTemp = new byte[ SEQUENCE_READ_GRANULARITY ];
+ ByteArrayOutputStream sequenceStream =
+ new ByteArrayOutputStream(SEQUENCE_READ_GRANULARITY);
+ byte[] sequence = null; // container for read tone sequence
+ int readCount = 0;
+
+ // Read data in SEQUENCE_READ_GRANULARITY sized blocks
+ try
+ {
+ while (readCount >= 0)
+ {
+ readCount = input.read(sequenceTemp, 0, SEQUENCE_READ_GRANULARITY);
+ if (readCount > 0)
+ {
+ sequenceStream.write(sequenceTemp, 0, readCount);
+ }
+ }
+ sequenceStream.flush();
+ sequence = sequenceStream.toByteArray();
+ sequenceStream.close();
+ }
+ catch (IOException ioe)
+ {
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA::TonePlayer: TonePlayer( DataSource ): " + ioe.toString());
+ throw new IllegalArgumentException();
+ }
+
+ setSequence(sequence);
+ }
+
+
+ /**
+ * Private method for initializing internal midi player
+ */
+ private void initializeMidi() throws MediaException
+ {
+ // Create concrete PlayerListenerImpl for listeners of
+ // this TonePlayer
+ iPlayerListenerImpl = new PlayerListenerImpl(this);
+ iMidiSequence = EMPTY_MIDI_SEQUENCE;
+
+ try
+ {
+ ByteArrayInputStream in = new ByteArrayInputStream(iMidiSequence);
+ iMidiPlayer = (InternalPlayer)Manager.createPlayer(in, "audio/midi");
+ }
+ catch (IOException ioe)
+ {
+ throw new IllegalStateException();
+ }
+
+ // we only have controls from MIDI player this far, so ToneControl
+ // must be added.
+
+ addControl(this, MidiToneConstants.TONE_CONTROL_FULL_NAME);
+
+ // register this TonePlayer as MIDI player listener
+ iMidiPlayer.addPlayerListener(this);
+ }
+
+
+ /**
+ * @see ToneControl
+ */
+ public void setSequence(byte[] aSequence)
+ {
+ // player must not be prefetched or started
+ int state = getState();
+ if (state == javax.microedition.media.Player.PREFETCHED)
+ {
+ throw new IllegalStateException("Player is PREFETCHED");
+ }
+ if (state == javax.microedition.media.Player.STARTED)
+ {
+ throw new IllegalStateException("Player is STARTED");
+ }
+
+ try
+ {
+ // process tone sequence into midi sequence
+ ToneSequence tone = new ToneSequence(aSequence);
+ tone.process();
+ iMidiSequence = tone.getByteArray();
+ iDuration = tone.getDuration();
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaMMAPI,
+ "MMA: TonePlayer: setSequence: !! Exception: " + e);
+ throw new IllegalArgumentException("Illegal sequence");
+ }
+ }
+
+
+ /**
+ * Adds control to the player.
+ * @param aControl Player's control
+ * @param aControlName Identifies the control. Name must contain
+ * full package information
+ */
+ public void addControl(javax.microedition.media.Control aControl,
+ String aControlName) throws MediaException
+ {
+ iMidiPlayer.addControl(aControl, aControlName);
+ }
+
+
+ /**
+ * interface Controllable
+ * Return controls
+ * @return list of controls
+ * @see Controllable
+ */
+ public javax.microedition.media.Control[] getControls()
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ // Get all controls but discard forbidden ones
+ javax.microedition.media.Control[] allControls =
+ iMidiPlayer.getControls();
+ javax.microedition.media.Control[] controls = null;
+
+ Vector controlVector = new Vector(allControls.length);
+
+ for (int i = 0; i < allControls.length; i++)
+ {
+ // Add only allowed controls to control vector
+ if (isAllowedControl(allControls[ i ].getClass()))
+ {
+ controlVector.addElement(allControls[ i ]);
+ }
+
+ controls =
+ new javax.microedition.media.Control[ controlVector.size()];
+
+ controlVector.copyInto(controls);
+ }
+ return controls;
+ }
+
+
+ /**
+ * interface Controllable
+ * get control by content type
+ * @param aControlType content type of wanted control
+ * @return control
+ * @see Controllable
+ * @see Control
+ */
+ public javax.microedition.media.Control getControl(String aControlType)
+ {
+ closeCheck();
+ unrealizedCheck();
+
+ if (aControlType == null)
+ {
+ throw new IllegalArgumentException("argument was null");
+ }
+
+ // If not fully qualified name, then supply default package
+ String controlType = null;
+ if (aControlType.indexOf(".") == -1)
+ {
+ controlType = CONTROL_DEFAULT_PACKAGE + aControlType;
+ }
+ else
+ {
+ controlType = aControlType;
+ }
+
+ Class controlClass = null;
+ try
+ {
+ controlClass = Class.forName(controlType);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ return null;
+ }
+
+ if (isAllowedControl(controlClass))
+ {
+ return iMidiPlayer.getControl(controlType);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void addPlayerListener(PlayerListener aPlayerListener)
+ {
+ closeCheck();
+ iPlayerListenerImpl.addPlayerListener(aPlayerListener);
+ }
+
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public void removePlayerListener(PlayerListener aPlayerListener)
+ {
+ closeCheck();
+ iPlayerListenerImpl.removePlayerListener(aPlayerListener);
+ }
+
+
+ /**
+ * From Player
+ * @see Player
+ */
+ public int getState()
+ {
+ return iMidiPlayer.getState();
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doRealize() throws MediaException
+ {
+ iMidiPlayer.realize();
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doPrefetch() throws MediaException
+ {
+
+ // we get javax.microedition control which is cast to com.nokia control
+ iMIDIControl = (MIDIControl)
+ iMidiPlayer.getControl(MidiToneConstants.MIDI_CONTROL_FULL_NAME);
+
+ // reinitialize midi engine with the sequence currently
+ // in iMidiSequence
+
+ iMIDIControl.reInitializeMidi(
+ iMidiSequence, 0, iMidiSequence.length);
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doDeallocate()
+ {
+ iMidiPlayer.deallocate();
+ }
+
+
+ /**
+ * From Player.
+ * @see Player
+ */
+ public void start() throws MediaException
+ {
+ prefetch();
+ iMidiPlayer.start();
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doStop() throws MediaException
+ {
+ iMidiPlayer.stop();
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public void doClose()
+ {
+ iDuration = 0;
+ iMidiPlayer.close();
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public void setLoopCount(int aCount)
+ {
+ iMidiPlayer.setLoopCount(aCount);
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public long getDuration()
+ {
+ closeCheck();
+
+ int state = iMidiPlayer.getState();
+
+ // Return TIME_UNKNOWN if player is realized and a midi
+ // sequence has been explicitely set.
+ if (state == Player.REALIZED &&
+ !(iMidiSequence.equals(EMPTY_MIDI_SEQUENCE)))
+ {
+ iDuration = Player.TIME_UNKNOWN;
+ }
+ else if (state == Player.PREFETCHED ||
+ state == Player.STARTED)
+ {
+ iDuration = iMidiPlayer.getDuration();
+ }
+ return iDuration;
+ }
+
+
+ /**
+ * From PlayerBase
+ * @see PlayerBase
+ */
+ public long setMediaTime(long aNow) throws MediaException
+ {
+ return iMidiPlayer.setMediaTime(aNow);
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public long getMediaTime()
+ {
+ closeCheck();
+ return iMidiPlayer.getMediaTime();
+ }
+
+
+ /**
+ * interface Player
+ * @see Player
+ */
+ public String getContentType()
+ {
+ closeCheck();
+ unrealizedCheck();
+ return TONE_CONTENT_TYPE;
+ }
+
+ /**
+ * from PlayerListener
+ * @see PlayerListener
+ */
+ public void playerUpdate(Player player,
+ java.lang.String event,
+ java.lang.Object eventData)
+ {
+ iPlayerListenerImpl.postEvent(event, eventData);
+ }
+
+ /**
+ * Check whether a control is allowed for tone player.
+ * @param aControl instance of control to check
+ * @return boolean allowed or not
+ */
+ private boolean isAllowedControl(Class aControlClass)
+ {
+ for (int i = 0; i < TONE_FORBIDDEN_CONTROLS.length; i++)
+ {
+ Class forbidden = null;
+ try
+ {
+ forbidden = Class.forName(TONE_FORBIDDEN_CONTROLS[ i ]);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // This should never happen
+ throw new Error("Control class not found");
+ }
+
+ if (forbidden.isAssignableFrom(aControlClass))
+ {
+ // Not allowed
+ return false;
+ }
+ }
+ // else
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/ToneSequence.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class represents tone sequence for tone to midi conversion
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Stack;
+import com.nokia.mj.impl.utils.Logger;
+
+
+/**
+ * This class represents tone sequence for tone to midi conversion
+ */
+public class ToneSequence
+{
+ // MEMBER DATA
+
+ /* Hold original tone sequence bytes */
+ private byte[] iToneSequence;
+
+ /* Holds the new tone sequence converted to MIDI */
+ private MidiSequence iMidiSequence;
+
+ /* Event list used to hold tone event processors */
+ private EventList iEventList;
+
+ ToneSequence(byte[] aSequence)
+ {
+ iToneSequence = aSequence;
+ iMidiSequence = new MidiSequence(MidiToneConstants.MIDI_TONE_CHANNEL,
+ MidiToneConstants.MIDI_TONE_INSTRUMENT);
+ iEventList = new EventList(iToneSequence, iMidiSequence);
+ }
+
+ public void process()
+ {
+ // Reset static base class variables of events before processing.
+ iEventList.reset();
+
+ // Check input; tone sequence must be even length
+ // ie. multiple of event size
+ if ((iToneSequence.length % Event.EVENT_SIZE) != 0)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, tone sequence must be multiple of single tone event size (2)");
+ }
+
+ // Validate header bytes
+
+ // Next check that have correct VERSION and possibly
+ // VERSION and RESOLUTION.
+ int checkPos = 0;
+
+ // First two bytes must belong to VERSION
+ if (iToneSequence[ checkPos ] != ToneControl.VERSION ||
+ iToneSequence[ checkPos + 1 ] !=
+ MidiToneConstants.TONE_SEQUENCE_SUPPORTED_VERSION)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, first two bytes must belong to version");
+ }
+
+ // Next two may be TEMPO or RESOLUTION
+ checkPos += Event.EVENT_SIZE;
+
+ if (iToneSequence[ checkPos ] == ToneControl.TEMPO)
+ {
+ iMidiSequence.setTempo(iToneSequence[ checkPos + 1 ]);
+ checkPos += Event.EVENT_SIZE;
+ }
+
+ // Continue checking RESOLUTION
+ if (iToneSequence[ checkPos ] == ToneControl.RESOLUTION)
+ {
+ iMidiSequence.setResolution(iToneSequence[ checkPos + 1 ]);
+ checkPos += Event.EVENT_SIZE;
+ }
+
+ // Validate rest of the sequence
+
+ int count = 0; // Offset to new position in tone sequence. >= 0
+ while (checkPos < iToneSequence.length)
+ {
+ count = iEventList.validate(checkPos);
+ checkPos += count;
+ if (count == 0)
+ {
+ // if end of tone sequence is reached, zero is
+ // OK. Otherwise this indicates error
+ if (checkPos != iToneSequence.length)
+ {
+ throw new IllegalArgumentException(
+ "Validation failed, sequence corrupted");
+ }
+ break;
+ }
+ }
+
+ // Find start of sequence
+ int position = 0; // current position on tone sequence
+
+ for (int i = iToneSequence.length - Event.EVENT_SIZE;
+ i >= 0;
+ i -= Event.EVENT_SIZE)
+ {
+ // There cannot be any lower value command bytes in tone sequence
+ // than REPEAT
+ if (iToneSequence[ i ] < ToneControl.REPEAT)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, lower value command than ToneControl.REPEAT found");
+ }
+
+ if (iToneSequence[ i ] < ToneControl.SILENCE &&
+ iToneSequence[ i ] != ToneControl.PLAY_BLOCK &&
+ iToneSequence[ i ] != ToneControl.SET_VOLUME &&
+ iToneSequence[ i ] != ToneControl.REPEAT)
+ {
+ position = i + Event.EVENT_SIZE;
+ // stop the for loop
+ break;
+ }
+ }
+
+ // No start position found
+ if (position < Event.EVENT_SIZE)
+ {
+ throw new IllegalArgumentException(
+ "Illegal sequence, no start position found");
+ }
+
+ count = 0; // offset to new position in tone sequence. +/-
+ try
+ {
+ while (position > 0 && position < iToneSequence.length)
+ {
+ count = iEventList.advance(position);
+ position += count;
+ if (count == 0)
+ {
+ // if end of tone sequence is reached, zero is
+ // OK. Otherwise this indicates error
+ if (position != iToneSequence.length)
+ {
+ throw new IllegalArgumentException(
+ "Validation failed, sequence corrupted");
+ }
+ break;
+ }
+ }
+ }
+ catch (MidiSequenceException mse)
+ {
+ // This exception indicates that we have reached the maximum
+ // midi sequence length and thus must stop processing. Currently
+ // processed midi sequence is however available by getStream.
+ // So no action is needed here.
+ Logger.WLOG(Logger.EJavaMMAPI,
+ "MMA: ToneSequence: MIDI maximum lenght reached.");
+ }
+ }
+
+ public ByteArrayInputStream getStream() throws IOException
+ {
+ return iMidiSequence.getStream();
+ }
+
+ public byte[] getByteArray() throws IOException
+ {
+ return iMidiSequence.getByteArray();
+ }
+
+ /**
+ * Get duration of tone sequence
+ */
+ public long getDuration()
+ {
+ return iMidiSequence.getCumulativeDuration();
+ }
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/tone/VolumeEvent.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Event processor class for tone sequence VOLUME events
+*
+*/
+
+
+package com.nokia.microedition.media.tone;
+
+import javax.microedition.media.control.ToneControl;
+
+/**
+ * Event processor class for tone sequence VOLUME events
+ */
+public class VolumeEvent extends Event
+{
+ /**
+ * ToneEvent constructor
+ * @param aSequence tone sequence byte array (input)
+ * @param aMidiSequence midi sequence object where to output midi events.
+ */
+ VolumeEvent(byte[] aSequence, MidiSequence aMidiSequence)
+ {
+ super(aSequence, aMidiSequence);
+ }
+
+ /**
+ * Inherited from Event
+ */
+ public int advance(int aPosition) throws MidiSequenceException
+ {
+ int retVal = doValidate(aPosition);
+ {
+ if (retVal == 0)
+ {
+ return 0;
+ }
+ }
+ // it is already checked that there is at least two bytes left
+ byte type = iSequence[ aPosition ];
+ byte data = iSequence[ aPosition + 1 ];
+
+ // calculate equivalent midi TONE_VOLUME
+ float vol = (float)MidiToneConstants.MIDI_MAX_VOLUME /
+ (float)MidiToneConstants.TONE_MAX_VOLUME * (float)data;
+
+ byte volume = (byte) vol;
+ if (volume < MidiToneConstants.MIDI_MIN_VOLUME)
+ {
+ volume = MidiToneConstants.MIDI_MIN_VOLUME;
+ }
+
+ if (volume > MidiToneConstants.MIDI_MAX_VOLUME)
+ {
+ volume = MidiToneConstants.MIDI_MAX_VOLUME;
+ }
+ // write TONE_VOLUME change on delta time 0
+ iMidiSequence.writeMidiEvent(
+ 0,
+ MidiToneConstants.MIDI_CONTROL_CHANGE,
+ MidiToneConstants.MIDI_CONTROL_MAIN_VOLUME,
+ volume);
+
+ // N.B.! Above MIDI_CONTROL_CHANGE can be written without channel
+ // value because MidiSequence will attach correct channel value to them anyway.
+ return EVENT_SIZE;
+ }
+
+ /**
+ * Child class defined functionality for validate
+ * @param aPosition position in tone sequence array where to validate
+ * @return new position offset related to aPosition in tone sequence
+ * array. Must be positive.
+ */
+ protected int doValidate(int aPosition)
+ throws IllegalArgumentException
+ {
+ byte type = iSequence[ aPosition ];
+ byte data = iSequence[ aPosition + 1 ];
+ int retVal = 0;
+ if (type == ToneControl.SET_VOLUME)
+ {
+ if (data < MidiToneConstants.TONE_MIN_VOLUME ||
+ data > MidiToneConstants.TONE_MAX_VOLUME)
+ {
+ throw new IllegalArgumentException(
+ "Volume is out of range, valid range is 0 <= volume <= 100");
+ }
+ retVal = EVENT_SIZE;
+ }
+ return retVal;
+ }
+
+ /**
+ * Child class defined functionality for checkEventAtNextPosition
+ * @param aPosition position in tone sequence array where to check
+ */
+ protected void checkEventAtNextPosition(int aPosition)
+ throws IllegalArgumentException
+ {
+ // After this event there can be:
+ // Tone, BlockEnd, PlayBlock, Volume, Repeat or
+ // end of sequence
+
+ int type = 0;
+ try
+ {
+ type = iSequence[ aPosition ];
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ return; // end of sequence is ok for this event
+ }
+
+ if (type >= ToneControl.SILENCE ||
+ type == ToneControl.BLOCK_END ||
+ type == ToneControl.PLAY_BLOCK ||
+ type == ToneControl.SET_VOLUME ||
+ type == ToneControl.REPEAT)
+ {
+ return;
+ }
+ throw new IllegalArgumentException(
+ "Illegal event found; sequence is corrupted");
+ }
+
+} // end of class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/mj/impl/media/PlayerPermission.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+ *
+*/
+
+
+package com.nokia.mj.impl.media;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import com.nokia.mj.impl.security.common.PermissionBase;
+import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
+
+public class PlayerPermission extends PermissionBase
+{
+ String iAction;
+
+ public PlayerPermission(String aUri, String aAction)
+ {
+ super(aUri);
+ iAction = aAction ;
+ }
+
+ /**
+ * Returns the question (as localized text) associated with the security
+ * prompt
+ *
+ * @return the localized text associated with the security prompt
+ */
+ public String getSecurityPromptQuestion(int aInteractionMode)
+ {
+ return (SecurityPromptMessage.getInstance()).getText(
+ SecurityPromptMessage.QUESTION_ID_AUDIO_VIDEO_RECORDING,
+ null);
+ }
+
+
+ public String toString()
+ {
+ if (iAction.compareTo("record") == 0)
+ {
+ return "javax.microedition.media.control.RecordControl";
+ }
+ else if (iAction.compareTo("snapshot") == 0)
+ {
+ return "javax.microedition.media.control.VideoControl.getSnapshot";
+ }
+ return "";
+ }
+
+ public boolean implies(Permission p)
+ {
+ if (p instanceof PlayerPermission)
+ {
+ PlayerPermission per = (PlayerPermission)p;
+ return matchActions(iAction, per.iAction);
+ }
+ return false;
+ }
+
+ public boolean equals(Object obj)
+ {
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ public String getActions()
+ {
+ return iAction;
+ }
+
+ public PermissionCollection newPermissionCollection()
+ {
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/mj/impl/media/RTSPPermission.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+ *
+*/
+
+
+package com.nokia.mj.impl.media;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import com.nokia.mj.impl.security.common.PermissionBase;
+import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
+
+public class RTSPPermission extends PermissionBase
+{
+ public RTSPPermission(String aUri)
+ {
+ super(aUri);
+ }
+
+ /**
+ * Returns the question (as localized text) associated with the security
+ * prompt
+ *
+ * @return the localized text associated with the security prompt
+ */
+ public String getSecurityPromptQuestion(int aInteractionMode)
+ {
+ return (SecurityPromptMessage.getInstance()).getText(
+ SecurityPromptMessage.QUESTION_ID_NETWORK_USAGE,
+ null);
+ }
+
+
+ public String toString()
+ {
+ return "javax.microedition.io.Connector.rtsp";
+ }
+
+ public boolean implies(Permission p)
+ {
+ if (p instanceof RTSPPermission)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean equals(Object obj)
+ {
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ public String getActions()
+ {
+ return "";
+ }
+
+ public PermissionCollection newPermissionCollection()
+ {
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/mj/impl/properties/mobilemedia/DynamicPropertyHandler.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.properties.mobilemedia;
+
+import com.nokia.mj.impl.rt.support.SystemPropertyProvider;
+import javax.microedition.media.Manager;
+
+/**
+ * A class for handling dynamic system properties of MobileMedia API.
+ */
+public class DynamicPropertyHandler implements SystemPropertyProvider
+{
+
+ /*
+ * Constants for identifying the asked property.
+ */
+ private static String AUDIO_ENCODINGS = "audio.encodings";
+ private static String SUPPORTS_VIDEO_CAPTURE = "supports.video.capture";
+ private static String VIDEO_ENCODINGS = "video.encodings";
+
+ // start of the audio content types
+ private static final String AUDIO = "audio";
+
+ // special audio encoding strings which are defined in the JSR
+ private static final String AUDIO_ENCODINGS_JSR =
+ " encoding=pcm encoding=ulaw encoding=gsm";
+
+ // start of the video content types
+ private static final String VIDEO = "video";
+
+
+ /* (non-Javadoc)
+ * @see com.nokia.mj.impl.rt.DynamicProperty#getProperty(com.nokia.mj.impl.rt.DynamicPropertyInfo)
+ */
+ public String getProperty(String propertyName)
+ {
+ String propertyValue = null;
+
+ if (propertyName.equals(AUDIO_ENCODINGS))
+ {
+ propertyValue = getSupportedCaptureEncodings(AUDIO) +
+ AUDIO_ENCODINGS_JSR;
+ }
+ else if (propertyName.equals(SUPPORTS_VIDEO_CAPTURE))
+ {
+ propertyValue = getSupportedCaptureEncodings(VIDEO);
+ // video capture is supported only if there is supported encodings
+ propertyValue = String.valueOf(propertyValue != null);
+ }
+ else if (propertyName.equals(VIDEO_ENCODINGS))
+ {
+ propertyValue = getSupportedCaptureEncodings(VIDEO);
+ }
+ return propertyValue;
+ }
+
+ public boolean isStatic(String key)
+ {
+ // All property values of MobileMedia API do not change during the
+ // lifetime of the application.
+ return true;
+ }
+
+ // capture protocol
+ private static final String CAPTURE = "capture";
+
+ // encoding for media strings
+ private static final String ENCODING = "encoding=";
+
+ /**
+ * Returns supported capture encodings.
+ * @param aPrefix Capture format type.
+ * @return the supported capture encodings.
+ */
+ private String getSupportedCaptureEncodings(String aPrefix)
+ {
+ // get supported content types from all capture:// protocols
+ String[] cTypes = Manager.getSupportedContentTypes(CAPTURE);
+
+ StringBuffer sBuffer = new StringBuffer();
+
+ // go through all types
+ for (int i = 0; i < cTypes.length; i++)
+ {
+ if (cTypes[ i ].startsWith(aPrefix))
+ {
+ // if video type appent to buffer encoding= + content type
+ sBuffer.append(ENCODING + cTypes[ i ] + " ");
+ }
+ }
+ String encodings = null;
+
+ // if no types was found null must be returned
+ if (sBuffer.length() > 0)
+ {
+ // substring is taken to remove last empty space added in previous
+ // for loop
+ encodings = sBuffer.toString().substring(0,
+ sBuffer.length() - 1);
+ }
+ return encodings;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/Control.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+public interface Control
+{
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/Controllable.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+public interface Controllable
+{
+
+ public Control[] getControls();
+
+ public Control getControl(String aControlType);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/Manager.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*/
+
+
+package javax.microedition.media;
+
+import java.io.IOException;
+import com.nokia.microedition.media.ManagerImpl;
+import javax.microedition.media.protocol.DataSource;
+import java.io.InputStream;
+
+public final class Manager
+{
+ private static ManagerImpl sInstance;
+
+ static
+ {
+ sInstance = ManagerImpl.getInstance();
+ }
+
+ final public static String TONE_DEVICE_LOCATOR = "device://tone";
+
+ final public static String MIDI_DEVICE_LOCATOR = "device://midi";
+
+
+ private Manager()
+ {
+ }
+
+ public static String[] getSupportedContentTypes(String aProtocol)
+ {
+ return sInstance.getAllSupportedContentTypes(aProtocol);
+ }
+
+ public static String[] getSupportedProtocols(String aContentType)
+ {
+ return sInstance.getAllSupportedProtocols(aContentType);
+ }
+
+ public static Player createPlayer(String aLocator)
+ throws IOException, MediaException
+ {
+ return sInstance.createPlayer(aLocator);
+ }
+
+ public static Player createPlayer(DataSource aSource)
+ throws IOException, MediaException
+ {
+ return sInstance.createInternalPlayer(aSource);
+ }
+
+ public static Player createPlayer(InputStream aStream, String aType)
+ throws IOException, MediaException
+ {
+ return sInstance.createPlayer(aStream, aType);
+ }
+
+ static public void playTone(int aNote, int aDuration, int aVolume)
+ throws MediaException
+ {
+ sInstance.playTone(aNote, aDuration, aVolume);
+ }
+
+ public static TimeBase getSystemTimeBase()
+ {
+ return sInstance.getSystemTimeBase();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/MediaException.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+public class MediaException extends Exception
+{
+
+ public MediaException()
+ {
+ super();
+ }
+
+ public MediaException(String aReason)
+ {
+ super(aReason);
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/Player.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+public interface Player extends Controllable
+{
+
+ public static final int UNREALIZED=100;
+ public static final int REALIZED=200;
+ public static final int PREFETCHED=300;
+ public static final int STARTED=400;
+ public static final int CLOSED=0;
+ public static final long TIME_UNKNOWN=-1;
+
+ public void realize() throws MediaException;
+
+ public void prefetch() throws MediaException;
+
+ public void start() throws MediaException;
+
+ public void stop() throws MediaException;
+
+ public void deallocate();
+
+ public void close();
+
+ public long setMediaTime(long aTime) throws MediaException;
+
+ public long getMediaTime();
+
+ public int getState();
+
+ public long getDuration();
+
+ public String getContentType();
+
+ public void setLoopCount(int aCount);
+
+ public void addPlayerListener(PlayerListener aPlayerListener);
+
+ public void removePlayerListener(PlayerListener aPlayerListener);
+
+ /**
+ * The following methods do not belong to the MIDP-NG multimedia subset
+ */
+
+ public void setTimeBase(TimeBase aTimeBase) throws MediaException;
+
+ public TimeBase getTimeBase();
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/PlayerListener.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+public interface PlayerListener
+{
+
+ public static final String STARTED="started";
+ public static final String STOPPED="stopped";
+ public static final String END_OF_MEDIA="endOfMedia";
+ public static final String DURATION_UPDATED="durationUpdated";
+ public static final String DEVICE_UNAVAILABLE="deviceUnavailable";
+ public static final String DEVICE_AVAILABLE="deviceAvailable";
+ public static final String VOLUME_CHANGED="volumeChanged";
+ public static final String ERROR="error";
+ public static final String CLOSED="closed";
+
+
+ /**
+ * The following constants do not belong to the MIDP-NG multimedia subset
+ */
+
+ public static final String STOPPED_AT_TIME="stoppedAtTime";
+ public static final String SIZE_CHANGED="sizeChanged";
+ public static final String RECORD_STARTED="recordStarted";
+ public static final String RECORD_STOPPED="recordStopped";
+ public static final String RECORD_ERROR="recordError";
+ public static final String BUFFERING_STARTED="bufferingStarted";
+ public static final String BUFFERING_STOPPED="bufferingStopped";
+
+ /**
+ * This method belongs to the MIDP-NG multimedia subset
+ */
+
+ public void playerUpdate(Player aPlayer, String aEvent, Object aEventData);
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/TimeBase.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package javax.microedition.media;
+
+/**
+ * This class does not belong to the MIDP-NG multimedia subset
+ */
+
+public interface TimeBase
+{
+ public long getTime();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/FramePositioningControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface FramePositioningControl
+ extends javax.microedition.media.Control
+{
+ int seek(int aFrameNumber);
+
+ int skip(int aFramesToSkip);
+
+ long mapFrameToTime(int aFrameNumber);
+
+ int mapTimeToFrame(long aMediaTime);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/GUIControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface GUIControl extends javax.microedition.media.Control
+{
+ int USE_GUI_PRIMITIVE = 0;
+
+ Object initDisplayMode(int aMode, Object aArg);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/MIDIControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+import javax.microedition.media.MediaException;
+
+public interface MIDIControl extends javax.microedition.media.Control
+{
+ int NOTE_ON = 0x90; // 144
+
+ int CONTROL_CHANGE = 0xB0; // 176
+
+ boolean isBankQuerySupported();
+
+ int[] getProgram(int aChannel)
+ throws MediaException;
+
+ int getChannelVolume(int aChannel);
+
+ void setProgram(int aChannel, int aBank, int aProgram);
+
+ void setChannelVolume(int aChannel, int aVolume);
+
+ int[] getBankList(boolean aCustom)
+ throws MediaException;
+
+ int[] getProgramList(int aBank)
+ throws MediaException;
+
+ String getProgramName(int aBank, int aProg)
+ throws MediaException;
+
+ String getKeyName(int aBank, int aProg, int aKey)
+ throws MediaException;
+
+ void shortMidiEvent(int aType, int aData1, int aData2);
+
+ int longMidiEvent(byte[] aData, int aOffset, int aLength);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/MetaDataControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+package javax.microedition.media.control;
+
+public interface MetaDataControl extends javax.microedition.media.Control
+{
+ String AUTHOR_KEY = "author";
+
+ String COPYRIGHT_KEY = "copyright";
+
+ String DATE_KEY = "date";
+
+ String TITLE_KEY = "title";
+
+ String[] getKeys();
+
+ String getKeyValue(String aKey);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/PitchControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface PitchControl extends javax.microedition.media.Control
+{
+ int setPitch(int aMillisemitones);
+
+ int getPitch();
+
+ int getMaxPitch();
+
+ int getMinPitch();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/RateControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface RateControl extends javax.microedition.media.Control
+{
+ int setRate(int aMillirate);
+
+ int getRate();
+
+ int getMaxRate();
+
+ int getMinRate();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/RecordControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+package javax.microedition.media.control;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.microedition.media.MediaException;
+
+public interface RecordControl extends javax.microedition.media.Control
+{
+ void setRecordStream(OutputStream aStream);
+
+ void setRecordLocation(String aLocator)
+ throws IOException, MediaException;
+
+ String getContentType();
+
+ void startRecord();
+
+ void stopRecord();
+
+ void commit() throws IOException;
+
+ int setRecordSizeLimit(int aSize) throws MediaException;
+
+ void reset() throws IOException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/StopTimeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface StopTimeControl extends javax.microedition.media.Control
+{
+ long RESET = Long.MAX_VALUE;
+
+ void setStopTime(long aStopTime);
+
+ long getStopTime();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/TempoControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface TempoControl extends RateControl
+{
+ int setTempo(int aMillitempo);
+
+ int getTempo();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/ToneControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface ToneControl extends javax.microedition.media.Control
+{
+ byte VERSION = -2;
+
+ byte TEMPO = -3;
+
+ byte RESOLUTION = -4;
+
+ byte BLOCK_START = -5;
+
+ byte BLOCK_END = -6;
+
+ byte PLAY_BLOCK = -7;
+
+ byte SET_VOLUME = -8;
+
+ byte REPEAT = -9;
+
+ byte C4 = 60;
+
+ byte SILENCE = -1;
+
+ void setSequence(byte[] aSequence);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/VideoControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+import javax.microedition.media.MediaException;
+
+public interface VideoControl extends GUIControl
+{
+ int USE_DIRECT_VIDEO = 1;
+
+ Object initDisplayMode(int aMode, Object aArg);
+
+ void setDisplayLocation(int aX, int aY);
+
+ int getDisplayX();
+
+ int getDisplayY();
+
+ void setVisible(boolean aVisible);
+
+ void setDisplaySize(int aWidth, int aHeight)
+ throws MediaException;
+
+ void setDisplayFullScreen(boolean aFullScreenMode) throws MediaException;
+
+ int getSourceWidth();
+
+ int getSourceHeight();
+
+ int getDisplayWidth();
+
+ int getDisplayHeight();
+
+ byte[] getSnapshot(String aImageType) throws MediaException;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/control/VolumeControl.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.control;
+
+public interface VolumeControl extends javax.microedition.media.Control
+{
+ void setMute(boolean aMute);
+
+ boolean isMuted();
+
+ int setLevel(int aLevel);
+
+ int getLevel();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/protocol/ContentDescriptor.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.protocol;
+
+public class ContentDescriptor
+{
+ private String iEncoding;
+
+ public ContentDescriptor(String aContentType)
+ {
+ iEncoding = aContentType;
+ }
+
+ public String getContentType()
+ {
+ return iEncoding;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/protocol/DataSource.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.protocol;
+
+import javax.microedition.media.Controllable;
+import java.io.IOException;
+
+abstract public class DataSource implements Controllable
+{
+ private String iSourceLocator;
+
+ public DataSource(String aLocator)
+ {
+ iSourceLocator = aLocator;
+ }
+
+ public abstract String getContentType();
+
+ public abstract void connect() throws IOException;
+
+ public abstract void disconnect();
+
+ public abstract void start() throws IOException;
+
+ public abstract void stop() throws IOException;
+
+ public abstract SourceStream[] getStreams();
+
+ public String getLocator()
+ {
+ return iSourceLocator;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/javasrc/javax/microedition/media/protocol/SourceStream.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Please refer JSR 135 for more details.
+*
+*/
+
+
+package javax.microedition.media.protocol;
+
+import java.io.IOException;
+import javax.microedition.media.Controllable;
+
+public interface SourceStream extends Controllable
+{
+ int NOT_SEEKABLE = 0;
+
+ int SEEKABLE_TO_START = 1;
+
+ int RANDOM_ACCESSIBLE = 2;
+
+ ContentDescriptor getContentDescriptor();
+
+ long getContentLength();
+
+ int read(byte[] aB, int aOff, int aLen)
+ throws IOException;
+
+ int getTransferSize();
+
+ long seek(long aWhere) throws IOException;
+
+ long tell();
+
+ int getSeekType();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.dsa/cmmadsawindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* in Direct Screen Access based displays for Helix engine.
+*
+*/
+
+
+// Include Files
+#include <logger.h>
+#include "cmmadsawindow.h"
+#include "cmmaplayer.h"
+
+CMMADSAWindow* CMMADSAWindow::NewL(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer,
+ RMMFVideoPlayControllerCustomCommands* aVPCustomCommand)
+{
+ CMMADSAWindow* self =
+ new(ELeave) CMMADSAWindow(aEventSource,
+ aPlayer,
+ aVPCustomCommand);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// Destructor (virtual by CBase)
+CMMADSAWindow::~CMMADSAWindow()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADSAWindow::~CMMADSAWindow");
+}
+
+CMMADSAWindow::CMMADSAWindow(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer,
+ RMMFVideoPlayControllerCustomCommands* aVPCustomCommand)
+ : iEventSource(aEventSource), iPlayer(aPlayer),
+ iVideoPlayControllerCustomCommands(aVPCustomCommand),
+ iDSAAborted(EFalse)
+{
+ // Nothing to do.
+}
+
+void CMMADSAWindow::ConstructL()
+{
+ iClientRect.SetRect(0, 0, 0, 0);
+
+ // Empty rect until video size is known
+ iDrawRect.SetRect(0, 0, 0, 0);
+}
+
+
+void CMMADSAWindow::SetDestinationBitmapL(CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+}
+
+void CMMADSAWindow::DrawFrameL(const CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+}
+
+// Local wrapper function to SetDrawRect method
+LOCAL_C void StaticSetDrawRect(
+ CMMADSAWindow* aWindow,
+ const TRect* aRect,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ RPointerArray< CMMAPlayer > players = aEventSource->Players();
+ // Invoke SetDrawRect only if the player has not been cleaned
+ if (players.Find(aPlayer) != KErrNotFound)
+ {
+ aWindow->SetDrawRect(*aRect);
+ }
+}
+
+void CMMADSAWindow::SetDrawRectThread(const TRect& aRect)
+{
+ // Call through event source changes thread to MMA event source thread
+ // and new rect can be set with RMMFVideoPlayControllerCustomCommands
+ // MMA player may be deleted after ExecuteV and before the static method
+ // is called so Event source is used to check if a cleanup has
+ // already been done for the player (for example due to MIDlet exit)
+ iEventSource->ExecuteV(&StaticSetDrawRect,
+ this,
+ &aRect,
+ iEventSource,
+ iPlayer);
+}
+
+void CMMADSAWindow::SetDrawRect(const TRect& aRect)
+{
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ // setting video draw rect and adjusting it to window
+ iDrawRect = aRect;
+ TRect drawRect = iDrawRect;
+ drawRect.Move(iClientRect.iTl);
+
+ if (!iVideoPlayControllerCustomCommands)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: no VideoPlayControllerCustomCommands set, aborting -");
+ return;
+ }
+
+ if (iVisible)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: Abort DSA");
+ iVideoPlayControllerCustomCommands->DirectScreenAccessEvent(EAbortDSA);
+ }
+
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: drawRect TL %d %d",
+ drawRect.iTl.iX, drawRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: drawRect BR %d %d",
+ drawRect.iBr.iX, drawRect.iBr.iY);
+
+ // Area where should be drawn is the intersection of drawRect and iClientRect.
+ TRect areaRect = iClientRect;
+ areaRect.Intersection(drawRect);
+
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: areaRect TL %d %d",
+ areaRect.iTl.iX, areaRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: areaRect BR %d %d",
+ areaRect.iBr.iX, areaRect.iBr.iY);
+
+ if (iVisible && !iDSAAborted)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: SetDisplayWindow( drawRect, areaRect )");
+ iVideoPlayControllerCustomCommands->SetDisplayWindow(
+ drawRect , areaRect);
+
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: Update region (areaRect)");
+ RRegion region(areaRect);
+ iVideoPlayControllerCustomCommands->UpdateDisplayRegion(region);
+ region.Close();
+
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: Resume DSA");
+ iVideoPlayControllerCustomCommands->DirectScreenAccessEvent(EResumeDSA);
+ }
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetDrawRect: -");
+}
+
+const TRect& CMMADSAWindow::DrawRect()
+{
+ return iDrawRect;
+}
+
+TSize CMMADSAWindow::WindowSize()
+{
+ return iClientRect.Size();
+}
+
+void CMMADSAWindow::SetPosition(const TPoint& aPosition)
+{
+ // changing to MMA thread
+ // MMA player may be deleted after ExecuteV and before the static method
+ // is called so Event source is used to check if a cleanup has
+ // already been done for the player (for example due to MIDlet exit)
+ iEventSource->ExecuteV(&CMMADSAWindow::StaticSetWindowPosition,
+ this,
+ aPosition,
+ iEventSource,
+ iPlayer);
+}
+
+void CMMADSAWindow::StaticSetWindowPosition(
+ CMMADSAWindow* aWindow,
+ TPoint aPosition,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ RPointerArray< CMMAPlayer > players = aEventSource->Players();
+ // Invoke SetDrawRect only if the player has not been cleaned
+ if (players.Find(aPlayer) != KErrNotFound)
+ {
+ aWindow->SetDrawRect(TRect(aPosition, aWindow->iDrawRect.Size()));
+ }
+}
+
+TBool CMMADSAWindow::IsVisible() const
+{
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::IsVisible %d ", iVisible);
+ return iVisible;
+}
+
+void CMMADSAWindow::SetVisible(TBool aVisible, TBool aUseEventServer)
+{
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetVisible avisible=%d useES=%d +", aVisible, aUseEventServer);
+ // Event server may not be used if we already in mma event server thread
+ if (aUseEventServer)
+ {
+ // MMA player may be deleted after ExecuteV and before the static method
+ // is called so Event source is used to check if a cleanup has
+ // already been done for the player (for example due to MIDlet exit)
+ iEventSource->ExecuteV(&CMMADSAWindow::SetWindowVisible,
+ this,
+ aVisible,
+ iEventSource,
+ iPlayer);
+ }
+ else
+ {
+ SetWindowVisible(this, aVisible, iEventSource, iPlayer);
+ }
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetVisible %d -", aVisible);
+}
+
+void CMMADSAWindow::SetWindowVisible(
+ CMMADSAWindow* aWindow,
+ TBool aVisible,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible aVisible %d", aVisible);
+ RPointerArray< CMMAPlayer > players = aEventSource->Players();
+ // Invoke SetDrawRect only if the player has not been cleaned
+ if (players.Find(aPlayer) != KErrNotFound)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible : Player found");
+ if (aVisible != aWindow->iVisible)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible: Changed visibility");
+ aWindow->iVisible = aVisible;
+ }
+ if (aVisible)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible: aVisible = 1");
+ const TRect drawRect = aWindow->DrawRect();
+
+ aWindow->SetDrawRect(drawRect);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible: aVisible = 0");
+ TRect emptyRect(0, 0, 0, 0);
+
+ RRegion region(emptyRect);
+ aWindow->iVideoPlayControllerCustomCommands->UpdateDisplayRegion(region);
+ region.Close();
+ LOG( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowVisible: Abort DSA");
+
+ aWindow->iVideoPlayControllerCustomCommands->
+ DirectScreenAccessEvent(EAbortDSA);
+ }
+
+ }
+}
+
+void CMMADSAWindow::SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType /*aThreadType*/)
+{
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowRect aRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMADSAWindow::SetWindowRect aRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ iClientRect = aRect;
+}
+
+const TRect& CMMADSAWindow::WindowRect()
+{
+ return iClientRect;
+}
+
+
+void CMMADSAWindow::AbortDSA()
+{
+ iDSAAborted = ETrue;
+
+ // Always runs in UI thread
+ iEventSource->ExecuteV(&StaticAbortDSA,
+ this,
+ iEventSource,
+ iPlayer);
+}
+
+
+void CMMADSAWindow::ResumeDSA()
+{
+ iDSAAborted = EFalse;
+
+ // Always runs in UI thread
+ iEventSource->ExecuteV(&StaticResumeDSA,
+ this,
+ iEventSource,
+ iPlayer);
+}
+
+
+void CMMADSAWindow::StaticAbortDSA(
+ CMMADSAWindow* aWindow,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ RPointerArray< CMMAPlayer > players = aEventSource->Players();
+ // Invoke SetDrawRect only if the player has not been cleaned
+ if (players.Find(aPlayer) != KErrNotFound &&
+ aWindow->iVisible && aWindow->iVideoPlayControllerCustomCommands)
+ {
+ TRect emptyRect(0, 0, 0, 0);
+
+ RRegion region(emptyRect);
+ aWindow->iVideoPlayControllerCustomCommands->UpdateDisplayRegion(region);
+ region.Close();
+ aWindow->iVideoPlayControllerCustomCommands->DirectScreenAccessEvent(EAbortDSA);
+ }
+}
+
+
+void CMMADSAWindow::StaticResumeDSA(
+ CMMADSAWindow* aWindow,
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ RPointerArray< CMMAPlayer > players = aEventSource->Players();
+ // Invoke SetDrawRect only if the player has not been cleaned
+ if (players.Find(aPlayer) != KErrNotFound &&
+ aWindow->iVisible && aWindow->iVideoPlayControllerCustomCommands)
+ {
+ TRect drawRect = aWindow->iDrawRect;
+ drawRect.Move(aWindow->iClientRect.iTl);
+
+ // Area where should be drawn is the intersection of drawRect and iClientRect.
+ TRect areaRect = aWindow->iClientRect;
+ areaRect.Intersection(drawRect);
+
+ aWindow->iVideoPlayControllerCustomCommands->SetDisplayWindow(
+ drawRect , areaRect);
+
+ RRegion region(areaRect);
+ aWindow->iVideoPlayControllerCustomCommands->UpdateDisplayRegion(region);
+ region.Close();
+
+ aWindow->iVideoPlayControllerCustomCommands->DirectScreenAccessEvent(EResumeDSA);
+ }
+}
+
+void CMMADSAWindow::ContainerDestroyed()
+{
+ SetVisible(EFalse, ETrue);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.dsa/cmmavideoplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing video.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmffile.h>
+#include <logger.h>
+
+#include "cmmavideoplayer.h"
+#include "mmmadisplay.h"
+#include "mmafunctionserver.h"
+#include "cmmadsawindow.h"
+
+// CONSTANTS
+_LIT(KVideoControlName, "VideoControl");
+
+CMMAVideoPlayer* CMMAVideoPlayer::NewLC(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAVideoPlayer* self =
+ new(ELeave) CMMAVideoPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAVideoPlayer::~CMMAVideoPlayer()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoPlayer::~CMMAVideoPlayer");
+ if (iDisplay)
+ {
+ TRAPD(err, iDisplay->SetWindowL(NULL));
+ if (err != KErrNone)
+ {
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ }
+ delete iDSAWindow;
+ delete iEmptySnapshotImage;
+ delete iActiveSchedulerWait;
+}
+
+CMMAVideoPlayer::CMMAVideoPlayer(
+ CMMAMMFResolver* aResolver):
+ CMMAAudioPlayer(aResolver),
+ iVideoControllerCustomCommands(iController),
+ iVideoPlayControllerCustomCommands(iController)
+{
+}
+
+void CMMAVideoPlayer::ConstructL()
+{
+ CMMAAudioPlayer::ConstructL();
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+}
+
+EXPORT_C void CMMAVideoPlayer::SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster)
+{
+ CMMAPlayer::SetPlayerListenerObjectL(aListenerObject,
+ aJni,
+ aEventPoster);
+
+ // this method must be called only ones
+ __ASSERT_DEBUG(!iDSAWindow, User::Invariant());
+
+ // create window for videoplayer
+ // event poster is always MMAFunctionServer type.
+
+ iDSAWindow = CMMADSAWindow::NewL(
+ static_cast< MMAFunctionServer* >(iEventPoster),
+ this,
+ &iVideoPlayControllerCustomCommands);
+}
+
+EXPORT_C void CMMAVideoPlayer::SetDisplayL(MMMADisplay* aDisplay)
+{
+ // now it is ready to draw
+ iDisplay = aDisplay;
+ iDisplay->SetWindowL(iDSAWindow);
+
+ // if state < prefeteched then we dont know actual source size yet
+ // and it will be set after prefetch
+ if (iState >= EPrefetched)
+ {
+ SourceSizeChanged();
+ }
+}
+void CMMAVideoPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::RealizeL");
+ // DataSource must have at least 1 stream or
+ // we must have file to play
+ if ((iSourceStreams.Count() == 0) && !iFileName)
+ {
+ User::Leave(KErrNotEnoughStreams);
+ }
+
+ // If file locator is used, then file is prefetched
+ // in realized state so that FramePositioningControl
+ // can acquire frame count in REALIZED state
+ if (iFileName)
+ {
+ PrefetchFileL();
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ // If the player has not changed state during wait,
+ // Then there is an error condition.
+ if (iState != ERealized)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ }
+ else
+ {
+ CMMAPlayer::RealizeL();
+ }
+}
+
+void CMMAVideoPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrefetchL");
+ if (iFileName)
+ {
+ // File has already been prefetched when realizing
+
+ // If initDisplayMode was called before prefetch,
+ // then the display must notified about source size.
+ if (iDisplay)
+ {
+ SourceSizeChanged();
+ }
+
+ ChangeState(EPrefetched);
+ PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ // Using TDes -- load the whole video
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+ // CMMASourceStream will notify with ReadCompleted
+}
+
+EXPORT_C void CMMAVideoPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoPlayer::ReadCompletedL: status = %d", aStatus);
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ TRAPD(err, PrefetchDataL(aData));
+ if (err != KErrNone)
+ {
+ PostActionCompleted(err);
+ }
+ // action completed event will be delivered from handleEvent
+ }
+}
+
+void CMMAVideoPlayer::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoPlayer::HandleEvent %d", aEvent.iEventType.iUid);
+
+ // KNotCompleteVideoError can be notified when video is not complete
+ // ( missing sound ) but still can be played. Because
+ // CMMAAudioPlayer::HandleEvent fails with all negative error codes,
+ // do not call it with KNotCompleteVideoError error when preparing.
+ if ((aEvent.iErrorCode != KNotCompleteVideoError) ||
+ (aEvent.iEventType != KMMFEventCategoryVideoPrepareComplete))
+ {
+ CMMAAudioPlayer::HandleEvent(aEvent);
+ }
+
+ // video opened, preparing
+ if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
+ {
+ if (aEvent.iErrorCode == KErrNone)
+ {
+ TInt prepareError(iVideoPlayControllerCustomCommands.Prepare());
+ if (prepareError != KErrNone)
+ {
+ // opening failed, notifying java
+ PostActionCompleted(prepareError);
+ }
+ }
+ else
+ {
+ // opening failed, notifying java
+ PostActionCompleted(aEvent.iErrorCode);
+ }
+ }
+ // final state of prefetch ( prepare completed )
+ else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
+ {
+ // This callback must be handled differently depending on whether
+ // player is created for a file locator or for a stream. When file
+ // locator is used, this callback is made in realized state. For
+ // stream it is made in prefetched state.
+ PrepareDisplay();
+ if (iFileName)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Using filename, change state to REALIZED");
+
+ // If there is an error condition, then the player state is not
+ // changed, which indicates the error condition to StartL when
+ // the ActiveSchedulerWait returns. KNotCompleteVideoError is not
+ // considered as an error condition, instead it indicates that some
+ // elements of the media cannot be played (e.g. video OR audio)
+ if (aEvent.iErrorCode == KErrNone ||
+ aEvent.iErrorCode == KNotCompleteVideoError)
+ {
+ ChangeState(ERealized);
+ }
+ __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant());
+ iActiveSchedulerWait->AsyncStop();
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Not using filename, change state to PREFETCHED");
+ CompletePrefetch(aEvent.iErrorCode);
+ }
+ }
+ else // in case of any other event
+ {
+ if (aEvent.iErrorCode != KErrNone)
+ {
+ PostActionCompleted(aEvent.iErrorCode); //some other error
+ }
+ }
+}
+
+void CMMAVideoPlayer::CompletePrefetch(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::CompletePrefetch + error = %d",aError);
+ // Post KNotCompleteVideoError as KErrNone to the Java side, because
+ // video can be played.
+ if (aError == KNotCompleteVideoError)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch KNotCompleteVideoError ");
+ // release java
+ PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch CompleteVideoError ");
+ // release java
+ PostActionCompleted(aError);
+ }
+
+ if (aError == KErrNone || aError == KNotCompleteVideoError)
+ {
+ ChangeState(EPrefetched);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch - ");
+}
+
+void CMMAVideoPlayer::PrepareDisplay()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrepareDisplay +");
+ // construction should have leaved if iDSAWindow does not exist
+ __ASSERT_DEBUG(iDSAWindow,
+ User::Panic(_L("CMMVideoPlayer::iDSAWindow is null"),
+ KErrArgument));
+
+ // Video must be initially not visible
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrepareDisplay: Initially aborting DSA");
+ iVideoPlayControllerCustomCommands.DirectScreenAccessEvent(EAbortDSA);
+
+ //First place where we are certain that source size can be fetched
+ TSize sourceSize;
+
+ TInt err = iVideoControllerCustomCommands.GetVideoFrameSize(sourceSize);
+
+ ELOG1( EJavaMMAPI, "MID::CMMAVideoPlayer::PrepareDisplay: GetVideoFrameSize err = %d", err);
+
+ // Still we did not get the size of video
+ if ((err != KErrNone) ||
+ (sourceSize.iWidth <= 0) ||
+ (sourceSize.iHeight <= 0))
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: No sourcesize found, using DSAWindow size");
+ // setting size to window size (client rect)
+ sourceSize = iDSAWindow->WindowSize();
+ }
+
+ // If 1x1 was got (the default size of form), it must be replaced
+ // with a valid size as controller will not accept 1x1.
+ if ((sourceSize.iWidth < KMMAVideoMinDimension) ||
+ (sourceSize.iHeight < KMMAVideoMinDimension))
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: Unacceptable source size, using failsafe");
+ // This is a special case and ought to be used only in
+ // the rare case that real size is not got from stream.
+ sourceSize = TSize(KMMAVideoMinDimension, KMMAVideoMinDimension);
+ }
+
+ iSourceSize = sourceSize;
+
+ // If init has been already done
+ if (iDisplay)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: display exists, changing source size");
+ SourceSizeChanged();
+ }
+
+ // Setting (in)visible if something has changed the DSA state
+ // (e.g. prepare). If initDisplayMode is not called, this will always
+ // set visibility to false.
+ iDSAWindow->SetVisible(iDSAWindow->IsVisible(), EFalse);
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrepareDisplay -");
+}
+
+EXPORT_C const TDesC& CMMAVideoPlayer::Type()
+{
+ return KMMAVideoPlayer;
+}
+
+EXPORT_C TSize CMMAVideoPlayer::SourceSize()
+{
+ return iSourceSize;
+}
+
+EXPORT_C MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& /*aSize*/,
+ const CMMAImageSettings& /*aSettings*/)
+{
+ if (iEmptySnapshotImage)
+ {
+ // Ealier snapshot was not got with SnapshotBitmap method.
+ User::Leave(KErrInUse);
+ }
+ // frame can't be got from video player, but TCK requires that it should
+ // be available. So returning empty image
+ iEmptySnapshotImage = new(ELeave) CFbsBitmap();
+ User::LeaveIfError(iEmptySnapshotImage->Create(TSize(1, 1),
+ EColor4K));
+
+
+ User::RequestComplete(aStatus, KErrNone);
+
+ // Return raw bitmap encoding and thus SnapshotEncoded() should not
+ // get called later on.
+ return EBitmap;
+}
+
+EXPORT_C CFbsBitmap* CMMAVideoPlayer::SnapshotBitmap()
+{
+ // snapshot is not supported, returning empty image
+ CFbsBitmap* image = iEmptySnapshotImage;
+
+ // ownership is transferred to caller
+ iEmptySnapshotImage = NULL;
+ return image;
+}
+
+EXPORT_C HBufC8* CMMAVideoPlayer::SnapshotEncoded()
+{
+ // This method should never be called.
+ // Asserted in debug build to be sure.
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+
+ return NULL;
+}
+
+EXPORT_C void CMMAVideoPlayer::NotifyWithStringEvent(
+ CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData)
+{
+ PostStringEvent(aEventType, aStringEventData);
+}
+
+EXPORT_C MMMASnapshot* CMMAVideoPlayer::SnapshoterL()
+{
+ return this;
+}
+
+void CMMAVideoPlayer::SourceSizeChanged()
+{
+ iDisplay->SourceSizeChanged(iSourceSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmaemcaudioplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+#include <AudioPreference.h>
+#include <logger.h>
+#include "cmmaemcaudioplayer.h"
+
+CMMAEMCAudioPlayer* CMMAEMCAudioPlayer::NewLC(
+ CMMAEMCResolver* aResolver)
+{
+ CMMAEMCAudioPlayer* self = new(ELeave) CMMAEMCAudioPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+EXPORT_C CMMAEMCAudioPlayer::~CMMAEMCAudioPlayer()
+{
+}
+
+EXPORT_C CMMAEMCAudioPlayer::CMMAEMCAudioPlayer(
+ CMMAEMCResolver* aResolver):
+ CMMAEMCPlayerBase(aResolver)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::CMMAEMCAudioPlayer");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL +");
+ CMMAEMCPlayerBase::ConstructL();
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL -");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::PrefetchDataL(const TDesC8& /*aData*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL +");
+
+ User::LeaveIfError(iMStreamControl->Prime());
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL -");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::PrefetchFileL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::Prefetching from file");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::PlayCompleteL(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL +");
+ TInt64 time;
+ GetDuration(&time);
+ iMediaTime = time;
+ iStartedEventTime = 0;
+
+ ChangeState(EPrefetched); // ready to play again
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, time);
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ // priming again for allowing e.g. media time setting
+ User::LeaveIfError(iMStreamControl->Prime());
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+
+ TInt64 position(0);
+ User::LeaveIfError(iMStreamControl->SetPosition(position));
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL -");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL +");
+ // DataSource must have at least 1 stream or
+ // we must have file to play
+ if ((iSourceStreams.Count() == 0) && !iFileName)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL : Not Enough Streams");
+ User::Leave(KErrNotEnoughStreams);
+ }
+ User::LeaveIfError(iMStreamControl->Open());
+
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ CMMAPlayer::RealizeL();
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL -");
+}
+
+EXPORT_C void CMMAEMCAudioPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL +");
+ __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant());
+
+ if (iFileName)
+ {
+ // prefetching the file
+ PrefetchFileL();
+ // we can go to prefetched state immediately
+ ChangeState(EPrefetched);
+ PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ // Using TDes -- load the whole sound
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+ // CMMASourceStream will notify with ReadCompleted
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL -");
+}
+
+EXPORT_C const TDesC& CMMAEMCAudioPlayer::Type()
+{
+ // Should be used in AMMS Implementation to differentiate between
+ // this new kind of player with others
+ return KMMAEMCAudioPlayer;
+}
+
+//
+// CMMASourceStreamReader finished read operation
+// This is called when ReadL is completed in Prefetch()
+//
+EXPORT_C void CMMAEMCAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL +");
+ LOG1( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL: status = %d", aStatus);
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ TRAPD(err, PrefetchDataL(aData));
+ if (err == KErrNone)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(err);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL -");
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmaemcaudiovolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#include <logger.h>
+#include "StreamControl.h"
+#include "EffectControl.h"
+#include "MMControlFactory.h"
+#include "cmmaemcaudiovolumecontrol.h"
+#include "cmmaemcaudioplayer.h"
+
+using multimedia ::KVolumeEffectControl;
+using multimedia ::MStreamControl;
+using multimedia ::MEffectControl;
+using multimedia ::CMultimediaFactory;
+
+EXPORT_C CMMAEMCAudioVolumeControl* CMMAEMCAudioVolumeControl::NewL(CMMAEMCAudioPlayer& aPlayer)
+{
+ CMMAEMCAudioVolumeControl* self = new(ELeave)CMMAEMCAudioVolumeControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+EXPORT_C CMMAEMCAudioVolumeControl::CMMAEMCAudioVolumeControl(CMMAEMCAudioPlayer& aPlayer)
+ : CMMAVolumeControl(&aPlayer), iPlayer(aPlayer)
+{
+}
+
+void CMMAEMCAudioVolumeControl::ConstructL()
+{
+ ConstructBaseL();
+ MStreamControl* streamControl = iPlayer.StreamControl();
+ CMultimediaFactory* mmFactory = iPlayer.MMFactory();
+
+ MEffectControl* temp(NULL);
+ User::LeaveIfError(mmFactory->CreateEffectControl(KVolumeEffectControl, temp));
+ iVolCntrl = static_cast<MVolumeControl*>(temp);
+ User::LeaveIfError(streamControl->AddEffect(*iVolCntrl));
+}
+
+CMMAEMCAudioVolumeControl::~CMMAEMCAudioVolumeControl()
+{
+ MStreamControl* streamControl = iPlayer.StreamControl();
+ CMultimediaFactory* mmFactory = iPlayer.MMFactory();
+
+ if ((NULL != streamControl) && (NULL != iVolCntrl))
+ {
+ streamControl->RemoveEffect(*iVolCntrl);
+ }
+
+ MEffectControl* temp = static_cast<MEffectControl*>(iVolCntrl);
+
+ if (NULL != mmFactory)
+ {
+ mmFactory->DeleteEffectControl(temp);
+ }
+}
+
+EXPORT_C void CMMAEMCAudioVolumeControl::DoSetLevelL(TInt aLevel)
+{
+ TInt maxVolume = 0;
+ User::LeaveIfError(iVolCntrl->GetMaxVolume(maxVolume));
+ // aLevel is the desired volume in range 0..100
+ TInt volLevel = aLevel * maxVolume / KMMAVolumeMaxLevel;
+ User::LeaveIfError(iVolCntrl->SetVolume(volLevel));
+ User::LeaveIfError(iVolCntrl->Apply());
+}
+
+EXPORT_C TInt CMMAEMCAudioVolumeControl::DoGetLevelL()
+{
+ TInt maxVolume = 0;
+ User::LeaveIfError(iVolCntrl->GetMaxVolume(maxVolume));
+ __ASSERT_DEBUG(maxVolume != 0, User::Invariant());
+ TInt volume = 0;
+ User::LeaveIfError(iVolCntrl->GetVolume(volume));
+ // result is in range 0..100
+ return (volume * KMMAVolumeMaxLevel / maxVolume);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmaemcplayerbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,358 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+//#include <mmf/server/mmfdes.h>
+#include <AudioPreference.h>
+#include <logger.h>
+#include "cmmaemcplayerbase.h"
+#include "cmmaemcresolver.h"
+
+using namespace multimedia;
+
+using multimedia::MSourceControlObserver;
+using multimedia::MStreamControlObserver;
+
+CMMAEMCPlayerBase::~CMMAEMCPlayerBase()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::~CMMAEMCPlayerBase +");
+
+ if (iMStreamControl)
+ {
+ iMStreamControl->RemoveObserver(*this);
+ if (iMStreamControl->GetState() > 0)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::~CMMAEMCPlayerBase: iMStreamControl's state = %d",iMStreamControl->GetState());
+ TInt err = iMStreamControl->Close();
+ ELOG1( EJavaMMAPI, "MMA::CMMAEMCPlayerBase::~CMMAEMCPlayerBase: Close() err = %d",err);
+ }
+ }
+
+ if (iFactory)
+ {
+ CleanupSource();
+
+ MSinkControl* objPtr1 = iMAudioSink;
+ iMStreamControl->RemoveSink(*objPtr1);
+
+ iFactory->DeleteSinkControl(objPtr1);
+ iMAudioSink = NULL;
+
+ //before deleting Stream Control all the controls need to be deleted
+ if (iControls.Count() > 0)
+ iControls.ResetAndDestroy();
+
+ iFactory->DeleteStreamControl(iMStreamControl);
+ delete iFactory;
+ }
+
+ delete iFileName;
+
+ delete iActiveSchedulerWait;
+
+ delete iMimeType;
+
+ delete iDescData;
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::~CMMAEMCPlayerBase -");
+}
+
+
+CMMAEMCPlayerBase::CMMAEMCPlayerBase(
+ CMMAEMCResolver* aResolver) :
+ iMediaTime(KTimeUnknown), iStartedEventTime(0)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase +");
+ // content type ownership is transferred
+ iDescData = NULL;
+ iContentType = aResolver->ContentTypeOwnership();
+ iMimeType = aResolver->MimeTypeOwnership(); // 8-bit version of iContentType
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::ContentType-- %S" ,iContentType->Des().PtrZ());
+
+ // file name ownership is transferred
+ iFileName = aResolver->FileNameOwnership();
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::FileName-- %S" ,iFileName->Des().PtrZ());
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase -");
+}
+
+void CMMAEMCPlayerBase::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::ConstructL +");
+ CMMAPlayer::ConstructL();
+ iSourceType = EDATABUFFERSOURCE; //Currently it only support Http
+
+ TInt status=CMultimediaFactory::CreateFactory(iFactory);
+ CreateStreamL();
+ AddDataSourceToStreamL();
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::ConstructL -");
+}
+
+void CMMAEMCPlayerBase::CreateStreamL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::CreateStreamL +");
+ if (iMStreamControl)
+ User::Leave(KErrAlreadyExists);
+ TInt err = iFactory->CreateStreamControl(KStreamControl,iMStreamControl);
+ User::LeaveIfError(err);
+ //If the state of iMStreamControl changes,iPrevStreamControlState will keep its previous state
+ iPrevStreamControlState = MStreamControl::CLOSED;
+ iMStreamControl->AddObserver(*this);
+
+ MSinkControl* tempSinkCtrl(NULL);
+ err = iFactory->CreateSinkControl(KMMFAudioOutputSinkControl,tempSinkCtrl);
+ User::LeaveIfError(err);
+ iMAudioSink = tempSinkCtrl;
+ iMStreamControl->AddSink(*iMAudioSink);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::CreateStreamL -");
+}
+
+void CMMAEMCPlayerBase::AddDataSourceToStreamL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::AddDataSourceToStreamL +");
+ if (iMStreamControl == NULL)
+ {
+ User::Leave(KErrNotReady);
+ }
+
+ TInt err(KErrNone);
+ MSourceControl* tempCtrl(NULL);
+
+ switch (iSourceType)
+ {
+ case EFILESOURCE:
+ {
+ err = iFactory->CreateSourceControl(KFileSourceControl, tempCtrl);
+ User::LeaveIfError(err);
+ iMFileSource = static_cast<MFileSource*>(tempCtrl);
+ iMimeType->Des().FillZ();
+ User::LeaveIfError(iMFileSource->Open(*iFileName, *iMimeType));
+ iMFileSource->AddObserver(*this);
+ break;
+ }
+ case EDATABUFFERSOURCE:
+ {
+ err = iFactory->CreateSourceControl(KDataBufferSourceControl, tempCtrl);
+ User::LeaveIfError(err);
+
+ iMDataBufferSource = static_cast<MDataBufferSource*>(tempCtrl);
+ MDataBuffer* headerData = NULL;
+ User::LeaveIfError(iMDataBufferSource->Open(*iMimeType, *headerData));
+ iMDataBufferSource->AddObserver(*this);
+ break;
+ }
+ case EDESCRIPTORSOURCE:
+ {
+ err = iFactory->CreateSourceControl(KDescriptorSourceControl, tempCtrl);
+ User::LeaveIfError(err);
+ iMDescriptorSource = static_cast<MDescriptorSource*>(tempCtrl);
+ TInt size = 0;
+ // iFile.Size(size); will be used when Descriptor support will be implemented
+
+ if (iDescData)
+ {
+ delete iDescData;
+ iDescData = NULL;
+ }
+ iDescData = HBufC8::NewL(size);
+ TPtr8 des = iDescData->Des();
+ //iFile.Read(des);
+ User::LeaveIfError(iMDescriptorSource->Open(*iMimeType,*iDescData));
+ iMDescriptorSource->AddObserver(*this);
+ break;
+ }
+ default:
+ break;
+ }
+
+ iMStreamControl->AddSource(*tempCtrl);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::AddDataSourceToStreamL -");
+}
+
+void CMMAEMCPlayerBase::CleanupSource()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::CleanupSource +");
+ if (iMDataBufferSource)
+ {
+ iMDataBufferSource->RemoveObserver(*this);
+ MSourceControl* objPtr = iMDataBufferSource;
+ iMStreamControl->RemoveSource(*objPtr); //added
+ objPtr->Close();
+ iFactory->DeleteSourceControl(objPtr);
+ iMDataBufferSource = NULL;
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::CleanupSource -");
+}
+
+EXPORT_C MStreamControl* CMMAEMCPlayerBase::StreamControl()
+{
+ return iMStreamControl;
+}
+
+EXPORT_C CMultimediaFactory* CMMAEMCPlayerBase::MMFactory()
+{
+ return iFactory;
+}
+
+TBool CMMAEMCPlayerBase::IsFilePlayer()
+{
+ return EFalse;
+}
+
+void CMMAEMCPlayerBase::StartL()
+{
+ // empty implementation
+ // should be overwritten in derived class
+}
+
+void CMMAEMCPlayerBase::StopL(TBool /*aPostEvent*/)
+{
+ // empty implementation
+ // should be overwritten in derived class
+}
+
+void CMMAEMCPlayerBase::DeallocateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::DeallocateL +");
+ if (iState == EPrefetched)
+ {
+ // Change state first to enable AMMS to delete Effect API classes
+ ChangeState(ERealized);
+
+ TInt err = iMStreamControl->Stop();
+ ELOG1( EJavaMMAPI, "CMMAEMCPlayerBase::DeallocateL iMStreamControl->Stop = %d", err);
+ ResetSourceStreams();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::DeallocateL -");
+}
+
+
+void CMMAEMCPlayerBase::GetDuration(TInt64* aDuration)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::GetDuration +");
+ if (iDuration == KTimeUnknown)
+ {
+ TInt64 duration(0);
+ TInt err = iMStreamControl->GetDuration(duration);
+ if (!err)
+ {
+ iDuration = duration;
+ }
+ }
+ *aDuration = iDuration;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerBase::GetDuration -");
+}
+
+void CMMAEMCPlayerBase::SetMediaTimeL(TInt64* aTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::SetMediaTimeL +");
+
+ // Negative values are not checked here
+ // because it's done already in Java side.
+
+ // Get clip duration
+ TInt64 duration;
+ User::LeaveIfError(iMStreamControl->GetDuration(duration));
+ LOG1( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::SetMediaTimeL iMStreamControl->GetDuration=%d", duration);
+
+ TInt64 position;
+
+ // If the desired media time is beyond the duration,
+ // the time is set to the end of the media.
+ if (*aTime > duration)
+ {
+ position = duration;
+ }
+ else
+ {
+ position = *aTime;
+ }
+
+ // The controller must be in the PRIMED or PLAYING state
+ User::LeaveIfError(iMStreamControl->SetPosition(position));
+
+ // Reset cached media time, because actual set position may be
+ // something else than aTime.
+ iMediaTime = KTimeUnknown;
+
+ // Inform about the position change to the StateListeners
+ ChangeState(iState);
+
+ // Get the actual media time
+ GetMediaTime(aTime);
+
+ iStartedEventTime = iMediaTime;
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::SetMediaTimeL -");
+}
+
+void CMMAEMCPlayerBase::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::GetMediaTimeL +");
+ TInt64 position(0);
+
+ if (iMediaTime == KTimeUnknown || iState == EStarted)
+ {
+
+ TInt error(iMStreamControl->GetPosition(position));
+
+ if (error == KErrNone)
+ {
+ TInt64 newTime = position;
+
+ // Sanity check for media time going backwards or beyond the
+ // duration.
+ // Some native controls may return zero media time for
+ // a few moments just before playback will complete.
+ if (newTime < iMediaTime ||
+ (iDuration > 0 && newTime > iDuration))
+ {
+ GetDuration(&iMediaTime);
+ }
+ else
+ {
+ // set return value
+ iMediaTime = newTime;
+ }
+ }
+ else
+ {
+ ELOG1( EJavaMMAPI, "CMMAEMCPlayerBase::GetMediaTimeL: error=%d, returning TIME_UNKNOWN", error);
+ // cannot get media time
+ iMediaTime = KTimeUnknown;
+ }
+ }
+ *aMediaTime = iMediaTime;
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::GetMediaTimeL -");
+}
+
+void CMMAEMCPlayerBase::CloseL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::CloseL +");
+ CMMAPlayer::CloseL();
+
+ iMStreamControl->Close();
+ LOG( EJavaMMAPI, EInfo, "CMMAEMCPlayerBase::CloseL -");
+}
+
+void CMMAEMCPlayerBase::Event(MControl* /*aControl*/, TUint /*aEventType*/, TAny* /*aEventObject*/)
+{
+ //Not Called
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmaemcplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating EMC-based players.
+*
+*/
+
+
+// INCLUDE FILES
+#include <badesca.h>
+#include <logger.h>
+
+#ifndef RD_JAVA_OMA_DRM_V2
+#include <DRMCommon.h>
+#endif // RD_JAVA_OMA_DRM_V2
+
+#include "cmmaemcplayerfactory.h"
+#include "cmmaemcresolver.h"
+#include "MimeTypes.h"
+
+// CONSTANTS
+// Granularity used to create initial arrays.
+const TInt KGranularity = 8;
+_LIT(KContentTypePacketSrcNotIncluded, "application/x-ext-packetsrc");
+
+CMMAEMCPlayerFactory::CMMAEMCPlayerFactory()
+{
+}
+
+CMMAEMCPlayerFactory::~CMMAEMCPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAEMCPlayerFactory::CreatePlayerL(const TDesC& aContentType)
+{
+ return CreatePlayerL(aContentType, NULL);
+}
+
+CMMAPlayer* CMMAEMCPlayerFactory::CreatePlayerL(const TDesC& /*aContentType*/,
+ const TDesC* /*aFileName*/)
+{
+ return (CMMAPlayer*)NULL;
+}
+
+CMMAPlayer* CMMAEMCPlayerFactory::CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC&)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerFactory::CreatePlayerL aMiddlePart = %S",
+ aMiddlePart.Ptr());
+ CMMAEMCResolver* emcresolver =
+ CMMAEMCResolver::NewLC();
+
+ emcresolver ->SetFileNameL(&aMiddlePart);
+
+ CMMAPlayer* player = NULL;
+ if (aProtocol == KMMAFileProtocol)
+ {
+
+ //player = CreatePlayerL( emcresolver, &aMiddlePart );
+
+#ifndef RD_JAVA_OMA_DRM_V2
+ // if opening is failed, it might be DRM file, trying it
+ if (!player)
+ {
+ player = TryOpenDRMFileL(aMiddlePart);
+ }
+#endif // RD_JAVA_OMA_DRM_V2
+
+ }
+ else
+ {
+ player = CreatePlayerL(emcresolver);
+ }
+
+ CleanupStack::PopAndDestroy(emcresolver);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerFactory::CreatePlayerL aMiddlePart ok");
+ return player;
+}
+
+#ifndef RD_JAVA_OMA_DRM_V2
+CMMAPlayer* CMMAEMCPlayerFactory::TryOpenDRMFileL(const TDesC& aFileName)
+{
+ // we are most likely going to play this file
+ ContentAccess::TIntent intent = ContentAccess::EPlay;
+
+ CContent* contentObj = CContent::NewL(aFileName);
+ CleanupStack::PushL(contentObj);
+ CData* dataObj = contentObj->OpenContentL(intent);
+ CleanupStack::PushL(dataObj);
+ User::LeaveIfError(dataObj->EvaluateIntent(intent));
+ TBuf8<KMaxName> mimeType;
+ CMMAPlayer* player = NULL;
+ if (dataObj->GetMimeTypeL(mimeType))
+ {
+ // we use 16bit mimeType
+ HBufC* mimeTypeBuf = HBufC::NewLC(mimeType.Length());
+ mimeTypeBuf->Des().Copy(mimeType);
+ player = CreatePlayerL(*mimeTypeBuf, &aFileName);
+ CleanupStack::PopAndDestroy(mimeTypeBuf);
+ }
+ CleanupStack::PopAndDestroy(2); //dataObj, contentObj
+ return player;
+}
+#endif // RD_JAVA_OMA_DRM_V2
+
+CMMAPlayer* CMMAEMCPlayerFactory::CreatePlayerL(const TDesC8& /*aHeaderData*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCPlayerFactory::CreatePlayerL header data +");
+
+ return (CMMAPlayer*)NULL;
+}
+
+void CMMAEMCPlayerFactory::GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray)
+{
+ //CMMAEMCResolver class should contain the constant array of all supported mimetype defined in EMC api MimeTypes.h
+ if (!IsSupportedProtocolL(aProtocol))
+ {
+ return;
+ }
+ CMMAEMCResolver* emcresolver = CMMAEMCResolver::NewLC();
+ emcresolver->GetSupportedContentTypesL(aMimeTypeArray);
+
+ CleanupStack::PopAndDestroy(emcresolver);
+}
+
+void CMMAEMCPlayerFactory::GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ // Check that this is supported content type
+ if (!IsSupportedContentTypeL(aContentType))
+ {
+ return;
+ }
+ aProtocolArray.AppendL(KMMAHttpProtocol);
+ aProtocolArray.AppendL(KMMAHttpsProtocol);
+}
+
+TBool CMMAEMCPlayerFactory::IsSupportedProtocolL(const TDesC& aProtocol)
+{
+ // With null desc we are getting all
+ if (aProtocol == KNullDesC)
+ {
+ return ETrue;
+ }
+ CDesC16ArraySeg* protocols = new(ELeave) CDesC16ArraySeg(KGranularity);
+ CleanupStack::PushL(protocols);
+ GetSupportedProtocolsL(KNullDesC, *protocols);
+ TInt pos = KErrNotFound;
+ // Find returns 0 if there contentType is found
+ TBool retValue = (protocols->Find(aProtocol, pos) == 0);
+ CleanupStack::PopAndDestroy(protocols);
+ return retValue;
+}
+
+TBool CMMAEMCPlayerFactory::IsSupportedContentTypeL(const TDesC& aContentType)
+{
+ // With null desc we are getting all
+ if (aContentType == KNullDesC)
+ {
+ return ETrue;
+ }
+
+ // Content type application/x-ext-packetsrc
+ // must not be supported at the moment.
+ if (aContentType == KContentTypePacketSrcNotIncluded)
+ {
+ return EFalse;
+ }
+
+ CDesC16ArraySeg* contentTypes = new(ELeave) CDesC16ArraySeg(KGranularity);
+ CleanupStack::PushL(contentTypes);
+ GetSupportedContentTypesL(KNullDesC, *contentTypes);
+ TInt pos = KErrNotFound;
+ // Find returns 0 if there contentType is found
+ TBool retValue = (contentTypes->Find(aContentType, pos) == 0);
+ CleanupStack::PopAndDestroy(contentTypes);
+ return retValue;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmaemcresolver.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,329 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaemcresolver.h"
+#include "hxmetadatautil.h"
+#include "apgcli.h"
+#include "apmrec.h"
+
+using namespace multimedia;
+
+_LIT(KRVMimeType1, "video/x-pn-realvideo");
+_LIT(KRVMimeType2, "video/x-realvideo");
+_LIT(KRVMimeType3, "video/vnd.rn-realvideo");
+
+// CONSTANTS
+
+CMMAEMCResolver* CMMAEMCResolver::NewLC()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: NewLC ++");
+ CMMAEMCResolver* self = new(ELeave)CMMAEMCResolver();
+ CleanupStack::PushL(self);
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: NewLC --");
+ return self;
+}
+
+CMMAEMCResolver::~CMMAEMCResolver()
+{
+ delete iContentType;
+
+ delete iFileName;
+
+ delete iMimeType;
+}
+
+HBufC* CMMAEMCResolver::ContentTypeOwnership()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: ContentTypeOwnership ++");
+ HBufC* ct = iContentType;
+ iContentType = NULL;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: ContentTypeOwnership --");
+ return ct;
+}
+
+HBufC8* CMMAEMCResolver::MimeTypeOwnership()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: MimeTypeOwnership ++");
+ HBufC8* mt = iMimeType;
+ iMimeType = NULL;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: MimeTypeOwnership --");
+ return mt;
+}
+
+HBufC* CMMAEMCResolver::ContentType()
+{
+ return iContentType;
+}
+
+void CMMAEMCResolver::SetFileNameL(const TDesC* aFileName)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: SetFileNameL ++");
+ HBufC* fn = NULL;
+ if (aFileName)
+ {
+ fn = aFileName->AllocL();
+ }
+ delete iFileName;
+ iFileName = fn;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: SetFileNameL --");
+}
+
+HBufC* CMMAEMCResolver::FileNameOwnership()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: FileNameOwnership ++");
+ HBufC* fn = iFileName;
+ iFileName = NULL;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: FileNameOwnership --");
+ return fn;
+}
+
+void CMMAEMCResolver::SetMimeTypeL(const TDesC* aFileName)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: SetMimeTypeL +");
+ if (iContentType)
+ {
+ delete iContentType;
+ iContentType = NULL;
+ }
+ iContentType = HBufC::NewL(KContentTypeMaxLength);
+ TBuf8<KContentTypeMaxLength> mimeType;
+ ResolveContentTypeL(*aFileName,mimeType);
+ iContentType->Des().Copy(mimeType);
+ iMimeType = HBufC8::NewL(mimeType.Length()); //8 bit Descriptor of iContentType
+ iMimeType->Des().Copy(mimeType);
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: SetMimeTypeL -");
+}
+
+void CMMAEMCResolver::ResolveContentTypeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver::ResolveContentTypeL +");
+
+ if (iContentType)
+ {
+ delete iContentType;
+ iContentType = NULL;
+ }
+ if (iMimeType)
+ {
+ delete iMimeType;
+ iMimeType = NULL;
+ }
+
+ iContentType = HBufC::NewL(KContentTypeMaxLength);
+ iMimeType = HBufC8::NewL(KContentTypeMaxLength);
+
+ if (iFileName->Right(4).Compare(KAacFileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeAAC);
+ iMimeType->Des().Copy(KMimetypeAAC);
+ }
+ else if (iFileName->Right(4).Compare(KAmrFileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeAMR);
+ iMimeType->Des().Copy(KMimetypeAMR);
+ }
+ else if (iFileName->Right(4).Compare(KAwbFileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeAMRWB);
+ iMimeType->Des().Copy(KMimetypeAMRWB);
+ }
+ else if (iFileName->Right(4).Compare(KWmaFileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeXMSWMA);
+ iMimeType->Des().Copy(KMimetypeXMSWMA);
+ }
+ else if (iFileName->Right(3).Compare(KRaFileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeRM);
+ iMimeType->Des().Copy(KMimetypeRM);
+ }
+ else if (iFileName->Right(4).Compare(KMp3FileExtension()) == 0)
+ {
+ iContentType->Des().Copy(KMimetypeMPEG);
+ iMimeType->Des().Copy(KMimetypeMPEG);
+ }
+ else if (iHeaderData)
+ {
+ RApaLsSession ls;
+ TInt err;
+ err = ls.Connect();
+
+ if (iFileName->Right(3).Compare(KRmFileExtension()) == 0)
+ {
+ TBool res = IsRealVideoTypeL(*iHeaderData);
+
+ if (!res)
+ {
+ iContentType->Des().Copy(KMimetypeRM);
+ iMimeType->Des().Copy(KMimetypeRM);
+ }
+ else
+ {
+ iContentType->Des().Copy(KNullDesC);
+ iMimeType->Des().Copy(KNullDesC8);
+ }
+ }
+ else if ((iFileName->Right(4).Compare(K3gpFileExtension()) == 0) ||
+ (iFileName->Right(4).Compare(KMp4FileExtension()) == 0))
+ {
+ TDataRecognitionResult result;
+ err = ls.RecognizeData(*iFileName, *iHeaderData, result);
+ if (!err && (result.iConfidence >= CApaDataRecognizerType::EProbable))
+ {
+ iContentType->Des().Copy(result.iDataType.Des8());
+ iMimeType->Des().Copy(result.iDataType.Des8());
+ }
+ else
+ {
+ iContentType->Des().Copy(KNullDesC);
+ iMimeType->Des().Copy(KNullDesC8);
+ }
+ }
+ ls.Close();
+ }
+ else
+ {
+ iContentType->Des().Copy(KNullDesC);
+ iMimeType->Des().Copy(KNullDesC8);
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver::ResolveContentTypeL -");
+}
+//
+
+void CMMAEMCResolver::ResolveContentTypeL(const TDesC& /*aFileName*/, TDes8& /*aMimeType*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: ResolveContentTypeL");
+}
+
+void CMMAEMCResolver::GetSupportedContentTypesL(CDesC16Array& aMimeTypeArray)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: GetSupportedContentTypesL +");
+ // All supported mimetypes are taken from "MimeTypes.h"
+ TBuf16<KContentTypeMaxLength> tempBuf;
+ tempBuf.Copy(KMimetype3GPP);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetype3GPP2);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeAAC);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeAMR);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeAMRWB);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeMPEG);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeMP4);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeXMSWMA);
+ aMimeTypeArray.AppendL(tempBuf);
+ tempBuf.Zero();
+ tempBuf.Copy(KMimetypeRM);
+ aMimeTypeArray.AppendL(tempBuf);
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAEMCResolver :: GetSupportedContentTypesL -");
+}
+
+// EMC - II
+void CMMAEMCResolver::SetSourceInfoL(const HBufC8* aHeaderData)
+{
+ iHeaderData = aHeaderData;
+ ResolveContentTypeL();
+}
+
+TBool CMMAEMCResolver::IsRealVideoTypeL(const TDesC8& aHeader)
+{
+ TBool result = EFalse;
+
+ CHXMetaDataUtility *putil;
+ putil = CHXMetaDataUtility::NewL();
+ CleanupStack::PushL(putil);
+ TRAPD(err, putil->OpenDesL((TDesC8 &)aHeader));
+ ELOG1( EJavaMMAPI, "MMA:CMMAEMCResolver::IsRealVideoTypeL, err = %d", err);
+
+ if (err != KErrNone)
+ {
+ CleanupStack::Pop(putil);
+ putil->ResetL();
+ delete putil;
+ return EFalse;
+ }
+
+ TUint count = 0;
+ putil->GetMetaDataCount(count);
+
+ TUint i;
+ HXMetaDataKeys::EHXMetaDataId id;
+
+ for (i = 0; i < count; i++)
+ {
+ HBufC* pDes = NULL;
+
+ putil->GetMetaDataAt(i, id, pDes);
+
+ if (id == HXMetaDataKeys::EHXMimeType)
+ {
+ if (IsRealMimeTypeSupported(*pDes))
+ {
+ result = ETrue;
+ }
+ }
+ }
+
+ CleanupStack::Pop(putil);
+
+ putil->ResetL();
+ delete putil;
+
+ return result;
+}
+
+TBool CMMAEMCResolver::IsRealMimeTypeSupported(const TDesC& aMimeType)
+{
+ TBool match = EFalse;
+
+ if (!aMimeType.Compare(KRVMimeType1()))
+ {
+ match = ETrue;
+ return match;
+ }
+ if (!aMimeType.Compare(KRVMimeType2()))
+ {
+ match = ETrue;
+ return match;
+ }
+ if (!aMimeType.Compare(KRVMimeType3()))
+ {
+ match = ETrue;
+ return match;
+ }
+
+ return match;
+}
+//
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/cmmamanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class uses player factories to generate different players
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <ecam.h>
+
+#include "cmmamanager.h"
+#include "cmmaaudioplayerfactory.h"
+#include "cmmavideoplayerfactory.h"
+#include "cmmaaudiorecorderfactory.h"
+#include "cmmacameraplayerfactory.h"
+#include "cmmamidiplayerfactory.h"
+#include "cmmavideourlplayerfactory.h"
+#include "cmmaaudiostreamplayerfactory.h"
+//#include "cmmaanimationplayerfactory.h"
+
+#ifdef RD_JAVA_OMA_DRM_V2
+#include "cmmadrmplayerfactory.h"
+#endif // RD_JAVA_OMA_DRM_V2
+
+// index of CMMAAudioStreamPlayerFactory in iPlayerFactories
+// if CMMAAudioStreamPlayerFactory is moved in iPlayerFactories
+// this constant should be updated accordingly
+const TInt KAudioStreamPlayerFactoryIndex = 2;
+
+CMMAManager::~CMMAManager()
+{
+ iPlayerFactories.ResetAndDestroy();
+ iPlayerFactories.Close();
+}
+
+CMMAManager::CMMAManager()
+{
+}
+
+void CMMAManager::ConstructL(TInt aMIDletSuiteID)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAManager::ConstructL +");
+ //
+ // Create and insert known player factories
+ //
+
+ CMMAVideoUrlPlayerFactory* videoUrlPlayerFactory = CMMAVideoUrlPlayerFactory::NewLC();
+ AddPlayerFactoryL(videoUrlPlayerFactory);
+ CleanupStack::Pop(); // videoUrlPlayerFactory
+
+ CMMAMIDIPlayerFactory* midiPlayerFactory = CMMAMIDIPlayerFactory::NewLC();
+ AddPlayerFactoryL(midiPlayerFactory);
+ CleanupStack::Pop(); // midiPlayerFactory
+
+ CMMAAudioStreamPlayerFactory* audioStreamPlayerFactory =
+ CMMAAudioStreamPlayerFactory::NewLC();
+ AddPlayerFactoryL(audioStreamPlayerFactory);
+ CleanupStack::Pop(); // audioStreamPlayerFactory
+
+ CMMAVideoPlayerFactory* videoPlayerFactory = CMMAVideoPlayerFactory::NewLC();
+ AddPlayerFactoryL(videoPlayerFactory);
+ CleanupStack::Pop(); // videoPlayerFactory
+
+ CMMAAudioPlayerFactory* audioPlayerFactory = CMMAAudioPlayerFactory::NewLC();
+ AddPlayerFactoryL(audioPlayerFactory);
+ CleanupStack::Pop(); // audioPlayerFactory
+
+ CMMAAudioRecorderFactory* audioRecorderFactory =
+ CMMAAudioRecorderFactory::NewLC(aMIDletSuiteID);
+ AddPlayerFactoryL(audioRecorderFactory);
+ CleanupStack::Pop(); // audioRecorderFactory
+
+/*
+ CMMAAnimationPlayerFactory* animationPlayerFactory =
+ CMMAAnimationPlayerFactory::NewLC();
+ AddPlayerFactoryL(animationPlayerFactory);
+ CleanupStack::Pop(); // animationPlayerFactory
+*/
+
+ // Add camera playerfactory only if there is a camera
+ if (CCamera::CamerasAvailable() > 0)
+ {
+ CMMACameraPlayerFactory* cameraPlayerFactory =
+ CMMACameraPlayerFactory::NewLC();
+ AddPlayerFactoryL(cameraPlayerFactory);
+ CleanupStack::Pop(); // cameraPlayerFactory
+ }
+
+#ifdef RD_JAVA_OMA_DRM_V2
+ CMMADRMPlayerFactory* drmPlayerFactory =
+ CMMADRMPlayerFactory::NewLC(videoPlayerFactory);
+ AddPlayerFactoryL(drmPlayerFactory);
+ CleanupStack::Pop(); // drmPlayerFactory
+#endif // RD_JAVA_OMA_DRM_V2
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAManager::ConstructL -");
+}
+
+void CMMAManager::StaticCreateManagerL(CMMAManager** aManager,
+ TInt aMIDletSuiteID)
+{
+ CMMAManager* self = new(ELeave) CMMAManager();
+
+ CleanupStack::PushL(self);
+ self->ConstructL(aMIDletSuiteID);
+ CleanupStack::Pop();
+
+ *aManager = self;
+}
+
+/**
+ * Use factories to create a player from content type
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC& aContentType)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aContentType);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * Use factories to create a player from locator
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aProtocol,
+ aMiddlePart,
+ aParameters);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * Use factories to create a player from header data
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC8& aHeaderData)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aHeaderData);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * From MMMAPlayerFactory. Get all supported protocols
+ */
+void CMMAManager::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aSupportedProtocols)
+{
+ // Query supported protocols from all player factories
+ for (TInt i = 0; i < iPlayerFactories.Count(); i++)
+ {
+ iPlayerFactories[ i ]->GetSupportedProtocolsL(aContentType,
+ aSupportedProtocols);
+ }
+}
+
+/**
+ * From MMMAPlayerFactory. Get all supported content types
+ */
+void CMMAManager::GetSupportedContentTypesL(
+ const TDesC& aProtocol,
+ CDesC16Array& aContentTypes)
+{
+ // Get all supported content types from PlayerFactories
+ for (TInt i = 0; i < iPlayerFactories.Count(); i++)
+ {
+ iPlayerFactories[ i ]->GetSupportedContentTypesL(aProtocol,
+ aContentTypes);
+ }
+}
+
+EXPORT_C void CMMAManager::AddPlayerFactoryL(MMMAPlayerFactory* aPlayerFactory)
+{
+ User::LeaveIfError(iPlayerFactories.Append(aPlayerFactory));
+}
+
+void CMMAManager::SetSourceInfoL(const TUint8* aHeader, TInt aLength)
+{
+
+ if (iPlayerFactories.Count() > KAudioStreamPlayerFactoryIndex)
+ {
+ // assumption - iPlayerFactories[KAudioStreamPlayerFactoryIndex] is CMMAAudioStreamPlayerFactory
+ CMMAAudioStreamPlayerFactory* audiostreamplayerfactory =
+ static_cast<CMMAAudioStreamPlayerFactory*>(iPlayerFactories[ KAudioStreamPlayerFactoryIndex ]);
+ audiostreamplayerfactory->SetSourceInfoL(aHeader, aLength);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.emc/emcsourceinfo.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+#include "com_nokia_microedition_media_protocol_EMCSourceInfo.h"
+#include "cmmamanager.h"
+
+LOCAL_C void SetHeaderDataL(
+ CMMAManager* aManager,
+ const TUint8* aHeader,
+ TInt aLength)
+{
+ aManager->SetSourceInfoL(aHeader, aLength);
+}
+
+/*
+ * Class: com_nokia_microedition_media_protocol_http_EMCSourceInfo
+ * Method: _writeHeaderData
+ * Signature: (II[B)V
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_protocol_EMCSourceInfo__1writeHeaderData
+(JNIEnv* aJni, jobject, jint aEventSourceHandle, jint aManagerHandle, jbyteArray aHeader)
+{
+ // Development time check.
+ __ASSERT_DEBUG((aEventSourceHandle > 0) && (aManagerHandle > 0), User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager* >(aManagerHandle);
+
+ if (aHeader)
+ {
+ // Get pointer to Java header data
+ jbyte* data = aJni->GetByteArrayElements(aHeader, NULL);
+
+ // if data is null Java data could not be obtained to native and
+ // KErrNoMemory is returned to Java
+ if (!data)
+ {
+ return KErrNoMemory;
+ }
+
+ TInt headerDataLength = aJni->GetArrayLength(aHeader);
+
+ TInt err = eventSource->ExecuteTrap(&SetHeaderDataL,
+ manager,
+ (const TUint8*)data,
+ headerDataLength);
+
+ // release bytes got with GetByteArrayElements
+ aJni->ReleaseByteArrayElements(aHeader,
+ data,
+ 0);
+
+ return err;
+ }
+ else
+ {
+ // if aHeader is NULL, this method should not have been called
+ // from java
+ return KErrBadHandle;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.mmf/cmmamanager.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class uses player factories to generate different players
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <ECam.h>
+
+#include "CMMAManager.h"
+#include "CMMAAudioPlayerFactory.h"
+#include "CMMAVideoPlayerFactory.h"
+#include "CMMAAudioRecorderFactory.h"
+#include "CMMACameraPlayerFactory.h"
+#include "CMMAMidiPlayerFactory.h"
+#include "CMMAVideoUrlPlayerFactory.h"
+
+#ifdef __MMA_AUDIOSTREAMING__
+#include "CMMAAudioStreamPlayerFactory.h"
+#endif // __MMA_AUDIOSTREAMING__
+
+#ifdef __MMA_ANIMATED_GIF__
+#include "CMMAAnimationPlayerFactory.h"
+#endif // __MMA_ANIMATED_GIF__
+
+#ifdef RD_JAVA_OMA_DRM_V2
+#include "CMMADRMPlayerFactory.h"
+#endif // RD_JAVA_OMA_DRM_V2
+
+CMMAManager::~CMMAManager()
+{
+ iPlayerFactories.ResetAndDestroy();
+ iPlayerFactories.Close();
+}
+
+CMMAManager::CMMAManager()
+{
+}
+
+void CMMAManager::ConstructL(TInt aMIDletSuiteID)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAManager::ConstructL +");
+ //
+ // Create and insert known player factories
+ //
+
+ CMMAVideoUrlPlayerFactory* videoUrlPlayerFactory = CMMAVideoUrlPlayerFactory::NewLC();
+ AddPlayerFactoryL(videoUrlPlayerFactory);
+ CleanupStack::Pop(); // videoUrlPlayerFactory
+
+ CMMAMIDIPlayerFactory* midiPlayerFactory = CMMAMIDIPlayerFactory::NewLC();
+ AddPlayerFactoryL(midiPlayerFactory);
+ CleanupStack::Pop(); // midiPlayerFactory
+
+ CMMAVideoPlayerFactory* videoPlayerFactory = CMMAVideoPlayerFactory::NewLC();
+ AddPlayerFactoryL(videoPlayerFactory);
+ CleanupStack::Pop(); // videoPlayerFactory
+
+#ifdef __MMA_AUDIOSTREAMING__
+ CMMAAudioStreamPlayerFactory* audioStreamPlayerFactory =
+ CMMAAudioStreamPlayerFactory::NewLC();
+ AddPlayerFactoryL(audioStreamPlayerFactory);
+ CleanupStack::Pop(); // audioStreamPlayerFactory
+#endif // __MMA_AUDIOSTREAMING__
+
+ CMMAAudioPlayerFactory* audioPlayerFactory = CMMAAudioPlayerFactory::NewLC();
+ AddPlayerFactoryL(audioPlayerFactory);
+ CleanupStack::Pop(); // audioPlayerFactory
+
+ CMMAAudioRecorderFactory* audioRecorderFactory =
+ CMMAAudioRecorderFactory::NewLC(aMIDletSuiteID);
+ AddPlayerFactoryL(audioRecorderFactory);
+ CleanupStack::Pop(); // audioRecorderFactory
+
+#ifdef __MMA_ANIMATED_GIF__
+ CMMAAnimationPlayerFactory* animationPlayerFactory =
+ CMMAAnimationPlayerFactory::NewLC();
+ AddPlayerFactoryL(animationPlayerFactory);
+ CleanupStack::Pop(); // animationPlayerFactory
+#endif // __MMA_ANIMATED_GIF__
+
+ // Add camera playerfactory only if there is a camera
+ if (CCamera::CamerasAvailable() > 0)
+ {
+ CMMACameraPlayerFactory* cameraPlayerFactory =
+ CMMACameraPlayerFactory::NewLC();
+ AddPlayerFactoryL(cameraPlayerFactory);
+ CleanupStack::Pop(); // cameraPlayerFactory
+ }
+
+#ifdef RD_JAVA_OMA_DRM_V2
+ CMMADRMPlayerFactory* drmPlayerFactory =
+ CMMADRMPlayerFactory::NewLC(videoPlayerFactory);
+ AddPlayerFactoryL(drmPlayerFactory);
+ CleanupStack::Pop(); // drmPlayerFactory
+#endif // RD_JAVA_OMA_DRM_V2
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAManager::ConstructL -");
+}
+
+void CMMAManager::StaticCreateManagerL(CMMAManager** aManager,
+ TInt aMIDletSuiteID)
+{
+ CMMAManager* self = new(ELeave) CMMAManager();
+
+ CleanupStack::PushL(self);
+ self->ConstructL(aMIDletSuiteID);
+ CleanupStack::Pop();
+
+ *aManager = self;
+}
+
+/**
+ * Use factories to create a player from content type
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC& aContentType)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aContentType);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * Use factories to create a player from locator
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aProtocol,
+ aMiddlePart,
+ aParameters);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * Use factories to create a player from header data
+ *
+ */
+CMMAPlayer* CMMAManager::CreatePlayerL(const TDesC8& aHeaderData)
+{
+ // Try all factories, in order
+ TInt factoryCount = iPlayerFactories.Count();
+ for (TInt i = 0; i < factoryCount; i++)
+ {
+ CMMAPlayer* player = iPlayerFactories[ i ]->CreatePlayerL(aHeaderData);
+ if (player)
+ {
+ return player;
+ }
+ }
+ // No PlayerFactory accepted the content type
+ return NULL;
+}
+
+/**
+ * From MMMAPlayerFactory. Get all supported protocols
+ */
+void CMMAManager::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aSupportedProtocols)
+{
+ // Query supported protocols from all player factories
+ for (TInt i = 0; i < iPlayerFactories.Count(); i++)
+ {
+ iPlayerFactories[ i ]->GetSupportedProtocolsL(aContentType,
+ aSupportedProtocols);
+ }
+}
+
+/**
+ * From MMMAPlayerFactory. Get all supported content types
+ */
+void CMMAManager::GetSupportedContentTypesL(
+ const TDesC& aProtocol,
+ CDesC16Array& aContentTypes)
+{
+ // Get all supported content types from PlayerFactories
+ for (TInt i = 0; i < iPlayerFactories.Count(); i++)
+ {
+ iPlayerFactories[ i ]->GetSupportedContentTypesL(aProtocol,
+ aContentTypes);
+ }
+}
+
+EXPORT_C void CMMAManager::AddPlayerFactoryL(MMMAPlayerFactory* aPlayerFactory)
+{
+ User::LeaveIfError(iPlayerFactories.Append(aPlayerFactory));
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,728 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* in graphics surface based displays for Helix engine.
+*
+*/
+
+// Include Files
+#include <logger.h>
+#include "cmmasurfacewindow.h"
+#include "cmmaplayer.h"
+
+// Used for iDisplay member
+#include "mmmadisplay.h"
+
+CMMASurfaceWindow* CMMASurfaceWindow::NewL(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer)
+{
+ CMMASurfaceWindow* self =
+ new(ELeave) CMMASurfaceWindow(aEventSource,
+ aPlayer);
+ return self;
+}
+
+// Destructor (virtual by CBase)
+CMMASurfaceWindow::~CMMASurfaceWindow()
+{
+ // It's not allowed to delete any nonsharable object here.
+ // This must be done in Destroy().
+ // If the iDisplay is set,
+ // instance should be deleted by sending
+ // event from UI to be received by MUiEventConsumer.
+}
+
+CMMASurfaceWindow::CMMASurfaceWindow(
+ MMAFunctionServer* aEventSource,
+ CMMAPlayer* aPlayer):
+ iEventSource(aEventSource),
+ iPlayer(aPlayer),
+ iVideoDisplayInitState(EUIResourcesAndSurfaceParametersNotSet)
+{
+ // Empty rect until video size is known
+ iContentRect.SetRect(0, 0, 0, 0);
+ iParentRect.SetRect(0, 0, 0, 0);
+ iRWindowRect.SetRect(0, 0, 0, 0);
+}
+
+void CMMASurfaceWindow::SetDestinationBitmapL(CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+}
+
+void CMMASurfaceWindow::DrawFrameL(const CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+}
+
+void CMMASurfaceWindow::SetDrawRectThread( const TRect& aRect )
+ {
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRectThread TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY );
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRectThread BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY );
+
+ iContentRect = aRect;
+
+ TInt error = StaticRedrawVideo(*this);
+ if ( KErrNone != error )
+ {
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::SetDrawRectThread, StaticRedrawVideo error = %d", error);
+ }
+ }
+
+void CMMASurfaceWindow::SetRWindowRect(const TRect& aRect,
+ MMMADisplay::TThreadType aThreadType)
+{
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetRWindowRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetRWindowRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ iRWindowRect = aRect;
+
+ if (MMMADisplay::EMmaThread == aThreadType)
+ {
+ if (iDisplay)
+ {
+ /* iDisplay->UIGetCallback( *this,
+ CMMASurfaceWindow::ESetDrawRect);
+ */
+ // MMAPI UI 3.x req.
+ iDisplay->GetCallbackInUiThread( (TInt)CMMASurfaceWindow::ESetDrawRect );
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect after GetCallbackInUiThread " );
+
+ }
+ }
+ else if (MMMADisplay::EUiThread == aThreadType)
+ {
+ /*TInt error = StaticRedrawVideo(*this);
+ if (KErrNone != error)
+ {
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect, StaticRedrawVideo error = %d", error);
+ }
+ */
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect else GetCallbackInUiThread + " );
+ iDisplay->GetCallbackInUiThread( (TInt)CMMASurfaceWindow::ESetDrawRect );
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect else GetCallbackInUiThread -" );
+ }
+}
+
+void CMMASurfaceWindow::SetDrawRect( const TRect& aRect )
+ {
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY );
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDrawRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY );
+
+ iContentRect = aRect;
+ if ( iDisplay )
+ {
+ // iDisplay->UIGetCallback( *this,
+ // CMMASurfaceWindow::ESetDrawRect );
+ // MMAPI UI 3.x req.
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
+ }
+ }
+
+TInt CMMASurfaceWindow::StaticRedrawVideo(CMMASurfaceWindow& aSurfaceWindow)
+{
+ TRAPD(error, aSurfaceWindow.RedrawVideoL());
+ return error;
+}
+
+void CMMASurfaceWindow::RedrawVideoL()
+{
+ if (!iMediaClientVideoDisplay)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -" );
+ return;
+ }
+
+ if (iWindow)
+ {
+ TRect contentRect;
+ if (iVisible)
+ {
+ contentRect = iContentRect;
+ ScaleVideoL(contentRect);
+ }
+ else
+ {
+ TRect emptyRect(0,0,0,0);
+ contentRect = emptyRect;
+ }
+
+ // align parent rect with respect to RWindow
+ TRect relativeParentRect;
+ relativeParentRect = iParentRect;
+ relativeParentRect.Move(-iRWindowRect.iTl);
+
+ // setting video draw rect and adjusting it to window
+ TRect drawRect = contentRect;
+ drawRect.Move(relativeParentRect.iTl);
+
+ // Area where should be drawn is the intersection of drawRect and relativeParentRect.
+ TRect areaRect = relativeParentRect;
+ areaRect.Intersection(drawRect);
+
+ iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow,
+ areaRect,
+ iVideoCropRegion);
+
+ iMediaClientVideoDisplay->SetVideoExtentL(*iWindow,
+ areaRect,
+ iVideoCropRegion);
+
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() areaRect is %d X %d",areaRect.Width(),areaRect.Height() );
+
+ iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
+ }
+}
+
+void CMMASurfaceWindow::ScaleVideoL(const TRect& aRect)
+{
+ // return without scaling incase cropregion dimensions are zero
+ if (!(iVideoCropRegion.Width() && iVideoCropRegion.Height()))
+ {
+ return;
+ }
+
+ TReal32 numerator = 1.0f * (aRect.Width() - iVideoCropRegion.Width());
+ TReal32 denominator = 1.0f * iVideoCropRegion.Width();
+ // new video width percent(relative to the original width) to
+ // which video has to be scaled.
+ TReal32 scaleWidthPercent = 100.0f + (100.0f * (numerator/denominator));
+
+ numerator = 1.0f * (aRect.Height() - iVideoCropRegion.Height());
+ denominator = 1.0f * iVideoCropRegion.Height();
+ // new video height percent(relative to the original height) to
+ // which video has to be scaled.
+ TReal32 scaleHeightPercent = 100.0f + (100.0f * (numerator/denominator));
+
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow:: scaleWidthPercent, scaleHeightPercent %d %d",
+ scaleWidthPercent, scaleHeightPercent );
+
+ iMediaClientVideoDisplay->SetScaleFactorL(scaleWidthPercent,
+ scaleHeightPercent,
+ iVideoCropRegion);
+}
+
+const TRect& CMMASurfaceWindow::DrawRect()
+{
+ return iContentRect;
+}
+
+TSize CMMASurfaceWindow::WindowSize()
+{
+ return iParentRect.Size();
+}
+
+void CMMASurfaceWindow::SetPosition(const TPoint& aPosition)
+{
+ iContentRect = TRect(aPosition, iContentRect.Size());
+ TInt error = StaticRedrawVideo(*this);
+ if (KErrNone != error)
+ {
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::SetPosition, StaticRedrawVideo error = %d", error);
+ }
+}
+
+TBool CMMASurfaceWindow::IsVisible() const
+ {
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::IsVisible %d ", iVisible );
+ return iVisible;
+ }
+
+void CMMASurfaceWindow::SetVisible(TBool aVisible, TBool aUseEventServer)
+{
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible aVisible %d", aVisible );
+ RPointerArray< CMMAPlayer > players = iEventSource->Players();
+
+ if (players.Find(iPlayer) != KErrNotFound)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible : Player found");
+ if (aVisible != iVisible)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetVisible: Changed visibility" );
+ iVisible = aVisible;
+ if (iDisplay)
+ {
+ //MMAPI UI 3.x req.
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,GetCallbackInUiThread");
+ }
+
+
+ /* if (aUseEventServer)
+ {
+ TInt error = StaticRedrawVideo(*this);
+ if (KErrNone != error)
+ {
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+ }
+ }
+ else // in MMA thread, so switch to UI thread
+ {
+ if (iDisplay)
+ {
+ //iDisplay->UIGetCallback(*this,
+ // CMMASurfaceWindow::ESetDrawRect );
+ //MMAPI UI 3.x req.
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,GetCallbackInUiThread");
+ }
+ }
+ */
+ }
+ }
+}
+
+void CMMASurfaceWindow::SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType /*aThreadType*/)
+{
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetWindowRect aRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetWindowRect aRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ iParentRect = aRect;
+}
+
+void CMMASurfaceWindow::SetVideoCropRegion(const TRect& aRect)
+{
+ // video size
+ iVideoCropRegion = aRect;
+}
+
+const TRect& CMMASurfaceWindow::WindowRect()
+{
+ return iParentRect;
+}
+
+void CMMASurfaceWindow::ContainerDestroyed()
+{
+ // We are in UI thread context now.
+ CleanVideoDisplay();
+}
+
+void CMMASurfaceWindow::SetDisplay(MMMADisplay *aDisplay)
+{
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDisplay +" );
+
+ if (iDisplay != aDisplay)
+ {
+ if (iDisplay)
+ {
+ // Clear the resources created within the old Display
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ECleanVideoDisplay );
+ }
+
+ // Set the new Display
+ iDisplay = aDisplay;
+
+ /*if ( iDisplay )
+ {
+ // Get a DSA resources for the new Display
+ //iDisplay->UIGetDSAResources( *this, MMMADisplay::EMmaThread );
+ CMMACanvasDisplay* display = static_cast< CMMACanvasDisplay* >( iDisplay );
+
+ display->GetWindowResources( this, MMMADisplay::EMmaThread );
+ }
+
+ */
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::SetDisplay -" );
+ }
+
+void CMMASurfaceWindow::ContainerSet()
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ContainerSet" );
+ // We are in UI thread now
+
+ // Container was probably not set when
+ // iDisplay was set,
+ // we can now try get the DSA stuff again
+ if (iDisplay)
+ {
+ // Get a DSA stuff for the new Display
+// iDisplay->UIGetDSAResources( *this, MMMADisplay::EUiThread );
+ }
+ }
+
+void CMMASurfaceWindow::Destroy()
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::Destroy" );
+ // Delete itself
+ delete this;
+ }
+
+void CMMASurfaceWindow::ProcureWindowResourcesFromQWidget(RWsSession * aWs,
+ CWsScreenDevice* aScreenDevice,
+ RWindowBase* aWindow)
+ {
+ iWs = aWs;
+ iScreenDevice = aScreenDevice;
+ iWindow = aWindow;
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget" );
+ switch ( iVideoDisplayInitState )
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -7" );
+ case EUIResourcesAndSurfaceParametersNotSet:
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -8" );
+ iVideoDisplayInitState =
+ EUIResourcesSetAndSurfaceParametersNotSet;
+ }
+ break;
+ case ESurfaceParametersSetAndUIResourcesNotSet:
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -9" );
+ iVideoDisplayInitState =
+ EUIResourcesAndSurfaceParametersSet;
+ }
+ break;
+ // can not occur
+ case EUIResourcesSetAndSurfaceParametersNotSet:
+ case EUIResourcesAndSurfaceParametersSet:
+ default:
+ {LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -10" );
+ __ASSERT_DEBUG( EFalse, User::Invariant() );
+ }
+ break;
+ }
+
+ if( iVideoDisplayInitState == EUIResourcesAndSurfaceParametersSet )
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -11" );
+ TRAPD(error, InitVideoDisplayL());
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget -12" );
+ if ( KErrNone != error )
+ {
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+ }
+ }
+
+ }
+/*
+void CMMASurfaceWindow::MdcDSAResourcesCallback(
+ RWsSession &aWs,
+ CWsScreenDevice &aScreenDevice,
+ RWindowBase &aWindow )
+ {
+ LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback" );
+
+ // We are in UI thread context now.
+ iWs = &aWs;
+ iScreenDevice = &aScreenDevice;
+ iWindow = &aWindow;
+
+ switch ( iVideoDisplayInitState )
+ {
+ case EUIResourcesAndSurfaceParametersNotSet:
+ {
+ iVideoDisplayInitState =
+ EUIResourcesSetAndSurfaceParametersNotSet;
+ }
+ break;
+ case ESurfaceParametersSetAndUIResourcesNotSet:
+ {
+ iVideoDisplayInitState =
+ EUIResourcesAndSurfaceParametersSet;
+ }
+ break;
+ // can not occur
+ case EUIResourcesSetAndSurfaceParametersNotSet:
+ case EUIResourcesAndSurfaceParametersSet:
+ default:
+ {
+ __ASSERT_DEBUG( EFalse, User::Invariant() );
+ }
+ break;
+ }
+
+ if( iVideoDisplayInitState == EUIResourcesAndSurfaceParametersSet )
+ {
+ TRAPD(error, InitVideoDisplayL());
+ if ( KErrNone != error )
+ {
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+ }
+ }
+ }
+*/
+void CMMASurfaceWindow::UICallback( TInt aCallbackId )
+ {
+ // We are in UI thread context now.
+ LOG1( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::MdcUICallback CallbackId = %d", aCallbackId );
+
+ TInt error = KErrNone;
+ switch (aCallbackId)
+ {
+ case ERemoveSurface:
+ {
+ DoRemoveSurface();
+ }
+ break;
+ case ESetDrawRect:
+ {
+ error = StaticRedrawVideo(*this);
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,StaticRedrawVideo error = %d", error);
+ }
+ break;
+ case EInitVideoDisplay:
+ {
+ TRAP(error, InitVideoDisplayL());
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,InitVideoDisplayL error = %d", error);
+ }
+ break;
+ case ESetChangedSurfaceParameters:
+ {
+ DoSetChangedSurfaceParameters();
+ }
+ break;
+ case EResetSurfaceParameters:
+ {
+ DoResetSurfaceParameters();
+ }
+ break;
+ case ECleanVideoDisplay:
+ {
+ CleanVideoDisplay();
+ }
+ break;
+ case EDestroyWindow:
+ {
+ Destroy();
+ }
+ break;
+ default:
+ {
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ break;
+ }
+}
+
+void CMMASurfaceWindow::SetSurfaceParameters(const TSurfaceId& aSurfaceId,
+ const TRect& aCropRect,
+ const TVideoAspectRatio& aPixelAspectRatio)
+{
+ iSurfaceId = aSurfaceId;
+ iCropRect = aCropRect;
+ iPixelAspectRatio = aPixelAspectRatio;
+
+ switch ( iVideoDisplayInitState )
+ {
+ case EUIResourcesAndSurfaceParametersNotSet:
+ {
+ iVideoDisplayInitState =
+ ESurfaceParametersSetAndUIResourcesNotSet;
+ }
+ break;
+ case EUIResourcesSetAndSurfaceParametersNotSet:
+ {
+ iVideoDisplayInitState =
+ EUIResourcesAndSurfaceParametersSet;
+ }
+ break;
+ // control reaches below two switch cases when
+ // playback is looped using setLoopCount() in java.
+ case ESurfaceParametersSetAndUIResourcesNotSet:
+ {
+ }
+ break;
+ // update surface parameters and return with out calling
+ // InitVideoDisplayL again.
+ case EUIResourcesAndSurfaceParametersSet:
+ {
+ // iDisplay->UIGetCallback( *this, CMMASurfaceWindow::EResetSurfaceParameters );
+ //MMAPI UI 3.x req.
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters : switch case EUIResourcesAndSurfaceParametersSet +");
+ iDisplay->GetCallbackInUiThread( (TInt)CMMASurfaceWindow::EResetSurfaceParameters );
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters : switch case EUIResourcesAndSurfaceParametersSet -");
+ return;
+ }
+ // break; not reachable
+ default: // can not occur
+ {
+ __ASSERT_DEBUG( EFalse, User::Invariant() );
+ }
+ break;
+ }
+
+ if ( iVideoDisplayInitState == EUIResourcesAndSurfaceParametersSet )
+ {
+ //iDisplay->UIGetCallback( *this, CMMASurfaceWindow::EInitVideoDisplay );
+ //MMAPI UI 3.x req.
+ iDisplay->GetCallbackInUiThread( (TInt)CMMASurfaceWindow::EInitVideoDisplay );
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetSurfaceParameters,EUIResourcesAndSurfaceParametersSet");
+ }
+ }
+
+void CMMASurfaceWindow::SetChangedSurfaceParameters(const TSurfaceId& aSurfaceId,
+ const TRect& aCropRect,
+ const TVideoAspectRatio& aPixelAspectRatio)
+{
+ iSurfaceId = aSurfaceId;
+ iCropRect = aCropRect;
+ iPixelAspectRatio = aPixelAspectRatio;
+
+ if (iDisplay)
+ {
+ //iDisplay->UIGetCallback(*this, CMMASurfaceWindow::ESetChangedSurfaceParameters);
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetChangedSurfaceParameters + ");
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetChangedSurfaceParameters);
+ LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetChangedSurfaceParameters - ");
+
+ }
+}
+
+void CMMASurfaceWindow::RemoveSurface()
+{
+ if (iDisplay)
+ {
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ERemoveSurface);
+ }
+}
+
+void CMMASurfaceWindow::DoRemoveSurface()
+{
+ if (iMediaClientVideoDisplay)
+ {
+ iMediaClientVideoDisplay->RemoveSurface();
+ LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
+
+ }
+}
+
+void CMMASurfaceWindow::DoResetSurfaceParameters()
+{
+ __ASSERT_DEBUG((iMediaClientVideoDisplay != NULL), User::Invariant());
+
+ if (iMediaClientVideoDisplay)
+ {
+ iMediaClientVideoDisplay->RemoveSurface();
+ TInt error = iMediaClientVideoDisplay->SurfaceCreated(iSurfaceId,
+ iCropRect,
+ iPixelAspectRatio,
+ iVideoCropRegion);
+
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::DoResetSurfaceParameters,SurfaceCreated error = %d", error);
+
+ iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
+ }
+}
+
+void CMMASurfaceWindow::DoSetChangedSurfaceParameters()
+{
+ if (iMediaClientVideoDisplay)
+ {
+ TInt error = iMediaClientVideoDisplay->SurfaceParametersChanged(iSurfaceId,
+ iCropRect,
+ iPixelAspectRatio);
+
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::DoSetChangedSurfaceParameters,SurfaceParametersChanged, error = %d", error);
+
+ iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
+ }
+}
+
+void CMMASurfaceWindow::InitVideoDisplayL()
+{
+ if (iVideoDisplayInitState != EUIResourcesAndSurfaceParametersSet)
+ {
+ User::Leave(KErrNotReady);
+ }
+
+ // check that this is the first time we are creating instance.
+ if (iMediaClientVideoDisplay)
+ {
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+
+ iMediaClientVideoDisplay =
+ CMediaClientVideoDisplay::NewL(iScreenDevice->GetScreenNumber(),
+ iSurfaceId,
+ iCropRect,
+ iPixelAspectRatio);
+
+ // video is not scaled untill user requests explicitly
+ // so retain same video width & height.
+ TReal32 scaleWidthPercent = 100.0f;
+ TReal32 scaleHeightPercent = 100.0f;
+
+ // video rotation feature not supported in MMAPI
+ TVideoRotation videoRotation(EVideoRotationNone);
+ // no automatic scaling, can be controlled only via VideoControl
+ TAutoScaleType autoScaleType = EAutoScaleNone;
+
+ // always align video to the top left corner of the display area
+ TInt horizontalPosition(EHorizontalAlignLeft);
+ TInt verticalPosition(EVerticalAlignTop);
+
+ TInt error = iMediaClientVideoDisplay->SurfaceCreated(iSurfaceId,
+ iCropRect,
+ iPixelAspectRatio,
+ iVideoCropRegion);
+
+ ELOG1( EJavaMMAPI, "MID::CMMASurfaceWindow::InitVideoDisplayL error = %d", error );
+ User::LeaveIfError(error);
+
+ iMediaClientVideoDisplay->AddDisplayWindowL(iWindow,
+ iContentRect,
+ iVideoCropRegion,
+ iContentRect,
+ scaleWidthPercent,
+ scaleHeightPercent,
+ videoRotation,
+ autoScaleType,
+ horizontalPosition,
+ verticalPosition,
+ (RWindow*)iWindow);
+
+ RedrawVideoL();
+}
+
+void CMMASurfaceWindow::CleanVideoDisplay()
+{
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::CleanVideoDisplay +" );
+
+ SetVisible(EFalse, ETrue);
+ if (iMediaClientVideoDisplay)
+ {
+ if (iWindow)
+ {
+ iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
+ }
+ iMediaClientVideoDisplay->RemoveSurface();
+ delete iMediaClientVideoDisplay;
+
+ iMediaClientVideoDisplay = NULL;
+ iWindow = NULL;
+ iScreenDevice = NULL;
+ iWs = NULL;
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::CleanVideoDisplay -" );
+}
+
+
+CMMAPlayer* CMMASurfaceWindow::UiPlayer()
+ {
+ return iPlayer;
+ }
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmavideoplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing video.
+*
+*/
+
+// INCLUDE FILES
+#include <mmf/server/mmffile.h>
+#include <logger.h>
+
+#include "cmmavideoplayer.h"
+#include "mmmadisplay.h"
+#include "mmafunctionserver.h"
+#include "cmmasurfacewindow.h"
+
+// CONSTANTS
+_LIT(KVideoControlName, "VideoControl");
+
+CMMAVideoPlayer* CMMAVideoPlayer::NewLC(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAVideoPlayer* self =
+ new(ELeave) CMMAVideoPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAVideoPlayer::~CMMAVideoPlayer()
+ {
+ LOG(EJavaMMAPI,EInfo, "MMA::CMMAVideoPlayer::~CMMAVideoPlayer" );
+
+ // Window is not able to send any
+ // callback requests to UI from now.
+ if (iSurfaceWindow)
+ {
+ iSurfaceWindow->SetDisplay(NULL);
+ }
+
+ if ( iDisplay && iDisplay->HasContainer() )
+ {
+ // Window will delete itself
+ // after all pending events are processed
+ // (lazy delete)
+// iDisplay->UIGetCallback(
+ // *iSurfaceWindow, CMMASurfaceWindow::EDestroyWindow );
+ iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EDestroyWindow );
+ }
+ else
+ {
+ delete iSurfaceWindow;
+ }
+
+ if (iDisplay)
+ {
+ TRAPD(err, iDisplay->SetWindowL(NULL));
+ if (err != KErrNone)
+ {
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ }
+
+ delete iEmptySnapshotImage;
+ delete iActiveSchedulerWait;
+}
+
+CMMAVideoPlayer::CMMAVideoPlayer(
+ CMMAMMFResolver* aResolver):
+ CMMAAudioPlayer(aResolver),
+ iVideoControllerCustomCommands(iController),
+ iVideoPlayControllerCustomCommands(iController),
+ iVideoPlaySurfaceSupportCustomCommands(iController)
+{
+ iMMASurface.iPrevSurfaceAvailable = EFalse;
+}
+
+void CMMAVideoPlayer::ConstructL()
+{
+ CMMAAudioPlayer::ConstructL();
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+}
+
+EXPORT_C void CMMAVideoPlayer::SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster)
+{
+ CMMAPlayer::SetPlayerListenerObjectL(aListenerObject,
+ aJni,
+ aEventPoster);
+
+ // this method must be called only ones
+ __ASSERT_DEBUG(!iSurfaceWindow, User::Invariant());
+
+ // create window for videoplayer
+ // event poster is always MMAFunctionServer type.
+
+ iSurfaceWindow = CMMASurfaceWindow::NewL(
+ static_cast< MMAFunctionServer* >(iEventPoster),
+ this);
+}
+
+EXPORT_C void CMMAVideoPlayer::SetDisplayL(MMMADisplay* aDisplay)
+{
+ // now it is ready to draw
+ iDisplay = aDisplay;
+ iDisplay->SetWindowL( iSurfaceWindow );
+ iSurfaceWindow->SetDisplay( aDisplay );
+ iDisplay->SetUIPlayer(this);
+
+
+/*
+ // if state < prefeteched then we dont know actual source size yet
+ // and it will be set after prefetch
+ if ( iState >= EPrefetched )
+ {
+ SourceSizeChanged();
+ }
+ */
+ }
+void CMMAVideoPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::RealizeL" );
+ // DataSource must have at least 1 stream or
+ // we must have file to play
+ if ((iSourceStreams.Count() == 0) && !iFileName)
+ {
+ User::Leave(KErrNotEnoughStreams);
+ }
+
+ // If file locator is used, then file is prefetched
+ // in realized state so that FramePositioningControl
+ // can acquire frame count in REALIZED state
+ if (iFileName)
+ {
+ PrefetchFileL();
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ // If the player has not changed state during wait,
+ // Then there is an error condition.
+ if (iState != ERealized)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ }
+ else
+ {
+ CMMAPlayer::RealizeL();
+ }
+}
+
+void CMMAVideoPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrefetchL" );
+ if (iFileName)
+ {
+ // File has already been prefetched when realizing
+
+ // If initDisplayMode was called before prefetch,
+ // then the display must notified about source size.
+ if (iDisplay)
+ {
+ SourceSizeChanged();
+ }
+
+ PostActionCompletedFile();
+ ChangeState( EPrefetched );
+ }
+ else
+ {
+ // Using TDes -- load the whole video
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+ // CMMASourceStream will notify with ReadCompleted
+}
+
+EXPORT_C void CMMAVideoPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoPlayer::ReadCompletedL: status = %d", aStatus );
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ TRAPD(err, PrefetchDataL(aData));
+ if (err != KErrNone)
+ {
+ PostActionCompleted(err);
+ }
+ // action completed event will be delivered from handleEvent
+ }
+}
+
+void CMMAVideoPlayer::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoPlayer::HandleEvent %d", aEvent.iEventType.iUid );
+
+ // event KMMFEventCategoryPlaybackComplete is handled by both Video
+ // and Audio players. first it should be handled by Video player
+ if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
+ {
+ iSurfaceWindow->RemoveSurface();
+ }
+
+ // KNotCompleteVideoError can be notified when video is not complete
+ // ( missing sound ) but still can be played. Because
+ // CMMAAudioPlayer::HandleEvent fails with all negative error codes,
+ // do not call it with KNotCompleteVideoError error when preparing.
+ if ((aEvent.iErrorCode != KNotCompleteVideoError) ||
+ (aEvent.iEventType != KMMFEventCategoryVideoPrepareComplete))
+ {
+ CMMAAudioPlayer::HandleEvent(aEvent);
+ }
+
+ if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceCreated)
+ {
+ if (aEvent.iErrorCode == KErrNone)
+ {
+ TSurfaceId surfaceId;
+ TRect cropRect;
+ TVideoAspectRatio pixelAspectRatio;
+
+ iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId,
+ cropRect,
+ pixelAspectRatio);
+
+ if (iMMASurface.iPrevSurfaceAvailable)
+ {
+ // free Surface
+ TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId);
+ if (KErrNone != error)
+ {
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode);
+ }
+ }
+ iMMASurface.iPrevSurfaceId = surfaceId;
+ iMMASurface.iPrevSurfaceAvailable = ETrue;
+
+ iSurfaceWindow->SetSurfaceParameters(surfaceId,
+ cropRect,
+ pixelAspectRatio);
+
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceCreated, surface parameters set" );
+ }
+ else
+ {
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::HandleEvent: error getting surface parameters, %d", aEvent.iErrorCode );
+ }
+ }
+ else if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceParametersChanged)
+ {
+ if (aEvent.iErrorCode == KErrNone)
+ {
+ TSurfaceId surfaceId;
+ TRect cropRect;
+ TVideoAspectRatio pixelAspectRatio;
+
+ iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId,
+ cropRect,
+ pixelAspectRatio);
+
+ if (iMMASurface.iPrevSurfaceAvailable)
+ {
+ // free Surface
+ TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId);
+ if (KErrNone != error)
+ {
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode);
+ }
+ }
+ iMMASurface.iPrevSurfaceAvailable = ETrue;
+ iMMASurface.iPrevSurfaceId = surfaceId;
+
+ iSurfaceWindow->SetChangedSurfaceParameters(surfaceId,
+ cropRect,
+ pixelAspectRatio);
+
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceParametersChanged" );
+ }
+ else
+ {
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::HandleEvent: surface parameters changed error, %d", aEvent.iErrorCode );
+ }
+ }
+ else if (aEvent.iEventType == KMMFEventCategoryVideoRemoveSurface)
+ {
+ if (aEvent.iErrorCode == KErrNone)
+ {
+ if (iMMASurface.iPrevSurfaceAvailable)
+ {
+ // free Surface
+ TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId);
+ if (KErrNone != error)
+ {
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode);
+ }
+ iMMASurface.iPrevSurfaceAvailable = EFalse;
+ }
+ }
+ else
+ {
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::HandleEvent:KMMFEventCategoryVideoRemoveSurface error, %d", aEvent.iErrorCode);
+ }
+ }
+ // video opened, preparing
+ else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
+ {
+ if (aEvent.iErrorCode == KErrNone)
+ {
+ TInt error = iVideoPlaySurfaceSupportCustomCommands.UseSurfaces();
+ ELOG1( EJavaMMAPI, "MMA::CMMAVideoPlayer::HandleEvent::After UseSurfaces(), error = %d", error );
+ TInt prepareError(iVideoPlayControllerCustomCommands.Prepare());
+ if (prepareError != KErrNone)
+ {
+ // opening failed, notifying java
+ PostActionCompleted(prepareError);
+ }
+ }
+ else
+ {
+ // opening failed, notifying java
+ PostActionCompleted(aEvent.iErrorCode);
+ }
+ }
+ // final state of prefetch ( prepare completed )
+ else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
+ {
+ // This callback must be handled differently depending on whether
+ // player is created for a file locator or for a stream. When file
+ // locator is used, this callback is made in realized state. For
+ // stream it is made in prefetched state.
+ PrepareDisplay();
+ if (iFileName)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Using filename, change state to REALIZED" );
+
+ // If there is an error condition, then the player state is not
+ // changed, which indicates the error condition to StartL when
+ // the ActiveSchedulerWait returns. KNotCompleteVideoError is not
+ // considered as an error condition, instead it indicates that some
+ // elements of the media cannot be played (e.g. video OR audio)
+ if (aEvent.iErrorCode == KErrNone ||
+ aEvent.iErrorCode == KNotCompleteVideoError)
+ {
+ ChangeState(ERealized);
+ }
+ __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant());
+ iActiveSchedulerWait->AsyncStop();
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::HandleEvent: Not using filename, change state to PREFETCHED" );
+ CompletePrefetch(aEvent.iErrorCode);
+ }
+ }
+ else // in case of any other event
+ {
+ if (aEvent.iErrorCode != KErrNone)
+ {
+ PostActionCompleted(aEvent.iErrorCode); //some other error
+ }
+ }
+}
+
+void CMMAVideoPlayer::CompletePrefetch(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "CMMAVideoPlayer::CompletePrefetch + error = %d",aError);
+ // Post KNotCompleteVideoError as KErrNone to the Java side, because
+ // video can be played.
+ if (aError == KNotCompleteVideoError)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch KNotCompleteVideoError ");
+ // release java
+ PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch CompleteVideoError ");
+ // release java
+ PostActionCompleted(aError);
+ }
+
+ if (aError == KErrNone || aError == KNotCompleteVideoError)
+ {
+ ChangeState(EPrefetched);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::CompletePrefetch - ");
+}
+
+void CMMAVideoPlayer::PrepareDisplay()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrepareDisplay +" );
+ // construction should have leaved if iSurfaceWindow does not exist
+ __ASSERT_DEBUG(iSurfaceWindow,
+ User::Panic(_L("CMMVideoPlayer::iSurfaceWindow is null"),
+ KErrArgument));
+
+ //First place where we are certain that source size can be fetched
+ TSize sourceSize;
+
+ TInt err = iVideoControllerCustomCommands.GetVideoFrameSize(sourceSize);
+
+ ELOG1( EJavaMMAPI, "MID::CMMAVideoPlayer::PrepareDisplay: GetVideoFrameSize err = %d", err );
+
+ // Still we did not get the size of video
+ if ((err != KErrNone) ||
+ (sourceSize.iWidth <= 0) ||
+ (sourceSize.iHeight <= 0))
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: No sourcesize found, using SurfaceWindow size" );
+ // setting size to window size (client rect)
+ sourceSize = iSurfaceWindow->WindowSize();
+ }
+
+ // If 1x1 was got (the default size of form), it must be replaced
+ // with a valid size as controller will not accept 1x1.
+ if ((sourceSize.iWidth < KMMAVideoMinDimension) ||
+ (sourceSize.iHeight < KMMAVideoMinDimension))
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: Unacceptable source size, using failsafe" );
+ // This is a special case and ought to be used only in
+ // the rare case that real size is not got from stream.
+ sourceSize = TSize(KMMAVideoMinDimension, KMMAVideoMinDimension);
+ }
+
+ iSourceSize = sourceSize;
+
+ // If init has been already done
+ if (iDisplay)
+ {
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAVideoPlayer::PrepareDisplay: display exists, changing source size" );
+ SourceSizeChanged();
+ }
+
+ // Setting (in)visible if something has changed the DSA state
+ // (e.g. prepare). If initDisplayMode is not called, this will always
+ // set visibility to false.
+ iSurfaceWindow->SetVisible(iSurfaceWindow->IsVisible(), EFalse);
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoPlayer::PrepareDisplay -" );
+}
+
+EXPORT_C const TDesC& CMMAVideoPlayer::Type()
+{
+ return KMMAVideoPlayer;
+}
+
+EXPORT_C TSize CMMAVideoPlayer::SourceSize()
+{
+ return iSourceSize;
+}
+
+EXPORT_C MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& /*aSize*/,
+ const CMMAImageSettings& /*aSettings*/)
+{
+ if (iEmptySnapshotImage)
+ {
+ // Ealier snapshot was not got with SnapshotBitmap method.
+ User::Leave(KErrInUse);
+ }
+ // frame can't be got from video player, but TCK requires that it should
+ // be available. So returning empty image
+ iEmptySnapshotImage = new(ELeave) CFbsBitmap();
+ User::LeaveIfError(iEmptySnapshotImage->Create(TSize(1, 1),
+ EColor4K));
+
+
+ User::RequestComplete(aStatus, KErrNone);
+
+ // Return raw bitmap encoding and thus SnapshotEncoded() should not
+ // get called later on.
+ return EBitmap;
+}
+
+EXPORT_C CFbsBitmap* CMMAVideoPlayer::SnapshotBitmap()
+{
+ // snapshot is not supported, returning empty image
+ CFbsBitmap* image = iEmptySnapshotImage;
+
+ // ownership is transferred to caller
+ iEmptySnapshotImage = NULL;
+ return image;
+}
+
+EXPORT_C HBufC8* CMMAVideoPlayer::SnapshotEncoded()
+{
+ // This method should never be called.
+ // Asserted in debug build to be sure.
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+
+ return NULL;
+}
+
+EXPORT_C void CMMAVideoPlayer::NotifyWithStringEvent(
+ CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData)
+{
+ PostStringEvent(aEventType, aStringEventData);
+}
+
+EXPORT_C MMMASnapshot* CMMAVideoPlayer::SnapshoterL()
+{
+ return this;
+}
+
+void CMMAVideoPlayer::SourceSizeChanged()
+{
+ iDisplay->SourceSizeChanged(iSourceSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/canvasdisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,149 @@
+#include "logger.h"
+#include "com_nokia_microedition_media_control_MMACanvasDisplay.h"
+#include "cmmacanvasdisplay.h"
+#include "qwidget.h"
+#include "cmmasurfacewindow.h"
+
+
+/*
+ * Class: com_nokia_microedition_media_control_mmacanvasdisplay
+ * Method: _setVisible
+ * Signature: (IIZ)I
+ */
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setVisible
+ (JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isVisible)
+ {
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setVisible +");
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TBool visible = (TBool)isVisible;
+ display ->SetVisible(visible);
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setVisible -");
+ }
+
+LOCAL_C void LocalSetContainerVisible(CMMADisplay* display,TBool visible)
+{
+ display ->SetContainerVisibility(visible);
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setContainerVisible
+(JNIEnv *, jobject,jint aEventSourceHandle, jint nativeDisplayHandle, jboolean isActive)
+{
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setContainerVisible +");
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+ // need to call in Function server thread context because CMMADisplay's JNI pointer
+ // is valid in that thread context only.
+
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TBool visible = (TBool)isActive;
+
+ TInt error = eventSource->ExecuteTrap(&LocalSetContainerVisible,
+ display,
+ visible);
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setContainerVisible -");
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setFullScreenMode
+(JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isFullScreen)
+{
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setFullScreenMode +");
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TBool mode = (TBool)isFullScreen;
+ display ->SetFullScreenL(mode);
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setFullScreenMode -");
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setWindowToNative
+(JNIEnv *, jobject,jint nativeDisplayHandle, jint qtWidgetHandle)
+{
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setWindowToNative + ");
+ QWidget *widget = reinterpret_cast<QWidget*>(qtWidgetHandle);
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ display->SetWindowResources(widget);
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setWindowToNative - ");
+}
+
+
+/*
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1nativeDummy
+(JNIEnv *, jobject,)
+{
+*/
+
+LOCAL_C void LocalSourceSizeChanged(CMMADisplay* display,TInt width,TInt height)
+{
+ display->SourceSizeChanged(width,height);
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setNativeWindowSize
+(JNIEnv *, jobject,jint nativeDisplayHandle, jint aEventSourceHandle, jint eswtControlwidth,jint eswtControlheight)
+{
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setNativeWindowSize + ");
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TInt width = eswtControlwidth;
+ TInt height = eswtControlheight;
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+ // need to call in Function server thread context because CMMADisplay's JNI pointer
+ // is valid in that thread context only.
+ TInt error = eventSource->ExecuteTrap(&LocalSourceSizeChanged,
+ display,
+ width,
+ height);
+
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setNativeWindowSize - ");
+}
+
+LOCAL_C void LocalSetDisplayPosition(CMMADisplay* display,TInt uiX,TInt uiY,TInt vcX,TInt vcY)
+{
+ display->SetDisplayPosition(uiX,uiY,vcX,vcY);
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setPosition
+(JNIEnv *, jobject,jint nativeDisplayHandle,jint aEventSourceHandle,jint uiX,jint uiY,jint vcX,jint vcY)
+{
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setPosition + ");
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TInt uiControlLocationX = uiX;
+ TInt uiControlLocationY = uiY;
+ TInt videoControlLocationX = vcX;
+ TInt videoControlLocationY = vcY;
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+ // need to call in Function server thread context because CMMADisplay's JNI pointer
+ // is valid in that thread context only.
+ TInt error = eventSource->ExecuteTrap(&LocalSetDisplayPosition,
+ display,
+ uiControlLocationX,
+ uiControlLocationY,
+ videoControlLocationX,
+ videoControlLocationY);
+
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setPosition - ");
+}
+
+
+
+
+LOCAL_C void LocalSetDisplaySize(CMMADisplay* display,TInt vcX,TInt vcY)
+{
+ LOG2(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : LocalSetDisplaySize vcX = %d,vcY=%d ",vcX,vcY);
+ TSize size(vcX,vcY);
+ display->SetDisplaySizeL(size);
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_MMACanvasDisplay__1setDisplaySize
+(JNIEnv *, jobject,jint nativeDisplayHandle,jint aEventSourceHandle,jint width,jint height)
+{
+ LOG2(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setDisplaySize + width = %d,height = %d",width,height);
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ TInt vc_width = width;
+ TInt vc_height = height;
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
+ // need to call in Function server thread context because CMMADisplay's JNI pointer
+ // is valid in that thread context only.
+ LOG2(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setDisplaySize + vc_width = %d,vc_height = %d",vc_width,vc_height);
+ TInt error = eventSource->ExecuteTrap(&LocalSetDisplaySize,
+ display,
+ vc_width,
+ vc_height);
+
+ LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : _setDisplaySize - ");
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudiometadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAAudioMetaDataControl is a concrete class for getting
+* metadata from an audio media.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaaudiometadatacontrol.h"
+
+CMMAAudioMetaDataControl::CMMAAudioMetaDataControl(
+ RMMFController& aController)
+ : iController(aController)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioMetaDataControl constructor called.");
+}
+
+TInt CMMAAudioMetaDataControl::KeyCountL()
+{
+ TInt entries = 0;
+
+ User::LeaveIfError(iController.GetNumberOfMetaDataEntries(entries));
+ return entries;
+}
+
+HBufC* CMMAAudioMetaDataControl::KeyL(TInt aIndex)
+{
+ CMMFMetaDataEntry* currEntry = NULL;
+
+ currEntry = iController.GetMetaDataEntryL(aIndex);
+ CleanupStack::PushL(currEntry);
+ HBufC* key = currEntry->Name().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+
+ return key;
+}
+
+
+/*
+ * Get the value of given audio metadata key. The ownership of the created value
+ * (descriptor) is passed to the caller.
+ */
+HBufC* CMMAAudioMetaDataControl::KeyValueL(const TDesC& aKey)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioMetaDataControl::GetKeyValueL() called.");
+
+ HBufC* retVal = NULL;
+ CMMFMetaDataEntry* currEntry = NULL;
+
+ TInt nEntries = 0;
+ User::LeaveIfError(iController.GetNumberOfMetaDataEntries(nEntries));
+
+ for (TInt i = 0; i < nEntries; ++i)
+ {
+ currEntry = iController.GetMetaDataEntryL(i);
+
+ if (0 == aKey.Compare(currEntry->Name()))
+ {
+ CleanupStack::PushL(currEntry);
+ retVal = currEntry->Value().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+ break;
+ }
+
+ delete currEntry;
+ }
+
+ User::LeaveIfNull(retVal);
+ return retVal;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudioplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmfdes.h>
+#include <mmf/server/mmffile.h>
+#include <AudioPreference.h>
+#include <logger.h>
+#include "cmmaaudioplayer.h"
+
+const TInt KPlayerPriority = KAudioPriorityRecording;
+const TInt KErrorMessageSize = 32;
+
+const TUid KSourceUid = { KMmfUidDescriptorSource };
+const TUid KFileSourceUid = { KMmfUidFileSource };
+_LIT(KErrDefaultError, "Symbian OS Error: %d");
+
+const TInt KMinIntervalBeforePrime = 0;
+
+CPlaybackCompletedCallback* CPlaybackCompletedCallback::NewL(MPlaybackCompletedCallback& aObs)
+{
+ CPlaybackCompletedCallback* self = new(ELeave)CPlaybackCompletedCallback(aObs);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CPlaybackCompletedCallback::~CPlaybackCompletedCallback()
+{
+ Cancel();
+}
+
+void CPlaybackCompletedCallback::RunL()
+{
+ iObs.HandlePlaybackCompleteL();
+}
+
+TInt CPlaybackCompletedCallback::RunError(TInt aError)
+{
+ iObs.ErrorPlaybackComplete(aError);
+ return KErrNone;
+}
+
+CPlaybackCompletedCallback::CPlaybackCompletedCallback(MPlaybackCompletedCallback& aObs)
+ : CTimer(EPriorityStandard), iObs(aObs)
+{
+ CActiveScheduler::Add(this);
+}
+
+void CPlaybackCompletedCallback::Callback()
+{
+ if (!IsActive())
+ After(KMinIntervalBeforePrime);
+}
+
+CMMAAudioPlayer* CMMAAudioPlayer::NewLC(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAAudioPlayer* self = new(ELeave) CMMAAudioPlayer(aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+
+CMMAAudioPlayer::~CMMAAudioPlayer()
+{
+
+ delete iPlaybackCompleted;
+}
+
+
+CMMAAudioPlayer::CMMAAudioPlayer(
+ CMMAMMFResolver* aResolver):
+ CMMAMMFPlayerBase(aResolver)
+{
+}
+
+
+void CMMAAudioPlayer::ConstructL()
+{
+ CMMAMMFPlayerBase::ConstructL();
+
+ iPlaybackCompleted = CPlaybackCompletedCallback::NewL(*this);
+}
+
+
+EXPORT_C void CMMAAudioPlayer::PrefetchDataL(const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::PrefetchDataL aData size %d",
+ aData.Size());
+
+ // player priority settings
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = KPlayerPriority;
+ prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality;
+ prioritySettings.iState = EMMFStatePlaying;
+
+ TMMFDescriptorConfig srcConfig;
+ srcConfig().iDes = (TAny*)&aData; // wants pointer to TPtr8
+ srcConfig().iDesThreadId = RThread().Id();
+
+ User::LeaveIfError(DoOpen(KSourceUid,
+ srcConfig,
+ KUidMmfAudioOutput,
+ KNullDesC8,
+ prioritySettings));
+
+ User::LeaveIfError(iController.Prime());
+}
+
+EXPORT_C void CMMAAudioPlayer::PrefetchFileL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAAudioPlayer::Prefetching from file");
+
+ // player priority settings
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = KPlayerPriority;
+ prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality;
+ prioritySettings.iState = EMMFStatePlaying;
+
+ TMMFFileConfig srcConfig;
+ srcConfig().iPath = iFileName->Des();
+
+ User::LeaveIfError(DoOpen(KFileSourceUid,
+ srcConfig,
+ KUidMmfAudioOutput,
+ KNullDesC8,
+ prioritySettings));
+
+ User::LeaveIfError(iController.Prime());
+}
+
+EXPORT_C void CMMAAudioPlayer::PlayCompleteL(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL +");
+ TInt64 time;
+ GetDuration(&time);
+ iMediaTime = time;
+ iStartedEventTime = 0;
+
+ ChangeState(EPrefetched); // ready to play again
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, time);
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ // priming again for allowing e.g. mediatime setting
+ User::LeaveIfError(iController.Prime());
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+
+ TTimeIntervalMicroSeconds position(0);
+ User::LeaveIfError(iController.SetPosition(position));
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PlayCompleteL -");
+}
+
+void CMMAAudioPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::RealizeL");
+ // DataSource must have at least 1 stream or
+ // we must have file to play
+ if ((iSourceStreams.Count() == 0) && !iFileName)
+ {
+ User::Leave(KErrNotEnoughStreams);
+ }
+ CMMAPlayer::RealizeL();
+}
+
+
+void CMMAAudioPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioPlayer::PrefetchL");
+ __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant());
+
+ if (iFileName)
+ {
+ // prefetching the file
+ PrefetchFileL();
+ // we can go to prefetched state immediately
+ PostActionCompletedFile();
+ ChangeState(EPrefetched);
+ //PostActionCompleted(KErrNone);
+ }
+ else
+ {
+ // Using TDes -- load the whole sound
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+ // CMMASourceStream will notify with ReadCompleted
+}
+
+const TDesC& CMMAAudioPlayer::Type()
+{
+ return KMMAAudioPlayer;
+}
+
+//
+// CMMASourceStreamReader finished read operation
+// This is called when ReadL is completed in Prefetch()
+//
+void CMMAAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioPlayer::ReadCompletedL: status = %d", aStatus);
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ TRAPD(err, PrefetchDataL(aData));
+ if (err == KErrNone)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(err);
+ }
+}
+
+
+void CMMAAudioPlayer::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::HandleEvent");
+ TInt err = aEvent.iErrorCode;
+ if (iState == EStarted)
+ {
+ // normal situation; will loop in PlayCompleteL if looping is set
+ if ((err == KErrEof || err == KErrUnderflow || err == KErrNone)
+ && aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
+ {
+ iPlaybackCompleted->Callback();
+ }
+ }
+
+ if (err == KErrDied && aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
+ {
+
+ // basically pausing the playback
+ //1. when the phone call is received/answered , the player will be pushed to pause state and phone call is given high priority.
+ //2. when the call ends the player will still be in pause state , In this case the user should resume the player.
+ err = iController.Pause();
+
+ if (iState == EStarted)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ iStartedEventTime = time;
+ LOG( EJavaMMAPI, EInfo, "MID::CMMAAudioPlayer::Going to ChangeState( EPrefetched );");
+
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ ChangeState(EPrefetched);
+ }
+ }
+
+ if (err != KErrNone && err != KErrDied)
+ {
+ ErrorPlaybackComplete(err);
+ }
+}
+
+EXPORT_C void CMMAAudioPlayer::HandlePlaybackCompleteL()
+{
+ PlayCompleteL(KErrNone);
+}
+
+EXPORT_C void CMMAAudioPlayer::ErrorPlaybackComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MID::CMMAAudioPlayer::ErrorPlaybackComplete: aError = %d", aError);
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, aError);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+
+ // Preparing controller for next try
+ TInt err = iController.Prime();
+ if (err != KErrNone)
+ {
+ // Prime failed
+ errorMessage.Format(KErrDefaultError, err);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ // we cannot recover, going back to unrealized state
+ ChangeState(EUnrealized);
+ return;
+ }
+
+ // If player was in started state, then error will change state to
+ // EPrefetched. In other cases the old state is retained.
+ if (iState == EStarted)
+ {
+ ChangeState(EPrefetched);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudioplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating wav player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cmmaaudioplayerfactory.h"
+#include "cmmaaudioplayer.h"
+#include "cmmaaudiovolumecontrol.h"
+#include "cmmastoptimecontrol.h"
+#include "cmmaaudiometadatacontrol.h"
+#include "cmmammfratecontrol.h"
+
+_LIT(KMMAMP3ContentType, "audio/mp3");
+_LIT(KMMAMPEGContentType, "audio/mpeg");
+
+CMMAAudioPlayerFactory* CMMAAudioPlayerFactory::NewLC()
+{
+ CMMAAudioPlayerFactory* pFactory =
+ new(ELeave) CMMAAudioPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAAudioPlayerFactory::CMMAAudioPlayerFactory()
+{
+}
+
+
+CMMAAudioPlayerFactory::~CMMAAudioPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAAudioPlayerFactory::CreatePlayerL(const TDesC& aContentType)
+{
+ CMMAPlayer* player = NULL;
+ if (aContentType == KMMAMP3ContentType)
+ {
+ // If 'mp3' use 'mpeg' to create player, because audio controller
+ // does not recognize mp3
+ player = CMMAMMFPlayerFactory::CreatePlayerL(KMMAMPEGContentType);
+ }
+ else
+ {
+ player = CMMAMMFPlayerFactory::CreatePlayerL(aContentType);
+ }
+ return player;
+}
+
+CMMAPlayer* CMMAAudioPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAAudioPlayer* player = CMMAAudioPlayer::NewLC(aResolver);
+
+ CMMAAudioVolumeControl* volumeControl = CMMAAudioVolumeControl::NewL(player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+ CMMAAudioMetaDataControl* metaDataControl =
+ new(ELeave) CMMAAudioMetaDataControl(player->Controller());
+ CleanupStack::PushL(metaDataControl);
+ player->AddControlL(metaDataControl);
+ CleanupStack::Pop(metaDataControl);
+
+ CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ CMMAMMFRateControl* rateControl = CMMAMMFRateControl::NewL(player);
+ CleanupStack::PushL(rateControl);
+ player->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+
+ CleanupStack::Pop(player);
+
+ return player;
+}
+
+void CMMAAudioPlayerFactory::GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray)
+{
+ // protocol is empty string all types must be returned.
+ if (IsSupportedProtocolL(aProtocol) ||
+ (aProtocol == KNullDesC))
+ {
+ // mp3 is not supported in the mmf, but support is
+ // added in CreatePlayerL( const TDesC& aContentType ) method.
+ aMimeTypeArray.AppendL(KMMAMP3ContentType);
+
+ // all other types from mmf
+ CMMAMMFPlayerFactory::GetSupportedContentTypesL(aProtocol,
+ aMimeTypeArray);
+ }
+}
+
+void CMMAAudioPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio));
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudiorecordcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RecordControl for AudioRecorder
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaaudiorecordcontrol.h"
+
+
+CMMAAudioRecordControl* CMMAAudioRecordControl::NewL(
+ CMMAAudioRecorder* aRecorder)
+{
+ CMMAAudioRecordControl* self = new(ELeave) CMMAAudioRecordControl(aRecorder);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ aRecorder->InitializeL(&self->iFile, self);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+CMMAAudioRecordControl::~CMMAAudioRecordControl()
+{
+ // close controller to free temp file
+ if (iRecorder)
+ {
+ iRecorder->Deinitialize();
+ }
+}
+
+
+CMMAAudioRecordControl::CMMAAudioRecordControl(CMMAAudioRecorder* aRecorder):
+ CMMARecordControl(aRecorder)
+{
+ iRecorder = aRecorder;
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecordControl()");
+}
+
+void CMMAAudioRecordControl::DoStartRecordL()
+{
+ iRecorder->StartRecordL();
+}
+
+void CMMAAudioRecordControl::DoStopRecordL()
+{
+ iRecorder->StopRecordL();
+}
+
+void CMMAAudioRecordControl::DoResetL()
+{
+ iRecorder->ResetL();
+}
+
+void CMMAAudioRecordControl::InitializeL()
+{
+ // already initialized, empty implementation
+}
+
+TInt CMMAAudioRecordControl::SetRecordSizeLimitL(TInt aSize)
+{
+ return iRecorder->SetRecordSizeLimitL(aSize);
+}
+
+void CMMAAudioRecordControl::HandleEvent(const TMMFEvent& aEvent)
+{
+ ELOG2( EJavaMMAPI, "MMA:CMMAAudioRecordControl::HandleEvent(type=%x,err=%d)",
+ aEvent.iEventType.iUid, aEvent.iErrorCode);
+ if (iState == ERecordRecording)
+ {
+ // Event's error code is KErrEof or KErrNone when record size limit
+ // is reached. When controller is stopped from java error code is
+ // KErrNone.
+ if ((aEvent.iEventType == KMMFEventCategoryPlaybackComplete) &&
+ ((aEvent.iErrorCode == KErrNone) ||
+ (aEvent.iErrorCode == KErrEof)))
+ {
+ HandleRecordSizeLimit();
+ }
+ else if (aEvent.iErrorCode != KErrNone)
+ {
+ Error(aEvent.iErrorCode);
+ }
+ }
+}
+
+// END OF FILE
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudiorecorder.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,391 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for recording Audio
+*
+*/
+
+
+#include <logger.h>
+#include <mmf/server/mmffile.h>
+#include <mmf/server/mmfdes.h>
+#include <mmfformatimplementationuids.hrh>
+#include "cmmaaudiorecorder.h"
+#include "cmmaoutputstream.h"
+
+const TInt KDefaultSize = KMaxTInt32; // Default record size limit
+
+CMMAAudioRecorder* CMMAAudioRecorder::NewLC(
+ CMMAMMFResolver* aResolver,
+ CMMAAudioSettings* aAudioSettings,
+ TInt aMIDletSuiteID)
+{
+ // Not using ELeave to avoid leave before owneship change of settings
+ CMMAAudioRecorder* self = new CMMAAudioRecorder(aResolver, aMIDletSuiteID);
+ if (!self)
+ {
+ delete aAudioSettings;
+ User::Leave(KErrNoMemory);
+ }
+ // Take the ownership of setting before any possible leaves
+ self->iSettings = aAudioSettings;
+ CleanupStack::PushL(self);
+ self->iWait = new(ELeave) CActiveSchedulerWait();
+ self->ConstructL();
+ return self;
+}
+
+
+CMMAAudioRecorder::~CMMAAudioRecorder()
+{
+ iFile.Close();
+ delete iSettings;
+ delete iWait;
+}
+
+
+CMMAAudioRecorder::CMMAAudioRecorder(
+ CMMAMMFResolver* aResolver,
+ TInt /*aMIDletSuiteID*/):
+ CMMAMMFPlayerBase(aResolver),
+ iAudioRecordControllerCustomCommands(iController),
+ iAudioControllerRecCustomCommands(iController),
+ iRecordSizeLimit(KDefaultSize),
+ iPauseError(KErrNone),
+ iEOFReached(EFalse)
+{
+}
+
+/**
+ * start the play
+ */
+void CMMAAudioRecorder::StartL()
+{
+ TInt64 time;
+ GetMediaTime(&time);
+
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ ChangeState(EStarted);
+ PostActionCompletedStart();
+}
+
+
+void CMMAAudioRecorder::StopL(TBool aPostEvent)
+{
+ if (iState == EStarted)
+ {
+ ChangeState(EPrefetched);
+ }
+
+ if (aPostEvent)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+}
+
+void CMMAAudioRecorder::DoOpenL()
+{
+ // Make sure any existing controller is closed.
+ iEventMonitor->Cancel();
+ iController.Close();
+
+ // player priority settings
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = EMdaPriorityMax;
+ prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality;
+ prioritySettings.iState = EMMFStateRecording;
+
+ // Try opening and configuring each controller in turn
+ TInt error = KErrNotSupported;
+ TInt index = 0;
+
+ // Try controllers until found a good controller or out of list
+ while ((error != KErrNone) &&
+ (index < iControllerInfos->Count()))
+ {
+ // Open the controller
+ error = iController.Open((*iControllerInfos)[ index ]->Uid(),
+ prioritySettings);
+
+ // If the controller was opened without error, start receiving events from it.
+ if (!error)
+ {
+ iEventMonitor->Start();
+
+ // Add the data source to the controller.
+ error = iController.AddDataSource(KUidMmfAudioInput, KNullDesC8);
+ }
+
+ // Add the data sink
+ if (!error)
+ {
+ TMMFFileHandleParams params(&iFile);
+ TPckg<TMMFFileHandleParams> paramPckg = params;
+ error = iController.AddDataSink(KUidMmfFileSink, paramPckg, iSinkInfo);
+ }
+
+ // If an error occurred in any of the above, close the controller.
+ if (error)
+ {
+ iEventMonitor->Cancel();
+ iController.Close();
+ }
+
+ index++;
+ }
+ User::LeaveIfError(error);
+
+ HBufC8* contentType8 = HBufC8::NewLC(iContentType->Length());
+ contentType8->Des().Copy(*iContentType);
+
+ TInt cInfoCount = iControllerInfos->Count();
+ for (TInt i = 0; i < cInfoCount; i++)
+ {
+ CMMFControllerImplementationInformation* contrInfo = (*iControllerInfos)[ i ];
+ const RMMFFormatImplInfoArray& recordFormats = contrInfo->RecordFormats();
+
+ for (TInt formatIndex = 0; formatIndex < recordFormats.Count(); formatIndex++)
+ {
+ CMMFFormatImplementationInformation* formatInfo = recordFormats[ formatIndex ];
+
+ if (formatInfo->SupportsMimeType(*contentType8))
+ {
+ iSupplier.Set(formatInfo->Supplier());
+ // Some of the controllers those support only one format can return KErrNotSupported
+ // error when setting the format, but still they can record that only supported format
+ // Ignoring this error
+ TInt err = iAudioControllerRecCustomCommands.SetSinkFormat(formatInfo->Uid());
+ if ((err != KErrNotSupported))
+ {
+ User::LeaveIfError(err);
+ }
+ break;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(contentType8);
+
+ // Do not set codec if it is default
+ if (iSettings->iDataType != TFourCC(KFourCCNULL))
+ {
+ User::LeaveIfError(
+ iAudioControllerRecCustomCommands.SetCodec(KFourCCNULL, iSettings->iDataType));
+ }
+
+ // set the audio data settings ie sample rate & channels, if not defaults
+ if (iSettings->iRate != KDefaultRate)
+ {
+ User::LeaveIfError(
+ iAudioControllerRecCustomCommands.SetSinkSampleRate(iSettings->iRate));
+ }
+
+ if (iSettings->iChannels != KDefaultChannels)
+ {
+ User::LeaveIfError(
+ iAudioControllerRecCustomCommands.SetSinkNumChannels(iSettings->iChannels));
+ }
+}
+
+void CMMAAudioRecorder::PrefetchL()
+{
+ if (iResetController)
+ {
+ DoOpenL();
+ }
+ User::LeaveIfError(iController.Prime());
+ //PostActionCompleted(KErrNone);
+ PostActionCompletedFile();
+ ChangeState(EPrefetched);
+}
+
+void CMMAAudioRecorder::InitializeL(RFile* aFile,
+ MMMFControllerEventMonitorObserver* aObserver)
+{
+ iFile.Duplicate(*aFile);
+ iObserver = aObserver;
+ DoOpenL();
+}
+
+void CMMAAudioRecorder::Deinitialize()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::Deinitialize++");
+ if (iEventMonitor)
+ {
+ iEventMonitor->Cancel();
+ }
+ iController.Close();
+ iFile.Close();
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::Deinitialize--");
+}
+
+const TDesC& CMMAAudioRecorder::Type()
+{
+ return KMMAAudioRecorder;
+}
+
+void CMMAAudioRecorder::StartRecordL()
+{
+ if (iResetController)
+ {
+ iResetController = EFalse;
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StartRecordL reopen controller");
+ DoOpenL();
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StartRecordL reopen done");
+ }
+
+
+ User::LeaveIfError(
+ iAudioRecordControllerCustomCommands.SetMaxFileSize(iRecordSizeLimit));
+
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StartRecordL Max File size set %d", iRecordSizeLimit);
+
+ User::LeaveIfError(iController.Prime());
+ User::LeaveIfError(iController.Play());
+}
+
+
+void CMMAAudioRecorder::StopRecordL()
+{
+ // ! here is the workaround for pause
+ // Pause() doesn't work with all formats.
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StopRecordL Stopping");
+
+ TInt pauseError = iController.Pause();
+ // if EOF is already reached return without
+ // doing any operation because controller is
+ // already in Stopped state
+ if (iEOFReached && (KErrNotReady == pauseError))
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StopRecordL, EOF reached already");
+ iEOFReached = EFalse;
+ return;
+ }
+ if (pauseError == KErrNotSupported)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StopRecordL Stopped instead pause");
+ User::LeaveIfError(iController.Stop());
+ }
+ else
+ {
+ User::LeaveIfError(pauseError);
+// wait only in HW
+#ifndef __WINS__
+ LOG( EJavaMMAPI, EInfo, "CMMAAudioRecorder::StopRecordL Stopped waiting");
+ // wait for playback complete event
+ if (!iWait->IsStarted())
+ {
+ iWait->Start();
+ }
+ User::LeaveIfError(iError);
+#endif
+ }
+
+
+ // prime controller and set position back to end (autorewind in controller)
+ User::LeaveIfError(iController.Prime());
+
+ TTimeIntervalMicroSeconds position(0);
+ User::LeaveIfError(iController.GetDuration(position));
+ User::LeaveIfError(iController.SetPosition(position));
+}
+
+void CMMAAudioRecorder::GetDuration(TInt64* aDuration)
+{
+ // Return -1 in realized state in order to pass END_OF_MEDIA
+ // tests in TCK. MMFPlayerbase would return 0.
+ if (iState == ERealized)
+ {
+ *aDuration = KTimeUnknown;
+ }
+ else
+ {
+ CMMAMMFPlayerBase::GetDuration(aDuration);
+ }
+}
+
+void CMMAAudioRecorder::DeallocateL()
+{
+ // set control to be reopened since
+ // deallocate closes it
+ if (iState == EPrefetched)
+ {
+ iResetController = ETrue;
+ }
+ CMMAMMFPlayerBase::DeallocateL();
+}
+
+void CMMAAudioRecorder::ResetL()
+{
+ iResetController = ETrue;
+}
+
+const TInt KMMASymbianControllerLimit = 4096 + 44; // buffer size + header
+_LIT(KSymbian, "Symbian");
+
+TInt CMMAAudioRecorder::SetRecordSizeLimitL(TInt aSize)
+{
+ iRecordSizeLimit = aSize;
+
+ // Wav and AU controller (supplied from symbian) is recording in 4kb buffers
+ // this controller does not record at all if size is smaller than 4kb and
+ // goes even in wierd state.
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioRecorder::SetRecordSizeLimitL Supplier = %S", iSupplier.Ptr());
+ if ((iSupplier == KSymbian) &&
+ (aSize < KMMASymbianControllerLimit))
+ {
+ iRecordSizeLimit = KMMASymbianControllerLimit;
+ }
+
+ // normal case is that recordsize is set just before starting
+ if (iState == EStarted)
+ {
+ LOG1( EJavaMMAPI, EInfo, "CMMAAudioRecorder::SetRecordSizeLimitL Setting while playing limit: %d", iRecordSizeLimit);
+ // trying to set max file size while recording
+ User::LeaveIfError(
+ iAudioRecordControllerCustomCommands.SetMaxFileSize(iRecordSizeLimit));
+ }
+ return iRecordSizeLimit;
+}
+
+void CMMAAudioRecorder::HandleEvent(const TMMFEvent& aEvent)
+{
+ ELOG1( EJavaMMAPI, "CMMAAudioRecorder::HandleEvent event error: %d", aEvent.iErrorCode);
+
+ if (KErrEof == aEvent.iErrorCode)
+ {
+ iEOFReached = ETrue;
+ }
+ // if we are waiting event
+ if (iWait->IsStarted())
+ {
+ iError = aEvent.iErrorCode;
+ iWait->AsyncStop();
+ return;
+ }
+ TMMFEvent event = aEvent;
+ if ((event.iEventType == KMMFEventCategoryPlaybackComplete) &&
+ ((event.iErrorCode == KErrNone) ||
+ (event.iErrorCode == KErrEof)))
+ {
+ // Prime controller after playback complete, in order to get position/duration
+ event.iErrorCode = iController.Prime();
+ }
+ if (iObserver)
+ {
+ iObserver->HandleEvent(event);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudiorecorderfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating audio recorder
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmmaaudiorecorderfactory.h"
+#include "cmmaaudiorecordcontrol.h"
+#include "cmmammfresolver.h"
+
+_LIT(KCaptureProtocol, "capture");
+_LIT(KAudioRecord, "audio");
+_LIT(KContentTypeAudioMp4NotIncluded, "audio/mp4");
+
+CMMAAudioRecorderFactory* CMMAAudioRecorderFactory::NewLC(TInt aMIDletSuiteID)
+{
+ CMMAAudioRecorderFactory* pFactory =
+ new(ELeave) CMMAAudioRecorderFactory(aMIDletSuiteID);
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+
+CMMAAudioRecorderFactory::CMMAAudioRecorderFactory(TInt aMIDletSuiteID)
+{
+ iMIDletSuiteID = aMIDletSuiteID;
+}
+
+
+CMMAAudioRecorderFactory::~CMMAAudioRecorderFactory()
+{
+ delete iSettings;
+}
+
+CMMAPlayer* CMMAAudioRecorderFactory::CreatePlayerL(const TDesC&)
+{
+ // record player cannot be created from content-type, since this is used only
+ // when we have also data
+ return NULL;
+}
+
+
+CMMAPlayer* CMMAAudioRecorderFactory::CreatePlayerL(const TDesC8&)
+{
+ // record player cannot be created with header data
+ return NULL;
+}
+
+CMMAPlayer* CMMAAudioRecorderFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ // settings ownership transferred to audiorecorder
+ CMMAAudioSettings* tmpSettings = iSettings;
+ iSettings = NULL;
+ CMMAAudioRecorder* recorder = CMMAAudioRecorder::NewLC(aResolver,
+ tmpSettings,
+ iMIDletSuiteID);
+
+
+
+ CMMAAudioRecordControl* audioRecordControl = CMMAAudioRecordControl::NewL(recorder);
+ CleanupStack::PushL(audioRecordControl);
+ recorder->AddControlL(audioRecordControl);
+ CleanupStack::Pop(audioRecordControl);
+
+ CleanupStack::Pop(recorder);
+
+ return recorder;
+}
+
+
+void CMMAAudioRecorderFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio));
+}
+
+void CMMAAudioRecorderFactory::PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection)
+{
+ aResolver->SetRequiredRecordFormatSupportL(*aFormatSelection);
+}
+
+CMMAPlayer* CMMAAudioRecorderFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // check that locator is capture:://audio
+ if ((aProtocol != KCaptureProtocol) ||
+ (aMiddlePart != KAudioRecord))
+ {
+ return NULL;
+ }
+
+ // validate properties
+ CMMAAudioSettings* settings =
+ TMMAParameterValidator::ValidateAudioPropertiesL(aParameters);
+ delete iSettings;
+ iSettings = settings;
+
+ // Find controller with content-type
+ return CMMAMMFPlayerFactory::CreatePlayerL(*iSettings->iContentType);
+}
+
+void CMMAAudioRecorderFactory::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ // Support for MP4 recording disabled: All features cannot
+ // be supported for MP4 capture at the moment (e.g. pause)
+ if (IsSupportedContentTypeL(aContentType) &&
+ (aContentType != KContentTypeAudioMp4NotIncluded))
+ {
+ aProtocolArray.AppendL(KMMACaptureProtocol);
+ }
+}
+
+void CMMAAudioRecorderFactory::GetSupportedContentTypesL(
+ const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray)
+{
+ // protocol is empty string all types must be returned.
+ if (IsSupportedProtocolL(aProtocol) ||
+ (aProtocol == KNullDesC))
+ {
+ // get supported types from MMF
+ CMMAMMFPlayerFactory::GetSupportedContentTypesL(aProtocol,
+ aMimeTypeArray);
+
+ // "audio/mp4" content type must not be supported
+ // for capture protocol
+ if (aProtocol == KCaptureProtocol)
+ {
+ TInt position(0);
+ TInt err = aMimeTypeArray.Find(KContentTypeAudioMp4NotIncluded, position);
+ if (err == KErrNone)
+ {
+ aMimeTypeArray.Delete(position);
+ aMimeTypeArray.Compress();
+ }
+ }
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaaudiovolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#include <logger.h>
+#include "cmmaaudiovolumecontrol.h"
+#include "cmmaaudioplayer.h"
+
+
+CMMAAudioVolumeControl::CMMAAudioVolumeControl(CMMAAudioPlayer* aPlayer)
+ : CMMAVolumeControl(aPlayer),
+ iAudioPlayDeviceCommands(aPlayer->Controller())
+{
+}
+
+void CMMAAudioVolumeControl::ConstructL()
+{
+ ConstructBaseL();
+}
+
+EXPORT_C CMMAAudioVolumeControl* CMMAAudioVolumeControl::NewL(CMMAAudioPlayer* aPlayer)
+{
+ CMMAAudioVolumeControl* self = new(ELeave)CMMAAudioVolumeControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+
+void CMMAAudioVolumeControl::DoSetLevelL(TInt aLevel)
+{
+ TInt maxVolume = 0;
+ User::LeaveIfError(iAudioPlayDeviceCommands.GetMaxVolume(maxVolume));
+ // aLevel is the desired volume in range 0..100
+ User::LeaveIfError(iAudioPlayDeviceCommands.SetVolume(
+ aLevel * maxVolume / KMMAVolumeMaxLevel));
+}
+
+TInt CMMAAudioVolumeControl::DoGetLevelL()
+{
+ TInt maxVolume = 0;
+ User::LeaveIfError(iAudioPlayDeviceCommands.GetMaxVolume(maxVolume));
+ __ASSERT_DEBUG(maxVolume != 0, User::Invariant());
+ TInt volume = 0;
+ User::LeaveIfError(iAudioPlayDeviceCommands.GetVolume(volume));
+ // result is in range 0..100
+ return (volume * KMMAVolumeMaxLevel / maxVolume);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmabitmapwindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This abstract class implements MMMADisplayWindow functionality
+* in CFbsBitmap based displays.
+*
+*/
+
+
+// Include Files
+#include <logger.h>
+#include <bitdev.h>
+#include <AknIconUtils.h>
+#include "cmmabitmapwindow.h"
+
+// Destructor (virtual by CBase)
+CMMABitmapWindow::~CMMABitmapWindow()
+{
+ delete iBitmap;
+ delete iBitmapDevice;
+ delete iBitmapContext;
+}
+
+CMMABitmapWindow* CMMABitmapWindow::NewL()
+{
+ CMMABitmapWindow* self = new(ELeave)CMMABitmapWindow();
+ return self;
+}
+
+CMMABitmapWindow::CMMABitmapWindow():
+ iDrawRect(0, 0, 0, 0),
+ iClientRect(0, 0, 0, 0)
+{
+}
+
+void CMMABitmapWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
+{
+ CFbsBitmap* bitmap = new(ELeave)CFbsBitmap();
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Duplicate(aBitmap->Handle()));
+
+ // create context for bitmap
+ CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(aBitmap);
+ CleanupStack::PushL(bitmapDevice);
+
+
+ CGraphicsContext* bitmapContext = NULL;
+ User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext));
+
+ CleanupStack::Pop(bitmapDevice); // bitmapDevice
+ CleanupStack::Pop(bitmap); // bitmap
+
+ delete iBitmap;
+ iBitmap = bitmap;
+ delete iBitmapDevice;
+ iBitmapDevice = bitmapDevice;
+ delete iBitmapContext;
+ iBitmapContext = bitmapContext;
+
+ if (iDrawRect.IsEmpty())
+ {
+ iDrawRect.SetSize(iBitmap->SizeInPixels());
+ }
+}
+
+void CMMABitmapWindow::DrawFrameL(const CFbsBitmap* aBitmap)
+{
+ if (iBitmap)
+ {
+ // leave in this function will panic thread
+ CFbsBitmap* bitmap = new(ELeave)CFbsBitmap();
+ CleanupStack::PushL(bitmap);
+ User::LeaveIfError(bitmap->Duplicate(aBitmap->Handle()));
+ // set incoming bitmap display mode to 16MA
+ if (EColor16MU == bitmap->DisplayMode())
+ {
+ bitmap->SetDisplayMode(EColor16MA);
+ }
+ AknIconUtils::ScaleBitmapL(iDrawRect, iBitmap, bitmap);
+ CleanupStack::PopAndDestroy(bitmap);
+ }
+}
+
+void CMMABitmapWindow::SetDrawRect(const TRect& aRect)
+{
+ iDrawRect = aRect;
+}
+
+void CMMABitmapWindow::SetDrawRectThread(const TRect& aRect)
+{
+ // Bitmap window's rect can be set in any thread.
+ SetDrawRect(aRect);
+}
+
+const TRect& CMMABitmapWindow::DrawRect()
+{
+ return iDrawRect;
+}
+
+TSize CMMABitmapWindow::WindowSize()
+{
+ if (!iBitmap)
+ {
+ // bitmap not ready returning currently set draw rect
+ return iDrawRect.Size();
+ }
+ return iBitmap->SizeInPixels();
+}
+
+void CMMABitmapWindow::SetPosition(const TPoint& /*aPosition*/)
+{
+ // ignored, this is done by framework
+}
+
+void CMMABitmapWindow::SetVisible(TBool /*aVisible*/, TBool /*aUseEventServer*/)
+{
+ // ignored, this is done by framework
+}
+
+void CMMABitmapWindow::SetWindowRect(const TRect& aRect ,MMMADisplay::TThreadType /*aThreadType*/)
+{
+ iClientRect = aRect;
+}
+
+const TRect& CMMABitmapWindow::WindowRect()
+{
+ return iClientRect;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmacameraplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,669 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing camera.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <fbs.h>
+#include "cmmacameraplayer.h"
+#include "tmmaparametervalidator.h"
+#include "mmmadisplay.h"
+#include "cmmacamerasound.h"
+
+#if defined( __WINS__ )
+#include <w32std.h>
+#endif
+
+// CONSTANTS
+_LIT8(KImageJpegMime, "image/jpeg");
+_LIT8(KJpegMime, "jpeg");
+_LIT(KVideoControlName, "VideoControl");
+
+CMMACameraPlayer* CMMACameraPlayer::NewLC(TInt aCameraIndex)
+{
+ CMMACameraPlayer* self = new(ELeave) CMMACameraPlayer;
+ CleanupStack::PushL(self);
+ self->ConstructL(aCameraIndex);
+ return self;
+}
+
+CMMACameraPlayer::~CMMACameraPlayer()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMACameraPlayer::~CMMACameraPlayer");
+
+ // Free (duplicated) UI camera resources first.
+ // Window is not able to send any
+ // callback requests to UI from now.
+ if (iWindow)
+ {
+ iWindow->SetDisplay(NULL);
+ }
+
+ if (iCamera)
+ {
+ iCamera->CancelCaptureImage();
+ iCamera->Release();
+ delete iCamera;
+ }
+
+ delete iSnapshotEncoded;
+ delete iSnapshotBitmap;
+ delete iRealizeWait;
+
+ if (iDisplay && iDisplay->HasContainer())
+ {
+ // Window will delete itself
+ // after all pending events are processed
+ // (lazy delete)
+ // iDisplay->UIGetCallback(
+ // *iWindow, CMMACameraWindow::EDestroyWindow);
+ }
+ else
+ {
+ delete iWindow;
+ }
+ iWindow = NULL;
+}
+
+
+CMMACameraPlayer::CMMACameraPlayer():
+ iDisplay(NULL),
+ iSourceSizeIndex(KErrNotFound),
+ iStartTime(KErrNotFound)
+{
+ iStopViewFinder = ETrue;
+}
+
+
+void CMMACameraPlayer::ConstructL(TInt aCameraIndex)
+{
+ CMMAPlayer::ConstructL();
+
+ if (aCameraIndex >= CCamera::CamerasAvailable())
+ {
+ // image capture is not supported
+ User::Leave(KErrNotFound);
+ }
+
+ iCamera = CCamera::NewL(*this, aCameraIndex);
+
+ iWindow = CMMACameraWindow::NewL(iCamera->Handle());
+
+ TCameraInfo cameraInfo;
+ iCamera->CameraInfo(cameraInfo);
+
+ if (cameraInfo.iNumImageSizesSupported < 1)
+ {
+ // image capture is not supported
+ User::Leave(KErrNotFound);
+ }
+
+ // default snapshot size
+ iSourceSizeIndex = cameraInfo.iNumImageSizesSupported - 1;
+
+ iRealizeWait = new(ELeave)CRealizeWait;
+}
+
+TInt64 CMMACameraPlayer::CurrentTime()
+{
+ TTime time;
+ time.HomeTime();
+ return time.Int64();
+}
+
+void CMMACameraPlayer::ResolveViewFinderSizeL(TSize& aSize)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMACameraPlayer::ResolveViewFinderSizeL");
+
+ TSize resultSize;
+
+ // The only way to find out the size is to start the view finder
+ // with a proper size (screen size).
+
+ ResolveScreenSizeL(resultSize);
+
+ // StartViewFinderBitmapsL changes resultSize to
+ // the used view finder size.
+ // Used to get the source size only.
+ iCamera->StartViewFinderBitmapsL(resultSize);
+
+ // Bitmap viewfinder is not used anymore.
+ iCamera->StopViewFinder();
+
+ aSize = resultSize;
+}
+
+void CMMACameraPlayer::ResolveScreenSizeL(TSize& aSize)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMACameraPlayer::ResolveScreenSizeL");
+
+#if defined( __WINS__ )
+ TSize size(0,0);
+ RWsSession ws;
+
+ if (ws.Connect() == KErrNone)
+ {
+ CleanupClosePushL(ws);
+
+ CWsScreenDevice* wsScreenDevice = new(ELeave)CWsScreenDevice(ws);
+ CleanupStack::PushL(wsScreenDevice);
+
+ User::LeaveIfError(wsScreenDevice->Construct());
+
+ size = wsScreenDevice->SizeInPixels();
+
+ CleanupStack::PopAndDestroy(2); // wsScreenDevice, ws.Close()
+ }
+
+ aSize = size;
+
+#else
+ TScreenInfoV01 info;
+ TPckgBuf< TScreenInfoV01 > buf(info);
+
+ UserSvr::ScreenInfo(buf);
+ info = buf();
+
+ aSize = info.iScreenSize;
+#endif
+}
+
+void CMMACameraPlayer::ResolveCaptureSizes(const CCamera::TFormat aFormat,
+ const TInt aNumImageSizesSupported,
+ const TSize& aRequestSize,
+ TSize& aSourceSize,
+ TInt& aSourceIndex,
+ TInt& aLargestIndex)
+{
+ // Largest image size
+ TSize largestSize;
+ // Index to largest image size
+ TInt largestSizeIndex = 0;
+ // Source size
+ TSize sourceSize;
+ // Default source size index not set
+ TInt sourceSizeIndex = KErrNotFound;
+ // Temporary size for iterating capture sizes
+ TSize tmpSize;
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::ResolveCaptureSizes: aFormat = 0x%x", aFormat);
+
+ // go through all supported sizes.
+ // Notice: Capture sizes are assumed to be in order from smaller to larger sizes
+ for (TInt i = 0; i < aNumImageSizesSupported; i++)
+ {
+ iCamera->EnumerateCaptureSizes(tmpSize,
+ i,
+ aFormat);
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::ResolveCaptureSizes: tmpSize.iWidth = %d", tmpSize.iWidth);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::ResolveCaptureSizes: tmpSize.iHeight = %d", tmpSize.iHeight);
+
+ // Check if current is the largest
+ if ((largestSize.iWidth < tmpSize.iWidth) &&
+ (largestSize.iHeight < tmpSize.iHeight))
+ {
+ largestSize = tmpSize;
+ largestSizeIndex = i;
+ }
+
+ // If wanted size is smaller than tmpSize we can use it
+ if ((aRequestSize.iWidth <= tmpSize.iWidth) &&
+ (aRequestSize.iHeight <= tmpSize.iHeight))
+ {
+ sourceSize = tmpSize;
+ sourceSizeIndex = i;
+ }
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::ResolveCaptureSizes: sourceSizeIndex = %d", sourceSizeIndex);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::ResolveCaptureSizes: largestSizeIndex = %d", largestSizeIndex);
+
+ aSourceSize = sourceSize;
+ aSourceIndex = sourceSizeIndex;
+ aLargestIndex = largestSizeIndex;
+}
+
+void CMMACameraPlayer::StartL()
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMACameraPlayer:StartL iState %d", iState);
+
+ // start can't be called to not ready player
+ if (iState == EPrefetched)
+ {
+ // camera passes ready images through
+ // ViewFinderFrameReady method
+
+ // set time when started
+ iStartTime = CurrentTime();
+
+ // inform java side
+ ChangeState(EStarted);
+
+ TInt64 time;
+ GetMediaTime(&time);
+
+ // Notify the camera window
+ // about the status change
+ iWindow->SetStarted(ETrue);
+
+ // inform java side
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ }
+ PostActionCompletedStart();
+ PostActionCompleted(KErrNone); // java start return
+}
+
+void CMMACameraPlayer::StopL(TBool aPostEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMACameraPlayer::StopL", iState);
+ if (iState == EStarted)
+ {
+ TInt64 time;
+ GetMediaTime(&time); // add played time to media time
+
+ if (iStopViewFinder && iWindow->ViewFinderActive())
+ {
+ iWindow->SetStarted(EFalse);
+ }
+ iStartTime = KErrNotFound;
+
+ if (aPostEvent)
+ {
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ }
+}
+
+void CMMACameraPlayer::DeallocateL()
+{
+ // If player is started when deallocate is called,
+ // player is stopped from java side -> state is changed to
+ // prefetched.
+ // In prefetched state only reserved resource is
+ // camera reserve( released with iCamera->Release() )
+ // In realized state no resources have been reserved.
+ // CHANGED: not releasing camera anymore, since it is already
+ // done in realized state
+ if (iState == EPrefetched)
+ {
+ ChangeState(ERealized);
+ }
+}
+
+
+void CMMACameraPlayer::RealizeL()
+{
+ iCamera->Reserve();
+ // this lock will be released when power on is completed (or error)
+ if (!iRealizeWait->IsStarted())
+ {
+ iRealizeWait->Start();
+ }
+ User::LeaveIfError(iRealizeWait->iError);
+ CMMAPlayer::RealizeL();
+}
+
+
+void CMMACameraPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::PrefetchL");
+ // nothing to do here
+ ChangeState(EPrefetched);
+ PostActionCompleted(KErrNone);
+}
+
+
+void CMMACameraPlayer::GetDuration(TInt64* aDuration)
+{
+ // camera viewer has no duration.
+ *aDuration = KTimeUnknown;
+}
+
+
+void CMMACameraPlayer::SetMediaTimeL(TInt64* /*aTime*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::SetMediaTimeL ");
+ // with camera media time is not supported.
+}
+
+
+void CMMACameraPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ if (iState == EStarted)
+ {
+ // add play time to media time
+ iMediaTime += CurrentTime() - iStartTime;
+ // set new start time
+ iStartTime = CurrentTime();
+ }
+
+ // set value to parameter
+ (*aMediaTime) = iMediaTime;
+}
+
+void CMMACameraPlayer::CloseL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::CloseL()");
+
+ // cancel all activity
+ iCamera->CancelCaptureImage();
+
+ // Stop and release UI Camera instance
+ iWindow->SetDisplay(NULL);
+
+ // we don't need reserve camera anymore
+ iCamera->Release();
+
+ CMMAPlayer::CloseL();
+}
+
+const TDesC& CMMACameraPlayer::Type()
+{
+ return KMMACameraPlayer;
+}
+
+// MCameraObserver
+void CMMACameraPlayer::ReserveComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMACameraPlayer::ReserveComplete %d", aError);
+ if (aError == KErrNone)
+ {
+ // camera will notify completion with PowerOnComplete method.
+ iCamera->PowerOn();
+ }
+ else
+ {
+ // release lock and store error. State doesn't change.
+ iRealizeWait->iError = aError;
+ iRealizeWait->AsyncStop();
+ }
+
+}
+
+void CMMACameraPlayer::PowerOnComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMACameraPlayer::PowerOnComplete %d", aError);
+
+ TSize viewFinderSize;
+ TInt error = aError;
+
+ if (error == KErrNone)
+ {
+ // The view finder size must be known after prefetching.
+ TRAP(error, ResolveViewFinderSizeL(viewFinderSize));
+ }
+
+ if (error == KErrNone)
+ {
+ iSize = viewFinderSize;
+
+ if (iDisplay)
+ {
+ iDisplay->SourceSizeChanged(iSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+ }
+ }
+
+ iRealizeWait->iError = error;
+ iRealizeWait->AsyncStop();
+}
+
+void CMMACameraPlayer::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+{
+ // Empty implementation of an interface method.
+ // DirectViewFinder is used
+ // instead of BitmapViewFinder
+}
+
+void CMMACameraPlayer::ImageReady(CFbsBitmap* aBitmap,
+ HBufC8* aData,
+ TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMACameraPlayer::ImageReady %d", aError);
+
+ // This method should never be called,
+ // unless we are taking snapshot
+ __ASSERT_DEBUG(iSnapshotStatus, User::Invariant());
+
+ __ASSERT_DEBUG(!iSnapshotBitmap, User::Invariant());
+ __ASSERT_DEBUG(!iSnapshotEncoded, User::Invariant());
+
+ if (aError == KErrNone)
+ {
+ // this class has ownership of the bitmap until
+ // snapshot bitmap is got from this class.
+ iSnapshotBitmap = aBitmap;
+ iSnapshotEncoded = aData;
+ }
+
+ // notify the caller, error code or KErrNone
+ User::RequestComplete(iSnapshotStatus, aError);
+ iWindow->SetStarted(ETrue);
+ // Status is not needed anymore
+ // and this class don't own the status.
+ iSnapshotStatus = NULL;
+}
+
+void CMMACameraPlayer::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,
+ TInt /*aError*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::FrameBufferReady");
+ // this callback will never be called
+ // Asserted in debug build to be sure.
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+}
+
+void CMMACameraPlayer::SetDisplayL(MMMADisplay* aDisplay)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::SetDisplay");
+
+ // now it is ready to draw
+ iDisplay = aDisplay;
+
+ // Passes display into iWindow.
+ // Allocates all resources needed to use a camera DirectViewFinder.
+ iWindow->SetDisplay(aDisplay);
+
+ iDisplay->SetWindowL(iWindow);
+
+ // Set view finder size to the display only if the view finder
+ // size has been resolved.
+ if (iSize != TSize(0, 0))
+ {
+ iDisplay->SourceSizeChanged(iSize);
+ NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
+ }
+}
+
+TSize CMMACameraPlayer::SourceSize()
+{
+ return iSize;
+}
+
+MMMASnapshot::TEncoding CMMACameraPlayer::TakeSnapshotL(TRequestStatus* aStatus,
+ const TSize& aSize,
+ const CMMAImageSettings& aSettings)
+{
+ __ASSERT_DEBUG(!iSnapshotStatus, User::Invariant());
+ __ASSERT_DEBUG(!iSnapshotBitmap, User::Invariant());
+ __ASSERT_DEBUG(!iSnapshotEncoded, User::Invariant());
+
+ // snapshots can not be taken if player is not realized
+ if (iState < ERealized)
+ {
+ User::Leave(KErrNotReady);
+ }
+ // save status which will be notified
+ iSnapshotStatus = aStatus;
+
+ // changing status to pending
+ *iSnapshotStatus = KRequestPending;
+
+ // Source size not set in the beginning
+ TSize sourceSize;
+
+ // Use default if size is not specified.
+ TInt sourceSizeIndex = iSourceSizeIndex;
+
+ // Largest image size index
+ TInt largestSizeIndex = 0;
+
+ // Get camera characteristics
+ TCameraInfo cameraInfo;
+ iCamera->CameraInfo(cameraInfo);
+
+ // Set default snapshot encoding type
+ TEncoding encoding = EBitmap;
+
+ // Set default image capture format
+ CCamera::TFormat format = CCamera::EFormatFbsBitmapColor16M;
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::TakeSnapshotL: cameraInfo.iImageFormatsSupported = 0x%x", cameraInfo.iImageFormatsSupported);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::TakeSnapshotL: cameraInfo.iNumImageSizesSupported = %d", cameraInfo.iNumImageSizesSupported);
+
+ // Check if size was set in Java
+ if (aSize.iWidth != KErrNotFound &&
+ aSize.iHeight != KErrNotFound)
+ {
+ // Determine if jpeg capture was requested
+ if ((*aSettings.iMimeType == KJpegMime) ||
+ (*aSettings.iMimeType == KImageJpegMime))
+ {
+ // Shortcut for supported image formats
+ TUint32 imageFormats = cameraInfo.iImageFormatsSupported;
+
+ // Jpeg subtype constants
+ _LIT8(KJpegJfif, "jfif");
+ _LIT8(KJpegExif, "exif");
+
+ // Resolve requested jpeg subtype from settings and camerainfo
+ if ((imageFormats & CCamera::EFormatJpeg) &&
+ (*aSettings.iType == KJpegJfif))
+ {
+ // JFIF JPEG
+ format = CCamera::EFormatJpeg;
+ encoding = EEncoded;
+ }
+ else if ((imageFormats & CCamera::EFormatExif) &&
+ (*aSettings.iType == KJpegExif))
+ {
+ // EXIF JPEG
+ format = CCamera::EFormatExif;
+ encoding = EEncoded;
+ }
+ }
+
+ // Try to resolve nearest source size to the one requested,
+ // except for the JFIF and EXIF jpeg subtypes the match has
+ // to be exact otherwise non-encode capture format will be
+ // used
+ ResolveCaptureSizes(format,
+ cameraInfo.iNumImageSizesSupported,
+ aSize,
+ sourceSize,
+ sourceSizeIndex,
+ largestSizeIndex);
+
+ // Format was either of the jpeg formats and requested size
+ // didn't match the source size
+ if ((format >= CCamera::EFormatJpeg &&
+ format <= CCamera::EFormatExif) &&
+ (aSize != sourceSize))
+ {
+ // Try again with an non-encoded format
+ format = CCamera::EFormatFbsBitmapColor16M;
+ encoding = EBitmap;
+ ResolveCaptureSizes(format,
+ cameraInfo.iNumImageSizesSupported,
+ aSize,
+ sourceSize,
+ sourceSizeIndex,
+ largestSizeIndex);
+ }
+
+ if (sourceSizeIndex == KErrNotFound)
+ {
+ // If correct index was not found use the largest.
+ sourceSizeIndex = largestSizeIndex;
+ }
+ }
+ // else use default iSourceSizeIndex and default image capture format
+
+ iCamera->PrepareImageCaptureL(format,
+ sourceSizeIndex);
+
+ // play sound when capturing image
+ CMMACameraSound::PlayImageCaptureSoundL();
+
+ // start capture, ImageReady will be called when ready
+ iWindow->SetStarted(EFalse);
+
+ iCamera->CaptureImage();
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::TakeSnapshotL: format = 0x%x", format);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::TakeSnapshotL: sourceSizeIndex = %d", sourceSizeIndex);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayer::TakeSnapshotL: encoding = %d", encoding);
+
+ // Inform caller which snapshot encoding was ultimately used
+ return encoding;
+}
+
+CFbsBitmap* CMMACameraPlayer::SnapshotBitmap()
+{
+ CFbsBitmap* bitmap = iSnapshotBitmap;
+
+ // ownership transfers to the caller
+ iSnapshotBitmap = NULL;
+ return bitmap;
+}
+
+HBufC8* CMMACameraPlayer::SnapshotEncoded()
+{
+ HBufC8* encoded = iSnapshotEncoded;
+
+ // ownership transfers to the caller
+ iSnapshotEncoded = NULL;
+ return encoded;
+}
+
+void CMMACameraPlayer::NotifyWithStringEvent(
+ CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData)
+{
+ PostStringEvent(aEventType, aStringEventData);
+}
+
+MMMASnapshot* CMMACameraPlayer::SnapshoterL()
+{
+ return this;
+}
+
+TInt CMMACameraPlayer::CameraHandle()
+{
+ return iCamera->Handle();
+}
+
+void CMMACameraPlayer::SetViewFinderMode(TBool aStopViewFinder)
+{
+ iStopViewFinder = aStopViewFinder;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmacameraplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating camera players.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <logger.h>
+
+#include "cmmacameraplayerfactory.h"
+#include "cmmacameraplayer.h"
+#include "cmmavideocontrol.h"
+#include "cmmavideorecordcontrol.h"
+#include "cmmastoptimecontrol.h"
+#include "cmmaplayerproperties.h"
+#include "cmmammfresolver.h"
+
+_LIT(KDefaultVideo, "video");
+//is the main camera
+_LIT(KDevcamZero, "devcam0");
+// the secondary camera
+_LIT(KDevcamOne, "devcam1");
+
+_LIT(KEncodingProperty, "encoding");
+
+_LIT(KVideoMp4MimeType, "video/mp4");
+_LIT(KVideoH264MimeType, "video/H264");
+
+CMMACameraPlayerFactory* CMMACameraPlayerFactory::NewLC()
+{
+ CMMACameraPlayerFactory* pFactory =
+ new(ELeave) CMMACameraPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+
+CMMACameraPlayerFactory::CMMACameraPlayerFactory()
+{
+}
+
+
+CMMACameraPlayerFactory::~CMMACameraPlayerFactory()
+{
+ delete iAudioSettings;
+}
+
+CMMAPlayer* CMMACameraPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayerFactory::CreatePlayerL( aResolver )+");
+ CMMACameraPlayer* player = CMMACameraPlayer::NewLC(iCameraIndex);
+
+ /* Add VideoControl */
+ CMMAVideoControl* videoControl = new(ELeave)CMMAVideoControl(player);
+
+ CleanupStack::PushL(videoControl);
+ player->AddControlL(videoControl);
+ CleanupStack::Pop(videoControl);
+
+ /* Add RecordControl */
+ CMMAVideoRecordControl* videoRecordControl =
+ CMMAVideoRecordControl::NewL(player,
+ aResolver,
+ iVideoSettings,
+ iAudioSettings,
+ player->CameraHandle());
+ CleanupStack::PushL(videoRecordControl);
+ player->AddControlL(videoRecordControl);
+ // ownership transfered to player
+ CleanupStack::Pop(videoRecordControl);
+
+ // With record control view finder can't be stopped,
+ // because it can not be restarted.
+ player->SetViewFinderMode(EFalse);
+
+ CleanupStack::Pop(player);
+ return player;
+}
+
+
+void CMMACameraPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeVideo));
+}
+
+void CMMACameraPlayerFactory::PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection)
+{
+ // We are creating record type player
+ aResolver->SetRequiredRecordFormatSupportL(*aFormatSelection);
+}
+
+CMMAPlayer* CMMACameraPlayerFactory::CreatePlayerL(const TDesC&)
+{
+ // record player cannot be created from conten-type, since this is used only
+ // when we have also data
+ return NULL;
+}
+
+
+CMMAPlayer* CMMACameraPlayerFactory::CreatePlayerL(const TDesC8&)
+{
+ // record player cannot be created with header data
+ return NULL;
+}
+
+CMMAPlayer* CMMACameraPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraPlayerFactory::CreatePlayerL aParameters = %S", aParameters.Ptr());
+ // check that locator is capture:://audio
+ if (aProtocol != KMMACaptureProtocol)
+ {
+ return NULL;
+ }
+
+ iCameraIndex = KErrNotFound;
+
+ // If the device supports multiple cameras then "capture://devcam0" is the
+ // main camera pointing outwards from the user. "capture://devcam1" is the
+ // secondary camera pointing e.g. towards the user. "capture://video" is
+ // the default camera locator pointing to the same camera as "devcam0"
+ if ((aMiddlePart == KDefaultVideo) ||
+ (aMiddlePart == KDevcamZero))
+ {
+ // First camera
+ iCameraIndex = 0;
+ }
+ else if (aMiddlePart == KDevcamOne)
+ {
+ // Second camera.
+ iCameraIndex = 1;
+ }
+ else
+ {
+ // not supported type
+ return NULL;
+ }
+
+ CMMAAudioSettings* audioSettings = new(ELeave) CMMAAudioSettings;
+ audioSettings->iDataType = KMMFFourCCCodeNULL;
+ delete iAudioSettings;
+ iAudioSettings = audioSettings;
+
+ if (aParameters.Length() == 0)
+ {
+ // getting defaults from validator
+ iVideoSettings = TMMAParameterValidator::ValidateVideoPropertiesL(aParameters);
+ }
+ else
+ {
+ // we accept either video or mixed parameters, so properties must contain encoding 2 times for mixed and
+ // 1 time for video.
+ // making tmp des without first "encoding"
+ TInt lengthWithoutEncoding = aParameters.Length() - KEncodingProperty().Length();
+ if (lengthWithoutEncoding < 0)
+ {
+ User::Leave(KErrArgument);
+ }
+ TPtrC tmp = aParameters.Right(lengthWithoutEncoding);
+ // finding second "encoding"
+ TInt videoPropertiesStartPos = tmp.Find(KEncodingProperty);
+ if (videoPropertiesStartPos == KErrNotFound)
+ {
+ // there is not another encoding, so assuming that there is only video parameters
+ iVideoSettings = TMMAParameterValidator::ValidateVideoPropertiesL(aParameters);
+ }
+ else
+ {
+ // there is mixed parameters
+ videoPropertiesStartPos += KEncodingProperty().Length();
+
+ // skipping '&' char
+ TPtrC audioProperties = aParameters.Left(videoPropertiesStartPos - 1);
+ TPtrC videoProperties = aParameters.Mid(videoPropertiesStartPos);
+ iVideoSettings = TMMAParameterValidator::ValidateVideoPropertiesL(videoProperties);
+
+ CMMAAudioSettings* audioSettings = TMMAParameterValidator::ValidateAudioPropertiesL(audioProperties);
+ delete iAudioSettings;
+ iAudioSettings = audioSettings;
+ }
+ }
+
+ // if wanted video capture encoding is H264, we must create player with video/mp4
+ // because mmf doesn't have controller for H264
+ if (iVideoSettings.iEncoding.Compare(KVideoH264MimeType) == 0)
+ {
+ return CMMAMMFPlayerFactory::CreatePlayerL(KVideoMp4MimeType);
+ }
+
+ // Find controller with content-type
+ return CMMAMMFPlayerFactory::CreatePlayerL(iVideoSettings.iEncoding);
+}
+
+void CMMACameraPlayerFactory::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ if (IsSupportedContentTypeL(aContentType))
+ {
+ aProtocolArray.AppendL(KMMACaptureProtocol);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,977 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplayWindow functionality
+* for Camera viewfinder usage.
+*
+*/
+
+
+// Include Files
+#include <eikenv.h>
+#include <gdi.h>
+#include <logger.h>
+#include <AknsUtils.h>
+#include <AknsDrawUtils.h>
+#include "cmmacanvasdisplay.h"
+#include "logger.h"
+
+class CMMACanvasDisplay;
+
+//#include <cameraapp.mbg>
+
+// Used for iDisplay member
+
+#include "cmmacamerawindow.h"
+
+// Camera viewfinder start delay
+const TInt KStarterTimeout = 100000; //100 msecs
+
+// Margin of icon displayed instead of viewfinder in case of error
+const TInt KErrorIconMargin = 5; //5 pixels
+
+
+_LIT(KCameraAppBitmapFile, "z:\\resource\\apps\\cameraapp.mif");
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::NewL
+// Two-phased constructor.
+// Use this method to create a CMMACameraWindow instance.
+// ---------------------------------------------------------------------------
+//
+CMMACameraWindow* CMMACameraWindow::NewL(TInt aCameraHandle)
+{
+ CMMACameraWindow* self = new(ELeave)CMMACameraWindow(aCameraHandle);
+ return self;
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::~CMMACameraWindow
+// Destructor.
+// NOTE: iUICamera have to be deleted by ReleaseUiResources() called
+// from UI thread
+// ---------------------------------------------------------------------------
+//
+CMMACameraWindow::~CMMACameraWindow()
+{
+ // It's not allowed to delete any nonsharable object here.
+ // This must be done in Destroy().
+ // If the iDisplay is set,
+ // instance should be deleted by sending
+ // event from UI to be received by MUiEventConsumer.
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::ViewFinderActive
+// Gets an information if the viewfinder is started.
+// ---------------------------------------------------------------------------
+//
+TBool CMMACameraWindow::ViewFinderActive()
+{
+ return iUICamera && iViewFinderVisible;
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::SetStarted
+// Notifies window about Started state change.
+// If started, tries to start viewfinder.
+// If not started, stops viewfinder.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetStarted(TBool aStarted)
+{
+ iStarted = aStarted;
+ if (iDisplay)
+ {
+ if (iStarted)
+ {
+ // iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EShowViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EShowViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread - EShowViewFinder");
+ }
+ else
+ {
+ // iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EHideViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EHideViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread - EHideViewFinder");
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::SetDisplay
+// Sets iDisplay used to invoke callbacks from UI thread.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetDisplay(MMMADisplay *aDisplay)
+{
+ if (iDisplay != aDisplay)
+ {
+ if (iDisplay)
+ {
+ // Clear the resources created within the old Display
+ //iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EDeleteViewFinder);
+
+
+ // instead make a call to java, shift to ui thread and call ReleaseUiResources() method in UI thread
+
+ // here jobject and jclass is valid since the flow is first creat CMMACanvasDisplay and then
+ // call setdeisplay of cameraplayer
+ /*iJavaDisplayObject = iDisplay->GetJavaDisplayObject();
+ iJavaDisplayClass = iDisplay->GetJavaDisplayClass();
+ iJni = iDisplay->GetJNIEnv();
+
+ jmethodID releaseUiResourceID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "releaseUiResource",
+ "()I");
+
+ iJni->CallIntMethod(iJavaDisplayObject,releaseUiResourceID);*/
+ //MMAPI UI 3.x req.
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread +");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EDeleteViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread -");
+ }
+
+ // Set the new Display
+ iDisplay = aDisplay;
+
+ if (iDisplay)
+ {
+ // Get a DSA resources for the new Display
+ // iDisplay->UIGetDSAResources(*this, MMMADisplay::EMmaThread);
+
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetDestinationBitmapL
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetDestinationBitmapL(CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDestinationBitmapL");
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::DrawFrameL
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::DrawFrameL(const CFbsBitmap* /*aBitmap*/)
+{
+ // Ignored, this window will not be used for actual drawing
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetDrawRect
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetDrawRect(const TRect& aRect)
+{
+ // MMAPI thread
+ LOG2(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::SetDrawRect TL:%d,%d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::SetDrawRect BR:%d,%d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ iDrawRect = aRect;
+
+ if (iDisplay)
+ {
+ //iDisplay->UIGetCallback(*this, CMMACameraWindow::EResetViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread + EResetViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EResetViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread - EResetViewFinder");
+
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetDrawRectThread
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetDrawRectThread(const TRect& aRect)
+{
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACameraWindow::SetDrawRectThread TL:%d,%d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACameraWindow::SetDrawRectThread BR:%d,%d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ // Note: Runs in UI thread only
+
+ // Bitmap window's rect can be set in any thread.
+ if (iDrawRect != aRect)
+ {
+ iDrawRect = aRect;
+
+ // Stop and start ViewFinder to update position
+ ResetViewFinder();
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::DrawRect
+//
+// ---------------------------------------------------------------------------
+//
+const TRect& CMMACameraWindow::DrawRect()
+{
+ return iDrawRect;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::WindowSize
+//
+// ---------------------------------------------------------------------------
+//
+TSize CMMACameraWindow::WindowSize()
+{
+ return iDrawRect.Size();
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetPosition
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetPosition(const TPoint& aPosition)
+{
+ // Note: Runs in UI thread only
+ SetDrawRectThread(TRect(aPosition, iDrawRect.Size()));
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetVisible
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetVisible(TBool aVisible, TBool aUseEventServer)
+{
+ iVisible = aVisible;
+
+ if (aUseEventServer)
+ {
+ // We are in UI thread now.
+ SetViewFinderVisibility(aVisible);
+ }
+ else
+ {
+ // MMAPI thread
+ if (iDisplay)
+ {
+ if (aVisible)
+ {
+ // iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EShowViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EShowViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EShowViewFinder");
+ }
+ else
+ {
+ // iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EHideViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EHideViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EHideViewFinder");
+ }
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetWindowRect
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetWindowRect(
+ const TRect& aRect,
+ MMMADisplay::TThreadType aThreadType)
+{
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACameraWindow::SetWindowRect TL:%d,%d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACameraWindow::SetWindowRect BR:%d,%d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ if (iClientRect != aRect)
+ {
+ iClientRect = aRect;
+
+ if (aThreadType == MMMADisplay::EUiThread)
+ {
+ ResetViewFinder();
+ }
+ else
+ {
+ // iDisplay->UIGetCallback(
+ // *this, CMMACameraWindow::EResetViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread + EResetViewFinder");
+ iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
+ LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread - EResetViewFinder");
+ }
+ }
+
+
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::WindowRect
+//
+// ---------------------------------------------------------------------------
+//
+const TRect& CMMACameraWindow::WindowRect()
+{
+ return iClientRect;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::GetDisplayWindowType
+//
+// ---------------------------------------------------------------------------
+//
+MMMADisplayWindow::TDisplayWindowType
+CMMACameraWindow::GetDisplayWindowType() const
+{
+ return EDisplayWindowTypeIsCamera;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::IsVisible
+//
+// ---------------------------------------------------------------------------
+//
+TBool CMMACameraWindow::IsVisible() const
+{
+ return iVisible;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::ContainerSet
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ContainerSet()
+{
+ // We are in UI thread now
+
+ // Container was probably not set when
+ // iDisplay was set,
+ // we can now try get the DSA stuff again
+ if (!iUICamera && iDisplay)
+ {
+ // Get a DSA stuff for the new Display
+ // iDisplay->UIGetDSAResources(*this, MMMADisplay::EUiThread);
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::ContainerDestroyed
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ContainerDestroyed()
+{
+ // We are in UI thread now
+ ReleaseUiResources();
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MCameraObserver
+// CMMACameraWindow::ReserveComplete
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ReserveComplete(TInt aError)
+{
+ LOG1(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::ReserveComplete %d", aError);
+
+ if (aError == KErrNone)
+ {
+ // camera will notify completion with PowerOnComplete method.
+ iUICamera->PowerOn();
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MCameraObserver
+// CMMACameraWindow::PowerOnComplete
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::PowerOnComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMACameraWindow::PowerOnComplete %d", aError);
+
+ if (aError == KErrNone)
+ {
+ iCameraPowerOn = ETrue;
+ SetViewFinderVisibility(ETrue);
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MCameraObserver
+// CMMACameraWindow::ViewFinderFrameReady
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ViewFinderFrameReady(CFbsBitmap& /*aFrame*/)
+{
+ // Empty implementation of the interface method
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::ViewFinderFrameReady");
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MCameraObserver
+// CMMACameraWindow::ImageReady
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ImageReady(CFbsBitmap* /*aBitmap*/,
+ HBufC8* /*aData*/,
+ TInt /*aError*/)
+{
+ // Empty implementation of the interface method
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::ImageReady");
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MCameraObserver
+// CMMACameraWindow::FrameBufferReady
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/,
+ TInt /*aError*/)
+{
+ // Empty implementation of the interface method
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::FrameBufferReady");
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MDirectScreenAccess.
+// CMMACameraWindow::AbortNow
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::AbortNow(
+ RDirectScreenAccess::TTerminationReasons /*aReasons*/)
+{
+ SetViewFinderVisibility(EFalse);
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MDirectScreenAccess.
+// CMMACameraWindow::Restart
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::Restart(
+ RDirectScreenAccess::TTerminationReasons /*aReasons*/)
+{
+ SetViewFinderVisibility(ETrue);
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::CMMACameraWindow
+// C++ constructor.
+// ---------------------------------------------------------------------------
+//
+CMMACameraWindow::CMMACameraWindow(TInt aCameraHandle):
+ iVisible(EFalse),
+ iStarted(EFalse),
+ iViewFinderVisible(EFalse),
+ iCameraPowerOn(EFalse),
+ iDrawRect(0, 0, 0, 0),
+ iClientRect(0, 0, 0, 0),
+ iCameraHandle(aCameraHandle),
+ iUICamera(NULL),
+ iDisplay(NULL),
+ iStarterTimer(NULL),
+ iDirectAccess(NULL),
+ iErrorIconBitmap(NULL),
+ iErrorIconMaskBitmap(NULL),
+ iRWindowRect(0, 0, 0, 0)
+{
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::UIStartViewFinder
+// Creates UI Camera.
+// This CCamera instance is duplicated from handle given to the constructor.
+// Have to be called from the thread which UI Camera will be controlled from.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::UIStartViewFinder(
+ RWsSession &aWs,
+ CWsScreenDevice &aScreenDevice,
+ RWindowBase &aWindow)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::UIStartViewFinder");
+
+ iWs = &aWs;
+ iScreenDevice = &aScreenDevice;
+ iWindow = &aWindow;
+
+ if (!iUICamera)
+ {
+ TRAPD(error, iUICamera =
+ CCamera::NewDuplicateL(*this, iCameraHandle));
+
+ ELOG1( EJavaMMAPI,
+ "MMA::CMMACameraWindow::UIStartViewFinder - NewDuplicateL %d",
+ error);
+
+ if (error == KErrNone)
+ {
+ iUICamera->Reserve();
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::SetViewFinderVisibility
+// If UI Camera have been created, it starts/hides the DirectViewFinder.
+// Have to be called from UI thread in which iUICamera instance was created.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetViewFinderVisibility(TBool aVisible)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMACameraWindow::SetViewFinderVisibility - %d",
+ aVisible);
+
+ if (!iUICamera || !iCameraPowerOn || iViewFinderVisible == aVisible)
+ {
+ return;
+ }
+
+ if (aVisible)
+ {
+ // Viewfinder is going to start
+ if (!iVisible || !iStarted)
+ {
+ return;
+ }
+
+ iViewFinderVisible = ETrue;
+
+ if (!iStarterTimer)
+ {
+ // If starter timer haven't been created yet, create an instance
+ TRAPD(
+ timerErr,
+ iStarterTimer = CPeriodic::NewL(CActive::EPriorityIdle));
+
+ if (timerErr != KErrNone)
+ {
+ ELOG1( EJavaMMAPI,
+ "MMA::CMMACameraWindow::SetViewFinderVisibility - timer error = %d",
+ timerErr);
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ }
+
+ if (!iStarterTimer->IsActive())
+ {
+ iStarterTimer->Start(
+ KStarterTimeout,
+ 0,
+ TCallBack(StarterTimerCallback, this));
+ }
+ }
+ else
+ {
+ // Viewfinder is going to be cancelled
+ LOG(EJavaMMAPI,EInfo,
+ "MMA::CMMACameraWindow::SetViewFinderVisibility - Stopping VF");
+
+ if (iStarterTimer && iStarterTimer->IsActive())
+ {
+ // Cancel the running starter timer
+ iStarterTimer->Cancel();
+ }
+
+ if (iUICamera->ViewFinderActive())
+ {
+ iUICamera->StopViewFinder();
+ }
+ if (iDirectAccess->IsActive())
+ {
+ iDirectAccess->Cancel();
+ }
+
+ iViewFinderVisible = EFalse;
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::StarterTimerCallback
+// Executed at the expiry of the iStartedTimer.
+// ---------------------------------------------------------------------------
+//
+TInt CMMACameraWindow::StarterTimerCallback(TAny* aThis)
+{
+ CMMACameraWindow* self = static_cast<CMMACameraWindow*>(aThis);
+ ASSERT(self);
+
+ self->StartViewFinder();
+
+ // We don't want to run the callback again
+ return EFalse;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MMMADisplayWindow
+// CMMACameraWindow::SetRWindowRect
+//
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::SetRWindowRect(const TRect& aRect,
+ MMMADisplay::TThreadType aThreadType)
+{
+ ELOG2( EJavaMMAPI,
+ "MID::CMMACameraWindow::SetRWindowRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ ELOG2( EJavaMMAPI,
+ "MID::CMMACameraWindow::SetRWindowRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+ iRWindowRect = aRect;
+
+ if (MMMADisplay::EMmaThread == aThreadType)
+ {
+ if (iDisplay)
+ {
+ //iDisplay->UIGetCallback(*this,
+ // CMMACameraWindow::EResetViewFinder);
+ }
+ }
+ else if (MMMADisplay::EUiThread == aThreadType)
+ {
+ ResetViewFinder();
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::StartViewFinder
+// Starts viewfinder.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::StartViewFinder()
+{
+ LOG(EJavaMMAPI,EInfo," < StartViewFinder");
+
+ ASSERT(iUICamera);
+ ASSERT(iCameraPowerOn);
+ ASSERT(iStarted);
+
+ iStarterTimer->Cancel();
+
+ // align client rect to RWindow, viewfinder
+ // display co-ordinates is w.r.t to RWindow
+ TRect relativeClientRect;
+ relativeClientRect = iClientRect;
+ relativeClientRect.Move(-iRWindowRect.iTl);
+
+ // Set the drawing area
+ TRect drawRect(iDrawRect);
+ drawRect.Move(relativeClientRect.iTl);
+
+ LOG2( EJavaMMAPI, EInfo,
+ "MMA::CMMACameraWindow::StartViewFinder - Starting VF TL:%d,%d",
+ drawRect.iTl.iX,
+ drawRect.iTl.iY);
+ LOG2( EJavaMMAPI, EInfo,
+ "MMA::CMMACameraWindow::StartViewFinder - Starting VF BR:%d,%d",
+ drawRect.iBr.iX,
+ drawRect.iBr.iY);
+
+ TRAPD(vfError, iUICamera->StartViewFinderDirectL(
+ *iWs, *iScreenDevice, *iWindow, drawRect));
+
+ if (vfError == KErrNone)
+ {
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::StartViewFinder - Start OK");
+ }
+ else
+ {
+ LOG1( EJavaMMAPI, EInfo,
+ "MMA::CMMACameraWindow::StartViewFinder() - \
+StartViewFinderDirectL error=%d", vfError);
+
+ TRAP_IGNORE(DrawViewFinderErrorL(vfError, drawRect));
+ }
+
+ LOG(EJavaMMAPI,EInfo," > StartViewFinder");
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::DrawViewFinderError()
+// Draws the error message to specified area.
+// Used in cases when viewfinder is unable to start.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::DrawViewFinderErrorL(
+ const TInt /*aError*/,
+ const TRect& aDrawRect)
+{
+
+ ASSERT(iDirectAccess);
+ TInt dcError = KErrNone;
+ if (!iDirectAccess->IsActive())
+ {
+ TRAP(dcError, iDirectAccess->StartL());
+ }
+
+ TRect drawRect(aDrawRect);
+
+ if (dcError == KErrNone)
+ {
+ drawRect.Intersection(iClientRect);
+ drawRect.Move(-iWindow->AbsPosition());
+
+ CFbsBitGc* directGc = iDirectAccess->Gc();
+ directGc->SetClippingRect(drawRect);
+ directGc->SetBrushColor(TRgb(128,128,128));
+ directGc->SetPenColor(TRgb(128,0,0));
+ directGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+ directGc->SetPenStyle(CGraphicsContext::ESolidPen);
+ directGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ directGc->DrawRect(drawRect);
+
+ if (!iErrorIconBitmap || !iErrorIconMaskBitmap)
+ {
+ if (iErrorIconBitmap)
+ {
+ delete iErrorIconBitmap;
+ iErrorIconBitmap = NULL;
+ }
+
+ if (iErrorIconMaskBitmap)
+ {
+ delete iErrorIconMaskBitmap;
+ iErrorIconMaskBitmap = NULL;
+ }
+/*
+ AknsUtils::CreateIconL(
+ AknsUtils::SkinInstance(),
+ KAknsIIDQgnIndiCam4Camera,
+ iErrorIconBitmap,
+ iErrorIconMaskBitmap,
+ KCameraAppBitmapFile,
+ EMbmCameraappQgn_indi_cam4_camera,
+ EMbmCameraappQgn_indi_cam4_camera_mask
+ );
+ */
+ }
+
+ //TRect iconRect
+ drawRect.iTl.iX += KErrorIconMargin;
+ drawRect.iTl.iY += KErrorIconMargin;
+ drawRect.iBr.iX -= KErrorIconMargin;
+ drawRect.iBr.iY -= KErrorIconMargin;
+
+ if (iErrorIconBitmap->SizeInPixels() != drawRect.Size())
+ {
+ AknIconUtils::SetSize(iErrorIconBitmap, drawRect.Size());
+ AknIconUtils::SetSize(iErrorIconMaskBitmap, drawRect.Size());
+ }
+
+ directGc->BitBltMasked(
+ drawRect.iTl, iErrorIconBitmap,
+ TRect(iErrorIconBitmap->SizeInPixels()),
+ iErrorIconMaskBitmap, EFalse);
+
+ iDirectAccess->ScreenDevice()->Update();
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::ReleaseUiResources()
+// Stops the DirectViewFinder and deletes UI Camera instance
+// Have to be called from UI thread in which UI Camera
+// have been created before the CMMACameraWindow instance
+// is deleted.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ReleaseUiResources()
+{
+ if (iUICamera)
+ {
+ SetViewFinderVisibility(EFalse);
+ // iStarterTimer is cancelled by previous call
+ // it can be deleted now
+ delete iStarterTimer;
+ iStarterTimer = NULL;
+ iUICamera->Release();
+ delete iUICamera;
+ iUICamera = NULL;
+ iCameraPowerOn = EFalse;
+ iDirectAccess->Cancel();
+ delete iDirectAccess;
+ iDirectAccess = NULL;
+ delete iErrorIconBitmap;
+ iErrorIconBitmap = NULL;
+ delete iErrorIconMaskBitmap;
+ iErrorIconMaskBitmap = NULL;
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::ResetViewFinder
+// Resets (stops and starts) viewfinder
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::ResetViewFinder()
+{
+
+ if (iStarterTimer && !iStarterTimer->IsActive() && iStarted)
+ {
+ SetViewFinderVisibility(EFalse);
+ SetViewFinderVisibility(ETrue);
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// CMMACameraWindow::Destroy
+// Deletes this object.
+// ---------------------------------------------------------------------------
+//
+void CMMACameraWindow::Destroy()
+{
+ // Delete itself
+ delete this;
+}
+
+
+// ---------------------------------------------------------------------------
+// From class MUiEventConsumer.
+// CMMACameraWindow::MdcDSAResourcesCallback
+// Callback to iDisplay->UIGetDSAResources().
+// Invoked asynchronously from UI Event Server thread.
+// ---------------------------------------------------------------------------
+//
+/*void CMMACameraWindow::MdcDSAResourcesCallback(
+ RWsSession &aWs,
+ CWsScreenDevice &aScreenDevice,
+ RWindowBase &aWindow)
+{
+ TRAPD(error, iDirectAccess = CDirectScreenAccess::NewL(aWs,
+ aScreenDevice,
+ aWindow,
+ *this));
+ LOG1(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::MdcDSAResourcesCallback, error = %d", error);
+ if (KErrNone != error)
+ {
+ return;
+ }
+ this->UIStartViewFinder(aWs, aScreenDevice, aWindow);
+}
+*/
+
+// ---------------------------------------------------------------------------
+// From class MUiEventConsumer.
+// CMMACameraWindow::MdcUICallback
+// Callback to iDisplay->UIGetCallback().
+// Invoked asynchronously from UI Event Server thread.
+// ---------------------------------------------------------------------------
+//
+
+void CMMACameraWindow::UICallback(TInt aCallbackId)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACameraWindow::MdcUICallback");
+
+ switch (aCallbackId)
+ {
+ case EDeleteViewFinder:
+ ReleaseUiResources();
+ break;
+ case EHideViewFinder:
+ SetViewFinderVisibility(EFalse);
+ break;
+ case EShowViewFinder:
+ SetViewFinderVisibility(ETrue);
+ break;
+ case EResetViewFinder:
+ ResetViewFinder();
+ break;
+ case EDestroyWindow:
+ Destroy();
+ break;
+ }
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Draws to Canvas.
+*
+*/
+
+
+// Include Files
+#include <logger.h>
+//#include <lcdui.h> // MMIDCanvas
+
+#ifdef EXTENDED_LCDUI_CANVAS
+#include <MMIDCanvasExtended.h>
+#endif
+
+#include "cmmacanvasdisplay.h"
+#include "cmmabitmapwindow.h"
+#include "mmafunctionserver.h"
+
+// CONSTRUCTION
+// Static constructor, leaves pointer to cleanup-stack
+CMMACanvasDisplay* CMMACanvasDisplay::NewLC(MMAFunctionServer* aEventSource, jobject obj/*MMIDCanvas* aCanvas*/)
+{
+ CMMACanvasDisplay* self =
+ new(ELeave) CMMACanvasDisplay(aEventSource, obj/*aCanvas*/);
+
+ CleanupStack::PushL(self);
+ self->Construct(aEventSource,obj);
+ return self;
+}
+
+// Destructor (virtual by CBase)
+CMMACanvasDisplay::~CMMACanvasDisplay()
+{
+}
+
+CMMACanvasDisplay::CMMACanvasDisplay(MMAFunctionServer* aEventSource ,jobject aJavaDisplayRef)
+{
+ /*
+iJni = aEventSource->getValidJniEnv();
+javaDisplayObject = iJni->NewGlobalRef(javadisplayref);
+javaDisplayClass = iJni->GetObjectClass(javaDisplayObject);
+*/
+}
+
+
+/*
+void CMMACanvasDisplay::SourceSizeChanged(const TSize& aSourceSize)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SourceSizeChanged");
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ if ( iWindow )
+ {
+ iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, aSourceSize ) );
+ }
+ #endif
+
+ iSourceSize = aSourceSize;
+ jmethodID getDisplayWidthID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getDisplayWidth",
+ "()I");
+
+ jmethodID getDisplayHeightID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getDisplayHeight",
+ "()I");
+
+
+ TInt x = iJni->CallIntMethod(iJavaDisplayObject,getDisplayWidthID);
+ TInt y = iJni->CallIntMethod(iJavaDisplayObject,getDisplayHeightID);
+
+ // TSize fullScreenSize(100,100); // TO-Do remove hardcoded with the relevent one
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasdisplay.cpp : SourceSizeChanged () fullScreenSize is x = %d ,y = %d ",x,y);
+ // get the ScreenSize from canvas in java
+ TSize canvasSize(x, y);
+ fullScreenSize = canvasSize;
+ TBool sourceIsBigger = (aSourceSize.iWidth > fullScreenSize.iWidth ||
+ aSourceSize.iHeight > fullScreenSize.iHeight);
+
+ if (sourceIsBigger)
+ {
+ // Source is larger than display area.
+ // Shrink draw are to fit in display.
+ iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
+ }
+ else
+ {
+ // source is smaller than display area
+ iWindow->SetDrawRect(TRect(iUserRect.iTl, iSourceSize));
+ }
+
+ SetClippingRegion();
+
+ if (iUserRect.IsEmpty())
+ {
+ // Java side hasn't set size.
+ iUserRect = iWindow->DrawRect();
+
+ if (!sourceIsBigger)
+ {
+ // Addjusting rect to top left corner.
+ iUserRect = TRect(iUserRect.Size());
+ }
+ }
+}
+
+*/
+
+void CMMACanvasDisplay::SetFullScreenL(TBool aFullScreen)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL +");
+ iFullScreen = aFullScreen;
+ if (iContainerVisible)
+ {
+ RemoveClippingRegion();
+
+ if (aFullScreen)
+ {
+ // use new scaled rect
+ // iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
+ iWindow->SetDrawRectThread(ScaleToFullScreen(fullScreenSize, iSourceSize));
+ }
+ else
+ {
+ // use size set from java
+ //iWindow->SetDrawRect(iUserRect);
+ iWindow->SetDrawRectThread(iUserRect);
+ }
+
+ AddClippingRegion();
+ }
+ LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL +");
+}
+
+void CMMACanvasDisplay::SetWindowL(MMMADisplayWindow* aWindow)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMACanvasDisplay::SetWindowL");
+ CMMADisplay::SetWindowL(aWindow);
+ if (!iWindow)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMACanvasDisplay::SetWindowL: NULL window, returning");
+ return;
+ }
+ /*
+ CFbsBitmap* bitmap = iCanvas->FrameBuffer();
+
+ __ASSERT_DEBUG(bitmap,
+ User::Panic(_L("Canvas has no bitmap"),
+ KErrNotFound));
+
+ iWindow->SetDestinationBitmapL(bitmap);
+
+ // Check that container exists
+ User::LeaveIfNull(iDirectContainer);
+
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACanvasDisplay::SetWindowL iDirectContainer->MdcContentBounds() TL %d %d", iDirectContainer->MdcContentBounds().iTl.iX, iDirectContainer->MdcContentBounds().iTl.iY);
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMACanvasDisplay::SetWindowL iDirectContainer->MdcContentBounds() BR %d %d", iDirectContainer->MdcContentBounds().iBr.iX, iDirectContainer->MdcContentBounds().iBr.iY);
+ */
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::before calling BoundRect");
+ TRect boundrect = BoundRect();
+ iWindow->SetWindowRect(boundrect/*iDirectContainer->MdcContentBounds()*/, MMMADisplay::EMmaThread);
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ //iWindow->SetRWindowRect( iDirectContainer->MdcContainerWindowRect(),
+ // MMMADisplay::EMmaThread );
+ iWindow->SetRWindowRect( boundrect,
+ MMMADisplay::EMmaThread );
+ #endif
+
+ SetClippingRegion();
+}
+
+
+
+TRect& CMMACanvasDisplay::BoundRect()
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect +");
+ jmethodID getBoundRectID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getBoundRect",
+ "()V");
+
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect --1");
+ // set the value to java,so that we can access those from array
+ iJni->CallVoidMethod(iJavaDisplayObject,getBoundRectID);
+ jfieldID field = iJni->GetFieldID(iJavaDisplayClass, "displayboundarr", "[I");
+ if(field == NULL)
+ {
+ // handle error
+ }
+ /* Read the instance field s */
+ jintArray javaboundinfoarr = (jintArray)iJni->GetObjectField(iJavaDisplayObject, field);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect --2");
+ jint* nativeboundinfoarr = iJni->GetIntArrayElements(javaboundinfoarr, NULL);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect --3");
+ if (!nativeboundinfoarr)
+ { // outputBuffer was already allocated
+ iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr, JNI_ABORT);
+ // return invalid rect.
+ TRect rect(0,0,0,0);
+ return rect;
+ }
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect --4");
+// create TRect
+ TInt xcoordinate = nativeboundinfoarr[0];
+ TInt ycoordinate = nativeboundinfoarr[1];
+ TInt width = nativeboundinfoarr[2];
+ TInt height = nativeboundinfoarr[3];
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay: BoundRect() co-ordinate of topleftcorner is x = %d,y =%d",xcoordinate,ycoordinate);
+ LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay: BoundRect() size of bound rect is width = %d,height =%d",width,height);
+ TPoint topleft(xcoordinate,ycoordinate);
+ TSize rectsize(width,height);
+ TRect boundRect(topleft,rectsize);
+ iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr, JNI_COMMIT);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect -");
+ return boundRect;
+}
+
+// ask java side peer about the container rect size
+// currently assuming the boundrect and containerrect will be same in case of canvas
+TRect& CMMACanvasDisplay::ContainerWindowRect()
+{
+
+ return BoundRect();
+
+}
+
+
+void CMMACanvasDisplay::SetDisplayLocationL(const TPoint& aPosition)
+{
+ // Move iUserRect top left corner to aPosition.
+ TSize size(iUserRect.Size());
+ iUserRect.iTl = aPosition;
+ iUserRect.SetSize(size);
+
+ if (iContainerVisible && !iFullScreen && iWindow)
+ {
+ iWindow->SetDrawRect(iUserRect);
+ SetClippingRegion();
+ }
+ else
+ {
+ iResetDrawRect = ETrue;
+ }
+}
+
+TPoint CMMACanvasDisplay::DisplayLocation()
+{
+ if (iWindow && iFullScreen)
+ {
+ return iWindow->DrawRect().iTl;
+ }
+ else
+ {
+ return iUserRect.iTl;
+ }
+}
+
+
+
+
+
+/*
+void CMMACanvasDisplay::MdcContentBoundsChanged(const TRect& aRect)
+{
+ LOG2(EJavaMMAPI,EInfo,"MID::CMMACanvasDisplay::MdcContentBoundsChanged aRect TL %d %d",
+ aRect.iTl.iX, aRect.iTl.iY);
+ LOG2(EJavaMMAPI,EInfo,"MID::CMMACanvasDisplay::MdcContentBoundsChanged aRect BR %d %d",
+ aRect.iBr.iX, aRect.iBr.iY);
+
+ if (iWindow)
+ {
+ // Set new rect to window.
+ iWindow->SetWindowRect(aRect, MMMADisplay::EUiThread);
+
+ if (iFullScreen)
+ {
+ TRect fullRect = ScaleToFullScreen(iCanvas->ContentSize(),
+ iSourceSize);
+
+ // use SetDrawRectThread because this code is executed
+ // in lcdui thread
+ iWindow->SetDrawRectThread(fullRect);
+ }
+ else
+ {
+ // move to user defined position.
+ iWindow->SetPosition(iUserRect.iTl);
+ }
+ }
+ SetClippingRegion();
+}
+*/
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is base interface for all controls.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmmacontrol.h"
+
+const TDesC* CMMAControl::ClassNameJni(CMMAControl* aControl)
+{
+ return &aControl->ClassName();
+}
+
+void CMMAControl::StaticSetHandle(CMMAControl* aControl,
+ jobject aControlObject)
+{
+ aControl->SetHandle(aControlObject);
+}
+
+EXPORT_C const TDesC& CMMAControl::PublicClassName() const
+{
+ return ClassName();
+}
+
+inline void CMMAControl::SetHandle(jobject aControlObject)
+{
+ iControlObject = aControlObject;
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmadeleterefevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadeleterefevent.h"
+
+CMMADeleteRefEvent::CMMADeleteRefEvent(jobject aDeleteRefObject):
+ CMMAEvent(EDisposableEvent)
+{
+ iDeleteRefObject = aDeleteRefObject;
+}
+
+// from CJavaEvent
+void CMMADeleteRefEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADeleteRefEvent::Dispatch");
+ aJni.DeleteGlobalRef(iDeleteRefObject);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,752 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements MMMADisplay
+*
+*/
+
+
+// Include Files
+#include "logger.h"
+
+#include "cmmadisplay.h"
+#include "mmmadisplaywindow.h"
+
+// temporary
+#include <w32std.h>
+
+// Destructor (virtual by CBase)
+CMMADisplay::~CMMADisplay()
+{
+/*
+ if (iDirectContainer)
+ {
+ // Remove clip rect if set
+ if (!iClipRect.IsEmpty())
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::~CMMADisplay(): Removing clip rect");
+ iDirectContainer->MdcRemoveContentBounds(iClipRect);
+ }
+
+ // Remove this object from MDirectContainer
+ iDirectContainer->MdcRemoveContent(this);
+ }
+ */
+}
+
+
+CMMADisplay::CMMADisplay():
+ iVisible(ETrue),
+ iFullScreen(EFalse),
+ iContainerVisible(ETrue),
+ iIsForeground(ETrue),
+ iResetDrawRect(EFalse)
+{
+}
+
+void CMMADisplay::Construct(MMAFunctionServer* eventSource , jobject javadisplayref)
+{
+ iEventSource = eventSource;
+ iJni = iEventSource->getValidJniEnv();
+ iJavaDisplayObject = iJni->NewGlobalRef(javadisplayref);
+ iJavaDisplayClass = iJni->GetObjectClass(iJavaDisplayObject);
+ // Components must have direct content.
+ /* __ASSERT_LOG(EJavaMMAPI,EInfo,"aDirectContainer, User::Invariant());
+
+ // Not owned
+ iDirectContainer = aDirectContainer;
+
+ // Get component visibility. Later visibility changes will
+ // be informed through MDirectContent observer.
+ iContainerVisible = iDirectContainer->MdcContainerVisibility();
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iVisible = %d", iVisible);
+
+ // Add this MDirectContent to the MDirectContainer. Cannot fail.
+ iDirectContainer->MdcAddContent(this);
+ */
+}
+
+TRect CMMADisplay::ScaleToFullScreen(const TSize& aFullScreenSize,
+ const TSize& aSourceSize)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::ScaleToFullScreen() +");
+ if ((aSourceSize.iWidth == 0) &&
+ (aSourceSize.iHeight == 0))
+ {
+ // Avoid divide by zero.
+ return TRect();
+ }
+
+ // Width or height will be full size.
+ TRect drawRect(TPoint(0, 0),
+ aFullScreenSize);
+
+ // Smaller dimension scale ratio will be scaled.
+ // Changed to area calculation to avoid reals and dimension
+ // with smaller area will be scaled.
+ TInt vDif((aFullScreenSize.iWidth - aSourceSize.iWidth)
+ * aFullScreenSize.iHeight);
+ TInt hDif((aFullScreenSize.iHeight - aSourceSize.iHeight)
+ * aFullScreenSize.iWidth);
+
+ TPoint position(0, 0);
+
+ // Check which side to scale to fullscreen size.
+ if (hDif > vDif)
+ {
+ // Width is full screen width.
+ // Scale height with aspect ratio.
+ drawRect.iBr.iY = aFullScreenSize.iWidth * aSourceSize.iHeight
+ / aSourceSize.iWidth;
+ // move rect middle of the screen
+ position.iY = (aFullScreenSize.iHeight - drawRect.iBr.iY) / 2;
+ }
+ else
+ {
+ // Height is full screen height.
+ // Scale width with aspect ratio.
+ drawRect.iBr.iX = aFullScreenSize.iHeight * aSourceSize.iWidth
+ / aSourceSize.iHeight;
+ // move rect middle of the screen
+ position.iX = (aFullScreenSize.iWidth - drawRect.iBr.iX) / 2;
+ }
+
+ drawRect.Move(position);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::ScaleToFullScreen() -");
+ return drawRect;
+}
+
+// from MMMADisplay
+void CMMADisplay::DrawFrameL(const CFbsBitmap* aBitmap)
+{
+ // This method is called only if bitmap is used.
+ // Runs in mmapi thread
+ if (iVisible && iWindow /*&& iDirectContainer*/)
+ {
+ iWindow->DrawFrameL(aBitmap);
+ //iDirectContainer->MdcFlushContainer(iWindow->WindowRect());
+ }
+}
+
+void CMMADisplay::SetClippingRegion()
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion");
+
+ if (!iWindow ||
+ (iWindow->GetDisplayWindowType() == MMMADisplayWindow::EDisplayWindowTypeIsBitmap) ||
+ iClipRect == iWindow->DrawRect() && iContainerVisible && iVisible)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion before return");
+ return;
+ }
+
+ TBool refreshScreen(EFalse);
+ // Remove first the current clip rect if set
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: iClipRect = %d X %d",iClipRect.Width(),iClipRect.Height());
+ if (!iClipRect.IsEmpty())
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: Removing old rect");
+ //iDirectContainer->MdcRemoveContentBounds(iClipRect);
+ iClipRect.SetRect(0, 0, 0, 0);
+ refreshScreen = ETrue;
+ }
+ // If visible then set a new clip rect
+ if (iVisible && iContainerVisible)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: inside if (iVisible && iContainerVisible)");
+ iClipRect = iWindow->DrawRect();
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: inside if (iVisible && iContainerVisible)iClipRect = %d X %d",iClipRect.Width(),iClipRect.Height());
+ if (!iClipRect.IsEmpty())
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: Adding new rect");
+ // Add new clipping rect
+ // iDirectContainer->MdcAddContentBounds(iClipRect);
+ SetContentBoundToJavaControl(iClipRect);
+ refreshScreen = ETrue;
+ }
+ }
+ if (refreshScreen)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: inside if(refreshScreen)");
+ // refresh screen
+ // iDirectContainer->MdcFlushContainer(iWindow->WindowRect());
+ RefreshJavaControl(iWindow->WindowRect());
+ }
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion -");
+}
+
+void CMMADisplay::RemoveClippingRegion()
+{
+ // Called in mmapi thread
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::RemoveClippingRegion");
+
+ if (!iWindow ||
+ (iWindow->GetDisplayWindowType() == MMMADisplayWindow::EDisplayWindowTypeIsBitmap))
+ {
+ return;
+ }
+ // Remove first the current clip rect if set
+ if (!iClipRect.IsEmpty())
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::RemoveClippingRegion: Removing old rect");
+ //iDirectContainer->MdcRemoveContentBounds(iClipRect);
+ RemoveContentBoundFromJavaControl(iClipRect);
+ iClipRect.SetRect(0, 0, 0, 0);
+ // refresh screen
+ //iDirectContainer->MdcFlushContainer(iWindow->WindowRect());
+ RefreshJavaControl(iWindow->WindowRect());
+ }
+}
+
+void CMMADisplay::AddClippingRegion()
+{
+ // Called in mmapi thread
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::AddClippingRegion");
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::AddClippingRegion iClipRect width = %d height = %d", iClipRect.Width() , iClipRect.Height());
+
+ if (!iWindow ||
+ (iWindow->GetDisplayWindowType() ==
+ MMMADisplayWindow::EDisplayWindowTypeIsBitmap) ||
+ iClipRect == iWindow->DrawRect())
+ {
+ return;
+ }
+ // If visible then set a new clip rect
+ if (iVisible)
+ {
+ iClipRect = iWindow->DrawRect();
+ if (!iClipRect.IsEmpty())
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::AddClippingRegion: Adding new rect");
+ // Add new clipping rect
+ // iDirectContainer->MdcAddContentBounds(iClipRect);
+ SetContentBoundToJavaControl(iClipRect);
+ // refresh screen
+ // iDirectContainer->MdcFlushContainer(
+ // iWindow->WindowRect());
+ RefreshJavaControl(iWindow->WindowRect());
+ }
+ }
+}
+
+// from MMMADisplay
+TSize CMMADisplay::DisplaySize()
+{
+ if (iWindow && iFullScreen)
+ {
+ return iWindow->DrawRect().Size();
+ }
+ else
+ {
+ return iUserRect.Size();
+ }
+}
+
+// from MMMADisplay
+void CMMADisplay::SetDisplaySizeL(const TSize& aSize)
+{
+ // user rect contains size set from java.
+ iUserRect.SetSize(aSize);
+ LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ // Size change has no effect if fullscreen mode is on.
+ // New size could be used when fullscreen is turned off.
+ if (iContainerVisible && !iFullScreen && iWindow)
+ {
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ RemoveClippingRegion();
+ LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after removingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ iWindow->SetDrawRect(iUserRect);
+ AddClippingRegion();
+ LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after AddingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+ }
+ else
+ {
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ iResetDrawRect = ETrue;
+ }
+}
+
+// from MMMADisplay
+void CMMADisplay::SetVisible(TBool aValue)
+{
+ iVisible = aValue;
+ // Window may be set visible only if container is on screen,
+
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible iVisible = %d", iVisible);
+ if (!iIsForeground)
+ {
+ LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible - iIsForeground = 0");
+ return;
+ }
+ // if not it can not be set visible.
+ if (iWindow && iContainerVisible)
+ {
+ // iWindow->SetVisible(aValue, EFalse);
+ //MMAPI UI 3.x req. (had to comment above line and add below line which excutes in FS thread)
+ iWindow->SetVisible(aValue, ETrue);
+ SetClippingRegion();
+ }
+}
+
+
+void CMMADisplay::SetContainerVisibility(TBool aValue)
+{
+ iContainerVisible = aValue;
+ // TODO : delete the below check once implementation is done as it is used only for testing purpose
+ if(iContainerVisible)
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay:SetContainerVisibility(): Container is visible ");
+ else
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay:SetContainerVisibility(): Container is not visible ");
+
+ HandleContainerVisibilityChanged(aValue);
+}
+// from MMMADisplay
+void CMMADisplay::SetWindowL(MMMADisplayWindow* aWindow)
+{
+ // Sets new window. Ownership is not transferred.
+ iWindow = aWindow;
+}
+
+// from MMMADisplay
+MMMADisplayWindow* CMMADisplay::Window()
+{
+ return iWindow;
+}
+
+TBool CMMADisplay::IsVisible()
+{
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible);
+ LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iVisible = %d", iVisible);
+ // display is visible if container is on screen and
+ // java side has set it visible
+ return iVisible && iContainerVisible;
+}
+
+TBool CMMADisplay::IsFullScreen()
+{
+ return iFullScreen;
+}
+
+TBool CMMADisplay::HasContainer()
+{
+ // return iDirectContainer != NULL;
+ return EFalse; // temporary
+}
+
+
+void CMMADisplay::HandleContainerVisibilityChanged( TBool aVisible )
+ {
+ LOG1(EJavaMMAPI,EInfo, "CMMADisplay::HandleContainerVisibilityChanged aVisible = %d",
+ aVisible );
+ if(!iIsForeground && aVisible)
+ {
+ LOG(EJavaMMAPI,EInfo," CMMADisplay::HandleContainerVisibilityChanged Condition 1 ");
+ return;
+ }
+
+ LOG(EJavaMMAPI,EInfo," CMMADisplay::HandleContainerVisibilityChanged After condition1");
+
+ if (iWindow)
+ {
+ // midlet comes to foreground (0 to 1 transition),
+ // Allow turn on or turn off based on aVisible
+ if (aVisible != iWindow->IsVisible())
+ {
+ // Allow
+ LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged Allow ");
+ }
+ else if( iContainerVisible == aVisible )
+ {
+ LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible ");
+ // if state is not changed, we do not need to do it again
+ return;
+ }
+ }
+
+ LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged After condition2");
+
+ if (iWindow)
+ {
+ LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iWindow is valid ");
+ // change is only needed if java side has set display visible or
+ // if container loses focus
+ if (!iContainerVisible || iVisible)
+ {
+ if (iResetDrawRect && aVisible && !iFullScreen)
+ {
+ iWindow->SetDrawRectThread(iUserRect);
+ iResetDrawRect = EFalse;
+ }
+ if (iIsForeground)
+ {
+ iWindow->SetVisible(aVisible);
+ }
+ SetClippingRegion();
+ }
+ }
+}
+
+/*
+
+void CMMADisplay::MdcItemContentRectChanged(const TRect& aContentRect,
+ const TRect& aScreenRect)
+{
+ // To be overwritten if used
+ __ASSERT_LOG(EJavaMMAPI,EInfo,"EFalse, User::Invariant());
+}
+
+void CMMADisplay::MdcContainerWindowRectChanged(const TRect&
+ #ifdef RD_JAVA_NGA_ENABLED
+ aRect
+ #endif
+ )
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerWindowRectChanged +");
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ if( iWindow )
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerWindowRectChanged, SetRWindowRect");
+ iWindow->SetRWindowRect(aRect, MMMADisplay::EUiThread);
+ }
+ #endif
+ }
+void CMMADisplay::MdcContainerDestroyed()
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMADisplay::MdcContainerDestroyed");
+
+ if (iWindow)
+ {
+ iWindow->ContainerDestroyed();
+ }
+
+ iDirectContainer = NULL;
+}
+
+
+void CMMADisplay::MdcAbortDSA()
+{
+ if (iWindow)
+ {
+ iWindow->AbortDSA();
+ }
+}
+
+
+void CMMADisplay::MdcResumeDSA()
+{
+ if (iWindow)
+ {
+ iWindow->ResumeDSA();
+ }
+}
+
+void CMMADisplay::UIGetCallback(
+ MUiEventConsumer& aConsumer,
+ TInt aCallbackId)
+{
+ if (iDirectContainer)
+ {
+ iDirectContainer->MdcGetUICallback(aConsumer, aCallbackId);
+ }
+}
+*/
+
+
+void CMMADisplay::GetCallbackInUiThread(TInt placeholder)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread +");
+
+
+
+
+
+
+
+
+ jmethodID getCallBackMethodID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "GetCallbackInUiThread",
+ "(I)V");
+ // LOG1(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
+ iJni->CallVoidMethod(iJavaDisplayObject,getCallBackMethodID,placeholder);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::GetCallbackInUiThread -");
+}
+
+void CMMADisplay::CalledBackInUiThread(TInt placeholder)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::CalledBackInUiThread +");
+ iWindow->UICallback(placeholder);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::CalledBackInUiThread -");
+
+}
+
+void CMMADisplay::SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight)
+ {
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged(aSourceSize,aJavaControlWidth,aJavaControlHeight) + aJavaControlWidth = %d ,aJavaControlHeight = %d",aJavaControlWidth,aJavaControlHeight);
+ iSourceSize = SourceSize();
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged(aSourceSize,aJavaControlWidth,aJavaControlHeight) + sourcesize = %d X %d",iSourceSize.iWidth , iSourceSize.iHeight);
+ #ifdef RD_JAVA_NGA_ENABLED
+ if ( iWindow )
+ {
+ iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, iSourceSize ) );
+ }
+ #endif
+
+ // size of canvas in java
+ TSize canvasSize(aJavaControlWidth, aJavaControlHeight);
+ fullScreenSize = canvasSize;
+ TBool sourceIsBigger = (iSourceSize.iWidth > fullScreenSize.iWidth ||
+ iSourceSize.iHeight > fullScreenSize.iHeight);
+
+ if (sourceIsBigger)
+ {
+ // Source is larger than display area.
+ // Shrink draw are to fit in display.
+ iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
+ }
+ else
+ {
+ // source is smaller than display area
+ iWindow->SetDrawRect(TRect(iUserRect.iTl, iSourceSize));
+ }
+
+ SetClippingRegion();
+
+ if (iUserRect.IsEmpty())
+ {
+ // Java side hasn't set size.
+ iUserRect = iWindow->DrawRect();
+
+ if (!sourceIsBigger)
+ {
+ // Addjusting rect to top left corner.
+ iUserRect = TRect(iUserRect.Size());
+ }
+ }
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged(aSourceSize,aJavaControlWidth,aJavaControlHeight) -");
+ }
+
+void CMMADisplay::SetWindowResources(QWidget* qtWidget)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources +");
+ CCoeControl* control = 0;
+ if(qtWidget && qtWidget ->winId())
+ {
+ control = reinterpret_cast<CCoeControl*>(qtWidget->winId());
+ }
+
+ CCoeEnv *coeEnv = control->ControlEnv();
+ RWsSession * iWs = &(coeEnv->WsSession());
+ CWsScreenDevice* iScreenDevice = coeEnv->ScreenDevice();
+ RWindowBase* window = static_cast<RWindowBase*>(control->DrawableWindow());
+ if (!iWindow)
+ {
+ return;
+ }
+ iWindow->ProcureWindowResourcesFromQWidget(iWs,iScreenDevice,window);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources -");
+ }
+
+
+void CMMADisplay::SetForeground(TBool aForeground, TBool aUseEventServer)
+{
+ LOG1(EJavaMMAPI,EInfo,"MMA::CMMADisplay::SetForeground %d", aForeground);
+ iIsForeground = aForeground;
+
+ if (aForeground)
+ {
+ if (iContainerVisible && !iWindow->IsVisible())
+ {
+ iWindow->SetVisible(ETrue, aUseEventServer);
+ }
+ }
+ else
+ {
+ if (iWindow->IsVisible())
+ {
+ iWindow->SetVisible(EFalse, aUseEventServer);
+ }
+ }
+}
+
+TSize CMMADisplay::SourceSize()
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetSourceSizeToDisplay ");
+ return iUiPlayer->SourceSize();
+ }
+
+void CMMADisplay::SetUIPlayer(MMMAGuiPlayer* player)
+ {
+ iUiPlayer = player;
+ }
+
+
+void CMMADisplay::SourceSizeChanged(const TSize& aSourceSize)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged");
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ if ( iWindow )
+ {
+ iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, aSourceSize ) );
+ }
+ #endif
+
+ iSourceSize = aSourceSize;
+ jmethodID getDisplayWidthID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getDisplayWidth",
+ "()I");
+
+ jmethodID getDisplayHeightID = iJni->GetMethodID(
+ iJavaDisplayClass,
+ "getDisplayHeight",
+ "()I");
+
+
+ TInt x = iJni->CallIntMethod(iJavaDisplayObject,getDisplayWidthID);
+ TInt y = iJni->CallIntMethod(iJavaDisplayObject,getDisplayHeightID);
+ LOG2(EJavaMMAPI,EInfo,"CMMADisplay.cpp : SourceSizeChanged () fullScreenSize is x = %d ,y = %d ",x,y);
+ // get the ScreenSize from canvas in java
+ TSize canvasSize(x, y);
+ fullScreenSize = canvasSize;
+ TBool sourceIsBigger = (aSourceSize.iWidth > fullScreenSize.iWidth ||
+ aSourceSize.iHeight > fullScreenSize.iHeight);
+
+ if (sourceIsBigger)
+ {
+ // Source is larger than display area.
+ // Shrink draw are to fit in display.
+ iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
+ }
+ else
+ {
+ // source is smaller than display area
+ iWindow->SetDrawRect(TRect(iUserRect.iTl, iSourceSize));
+ }
+
+ SetClippingRegion();
+
+ if (iUserRect.IsEmpty())
+ {
+ // Java side hasn't set size.
+ iUserRect = iWindow->DrawRect();
+
+ if (!sourceIsBigger)
+ {
+ // Addjusting rect to top left corner.
+ iUserRect = TRect(iUserRect.Size());
+ }
+ }
+}
+
+
+
+void CMMADisplay::SetDisplayPosition(TInt uiControlLocationX,TInt uiControlLocationY,TInt videoControlLocationX,TInt videoControlLocationY)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged + ");
+ TPoint point(videoControlLocationX ,videoControlLocationY);
+ //calling derived class fuction
+ SetDisplayLocationL(point);
+ LOG(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged - ");
+}
+
+
+void CMMADisplay::ResetJavaRectObject(const TRect& aRect)
+ {
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject +");
+ JNIEnv* validJni = iEventSource->getValidJniEnv();
+ jmethodID setRectID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "setRect",
+ "()V");
+
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --1");
+ // set the value to java,so that we can access those from array
+ jfieldID field = validJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");
+ if(field == NULL)
+ {
+ // handle error
+ }
+ /* Write to the instance fields */
+ jintArray javaDimensionarr = (jintArray)validJni->GetObjectField(iJavaDisplayObject, field);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --2");
+ jint* nativeRectDimensionArr = validJni->GetIntArrayElements(javaDimensionarr, NULL);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject --3");
+ if (!nativeRectDimensionArr)
+ { // inputBuffer was already allocated
+ validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_ABORT);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject Error in resetting rect dimension to java");
+ return;
+ }
+ nativeRectDimensionArr[0] = aRect.iTl.iX;
+ nativeRectDimensionArr[1] = aRect.iTl.iY;;
+ nativeRectDimensionArr[2] = aRect.Width();
+ nativeRectDimensionArr[3] = aRect.Height();
+ // Now the dimension array in java is updated hence reset the java rect
+ validJni->CallVoidMethod(iJavaDisplayObject,setRectID);
+
+ validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_COMMIT);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject -");
+}
+
+
+void CMMADisplay::SetContentBoundToJavaControl(const TRect& aRect)
+ {
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl +");
+ JNIEnv* validJni = iEventSource->getValidJniEnv();
+ // Reset the java rect
+ ResetJavaRectObject(aRect);
+ jmethodID setContentBoundID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "setContentBound",
+ "()V");
+ // call java function
+ validJni->CallVoidMethod(iJavaDisplayObject,setContentBoundID);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::SetContentBoundToJavaControl -");
+ }
+
+void CMMADisplay::RemoveContentBoundFromJavaControl(const TRect& aRect)
+ {
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl +");
+ JNIEnv* validJni = iEventSource->getValidJniEnv();
+ // Reset the java rect
+ ResetJavaRectObject(aRect);
+ jmethodID removeContentBoundID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "removeContentBound",
+ "()V");
+ // call java function
+ validJni->CallVoidMethod(iJavaDisplayObject,removeContentBoundID);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RemoveContentBoundFromJavaControl -");
+ }
+
+void CMMADisplay::RefreshJavaControl(const TRect& aRect)
+ {
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl +");
+ JNIEnv* validJni = iEventSource->getValidJniEnv();
+ // Reset the java rect
+ //ResetJavaRectObject(aRect);
+ jmethodID redrawControlID = validJni->GetMethodID(
+ iJavaDisplayClass,
+ "redrawControl",
+ "()V");
+ // call java function
+ validJni->CallVoidMethod(iJavaDisplayObject,redrawControlID);
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::RefreshJavaControl -");
+ }
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmadurationupdater.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Send update duration event if needed when player state changes
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadurationupdater.h"
+
+CMMADurationUpdater* CMMADurationUpdater::NewL(CMMAPlayer& aPlayer)
+{
+ CMMADurationUpdater* self = new(ELeave) CMMADurationUpdater(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+CMMADurationUpdater::CMMADurationUpdater(CMMAPlayer& aPlayer)
+ : iPlayer(aPlayer), iDuration(KErrNotFound), iSecondStart(EFalse)
+{
+}
+
+void CMMADurationUpdater::ConstructL()
+{
+ iPlayer.AddStateListenerL(this);
+}
+
+CMMADurationUpdater::~CMMADurationUpdater()
+{
+ iPlayer.RemoveStateListener(this);
+}
+
+void CMMADurationUpdater::StateChanged(TInt aState)
+{
+ TInt64 duration = 0;
+ iPlayer.GetDuration(&duration);
+
+ if ((duration >= KErrNotFound) && (duration != iDuration))
+ {
+ // Send DURATION_UPDATED
+ iDuration = duration;
+ iPlayer.PostLongEvent(CMMAPlayerEvent::EDurationUpdated, iDuration);
+ }
+ else if (duration == KErrNotFound && aState == CMMAPlayer::EStarted && !iSecondStart)
+ {
+ // for medias whose duration is unknown (e.g. streaming audio amr)
+ // must post EDurationUpdated event with duration -1 in first start
+ iPlayer.PostLongEvent(CMMAPlayerEvent::EDurationUpdated, iDuration);
+ iSecondStart = ETrue;
+ }
+
+ if (aState == CMMAPlayer::ERealized)
+ {
+ iSecondStart = EFalse;
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaevent.h"
+
+CMMAEvent::CMMAEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable):
+ iListenerObject(aNotifyObject),
+ iHandleEventMethod(aHandleEventMethod)
+{
+}
+
+
+CMMAEvent::CMMAEvent(TDisposability /*aDisposable*/)
+{
+}
+
+
+void CMMAEvent::SetEventData(TInt aEventData)
+{
+ iEventData = aEventData;
+}
+
+
+// from CJavaEvent
+void CMMAEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAEvent::Dispatch iEventData=%d", iEventData);
+
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventData);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaframepositioningcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract base class for FramePositioningControl
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmaplayer.h"
+#include "cmmaframepositioningcontrol.h"
+
+CMMAFramePositioningControl::CMMAFramePositioningControl(CMMAPlayer* aPlayer)
+ : iPlayer(aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAFramePositioningControl::CMMAFramePositioningControl");
+}
+
+CMMAFramePositioningControl::~CMMAFramePositioningControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAFramePositioningControl::~CMMAFramePositioningControl");
+}
+
+const TDesC& CMMAFramePositioningControl::ClassName() const
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAFramePositioningControl::ClassName");
+ return KMMAFramePositioningControlName;
+}
+
+TInt CMMAFramePositioningControl::ClampMediaTime(TInt64& aMediaTime)
+{
+ TInt64 duration = 0;
+ iPlayer->GetDuration(&duration);
+ if (duration < 0)
+ {
+ return KErrNotFound;
+ }
+
+ if (aMediaTime > duration)
+ {
+ aMediaTime = duration;
+ }
+ else if (aMediaTime < 0)
+ {
+ aMediaTime = 0;
+ }
+ return KErrNone;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaitemdisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Bitmap display that draws to the Java CustomItem's bitmap.
+*
+*/
+
+
+// Include Files
+#include <logger.h>
+//#include <lcdui.h>
+
+#include "cmmaitemdisplay.h"
+#include "cmmabitmapwindow.h"
+
+// CONSTRUCTION
+// Static constructor, leaves pointer to cleanup-stack
+CMMAItemDisplay* CMMAItemDisplay::NewLC(/*MMIDCustomItem* aCustomItem*/)
+{
+ CMMAItemDisplay* self = new(ELeave) CMMAItemDisplay(/*aCustomItem*/);
+ CleanupStack::PushL(self);
+ // self->Construct(/*&(aCustomItem->DirectContainer())*/);
+ return self;
+}
+
+
+// Destructor (virtual by CBase)
+CMMAItemDisplay::~CMMAItemDisplay()
+{
+}
+
+
+CMMAItemDisplay::CMMAItemDisplay(/*MMIDCustomItem* aCustomItem*/)
+ //: iItem(aCustomItem)
+{
+ iVisible = ETrue; // Item is visible at startup
+}
+
+void CMMAItemDisplay::SizeChangedL(CMMAItemDisplay* aDisplay,
+ TInt /*aWidth*/,
+ TInt /*aHeight*/)
+// currently width and height is ignored
+// may be used later to layout the image.
+{
+ /*
+ if (aDisplay->iWindow)
+ {
+ CFbsBitmap* bitmap = aDisplay->iItem->FrameBuffer();
+ aDisplay->iWindow->SetDestinationBitmapL(bitmap);
+ }
+ */
+}
+
+void CMMAItemDisplay::SetFullScreenL(TBool aFullScreen)
+{
+ iFullScreen = aFullScreen;
+ if (!iWindow)
+ {
+ return;
+ }
+ if (aFullScreen)
+ {
+ // switch to fullscreen
+ iWindow->SetDrawRect(ScaleToFullScreen(
+ iWindow->WindowSize(), iSourceSize));
+ }
+ else
+ {
+ // switch to normal screen
+ iWindow->SetDrawRect(iUserRect);
+ }
+}
+
+void CMMAItemDisplay::SetWindowL(MMMADisplayWindow* aWindow)
+{
+ CMMADisplay::SetWindowL(aWindow);
+ if (!iWindow)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAItemDisplay::SetWindowL: NULL window, returning");
+ return;
+ }
+ iSourceSize = iWindow->WindowSize();
+ /* CFbsBitmap* bitmap = iItem->FrameBuffer();
+
+ if (bitmap)
+ {
+ iWindow->SetDestinationBitmapL(bitmap);
+ }
+ */
+}
+
+void CMMAItemDisplay::SetDisplayLocationL(const TPoint& /*aPosition*/)
+{
+ // In item( USE_GUI_PRIMITIVE ) mode, this call will be ignored.
+}
+
+
+TPoint CMMAItemDisplay::DisplayLocation()
+{
+ // Java Item's location is always 0, 0
+ return TPoint(0, 0);
+}
+
+void CMMAItemDisplay::SourceSizeChanged(const TSize& aSourceSize)
+{
+ LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
+ aSourceSize.iWidth);
+ LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
+ aSourceSize.iHeight);
+
+ #ifdef RD_JAVA_NGA_ENABLED
+ if ( iWindow )
+ {
+ iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, aSourceSize ) );
+ }
+ #endif
+
+ iSourceSize = aSourceSize;
+
+ if (iWindow)
+ {
+ TRect clientRect(iUserRect.iTl, aSourceSize);
+
+ iWindow->SetDrawRect(clientRect);
+ // Setting initial window size if not already set, actual size will
+ // be set in MdcItemContentRectChanged()
+ if (iWindow->WindowSize() == TSize())
+ {
+ iWindow->SetWindowRect(clientRect, MMMADisplay::EMmaThread);
+ }
+ }
+
+ SetClippingRegion();
+
+ if (iUserRect.IsEmpty())
+ {
+ // Java side hasn't set size.
+ iUserRect.SetSize(iSourceSize);
+ }
+}
+
+void CMMAItemDisplay::StaticSourceSize(CMMAItemDisplay* aDisplay,
+ TSize* aSize)
+{
+ *aSize = aDisplay->iUserRect.Size();
+}
+
+/*void CMMAItemDisplay::MdcItemContentRectChanged(const TRect& aContentRect,
+ const TRect& aScreenRect)
+{
+ if (iWindow)
+ {
+ // Change windows rect.
+ iWindow->SetWindowRect(aScreenRect, MMMADisplay::EUiThread);
+ TRect drawRect = aContentRect;
+ drawRect.Move(- aScreenRect.iTl);
+ iWindow->SetDrawRectThread(drawRect);
+ }
+ SetClippingRegion();
+}
+*/
+/*void CMMAItemDisplay::MdcContentBoundsChanged(const TRect& aRect)
+{
+ // Do nothing in Item display
+}
+*/
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmametadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This interface is for getting metadata from a media.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmmametadatacontrol.h"
+
+
+_LIT(KControlName, "MetaDataControl");
+
+
+CMMAMetaDataControl::CMMAMetaDataControl()
+{
+ // Nothing, OK.
+}
+
+void CMMAMetaDataControl::StaticKeysCountL(CMMAMetaDataControl* aMetaDataControl, TInt *aCount)
+{
+ *aCount = aMetaDataControl->KeyCountL();
+}
+
+void CMMAMetaDataControl::StaticKeyL(CMMAMetaDataControl* aMetaDataControl, HBufC** aKey, TInt aIndex)
+{
+ *aKey = aMetaDataControl->KeyL(aIndex);
+}
+
+void CMMAMetaDataControl::StaticKeyValueL(
+ CMMAMetaDataControl* aMetaDataControl,
+ HBufC** aValue,
+ TDesC* aKey)
+{
+ /* Just pass the call through to the real implementation. The ownership of the returned data
+ * is received from the implementation and passed to the caller as well.
+ *
+ */
+ *aValue = aMetaDataControl->KeyValueL(*aKey);
+}
+
+const TDesC& CMMAMetaDataControl::ClassName() const
+{
+ return KControlName;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidicontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a MIDIControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32math.h>
+
+#include "cmmamidicontrol.h"
+#include "cmmamidiplayer.h"
+
+namespace
+{
+const TReal KMMAMIDIVolumeConversionConstant = 40;
+const TReal KMMADecibelToMidiVolumeConversionPowerBase = 10;
+//const TTimeIntervalMicroSeconds32 KMMAMIDIVolumeChangeTimeout = 2000000;
+const TInt KMMAMIDIVolumeChangeTimeout = 2000000;
+const TReal KMMAMIDIMinimumVolumeDecibels = -130;
+// For channel volume change message:
+const TUint8 KMIDIControlChangeEvent = 0xB0;
+const TUint8 KMIDIControlMainVolume = 0x07;
+}
+
+CMMAMIDIControl* CMMAMIDIControl::NewL(CMMAMIDIPlayer* aPlayer)
+{
+ CMMAMIDIControl* self = new(ELeave)CMMAMIDIControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAMIDIControl::CMMAMIDIControl(CMMAMIDIPlayer* aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::CMMAMIDIControl");
+ iPlayer = aPlayer;
+}
+
+CMMAMIDIControl::~CMMAMIDIControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::~CMMAMIDIControl +");
+ delete iVolumeEventWait;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::~CMMAMIDIControl -");
+}
+
+void CMMAMIDIControl::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::ConstructL +");
+ iVolumeEventWait = CChannelVolumeEventWait::NewL();
+ iPlayer->addObserverL(this);
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::ConstructL -");
+}
+
+const TDesC& CMMAMIDIControl::ClassName() const
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIControl::ClassName");
+ return KMIDIControlName;
+}
+
+TInt CMMAMIDIControl::ChannelVolumeL(TInt aChannel)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: ChannelVolumeL + aChannel=%d", aChannel);
+
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+
+ // If engine is not processing events, current
+ // volume cannot be known for sure.
+ TMidiState engineState = midi->State();
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ if ((engineState == EMidiStateClosedDisengaged) ||
+ (engineState == EMidiStateOpenDisengaged))
+#else
+ if ((engineState == EClosedDisengaged) ||
+ (engineState == EOpenDisengaged))
+#endif
+ {
+ return KErrNotFound;
+ }
+
+ // This calculation might be slow on hardware, since
+ // following equation must be calculated using TReals:
+ //
+ // p1 = 10^(dB/40) * p0, where:
+ // p1 is target midi volume,
+ // p0 is reference value (maximum midi volume, 127)
+ // dB is volume value in Decibels from MidiClientUtility
+
+ TReal32 volume = midi->ChannelVolumeL(aChannel);
+ if (volume < KMMAMIDIMinimumVolumeDecibels)
+ {
+ volume = KMMAMIDIMinimumVolumeDecibels;
+ }
+ TReal exponent = volume / KMMAMIDIVolumeConversionConstant;
+ TReal targetVal = 0;
+
+ // calculate midi volume value
+ User::LeaveIfError(
+ Math::Pow(
+ targetVal,
+ KMMADecibelToMidiVolumeConversionPowerBase,
+ exponent));
+
+ // multiply by reference value
+ targetVal *= KMAXVolume;
+
+ // round value to zero decimals
+ User::LeaveIfError(Math::Round(targetVal, targetVal, 0));
+
+ // clamp to bounds
+ TInt retVal = (int) targetVal;
+ if (retVal < 0)
+ {
+ retVal = 0;
+ }
+ else if (retVal > KMAXVolume)
+ {
+ retVal = KMAXVolume;
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: ChannelVolumeL - retVal=%d", retVal);
+ return retVal;
+}
+
+void CMMAMIDIControl::SetChannelVolumeL(TInt aChannel, TInt aVolume)
+{
+ LOG2( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SetChannelVolumeL + aChannel=%d aVolume=%d", aChannel, aVolume);
+
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+
+ // Change is done with shortMidiEvent so midi volume -> decibel
+ // calculation is avoided (would be needed for midi client api
+ // SetChannelVolumeL method)
+
+ TBuf8<3> volumeChangeMessage;
+ // range is checked before
+ TUint8 channel = (KMIDIControlChangeEvent | (TUint8)aChannel);
+ volumeChangeMessage.Append(channel);
+ volumeChangeMessage.Append(KMIDIControlMainVolume);
+ volumeChangeMessage.Append((TUint8)aVolume);
+ SendMIDIEventL(&volumeChangeMessage);
+
+ TMidiState engineState = midi->State();
+
+ // If engine is not processing, we do not have to
+ // wait until change is done.
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ if (!((engineState == EMidiStateClosedDisengaged) ||
+ (engineState == EMidiStateOpenDisengaged)))
+#else
+ if (!((engineState == EClosedDisengaged) ||
+ (engineState == EOpenDisengaged)))
+#endif
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SetChannelVolumeL: ExecuteL ->");
+ iVolumeEventWait->StartWait(aChannel);
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SetChannelVolumeL: ExecuteL <-");
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SetChannelVolumeL -");
+}
+
+void CMMAMIDIControl::SetProgramL(TInt aChannel,
+ TInt aBank,
+ TInt aProgram)
+{
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+
+ // Program means instrument.
+ midi->SetInstrumentL(aChannel, aBank, aProgram);
+}
+
+TInt CMMAMIDIControl::SendMIDIEventL(const TDesC8* aData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SendMIDIEventL +");
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+
+ // SendMessageL only processes first message in the descriptor,
+ // so we need to send blocks of data as many times as needed.
+
+ TInt dataLength = aData->Length();
+ TInt dataSent = 0;
+ while (dataSent < dataLength)
+ {
+ // Delegate event directly to the native implementation
+ // which checks the validity.
+ TPtrC8 nextBlock = aData->Right(dataLength - dataSent);
+ dataSent += midi->SendMessageL(nextBlock);
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SendMIDIEventL: sent %d bytes", dataSent);
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: SendMIDIEventL -");
+ return dataSent;
+}
+
+TInt CMMAMIDIControl::ReInitializeMidiL(const TDesC8* aData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: ReInitializeMidiL + ");
+ iPlayer->ReInitializeMidiEngineL(aData);
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIControl: ReInitializeMidiL - ");
+ return KErrNone;
+}
+
+void CMMAMIDIControl::MmcuoStateChanged(TMidiState /*aOldState*/,
+ TMidiState /*aNewState*/,
+ const TTimeIntervalMicroSeconds& /*aTime*/,
+ TInt /*aError*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoTempoChanged(TInt /*aMicroBeatsPerMinute*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoVolumeChanged(TInt aChannel, TReal32 /*aVolumeInDecibels*/)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAMIDIControl:: MmcuoVolumeChanged + aChannel=%d", aChannel);
+ if (iVolumeEventWait)
+ {
+ iVolumeEventWait->HandleVolumeChangedEvent(aChannel);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl:: MmcuoVolumeChanged -");
+}
+
+void CMMAMIDIControl::MmcuoMuteChanged(TInt /*aChannel*/,TBool /*aMuted*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& /*aMicroSeconds*/,TInt64 /*aMicroBeats*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoMetaDataEntryFound(const TInt /*aMetaDataEntryId*/,const TTimeIntervalMicroSeconds& /*aPosition*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& /*aMessage*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoPolyphonyChanged(TInt /*aNewPolyphony*/)
+{
+}
+
+void CMMAMIDIControl::MmcuoInstrumentChanged(TInt /*aChannel*/,TInt /*aBankId*/,TInt /*aInstrumentId*/)
+{
+}
+
+CMMAMIDIControl::CChannelVolumeEventWait* CMMAMIDIControl::CChannelVolumeEventWait::NewL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::NewL");
+ CChannelVolumeEventWait* self = new(ELeave) CChannelVolumeEventWait();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+void CMMAMIDIControl::CChannelVolumeEventWait::ConstructL()
+{
+ iWait = new(ELeave) CActiveSchedulerWait();
+ iTimer = CTimeOutTimer::NewL(CActive::EPriorityStandard, *this);
+}
+
+CMMAMIDIControl::CChannelVolumeEventWait::CChannelVolumeEventWait()
+{
+}
+
+CMMAMIDIControl::CChannelVolumeEventWait::~CChannelVolumeEventWait()
+{
+ delete iTimer;
+ delete iWait;
+}
+
+void CMMAMIDIControl::CChannelVolumeEventWait::TimerExpired()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::TimerExpired +");
+ if (iWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::TimerExpired - cancelling wait");
+ iWait->AsyncStop();
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::TimerExpired -");
+}
+
+void CMMAMIDIControl::CChannelVolumeEventWait::StartWait(TInt aChannel)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::StartWait aChannel=%d", aChannel);
+ iChannel = aChannel;
+
+ if (!iWait->IsStarted())
+ {
+ iTimer->After(KMMAMIDIVolumeChangeTimeout);
+ iWait->Start();
+ }
+}
+
+void CMMAMIDIControl::CChannelVolumeEventWait::StopWait()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::StopWait");
+ if (iWait->IsStarted())
+ {
+ iTimer->Cancel();
+ iWait->AsyncStop();
+ }
+}
+
+void CMMAMIDIControl::CChannelVolumeEventWait::HandleVolumeChangedEvent(TInt aChannel)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAMIDIControl::CChannelVolumeEventWait::HandleVolumeChangedEvent aChannel=%d", aChannel);
+ if (iChannel == aChannel)
+ {
+ StopWait();
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidimetadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMAMIDIMetaDataControl is a concrete class for getting
+* metadata from midi engine.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmamidimetadatacontrol.h"
+
+CMMAMIDIMetaDataControl::CMMAMIDIMetaDataControl(
+ CMMAMIDIPlayer* aPlayer)
+ : iPlayer(aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMIDIMetaDataControl constructor called.");
+}
+
+TInt CMMAMIDIMetaDataControl::KeyCountL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIMetaDataControl::KeyCountL");
+ TInt entries = iPlayer->MidiClient()->NumberOfMetaDataEntriesL();
+ return entries;
+}
+
+HBufC* CMMAMIDIMetaDataControl::KeyL(TInt aIndex)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIMetaDataControl::KeyL");
+ CMMFMetaDataEntry* currEntry =
+ iPlayer->MidiClient()->GetMetaDataEntryL(aIndex);
+ CleanupStack::PushL(currEntry);
+ HBufC* key = currEntry->Name().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+ return key;
+}
+
+
+/*
+ * Get the value of given midi metadata key. The ownership of the created value
+ * (descriptor) is passed to the caller.
+ */
+HBufC* CMMAMIDIMetaDataControl::KeyValueL(const TDesC& aKey)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIMetaDataControl::KeyValueL");
+
+ HBufC* retVal = NULL;
+ CMMFMetaDataEntry* currEntry = NULL;
+
+ TInt nEntries = iPlayer->MidiClient()->NumberOfMetaDataEntriesL();
+
+ for (TInt i = 0; i < nEntries; ++i)
+ {
+ currEntry = iPlayer->MidiClient()->GetMetaDataEntryL(i);
+
+ if (0 == aKey.Compare(currEntry->Name()))
+ {
+ CleanupStack::PushL(currEntry);
+ retVal = currEntry->Value().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+ break;
+ }
+
+ delete currEntry;
+ }
+
+ User::LeaveIfNull(retVal);
+ return retVal;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidipitchcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a PitchControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmamidipitchcontrol.h"
+#include "cmmamidiplayer.h"
+
+CMMAMIDIPitchControl* CMMAMIDIPitchControl::NewL(CMMAMIDIPlayer* aPlayer)
+{
+ CMMAMIDIPitchControl* self = new(ELeave) CMMAMIDIPitchControl(aPlayer);
+ return self;
+}
+
+CMMAMIDIPitchControl::CMMAMIDIPitchControl(CMMAMIDIPlayer* aPlayer)
+{
+ iPlayer = aPlayer;
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::CMMAMIDIPitchControl");
+}
+
+CMMAMIDIPitchControl::~CMMAMIDIPitchControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::~CMMAMIDIPitchControl");
+}
+
+const TDesC& CMMAMIDIPitchControl::ClassName() const
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIPitchControl::ClassName");
+ return KMIDIPitchControlName;
+}
+
+
+TInt CMMAMIDIPitchControl::PitchL()
+{
+ return iPlayer->MidiClient()->PitchTranspositionCentsL();
+}
+
+TInt CMMAMIDIPitchControl::SetPitchL(TInt aPitch)
+{
+ TInt pitch = aPitch;
+ if (aPitch > KMIDIPitchControlMaxPitch)
+ {
+ pitch = KMIDIPitchControlMaxPitch;
+ }
+ else if (aPitch < KMIDIPitchControlMinPitch)
+ {
+ pitch = KMIDIPitchControlMinPitch;
+ }
+ iPlayer->MidiClient()->SetPitchTranspositionL(pitch);
+
+ return PitchL(); // return the actual Pitch
+}
+
+// this method is intentionally left leaving to allow leaving implementation in the future
+TInt CMMAMIDIPitchControl::MaxPitchL()
+{
+ return KMIDIPitchControlMaxPitch;
+}
+
+// this method is intentionally left leaving to allow leaving implementation in the future
+TInt CMMAMIDIPitchControl::MinPitchL()
+{
+ return KMIDIPitchControlMinPitch;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidiplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,590 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for MIDI.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmffile.h>
+#include <logger.h>
+#include <e32base.h>
+#include <AudioPreference.h>
+
+#include "cmmamidiplayer.h"
+#include "mmmadisplay.h"
+
+const TInt KErrorMessageSize = 32;
+_LIT(KErrDefaultError, "Symbian OS Error: %d");
+const TInt KMidiDefaultBank = 0x3c80;
+const TInt KMidiDrumBank = 0x3c7c;
+const TInt KMidiDrumChannel = 9;
+const TInt KMidiChannels = 16;
+const TInt KMidiDefaultInstrument = 1;
+
+CMMAMIDIPlayer* CMMAMIDIPlayer::NewLC(const TDesC& aContentType,
+ TFileName aFileName)
+{
+ CMMAMIDIPlayer* self = new(ELeave) CMMAMIDIPlayer(aFileName);
+ CleanupStack::PushL(self);
+ self->ConstructL(aContentType);
+ return self;
+}
+
+CMMAMIDIPlayer::~CMMAMIDIPlayer()
+{
+ CloseClientUtility();
+ // new function added to CMMAPlayer delete the controls before the destruction of iMidi.
+ DeleteControls();
+ delete iMidi;
+ delete iActiveSchedulerWait;
+ iObservers.Close();
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMIDIPlayer::~CMMAMIDIPlayer");
+}
+
+void CMMAMIDIPlayer::ConstructL(const TDesC& aContentType)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIPlayer::ConstructL");
+ iContentType = aContentType.AllocL();
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+ iMidi = CMidiClientUtility::NewL(*this, KAudioPriorityRecording,
+ KMMAMIDIPriorityPreference, ETrue);
+
+ CMMAPlayer::ConstructL();
+}
+
+CMMAMIDIPlayer::CMMAMIDIPlayer(TFileName aFileName):
+ iFileName(aFileName),
+ iMediaTime(KTimeUnknown), iStartedEventTime(0)
+{
+}
+
+EXPORT_C CMidiClientUtility* CMMAMIDIPlayer::MidiClient() const
+{
+ return iMidi;
+}
+
+
+void CMMAMIDIPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDIPlayer::RealizeL");
+ CMMAPlayer::RealizeL();
+}
+
+void CMMAMIDIPlayer::PrefetchL()
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAMIDIPlayer::PrefetchL stream count %d", iSourceStreams.Count());
+ if (iFileName != KNullDesC)
+ {
+ iMidi->OpenFile(iFileName);
+ }
+ else if (iSourceStreams.Count() == 0)
+ {
+ // We have no data, but need to initialize the player
+ // Preparing all channels
+ for (TInt i = 0; i < KMidiChannels; i++)
+ {
+ iMidi->SetInstrumentL(i, KMidiDefaultBank,
+ KMidiDefaultInstrument);
+ }
+
+ // Setting drums to channel 10
+ iMidi->SetInstrumentL(KMidiDrumChannel, KMidiDrumBank,
+ KMidiDefaultInstrument);
+
+ // Start it immediately in order to get MIDIControl work without
+ // calling the start. This is how reference implementation works.
+ iMidi->Play();
+ }
+ else
+ {
+ // Created with content, audio player will initialize controller
+ // and data source.
+ iSourceStreams[ 0 ]->ReadAllL();
+ }
+}
+
+//
+// This method is called when CMMASourceStreamReader finished reading
+// initiated in PrefetchL
+//
+void CMMAMIDIPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
+{
+ if (aStatus < KErrNone)
+ {
+ PostActionCompleted(aStatus);
+ }
+ else
+ {
+ // we're not finished yet
+ iMidi->OpenDes(aData); //wait for MMidiClientUtilityObserver::MmcuoStateChanged
+ }
+}
+
+void CMMAMIDIPlayer::DeallocateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: DeallocateL +");
+ if (iState == EPrefetched)
+ {
+ CloseClientUtility();
+ ResetSourceStreams();
+ ChangeState(ERealized);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: DeallocateL -");
+}
+
+void CMMAMIDIPlayer::StartL()
+{
+ iMediaTime = KTimeUnknown;
+
+ // Player is already started if this player is constructed with
+ // device://midi locator.
+ TBool isDeviceMidi = (iSourceStreams.Count() == 0 &&
+ iFileName == KNullDesC);
+ if (!isDeviceMidi)
+ {
+ iMidi->Play();
+ }
+
+ // inform java side
+ PostLongEvent(CMMAPlayerEvent::EStarted, iStartedEventTime);
+ ChangeState(EStarted);
+
+ // To achieve similar functionality as reference implementation,
+ // END_OF_MEDIA must be sent right after Start on device://midi.
+ if (isDeviceMidi)
+ {
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, iStartedEventTime);
+ ChangeState(EPrefetched);
+ }
+ PostActionCompletedStart();
+ //PostActionCompleted(KErrNone); // java start return
+}
+
+void CMMAMIDIPlayer::StopL(TBool aPostEvent)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer::StopL");
+ if (iState == EStarted)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ iStartedEventTime = time;
+
+ // do the stop only if we are playing some content
+ if ((iSourceStreams.Count() > 0) ||
+ (iFileName != KNullDesC))
+ {
+ // should actually pause!!!
+ iMidi->Stop(TTimeIntervalMicroSeconds(0));
+ }
+
+ if (aPostEvent)
+ {
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ }
+}
+
+void CMMAMIDIPlayer::GetDuration(TInt64* aDuration)
+{
+ // Special case for device://midi
+ if ((iSourceStreams.Count() == 0) &&
+ (iFileName == KNullDesC))
+ {
+ iDuration = KErrNone;
+ }
+ else if (iDuration == KTimeUnknown)
+ {
+ TRAPD(err, iDuration = iMidi->DurationMicroSecondsL().Int64());
+ if (err != KErrNone)
+ {
+ // Duration was not available.
+ iDuration = KTimeUnknown;
+ }
+ }
+
+ *aDuration = iDuration;
+}
+
+void CMMAMIDIPlayer::SetMediaTimeL(TInt64* aTime)
+{
+ TTimeIntervalMicroSeconds position(*aTime);
+ iMidi->SetPositionMicroSecondsL(position);
+
+ // Reset cached media time, because actual set position may be
+ // something else than aTime.
+ iMediaTime = KTimeUnknown;
+
+ // Inform about the position change to the StateListeners
+ ChangeState(iState);
+
+ // Get the actual media time
+ GetMediaTime(aTime);
+
+ iStartedEventTime = iMediaTime;
+}
+
+void CMMAMIDIPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ // Special case for device://midi
+ if ((iSourceStreams.Count() == 0) &&
+ (iFileName == KNullDesC))
+ {
+ iMediaTime = KErrNone;
+ }
+ else if (iMediaTime == KTimeUnknown || iState == EStarted)
+ {
+ TTimeIntervalMicroSeconds position(0);
+ TRAPD(error, position = iMidi->PositionMicroSecondsL());
+
+ if (error == KErrNone)
+ {
+ TInt64 newTime = position.Int64();
+
+ // Sanity check for media time going backwards or beyond the
+ // duration.
+ // Some native controls may return zero media time for
+ // a few moments just before playback will complete.
+ if (newTime < iMediaTime ||
+ (iDuration > 0 && newTime > iDuration))
+ {
+ GetDuration(&iMediaTime);
+ }
+ else
+ {
+ // set return value
+ iMediaTime = newTime;
+ }
+ }
+ else
+ {
+ // media time cannot be get
+ iMediaTime = KTimeUnknown;
+ }
+ }
+ *aMediaTime = iMediaTime;
+}
+
+void CMMAMIDIPlayer::ReInitializeMidiEngineL(const TDesC8* aMidiSequence)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIPlayer: ReInitializeMidiEngineL: + ");
+
+ CloseClientUtility();
+
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: ReInitializeMidiEngineL: Opening descriptor");
+
+ iMidi->OpenDes(*aMidiSequence);
+ // Wait until asynchronous OpenDes call has completed
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ ChangeState(EPrefetched);
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDIPlayer: ReInitializeMidiEngineL: - ");
+}
+
+void CMMAMIDIPlayer::addObserverL(MMidiClientUtilityObserver* aObserver)
+{
+ iObservers.AppendL(aObserver);
+}
+
+void CMMAMIDIPlayer::CloseL()
+{
+ CMMAPlayer::CloseL();
+ CloseClientUtility();
+}
+
+const TDesC& CMMAMIDIPlayer::Type()
+{
+ return KMMAMIDIPlayer;
+}
+
+void CMMAMIDIPlayer::PlayCompleteL(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: PlayCompleteL +");
+ ELOG1( EJavaMMAPI, "MMA: CMMAMidiPlayer: PlayCompleteL: Error=%d", aError);
+ TInt64 duration;
+ GetDuration(&duration);
+ iMediaTime = duration;
+ iStartedEventTime = 0;
+
+ iMidi->Stop(TTimeIntervalMicroSeconds(0));
+
+ // go back to prefetched state
+ ChangeState(EPrefetched); // ready to play again
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, duration);
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: PlayCompleteL -");
+}
+
+void CMMAMIDIPlayer::MmcuoStateChanged(TMidiState aOldState,
+ TMidiState aNewState,
+ const TTimeIntervalMicroSeconds& aTime,
+ TInt aError)
+{
+ TInt err = aError;
+
+ ELOG3( EJavaMMAPI, "MMA: CMMAMIDIPlayer: MmcuoStateChanged: Old=%d, New=%d, Error=%d",
+ aOldState,
+ aNewState,
+ err);
+ // Closing the utility or reinitialising
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ if (iActiveSchedulerWait->IsStarted() &&
+ ((aNewState == EMidiStateClosedDisengaged) ||
+ (aNewState == EMidiStateOpenDisengaged) ||
+ (aNewState == EMidiStateClosedEngaged)))
+#else
+ if (iActiveSchedulerWait->IsStarted() &&
+ ((aNewState == EClosedDisengaged) ||
+ (aNewState == EOpenDisengaged) ||
+ (aNewState == EClosedEngaged)))
+#endif
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ // changing from realized to prefetched state
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ else if ((iState == ERealized) &&
+ (aOldState == EMidiStateClosedDisengaged) &&
+ ((aNewState == EMidiStateOpenDisengaged) ||
+ (aNewState == EMidiStateClosedEngaged) ||
+ (aNewState == EMidiStateClosedDisengaged)))
+#else
+ else if ((iState == ERealized) &&
+ (aOldState == EClosed) &&
+ ((aNewState == EOpen) || (aNewState == EClosedEngaged) ||
+ (aNewState == EClosed))) // EClosed is EClosedDisengaged
+#endif
+ {
+ if (aError == KErrNone)
+ {
+ // prefetch succeed
+ ChangeState(EPrefetched);
+ }
+ // else state remains realized
+
+ // inform java
+ PostActionCompleted(aError);
+ err = KErrNone; // don't report the error again
+ }
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ else if ((aOldState == EMidiStateOpenPlaying) &&
+ (aNewState == EMidiStateOpenEngaged) &&
+ (iState == EStarted))
+#else
+ else if ((aOldState == EPlaying) &&
+ (aNewState == EOpenEngaged) &&
+ (iState == EStarted))
+#endif
+ {
+ // If iState is not EStarted PlayCompleteL may not be called because
+ // player may be already stopped.
+
+ // playing completed
+ TRAPD(playErr, PlayCompleteL(aError));
+ if (playErr != KErrNone)
+ {
+ err = playErr;
+ }
+ }
+
+ if (err != KErrNone)
+ {
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, err);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ }
+
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoStateChanged(aOldState, aNewState, aTime, aError);
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDIPlayer: MmcuoStateChanged: midi state %d",
+ iMidi->State());
+}
+
+void CMMAMIDIPlayer::MmcuoTempoChanged(TInt aMicroBeatsPerMinute)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoTempoChanged(aMicroBeatsPerMinute);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoVolumeChanged(aChannel, aVolumeInDecibels);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoMuteChanged(TInt aChannel,TBool aMuted)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoMuteChanged(aChannel, aMuted);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoSyncUpdate(aMicroSeconds, aMicroBeats);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoMetaDataEntryFound(aMetaDataEntryId, aPosition);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& aMessage)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoMipMessageReceived(aMessage);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoPolyphonyChanged(TInt aNewPolyphony)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoPolyphonyChanged(aNewPolyphony);
+ }
+}
+
+void CMMAMIDIPlayer::MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId)
+{
+ // notify observers
+ TInt count = iObservers.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ iObservers[ i ]->MmcuoInstrumentChanged(aChannel, aBankId, aInstrumentId);
+ }
+}
+
+void CMMAMIDIPlayer::CloseClientUtility()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: CloseClientUtility +");
+ if (iMidi &&
+ iActiveSchedulerWait &&
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ (iMidi->State() != EMidiStateClosedDisengaged))
+#else
+ (iMidi->State() != EClosed))
+#endif
+ {
+ // Have to stop midi before closing,
+ // this case is for device://midi
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ if (iMidi->State() == EMidiStateClosedEngaged)
+#else
+ if (iMidi->State() == EClosedEngaged)
+#endif
+ {
+ iMidi->Stop(TTimeIntervalMicroSeconds(0));
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ }
+ else
+ {
+ // Calling Close and Stop or Stop and Close should
+ // always lead to EClosed state.
+
+ // From EOpenEngaged or EOpenPlaying to EClosedEngaged
+ // or from EOpenDisengaged to EClosedDisengaged
+ iMidi->Close();
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "State after Close: %d", iMidi->State());
+
+ // If not in EClosedDisengaged yet
+#ifdef RD_JAVA_TMIDISTATECHANGE
+ if (iMidi->State() != EMidiStateClosedDisengaged)
+#else
+ if (iMidi->State() != EClosed)
+#endif
+ {
+ // From EClosedEngaged to EClosedDisengaged
+ iMidi->Stop(TTimeIntervalMicroSeconds(0));
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ LOG1( EJavaMMAPI, EInfo, "State after Stop: %d", iMidi->State());
+ }
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: CloseClientUtility: State after close: %d", iMidi->State());
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: CloseClientUtility -");
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidiplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating MIDI player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmamidiplayerfactory.h"
+#include "cmmamidiplayer.h"
+#include "cmmamidivolumecontrol.h"
+#include "cmmamidistoptimecontrol.h"
+#include "cmmamidicontrol.h"
+#include "cmmamiditempocontrol.h"
+#include "cmmamidipitchcontrol.h"
+#include "cmmammfresolver.h"
+#include "cmmamidimetadatacontrol.h"
+
+
+_LIT(KMMAMidi, "midi");
+_LIT(KDeviceMidiContentType, "audio/midi");
+
+CMMAMIDIPlayerFactory* CMMAMIDIPlayerFactory::NewLC()
+{
+ CMMAMIDIPlayerFactory* pFactory =
+ new(ELeave) CMMAMIDIPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAMIDIPlayerFactory::CMMAMIDIPlayerFactory()
+{
+}
+
+
+CMMAMIDIPlayerFactory::~CMMAMIDIPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAMIDIPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ // if we get this far then MIDI is supported
+ HBufC* contentType = aResolver->ContentType();
+ HBufC* tmpFileName = aResolver->FileNameOwnership();
+ TFileName fileName;
+ if (tmpFileName)
+ {
+ fileName.Copy(tmpFileName->Des());
+ }
+ else
+ {
+ fileName = KNullDesC;
+ }
+ delete tmpFileName;
+ CMMAPlayer* player = CreateMidiFilePlayerL(*contentType, fileName);
+ return player;
+}
+
+
+void CMMAMIDIPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeMidi));
+}
+
+CMMAPlayer* CMMAMIDIPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aProperties)
+{
+ CMMAPlayer* player = NULL;
+ if ((aProtocol == KMMADeviceProtocol) &&
+ (aMiddlePart == KMMAMidi))
+ {
+ // locator was device://midi
+ player = CreateMidiSynthPlayerL(KDeviceMidiContentType);
+ }
+ else
+ {
+ // other locator, if it is midi file CMMAMMFPlayerFactory
+ // calls CreatePlayerL( CMMAMMFResolver* aResolver ) method.
+ player = CMMAMMFPlayerFactory::CreatePlayerL(aProtocol,
+ aMiddlePart,
+ aProperties);
+ }
+ return player;
+}
+
+void CMMAMIDIPlayerFactory::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ if (IsSupportedContentTypeL(aContentType))
+ {
+ aProtocolArray.AppendL(KMMADeviceProtocol);
+ }
+}
+
+CMMAPlayer* CMMAMIDIPlayerFactory::CreateMidiFilePlayerL(const TDesC& aContentType,
+ TFileName aFileName)
+{
+ CMMAMIDIPlayer* player = CMMAMIDIPlayer::NewLC(aContentType, aFileName);
+
+ CMMAMIDIVolumeControl* volumeControl = CMMAMIDIVolumeControl::NewL(player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+ CMMAMIDIStopTimeControl* stopTimeControl = CMMAMIDIStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ CMMAMIDIControl* midiControl = CMMAMIDIControl::NewL(player);
+ CleanupStack::PushL(midiControl);
+ player->AddControlL(midiControl);
+ CleanupStack::Pop(midiControl);
+
+ CMMAMIDITempoControl* tempoControl = CMMAMIDITempoControl::NewL(player);
+ CleanupStack::PushL(tempoControl);
+ player->AddControlL(tempoControl);
+ CleanupStack::Pop(tempoControl);
+
+ CMMAMIDIPitchControl* pitchControl = CMMAMIDIPitchControl::NewL(player);
+ CleanupStack::PushL(pitchControl);
+ player->AddControlL(pitchControl);
+ CleanupStack::Pop(pitchControl);
+
+#ifdef __MMA_METADATA_CONTROL__
+ CMMAMIDIMetaDataControl* metaDataControl =
+ new(ELeave) CMMAMIDIMetaDataControl(player);
+ CleanupStack::PushL(metaDataControl);
+ player->AddControlL(metaDataControl);
+ CleanupStack::Pop(metaDataControl);
+#endif // __MMA_METADATA_CONTROL__
+
+ CleanupStack::Pop(player);
+ return player;
+}
+
+CMMAPlayer* CMMAMIDIPlayerFactory::CreateMidiSynthPlayerL(const TDesC& aContentType)
+{
+ CMMAMIDIPlayer* player = CMMAMIDIPlayer::NewLC(aContentType, KNullDesC());
+
+ CMMAMIDIVolumeControl* volumeControl = CMMAMIDIVolumeControl::NewL(player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+ CMMAMIDIControl* midiControl = CMMAMIDIControl::NewL(player);
+ CleanupStack::PushL(midiControl);
+ player->AddControlL(midiControl);
+ CleanupStack::Pop(midiControl);
+
+ CMMAMIDIPitchControl* pitchControl = CMMAMIDIPitchControl::NewL(player);
+ CleanupStack::PushL(pitchControl);
+ player->AddControlL(pitchControl);
+ CleanupStack::Pop(pitchControl);
+
+ CleanupStack::Pop(player);
+ return player;
+}
+
+// END OF FILE
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidistoptimecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32std.h>
+
+#include "cmmamidistoptimecontrol.h"
+#include "cmmaplayer.h"
+
+CMMAMIDIStopTimeControl* CMMAMIDIStopTimeControl::NewL(CMMAPlayer* aPlayer)
+{
+ CMMAMIDIStopTimeControl* control =
+ new(ELeave) CMMAMIDIStopTimeControl(aPlayer);
+ CleanupStack::PushL(control);
+ // calls base class ConstructL
+ control->ConstructL();
+ CleanupStack::Pop(); // control
+ return control;
+}
+
+
+CMMAMIDIStopTimeControl::~CMMAMIDIStopTimeControl()
+{
+}
+
+CMMAMIDIStopTimeControl::CMMAMIDIStopTimeControl(CMMAPlayer* aPlayer)
+ : CMMAStopTimeControl(aPlayer)
+{
+}
+
+
+void CMMAMIDIStopTimeControl::StopAtTimeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDIStopTimeControl::StopAtTime");
+
+ // Stop the player only when it's playing
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+ if (time >= 0 && time < iStopTime)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAMIDIStopTimeControl::StopAtTime - Called %dms too early",
+ I64INT((time - iStopTime)/1000));
+ StartTimer(time);
+ return;
+ }
+
+ TInt64 stopTime;
+
+ iPlayer->StopL(EFalse);
+ iPlayer->SetMediaTimeL(&iStopTime);
+ iPlayer->GetMediaTime(&stopTime);
+
+ // Inform the player that it's "stopped at time"
+ iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, stopTime);
+
+ iStopTime = iNoTimer; // Timer is reseted
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamiditempocontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a TempoControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmamiditempocontrol.h"
+#include "cmmamidiplayer.h"
+
+static const TInt KMicroBeatsInMiliBeat = 1000;
+static const TInt KMMAMIDIMinimumTempo = 10000;
+static const TInt KMMAMIDIMaximumTempo = 300000;
+static const TInt KMMAMIDIDefaultTempoInMicroBeats = 120000000;
+_LIT(KMMAMidiTempoStateChangedError, "Tempo error in state change");
+
+CMMAMIDITempoControl* CMMAMIDITempoControl::NewL(CMMAMIDIPlayer* aPlayer)
+{
+ CMMAMIDITempoControl* self = new(ELeave) CMMAMIDITempoControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAMIDITempoControl::CMMAMIDITempoControl(CMMAMIDIPlayer* aPlayer)
+{
+ iPlayer = aPlayer;
+ iTempo = KMMAMIDIDefaultTempoInMicroBeats;
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDITempoControl::CMMAMIDITempoControl");
+}
+
+CMMAMIDITempoControl::~CMMAMIDITempoControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDITempoControl::~CMMAMIDITempoControl");
+}
+
+inline void CMMAMIDITempoControl::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDITempoControl::ConstructL");
+
+ iPlayer->addObserverL(this);
+ iPlayer->AddStateListenerL(this);
+}
+
+const TDesC& CMMAMIDITempoControl::ClassName() const
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMIDITempoControl::ClassName");
+ return KMIDITempoControlName;
+}
+
+
+TInt CMMAMIDITempoControl::TempoL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDITempoControl: TempoL");
+
+ return iTempo / KMicroBeatsInMiliBeat;
+}
+
+TInt CMMAMIDITempoControl::SetTempoL(TInt aTempo)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMIDITempoControl: SetTempoL");
+ TInt tempo = aTempo;
+ if (tempo < KMMAMIDIMinimumTempo)
+ {
+ tempo = KMMAMIDIMinimumTempo;
+ }
+ if (tempo > KMMAMIDIMaximumTempo)
+ {
+ tempo = KMMAMIDIMaximumTempo;
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDITempoControl: SetTempoL: setting tempo %d",
+ tempo);
+
+ // Convert tempo to micro-beats.
+ tempo *= KMicroBeatsInMiliBeat;
+
+ // Set the tempo to the midi client if the player state is not REALIZED.
+ // (Tempo cannot be set to the midi client if the player
+ // has not been prefetched).
+ if (iPlayer->State() != CMMAPlayer::ERealized)
+ {
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+ midi->SetTempoL(tempo);
+ tempo = iPlayer->MidiClient()->TempoMicroBeatsPerMinuteL();
+ }
+
+ iTempo = tempo;
+
+ LOG1( EJavaMMAPI, EInfo, "MMA: CMMAMIDITempoControl: SetTempoL: Tempo set: %d",
+ tempo / KMicroBeatsInMiliBeat);
+
+ return tempo / KMicroBeatsInMiliBeat;
+}
+
+TInt CMMAMIDITempoControl::SetRateL(TInt aRate)
+{
+ TInt rate = aRate;
+ TInt maxRate = MaxRateL();
+ TInt minRate = MinRateL();
+
+ if (rate > maxRate)
+ {
+ rate = maxRate;
+ }
+ else if (rate < minRate)
+ {
+ rate = minRate;
+ }
+ iPlayer->MidiClient()->SetPlaybackRateL(rate);
+ return RateL(); // return the actual tempo
+}
+
+TInt CMMAMIDITempoControl::RateL()
+{
+ return iPlayer->MidiClient()->PlaybackRateL();
+}
+
+TInt CMMAMIDITempoControl::MaxRateL()
+{
+ return iPlayer->MidiClient()->MaxPlaybackRateL();
+}
+
+TInt CMMAMIDITempoControl::MinRateL()
+{
+ return iPlayer->MidiClient()->MinPlaybackRateL();
+}
+
+void CMMAMIDITempoControl::StateChanged(TInt aState)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAMIDITempoControl:: StateChanged, state = %d", aState);
+
+ // If tempo was set when the player was in REALIZED state, set the tempo
+ // now when the player has been prefetched.
+ if ((aState == CMMAPlayer::EPrefetched) &&
+ (iTempo != KMMAMIDIDefaultTempoInMicroBeats))
+ {
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+ TRAPD(err, midi->SetTempoL(iTempo));
+
+ ELOG1( EJavaMMAPI, "CMMAMIDITempoControl:: StateChanged, err = %d", err);
+
+ if (err != KErrNone)
+ {
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError,
+ KMMAMidiTempoStateChangedError);
+ }
+ }
+ else if (aState == CMMAPlayer::ERealized)
+ {
+ // If the player was deallocated, set the tempo to the default value.
+ iTempo = KMMAMIDIDefaultTempoInMicroBeats;
+ }
+}
+void CMMAMIDITempoControl::MmcuoStateChanged(TMidiState /*aOldState*/,
+ TMidiState /*aNewState*/,
+ const TTimeIntervalMicroSeconds& /*aTime*/,
+ TInt /*aError*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoTempoChanged(TInt aMicroBeatsPerMinute)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMIDITempoControl:: MmcuoTempoChanged");
+
+ iTempo = aMicroBeatsPerMinute;
+}
+
+void CMMAMIDITempoControl::MmcuoVolumeChanged(TInt /*aChannel*/,TReal32 /*aVolumeInDecibels*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoMuteChanged(TInt /*aChannel*/,TBool /*aMuted*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& /*aMicroSeconds*/,TInt64 /*aMicroBeats*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoMetaDataEntryFound(const TInt /*aMetaDataEntryId*/,const TTimeIntervalMicroSeconds& /*aPosition*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& /*aMessage*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoPolyphonyChanged(TInt /*aNewPolyphony*/)
+{
+}
+
+void CMMAMIDITempoControl::MmcuoInstrumentChanged(TInt /*aChannel*/,TInt /*aBankId*/,TInt /*aInstrumentId*/)
+{
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmamidivolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#include <logger.h>
+#include "cmmamidivolumecontrol.h"
+#include "cmmamidiplayer.h"
+
+CMMAMIDIVolumeControl::CMMAMIDIVolumeControl(CMMAMIDIPlayer* aPlayer)
+ : CMMAVolumeControl(aPlayer)
+{
+ iPlayer = aPlayer;
+}
+
+void CMMAMIDIVolumeControl::ConstructL()
+{
+ ConstructBaseL();
+}
+
+CMMAMIDIVolumeControl* CMMAMIDIVolumeControl::NewL(CMMAMIDIPlayer* aPlayer)
+{
+ CMMAMIDIVolumeControl* self = new(ELeave)CMMAMIDIVolumeControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+void CMMAMIDIVolumeControl::DoSetLevelL(TInt aLevel)
+{
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+ TInt maxVolume = midi->MaxVolumeL();
+ midi->SetVolumeL(aLevel * maxVolume / KMMAVolumeMaxLevel);
+}
+
+TInt CMMAMIDIVolumeControl::DoGetLevelL()
+{
+ CMidiClientUtility* midi = iPlayer->MidiClient();
+ // result is in range 0..100
+ return (midi->VolumeL() * KMMAVolumeMaxLevel / midi->MaxVolumeL());
+}
+
+
+// END OF FILE
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmammfplayerbase.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,377 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmfdes.h>
+#include <AudioPreference.h>
+#include <logger.h>
+#include "cmmammfplayerbase.h"
+#include "cmmammfresolver.h"
+
+
+CMMAMMFPlayerBase::~CMMAMMFPlayerBase()
+{
+ // First delete the control and then close the controller
+ // Added after AudioOutputControl
+ DeleteControls();
+ if (iControllerInfos)
+ {
+ iControllerInfos->ResetAndDestroy();
+ }
+ delete iControllerInfos;
+
+ if (iEventMonitor)
+ {
+ iEventMonitor->Cancel();
+ }
+
+ iController.Close();
+
+ delete iEventMonitor;
+
+ delete iFileName;
+}
+
+
+CMMAMMFPlayerBase::CMMAMMFPlayerBase(
+ CMMAMMFResolver* aResolver) :
+ iMediaTime(KTimeUnknown), iStartedEventTime(0)
+{
+ // implementation array ownership is transferred
+ iControllerInfos = aResolver->ImplementationsOwnership();
+
+ // content type ownership is transferred
+ iContentType = aResolver->ContentTypeOwnership();
+
+ // file name ownership is transferred
+ iFileName = aResolver->FileNameOwnership();
+}
+
+
+void CMMAMMFPlayerBase::ConstructL()
+{
+ CMMAPlayer::ConstructL();
+
+ // Create an event monitor
+ iEventMonitor =
+ CMMFControllerEventMonitor::NewL(*this, iController);
+}
+
+
+EXPORT_C RMMFController& CMMAMMFPlayerBase::Controller()
+{
+ return iController;
+}
+
+EXPORT_C TInt CMMAMMFPlayerBase::DoOpen(TUid aSourceUid,
+ const TDesC8& aSourceData,
+ TUid aSinkUid,
+ const TDesC8& aSinkData,
+ TMMFPrioritySettings aPrioritySettings)
+{
+ // Make sure any existing controller is closed.
+ iEventMonitor->Cancel();
+ iController.Close();
+
+ // Try opening and configuring each controller in turn
+ TInt error = KErrNotSupported;
+ TInt index = 0;
+
+ // Try controllers until found a good controller or out of list
+ while ((error != KErrNone) &&
+ (index < iControllerInfos->Count()))
+ {
+ // Open the controller
+ error = iController.Open((*iControllerInfos)[ index ]->Uid(),
+ aPrioritySettings, ETrue);
+
+ // If the controller was opened without error, start receiving events from it.
+ if (!error)
+ {
+ iEventMonitor->Start();
+
+ // Add the data source to the controller.
+ error = iController.AddDataSource(aSourceUid, aSourceData);
+ }
+
+ // Add the data sink
+ if (!error)
+ {
+ error = iController.AddDataSink(aSinkUid, aSinkData);
+ }
+
+ // If an error occurred in any of the above, close the controller.
+ if (error)
+ {
+ iEventMonitor->Cancel();
+ iController.Close();
+ }
+
+ index++;
+ }
+
+ return error;
+}
+
+TBool CMMAMMFPlayerBase::IsFilePlayer()
+{
+ if (iFileName != NULL)
+ {
+ return ETrue;
+ }
+ return EFalse;
+}
+
+void CMMAMMFPlayerBase::StartL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL +");
+ iMediaTime = KTimeUnknown;
+ User::LeaveIfError(iController.Play());
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after iController.Play() ");
+ // inform java side
+ ChangeState(EStarted);
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after ChangeState ");
+ PostLongEvent(CMMAPlayerEvent::EStarted, iStartedEventTime);
+ PostActionCompletedStart();
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after PostLongEvent ");
+
+// PostActionCompleted(KErrNone); // java start return
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after PostActionCompleted ");
+}
+
+void CMMAMMFPlayerBase::StopL(TBool aPostEvent)
+{
+ if (iState == EStarted)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ iStartedEventTime = time;
+
+ TInt err = KErrNone;
+ // AAC controller does not support multiple
+ // calls to pause but leave with KErrNotReady.
+ // That error is dismissed as player should
+ // be paused already in that case.
+ if (time == 0)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position is zero, stopping");
+ // Normally pause would be called, but if
+ // current time is zero, Stop is called instead.
+ // This is done because video playback breaks
+ // if pause is called between events
+ // KMMFEventCategoryVideoLoadingStarted and
+ // KMMFEventCategoryVideoLoadingCompleted
+ // (no wurther events are delivered altough
+ // playback continues fine).
+ // However calling Stop is tolerated in that
+ // situation.
+ err = iController.Stop();
+ if (err == KErrNone)
+ {
+ err = iController.Prime();
+ }
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position not zero, pausing");
+ err = iController.Pause();
+ }
+
+ if ((err != KErrNone) && (err != KErrNotReady))
+ {
+ ELOG1( EJavaMMAPI, "CMMAMMFPlayerBase::StopL: pause/stop failed %d, leaving", err);
+ User::Leave(err);
+ }
+
+ if (aPostEvent)
+ {
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ }
+}
+
+
+void CMMAMMFPlayerBase::DeallocateL()
+{
+ if (iState == EPrefetched)
+ {
+ // release all resources
+ if (iEventMonitor)
+ {
+ iEventMonitor->Cancel();
+ }
+
+ // Change state first to enable AMMS to delete Effect API classes
+ ChangeState(ERealized);
+ iController.Stop();
+ ResetSourceStreams();
+ }
+}
+
+
+EXPORT_C void CMMAMMFPlayerBase::GetDuration(TInt64* aDuration)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration ");
+ if (iDuration == KTimeUnknown)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration Time unknown ");
+ TTimeIntervalMicroSeconds duration;
+ TInt err = iController.GetDuration(duration);
+ if (!err)
+ {
+ iDuration = duration.Int64();
+ }
+ }
+ *aDuration = iDuration;
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration - ");
+}
+
+void CMMAMMFPlayerBase::SetMediaTimeL(TInt64* aTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL");
+
+ // Negative values are not checked here
+ // because it's done already in Java side.
+
+ // Get clip duration
+ TTimeIntervalMicroSeconds duration;
+ User::LeaveIfError(iController.GetDuration(duration));
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL iController.GetDuration=%d", duration.Int64());
+
+ TTimeIntervalMicroSeconds position;
+
+ // If the desired media time is beyond the duration,
+ // the time is set to the end of the media.
+ if (*aTime > duration.Int64())
+ {
+ position = duration;
+ }
+ else
+ {
+ position = *aTime;
+ }
+
+ TBool paused = EFalse;
+ TInt err = KErrNone;
+
+ if (iState == EStarted)
+ {
+ paused = ETrue;
+ User::LeaveIfError(err = iController.Pause());
+ ELOG1( EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL after iController.Pause = %d", err);
+ }
+
+ if (err == KErrNone)
+ {
+ // The controller must be in the PRIMED or PLAYING state
+ User::LeaveIfError(err = iController.SetPosition(position));
+ ELOG1( EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.SetPosition() = %d", err);
+ }
+
+ // Reset cached media time, because actual set position may be
+ // something else than aTime.
+ iMediaTime = KTimeUnknown;
+
+ // Inform about the position change to the StateListeners
+ ChangeState(iState);
+
+ // Get the actual media time
+ GetMediaTime(aTime);
+
+ iStartedEventTime = iMediaTime;
+
+ if (err == KErrNone)
+ {
+ if (paused == (TBool)ETrue)
+ {
+ User::LeaveIfError(err = iController.Play());
+ ELOG1( EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.Play() = %d", err);
+ }
+ }
+
+ if (err != KErrNone)
+ {
+ User::Leave(err);
+ }
+}
+
+void CMMAMMFPlayerBase::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime +");
+ TTimeIntervalMicroSeconds position(0);
+
+ if (iMediaTime == KTimeUnknown || iState == EStarted)
+ {
+ // The controller must be in the PRIMED or PLAYING state
+ TInt error(iController.GetPosition(position));
+
+ if (error == KErrNone)
+ {
+ TInt64 newTime = position.Int64();
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime iController.GetPosition : %d", newTime);
+
+ // Sanity check for media time going backwards or beyond the
+ // duration.
+ // Some native controls may return zero media time for
+ // a few moments just before playback will complete.
+ if (newTime < iMediaTime ||
+ (iDuration > 0 && newTime > iDuration))
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.GetDuration ");
+ GetDuration(&iMediaTime);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.else ");
+ // set return value
+ iMediaTime = newTime;
+ }
+ }
+ else
+ {
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime: error=%d, returning TIME_UNKNOWN", error);
+ // cannot get media time
+ iMediaTime = KTimeUnknown;
+ }
+ }
+ *aMediaTime = iMediaTime;
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime - %d", *aMediaTime);
+}
+
+void CMMAMMFPlayerBase::CloseL()
+{
+ CMMAPlayer::CloseL();
+ if (iEventMonitor)
+ {
+ iEventMonitor->Cancel();
+ }
+ // First delete the control and then close the controller
+ // Added after AudioOutputControl
+ iController.Stop();
+ delete iEventMonitor;
+ iEventMonitor = NULL;
+}
+
+void CMMAMMFPlayerBase::HandleEvent(const TMMFEvent& /*aEvent*/)
+{
+ // empty implementation
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmammfplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,292 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating MMF-based players.
+*
+*/
+
+
+// INCLUDE FILES
+#include <badesca.h>
+#include <logger.h>
+
+#ifndef RD_JAVA_OMA_DRM_V2
+#include <DRMCommon.h>
+#endif // RD_JAVA_OMA_DRM_V2
+
+#include "cmmammfplayerfactory.h"
+#include "cmmammfresolver.h"
+
+// CONSTANTS
+// Granularity used to create initial arrays.
+const TInt KGranularity = 8;
+_LIT(KContentTypePacketSrcNotIncluded, "application/x-ext-packetsrc");
+
+EXPORT_C CMMAMMFPlayerFactory::CMMAMMFPlayerFactory()
+{
+}
+
+EXPORT_C CMMAMMFPlayerFactory::~CMMAMMFPlayerFactory()
+{
+}
+
+CMMAPlayer* CMMAMMFPlayerFactory::CreatePlayerL(const TDesC& aContentType)
+{
+ return CreatePlayerL(aContentType, NULL);
+}
+
+CMMAPlayer* CMMAMMFPlayerFactory::CreatePlayerL(const TDesC& aContentType,
+ const TDesC* aFileName)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL content type = %S",
+ aContentType.Ptr());
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ // MMF needs 8bit data
+ HBufC8* contentType = HBufC8::NewLC(aContentType.Length());
+ contentType->Des().Copy(aContentType);
+
+ // Match to mime/content type
+ fSelect->SetMatchToMimeTypeL(*contentType);
+
+ CMMAPlayer* player = CreatePlayerL(fSelect, aFileName);
+
+ CleanupStack::PopAndDestroy(contentType);
+ CleanupStack::PopAndDestroy(fSelect);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL content type ok");
+ return player;
+}
+
+CMMAPlayer* CMMAMMFPlayerFactory::CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC&)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL aMiddlePart = %S",
+ aMiddlePart.Ptr());
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ // Match to file name, using only middle part of the locator
+ fSelect->SetMatchToFileNameL(aMiddlePart);
+
+ CMMAPlayer* player = NULL;
+ if (aProtocol == KMMAFileProtocol)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFPlayerFactory::CreatePlayerL creating file player");
+ player = CreatePlayerL(fSelect, &aMiddlePart);
+
+#ifndef RD_JAVA_OMA_DRM_V2
+ // if opening is failed, it might be DRM file, trying it
+ if (!player)
+ {
+ player = TryOpenDRMFileL(aMiddlePart);
+ }
+#endif // RD_JAVA_OMA_DRM_V2
+
+ }
+ else
+ {
+ player = CreatePlayerL(fSelect, NULL);
+ }
+
+ CleanupStack::PopAndDestroy(fSelect);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL aMiddlePart ok");
+ return player;
+}
+
+#ifndef RD_JAVA_OMA_DRM_V2
+CMMAPlayer* CMMAMMFPlayerFactory::TryOpenDRMFileL(const TDesC& aFileName)
+{
+ // we are most likely going to play this file
+ ContentAccess::TIntent intent = ContentAccess::EPlay;
+
+ CContent* contentObj = CContent::NewL(aFileName);
+ CleanupStack::PushL(contentObj);
+ CData* dataObj = contentObj->OpenContentL(intent);
+ CleanupStack::PushL(dataObj);
+ User::LeaveIfError(dataObj->EvaluateIntent(intent));
+ TBuf8<KMaxName> mimeType;
+ CMMAPlayer* player = NULL;
+ if (dataObj->GetMimeTypeL(mimeType))
+ {
+ // we use 16bit mimeType
+ HBufC* mimeTypeBuf = HBufC::NewLC(mimeType.Length());
+ mimeTypeBuf->Des().Copy(mimeType);
+ player = CreatePlayerL(*mimeTypeBuf, &aFileName);
+ CleanupStack::PopAndDestroy(mimeTypeBuf);
+ }
+ CleanupStack::PopAndDestroy(2); //dataObj, contentObj
+ return player;
+}
+#endif // RD_JAVA_OMA_DRM_V2
+
+CMMAPlayer* CMMAMMFPlayerFactory::CreatePlayerL(const TDesC8& aHeaderData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL header data +");
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ // Match to header data
+ fSelect->SetMatchToHeaderDataL(aHeaderData);
+
+ CMMAPlayer* player = CreatePlayerL(fSelect);
+
+ CleanupStack::PopAndDestroy(fSelect);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAMMFPlayerFactory::CreatePlayerL header data -");
+ return player;
+}
+
+void CMMAMMFPlayerFactory::GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray)
+{
+ // check that this is supported protocol
+ if (!IsSupportedProtocolL(aProtocol))
+ {
+ return;
+ }
+
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ CMMAMMFResolver* cSelect =
+ CMMAMMFResolver::NewLC();
+
+ PreparePluginSelectionParametersL(cSelect, fSelect);
+
+ // Set the media ids
+ RArray<TUid> mediaIds;
+ CleanupClosePushL(mediaIds);
+ MediaIdsL(mediaIds);
+ cSelect->SelectionParameters()->SetMediaIdsL(mediaIds, MediaIdMatchType());
+
+ cSelect->GetSupportedContentTypesL(aMimeTypeArray);
+
+ // Content type application/x-ext-packetsrc must not be supported,
+ // thus it is removed from the list of supported content types
+ TInt position(0);
+ TInt err = aMimeTypeArray.Find(KContentTypePacketSrcNotIncluded, position);
+ if (err == KErrNone)
+ {
+ aMimeTypeArray.Delete(position);
+ aMimeTypeArray.Compress();
+ }
+
+ CleanupStack::PopAndDestroy(); // mediaIds
+ CleanupStack::PopAndDestroy(cSelect);
+ CleanupStack::PopAndDestroy(fSelect);
+}
+
+EXPORT_C CMMAPlayer* CMMAMMFPlayerFactory::CreatePlayerL(CMMFFormatSelectionParameters* aFormatSelect,
+ const TDesC* aFileName)
+{
+ CMMAMMFResolver* cSelect =
+ CMMAMMFResolver::NewLC();
+ cSelect->SetFileNameL(aFileName);
+
+ PreparePluginSelectionParametersL(cSelect,
+ aFormatSelect);
+
+ // Set the media ids
+ RArray<TUid> mediaIds;
+ CleanupClosePushL(mediaIds);
+ MediaIdsL(mediaIds);
+ cSelect->SelectionParameters()->SetMediaIdsL(
+ mediaIds, MediaIdMatchType());
+
+ cSelect->ListImplementationsL();
+ CMMAPlayer* player = NULL;
+
+ // check that did we get any hits
+ if (cSelect->Implementations()->Count() > 0)
+ {
+ // Call actual factory to create player
+ player = CreatePlayerL(cSelect);
+ }
+
+ CleanupStack::PopAndDestroy(); // mediaIds
+ CleanupStack::PopAndDestroy(cSelect);
+ return player;
+}
+
+void CMMAMMFPlayerFactory::GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ // Check that this is supported content type
+ if (!IsSupportedContentTypeL(aContentType))
+ {
+ return;
+ }
+ aProtocolArray.AppendL(KMMAHttpProtocol);
+ aProtocolArray.AppendL(KMMAHttpsProtocol);
+ aProtocolArray.AppendL(KMMAFileProtocol);
+}
+
+TBool CMMAMMFPlayerFactory::IsSupportedProtocolL(const TDesC& aProtocol)
+{
+ // With null desc we are getting all
+ if (aProtocol == KNullDesC)
+ {
+ return ETrue;
+ }
+ CDesC16ArraySeg* protocols = new(ELeave) CDesC16ArraySeg(KGranularity);
+ CleanupStack::PushL(protocols);
+ GetSupportedProtocolsL(KNullDesC, *protocols);
+ TInt pos = KErrNotFound;
+ // Find returns 0 if there contentType is found
+ TBool retValue = (protocols->Find(aProtocol, pos) == 0);
+ CleanupStack::PopAndDestroy(protocols);
+ return retValue;
+}
+
+TBool CMMAMMFPlayerFactory::IsSupportedContentTypeL(const TDesC& aContentType)
+{
+ // With null desc we are getting all
+ if (aContentType == KNullDesC)
+ {
+ return ETrue;
+ }
+
+ // Content type application/x-ext-packetsrc
+ // must not be supported at the moment.
+ if (aContentType == KContentTypePacketSrcNotIncluded)
+ {
+ return EFalse;
+ }
+
+ CDesC16ArraySeg* contentTypes = new(ELeave) CDesC16ArraySeg(KGranularity);
+ CleanupStack::PushL(contentTypes);
+ GetSupportedContentTypesL(KNullDesC, *contentTypes);
+ TInt pos = KErrNotFound;
+ // Find returns 0 if there contentType is found
+ TBool retValue = (contentTypes->Find(aContentType, pos) == 0);
+ CleanupStack::PopAndDestroy(contentTypes);
+ return retValue;
+}
+
+EXPORT_C void CMMAMMFPlayerFactory::PreparePluginSelectionParametersL(
+ CMMAMMFResolver* aResolver,
+ CMMFFormatSelectionParameters* aFormatSelection)
+{
+ // Play type is default
+ aResolver->SetRequiredPlayFormatSupportL(*aFormatSelection);
+}
+
+
+CMMFPluginSelectionParameters::TMediaIdMatchType
+CMMAMMFPlayerFactory::MediaIdMatchType()
+{
+ // We are now getting only Audio Controllers
+ return CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmammfratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements generic RateControl functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmammfratecontrol.h"
+
+namespace
+{
+const TInt KErrorMessageSize = 32;
+_LIT(KErrDefaultError, "Symbian OS Error: %d");
+}
+
+CMMAMMFRateControl* CMMAMMFRateControl::NewL(CMMAMMFPlayerBase* aPlayer)
+{
+ CMMAMMFRateControl* self = new(ELeave) CMMAMMFRateControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAMMFRateControl::~CMMAMMFRateControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::~CMMAMMFRateControl");
+}
+
+CMMAMMFRateControl::CMMAMMFRateControl(CMMAMMFPlayerBase* aPlayer) :
+ iPlayer(aPlayer), iCurrentRate(KMMADefaultRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::CMMAMMFRateControl");
+}
+
+void CMMAMMFRateControl::ConstructL()
+{
+ iPlayer->AddStateListenerL(this);
+}
+
+void CMMAMMFRateControl::StateChanged(TInt aState)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::StateChanged");
+ if (aState == CMMAPlayer::EStarted && iCurrentRate == KMMAMinRate)
+ {
+ RMMFController& controller = iPlayer->Controller();
+ TInt err = controller.Pause();
+ if ((err != KErrNone) && (err != KErrNotReady))
+ {
+ ELOG1( EJavaMMAPI, "CMMAMMFRateControl::StateChanged: Pause error %d", err);
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+ }
+ }
+}
+
+TInt CMMAMMFRateControl::SetRateL(TInt aRate)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::SetRateL");
+ RMMFController& controller = iPlayer->Controller();
+
+ TInt newRate;
+ if (aRate <= KMMAMinRate)
+ {
+ newRate = KMMAMinRate;
+ }
+ else
+ {
+ newRate = KMMADefaultRate;
+ }
+
+ if ((iPlayer->State() == CMMAPlayer::EStarted) &&
+ (newRate != iCurrentRate))
+ {
+ if (newRate == KMMAMinRate)
+ {
+ TInt err = controller.Pause();
+ if ((err != KErrNone) && (err != KErrNotReady))
+ {
+ User::Leave(err);
+ }
+ }
+ else
+ {
+ User::LeaveIfError(controller.Play());
+ }
+ }
+ iCurrentRate = newRate;
+ return iCurrentRate;
+}
+
+TInt CMMAMMFRateControl::RateL()
+{
+ return iCurrentRate;
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmammfresolver.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing sounds
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+
+#include "cmmammfresolver.h"
+#include "apgcli.h"
+#include "apmrec.h"
+
+
+#include "hxmetadatautil.h"
+_LIT8(KMimetypeRM, "audio/x-pn-realaudio");
+_LIT(KRVMimeType1, "video/x-pn-realvideo");
+_LIT(KRVMimeType2, "video/x-realvideo");
+_LIT(KRVMimeType3, "video/vnd.rn-realvideo");
+
+
+// CONSTANTS
+
+CMMAMMFResolver* CMMAMMFResolver::NewLC()
+{
+ CMMAMMFResolver* self = new(ELeave)CMMAMMFResolver();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+void CMMAMMFResolver::ListImplementationsL()
+{
+ iControllerSelection->ListImplementationsL(*iImplementations);
+ if (iImplementations->Count() > 0)
+ {
+ ResolveContentTypeL();
+ }
+}
+
+RMMFControllerImplInfoArray* CMMAMMFResolver::Implementations()
+{
+ // ImplementationsOwnership method must not be called before this
+ __ASSERT_DEBUG(iImplementations, User::Invariant());
+ return iImplementations;
+}
+
+RMMFControllerImplInfoArray* CMMAMMFResolver::ImplementationsOwnership()
+{
+ // ImplementationsOwnership method must not be called many times
+ __ASSERT_DEBUG(iImplementations, User::Invariant());
+
+ RMMFControllerImplInfoArray* implementations = iImplementations;
+ iImplementations = NULL; // ownership is transferred
+ return implementations;
+}
+
+HBufC* CMMAMMFResolver::ContentTypeOwnership()
+{
+ HBufC* ct = iContentType;
+ iContentType = NULL;
+ return ct;
+}
+
+HBufC* CMMAMMFResolver::ContentType()
+{
+ return iContentType;
+}
+
+void CMMAMMFResolver::SetFileNameL(const TDesC* aFileName)
+{
+ HBufC* fn = NULL;
+ if (aFileName)
+ {
+ fn = aFileName->AllocL();
+ }
+ delete iFileName;
+ iFileName = fn;
+}
+
+HBufC* CMMAMMFResolver::FileNameOwnership()
+{
+ HBufC* fn = iFileName;
+ iFileName = NULL;
+ return fn;
+}
+
+void CMMAMMFResolver::ResolveContentTypeL()
+{
+ LOG( EJavaMMAPI, EInfo, "+ CMMAMMFResolver::ResolveContentTypeL()");
+ CMMFFormatSelectionParameters* fSelect = iRequiredPlayFormatSupport;
+ if (!fSelect)
+ {
+ fSelect = iRequiredRecordFormatSupport;
+ }
+ // if there is no play or record formats this object is not
+ // initialized correctly.
+ __ASSERT_DEBUG(fSelect, User::Invariant());
+
+ CMMFFormatSelectionParameters::TMatchDataType type =
+ fSelect->MatchDataType();
+
+ // if there is no implementation this method must not be called.
+ __ASSERT_DEBUG(iImplementations->Count() > 0, User::Invariant());
+ const RMMFFormatImplInfoArray* formats =
+ Formats((*iImplementations)[ 0 ]);
+
+ HBufC8* contentType = NULL;
+ TInt formatsCount = formats->Count();
+
+ if (type == CMMFFormatSelectionParameters::EMatchMimeType)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchMimeType");
+ // The match was based on a mime type.
+ contentType = fSelect->MatchData().AllocLC();
+ }
+ else if (type == CMMFFormatSelectionParameters::EMatchFileExtension)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchFileExtension");
+ // The match was based on a file extension.
+ RApaLsSession ls;
+ TInt error;
+ error = ls.Connect();
+ TDataRecognitionResult result;
+ error = ls.RecognizeData(*iFileName, KNullDesC8, result);
+ ls.Close();
+
+ if (iFileName && (iFileName->Right(3).Compare(KRaFileExtension()) == 0))
+ {
+ contentType = KMimetypeRM().AllocLC();
+ }
+ else if (iFileName && (iFileName->Right(3).Compare(KRmFileExtension()) == 0) &&
+ !(IsRealVideoTypeL(*iFileName)))
+ {
+ contentType = KMimetypeRM().AllocLC();
+ }
+ else if (!error && (result.iConfidence >= CApaDataRecognizerType::EProbable))
+ {
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - Confidence : %d", result.iConfidence);
+ contentType = result.iDataType.Des8().AllocLC();
+ }
+
+
+ else
+ {
+ // The probability is less, hence matching is done based on legacy style
+ for (TInt format = 0; (format < formatsCount) &&
+ !contentType; format++)
+ {
+ const CMMFFormatImplementationInformation* info = (*formats)[ format ];
+ if (info->SupportsFileExtension(fSelect->MatchData()))
+ {
+ if (info->SupportedMimeTypes().Count() > 0)
+ {
+ contentType = info->SupportedMimeTypes()[ 0 ].AllocLC();
+ }
+ }
+ }
+ }
+ }
+ else if (type == CMMFFormatSelectionParameters::EMatchHeaderData)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchHeaderData");
+ // The match was on a header data.
+ RApaLsSession ls;
+ TInt error;
+ error = ls.Connect();
+ TDataRecognitionResult result;
+ error = ls.RecognizeData(KNullDesC, fSelect->MatchData() , result);
+ ls.Close();
+ if (!error && (result.iConfidence >= CApaDataRecognizerType::EProbable))
+ {
+ contentType = result.iDataType.Des8().AllocLC();
+ }
+ else
+ {
+ // The probability is less, hence matching is done based on legacy style
+ for (TInt format = 0; (format < formatsCount) &&
+ !contentType; format++)
+ {
+ CMMFFormatImplementationInformation* info = (*formats)[ format ];
+ if (info->SupportsHeaderDataL(fSelect->MatchData()))
+ {
+ if (info->SupportedMimeTypes().Count() > 0)
+ {
+ contentType = info->SupportedMimeTypes()[ 0 ].AllocLC();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - KErrNotSupported");
+ // EMatchAny is not supported
+ User::Leave(KErrNotSupported);
+ }
+
+ // iContentType remains NULL if content type was not found.
+ if (contentType)
+ {
+ LOG1( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType : %s", contentType->Des().PtrZ());
+
+ HBufC* ct = HBufC::NewL(contentType->Length());
+ (ct->Des()).Copy(*contentType);
+ CleanupStack::PopAndDestroy(contentType);
+ delete iContentType;
+ iContentType = ct;
+ }
+ else
+ {
+ //This situation should never occur
+ LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType = NULL");
+ User::Leave(KErrUnknown);
+ }
+ LOG( EJavaMMAPI, EInfo, "- CMMAMMFResolver::ResolveContentTypeL()");
+}
+
+
+TBool CMMAMMFResolver::IsRealVideoTypeL(const TDesC& aFileName)
+{
+ TBool result = EFalse;
+
+ CHXMetaDataUtility *putil;
+ putil = CHXMetaDataUtility::NewL();
+ CleanupStack::PushL(putil);
+ TRAPD(err, putil->OpenFileL(aFileName));
+ ELOG1( EJavaMMAPI, "MMA:CMMAMMFResolver::IsRealVideoTypeL, err = %d", err);
+
+ if (err != KErrNone)
+ {
+ CleanupStack::Pop(putil);
+ putil->ResetL();
+ delete putil;
+ return EFalse;
+ }
+
+ TUint count = 0;
+ putil->GetMetaDataCount(count);
+
+ TUint i;
+ HXMetaDataKeys::EHXMetaDataId id;
+
+ for (i = 0; i < count; i++)
+ {
+ HBufC* pDes = NULL;
+
+ putil->GetMetaDataAt(i, id, pDes);
+
+ if (id == HXMetaDataKeys::EHXMimeType)
+ {
+ if (IsRealMimeTypeSupported(*pDes))
+ {
+ result = ETrue;
+ }
+ }
+ }
+
+ CleanupStack::Pop(putil);
+
+ putil->ResetL();
+ delete putil;
+
+ return result;
+}
+
+
+TBool CMMAMMFResolver::IsRealMimeTypeSupported(const TDesC& aMimeType)
+{
+ TBool match = EFalse;
+
+ if (!aMimeType.Compare(KRVMimeType1()))
+ {
+ match = ETrue;
+ return match;
+ }
+ if (!aMimeType.Compare(KRVMimeType2()))
+ {
+ match = ETrue;
+ return match;
+ }
+ if (!aMimeType.Compare(KRVMimeType3()))
+ {
+ match = ETrue;
+ return match;
+ }
+
+ return match;
+}
+
+
+void CMMAMMFResolver::GetSupportedContentTypesL(CDesC16Array& aMimeTypeArray)
+{
+ iControllerSelection->ListImplementationsL(*iImplementations);
+
+ TInt impCount = iImplementations->Count();
+ for (TInt i = 0; i < impCount; i++)
+ {
+ const RMMFFormatImplInfoArray* formats = Formats((*iImplementations)[ i ]);
+ TInt formatsCount(formats->Count());
+ for (TInt format = 0; format < formatsCount; format++)
+ {
+ const CMMFFormatImplementationInformation* info = (*formats)[ format ];
+ const CDesC8Array& supportedMimes = info->SupportedMimeTypes();
+ TInt mimeCount = supportedMimes.Count();
+ for (TInt mime = 0; mime < mimeCount; mime++)
+ {
+ // must convert from 8 bits to 16 bits
+ HBufC* tmpBuf = HBufC::NewLC(supportedMimes[ mime ].Length());
+ tmpBuf->Des().Copy(supportedMimes[ mime ]);
+ aMimeTypeArray.AppendL(*tmpBuf);
+ CleanupStack::PopAndDestroy(tmpBuf);
+ }
+ }
+ }
+}
+
+
+void CMMAMMFResolver::SetRequiredPlayFormatSupportL(
+ CMMFFormatSelectionParameters& aRequiredSupport)
+{
+ iControllerSelection->SetRequiredPlayFormatSupportL(aRequiredSupport);
+ iRequiredPlayFormatSupport = &aRequiredSupport;
+}
+
+void CMMAMMFResolver::SetRequiredRecordFormatSupportL(
+ CMMFFormatSelectionParameters& aRequiredSupport)
+{
+ iControllerSelection->SetRequiredRecordFormatSupportL(aRequiredSupport);
+ iRequiredRecordFormatSupport = &aRequiredSupport;
+}
+
+const RMMFFormatImplInfoArray* CMMAMMFResolver::Formats(CMMFControllerImplementationInformation* aImplementation)
+{
+ const RMMFFormatImplInfoArray* formats = NULL;
+ if (iRequiredPlayFormatSupport)
+ {
+ formats = &(aImplementation->PlayFormats());
+ }
+ else
+ {
+ // if there is no play or record formats this object is not
+ // initialized correctly.
+ __ASSERT_DEBUG(iRequiredRecordFormatSupport, User::Invariant());
+
+ formats = &(aImplementation->RecordFormats());
+ }
+ return formats;
+}
+
+CMMFControllerPluginSelectionParameters*
+CMMAMMFResolver::SelectionParameters()
+{
+ return iControllerSelection;
+}
+
+CMMAMMFResolver::~CMMAMMFResolver()
+{
+ if (iImplementations)
+ {
+ iImplementations->ResetAndDestroy();
+ }
+ delete iImplementations;
+ delete iContentType;
+ delete iControllerSelection;
+ delete iFileName;
+}
+
+
+CMMAMMFResolver::CMMAMMFResolver()
+{
+}
+
+
+void CMMAMMFResolver::ConstructL()
+{
+ iImplementations = new(ELeave)RMMFControllerImplInfoArray();
+ iControllerSelection = CMMFControllerPluginSelectionParameters::NewL();
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaoutputstream.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class to handle OutputStream operations.
+*
+*/
+
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+#include "cmmaoutputstream.h"
+#include "mmmaeventposter.h"
+#include "cmmaoutputstreamevent.h"
+
+// CONSTANTS
+const TInt KMMACommit = -10000; // indicates native started commit
+
+CMMAOutputStream* CMMAOutputStream::NewL(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter
+ )
+{
+ CMMAOutputStream* self = CMMAOutputStream::NewLC(aJNIEnv,
+ aEventPoster,
+ aJavaOutputStreamWriter
+ );
+ CleanupStack::Pop();
+ return self;
+}
+
+
+CMMAOutputStream* CMMAOutputStream::NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter
+ )
+{
+ CMMAOutputStream* self = new(ELeave) CMMAOutputStream(aEventPoster);
+ CleanupStack::PushL(self);
+ self->ConstructL(aJNIEnv, aJavaOutputStreamWriter);
+ return self;
+}
+
+
+void CMMAOutputStream::CreateL(CMMAOutputStream** aOutputStream,
+ MMAFunctionServer* aEventServer,
+ JNIEnv* aJniEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaOutputStreamWriter)
+{
+
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJniEnv = aEventServer->getValidJniEnv();
+
+ *aOutputStream = NewL(aJniEnv, aEventPoster, aJavaOutputStreamWriter);
+}
+
+
+CMMAOutputStream::~CMMAOutputStream()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAOutputStream::~");
+
+ // If write event is in the event server, it cannot be deleted.
+ // Thus set the event to be deleted when event dispatch is called.
+ if (iWriteEvent &&
+ iWriteEvent->State() == CMMAOutputStreamEvent::EMMAEventActive)
+ {
+ iWriteEvent->SetState(CMMAOutputStreamEvent::EMMADeleteEvent);
+ }
+ else
+ {
+ delete iWriteEvent;
+ }
+
+ delete iData;
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAOutputStream::~ OK");
+}
+
+
+// Default constructor
+CMMAOutputStream::CMMAOutputStream(MMMAEventPoster* aEventPoster)
+ : iEventSource(aEventPoster),
+ iPtr(NULL, 0)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAOutputStream constructed");
+}
+
+
+void CMMAOutputStream::ConstructL(JNIEnv* aJNIEnv,
+ jobject aJavaOutputStreamWriter)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAOutputStream::ConstructL()");
+
+ // void write( int aLength, int aStatus ) method in OutputStreamWriter
+ jmethodID classMethodID =
+ aJNIEnv->GetMethodID(
+ aJNIEnv->GetObjectClass(aJavaOutputStreamWriter),
+ "write",
+ "(II)V");
+ if (!classMethodID)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAOutputStream::ConstructL: Cannot find java method");
+ User::Panic(_L("Java method write(II)V not found"), KErrGeneral);
+ }
+
+ iWriteEvent = new(ELeave) CMMAOutputStreamEvent(classMethodID,
+ aJavaOutputStreamWriter);
+}
+
+void CMMAOutputStream::ReadDataL(TUint8* aOutputData,
+ TInt* aBufferSize,
+ TInt* aReadStatus)
+{
+ if (!iData)
+ {
+ User::Leave(KErrNotReady);
+ }
+
+ // Status code to be returned
+ TInt status = KErrNone;
+
+ TPtr8 buffer(aOutputData, *aBufferSize);
+ LOG1( EJavaMMAPI, EInfo, " MMA::CMMAOutputStream::ReadDataL SIZE BEFORE READL %d", buffer.Length());
+ LOG1( EJavaMMAPI, EInfo, " MMA::CMMAOutputStream::ReadDataL BYTES AVAILABLE %d", iPtr.Length());
+
+ // Bytes available in native buffer
+ TInt bytesAvailable = iPtr.Length();
+
+ // Maximum size that can be written to Java buffer
+ TInt outputMaxLength = buffer.MaxLength();
+
+ // Length that can be written
+ TInt writeLength = 0;
+
+ if (outputMaxLength < bytesAvailable)
+ {
+ // Not all bytes can be written Java buffer
+ writeLength = outputMaxLength;
+
+ // Java need to read more data
+ status = EMoreData;
+ }
+ else
+ {
+ // All bytes can be written to Java buffer
+ writeLength = bytesAvailable;
+
+ // All data is copied
+ status = ECompleted;
+ }
+
+ // Copy maximum number of bytes to Java buffer
+ buffer.Copy(iPtr.Left(writeLength));
+ *aBufferSize = buffer.Length();
+
+ // Move pointer to next read position.
+ iPtr = iPtr.Mid(writeLength);
+
+ LOG1( EJavaMMAPI, EInfo, " MMA::CMMAOutputStream::ReadDataL SIZE AFTER READL %d", buffer.Length());
+ LOG1( EJavaMMAPI, EInfo, " MMA::CMMAOutputStream::ReadDataL RETURN %d", status);
+ LOG1( EJavaMMAPI, EInfo, " MMA::CMMAOutputStream::ReadDataL dataLeft %d", iPtr.Length());
+
+ if (iPtr.Length() == 0)
+ {
+ // All data is read and buffer is not needed anymore.
+ delete iData;
+ iData = NULL;
+ }
+ *aReadStatus = status;
+}
+
+void CMMAOutputStream::WriteL(const TDesC8& aData)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAOutputStream::WriteL data size = %d", aData.Size());
+ if (iData)
+ {
+ // Previous data was not readed from the stream.
+ User::Leave(KErrNotReady);
+ }
+
+ if (aData.Length() > 0)
+ {
+ // Take a copy of new data.
+ HBufC8* data = aData.AllocL();
+ delete iData;
+ iData = data;
+ iPtr.Set(iData->Des());
+
+ // Set java event
+ LOG1( EJavaMMAPI, EInfo, "CMMAOutputStream::WriteL: available data: %d", iData->Length());
+ iWriteEvent->SetLength(iData->Length());
+ iWriteEvent->SetStatus(EMoreData);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAOutputStream::WriteL Zero length data");
+ iWriteEvent->SetLength(0);
+ iWriteEvent->SetStatus(ECompleted);
+ }
+ iEventSource->PostEvent(iWriteEvent, CMMAEvent::ENotifyPriority);
+}
+
+void CMMAOutputStream::Commit()
+{
+ iWriteEvent->SetLength(0);
+ iWriteEvent->SetStatus(KMMACommit);
+ iEventSource->PostEvent(iWriteEvent, CMMAEvent::ENotifyPriority);
+}
+
+// END OF FILE
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaoutputstreamevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#include <logger.h>
+
+#include "cmmaoutputstreamevent.h"
+
+
+CMMAOutputStreamEvent::CMMAOutputStreamEvent(jmethodID aHandleEventMethod,
+ jobject aNotifyObject)
+ : CMMAEvent(EReusableEvent),
+ iHandleEventMethod(aHandleEventMethod),
+ iListenerObject(aNotifyObject)
+{
+ iState = EMMAEventNotActive;
+}
+
+void CMMAOutputStreamEvent::SetLength(TInt aLength)
+{
+ iLength = aLength;
+ iState = EMMAEventActive;
+}
+
+
+void CMMAOutputStreamEvent::SetStatus(TInt aStatus)
+{
+ iStatus = aStatus;
+ iState = EMMAEventActive;
+}
+
+void CMMAOutputStreamEvent::SetState(CMMAOutputStreamEvent::TMMAOutputStreamState aState)
+{
+ iState = aState;
+}
+
+CMMAOutputStreamEvent::TMMAOutputStreamState CMMAOutputStreamEvent::State()
+{
+ return iState;
+}
+
+void CMMAOutputStreamEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG2( EJavaMMAPI, EInfo, "CMMAOutputStreamEvent::Dispatch, len=%d status=%d-",
+ iLength, iStatus);
+
+ if (iState == EMMAEventActive)
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iLength,
+ iStatus);
+ iState = EMMAEventNotActive;
+ }
+ else if (iState == EMMADeleteEvent)
+ {
+ // This is done because some
+ // event may still exist in the event server when
+ // the sender has been deleted.
+
+ delete this;
+ }
+ // else event is not active
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,496 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is base class for all players.
+*
+*/
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+#include "cmmaplayer.h"
+#include "mmafunctionserver.h"
+#include "cmmadurationupdater.h"
+#include "cmmavolumecontrol.h"
+
+// CONSTANTS
+_LIT(KPanicOutOfMem, "out of memory");
+
+#ifdef _DEBUG // Needed only in ASSER_DEBUG statements.
+_LIT(KPanicMethod, "method not found");
+#endif
+
+CMMAPlayer::~CMMAPlayer()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAPlayer::~CMMAPlayer()");
+
+ iSourceStreams.ResetAndDestroy();
+ if (iControls.Count() > 0)
+ iControls.ResetAndDestroy();
+ iStateListeners.Reset();
+ delete iActionCompletedEvent;
+ delete iOOMErrorEvent;
+ delete iDurationUpdater;
+ delete iContentType;
+}
+
+
+CMMAPlayer::CMMAPlayer():
+ iRepeatNumberOfTimes(0),
+ iRepeatForever(EFalse),
+ iRepeatCount(0),
+ iDuration(KTimeUnknown),
+ iState(EUnrealized)
+{
+}
+
+
+void CMMAPlayer::ConstructL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL + ");
+ iDurationUpdater = CMMADurationUpdater::NewL(*this);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL - ");
+}
+
+
+void CMMAPlayer::StaticAddSourceStreamL(JNIEnv* aJniEnv,
+ CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aReader,
+ CMMASourceStream** aSourceStream)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL +");
+
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJniEnv = aEventSource-> getValidJniEnv();
+
+ *aSourceStream = aPlayer->AddSourceStreamL(aJniEnv,
+ aEventSource,
+ aReader);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL -");
+}
+
+
+
+void CMMAPlayer::StaticSetPlayerListenerObjectL(CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventsource,
+ jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aPoster)
+{
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL +");
+
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJni = aEventsource-> getValidJniEnv();
+
+ aPlayer->SetPlayerListenerObjectL(aListenerObject, aJni, aPoster);
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL -");
+}
+
+
+void CMMAPlayer::StaticInitPlayerL(CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventsource,
+ jobject aPlayerObject,
+ JNIEnv* aJni)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL +");
+
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJni = aEventsource-> getValidJniEnv();
+
+ jmethodID actionCompletedMethod = aJni->GetMethodID(
+ aJni->GetObjectClass(aPlayerObject),
+ "actionCompleted",
+ "(I)V");
+
+ jmethodID actionCompletedFileMethod = aJni->GetMethodID(
+ aJni->GetObjectClass(aPlayerObject),
+ "actionCompletedFile",
+ "()V");
+
+ jmethodID actionCompletedStartMethod = aJni->GetMethodID(
+ aJni->GetObjectClass(aPlayerObject),
+ "actionCompletedStart",
+ "()V");
+
+ // Sanity Check, something is really wrong if methods cannot be found
+ __ASSERT_DEBUG(actionCompletedMethod,
+ User::Panic(KPanicMethod, KErrGeneral));
+
+ aPlayer->iActionCompletedEvent = new(ELeave) CMMAEvent(
+ aPlayerObject,
+ actionCompletedMethod,
+ CMMAEvent::EReusableEvent);
+
+ aPlayer->iActionCompletedFileEvent = new(ELeave) CMMAEvent(
+ aPlayerObject,
+ actionCompletedFileMethod,
+ CMMAEvent::EReusableEvent);
+
+ aPlayer->iActionCompletedStartEvent = new(ELeave) CMMAEvent(
+ aPlayerObject,
+ actionCompletedStartMethod,
+ CMMAEvent::EReusableEvent);
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL -");
+}
+
+CMMAControl* CMMAPlayer::StaticControl(CMMAPlayer* aPlayer, TInt aIndex)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticControl +");
+ return aPlayer->Control(aIndex);
+
+}
+
+
+void CMMAPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::RealizeL +");
+ ChangeState(ERealized);
+
+}
+
+
+void CMMAPlayer::CloseL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::CloseL ");
+ ChangeState(EClosed);
+ PostObjectEvent(CMMAPlayerEvent::EClosed, NULL);
+}
+
+
+void CMMAPlayer::GetDuration(TInt64* aDuration)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetDuration ");
+ *aDuration = iDuration;
+}
+
+
+void CMMAPlayer::SetMediaTimeL(TInt64* aTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetMediaTimeL ");
+ *aTime = KErrNotSupported;
+}
+
+void CMMAPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetMediaTime ");
+ *aMediaTime = KErrNotSupported;
+}
+
+
+EXPORT_C void CMMAPlayer::SetLoopCount(TInt aCount)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetLoopCount ");
+ iRepeatForever = (aCount == KJavaRepeatForever);
+ iRepeatNumberOfTimes = aCount;
+ iRepeatCount = 0;
+}
+
+HBufC* CMMAPlayer::ContentType() const
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ContentType ");
+ return iContentType;
+}
+
+void CMMAPlayer::SetPlayerListenerObjectL(jobject aListenerObject,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetPlayerListenerObjectL +");
+ iListenerObject = aListenerObject;
+ iEventPoster = aEventPoster;
+
+ jclass listenerClass = aJni->GetObjectClass(aListenerObject);
+
+ iPostEvent = aJni->GetMethodID(
+ listenerClass,
+ "postEvent",
+ "(Ljava/lang/String;Ljava/lang/Object;)V");
+
+ iPostObjectEvent = aJni->GetMethodID(listenerClass,
+ "postObjectEvent",
+ "(ILjava/lang/Object;)V");
+
+ iPostLongEvent = aJni->GetMethodID(listenerClass,
+ "postLongEvent",
+ "(IJ)V");
+
+ iPostStringEvent = aJni->GetMethodID(listenerClass,
+ "postStringEvent",
+ "(ILjava/lang/String;)V");
+
+ iPostControlEvent = aJni->GetMethodID(listenerClass,
+ "postControlEvent",
+ "(ILjava/lang/String;)V");
+
+
+ // Sanity Check, something is really wrong if methods cannot be found
+ __ASSERT_DEBUG(iPostEvent &&
+ iPostObjectEvent &&
+ iPostLongEvent &&
+ iPostStringEvent &&
+ iPostControlEvent,
+ User::Panic(KPanicMethod, KErrGeneral));
+
+ iOOMErrorEvent = new(ELeave) CMMAPlayerEvent(iListenerObject,
+ iPostStringEvent,
+ CMMAEvent::EReusableEvent);
+ iOOMErrorEvent->SetStringEventL(CMMAPlayerEvent::EError,
+ KPanicOutOfMem);
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetPlayerListenerObjectL -");
+}
+
+
+EXPORT_C TInt CMMAPlayer::ControlCount()
+{
+ return iControls.Count();
+}
+
+
+EXPORT_C CMMAControl* CMMAPlayer::Control(TInt aIndex)
+{
+ return iControls[ aIndex ];
+}
+
+void CMMAPlayer::RefreshControls()
+{
+
+ for (TInt index = 0; index < iControls.Count(); index++)
+ {
+ CMMAControl* control = iControls[ index ];
+ control->RefreshControl();
+ }
+
+}
+
+EXPORT_C void CMMAPlayer::AddStateListenerL(MMMAPlayerStateListener* aListener)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::AddStateListenerL +");
+ TInt err = iStateListeners.Append(aListener);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::AddStateListenerL - err = %d ",err);
+ User::LeaveIfError(err);
+ //User::LeaveIfError(iStateListeners.Append(aListener));
+
+}
+
+EXPORT_C void CMMAPlayer::RemoveStateListener(MMMAPlayerStateListener* aListener)
+{
+
+ TInt index = iStateListeners.Find(aListener);
+
+ if (index != KErrNotFound)
+ {
+ iStateListeners.Remove(index);
+ }
+
+}
+
+const TDesC& CMMAPlayer::Type()
+{
+ // by default player has not the type
+ return KNullDesC;
+}
+
+void CMMAPlayer::SetContentType(HBufC* aContentType)
+{
+
+ delete iContentType;
+ iContentType = aContentType;
+
+}
+
+void CMMAPlayer::ResetSourceStreams()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ResetSourceStreams +");
+ int sourceStreamsCount = iSourceStreams.Count();
+ for (int i = 0; i < sourceStreamsCount; i++)
+ {
+ iSourceStreams[ i ]->ResetData();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ResetSourceStreams -");
+}
+
+EXPORT_C void CMMAPlayer::AddControlL(CMMAControl* aControl)
+{
+
+ User::LeaveIfError(iControls.Append(aControl));
+
+}
+
+void CMMAPlayer::PostLongEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TInt64& aLongEventData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostLongEvent ");
+ if (!iListenerObject || !iEventPoster)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostLongEvent No listener");
+ // return since player is not ready for posting any events and is not initialized
+ return;
+ }
+
+ CMMAPlayerEvent* playerEvent = new CMMAPlayerEvent(iListenerObject,
+ iPostLongEvent);
+ if (!playerEvent)
+ {
+ // creation of player event failed, informing Java
+ iEventPoster->PostEvent(iOOMErrorEvent);
+ return;
+ }
+ playerEvent->SetLongEvent(aEventType, aLongEventData);
+
+ // event poster takes ownership of event
+ iEventPoster->PostEvent(playerEvent);
+}
+
+
+EXPORT_C void CMMAPlayer::PostStringEvent(CMMAPlayerEvent::TEventType aEventType,
+ const TDesC& aStringEventData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostStringEvent ");
+ if (!iListenerObject || !iEventPoster)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostStringEvent No listener");
+ // return since player is not ready for posting any events and is not initialized
+ return;
+ }
+
+ CMMAPlayerEvent* playerEvent = new CMMAPlayerEvent(iListenerObject,
+ iPostStringEvent);
+ if (!playerEvent)
+ {
+ // creation of player event failed, informing Java
+ iEventPoster->PostEvent(iOOMErrorEvent);
+ return;
+ }
+
+ TRAPD(err, playerEvent->SetStringEventL(aEventType, aStringEventData));
+ if (err != KErrNone)
+ {
+ // string setting failed, informing Java
+ iEventPoster->PostEvent(iOOMErrorEvent);
+ return;
+ }
+
+ // event poster takes ownership of event
+ iEventPoster->PostEvent(playerEvent);
+}
+
+
+EXPORT_C void CMMAPlayer::PostObjectEvent(CMMAPlayerEvent::TEventType aEventType,
+ const jobject aEventData)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostObjectEvent ");
+
+ if (!iListenerObject || !iEventPoster)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostObjectEvent No listener");
+ // return since player is not ready for posting any events and is not initialized
+ return;
+ }
+
+ CMMAPlayerEvent* playerEvent = new CMMAPlayerEvent(iListenerObject,
+ iPostObjectEvent);
+
+ if (!playerEvent)
+ {
+ // creation of player event failed, informing Java
+ iEventPoster->PostEvent(iOOMErrorEvent);
+ return;
+ }
+
+ TRAPD(err, playerEvent->SetObjectEventL(aEventType, aEventData));
+ if (err != KErrNone)
+ {
+ // creation of player event failed, informing Java
+ iEventPoster->PostEvent(iOOMErrorEvent);
+ return;
+ }
+
+ // event poster takes ownership of event
+ iEventPoster->PostEvent(playerEvent);
+}
+
+EXPORT_C CMMASourceStream* CMMAPlayer::AddSourceStreamL(JNIEnv* aJNIEnv,
+ MMAFunctionServer* aEventSource,
+ jobject aReader)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::AddSourceStreamL ");
+ CMMASourceStream* sourceStream = CMMASourceStream::NewL(aJNIEnv,
+ aEventSource,
+ aReader,
+ this);
+
+ CleanupStack::PushL(sourceStream);
+ User::LeaveIfError(iSourceStreams.Append(sourceStream));
+ CleanupStack::Pop(); // sourceStream
+ return sourceStream;
+}
+
+
+void CMMAPlayer::PostActionCompleted(TInt aError)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted ");
+ iActionCompletedEvent->SetEventData(aError);
+ iEventPoster->PostEvent(iActionCompletedEvent,
+ CMMAEvent::ENotifyPriority);
+}
+
+void CMMAPlayer::PostActionCompletedFile()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted ");
+ // iActionCompletedFileEvent->SetEventData(aError);
+ iEventPoster->PostEvent(iActionCompletedFileEvent,
+ CMMAEvent::ENotifyPriority);
+}
+
+
+void CMMAPlayer::PostActionCompletedStart()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted ");
+ iEventPoster->PostEvent(iActionCompletedStartEvent,
+ CMMAEvent::ENotifyPriority);
+}
+
+void CMMAPlayer::ChangeState(TPlayerState aState)
+{
+ iState = aState;
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - iStateListeners count is %d", iStateListeners.Count());
+ for (TInt i(0); i<iStateListeners.Count(); i++)
+ {
+ iStateListeners[ i ]->StateChanged(aState);
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - State changed to %d", iState);
+}
+
+void CMMAPlayer::ReadCompletedL(TInt /*aStatus*/, const TDesC8& /*aData*/)
+{
+ // empty implementation
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ReadCompletedL ");
+}
+void CMMAPlayer:: DeleteControls()
+{
+ if (iControls.Count() > 0)
+ {
+ iControls.ResetAndDestroy();
+ }
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaplayerevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaplayerevent.h"
+#include "mmapiutils.h"
+#include "s60commonutils.h"
+using namespace java::util;
+
+
+CMMAPlayerEvent::CMMAPlayerEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable):
+ CMMAEvent(aNotifyObject, aHandleEventMethod, aDisposable)
+{
+}
+
+CMMAPlayerEvent::~CMMAPlayerEvent()
+{
+ //delete iStringEventType;
+ delete iStringEventData;
+}
+
+void CMMAPlayerEvent::SetObjectEventL(TEventType aEventType,
+ const jobject aEventData)
+{
+ iEventType = aEventType;
+ iObjectEventData = aEventData;
+ iEventParams = EObject;
+}
+
+void CMMAPlayerEvent::SetLongEvent(TEventType aEventType,
+ const TInt64& aEventData)
+{
+ iEventType = aEventType;
+ iLongEventData = aEventData;
+ iEventParams = ELong;
+}
+
+void CMMAPlayerEvent::SetStringEventL(TEventType aEventType,
+ const TDesC& aEventData)
+{
+ // __ASSERT_DEBUG(iStringEventData == NULL, User::Invariant());
+ iEventType = aEventType;
+ iStringEventData = aEventData.AllocL();
+ iEventParams = EString;
+}
+
+void CMMAPlayerEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayerEvent::Dispatch type=%d", iEventType);
+ if (aJni.IsSameObject(iListenerObject, 0))
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayerEvent::Dispatch EVENT_NOT_VALID type=%d", iEventType);
+ return;
+ }
+ switch (iEventParams)
+ {
+ case ENormal:
+ {
+ jstring javaString = S60CommonUtils::NativeToJavaString(aJni, *iStringEventType);
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ javaString,
+ iObjectEventData);
+ break;
+ }
+ case ELong:
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventType,
+ iLongEventData);
+ break;
+ }
+ case EString:
+ {
+ jstring javaString = S60CommonUtils::NativeToJavaString(aJni, *iStringEventData);
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventType,
+ javaString);
+ break;
+ }
+ case EObject:
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventType,
+ iObjectEventData);
+ break;
+ }
+ default:
+ {
+ // cannot occur
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ }
+
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaplayerproperties.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for storing and parsing properties
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cmmaplayerproperties.h"
+
+const TInt KPropertyNameEndChar = '=';
+const TInt KPropertyEndChar = '&';
+const TInt KDefaultGranularity = 8;
+
+CMMAPlayerProperties* CMMAPlayerProperties::NewL(const TDesC& aProperties,
+ MMMAParameterRule& aRule)
+{
+ CMMAPlayerProperties* props = new(ELeave) CMMAPlayerProperties(aProperties, aRule);
+ return props;
+}
+
+CMMAPlayerProperties::~CMMAPlayerProperties()
+{
+}
+
+
+CMMAPlayerProperties::CMMAPlayerProperties(const TDesC& aProperties, MMMAParameterRule& aRule) :
+ iProperties(aProperties),
+ iRule(aRule)
+{
+}
+
+TBool CMMAPlayerProperties::GetProperty(const TDesC& aKey,
+ TInt& aValue) const
+{
+ return iRule.FindProperty(aKey, aValue);
+}
+
+TBool CMMAPlayerProperties::GetProperty(const TDesC& aKey, TPtrC& aValue) const
+{
+ return iRule.FindProperty(aKey, aValue);
+}
+
+TBool CMMAPlayerProperties::Compare(const TDesC& aKey, const TDesC& aValue) const
+{
+ return iRule.Compare(aKey, aValue);
+}
+
+TBool CMMAPlayerProperties::Compare(const TDesC& aKey, const TInt& aValue) const
+{
+ return iRule.Compare(aKey, aValue);
+}
+
+// Parse property values: "key=value&key2=value2&..."
+void CMMAPlayerProperties::ValidateL() const
+{
+ // Empty properties are valid
+ if (iProperties.Length() == 0)
+ {
+ return;
+ }
+ TInt pos = 0;
+ while (pos != KErrNotFound)
+ {
+ // Getting everything from 'pos' to end and finding '&'
+ TPtrC property = iProperties.Mid(pos);
+ TInt valueEndPos = property.Locate(KPropertyEndChar);
+
+ if (valueEndPos != KErrNotFound)
+ {
+ // This is not last property, clipping remaining chars
+ property.Set(iProperties.Mid(pos, valueEndPos));
+ }
+
+ TInt keyEndPos = property.Locate(KPropertyNameEndChar);
+ // if we are getting KErrNotFound then properties is not valid
+ if (keyEndPos == KErrNotFound)
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // "key=value"
+ TPtrC propertyKey(property.Left(keyEndPos));
+ TPtrC propertyValue(property.Mid(keyEndPos + 1));
+
+ // check is the pair valid, leave if not
+ // check also that this key was expected, leave if not
+ TPtrC tmp;
+ TInt tmpInt;
+ if (!iRule.ValidateAndStoreL(propertyKey, propertyValue) ||
+ !(iRule.FindProperty(propertyKey, tmp) ||
+ iRule.FindProperty(propertyKey, tmpInt)))
+ {
+ User::Leave(KErrArgument);
+ }
+
+ // prepare for next token or mark end
+ if (valueEndPos != KErrNotFound)
+ {
+ pos += valueEndPos + 1;
+ }
+ else
+ {
+ pos = valueEndPos;
+ }
+ }
+}
+
+
+CMMAParameterRuleSet* CMMAParameterRuleSet::NewLC()
+{
+ CMMAParameterRuleSet* self = new(ELeave)CMMAParameterRuleSet();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+CMMAParameterRuleSet::~CMMAParameterRuleSet()
+{
+ if (iRules)
+ {
+ iRules->Reset();
+ delete iRules;
+ }
+}
+
+CMMAParameterRuleSet::CMMAParameterRuleSet()
+{
+}
+
+void CMMAParameterRuleSet::ConstructL()
+{
+ iRules = new(ELeave)CArrayPtrSeg< MMMAParameterRule >(KDefaultGranularity);
+}
+
+#define LOOPUNTILRULE( endRule ) \
+ TInt rules = iRules->Count(); \
+ TInt i( 0 ); \
+ while( ( i < rules ) && \
+ endRule ) \
+ { \
+ i++; \
+ }
+
+TBool CMMAParameterRuleSet::ValidateAndStoreL(const TDesC& aKey, const TDesC& aValue)
+{
+ LOOPUNTILRULE(iRules->At(i)->ValidateAndStoreL(aKey, aValue));
+ // if loop has ended before end then some validation has failed.
+ return (i == rules);
+}
+
+TBool CMMAParameterRuleSet::Compare(const TDesC& aKey, const TDesC& aValue)
+{
+ LOOPUNTILRULE(!iRules->At(i)->Compare(aKey, aValue));
+ // if loop has ended before end then key-value pair has been found
+ return (i != rules);
+}
+
+TBool CMMAParameterRuleSet::Compare(const TDesC& aKey, const TInt aValue)
+{
+ LOOPUNTILRULE(!iRules->At(i)->Compare(aKey, aValue));
+ // if loop has ended before end then key-value pair has been found
+ return (i != rules);
+}
+
+TBool CMMAParameterRuleSet::FindProperty(const TDesC& aKey, TPtrC& aValue)
+{
+ LOOPUNTILRULE(!iRules->At(i)->FindProperty(aKey, aValue));
+ // if loop has ended before end then key has been found
+ return (i != rules);
+}
+
+TBool CMMAParameterRuleSet::FindProperty(const TDesC& aKey, TInt& aValue)
+{
+ LOOPUNTILRULE(!iRules->At(i)->FindProperty(aKey, aValue));
+ // if loop has ended before end then key has been found
+ return (i != rules);
+}
+
+void CMMAParameterRuleSet::AppendRuleL(MMMAParameterRule* aRule)
+{
+ iRules->AppendL(aRule);
+}
+
+TMMAParameterRuleBase::TMMAParameterRuleBase(const TDesC& aKey) :
+ iKey(aKey),
+ iAssigned(EFalse)
+{}
+
+TBool TMMAParameterRuleBase::ValidateAndStoreL(const TDesC& aKey, const TDesC& aValue)
+{
+ if ((aKey.Length() == 0) ||
+ (aValue.Length() == 0))
+ {
+ // key or value length is zero, fail
+ User::Leave(KErrArgument);
+ }
+
+ TBool isValid = ETrue;
+ // this is same key as in rule
+ if (iKey.Compare(aKey) == 0)
+ {
+ //if this key is already assigned then there is same key more than once
+ if (iAssigned)
+ {
+ User::Leave(KErrArgument);
+ }
+ isValid = ValidateValueL(aValue);
+
+ // if it was valid we mark this key as assigned
+ if (isValid)
+ {
+ iAssigned = ETrue;
+ }
+ }
+ return isValid;
+}
+
+TBool TMMAParameterRuleBase::Compare(const TDesC& /*aKey*/, const TDesC& /*aValue*/)
+{
+ // by default we do not found this key
+ return EFalse;
+}
+
+TBool TMMAParameterRuleBase::Compare(const TDesC& /*aKey*/, const TInt /*aValue*/)
+{
+ // by default we do not found this key
+ return EFalse;
+}
+
+TBool TMMAParameterRuleBase::FindProperty(const TDesC& /*aKey*/, TPtrC& /*aValue*/)
+{
+ // by default we do not found this key
+ return EFalse;
+}
+
+TBool TMMAParameterRuleBase::FindProperty(const TDesC& /*aKey*/, TInt& /*aValue*/)
+{
+ // by default we do not found this key
+ return EFalse;
+}
+
+TMMAParameterRuleInt::TMMAParameterRuleInt(const TDesC& aKey) :
+ TMMAParameterRuleBase(aKey),
+ iUpperLimit(KMaxTInt),
+ iLowerLimit(KMinTInt)
+{}
+
+TMMAParameterRuleInt::TMMAParameterRuleInt(const TDesC& aKey,
+ const TInt aLowerLimit) :
+ TMMAParameterRuleBase(aKey),
+ iUpperLimit(KMaxTInt),
+ iLowerLimit(aLowerLimit)
+{}
+
+TMMAParameterRuleInt::TMMAParameterRuleInt(const TDesC& aKey,
+ const TInt aLowerLimit,
+ const TInt aUpperLimit) :
+ TMMAParameterRuleBase(aKey),
+ iUpperLimit(aUpperLimit),
+ iLowerLimit(aLowerLimit)
+{}
+
+TBool TMMAParameterRuleInt::ValidateValueL(const TDesC& aValue)
+{
+ TLex lex(aValue);
+ TInt valueInt = 0;
+ if ((lex.Val(valueInt) != KErrNone) ||
+ !lex.Eos())
+ {
+ User::Leave(KErrArgument);
+ }
+ if ((valueInt < iLowerLimit) ||
+ (valueInt > iUpperLimit))
+ {
+ // value is not valid
+ return EFalse;
+ }
+ else
+ {
+ // value is valid, store it
+ iValue = valueInt;
+ return ETrue;
+ }
+}
+
+TBool TMMAParameterRuleInt::Compare(const TDesC& aKey, const TInt aValue)
+{
+ TBool match = EFalse;
+ if (iAssigned &&
+ (iKey.Compare(aKey) == 0) &&
+ (aValue == iValue))
+ {
+ match = ETrue;
+ }
+ return match;
+}
+
+TBool TMMAParameterRuleInt::FindProperty(const TDesC& aKey, TInt& aValue)
+{
+ TBool match = EFalse;
+ if (iAssigned &&
+ iKey.Compare(aKey) == 0)
+ {
+ aValue = iValue;
+ match = ETrue;
+ }
+ return match;
+}
+
+TMMAParameterRuleDes::TMMAParameterRuleDes(const TDesC& aKey) :
+ TMMAParameterRuleBase(aKey),
+ iValidValues(NULL),
+ iArraySize(0)
+{}
+
+TMMAParameterRuleDes::TMMAParameterRuleDes(const TDesC& aKey,
+ const TMMAStaticStrArray* aValidValues,
+ const TInt aArraySize) :
+ TMMAParameterRuleBase(aKey),
+ iValidValues(aValidValues),
+ iArraySize(aArraySize)
+{}
+
+TBool TMMAParameterRuleDes::ValidateValueL(const TDesC& aValue)
+{
+ TInt i = 0;
+ while ((i < iArraySize) &&
+ aValue.Compare(iValidValues[i]()) != 0)
+ {
+ i++;
+ }
+ // if there is not valid values then we treat every value as valid
+ if (iValidValues &&
+ (i == iArraySize))
+ {
+ // there was no hit
+ return EFalse;
+ }
+
+ // find match or every value is valid, storing
+ iValue.Set(aValue);
+ return ETrue;
+}
+
+TBool TMMAParameterRuleDes::Compare(const TDesC& aKey, const TDesC& aValue)
+{
+ TBool match = EFalse;
+ if (iAssigned &&
+ (iKey.Compare(aKey) == 0) &&
+ (iValue.Compare(aValue) == 0))
+ {
+ match = ETrue;
+ }
+ return match;
+}
+
+TBool TMMAParameterRuleDes::FindProperty(const TDesC& aKey, TPtrC& aValue)
+{
+ TBool match = EFalse;
+ if (iAssigned &&
+ iKey.Compare(aKey) == 0)
+ {
+ aValue.Set(iValue);
+ match = ETrue;
+ }
+ return match;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmaratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements generic RateControl functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+
+#include "cmmaratecontrol.h"
+
+CMMARateControl::CMMARateControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARateControl::CMMARateControl");
+}
+
+CMMARateControl::~CMMARateControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARateControl::~CMMARateControl");
+}
+
+const TDesC& CMMARateControl::ClassName() const
+{
+ return KMMARateControlName;
+}
+
+TInt CMMARateControl::MaxRateL()
+{
+ return KMMADefaultRate;
+}
+
+TInt CMMARateControl::MinRateL()
+{
+ return KMMAMinRate;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmarecordcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a RecordControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include "cmmarecordcontrol.h"
+#include "cmmaplayer.h"
+
+
+_LIT(KControlName, "RecordControl");
+
+CMMARecordControl::CMMARecordControl(CMMAPlayer* aPlayer):
+ iState(ERecordUninitialized),
+ iPlayer(aPlayer),
+ iStartTime(0)
+{
+}
+
+
+CMMARecordControl::~CMMARecordControl()
+{
+ iRecordPauseTimer.Cancel();
+ iRecordPauseTimer.Close();
+
+ if (iPlayer)
+ {
+ iPlayer->RemoveStateListener(this);
+ }
+
+ delete iOutputStream;
+
+ iFile.Close();
+ iFs.Delete(iFilename);
+ iFs.Close();
+}
+
+void CMMARecordControl::WaitForPauseL(const TInt64& aMediaTime)
+{
+ // reusing time variable
+ TInt64 time = iStartTime - aMediaTime + KMinRecordPauseInterval;
+ iStartTime = 0;
+ LOG1( EJavaMMAPI, EInfo, "CMMARecordControl::WaitForPauseL wait time = %d", (TInt)time);
+ // if time > 0, time between record and pause is smaller than
+ // KMinRecordPauseInterval and we have to wait.
+ if (time > 0)
+ {
+ TRequestStatus status;
+ iRecordPauseTimer.Cancel();
+ iRecordPauseTimer.After(status, I64INT(time));
+ User::WaitForRequest(status);
+ // Status ignored because recording must be stopped.
+ }
+}
+
+void CMMARecordControl::ConstructL()
+{
+ User::LeaveIfError(iRecordPauseTimer.CreateLocal());
+
+ User::LeaveIfError(iFs.Connect());
+
+ // create temporary file for recording
+ User::LeaveIfError(iFile.Temp(iFs,
+ KMMARecordTempDirectory,
+ iFilename,
+ EFileRead | EFileWrite | EFileShareAny));
+
+ iPlayer->AddStateListenerL(this);
+}
+
+void CMMARecordControl::StartRecordL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::StartRecordL+");
+
+ // Initialize needs to be done only once after setRecordLocation or
+ // setRecordStream and before commit or reset. Although startRecord can be
+ // called several times in the process, the initialization must happen
+ // only in the first call to startRecord
+ if (iState == ERecordUninitialized)
+ {
+ InitializeL();
+ }
+
+ iState = ERecordStandBy;
+ // calling next state if player is already started
+ NextStateL(iPlayer->State());
+
+ iPlayer->GetMediaTime(&iStartTime);
+ iPlayer->PostLongEvent(CMMAPlayerEvent::ERecordStarted, iStartTime);
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::StartRecordL-");
+}
+
+
+void CMMARecordControl::StopRecordL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::StopRecordL+");
+ if (iState == ERecordRecording)
+ {
+ NextStateL(iPlayer->State());
+ }
+
+ iState = ERecordInitialized;
+
+ // ask mediatime again for more accurate value
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+ iPlayer->PostLongEvent(CMMAPlayerEvent::ERecordStopped, time);
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::StopRecordL-");
+}
+
+
+void CMMARecordControl::CommitL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::CommitL+");
+ // reset the recorder if already initialized
+ if (iState > ERecordUninitialized)
+ {
+ DoResetL();
+ }
+ else
+ {
+ // not even initialized yet, just inform java
+ iOutputStream->WriteL(KNullDesC8);
+ return;
+ }
+ iState = ERecordUninitialized;
+
+ // Create buffer for file context
+ TInt fileSize;
+ User::LeaveIfError(iFile.Size(fileSize));
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::CommitL size in bytes = %d", fileSize);
+
+ HBufC8* data = HBufC8::NewLC(fileSize);
+
+ // Read file context
+ TPtr8 dataPtr = data->Des();
+ TInt pos(0);
+ User::LeaveIfError(iFile.Seek(ESeekStart, pos));
+ User::LeaveIfError(iFile.Read(dataPtr));
+ User::LeaveIfError(iFile.SetSize(0));
+ User::LeaveIfError(iFile.Flush());
+
+ // Write whole video data to stream
+ iOutputStream->WriteL(dataPtr);
+ CleanupStack::PopAndDestroy(data);
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::CommitL-");
+}
+
+
+void CMMARecordControl::ResetL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::ResetL+");
+ // reset the recorder if already initialized
+ if (iState > ERecordUninitialized)
+ {
+ DoResetL();
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::DoResetL done");
+ iState = ERecordUninitialized;
+
+ // Empty file that it can be reused
+ User::LeaveIfError(iFile.SetSize(0));
+ User::LeaveIfError(iFile.Flush());
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::ResetL-");
+}
+
+void CMMARecordControl::SetRecordStream(CMMAOutputStream* aStream)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::SetRecordStream");
+ __ASSERT_DEBUG(aStream, User::Panic(
+ _L("CMMAVideoRecordControl:: Stream is NULL."),
+ KErrArgument));
+ delete iOutputStream;
+ iOutputStream = aStream;
+}
+
+
+HBufC* CMMARecordControl::GetContentTypeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::GetContentTypeL");
+ return iPlayer->ContentType();
+}
+
+const TDesC& CMMARecordControl::ClassName() const
+{
+ return KControlName;
+}
+
+void CMMARecordControl::StateChanged(TInt aState)
+{
+ TRAPD(err, NextStateL(aState));
+ if (err)
+ {
+ Error(err);
+ }
+}
+
+void CMMARecordControl::Error(TInt aErrorCode)
+{
+ ELOG1( EJavaMMAPI, "MMA:CMMARecordControl::Error %d", aErrorCode);
+ TBuf<KRecordErrorMessageSize> errorMessage;
+ errorMessage.Format(KMMARecordErrorMsg, aErrorCode);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::ERecordError,
+ errorMessage);
+}
+
+void CMMARecordControl::HandleRecordSizeLimit()
+{
+ // commit the stream
+ iOutputStream->Commit();
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+ iPlayer->PostLongEvent(CMMAPlayerEvent::ERecordStopped, time);
+}
+
+void CMMARecordControl::NextStateL(TInt aPlayerState)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL Player state = %d", aPlayerState);
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL internal state = %d", iState);
+ switch (iState)
+ {
+ case ERecordUninitialized:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: case ERecordUninitialized");
+ // This is the initial state.
+ // To getinto this state, commit or reset must be called
+ // To get out of this state startRecord must be called
+
+ break;
+ }
+ case ERecordInitialized:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: case ERecordInitialized");
+ // To get into this state stopRecord must be called.
+ // To get out of this state startRecord, commit or reset must be
+ // called
+ break;
+ }
+ case ERecordStandBy:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: case ERecordStandBy");
+ // To get into this state startRecord must be called.
+ // To get out of this state stopRecord, commit or reset must be
+ // called, or state of the Player must change to STARTED
+
+
+ // start the actual recording if player is started
+ if (aPlayerState == CMMAPlayer::EStarted)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: ERecordStandBy -> ERecordRecording");
+ DoStartRecordL();
+ iState = ERecordRecording;
+ }
+ break;
+ }
+ case ERecordRecording:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: case ERecordRecording");
+
+ // To get into this state startRecord must have been called and
+ // the Player must be in STARTED state.
+ // To get out of this state, stopRecord, commit or reset must be
+ // called or the Player must change to a state other than STARTED
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+ WaitForPauseL(time);
+ DoStopRecordL();
+ iState = ERecordStandBy;
+ break;
+ }
+ default:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMARecordControl::NextStateL: case default - code should not reach here!!");
+ __ASSERT_DEBUG(KErrGeneral, User::Invariant()); // This will newer occur
+ break;
+ }
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmasnapshot.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class takes snapshot and resizes bitmap if needed.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmasnapshot.h"
+#include "mmmaguiplayer.h"
+#include "mmmasnapshotreadycallback.h"
+#include "mmmasnapshot.h"
+
+// CONSTANTS
+const TInt KIgnoreSize = -1;
+
+
+// CONSTRUCTION
+CMMASnapshot* CMMASnapshot::NewL(MMMAGuiPlayer* aGuiPlayer,
+ MMMASnapshotReadyCallback& aCallBack)
+{
+ CMMASnapshot* self = new(ELeave) CMMASnapshot(aGuiPlayer,
+ aCallBack);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ return self;
+}
+
+CMMASnapshot::~CMMASnapshot()
+{
+ if (iScaler)
+ {
+ iScaler->Cancel();
+ delete iScaler;
+ }
+ if (iEncoder)
+ {
+ iEncoder->Cancel();
+ delete iEncoder;
+ }
+ delete iBitmap;
+ delete iBuffer;
+ delete iSettings;
+}
+
+void CMMASnapshot::ConstructL()
+{
+ CActiveScheduler::Add(this);
+ iScaler = CBitmapScaler::NewL();
+}
+
+CMMASnapshot::CMMASnapshot(MMMAGuiPlayer* aGuiPlayer,
+ MMMASnapshotReadyCallback& aCallBack):
+ CActive(EPriorityStandard),
+ iEncoding(MMMASnapshot::EBitmap),
+ iCallBack(aCallBack),
+ iState(EIdle)
+{
+ iGUIPlayer = aGuiPlayer;
+}
+
+void CMMASnapshot::TakeSnapShotL(const TDesC& aProperties)
+{
+ // snapshot sequence is not finished
+ __ASSERT_DEBUG(iState == EIdle, User::Invariant());
+ // image buffer must be taken with ImageBuffer before taking new snapshot
+ __ASSERT_DEBUG(iBuffer == NULL, User::Invariant());
+
+ CMMAImageSettings* settings
+ = TMMAParameterValidator::ValidateImagePropertiesL(aProperties);
+ CleanupStack::PushL(settings);
+
+ delete iSettings;
+ CleanupStack::Pop(settings);
+ iSettings = settings;
+
+ // take snapshot from player. RunL is called when image is ready
+ // or error occures
+ iState = ETakingSnapshot;
+ TSize snapshotSize(iSettings->iWidth, iSettings->iHeight);
+ iEncoding = iGUIPlayer->SnapshoterL()->TakeSnapshotL(&iStatus,
+ snapshotSize,
+ *iSettings);
+ SetActive();
+}
+
+HBufC8* CMMASnapshot::ImageBuffer()
+{
+ // this must not be called when snapshot sequence is running
+ __ASSERT_DEBUG(iState == EIdle, User::Invariant());
+ HBufC8* buffer = iBuffer;
+ // caller takes ownership of the buffer
+ iBuffer = NULL;
+ return buffer;
+}
+
+void CMMASnapshot::ResizeL()
+{
+ iState = EResizing;
+ TSize imageSize(iBitmap->SizeInPixels());
+ if (iSettings->iWidth != KIgnoreSize)
+ {
+ imageSize.iWidth = iSettings->iWidth;
+ }
+ if (iSettings->iHeight != KIgnoreSize)
+ {
+ imageSize.iHeight = iSettings->iHeight;
+ }
+ if (imageSize == iBitmap->SizeInPixels())
+ {
+ // no user resizing needed, continue sequence
+ EncodeL();
+ }
+ else
+ {
+ iScaler->Scale(&iStatus, *iBitmap, imageSize, EFalse);
+ SetActive();
+ }
+}
+
+void CMMASnapshot::EncodeL()
+{
+ // CImageEncoder cannot be reused, so have to make it every time
+ CImageEncoder* encoder = CImageEncoder::DataNewL(iBuffer, *iSettings->iMimeType);
+ delete iEncoder;
+ iEncoder = encoder;
+
+ iState = EEncoding;
+ iEncoder->Convert(&iStatus, *iBitmap, iSettings->iImageData);
+ SetActive();
+}
+
+void CMMASnapshot::Completed(TInt aError)
+{
+ iStatus = aError;
+ iCallBack.SnapshotReady();
+}
+
+void CMMASnapshot::RunL()
+{
+ if (iStatus != KErrNone)
+ {
+ // Error has occured, inform java side and change state
+ iState = EIdle;
+ Completed(iStatus.Int());
+ return;
+ }
+
+ switch (iState)
+ {
+ case ETakingSnapshot:
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMASnapshot::RunL: iEncoding = %d", iEncoding);
+ if (iEncoding == MMMASnapshot::EEncoded)
+ {
+ // take encoded image from player.
+ // Ownership transfers to this class.
+ iBuffer = iGUIPlayer->SnapshoterL()->SnapshotEncoded();
+ if (!iBuffer)
+ {
+ // error has occured with taking image
+ Completed(KErrNotFound);
+ }
+ // Image is ready, update internal state and inform listener
+ // Encoded images are not resized
+ iState = EIdle;
+ Completed(KErrNone);
+ }
+ else
+ {
+ // take bitmap from player.
+ // Ownership transfers to this class.
+ iBitmap = iGUIPlayer->SnapshoterL()->SnapshotBitmap();
+ if (!iBitmap)
+ {
+ // error has occured with taking image
+ Completed(KErrNotFound);
+ }
+ // Continue to next state
+ ResizeL();
+ }
+ break;
+ }
+ case EResizing:
+ {
+ // Continue to next state
+ EncodeL();
+ break;
+ }
+ case EEncoding:
+ {
+ delete iEncoder;
+ iEncoder = NULL;
+
+ delete iBitmap;
+ iBitmap = NULL;
+ iState = EIdle;
+ // encoding is ready, inform listener
+ Completed(KErrNone);
+ break;
+ }
+ default:
+ {
+ // unknown state
+ __ASSERT_DEBUG(EFalse, User::Invariant());
+ }
+ }
+}
+
+TInt CMMASnapshot::RunError(TInt aError)
+{
+ // Reset state
+ iState = EIdle;
+ // Pass error code to observer
+ Completed(aError);
+
+ return KErrNone;
+}
+
+void CMMASnapshot::DoCancel()
+{
+ // snapshot taking cannot be cancelled
+ if (iScaler)
+ {
+ iScaler->Cancel();
+ }
+ if (iEncoder)
+ {
+ iEncoder->Cancel();
+ }
+ iState = EIdle;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmasnapshotevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmasnapshotevent.h"
+#include "mmapiutils.h"
+
+CMMASnapshotEvent::CMMASnapshotEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TInt aError,
+ HBufC8* aImageBuffer,
+ TDisposability aDisposable):
+ CMMAEvent(aNotifyObject,
+ aHandleEventMethod,
+ aDisposable)
+{
+ iEventData = aError;
+ iImageBuffer = aImageBuffer;
+}
+
+CMMASnapshotEvent::~CMMASnapshotEvent()
+{
+ // image buffer need to be deleted if
+ // event server hasn't sent this event before
+ // middlet is destroyed
+ delete iImageBuffer;
+}
+
+void CMMASnapshotEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMASnapshotEvent::Dispatch");
+
+ // create java byte array
+ jbyteArray byteArray;
+ if (iImageBuffer)
+ {
+ byteArray = aJni.NewByteArray(iImageBuffer->Size());
+ if (byteArray)
+ {
+ MMAPIUtils::CopyToJava(aJni,
+ *iImageBuffer,
+ byteArray,
+ 0,
+ iImageBuffer->Size());
+ }
+ }
+ else
+ {
+ byteArray = aJni.NewByteArray(0);
+ }
+
+ if (!byteArray)
+ {
+ delete iImageBuffer;
+ iImageBuffer = NULL; // otherwise double delete in destructor
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMASnapshotEvent::Dispatch - Failed to create ByteArray");
+ return;
+ }
+
+
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventData,
+ byteArray);
+
+ delete iImageBuffer;
+ iImageBuffer = NULL; // otherwise double delete in destructor
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmasourcestream.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class for reading data from Java SourceStream to native side
+*
+*/
+
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+#include "mmafunctionserver.h"
+#include "cmmasourcestream.h"
+#include "cmmasourcestreamevent.h"
+#include "mmmasourcestreamlistener.h"
+
+const TInt KBufferSize = 4096; // data is read from java in 4k pieces
+
+// CONSTRUCTION
+CMMASourceStream* CMMASourceStream::NewL(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener
+ )
+{
+ CMMASourceStream* self = CMMASourceStream::NewLC(aJNIEnv,
+ aEventPoster,
+ aJavaSourceStream,
+ aListener);
+ CleanupStack::Pop();
+ return self;
+}
+
+
+CMMASourceStream* CMMASourceStream::NewLC(JNIEnv* aJNIEnv,
+ MMMAEventPoster* aEventPoster,
+ jobject aJavaSourceStream,
+ MMMASourceStreamListener* aListener
+ )
+{
+ CMMASourceStream* self = new(ELeave) CMMASourceStream(aEventPoster,
+ aListener);
+ CleanupStack::PushL(self);
+ self->ConstructL(aJNIEnv, aJavaSourceStream);
+ return self;
+}
+
+
+CMMASourceStream::~CMMASourceStream()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMASourceStream::~");
+ delete iData;
+ delete iReadEvent;
+}
+
+
+// Default constructor
+CMMASourceStream::CMMASourceStream(MMMAEventPoster* aEventPoster,
+ MMMASourceStreamListener* aListener)
+ : iEventPoster(aEventPoster), iListener(aListener)
+{
+}
+
+
+void CMMASourceStream::ConstructL(JNIEnv* aJNIEnv,
+ jobject aJavaSourceStream)
+{
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJNIEnv = iEventPoster->getValidJniEnv();
+ jmethodID classMethodID =
+ aJNIEnv->GetMethodID(aJNIEnv->GetObjectClass(aJavaSourceStream),
+ "read",
+ "(II)V");
+ if (!classMethodID)
+ {
+ User::Leave(KErrNoMemory);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMASourceStream::ConstructL , jmethodId found");
+ jobject apeer = aJNIEnv->NewGlobalRef(aJavaSourceStream);
+ iReadEvent = new(ELeave) CMMASourceStreamEvent(classMethodID,
+ apeer);
+}
+
+
+void CMMASourceStream::WriteL(const TUint8* aData,
+ TInt aLength,
+ TInt aState)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMASourceStream::WriteL() %d",aState);
+ if (aState < KErrNone)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMASourceStream::WriteL : 1");
+ // Inform listener on error case
+ iListener->ReadCompletedL(aState, KNullDesC8());
+ return;
+ }
+
+
+ if ((iData->Size() + aLength) > iData->Des().MaxSize())
+ {
+ // if data doesn't fit, reallocate more
+ HBufC8* reallocated = iData->ReAlloc(iData->Des().MaxSize() + KBufferSize);
+ if (!reallocated) // realloc failed
+ {
+ // probably too much data read, so freeing used memory
+ delete iData;
+ iData = NULL;
+ iListener->ReadCompletedL(KErrNoMemory, KNullDesC8());
+ return;
+ }
+ iData = reallocated;
+ }
+
+ // java returns length -1 when completed
+ if (aLength > 0)
+ {
+ iData->Des().Append(aData, aLength);
+ }
+
+ TInt currentRead = iData->Size() - iBufferPosition;
+
+ if ((aState == ECompleted) ||
+ (currentRead == iReadLength))
+ {
+ if (iReadLength == KMMAReadAllData)
+ {
+ iListener->ReadCompletedL(aState, *iData);
+ }
+ else
+ {
+ TPtrC8 data = iData->Mid(iBufferPosition, currentRead);
+ iListener->ReadCompletedL(aState, data);
+ }
+ }
+ else
+ {
+ // phase ready, inform the Player
+ if (iReadLength == KMMAReadAllData)
+ {
+ iReadEvent->SetLength(KBufferSize);
+ }
+ else
+ {
+ iReadEvent->SetLength(iReadLength - currentRead);
+ }
+
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMASourceStream::WriteL completed");
+}
+
+void CMMASourceStream::ReadL(TInt aLength)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMASourceStream::ReadL(%d)", aLength);
+
+ __ASSERT_DEBUG(iData != NULL, User::Invariant());
+
+ PrepareReadL();
+
+ iBufferPosition = iData->Size();
+ iReadLength = aLength;
+
+ iReadEvent->SetLength(aLength);
+
+ // data has been requested, note will be sent
+ iEventPoster->PostEvent(iReadEvent, CMMAEvent::ENotifyPriority);
+}
+
+
+void CMMASourceStream::ReadAllL()
+{
+ // not reading again if iData already has data
+ if (iData == NULL)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMASourceStream::ReadAllL: Buffer empty, reading from java");
+ CreateDataBufferL(KBufferSize);
+ ReadL(KMMAReadAllData);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMASourceStream::ReadAllL: Buffer not empty, ->ReadCompleteL");
+ iListener->ReadCompletedL(ECompleted, *iData);
+ }
+}
+
+void CMMASourceStream::PrepareReadL()
+{
+}
+
+void CMMASourceStream::ResetData()
+{
+ delete iData;
+ iData = NULL;
+}
+
+void CMMASourceStream::CreateDataBufferL(TInt aBufferSize)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMASourceStream::CreateDataBufferL +");
+ __ASSERT_DEBUG(iData == NULL, User::Invariant());
+
+ iData = HBufC8::NewL(aBufferSize);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmasourcestreamevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+#include <logger.h>
+
+#include "cmmasourcestreamevent.h"
+
+
+CMMASourceStreamEvent::CMMASourceStreamEvent(
+ jmethodID aHandleEventMethod,
+ jobject aNotifyObject):
+ CMMAEvent(EReusableEvent),
+ iHandleEventMethod(aHandleEventMethod),
+ iListenerObject(aNotifyObject)
+{
+}
+
+
+void CMMASourceStreamEvent::SetLength(TInt aLength)
+{
+ iLength = aLength;
+}
+
+
+
+void CMMASourceStreamEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMASourceStreamEvent:Dispatch len=%d", iLength);
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iLength);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmastoptimecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for stoptime controlling
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32std.h>
+
+#include "cmmastoptimecontrol.h"
+#include "cmmaplayer.h"
+
+
+_LIT(KControlName, "StopTimeControl");
+
+_LIT(KMMAStopTimeControlError, "StopTimeControl Symbian OS error: %d");
+const TInt KMMAStopTimeControlErrorLength = 50;
+
+CMMAStopTimeControl::CStopTimer* CMMAStopTimeControl::CStopTimer::NewL(
+ CMMAStopTimeControl* aControl)
+{
+ CStopTimer* self = new(ELeave) CStopTimer(aControl);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+
+CMMAStopTimeControl::CStopTimer::CStopTimer(CMMAStopTimeControl* aControl)
+ : CTimer(CActive::EPriorityStandard)
+{
+ iControl = aControl;
+}
+
+
+void CMMAStopTimeControl::CStopTimer::ConstructL()
+{
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+}
+
+
+void CMMAStopTimeControl::CStopTimer::RunL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl:CStopTimer:RunL timer triggered");
+ iControl->StopAtTimeL();
+}
+
+const TDesC& CMMAStopTimeControl::ClassName() const
+{
+ return KControlName;
+}
+
+
+CMMAStopTimeControl* CMMAStopTimeControl::NewL(CMMAPlayer* aPlayer)
+{
+ CMMAStopTimeControl* control =
+ new(ELeave) CMMAStopTimeControl(aPlayer);
+ CleanupStack::PushL(control);
+ control->ConstructL();
+ CleanupStack::Pop(); // control
+ return control;
+}
+
+
+CMMAStopTimeControl::~CMMAStopTimeControl()
+{
+ delete iTimer;
+}
+
+
+CMMAStopTimeControl::CMMAStopTimeControl(CMMAPlayer* aPlayer)
+ : iPlayer(aPlayer), iNoTimer((MAKE_TINT64(KMaxTInt, KMaxTUint)))
+{
+ iStopTime = iNoTimer;
+}
+
+
+void CMMAStopTimeControl::ConstructL()
+{
+ iTimer = CStopTimer::NewL(this);
+ iPlayer->AddStateListenerL(this);
+}
+
+
+void CMMAStopTimeControl::StaticGetStopTime(CMMAStopTimeControl* aControl,
+ TInt64* aTime)
+{
+ aControl->GetStopTime(*aTime);
+}
+
+
+void CMMAStopTimeControl::StaticSetStopTimeL(CMMAStopTimeControl* aControl,
+ TInt64* aTime)
+{
+ aControl->SetStopTimeL(*aTime);
+}
+
+
+void CMMAStopTimeControl::StopAtTimeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl::StopAtTime");
+
+ // Stop the player only when it's playing
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+ if (time >= 0 && time < iStopTime)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl::StopAtTime - Called %dms too early",
+ I64INT((time - iStopTime)/1000));
+ StartTimer(time);
+ return;
+ }
+
+ TInt64 stopTime;
+
+ // MediaTime is known
+ if (time >= 0)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl::StopAtTime - called %dms late", I64INT((time - iStopTime)/1000));
+ stopTime = time;
+ }
+ else
+ {
+ // Use the requested time
+ stopTime = iStopTime;
+ }
+
+ iPlayer->StopL(EFalse);
+
+ // Inform the player that it's "stopped at time"
+ iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, stopTime);
+
+ iStopTime = iNoTimer; // Timer is reseted
+ }
+}
+
+
+/**
+ * Get stop time, in microseconds
+ */
+void CMMAStopTimeControl::GetStopTime(TInt64& aTime)
+{
+ aTime = iStopTime;
+}
+
+
+/**
+ * Set stop time, in microseconds
+ * @param aTime is iNoTimer if the timer should be reseted
+ */
+void CMMAStopTimeControl::SetStopTimeL(const TInt64& aTime)
+{
+ iStopTime = aTime;
+
+ if (aTime != iNoTimer)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl:SetStopTime(%dms)",
+ I64INT(aTime / 1000));
+
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ TInt64 currentTime(0);
+ iPlayer->GetMediaTime(¤tTime);
+
+ StartTimer(currentTime);
+ }
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl:SetStopTime(RESET)");
+
+ iTimer->Cancel();
+ }
+}
+
+
+/*
+ * Start timer
+ * @param aCurrentTime current position of the player
+ */
+void CMMAStopTimeControl::StartTimer(const TInt64& aCurrentTime)
+{
+ // StopTime is defined
+ TInt64 time = iStopTime - aCurrentTime;
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAStopTimeControl:StartTimer timer started; time=%dms",
+ I64INT(time / 1000));
+ iTimer->Cancel();
+
+ if (time >= 0)
+ {
+ // Value is too large to represent with TInt
+ // use the biggest possible value instead
+ if (I64HIGH(time) != 0 || I64INT(time) < 0)
+ {
+ time = KMaxTInt;
+ }
+
+ iTimer->After(TTimeIntervalMicroSeconds32(I64INT(time)));
+ }
+ else
+ {
+ // Stop the player immediatelly
+ TRAPD(err, StopAtTimeL());
+ if (err != KErrNone)
+ {
+ TBuf< KMMAStopTimeControlErrorLength > errorMsg;
+ errorMsg.Format(KMMAStopTimeControlError, err);
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError,
+ errorMsg);
+ }
+ }
+}
+
+
+void CMMAStopTimeControl::StateChanged(TInt aState)
+{
+ switch ((CMMAPlayer::TPlayerState) aState)
+ {
+ case CMMAPlayer::EStarted:
+ {
+ if (iStopTime != iNoTimer)
+ {
+ // (Re)start the timer
+ TInt64 time;
+ iPlayer->GetMediaTime(&time);
+
+ StartTimer(time);
+ }
+ break;
+ }
+ case CMMAPlayer::ERealized:
+ case CMMAPlayer::EPrefetched:
+ case CMMAPlayer::EClosed:
+ {
+ // Player is not running anymore
+ iTimer->Cancel();
+ break;
+ }
+ default:
+ {
+ // other states are ignored
+ }
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a VideoControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+//#include <lcdui.h>
+
+#include <JniEnvWrapper.h>
+
+#include "com_nokia_microedition_media_control_VideoControl.h"
+
+#include "cmmavideocontrol.h"
+#include "cmmacameraplayer.h"
+#include "mmmaeventposter.h"
+#include "cmmacanvasdisplay.h"
+#include "cmmaitemdisplay.h"
+#include "cmmasnapshotevent.h"
+#include "mmmaguiplayer.h"
+#include "cmmasnapshot.h"
+#include "mmmadisplaywindow.h"
+#include "cmmaplayerproperties.h"
+#include "cmmadcdisplay.h"
+#include "cmmavideocontrol.h"
+
+_LIT(KControlName, "VideoControl");
+
+EXPORT_C CMMAVideoControl::CMMAVideoControl(MMMAGuiPlayer* aGuiPlayer):
+ CMMAControl()
+{
+ iGuiPlayer = aGuiPlayer;
+ iIsForeground = 1;
+
+ iDisplay = 0;
+}
+
+EXPORT_C CMMAVideoControl::~CMMAVideoControl()
+{
+ delete iDisplay;
+
+ // Event server takes event ownership
+ if (iEventPoster)
+ {
+ if(iDeleteRefEvent)
+ {
+ iEventPoster->PostEvent(iDeleteRefEvent);
+ }
+ }
+ if (iSnapshot)
+ {
+ iSnapshot->Cancel();
+ delete iSnapshot;
+ }
+}
+
+
+void CMMAVideoControl::ConstructL(CMMAVideoControl* aControl,
+ jobject aControlObject,
+ MMAFunctionServer* aEventSource,
+ JNIEnv* aJni,
+ MMMAEventPoster* aEventPoster/*,
+ CMIDToolkit* aToolkit*/) // mobitv fix // 3.x QT based UI
+{
+
+
+
+
+
+ aControl->iListenerObject = aControlObject;
+ aControl->iJni = aEventSource->getValidJniEnv();
+ aControl->iEventPoster = aEventPoster;
+
+ // snapshot ready method. Created here because jni cannot be used later.
+ aControl->iSnapshotReadyMethod = aJni->GetMethodID(
+ aJni->GetObjectClass(aControlObject),
+ "snapshotReady",
+ "(I[B)V");
+
+ aControl->iSnapshot = CMMASnapshot::NewL(aControl->iGuiPlayer,
+ *aControl);
+ // aControl->RegisterForegroundListenerL(aToolkit); // 3.x QT based UI
+}
+/* // 3.x QT based UI
+// mobitv fix`
+void CMMAVideoControl::RegisterForegroundListenerL(CMIDToolkit* aToolkit)
+{
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListener + ");
+
+ // Initialize IsForeground to true, we might have already missed the event (HandleForegroundL), events before observer registration
+ iIsForeground = ETrue;
+
+
+ iToolkit = aToolkit;
+
+ if (iToolkit)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL : iToolkit->Env(); +");
+ iMidEnv = iToolkit->Env();
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL : iToolkit->Env(); -");
+ }
+
+ if (iMidEnv)
+ {
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL : iMidEnv->AddObserverL + ");
+ // register for getting the foreground change event
+ iMidEnv->AddObserverL(*this);
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL : iMidEnv->AddObserverL - ");
+ }
+
+ LOG(EJavaMMAPI,EInfo,"CMMAVideoControl::RegisterForegroundListenerL - ");
+}
+*/
+void CMMAVideoControl::StaticInitL(CMMAVideoControl* aControl,
+ jobject javaDisplayRef,
+ MMAFunctionServer* aEventSource,
+ TInt* aDisplayHandle,
+ CMMAEvent* aDeleteRefEvent)
+{
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL +");
+
+ aControl->iDeleteRefEvent = aDeleteRefEvent;
+
+ CMMACanvasDisplay* canvasDisplay =
+ CMMACanvasDisplay::NewLC(aEventSource,javaDisplayRef);
+ aControl->iDisplay = canvasDisplay;
+ CleanupStack::Pop(canvasDisplay);
+ *aDisplayHandle = reinterpret_cast<TInt>(canvasDisplay);
+
+
+/* MMIDComponent::TType componentType = aComponent->Type();
+ switch (componentType)
+ {
+ case MMIDComponent::ECustomItem:
+ {
+ //MMIDCustomItem // end of // 3.x QT based UI
+ // MMIDCustomItem* customItem =
+ // reinterpret_cast< MMIDCustomItem* >(aComponent);
+
+ CMMAItemDisplay* itemDisplay =
+ CMMAItemDisplay::NewLC(customItem);
+
+ aControl->iDisplay = itemDisplay;
+ CleanupStack::Pop(itemDisplay);
+ *aDisplayHandle = JavaMakeHandle(itemDisplay);
+ break;
+ }
+ case MMIDComponent::ECanvas:
+ {
+ //MMIDCanvas
+ MMIDCanvas* canvas = reinterpret_cast< MMIDCanvas* >(aComponent);
+
+ CMMACanvasDisplay* canvasDisplay =
+ CMMACanvasDisplay::NewLC(canvas);
+
+ aControl->iDisplay = canvasDisplay;
+ CleanupStack::Pop(canvasDisplay);
+ *aDisplayHandle = JavaMakeHandle(canvasDisplay);
+ break;
+ }
+ default:
+ {
+ // other component types are not supported
+ User::Leave(KErrNotSupported);
+ }
+
+ }*/
+
+ aControl->iGuiPlayer->SetDisplayL(aControl->iDisplay);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitL - ");
+}
+
+
+void CMMAVideoControl::SetDisplayHandleToJavaPeer(MMAFunctionServer* eventSource ,jobject aJavaVideoControlPeer)
+{
+ JNIEnv* validJNI = eventSource->getValidJniEnv();
+
+ jmethodID jmid = validJNI->GetMethodID( validJNI->GetObjectClass(aJavaVideoControlPeer),
+ "setNativeDisplayHandleToJavaPeer",
+ "(I)V");
+ // DEBUG_INT("CMMADisplay::GetCallbackInUiThread getCallBackMethodID = %d",getCallBackMethodID);
+ TInt handle = reinterpret_cast<TInt>(iDisplay);
+ validJNI->CallVoidMethod(aJavaVideoControlPeer,jmid,handle);
+ iGuiPlayer->SetDisplayL(iDisplay);
+}
+
+void CMMAVideoControl::StaticInitDynamicModeL(
+ CMMAVideoControl* aVideoControl,
+ TInt* aContentHandle,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject,
+ CMMAEvent* aDeleteRefEvent)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::CMMAVideoControl::StaticInitDynamicModeL+");
+ aVideoControl->iDeleteRefEvent = aDeleteRefEvent;
+
+ CMMADCDisplay* dcDisplay = CMMADCDisplay::NewLC(aVideoControl->iGuiPlayer,
+ aEventSource,
+ aGUIObject);
+
+ MMMADirectContent* content = dcDisplay;
+ *aContentHandle = reinterpret_cast< TInt >(content);
+ aVideoControl->iDisplay = dcDisplay;
+ aVideoControl->iGuiPlayer->SetDisplayL(aVideoControl->iDisplay);
+ CleanupStack::Pop(dcDisplay);
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticInitDynamicModeL-");
+}
+
+void CMMAVideoControl::StaticGetPropertyL(CMMAVideoControl* aControl,
+ TInt aPropertyType,
+ TInt* aReturnValue)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL property %d",
+ aPropertyType);
+
+// MMAPI UI 3.x req.
+// remove the below return; once display is implemented in java
+ return;
+
+
+ MMMADisplay* display = aControl->iDisplay;
+
+ if (aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH &&
+ aPropertyType != com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT &&
+ !display)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL not initialized yet");
+ // init is not done yet, returning 0
+ *aReturnValue = 0;
+ return;
+ }
+
+ switch (aPropertyType)
+ {
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_WIDTH:
+ {
+ *aReturnValue = display->DisplaySize().iWidth;
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_HEIGHT:
+ {
+ *aReturnValue = display->DisplaySize().iHeight;
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_X:
+ {
+ *aReturnValue = display->DisplayLocation().iX;
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_DISPLAY_Y:
+ {
+ *aReturnValue = display->DisplayLocation().iY;
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_WIDTH:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source width");
+ *aReturnValue = aControl->iGuiPlayer->SourceSize().iWidth;
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_PROPERTY_SOURCE_HEIGHT:
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticGetPropertyL get source height");
+ *aReturnValue = aControl->iGuiPlayer->SourceSize().iHeight;
+ break;
+ }
+ default:
+ {
+ *aReturnValue = KErrNotFound;
+ User::Leave(KErrNotFound);
+ break;
+ }
+ }
+}
+
+
+void CMMAVideoControl::StaticSetPropertyL(CMMAVideoControl* aControl,
+ TInt aPropertyType,
+ TInt aPropertyA,
+ TInt aPropertyB)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL property type %d",
+ aPropertyType);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL a property %d",
+ aPropertyA);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d",
+ aPropertyB);
+// MMAPI UI 3.x req.
+// remove the below return; once display is implemented in java
+ return;
+
+ MMMADisplay* display = aControl->iDisplay;
+
+ __ASSERT_DEBUG(display != NULL,
+ User::Panic(_L("display not initialized"), KErrNotReady));
+
+ switch (aPropertyType)
+ {
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE:
+ {
+ TSize displaySize(aPropertyA, aPropertyB);
+ display->SetDisplaySizeL(displaySize);
+
+ // inform java side
+ if (!display->IsFullScreen())
+ {
+ aControl->iGuiPlayer->NotifyWithStringEvent(
+ CMMAPlayerEvent::ESizeChanged, KControlName);
+ }
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_LOCATION:
+ {
+ TPoint displayLocation(aPropertyA, aPropertyB);
+ display->SetDisplayLocationL(displayLocation);
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_TRUE:
+ {
+ display->SetVisible(ETrue);
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_VISIBLE_FALSE:
+ {
+ display->SetVisible(EFalse);
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_TRUE:
+ {
+ // store old user rect to determine if SIZE_CHANGED event
+ // has to be delivered when full screen mode is turned off.
+ aControl->iOldDisplaySize = display->DisplaySize();
+
+ display->SetFullScreenL(ETrue);
+ break;
+ }
+ case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE:
+ {
+ display->SetFullScreenL(EFalse);
+
+ // Send SIZE_CHANGED event when fullscreen is turned off if
+ // size of the video display has changed. Possible position
+ // change is however disregarded
+ if (aControl->iOldDisplaySize != display->DisplaySize())
+ {
+ aControl->iGuiPlayer->NotifyWithStringEvent(
+ CMMAPlayerEvent::ESizeChanged, KControlName);
+ }
+
+ break;
+ }
+ default:
+ {
+ User::Leave(KErrNotFound);
+ break;
+ }
+ }
+}
+
+
+void CMMAVideoControl::TakeSnapShotL(CMMAVideoControl* aControl,
+ const TDesC* aProperties)
+{
+ __ASSERT_DEBUG(
+ aControl,
+ User::Panic(_L("CMMAVideoControl::TakeSnapShotL CMMAVideoControl is NULL"),
+ KErrArgument)
+ );
+
+ ASSERT(aProperties);
+ aControl->iSnapshot->TakeSnapShotL(*aProperties);
+}
+
+EXPORT_C void CMMAVideoControl::SnapshotReady()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::SnapshotReady()");
+
+ // now this class owns the buffer
+ HBufC8* imageBuffer = iSnapshot->ImageBuffer();
+ // Use standard new to avoid useless trap.
+ CMMASnapshotEvent* event =
+ new CMMASnapshotEvent(iListenerObject,
+ iSnapshotReadyMethod,
+ iSnapshot->iStatus.Int(),
+ imageBuffer,
+ CMMAEvent::EDisposableEvent);
+ if (event)
+ {
+ // ok, ownership of buffer transfered to event
+
+ // event poster takes the ownership of the event
+ iEventPoster->PostEvent(event, CMMAEvent::ENotifyPriority);
+ }
+ else
+ {
+ // we own the buffer
+ delete imageBuffer;
+ }
+}
+
+EXPORT_C const TDesC& CMMAVideoControl::ClassName() const
+{
+ return KControlName;
+}
+TBool CMMAVideoControl::IsForeground()
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoControl::IsForeground() %d",iIsForeground);
+
+ return iIsForeground;
+}
+
+void CMMAVideoControl::StaticSetForegroundL(CMMAVideoControl* aControl,
+ TInt aForeground)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetForegroundL + aForeground %d",
+ aForeground);
+
+ __ASSERT_DEBUG(
+ aControl,
+ User::Panic(_L("MMA::CMMAVideoControl::StaticSetForegroundL : CMMAVideoControl is NULL"),
+ KErrArgument)
+ );
+
+ if (aControl)
+ {
+ aControl->SetForeground(aForeground, EFalse);
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetForegroundL - ");
+}
+
+/* // 3.x QT based UI
+// Implement MMIDEnvObserver
+
+void CMMAVideoControl::HandleSwitchOnL(TBool aSwitchOn)
+{
+ // Dummy implementation, no intent to do anything
+}
+*/
+/**
+ * Handles the case when the MIDlet is brought to the foreground.
+ */
+
+/*
+void CMMAVideoControl::HandleForegroundL(TBool aForeground)
+{
+
+ SetForeground(aForeground, ETrue);
+
+}
+
+*/
+void CMMAVideoControl::SetForeground(TBool aForeground, TBool aUseEventServer)
+{
+ iIsForeground = aForeground;
+ if (iDisplay)
+ {
+ iDisplay->SetForeground(iIsForeground, aUseEventServer);
+ }
+}
+
+
+/**
+ * Handles a change to resources which are shared accross the environment.
+ */
+/*
+void CMMAVideoControl::HandleResourceChangeL(TInt aType)
+{
+ // Dummy implementation, no intent to do anything
+}
+*/ // end of // 3.x QT based UI
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideoframepositioningcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements FramePositioningControl for video player
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+#include <e32math.h>
+
+#include "cmmavideoframepositioningcontrol.h"
+
+namespace
+{
+const TInt32 KMMAFramePosMicroSecMultiplier = 1000000;
+}
+
+CMMAVideoFramePositioningControl*
+CMMAVideoFramePositioningControl::NewL(CMMAVideoPlayer* aPlayer)
+{
+ CMMAVideoFramePositioningControl* self =
+ new(ELeave) CMMAVideoFramePositioningControl(aPlayer);
+ return self;
+
+}
+CMMAVideoFramePositioningControl::
+CMMAVideoFramePositioningControl(CMMAVideoPlayer* aPlayer)
+ : CMMAFramePositioningControl(aPlayer), iPlayer(aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoFramePositioningControl::CMMAVideoFramePositioningControl");
+}
+
+CMMAVideoFramePositioningControl::~CMMAVideoFramePositioningControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoFramePositioningControl::~CMMAVideoFramePositioningControl");
+}
+
+TInt CMMAVideoFramePositioningControl::SeekL(TInt aFrameNumber)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::SeekL, aFrameNumber: %d", aFrameNumber);
+
+ RMMFController& controller = iPlayer->Controller();
+
+ // Controller is paused before changing position to increase
+ // accuracy
+ TBool playerStarted = EFalse;
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ playerStarted = ETrue;
+ }
+
+ if (playerStarted)
+ {
+ User::LeaveIfError(controller.Pause());
+ }
+
+ // Frame number must be positive
+ TInt frameNumber = aFrameNumber;
+ if (frameNumber < 0)
+ {
+ frameNumber = 0;
+ }
+
+ // Find out framerate of video
+ TReal32 frameRate = 0;
+ GetAndCheckFrameRateL(frameRate);
+
+ // Calculate new media time
+ TReal tempReal = ((TReal32)frameNumber *
+ KMMAFramePosMicroSecMultiplier) / frameRate;
+ User::LeaveIfError(Math::Round(tempReal, tempReal, 0));
+ TInt64 newMediaTime = tempReal;
+
+ // New media time is clamped to duration
+ TInt err = ClampMediaTime(newMediaTime);
+ // Clamp fails if duration of content is not known.
+ // Two additional resorts are (in preferred order):
+ // 1) Return current frame position if it can be calculated.
+ // 2) Or seek to 0.
+
+ // First resort
+ if (err != KErrNone)
+ {
+ iPlayer->GetMediaTime(&newMediaTime);
+ // Second resort
+ if (newMediaTime < 0)
+ {
+ newMediaTime = 0;
+ }
+ }
+ iPlayer->SetMediaTimeL(&newMediaTime);
+ // Error condition
+ if (newMediaTime < KErrNotFound)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Calculate actually set frame number
+ tempReal = (((TReal32)newMediaTime / KMMAFramePosMicroSecMultiplier) *
+ (TReal32) frameRate);
+ User::LeaveIfError(Math::Round(tempReal, tempReal, 0));
+
+ // Restart controller
+ if (playerStarted)
+ {
+ User::LeaveIfError(controller.Play());
+ }
+
+ return tempReal;
+}
+
+TInt CMMAVideoFramePositioningControl::SkipL(TInt aFramesToSkip)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::SkipL, aFramesToSkip: %d", aFramesToSkip);
+
+ RMMFController& controller = iPlayer->Controller();
+
+ // Controller is paused before changing position to increase
+ // accuracy
+ TBool playerStarted = EFalse;
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ playerStarted = ETrue;
+ }
+
+ if (playerStarted)
+ {
+ User::LeaveIfError(controller.Pause());
+ }
+
+ // Find out framerate of video
+ TReal32 frameRate = 0;
+ GetAndCheckFrameRateL(frameRate);
+
+ // Find out current media time
+ TInt64 currentMediaTime = 0;
+ iPlayer->GetMediaTime(¤tMediaTime);
+
+ // Error condition
+ if (currentMediaTime < KErrNone)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Find out current frame number
+ TReal tempReal =
+ ((TReal32) currentMediaTime / KMMAFramePosMicroSecMultiplier) *
+ frameRate;
+ User::LeaveIfError(Math::Round(tempReal, tempReal, 0));
+ TInt currentFrameNumber = tempReal;
+
+ // Calculate new media time
+ TInt64 newMediaTime = currentMediaTime +
+ (((TReal32) aFramesToSkip / frameRate) * KMMAFramePosMicroSecMultiplier);
+
+ // New media time is clamped to duration
+ TInt err = ClampMediaTime(newMediaTime);
+
+ // If clamping fails, no frames are skipped
+ TInt framesSkipped = 0;
+ if (err == KErrNone)
+ {
+ iPlayer->SetMediaTimeL(&newMediaTime);
+ // Error condition
+ if (newMediaTime < KErrNone)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ // Calculate actual amount of frames skipped
+ tempReal = ((((TReal32) newMediaTime / KMMAFramePosMicroSecMultiplier) *
+ (TReal32) frameRate) - currentFrameNumber);
+
+ User::LeaveIfError(Math::Round(tempReal, tempReal, 0));
+ framesSkipped = tempReal;
+ }
+
+ // Restart controller
+ if (playerStarted)
+ {
+ User::LeaveIfError(controller.Play());
+ }
+
+ return framesSkipped;
+}
+
+void CMMAVideoFramePositioningControl::MapFrameToTimeL(TInt aFrameNumber, TInt64* aMediaTime)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::MapFrameToTimeL, aFrameNumber: %d", aFrameNumber);
+ // Find out framerate of video
+ TReal32 frameRate = 0;
+ GetAndCheckFrameRateL(frameRate);
+
+ // Find out frame mediatime
+ TInt64 frameMediaTime =
+ ((TReal32)aFrameNumber / (TReal32)frameRate) *
+ KMMAFramePosMicroSecMultiplier;
+
+ TInt64 duration;
+ iPlayer->GetDuration(&duration);
+
+ if (frameMediaTime < 0)
+ {
+ frameMediaTime = KErrNotFound;
+ }
+ else if (frameMediaTime > duration)
+ {
+ frameMediaTime = KErrNotFound;
+ // With some medias last frame media time is few hundred microsec's
+ // over duration. This is because framerate is not accurate.
+ // If given frame number is last frame and frameMediaTime > duration,
+ // return duration
+ // Find out last frame
+ TReal lastFrame = (frameRate * (TReal32)duration) /
+ KMMAFramePosMicroSecMultiplier;
+ User::LeaveIfError(Math::Round(lastFrame, lastFrame, 0));
+ if (aFrameNumber == lastFrame)
+ {
+ frameMediaTime = duration;
+ }
+ }
+ *aMediaTime = frameMediaTime;
+}
+
+TInt CMMAVideoFramePositioningControl::MapTimeToFrameL(TInt64* aMediaTime)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::MapTimeToFrameL, aMediaTime: %d", *aMediaTime);
+ TInt64 mediaTime = *aMediaTime;
+
+ // If given media time is < 0 or > duration, cannot map time to frame
+ // conversion fails, -1 is returned
+ TInt64 duration;
+ iPlayer->GetDuration(&duration);
+ if (mediaTime > duration || mediaTime < 0)
+ {
+ return KErrNotFound;
+ }
+
+ // Find out framerate of video
+ TReal32 frameRate = 0;
+ GetAndCheckFrameRateL(frameRate);
+
+ // Calculate frame number from media time
+ TReal tempReal = (TInt)((TReal64)(mediaTime * frameRate) /
+ KMMAFramePosMicroSecMultiplier);
+ User::LeaveIfError(Math::Round(tempReal, tempReal, 0));
+
+ return tempReal;
+}
+
+
+void CMMAVideoFramePositioningControl::GetAndCheckFrameRateL(
+ TReal32& aFrameRate)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::GetAndCheckFrameRateL");
+ RMMFVideoControllerCustomCommands customCommands =
+ RMMFVideoControllerCustomCommands(iPlayer->Controller());
+
+ User::LeaveIfError(customCommands.GetFrameRate(aFrameRate));
+ LOG1( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::GetAndCheckFrameRateL, aFrameRate: %d", aFrameRate);
+ if (aFrameRate <= 0)
+ {
+ // zero framerate is not accepted because cannot
+ // divide by zero. Negative framerate is not
+ // acceptable aswell.
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoFramePositioningControl::GetAndCheckFrameRateL: invalid framerate");
+ User::Leave(KErrNotFound);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideoplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating video player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideoplayerfactory.h"
+#include "cmmastoptimecontrol.h"
+#include "cmmavideoplayer.h"
+#include "cmmavideocontrol.h"
+#include "cmmaaudiovolumecontrol.h"
+#include "cmmammfresolver.h"
+#include "cmmavideoframepositioningcontrol.h"
+#include "cmmammfratecontrol.h"
+
+
+// audio content type
+_LIT(KMMAAudio, "audio");
+// Length of KMMAAudio descriptor
+const TInt KMMAAudioLength = 5;
+
+CMMAVideoPlayerFactory* CMMAVideoPlayerFactory::NewLC()
+{
+ CMMAVideoPlayerFactory* pFactory =
+ new(ELeave) CMMAVideoPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+CMMAVideoPlayerFactory::CMMAVideoPlayerFactory()
+{
+}
+
+
+CMMAVideoPlayerFactory::~CMMAVideoPlayerFactory()
+{
+}
+
+#ifdef RD_JAVA_OMA_DRM_V2
+CMMAPlayer* CMMAVideoPlayerFactory::CreatePlayerWithFileL(const TDesC& aContentType,
+ const TDesC* aFileName)
+{
+ iFileName = aFileName;
+ return CMMAMMFPlayerFactory::CreatePlayerL(aContentType);
+}
+#endif // RD_JAVA_OMA_DRM_V2
+
+CMMAPlayer* CMMAVideoPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ HBufC* cType = aResolver->ContentType();
+
+ // Video player may not accept audio content types.
+ if (cType &&
+ cType->Length() >= KMMAAudioLength &&
+ (aResolver->ContentType()->Mid(0, KMMAAudioLength) == KMMAAudio))
+ {
+ return NULL;
+ }
+
+#ifdef RD_JAVA_OMA_DRM_V2
+ if (iFileName)
+ {
+ aResolver->SetFileNameL(iFileName);
+ iFileName = NULL;
+ }
+#endif // RD_JAVA_OMA_DRM_V2
+
+ CMMAVideoPlayer* player = CMMAVideoPlayer::NewLC(aResolver);
+
+ CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(player);
+ CleanupStack::PushL(videoControl);
+ player->AddControlL(videoControl);
+ CleanupStack::Pop(videoControl);
+
+ CMMAAudioVolumeControl* audioVolumeControl = CMMAAudioVolumeControl::NewL(player);
+ CleanupStack::PushL(audioVolumeControl);
+ player->AddControlL(audioVolumeControl);
+ CleanupStack::Pop(audioVolumeControl);
+
+ CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ // FramePositioningControl is only supported for file locator
+ if (player->IsFilePlayer())
+ {
+ CMMAVideoFramePositioningControl* framePositioningControl =
+ CMMAVideoFramePositioningControl::NewL(player);
+ CleanupStack::PushL(framePositioningControl);
+ player->AddControlL(framePositioningControl);
+ CleanupStack::Pop(framePositioningControl);
+ }
+
+ CMMAMMFRateControl* rateControl = CMMAMMFRateControl::NewL(player);
+ CleanupStack::PushL(rateControl);
+ player->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+
+
+ CleanupStack::Pop(); // player
+ return player;
+}
+
+
+void CMMAVideoPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeVideo));
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio));
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideorecordcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is a RecordControl.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideorecordcontrol.h"
+#include "cmmaplayer.h"
+#include "cmmammfresolver.h"
+#include "cmmacamerasound.h"
+
+const TInt KUnlimitedSize = KMaxTInt32;
+
+const TReal32 KNoUserDefinedFps = -1;
+const TInt KNoUserDefinedSize = -1;
+const TInt KNoUserDefinedRecordSize = -1;
+
+_LIT(KVideoMp4MimeType, "video/mp4");
+_LIT(KVideoH264MimeType, "video/H264");
+
+_LIT8(KMimeTypeMPEG4VSPL3, "video/mp4v-es; profile-level-id=3");
+_LIT8(KMimeTypeH264AVCBPL12, "video/H264; profile-level-id=42800C"); // Level 1.2
+
+CMMAVideoRecordControl* CMMAVideoRecordControl::NewL(CMMAPlayer* aPlayer,
+ CMMAMMFResolver* aResolver,
+ const TMMAVideoSettings& aVideoSettings,
+ CMMAAudioSettings* aAudioSettings,
+ TInt aCameraHandle)
+{
+ CMMAVideoRecordControl* self =
+ new(ELeave)CMMAVideoRecordControl(aPlayer,
+ aCameraHandle);
+ CleanupStack::PushL(self);
+
+ // SetContentType takes ownership
+ aPlayer->SetContentType(aResolver->ContentTypeOwnership());
+ self->ConstructL(*aResolver->Implementations(),
+ aVideoSettings,
+ aAudioSettings);
+
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAVideoRecordControl::CMMAVideoRecordControl(CMMAPlayer* aPlayer,
+ TInt aCameraHandle):
+ CMMARecordControl(aPlayer),
+ iRecordSizeLimit(KNoUserDefinedRecordSize)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::CMMAVideoRecordControl");
+
+ __ASSERT_DEBUG(aCameraHandle > 0, User::Panic(
+ _L("CMMAVideoRecordControl::Invalid camera"),
+ KErrArgument));
+ __ASSERT_DEBUG(aPlayer, User::Panic(
+ _L("CMMAVideoRecordControl::Invalid player"),
+ KErrArgument));
+ iCameraHandle = aCameraHandle;
+}
+
+CMMAVideoRecordControl::~CMMAVideoRecordControl()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::~CMMAVideoRecordControl");
+
+ delete iActiveSchedulerWait;
+
+ if (iRecorder)
+ {
+ iRecorder->Close();
+ delete iRecorder;
+ }
+}
+
+void CMMAVideoRecordControl::ConstructL(
+ RMMFControllerImplInfoArray& aControllerInfos,
+ const TMMAVideoSettings& aVideoSettings,
+ CMMAAudioSettings* aAudioSettings)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::ConstructL +");
+ CMMARecordControl::ConstructL();
+
+ iVideoSettings = aVideoSettings;
+
+ iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
+
+ iRecorder = CVideoRecorderUtility::NewL(*this, EMdaPriorityMin, EMdaPriorityPreferenceNone);
+
+ TUid videoControllerUid = KNullUid;
+ TUid videoFormatUid = KNullUid;
+
+ HBufC8* encoding;
+ // if wanted video encoding is H264, we must find format uid for video/mp4
+ // and set encoding later because mmf doesn't have controller for video/H264
+ if (!(iVideoSettings.iEncoding.Compare(KVideoH264MimeType) == 0))
+ {
+ encoding = HBufC8::NewLC(iVideoSettings.iEncoding.Length());
+ encoding->Des().Copy(iVideoSettings.iEncoding);
+ }
+ else
+ {
+ encoding = HBufC8::NewLC(KVideoMp4MimeType().Length());
+ encoding->Des().Copy(KVideoMp4MimeType());
+ }
+
+ // Go through controller infos to find format UID
+ TInt controllerCount = aControllerInfos.Count();
+ for (TInt cIndex = 0; cIndex < controllerCount; cIndex++)
+ {
+ const RMMFFormatImplInfoArray infoArray =
+ aControllerInfos[ cIndex ]->RecordFormats();
+
+ // Find correct format uid
+ TInt formatCount = infoArray.Count();
+ for (TInt formatIndex = 0; formatIndex < formatCount; formatIndex++)
+ {
+ if (infoArray[ formatIndex ]->SupportsMimeType(*encoding))
+ {
+ // Uids will be used to open controller
+ videoFormatUid = infoArray[ formatIndex ]->Uid();
+ videoControllerUid = aControllerInfos[ cIndex ]->Uid();
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(encoding);
+
+ if (videoFormatUid == KNullUid ||
+ videoControllerUid == KNullUid)
+ {
+ // Controller and / or format for mime was not found.
+ User::Leave(KErrNotSupported);
+ }
+
+ iFile.Close();
+ iRecorder->OpenFileL(iFilename,
+ iCameraHandle,
+ videoControllerUid,
+ videoFormatUid,
+ KNullDesC8,
+ aAudioSettings->iDataType);
+
+ // wait until MvruoOpenComplete is called
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ User::LeaveIfError(iError);
+
+ // if wanted video encoding is mp4, set it
+ if (iVideoSettings.iEncoding.Compare(KVideoMp4MimeType) == 0)
+ {
+ iRecorder->SetVideoTypeL(KMimeTypeMPEG4VSPL3);
+ // audio encoding with mp4 is AAC by default
+ iRecorder->SetAudioTypeL(KMMFFourCCCodeAAC);
+ }
+
+ // if wanted video encoding is H264, set it
+ if (iVideoSettings.iEncoding.Compare(KVideoH264MimeType) == 0)
+ {
+ iRecorder->SetVideoTypeL(KMimeTypeH264AVCBPL12);
+ // audio encoding with mp4 is AAC by default
+ iRecorder->SetAudioTypeL(KMMFFourCCCodeAAC);
+ }
+
+ // setting size if it is set by user
+ TSize videoSize;
+ iRecorder->GetVideoFrameSizeL(videoSize);
+ if (iVideoSettings.iHeight != KNoUserDefinedSize)
+ {
+ videoSize.iHeight = iVideoSettings.iHeight;
+ }
+
+ if (iVideoSettings.iWidth != KNoUserDefinedSize)
+ {
+ videoSize.iWidth = iVideoSettings.iWidth;
+ }
+ iRecorder->SetVideoFrameSizeL(videoSize);
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::ConstructL()-");
+}
+
+void CMMAVideoRecordControl::InitializeL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::InitializeL()");
+ iRecorder->Prepare();
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ User::LeaveIfError(iError);
+
+ // setting frame rate if it is set by user
+ // record utility must be prepared to do this
+ if (iVideoSettings.iFps != KNoUserDefinedFps)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::InitializeL() SetVideoFrameRateL = %d", iVideoSettings.iFps);
+ iRecorder->SetVideoFrameRateL(iVideoSettings.iFps);
+ }
+
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::InitializeL()-");
+}
+
+void CMMAVideoRecordControl::DoStartRecordL()
+{
+ // if reset is called then file is reopened, closing it in order to prevent
+ // KErrInUse
+ iFile.Close();
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoRecordControl::DoStartRecordL() err=%d", iError);
+ User::LeaveIfError(iError);
+
+ // play sound when recording starts
+ CMMACameraSound::PlayVideoRecordSoundL();
+
+ // Set recordsize limit if needed
+ if (iRecordSizeLimit != KNoUserDefinedRecordSize)
+ {
+ DoSetRecordSizeLimitL(iRecordSizeLimit);
+ }
+
+ iRecorder->Record();
+}
+
+void CMMAVideoRecordControl::DoStopRecordL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::DoStopRecordL");
+ // Just paused that recording can continue
+ iRecorder->PauseL();
+}
+
+void CMMAVideoRecordControl::DoResetL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::ResetL");
+ TInt err = iRecorder->Stop();
+ // returns KErrCompletion when recording is finished when size limit is reached
+ // and KErrAlreadyExists if we have created file (ignoring both)
+ if ((err != KErrCompletion) &&
+ (err != KErrAlreadyExists))
+ {
+ User::LeaveIfError(err);
+ }
+ TBool isOpen(EFalse);
+ err = iFs.IsFileOpen(iFilename, isOpen);
+ if (!isOpen && (err != KErrNotFound))
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::ResetL - Opening file");
+ // opening file for resetting (or commit)
+ User::LeaveIfError(iFile.Open(iFs, iFilename, EFileRead |
+ EFileWrite |
+ EFileShareAny));
+ }
+ else if (err == KErrNotFound)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::ResetL - Recreating file");
+ // record utility deletes file if nothing is recorded, creating it again
+ User::LeaveIfError(iFile.Create(iFs,
+ iFilename,
+ EFileRead |
+ EFileWrite |
+ EFileShareAny));
+ }
+ else
+ {
+ User::LeaveIfError(err);
+ }
+}
+
+void CMMAVideoRecordControl::DoSetRecordSizeLimitL(TInt aSize)
+{
+ if (aSize == KUnlimitedSize)
+ {
+ iRecorder->SetMaxClipSizeL(KMMFNoMaxClipSize);
+ }
+ else
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::DoSetRecordSizeLimitL %d", aSize);
+ iRecorder->SetMaxClipSizeL(aSize);
+ }
+ // reset local value
+ iRecordSizeLimit = KNoUserDefinedRecordSize;
+ // have to reprepare after setting clipsize
+ iRecorder->Prepare();
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ User::LeaveIfError(iError);
+}
+
+TInt CMMAVideoRecordControl::SetRecordSizeLimitL(TInt aSize)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoRecordControl::SetRecordSizeLimitL %d", aSize);
+
+ // if already recording, try to set immediately
+ if (iState == ERecordRecording)
+ {
+ DoSetRecordSizeLimitL(aSize);
+ }
+ else
+ {
+ // set record size limit when recording is started
+ iRecordSizeLimit = aSize;
+ }
+ return aSize;
+}
+
+void CMMAVideoRecordControl::MvruoOpenComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoRecordControl::MvruoOpenComplete aError = %d", aError);
+
+ // Error situation is handled in ConstructL,
+ iError = aError;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+}
+
+void CMMAVideoRecordControl::MvruoPrepareComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoRecordControl::MvruoPrepareComplete aError = %d", aError);
+ // Error situation is handled in InitializeL
+ iError = aError;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+}
+
+void CMMAVideoRecordControl::MvruoRecordComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoRecordControl::MvruoRecordComplete aError = %d", aError);
+
+ // iState = ERecordComplete
+
+ if ((aError == KErrNone) ||
+ (aError == KErrCompletion)) // Size limit reached
+ {
+ if (aError == KErrCompletion)
+ {
+ HandleRecordSizeLimit();
+ }
+ }
+ else
+ {
+ Error(aError);
+ }
+}
+
+
+void CMMAVideoRecordControl::MvruoEvent(const TMMFEvent& aEvent)
+{
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoRecordControl::MvruoEvent event error code = %d", aEvent.iErrorCode);
+ // Only error situations needs to be considered.
+ if (aEvent.iErrorCode != KErrNone)
+ {
+ Error(aEvent.iErrorCode);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideourlplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing video.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmf/server/mmfurl.h>
+#include <es_enum.h>
+#include <logger.h>
+
+#include "cmmavideourlplayer.h"
+#include "mmmadisplay.h"
+#include "cmmasourcestream.h"
+
+const TUid KUrlSourceUid = { KMmfUidUrlSource };
+_LIT(KMMALiveStreamMetaDataKeyword, "LiveStream");
+_LIT(KMMALiveStreamMetaDataValue, "1");
+
+CMMAVideoUrlPlayer* CMMAVideoUrlPlayer::NewLC(
+ CMMAMMFResolver* aResolver,
+ const TDesC& aUrl)
+{
+ CMMAVideoUrlPlayer* self = new(ELeave) CMMAVideoUrlPlayer(
+ aResolver);
+ CleanupStack::PushL(self);
+ self->ConstructL(aUrl);
+ return self;
+}
+
+EXPORT_C CMMAVideoUrlPlayer::~CMMAVideoUrlPlayer()
+{
+ iConnection.Close();
+ iSocketServ.Close();
+ delete iUrl;
+ delete iPlayerDelegate;
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::ConstructL(const TDesC& aUrl)
+{
+ CMMAVideoPlayer::ConstructL();
+ iUrl = aUrl.AllocL();
+
+ User::LeaveIfError(iSocketServ.Connect());
+ User::LeaveIfError(iConnection.Open(iSocketServ));
+}
+
+EXPORT_C CMMAVideoUrlPlayer::CMMAVideoUrlPlayer(
+ CMMAMMFResolver* aResolver):
+ CMMAVideoPlayer(aResolver)
+{
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::DeallocateL()
+{
+ __ASSERT_DEBUG(iPlayerDelegate != NULL, User::Invariant());
+ delete iPlayerDelegate;
+ iPlayerDelegate = NULL;
+ CMMAMMFPlayerBase::DeallocateL();
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::CloseL()
+{
+ // Do not call the CMMAVideoPlayer CloseL because it deletes
+ // file source stream.
+ CMMAAudioPlayer::CloseL();
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::StartL()
+{
+ __ASSERT_DEBUG(iPlayerDelegate != NULL, User::Invariant());
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoUrlPlayer::StartL() +");
+ iPlayerDelegate->StartL();
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoUrlPlayer::StartL() -");
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::StopL(TBool aPostEvent)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::StopL ");
+ __ASSERT_DEBUG(iPlayerDelegate != NULL, User::Invariant());
+ iPlayerDelegate->StopL(aPostEvent);
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::GetMediaTime +");
+ if (iPlayerDelegate)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::GetMediaTime .iPlayerDelegate->GetMediaTime ");
+ iPlayerDelegate->GetMediaTime(aMediaTime);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::GetMediaTime Not found ");
+ *aMediaTime = KErrNotFound;
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::GetMediaTime -");
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::RealizeL()
+{
+ CMMAPlayer::RealizeL(); // Changes state to ERealized
+}
+
+
+EXPORT_C void CMMAVideoUrlPlayer::PrefetchL()
+{
+ const TUint KConnectionTreshold(1);
+ TUint connectIap((TUint)KUseDefaultIap);
+ TUint connectionCount(0);
+ User::LeaveIfError(iConnection.EnumerateConnections(connectionCount));
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::PrefetchL: connectionCount = %d", connectionCount);
+ if (connectionCount == KConnectionTreshold)
+ {
+ // One active connection - find it and try using it
+ FindActiveIap(connectionCount, connectIap);
+ }
+ // else No active connections try using the default one
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::PrefetchL: connectIap = %d", connectIap);
+
+ CMMFUrlParams* urlCfg = CMMFUrlParams::NewLC(*iUrl, (TInt)connectIap);
+ CBufFlat* urlCfgBuffer = urlCfg->ExternalizeToCBufFlatLC();
+
+ // Store current thread priority to give
+ // more CPU time to Java threads i.e. this
+ // is work around for not locking the Java
+ // thread while RTSP connection is being
+ // opened
+ iOrigPriority = RThread().Priority();
+
+ // player priority settings
+ TMMFPrioritySettings prioritySettings;
+ prioritySettings.iPriority = EMdaPriorityMax;
+ prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality;
+ prioritySettings.iState = EMMFStatePlaying;
+
+ User::LeaveIfError(DoOpen(KUrlSourceUid,
+ urlCfgBuffer->Ptr(0),
+ KUidMmfAudioOutput,
+ KNullDesC8,
+ prioritySettings));
+
+ User::LeaveIfError(iController.Prime());
+
+ CleanupStack::PopAndDestroy(urlCfgBuffer);
+ CleanupStack::PopAndDestroy(urlCfg);
+
+ // Prefetch will be completed in HandleEvent method.
+ // Next event KMMFEventCategoryVideoOpenComplete will be handled in
+ // CMMAVideoPlayer.
+}
+
+void CMMAVideoUrlPlayer::FindActiveIap(const TUint aConnectionCount, TUint& aActiveIap)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::FindActiveIap: aConnectionCount = %d +", aConnectionCount);
+
+ TPckgBuf<TConnectionInfo> connectionInfo;
+ for (TUint i = 1; i <= aConnectionCount; ++i)
+ {
+ if (iConnection.GetConnectionInfo(i, connectionInfo) == KErrNone)
+ {
+ aActiveIap = connectionInfo().iIapId;
+ break;
+ }
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::FindActiveIap: aActiveIap = %d -", aActiveIap);
+}
+
+TBool CMMAVideoUrlPlayer::IsLiveStreamL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoUrlPlayer::IsLiveStream: Checking if this is a live stream..");
+
+ CMMFMetaDataEntry* currEntry = NULL;
+
+ TInt nEntries = 0;
+ User::LeaveIfError(iController.GetNumberOfMetaDataEntries(nEntries));
+
+ for (TInt i = 0; i < nEntries; ++i)
+ {
+ currEntry = iController.GetMetaDataEntryL(i);
+
+ if ((0 == currEntry->Name().Compare(KMMALiveStreamMetaDataKeyword)) &&
+ (0 == currEntry->Value().Compare(KMMALiveStreamMetaDataValue)))
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoUrlPlayer::IsLiveStream: Stream is a live stream");
+ delete currEntry;
+ return ETrue;
+ }
+
+ delete currEntry;
+ }
+
+ LOG( EJavaMMAPI, EInfo, "CMMAVideoUrlPlayer::IsLiveStream: Not a live stream");
+ return EFalse;
+}
+
+EXPORT_C void CMMAVideoUrlPlayer::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::HandleEvent 0x%X", aEvent.iEventType.iUid);
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoUrlPlayer::HandleEvent error code: %d", aEvent.iErrorCode);
+ RThread currentThread;
+
+ if (iPlayerDelegate != NULL)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::HandleEvent: iPlayerDelegate != NULL");
+ iPlayerDelegate->HandleEvent(aEvent);
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::HandleEvent: else");
+
+ __ASSERT_DEBUG(iPlayerDelegate == NULL, User::Invariant());
+ TInt err = aEvent.iErrorCode;
+
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::HandleEvent: currentThread.Priority() I = %d", currentThread.Priority());
+
+ // Lower thread priority to give more CPU time to Java-threads
+ // i.e. current thread has one increment higher priority than
+ // EPriorityNormal
+ if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete &&
+ err == KErrNone)
+ {
+ currentThread.SetPriority(EPriorityNormal);
+ }
+
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::HandleEvent: currentThread.Priority() II = %d", currentThread.Priority());
+
+ if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
+ {
+ // Restore original thread priority
+ currentThread.SetPriority(iOrigPriority);
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::HandleEvent: currentThread.Priority() III = %d", currentThread.Priority());
+
+ // NotCompleteVideoError is not considered as an error condition, instead it indicates
+ // that some elements of the media cannot be played (e.g. video OR audio)
+ if (err != KErrNone && err != KNotCompleteVideoError)
+ {
+ CompletePrefetch(err);
+ return;
+ }
+
+ // Find out of this is a live stream
+ TBool liveStream = EFalse;
+ TRAP(err, liveStream = IsLiveStreamL());
+
+ if (err != KErrNone)
+ {
+ CompletePrefetch(err);
+ return;
+ }
+
+ if (liveStream)
+ {
+ TRAP(err, iPlayerDelegate =
+ CMMAVideoUrlPlayerLiveStreamDelegate::NewL(*this));
+ }
+ else
+ {
+ iPlayerDelegate = new CMMAVideoUrlPlayerClipStreamDelegate(*this);
+ err = iPlayerDelegate ? KErrNone : KErrNoMemory;
+ }
+
+ if (err != KErrNone)
+ {
+ // could not create delegate
+ CompletePrefetch(err);
+ return;
+ }
+
+ iPlayerDelegate->HandleEvent(aEvent);
+ }
+ else
+ {
+ // All other events.
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVideoUrlPlayer::HandleEvent: Calling CMMAVideoPlayer::HandleEvent()");
+ CMMAVideoPlayer::HandleEvent(aEvent);
+ }
+ }
+}
+
+void CMMAVideoUrlPlayer::HandleEventToParent(const TMMFEvent& aEvent)
+{
+ CMMAVideoPlayer::HandleEvent(aEvent);
+}
+
+// ----------------------------------------------------------------------------
+//
+// CMMAVideoUrlPlayerClipStreamDelegate
+//
+// ----------------------------------------------------------------------------
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerDelegate::
+CMMAVideoUrlPlayerDelegate(CMMAVideoUrlPlayer& aPlayer) :
+ iPlayer(aPlayer)
+{
+ // Nothing to be done.
+}
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerDelegate::~CMMAVideoUrlPlayerDelegate()
+{
+ // Nothing to be done.
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideourlplayerclipstreamdelegate.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Player delegate to handle RTSP live streaming
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideourlplayer.h"
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::
+CMMAVideoUrlPlayerClipStreamDelegate(CMMAVideoUrlPlayer& aPlayer) :
+ CMMAVideoUrlPlayerDelegate(aPlayer)
+{
+ // Nothing to be done.
+}
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::~CMMAVideoUrlPlayerClipStreamDelegate()
+{
+ // Nothing to be done.
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::StartL()
+{
+ iPlayer.CMMAMMFPlayerBase::StartL();
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::StopL(TBool aPostEvent)
+{
+ if (iPlayer.iState == EStarted)
+ {
+ User::LeaveIfError(iPlayer.iController.Pause());
+
+ if (aPostEvent)
+ {
+ TInt64 time;
+ iPlayer.GetMediaTime(&time);
+ iPlayer.PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ // go back to prefetched state
+ iPlayer.ChangeState(EPrefetched);
+ }
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::GetMediaTime(TInt64* aMediaTime)
+{
+ iPlayer.CMMAMMFPlayerBase::GetMediaTime(aMediaTime);
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerClipStreamDelegate::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Clip stream: HandleEvent %d", aEvent.iEventType.iUid);
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoUrlPlayer: Clip stream: HandleEvent error code: %d", aEvent.iErrorCode);
+
+ TInt err = aEvent.iErrorCode;
+
+ if ((aEvent.iEventType == KMMFEventCategoryVideoLoadingComplete) &&
+ (iPlayer.iState == ERealized))
+ {
+ // Call pause only when doing prefetch.
+ // Loading complete will come also when looping.
+ if (err == KErrNone)
+ {
+ err = iPlayer.iController.Pause();
+ }
+
+ // VideoLoadingComplete-event only completes prefetch sequence
+ // for non-live streams.
+ iPlayer.CompletePrefetch(err);
+ }
+ else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
+ {
+ // going to prefetch state, after Play
+ // KMMFEventCategoryVideoLoadingComplete event will be received
+
+ if (err == KErrNone)
+ {
+ iPlayer.PrepareDisplay();
+
+ // Buffering is done only for non-live streams.
+ err = iPlayer.iController.Play();
+ }
+
+ // For non-live streams: if error is other than
+ // KErrNone, then complete prefetch.
+ if (err != KErrNone)
+ {
+ // prefetch didn't succeed
+ iPlayer.CompletePrefetch(err);
+ }
+ }
+ else
+ {
+ // All other events.
+ iPlayer.HandleEventToParent(aEvent);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideourlplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating video player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideourlplayerfactory.h"
+#include "cmmavideourlplayer.h"
+#include "cmmavideocontrol.h"
+#include "cmmaaudiovolumecontrol.h"
+#include "cmmammfratecontrol.h"
+
+// CONSTANTS
+const TInt KDefaultGranularity = 8;
+_LIT(KProtocolRtsp, "rtsp");
+_LIT(KRtspMimeType, "application/sdp");
+
+_LIT(KAudioXPnRmMimeType, "application/x-pn-realmedia");
+_LIT(KAudioRmMimeType, "application/vnd.rn-realmedia");
+_LIT(KAudio3gppMimeType, "audio/3gpp");
+_LIT(KAudio3gpp2MimeType, "audio/3gpp2");
+_LIT(KAudioAmrMimeType, "audio/amr");
+_LIT(KAudioMp4MimeType, "audio/mp4");
+_LIT(KAudioMp4LatmMimeType, "audio/mp4-latm");
+_LIT(KAudioQcelpMimeType, "audio/qcelp");
+_LIT(KAudioVndQcelpMimeType, "audio/vnd.qcelp");
+_LIT(KVideo3GppMimeType, "video/3gpp");
+_LIT(KVideo3Gpp2MimeType, "video/3gpp2");
+_LIT(KVideoMp4MimeType, "video/mp4");
+
+_LIT(KProtocolSeparator, "://");
+_LIT(KParameterSeparator, "?");
+
+CMMAVideoUrlPlayerFactory::CMMAVideoUrlPlayerFactory()
+{
+}
+
+
+CMMAVideoUrlPlayerFactory* CMMAVideoUrlPlayerFactory::NewLC()
+{
+ CMMAVideoUrlPlayerFactory* pFactory =
+ new(ELeave) CMMAVideoUrlPlayerFactory();
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+
+CMMAVideoUrlPlayerFactory::~CMMAVideoUrlPlayerFactory()
+{
+ delete iUrl;
+}
+
+
+CMMAPlayer* CMMAVideoUrlPlayerFactory::CreatePlayerL(const TDesC& /*aContentType*/)
+{
+ // Only creating with locator is supported
+ return NULL;
+}
+CMMAPlayer* CMMAVideoUrlPlayerFactory::CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters)
+{
+ // Is it rtsp:// protocol
+ if (aProtocol != KProtocolRtsp)
+ {
+ return NULL;
+ }
+ CMMFFormatSelectionParameters* fSelect =
+ CMMFFormatSelectionParameters::NewLC();
+
+ // combining the locator
+ HBufC* remadeLocator = HBufC::NewLC(aProtocol.Length() +
+ KProtocolSeparator().Length() +
+ aMiddlePart.Length() +
+ KParameterSeparator().Length() +
+ aParameters.Length());
+ TPtr loc = remadeLocator->Des();
+ loc.Append(aProtocol);
+ loc.Append(KProtocolSeparator);
+ loc.Append(aMiddlePart);
+ if (aParameters != KNullDesC)
+ {
+ loc.Append(KParameterSeparator);
+ loc.Append(aParameters);
+ }
+ delete iUrl;
+ iUrl = remadeLocator;
+ CleanupStack::Pop(remadeLocator);
+
+ // RTSP URLs without file extension:
+ // In case of file extensionless RTSP URL a predefined mime type
+ // is used to select controller. It is assumed that this mime
+ // type selects the controller that is capable to play any file
+ // extensionless RTSP URLs.
+ // To determine whether there is a file extension, it is checked whether
+ // there is a dot at all or if there is a slash after last dot in the
+ // URL. If there is a slash after last dot or if there is no dot at all,
+ // then there is no file extension.
+ TInt dotPos = aMiddlePart.LocateReverse('.');
+ TInt slashPos = aMiddlePart.LocateReverse('/');
+ if ((dotPos == KErrNotFound) || (slashPos > dotPos))
+ {
+ HBufC8* mimeBuf = HBufC8::NewLC(KRtspMimeType().Length());
+ TPtr8 mimePtr = mimeBuf->Des();
+ mimePtr.Copy(KRtspMimeType());
+ fSelect->SetMatchToMimeTypeL(mimePtr);
+ CleanupStack::PopAndDestroy(mimeBuf);
+ }
+ else
+ {
+ // Match to file name, using only middle part of the locator
+ fSelect->SetMatchToUriL(loc);
+ }
+
+ CMMAPlayer* player = CMMAMMFPlayerFactory::CreatePlayerL(fSelect);
+
+ CleanupStack::PopAndDestroy(fSelect);
+ return player;
+}
+
+CMMAPlayer* CMMAVideoUrlPlayerFactory::CreatePlayerL(
+ const TDesC8& /*aHeaderData*/)
+{
+ // We do not try to match headerdata
+ return NULL;
+}
+
+
+void CMMAVideoUrlPlayerFactory::GetSupportedContentTypesL(
+ const TDesC& aProtocol,
+ CDesC16Array& aMimeTypes)
+{
+ if ((aProtocol == KNullDesC) ||
+ (aProtocol == KProtocolRtsp))
+ {
+ aMimeTypes.AppendL(KAudio3gppMimeType);
+ aMimeTypes.AppendL(KAudio3gpp2MimeType);
+ aMimeTypes.AppendL(KAudioAmrMimeType);
+ aMimeTypes.AppendL(KAudioMp4MimeType);
+ aMimeTypes.AppendL(KAudioMp4LatmMimeType);
+ aMimeTypes.AppendL(KAudioQcelpMimeType);
+ aMimeTypes.AppendL(KAudioVndQcelpMimeType);
+ aMimeTypes.AppendL(KVideo3GppMimeType);
+ aMimeTypes.AppendL(KVideo3Gpp2MimeType);
+ aMimeTypes.AppendL(KVideoMp4MimeType);
+ aMimeTypes.AppendL(KAudioRmMimeType);
+ aMimeTypes.AppendL(KAudioXPnRmMimeType);
+ // plus RTSP content types
+ aMimeTypes.AppendL(KRtspMimeType);
+ }
+}
+
+
+void CMMAVideoUrlPlayerFactory::GetSupportedProtocolsL(
+ const TDesC& aContentType,
+ CDesC16Array& aProtocolArray)
+{
+ CDesC16ArraySeg* supportedCTs
+ = new(ELeave) CDesC16ArraySeg(KDefaultGranularity);
+ CleanupStack::PushL(supportedCTs);
+ GetSupportedContentTypesL(KNullDesC, *supportedCTs);
+ TInt ignore(0);
+ if ((supportedCTs->Find(aContentType, ignore) == 0) ||
+ (aContentType == KNullDesC))
+ {
+ aProtocolArray.AppendL(KProtocolRtsp);
+ }
+ CleanupStack::PopAndDestroy(supportedCTs);
+}
+
+CMMAPlayer* CMMAVideoUrlPlayerFactory::CreatePlayerL(
+ CMMAMMFResolver* aResolver)
+{
+ CMMAVideoUrlPlayer* player = CMMAVideoUrlPlayer::NewLC(aResolver,
+ *iUrl);
+
+ CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(player);
+ CleanupStack::PushL(videoControl);
+ player->AddControlL(videoControl);
+ CleanupStack::Pop(videoControl);
+
+ CMMAAudioVolumeControl* audioVolumeControl = CMMAAudioVolumeControl::NewL(player);
+ CleanupStack::PushL(audioVolumeControl);
+ player->AddControlL(audioVolumeControl);
+ CleanupStack::Pop(audioVolumeControl);
+
+ CMMAMMFRateControl* rateControl = CMMAMMFRateControl::NewL(player);
+ CleanupStack::PushL(rateControl);
+ player->AddControlL(rateControl);
+ CleanupStack::Pop(rateControl);
+
+ CleanupStack::Pop(); // player
+ return player;
+}
+
+void CMMAVideoUrlPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds)
+{
+ User::LeaveIfError(aMediaIds.Append(KUidMediaTypeVideo));
+}
+
+CMMFPluginSelectionParameters::TMediaIdMatchType
+CMMAVideoUrlPlayerFactory::MediaIdMatchType()
+{
+ // We are now getting only Audio Controllers
+ return CMMFPluginSelectionParameters::EAllowOtherMediaIds;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavideourlplayerlivestreamdelegate.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Player delegate to handle RTSP live streaming
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmavideourlplayer.h"
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate*
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::NewL(CMMAVideoUrlPlayer& aPlayer)
+{
+ CMMAVideoUrlPlayerLiveStreamDelegate* self =
+ new(ELeave) CMMAVideoUrlPlayerLiveStreamDelegate(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::
+CMMAVideoUrlPlayerLiveStreamDelegate(CMMAVideoUrlPlayer& aPlayer) :
+ CMMAVideoUrlPlayerDelegate(aPlayer), iMediaStartTime(0),
+ iStoppedAtTime(0)
+{
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::ConstructL()
+{
+ iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
+}
+
+CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::~CMMAVideoUrlPlayerLiveStreamDelegate()
+{
+ delete iActiveSchedulerWait;
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::StartL()
+{
+ // start can't be called to not ready player
+ ASSERT(iPlayer.iState == EPrefetched);
+
+
+ iPlayer.PrefetchL();
+
+ // Refresh all controls again after second prefetch
+ iPlayer.RefreshControls();
+
+ // Completed in VideoPrepareComplete-event
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StartL() ASW Start1");
+ iActiveSchedulerWait->Start();
+ }
+
+ // Prime() is called sometimes twice since it's needed also when
+ // restarting the playing
+ User::LeaveIfError(iPlayer.iController.Prime());
+ User::LeaveIfError(iPlayer.iController.Play());
+
+ // Completed in VideoLoadingComplete-event
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StartL() ASW Start2");
+ iActiveSchedulerWait->Start();
+ }
+ iPlayer.PostActionCompleted(KErrNone); // java start return
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::StopL(TBool aPostEvent)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StopL");
+ if (iPlayer.iState == EStarted)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StopL : Started ");
+ GetMediaTime(&iStoppedAtTime);
+ if (aPostEvent)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StopL : Postevent ");
+ iPlayer.PostLongEvent(CMMAPlayerEvent::EStopped, iStoppedAtTime);
+ }
+ // go back to prefetched state
+ iPlayer.ChangeState(EPrefetched);
+
+ // Call stop instead of Pause as per the suggestions from helix
+ // Pause has no meaning for live streaming
+ iPlayer.iController.Stop();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: StopL - ");
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::GetMediaTime +");
+ if (iPlayer.iState == EStarted)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::GetMediaTime Started Playerbase call");
+ iPlayer.CMMAMMFPlayerBase::GetMediaTime(aMediaTime);
+ *aMediaTime -= iMediaStartTime;
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::GetMediaTime Stopped");
+ *aMediaTime = iStoppedAtTime;
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::GetMediaTime -");
+}
+
+void CMMAVideoUrlPlayer::CMMAVideoUrlPlayerLiveStreamDelegate::HandleEvent(const TMMFEvent& aEvent)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: HandleEvent %d", aEvent.iEventType.iUid);
+ ELOG1( EJavaMMAPI, "MMA:CMMAVideoUrlPlayer: Live stream: HandleEvent error code: %d", aEvent.iErrorCode);
+
+ TInt err = aEvent.iErrorCode;
+
+ if ((aEvent.iEventType == KMMFEventCategoryVideoLoadingComplete) &&
+ (iPlayer.iState == EPrefetched))
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoLoadingComplete +");
+ if (err == KErrNone)
+ {
+ TTimeIntervalMicroSeconds position(0);
+ TInt error(iPlayer.iController.GetPosition(position));
+ if (error == KErrNone)
+ {
+ iMediaStartTime = position.Int64();
+ }
+
+ // inform java side. Always start playback from zero for
+ // live stream.
+ iPlayer.PostLongEvent(CMMAPlayerEvent::EStarted, 0);
+
+ // Buffering takes a long time, so player state is not changed
+ // until playback really starts.
+ iPlayer.ChangeState(EStarted);
+ }
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoLoadingComplete ASW Stop");
+ iActiveSchedulerWait->AsyncStop();
+ }
+ if (err != KErrNone)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoLoadingComplete Error Inform Parent");
+ iPlayer.HandleEventToParent(aEvent);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoLoadingComplete -");
+ }
+ else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPrepareComplete +");
+ // going to prefetch state, after Play
+ // KMMFEventCategoryVideoLoadingComplete event will be received
+
+ if (err == KErrNone)
+ {
+ iPlayer.PrepareDisplay();
+ }
+
+ // For live streams: complete prefetch.
+ // if activeschedulerwait is started, then
+ // do not complete prefetch as we are here
+ // as a result of calling StartL and not for
+ // PrefetchL.
+ if (!(iActiveSchedulerWait->IsStarted()))
+ {
+ iPlayer.CompletePrefetch(err);
+ }
+
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPrepareComplete ASW Stop");
+ iActiveSchedulerWait->AsyncStop();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPrepareComplete -");
+ }
+ else if (aEvent.iEventType == KMMFEventCategoryVideoPlayerGeneralError)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPlayerGeneralError +");
+ // For live streams: KMMFEventCategoryVideoPlayerGeneralError means helix is closed
+ // side if player is in prefetched state.
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPlayerGeneralError ASW Stop");
+ iActiveSchedulerWait->AsyncStop();
+ }
+
+ // usually error condition -45 (KErrSessionClosed) or -33 (KErrTimedOut)
+ if (err != KErrNone)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPlayerGeneralError Inform Parent");
+ iPlayer.HandleEventToParent(aEvent);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: KMMFEventCategoryVideoPlayerGeneralError -");
+ }
+ else
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: + 0x%X", aEvent.iEventType.iUid);
+ // For live streams: KErrSessionClosed is not posted to Java
+ // side if player is in prefetched state.
+ if ((iPlayer.iState != EPrefetched) ||
+ (aEvent.iErrorCode != KErrSessionClosed))
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: Error Inform Parent");
+ // All other events.
+ iPlayer.HandleEventToParent(aEvent);
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA:CMMAVideoUrlPlayer: Live stream: - 0x%X", aEvent.iEventType.iUid);
+ }
+
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/cmmavolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for volume setting
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cmmavolumecontrol.h"
+#include "cmmaplayer.h"
+#include <logger.h>
+
+_LIT(KMMAVolumeErrorMsg, "Can't set volume level");
+
+const TInt KMMAJavaSoundIndex = 0;
+const TInt KMMAGlobalVolumeSoundIndex = 2;
+
+void CMMAVolumeControl::StaticSetLevelL(CMMAVolumeControl* aVolumeControl,
+ TInt aLevel)
+{
+ // Java level is the first
+ aVolumeControl->SetVolumeLevelL(KMMAJavaSoundIndex, aLevel);
+}
+
+void CMMAVolumeControl::StaticGetLevelL(CMMAVolumeControl* aVolumeControl,
+ TInt* aLevel)
+{
+ // Java level is the first
+ aVolumeControl->GetVolumeLevelL(KMMAJavaSoundIndex, aLevel);
+}
+
+
+CMMAVolumeControl::CMMAVolumeControl(CMMAPlayer* aPlayer)
+ : iPlayer(aPlayer), iLevel(KMMAVolumeMaxLevel)
+{
+}
+
+
+CMMAVolumeControl::~CMMAVolumeControl()
+{
+ iLevels.Close();
+}
+
+
+void CMMAVolumeControl::ConstructBaseL()
+{
+ iPlayer->AddStateListenerL(this);
+
+ // Add level for java, will set in StaticSetLevelL method.
+ // In constructor iLevels array is empty and Java level will be the first,
+ // KMMAJavaSoundIndex.
+ AddLevelL();
+
+ iLevel = CalculateLevel();
+
+ // The default value is not yet known. Volume control may change the
+ // volume of the controller before it has been retrieved so when the
+ // state of the player is changed the Java volume is retrieved from
+ // the controller.
+ iLevels[ KMMAJavaSoundIndex ] = KErrNotFound;
+}
+
+const TDesC& CMMAVolumeControl::ClassName() const
+{
+ return KMMAVolumeControlName;
+}
+
+void CMMAVolumeControl::SetLevelL(TInt aLevel)
+{
+ // Level cannot be set to derived control if player is not prefetched.
+ if (iPlayer->State() > CMMAPlayer::ERealized)
+ {
+ DoSetLevelL(aLevel);
+ }
+ iLevel = aLevel;
+}
+
+void CMMAVolumeControl::StateChanged(TInt aState)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVolumeControl::StateChanged - state %d", aState);
+ // Set the volume if the player is prefetched
+ if (aState == CMMAPlayer::EPrefetched)
+ {
+ TRAPD(error,
+ {
+ // Get the default value for the Java sound level
+ if (iLevels[ KMMAJavaSoundIndex ] == KErrNotFound)
+ {
+ iLevels[ KMMAJavaSoundIndex ] = DoGetLevelL();
+ iLevel = CalculateLevel();
+ }
+ SetLevelL(iLevel);
+
+ });
+ if (error != KErrNone)
+ {
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError,
+ KMMAVolumeErrorMsg);
+ }
+ }
+
+ // Level is already set for Global Volume so no need to set it again
+ // Notify the initial global volume value to java
+ // Notify only if STATE == CMMAPlayer::ERealized
+ // Error ID AKUR-7G69Q5 GLOBAL VOLUME EVENT CR
+ if (aState == CMMAPlayer::ERealized)
+ {
+ if ((iLevels.Count() - 1) == KMMAGlobalVolumeSoundIndex)
+ {
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVolumeControl::StateChanged : Post GLOBAL VOL EVENT ");
+ if (iLevels[ KMMAGlobalVolumeSoundIndex ] != KErrNotFound)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMAVolumeControl::StateChanged : Post complete Val = %d ",iLevels[ KMMAGlobalVolumeSoundIndex ]);
+ iPlayer->PostLongEvent(CMMAPlayerEvent::ENOKIA_EXTERNAL_VOLUME_EVENT,
+ iLevels[ KMMAGlobalVolumeSoundIndex ]);
+ }
+ }
+ }
+}
+
+void CMMAVolumeControl::RefreshVolume()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVolumeControl::RefreshVolume ++ ");
+ TRAPD(error,
+ {
+ // Get the default value for the Java sound level
+ if (iLevels[ KMMAJavaSoundIndex ] == KErrNotFound)
+ {
+ iLevels[ KMMAJavaSoundIndex ] = DoGetLevelL();
+ iLevel = CalculateLevel();
+ }
+ SetLevelL(iLevel);
+
+ });
+
+ if (error != KErrNone)
+ {
+ iPlayer->PostStringEvent(CMMAPlayerEvent::EError,
+ KMMAVolumeErrorMsg);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMAVolumeControl::RefreshVolume -- ");
+}
+
+void CMMAVolumeControl::RefreshControl()
+{
+ RefreshVolume();
+}
+
+EXPORT_C TInt CMMAVolumeControl::AddLevelL()
+{
+ User::LeaveIfError(iLevels.Append(KMMAVolumeMaxLevel));
+
+ // New level is the last element
+ return iLevels.Count() - 1;
+}
+
+EXPORT_C void CMMAVolumeControl::SetVolumeLevelL(TInt aLevelIndex,
+ TInt aVolumeLevel)
+{
+ LOG2( EJavaMMAPI, EInfo, "CMMAVolumeControl::SetVolumeLevelL - setting index %d, level %d",
+ aLevelIndex, aVolumeLevel);
+ if (0 >= iLevels.Count() || iLevels.Count() > 3)
+ {
+ return ;
+ }
+ TInt oldVolumeLevel = iLevels[ aLevelIndex ];
+ iLevels[ aLevelIndex ] = aVolumeLevel;
+ SetLevelL(CalculateLevel());
+
+ // send event if level is really changed
+ if ((aLevelIndex == KMMAJavaSoundIndex) &&
+ (aVolumeLevel != oldVolumeLevel))
+ {
+ iPlayer->PostObjectEvent(CMMAPlayerEvent::EVolumeChanged,
+ iControlObject);
+ }
+
+ // send event if global volume level is really changed
+ // Error ID AKUR-7G69Q5 GLOBAL VOLUME EVENT CR
+ if ((aLevelIndex == KMMAGlobalVolumeSoundIndex) &&
+ (aVolumeLevel != oldVolumeLevel))
+ {
+
+ iPlayer->PostLongEvent(CMMAPlayerEvent::ENOKIA_EXTERNAL_VOLUME_EVENT,
+ iLevels[ aLevelIndex ]);
+ }
+}
+
+void CMMAVolumeControl::GetVolumeLevelL(TInt aLevelIndex,
+ TInt* aVolumeLevel)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAVolumeControl::GetVolumeLevelL - level index %d", aLevelIndex);
+
+ // Return max volume if the default Java volume level is not yet known
+ if (aLevelIndex == KMMAJavaSoundIndex &&
+ iLevels[ KMMAJavaSoundIndex ] == KErrNotFound)
+ {
+ *aVolumeLevel = KMMAVolumeMaxLevel;
+ return;
+ }
+
+ *aVolumeLevel = iLevels[ aLevelIndex ];
+
+ LOG1( EJavaMMAPI, EInfo, "CMMAVolumeControl::GetVolumeLevelL - level %d", *aVolumeLevel);
+}
+
+TInt CMMAVolumeControl::CalculateLevel()
+{
+ TInt levelCount = iLevels.Count();
+
+ // 64 bit integer must be used to have more than 4 levels.
+ TInt64 level = KMMAVolumeMaxLevel;
+ TInt64 sum = 1;
+
+ // All levels in the array are percentage of the max volume (0..100).
+ // Actual sound level will be multiplying all levels.
+ for (TInt i = 0; i < levelCount; i++)
+ {
+ // If the level is not known it is expected to be max volume
+ level = (iLevels[ i ] == KErrNotFound ?
+ level * KMMAVolumeMaxLevel :
+ level * iLevels[ i ]);
+ sum *= KMMAVolumeMaxLevel;
+ }
+ return level / sum;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/controlcontainer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains ControlContainer JNI functions
+*
+*/
+
+#include <logger.h>
+#include "com_nokia_microedition_media_ControlContainer.h"
+
+#include "cmmaplayer.h"
+#include "cmmacontrol.h"
+#include "s60commonutils.h"
+
+using namespace java::util;
+
+//#include "mmapiutils.h"
+//#include "jutils.h"
+
+
+/**
+ * JNI function
+ */
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlClassName
+(JNIEnv* aJni, jclass,
+ jint aControlHandle)
+{
+ CMMAControl* control =
+ reinterpret_cast< CMMAControl* >(aControlHandle);
+
+ const TDesC& className = control->ClassName();
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getControlClassName name = %S",
+ className.Ptr());
+
+ // Create Java String from class name and return it
+ return (className == KNullDesC) ? NULL : S60CommonUtils::NativeToJavaString(*aJni, className);
+}
+
+/**
+ * JNI function
+ */
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_ControlContainer__1getPublicControlClassName
+(JNIEnv* aJni, jclass,
+ jint aControlHandle)
+{
+ CMMAControl* control =
+ reinterpret_cast< CMMAControl* >(aControlHandle);
+
+ const TDesC& className = control->PublicClassName();
+
+ LOG1( EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getPublicControlClassName name = %S",
+ className.Ptr());
+
+ // Create Java String from class name and return it
+ return (className == KNullDesC) ? NULL : S60CommonUtils::NativeToJavaString(*aJni, className);
+}
+
+/**
+ * JNI function
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlsCount
+(JNIEnv*, jclass,
+ jint aPlayerHandle)
+{
+ CMMAPlayer* player =
+ reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
+ LOG1( EJavaMMAPI, EInfo, "MMA::ControlContainer.cpp::getControlsCount count = %d",
+ player->ControlCount());
+ return player->ControlCount();
+}
+
+/**
+ * JNI function
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ControlContainer__1getControlHandle
+(JNIEnv*, jclass,
+ jint aPlayerHandle, jint aControlIndex)
+{
+ CMMAPlayer* player =
+ reinterpret_cast< CMMAPlayer *>(aPlayerHandle);
+
+ // Get control and make Java handle
+ return reinterpret_cast<TInt>(player->Control(aControlIndex));
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/controlimpl.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAControl
+*
+*/
+
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+
+#include "com_nokia_microedition_media_control_ControlImpl.h"
+#include "mmafunctionserver.h"
+#include "cmmacontrol.h"
+
+/*
+ * Class: com_nokia_microedition_media_control_ControlImpl
+ * Method: _setHandle
+ */
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_ControlImpl__1setHandle
+(JNIEnv* aJni, jclass , jint aEventSource, jint aControlHandle, jobject aControlObject)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAControl* control =
+ reinterpret_cast< CMMAControl* >(aControlHandle);
+ jobject controlObject = aJni->NewWeakGlobalRef(aControlObject);
+
+ eventSource->ExecuteV(&CMMAControl::StaticSetHandle,
+ control, controlObject);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/display.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,18 @@
+#include "logger.h"
+#include "com_nokia_microedition_media_control_BaseDisplay.h"
+#include "cmmadisplay.h"
+
+/*
+ * Class: com_nokia_microedition_media_control_BaseDisplay
+ * Method: _setVisible
+ * Signature: (IIZ)I
+ */
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_BaseDisplay__1nativeMethodCallInUiThread
+ (JNIEnv *, jobject, jint nativeDisplayHandle, jint nativeFunctionID)
+ {
+ LOG(EJavaMMAPI,EInfo,"JNI_Display.cpp : nativeMethodCallInUiThread +");
+ CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
+ display ->CalledBackInUiThread(nativeFunctionID);
+ LOG(EJavaMMAPI,EInfo,"JNI_Display.cpp : nativeMethodCallInUiThread -");
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/framepositioningcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAFramePositioningControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_FramePositioningControl.h"
+#include "mmafunctionserver.h"
+#include "cmmaframepositioningcontrol.h"
+#include <logger.h>
+
+/**
+ * Local function which can be used to call CMMAFramePositioningControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMAFramePositioningControl::aFunc( TInt )
+ *
+ * @param aFramePositioningControl CMMAFramePositioningControl pointer.
+ * @param aFuncL Pointer to the CMMAFramePositioningControl method.
+ * @param aParam Parameter value for aFuncL method.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntFuncIntL(CMMAFramePositioningControl* aFramePositioningControl,
+ TInt(CMMAFramePositioningControl::*aFuncL)(TInt aParam),
+ TInt aParam,
+ TInt* aReturnValue)
+{
+ // call TInt CMMAFramePositioningControl::aFunc( TInt ) method.
+ *aReturnValue = (aFramePositioningControl->*aFuncL)(aParam);
+}
+
+//
+// JNI functions. Prototypes are generated and commented in Java class
+// com_nokia_microedition_media_control_FramePositioningControl
+//
+
+/**
+ * JNI function from com.nokia.microedition.media.control.FramePositioningControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_FramePositioningControl__1seek
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aFrameNumber)
+{
+ LOG( EJavaMMAPI, EInfo, "FramePositioningControl__1seek");
+
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAFramePositioningControl* FramePositioningControl =
+ reinterpret_cast< CMMAFramePositioningControl* >(aControlHandle);
+
+ // Will leave on error. Otherwise returnValue contains frame number
+ // to which the implementation has seeked.
+ TInt returnValue = 0;
+ TInt error = eventSource->ExecuteTrap(&ReturnIntFuncIntL,
+ FramePositioningControl,
+ &CMMAFramePositioningControl::SeekL,
+ aFrameNumber,
+ &returnValue);
+ LOG1( EJavaMMAPI, EInfo, "FramePositioningControl__1seek error= %d",error);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.FramePositioningControl
+ */
+JNIEXPORT jintArray JNICALL
+Java_com_nokia_microedition_media_control_FramePositioningControl__1skip
+(JNIEnv* aJniEnv,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jintArray aValues)
+{
+ LOG( EJavaMMAPI, EInfo, "FramePositioningControl__1skip");
+
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAFramePositioningControl* FramePositioningControl =
+ reinterpret_cast< CMMAFramePositioningControl* >(aControlHandle);
+
+ TInt value[ 2 ];
+ aJniEnv->GetIntArrayRegion(aValues, 0, 2, &value[ 0 ]);
+
+ // Will leave on error. Otherwise returnValue contains number of frames
+ // skipped.
+ value[ 1 ] = eventSource->ExecuteTrap(&ReturnIntFuncIntL,
+ FramePositioningControl,
+ &CMMAFramePositioningControl::SkipL,
+ value[ 0 ],
+ &value[ 0 ]);
+
+ if (aValues)
+ {
+ aJniEnv->SetIntArrayRegion(aValues, 0, 2, &value[ 0 ]);
+ }
+
+ return aValues;
+}
+
+/**
+ * Local function which can be used to call CMMAFramePositioningControl class methods.
+ * Type of of the function pointer must be
+ * void CMMAFramePositioningControl::aFunc( TInt, TInt64* )
+ *
+ * @param aFramePositioningControl CMMAFramePositioningControl pointer.
+ * @param aFuncL Pointer to the CMMAFramePositioningControl method.
+ * @param aParam Parameter value for aFuncL
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void VoidFuncInt64L(CMMAFramePositioningControl* aFramePositioningControl,
+ void (CMMAFramePositioningControl::*aFuncL)(
+ TInt aParam,
+ TInt64* aReturnValue),
+ TInt aParam,
+ TInt64* aReturnValue)
+{
+ // call void CMMAFramePositioningControl::aFunc( TInt, TInt64 ) method.
+ (aFramePositioningControl->*aFuncL)(aParam, aReturnValue);
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.FramePositioningControl
+ */
+JNIEXPORT jlong JNICALL
+Java_com_nokia_microedition_media_control_FramePositioningControl__1mapFrameToTime
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aFrameNumber)
+{
+ LOG( EJavaMMAPI, EInfo, "FramePositioningControl__1mapFrameToTime");
+
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAFramePositioningControl* FramePositioningControl =
+ reinterpret_cast< CMMAFramePositioningControl* >(aControlHandle);
+
+ // Will leave on error. Media time of frame in question.
+ TInt64 returnValue(0);
+ TInt error = eventSource->ExecuteTrap(&VoidFuncInt64L,
+ FramePositioningControl,
+ &CMMAFramePositioningControl::MapFrameToTimeL,
+ aFrameNumber,
+ &returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * Local function which can be used to call CMMAFramePositioningControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMAFramePositioningControl::aFunc( TInt64* )
+ *
+ * @param aFramePositioningControl CMMAFramePositioningControl pointer.
+ * @param aFuncL Pointer to the CMMAFramePositioningControl method.
+ * @param aParam Parameter value for aFuncL method.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntFuncInt64L(CMMAFramePositioningControl* aFramePositioningControl,
+ TInt(CMMAFramePositioningControl::*aFuncL)(TInt64* aParam),
+ TInt64* aParam,
+ TInt* aReturnValue)
+{
+ // call TInt CMMAFramePositioningControl::aFunc() method.
+ *aReturnValue = (aFramePositioningControl->*aFuncL)(aParam);
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.FramePositioningControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_FramePositioningControl__1mapTimeToFrame
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jlong aMediaTime)
+{
+ LOG( EJavaMMAPI, EInfo, "FramePositioningControl__1mapFrameToTime");
+
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAFramePositioningControl* FramePositioningControl =
+ reinterpret_cast< CMMAFramePositioningControl* >(aControlHandle);
+
+ // Will leave on error. Media time of frame in question.
+ TInt returnValue = 0;
+ TInt error = eventSource->ExecuteTrap(&ReturnIntFuncInt64L,
+ FramePositioningControl,
+ &CMMAFramePositioningControl::MapTimeToFrameL,
+ &aMediaTime,
+ &returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/itemdisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAItemDisplay
+*
+*/
+
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+#include "com_nokia_microedition_media_control_VideoItem.h"
+#include "mmafunctionserver.h"
+#include "cmmaitemdisplay.h"
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1sizeChanged
+(JNIEnv*, jobject,
+ jint aEventSourceHandle,
+ jint aDisplayHandle,
+ jint aWidth,
+ jint aHeight)
+{
+ CMMAItemDisplay* itemDisplay = reinterpret_cast< CMMAItemDisplay* >(aDisplayHandle);
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ __ASSERT_DEBUG(itemDisplay != NULL,
+ User::Panic(_L("itemdisplay::control is null"),
+ KErrArgument));
+ __ASSERT_DEBUG(eventSource != NULL,
+ User::Panic(_L("itemdisplay::eventsource is null"),
+ KErrArgument));
+
+ TInt err = eventSource->ExecuteTrap(&CMMAItemDisplay::SizeChangedL,
+ itemDisplay,
+ aWidth,
+ aHeight);
+
+ return err;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getMinContentWidth
+(JNIEnv*, jobject,
+ jint aEventSourceHandle,
+ jint aDisplayHandle)
+{
+ CMMAItemDisplay* itemDisplay = reinterpret_cast< CMMAItemDisplay* >(aDisplayHandle);
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ TSize size;
+ eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
+ itemDisplay,
+ (TSize*)&size);
+ return size.iWidth;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getMinContentHeight
+(JNIEnv*, jobject,
+ jint aEventSourceHandle,
+ jint aDisplayHandle)
+{
+ CMMAItemDisplay* itemDisplay = reinterpret_cast< CMMAItemDisplay *>(aDisplayHandle);
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ TSize size;
+ eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
+ itemDisplay,
+ (TSize*)&size);
+ return size.iHeight;
+}
+
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getPrefContentHeight
+(JNIEnv*, jobject,
+ jint aEventSourceHandle,
+ jint aDisplayHandle,
+ jint /*aTentative*/) // tentative value is ignored because current
+// implementation returns always -1
+{
+ CMMAItemDisplay* itemDisplay = reinterpret_cast< CMMAItemDisplay* >(aDisplayHandle);
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ TSize size;
+ eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
+ itemDisplay,
+ (TSize*)&size);
+ return size.iHeight;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoItem__1getPrefContentWidth
+(JNIEnv*, jobject,
+ jint aEventSourceHandle,
+ jint aDisplayHandle,
+ jint /*aTentative*/) // tentative value is ignored because current
+// implementation returns always -1
+{
+ CMMAItemDisplay* itemDisplay = reinterpret_cast< CMMAItemDisplay *>(aDisplayHandle);
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ TSize size;
+ eventSource->ExecuteV(CMMAItemDisplay::StaticSourceSize,
+ itemDisplay,
+ (TSize*)&size);
+ return size.iWidth;
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/managerimpl.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,261 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has ManagerImpl JNI functions
+*
+*/
+
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+#include "com_nokia_microedition_media_ManagerImpl.h"
+#include "cmmamanager.h"
+#include "cmmaplayer.h"
+#include "jstringutils.h"
+#include "s60commonutils.h"
+using namespace java::util;
+
+const TInt KMMADefaultArrayGranularity = 8;
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_ManagerImpl__1dispose
+(JNIEnv* aJni, jobject, jint aEventSourceHandle)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA::ManagerImpl dispose");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ delete eventSource;
+}
+
+LOCAL_C void ReleaseEventSource(MMAFunctionServer* aEventSource)
+{
+ aEventSource->Release();
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_ManagerImpl__1release
+(JNIEnv*, jobject, jint aEventSourceHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::ManagerImpl release");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ eventSource->ExecuteV(&ReleaseEventSource,
+ eventSource);
+}
+
+/*
+ * Class: javax_microedition_media_Manager
+ * Method: _createManager
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ManagerImpl__1createManager
+(JNIEnv*, jobject, jint aEventSourceHandle, jint aMIDletSuiteID)
+{
+ MMAFunctionServer* eventSource = reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CMMAManager* manager = NULL;
+ TInt error = eventSource->ExecuteTrap(&CMMAManager::StaticCreateManagerL,
+ &manager,
+ aMIDletSuiteID);
+ ELOG1( EJavaMMAPI, "MMA::ManagerImpl createManager StaticCreateManagerL %d",
+ error);
+ if (error != KErrNone)
+ {
+ return error;
+ }
+
+ TInt managerHandle( reinterpret_cast<TInt>(manager));
+
+ error = eventSource->ExecuteTrap(MMAFunctionServer::StaticAddObjectFromHandleL,
+ eventSource,
+ managerHandle);
+
+ ELOG1( EJavaMMAPI, "MMA::ManagerImpl createManager StaticAddObjectFromHandleL %d",
+ error);
+
+ if (error != KErrNone)
+ {
+ // Adding manager to event source failed.
+ delete manager;
+
+ // Error code will be returned to java
+ managerHandle = error;
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA::ManagerImpl createManager %d",
+ managerHandle);
+ return managerHandle;
+}
+
+
+LOCAL_C void InvokeConstructSvrL(MMAFunctionServer* aEventSource)
+{
+ aEventSource->ConstructSvrL();
+}
+
+/*
+ * Class: javax_microedition_media_Manager
+ * Method: _getEventSource
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_ManagerImpl__1createEventSource
+(JNIEnv* aJni, jobject aPeer)
+{
+ TInt eventSourceHandle = MMAFunctionServer::NewL(*aJni, aPeer);
+ if (eventSourceHandle > KErrNone)
+ {
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(eventSourceHandle);
+
+ // third phase construction
+ TInt error = eventSource->ExecuteTrap(&InvokeConstructSvrL,
+ eventSource);
+ if (error != KErrNone)
+ {
+ eventSourceHandle = error;
+ }
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA::ManagerImpl createEventSource %d",
+ eventSourceHandle);
+ return eventSourceHandle;
+}
+
+/**
+ * Local function which can be used to call CMMAManager class methods.
+ * Type of of the function pointer must be
+ * void CMMAManager::aFuncL( RPointerArray< HBufC >&, const TDesC& )
+ * Java String array will be created and set to aArray variable.
+ *
+ * @param aManager CMMAManager instance.
+ * @param aFuncL Pointer to the CMMAManager method.
+ * @param aJni Used to create an array.
+ * @param aArray Values got from aFuncL will be copied to this array.
+ * @param aParam Parameter that will be passed to aFuncL method.
+ */
+LOCAL_C void GetObjectArrayL(MMAFunctionServer* aEventSource,
+ CMMAManager* aManager,
+ void (CMMAManager::*aFuncL)(const TDesC&,
+ CDesC16Array&),
+ JNIEnv* aJni,
+ jobjectArray* aArray,
+ const TDesC* aParam)
+{
+ // Temporary descriptor array to be copied to Java array.
+ CDesC16ArrayFlat* values = new(ELeave) CDesC16ArrayFlat(
+ KMMADefaultArrayGranularity);
+ CleanupStack::PushL(values);
+
+ // Call void CMMAManager::aFuncL( const TDesC&, RPointerArray< HBufC >& )
+ // method. Method can leave.
+ // Elements of the array will be owned by this method.
+ (aManager->*aFuncL)(*aParam, *values);
+
+ // JNI interface pointer can't be passed to different thread, so
+ // it is needed to get valid JNI interface pointer for Event Server thread
+ aJni =aEventSource->getValidJniEnv();
+
+ // Create new java String array and copy values from the values array
+ *aArray = MMAPIUtils::CopyToNewJavaStringArrayL(*aJni, *values);
+ CleanupStack::PopAndDestroy(values);
+}
+
+
+/*
+ * Class: javax_microedition_media_Manager
+ * Method: _getSupportedContentTypes
+ * Signature: (II)[[B
+ */
+JNIEXPORT jobjectArray JNICALL Java_com_nokia_microedition_media_ManagerImpl__1getSupportedContentTypes
+(JNIEnv* aJni,
+ jclass,
+ jint aEventSourceHandle,
+ jint aManagerHandle,
+ jstring aProtocol)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer * >(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager *>(aManagerHandle);
+
+ jobjectArray contentTypes = NULL;
+
+ // Create descritor from Java String.
+ // JStringUtils is derived from TPtrC16 and is save to cast to TDesC
+ JStringUtils tmp(*aJni, aProtocol);
+ const TDesC* protocol = &tmp;
+ if (aProtocol == NULL)
+ {
+ protocol = &KNullDesC;
+ }
+
+ // Call manager->GetSupportedContentTypesL and create Java array.
+ TInt err = eventSource->ExecuteTrap(&GetObjectArrayL,
+ eventSource,
+ manager,
+ &CMMAManager::GetSupportedContentTypesL,
+ aJni,
+ &contentTypes,
+ protocol);
+
+ if (err != KErrNone)
+ {
+ // Something failed. Returning NULL, because contentTypes array may not
+ // be complete. contentTypes array is left for carbage collertor,
+ // because it can't be released.
+ return NULL;
+ }
+ return contentTypes;
+}
+
+/*
+ * Class: javax_microedition_media_Manager
+ * Method: _getSupportedProtocols
+ * Signature: (II)[[B
+ */
+JNIEXPORT jobjectArray JNICALL Java_com_nokia_microedition_media_ManagerImpl__1getSupportedProtocols
+(JNIEnv* aJni,
+ jclass,
+ jint aEventSourceHandle,
+ jint aManagerHandle,
+ jstring aContentType)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager *>(aManagerHandle);
+
+ jobjectArray protocols = NULL;
+
+ // Create descritor from Java String.
+ // JStringUtils is derived from TPtrC16 and is save to cast to TDesC
+ JStringUtils tmp(*aJni, aContentType);
+ const TDesC* contentType = &tmp;
+ if (aContentType == NULL)
+ {
+ contentType = &KNullDesC;
+ }
+
+ // Call manager->GetSupportedProtocolsL and create Java array.
+ TInt err = eventSource->ExecuteTrap(&GetObjectArrayL,
+ eventSource,
+ manager,
+ &CMMAManager::GetSupportedProtocolsL,
+ aJni,
+ &protocols,
+ contentType);
+ if (err != KErrNone)
+ {
+ // Something failed. Returning NULL, because contentTypes array may not
+ // be complete. contentTypes array is left for carbage collertor,
+ // because it can't be released.
+ return NULL;
+ }
+ return protocols;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/metadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAMetaDataControl
+*
+*/
+
+
+#include <logger.h>
+#include "com_nokia_microedition_media_control_MetaDataControl.h"
+
+#include "mmafunctionserver.h"
+#include "cmmametadatacontrol.h"
+#include "s60commonutils.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+//#include "mmapiutils.h"
+
+
+/* ...getKeyCount
+ *
+ * Returns the number of metadata keys or symbian error code
+ */
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_MetaDataControl__1getKeysCount
+(JNIEnv* /*aJniEnv*/, jobject, jint aEventSourceHandle, jint aMetaDataControlHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAMetaDataControl* metaDataControl =
+ reinterpret_cast< CMMAMetaDataControl* >(aMetaDataControlHandle);
+
+ TInt keys;
+ TInt err = eventSource->ExecuteTrap(&CMMAMetaDataControl::StaticKeysCountL, metaDataControl, &keys);
+
+ return err == KErrNone ? keys : err;
+}
+
+
+/* ... getKey
+ *
+ * Get the key name at the given index from the actual native implementation. If no key is available,
+ * return null.
+ *
+ * The ownership of the native data is received from the actual native implementation.
+ * The data is duplicated to the Java side and the native data is destroyed here.
+ */
+
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_control_MetaDataControl__1getKey
+(JNIEnv* aJniEnv, jobject, jint aEventSourceHandle, jint aMetaDataControlHandle, jint aIndex)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAMetaDataControl* metaDataControl =
+ reinterpret_cast< CMMAMetaDataControl* >(aMetaDataControlHandle);
+
+ HBufC* key = NULL;
+ jstring javaStr = NULL;
+
+ TInt err = eventSource->ExecuteTrap(&CMMAMetaDataControl::StaticKeyL, metaDataControl, &key, aIndex);
+
+ if (err == KErrNone)
+ {
+ javaStr = S60CommonUtils::NativeToJavaString(*aJniEnv, key->Des());
+ }
+ delete key;
+
+ return javaStr;
+}
+
+/* ...getKeyValue
+ *
+ * Get the value of the given key from the actual native implementation. If no key is available,
+ * return null (as specified in the MetaDataControl interface).
+ *
+ * The ownership of the native data is received from the actual native implementation.
+ * The data is duplicated to the Java side and the native data is destroyed here.
+ */
+
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_control_MetaDataControl__1getKeyValue
+(JNIEnv* aJniEnv, jobject, jint aEventSourceHandle, jint aMetaDataControlHandle, jstring aKey)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMetaDataControl* metaDataControl =
+ reinterpret_cast< CMMAMetaDataControl* >(aMetaDataControlHandle);
+
+ HBufC* value = NULL;
+ JStringUtils key(*aJniEnv, aKey);
+
+ TInt retVal = eventSource->ExecuteTrap(
+ &CMMAMetaDataControl::StaticKeyValueL,
+ metaDataControl,
+ &value,
+ (TDesC*) &key);
+
+ jstring retString = NULL;
+
+ if (KErrNone == retVal)
+ {
+ retString = S60CommonUtils::NativeToJavaString(*aJniEnv, *value);
+ }
+
+ delete value;
+
+ return retString;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/midicontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAMIDIControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_MIDIControl.h"
+#include "mmafunctionserver.h"
+#include "cmmamidicontrol.h"
+#include <logger.h>
+
+/**
+ * Local function which is used to call CMMAMIDIControl class method.
+ * Type of of the function pointer must be
+ * void CMMAMIDIControl::aFunc( TInt, TInt, TInt )
+ *
+ * @param aMIDIControl CMMAMIDIControl pointer.
+ * @param aFunc Pointer to the CMMAMIDIControl method.
+ * @param aParam1 Parameter passed to the aFunc.
+ * @param aParam2 Parameter passed to the aFunc.
+ * @param aParam3 Parameter passed to the aFunc.
+ */
+LOCAL_C void ReturnVoidParam3IntFuncL(
+ CMMAMIDIControl* aMIDIControl,
+ void (CMMAMIDIControl::*aFuncL)(TInt, TInt, TInt),
+ TInt aParam1,
+ TInt aParam2,
+ TInt aParam3)
+{
+ // call TInt CMMAMIDIControl::aFunc( TInt, TInt, TInt ) method.
+ (aMIDIControl->*aFuncL)(aParam1, aParam2, aParam3);
+}
+
+/**
+ * Implements generated JNI function prototype.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_MIDIControl__1setProgram
+(
+ JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aChannel,
+ jint aBank,
+ jint aProgram)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDIControl* midiControl =
+ reinterpret_cast< CMMAMIDIControl *>(aControlHandle);
+
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnVoidParam3IntFuncL,
+ midiControl,
+ &CMMAMIDIControl::SetProgramL,
+ aChannel,
+ aBank,
+ aProgram);
+
+ return error;
+}
+
+/**
+ * Local function which is used to call CMMAMIDIControl class method.
+ * Type of of the function pointer must be
+ * TInt CMMAMIDIControl::aFunc( TInt )
+ *
+ * @param aMIDIControl CMMAMIDIControl pointer.
+ * @param aFunc Pointer to the CMMAMIDIControl method.
+ * @param aData Parameter passed to the aFunc.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntParamIntFuncL(
+ CMMAMIDIControl* aMIDIControl,
+ TInt(CMMAMIDIControl::*aFuncL)(TInt aData),
+ TInt aData,
+ TInt* aReturnValue)
+{
+ // call TInt CMMAMIDIControl::aFunc( TDesC* aData ) method.
+ *aReturnValue = (aMIDIControl->*aFuncL)(aData);
+}
+
+/**
+ * Implements generated JNI function prototype.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_MIDIControl__1getChannelVolume
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aChannel)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+ CMMAMIDIControl* midiControl =
+ reinterpret_cast< CMMAMIDIControl *>(aControlHandle);
+
+
+ TInt returnValue = 0;
+ TInt error;
+
+ error = eventSource->ExecuteTrap(&ReturnIntParamIntFuncL,
+ midiControl,
+ &CMMAMIDIControl::ChannelVolumeL,
+ aChannel,
+ &returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * Local function which is used to call CMMAMIDIControl class method.
+ * Type of of the function pointer must be
+ * void CMMAMIDIControl::aFunc( TInt, TInt )
+ *
+ * @param aMIDIControl CMMAMIDIControl pointer.
+ * @param aFunc Pointer to the CMMAMIDIControl method.
+ * @param aParam1 Parameter passed to the aFunc.
+ * @param aParam2 Parameter passed to the aFunc.
+ */
+LOCAL_C void ReturnVoidParamIntIntFuncL(
+ CMMAMIDIControl* aMIDIControl,
+ void (CMMAMIDIControl::*aFuncL)(TInt, TInt),
+ TInt aParam1,
+ TInt aParam2)
+{
+ // call TInt CMMAMIDIControl::aFunc( TInt, TInt ) method.
+ (aMIDIControl->*aFuncL)(aParam1, aParam2);
+}
+
+/**
+ * Implements generated JNI function prototype.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_MIDIControl__1setChannelVolume
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aChannel,
+ jint aVolume)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDIControl* midiControl =
+ reinterpret_cast< CMMAMIDIControl *>(aControlHandle);
+
+ TInt error = eventSource->ExecuteTrap(&ReturnVoidParamIntIntFuncL,
+ midiControl,
+ &CMMAMIDIControl::SetChannelVolumeL,
+ aChannel,
+ aVolume);
+
+ return error;
+}
+
+/**
+ * Local function which can be used to call CMMAMIDIControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMAMIDIControl::aFunc( TDesC* aData )
+ *
+ * @param aMIDIControl CMMAMIDIControl pointer.
+ * @param aFunc Pointer to the CMMAMIDIControl method.
+ * @param aData Parameter passed to the aFunc.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void SendMIDIEventFuncL(
+ CMMAMIDIControl* aMIDIControl,
+ TInt(CMMAMIDIControl::*aFuncL)(const TDesC8* aData),
+ const TDesC8* aData,
+ TInt* aReturnValue)
+{
+ // call TInt CMMAMIDIControl::aFunc( TDesC* aData ) method.
+ *aReturnValue = (aMIDIControl->*aFuncL)(aData);
+}
+
+/**
+ * Implements generated JNI function prototype.
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_MIDIControl__1sendMidiEvent
+(JNIEnv* aJni,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jbyteArray aData,
+ jint aOffset,
+ jint aLength)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAMIDIControl* midiControl =
+ reinterpret_cast< CMMAMIDIControl* >(aControlHandle);
+
+ // Get pointer to Java data
+ jbyte* data = aJni->GetByteArrayElements(aData, NULL);
+
+ // Assert only in debug builds, array size must be checked in Java.
+ __ASSERT_DEBUG(aJni->GetArrayLength(aData) >= aOffset + aLength &&
+ aOffset >= 0 &&
+ aLength > 0,
+ User::Invariant());
+
+ // Create descriptor from Java data starting from offset
+ jbyte* tempJbyte = &data[ aOffset ];
+ TUint8* tempPtr = (TUint8*) tempJbyte;
+ TPtrC8 dataPtr(tempPtr, aLength);
+
+ TInt returnValue = 0;
+
+ TInt err = eventSource->ExecuteTrap(&SendMIDIEventFuncL,
+ midiControl,
+ &CMMAMIDIControl::SendMIDIEventL,
+ (const TDesC8*)(&dataPtr),
+ &returnValue);
+
+ // Java bytes are not needed anymore
+ aJni->ReleaseByteArrayElements(aData, data, 0);
+
+ if (err != KErrNone)
+ {
+ // return error code to Java
+ returnValue = err;
+ }
+
+ return returnValue;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_MIDIControl__1reInitializeMidi
+(JNIEnv* aJni,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jbyteArray aMidiSequence,
+ jint aOffset,
+ jint aLength)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAMIDIControl* midiControl =
+ reinterpret_cast< CMMAMIDIControl* >(aControlHandle);
+
+ // Assert only in debug builds, array size must be checked in Java.
+ __ASSERT_DEBUG(aJni->GetArrayLength(aMidiSequence) >= aOffset + aLength &&
+ aOffset >= 0 &&
+ aLength > 0,
+ User::Invariant());
+
+ // Get pointer to Java data
+ jbyte* data = aJni->GetByteArrayElements(aMidiSequence, NULL);
+
+ // Create descriptor from Java data starting from offset
+ jbyte* tempJbyte = &data[ aOffset ];
+ TUint8* tempPtr = (TUint8*) tempJbyte;
+ TPtrC8 dataPtr(tempPtr, aLength);
+
+ // SendMIDIEventFuncL has suitable enough footprint for this call too.
+ // Return value is not used but needs to be there for method footprint.
+
+ TInt returnValue = 0;
+ TInt err = eventSource->ExecuteTrap(&SendMIDIEventFuncL,
+ midiControl,
+ &CMMAMIDIControl::ReInitializeMidiL,
+ (const TDesC8*)(&dataPtr),
+ &returnValue);
+
+ // Release Java bytes
+ aJni->ReleaseByteArrayElements(aMidiSequence, data, 0);
+ return err;
+}
+
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/mmafunctionserver.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,245 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class provides CJavaEventSource services
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h> // DEBUG
+#include <coemain.h>
+#include <eikenv.h>
+
+#include "mmafunctionserver.h"
+#include "cmmaevent.h"
+#include "cmmaplayer.h"
+#include "mmmaplayerinstanceobserver.h"
+#ifdef RD_JAVA_VOLUME_CONTROL
+#include "cmmaglobalvolume.h"
+#endif // RD_JAVA_VOLUME_CONTROL
+
+MMAFunctionServer::MMAFunctionServer(JNIEnv& aJni, jobject aPeer): java::util::FunctionServer("JavaMMAPIFunctionServer")
+{
+ LOG( EJavaMMAPI, EInfo, "++MMAFunctionServer::MMAFunctionServer");
+ createServerToNewThread();
+ attachToVm(aJni, aPeer);
+ mVmAttached = true;
+ iServer = reinterpret_cast<java::util::FunctionServer*>(this);
+}
+
+MMAFunctionServer::~MMAFunctionServer()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::~MMAFunctionServer()");
+ if (mVmAttached)
+ {
+ detachFromVm();
+ }
+ stopServer();
+#ifdef RD_JAVA_VOLUME_CONTROL
+ delete iGlobalVolume;
+#endif // RD_JAVA_VOLUME_CONTROL
+}
+
+TInt MMAFunctionServer::NewL(JNIEnv& aJni, jobject aPeer)
+{
+
+ MMAFunctionServer* self = new(ELeave) MMAFunctionServer(aJni,aPeer);
+ self->ConstructL(aJni,aPeer);
+ return reinterpret_cast<TInt>(self);
+}
+void MMAFunctionServer::ConstructL(JNIEnv& aJni,
+ jobject aPeer
+ )
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::ConstructL +");
+ aJni.GetJavaVM(&iJavaVM); // Get pointer to VM
+ LOG( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::ConstructL -");
+}
+
+java::util::FunctionServer* MMAFunctionServer::getFunctionServer() const
+{
+ LOG( EJavaMMAPI, EInfo, "++getFunctionServer1");
+ JELOG2(EJavaMMAPI);
+ return iServer;
+}
+JNIEnv* MMAFunctionServer::getValidJniEnv()
+ {
+ JELOG2(EJavaLocation);
+ return mJniEnv;
+ }
+jobject MMAFunctionServer::getPeer()
+ {
+ return mJavaPeerObject;
+ }
+
+void MMAFunctionServer::ConstructSvrL()
+{
+ // creating fbs session
+ User::LeaveIfError(RFbsSession::Connect());
+ iFbsSessionConnected = ETrue;
+ LOG( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::ConstructSvrL ok");
+}
+
+EXPORT_C void MMAFunctionServer::StaticAddObjectFromHandleL(
+ MMAFunctionServer* aEventSource,
+ TInt aHandle)
+{
+ aEventSource->AddObjectFromHandleL(aHandle);
+}
+
+void MMAFunctionServer::AddPlayerL(CMMAPlayer* aPlayer)
+{
+ if (iInstanceObserver)
+ {
+ iInstanceObserver->AddPlayerNotifyL(aPlayer);
+ }
+#ifdef RD_JAVA_VOLUME_CONTROL
+ if (iGlobalVolume)
+ {
+ iGlobalVolume->AddPlayerL(aPlayer);
+ }
+#endif // RD_JAVA_VOLUME_CONTROL
+ TInt err = iPlayers.Append(aPlayer);
+
+ if (err != KErrNone)
+ {
+ // There was no memory to add new player to array,
+ // player must be removed from instance observer.
+ if (iInstanceObserver)
+ {
+ iInstanceObserver->RemovePlayerNotify(aPlayer);
+ }
+#ifdef RD_JAVA_VOLUME_CONTROL
+ if (iGlobalVolume)
+ {
+ iGlobalVolume->RemovePlayer(aPlayer);
+ }
+#endif // RD_JAVA_VOLUME_CONTROL
+ User::Leave(err);
+ }
+}
+
+void MMAFunctionServer::DisposePlayer(CMMAPlayer* aPlayer)
+{
+ TInt index = iPlayers.Find(aPlayer);
+ if (index != KErrNotFound)
+ {
+ if (iInstanceObserver)
+ {
+ iInstanceObserver->RemovePlayerNotify(aPlayer);
+ }
+#ifdef RD_JAVA_VOLUME_CONTROL
+ if (iGlobalVolume)
+ {
+ iGlobalVolume->RemovePlayer(aPlayer);
+ }
+#endif // RD_JAVA_VOLUME_CONTROL
+ delete iPlayers[ index ];
+
+ // remove object from list
+ iPlayers.Remove(index);
+ }
+}
+
+EXPORT_C void MMAFunctionServer::SetPlayerInstanceObserver(
+ MMMAPlayerInstanceObserver* aObserver)
+{
+ iInstanceObserver = aObserver;
+}
+
+EXPORT_C RPointerArray< CMMAPlayer >& MMAFunctionServer::Players()
+{
+ return iPlayers;
+}
+
+void MMAFunctionServer::Release()
+{
+ // If player instance observer is added to event source, remove all
+ // players from observer before deleting those.
+ if (iInstanceObserver)
+ {
+ for (TInt i = 0; i < iPlayers.Count(); i++)
+ {
+ iInstanceObserver->RemovePlayerNotify(iPlayers[ i ]);
+#ifdef RD_JAVA_VOLUME_CONTROL
+ if (iGlobalVolume)
+ {
+ iGlobalVolume->RemovePlayer(iPlayers[ i ]);
+ }
+#endif // RD_JAVA_VOLUME_CONTROL
+ }
+ }
+
+ iPlayers.ResetAndDestroy();
+}
+
+void MMAFunctionServer::AddObjectFromHandleL(TInt aHandle)
+{
+ User::LeaveIfError(iObjects.Append(reinterpret_cast< CBase* >(aHandle)));
+}
+
+
+void MMAFunctionServer::FinalizeSvr()
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::FinalizeSvr() object count = %d",
+ iObjects.Count());
+ LOG1( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::FinalizeSvr() player count = %d",
+ iPlayers.Count());
+
+ // After object array alements are deleted all external references to
+ // player objects are removed and player array can be deleted.
+ iObjects.ResetAndDestroy();
+ iPlayers.ResetAndDestroy();
+
+ if (iFbsSessionConnected)
+ {
+ RFbsSession::Disconnect();
+ iFbsSessionConnected = EFalse;
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::MMAFunctionServer::FinalizeSvr() ok");
+}
+
+
+void MMAFunctionServer::PostEvent(CMMAEvent* aEvent, TInt /*aPriority*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMAFunctionServer::PostEvent");
+ aEvent->Dispatch(*mJniEnv);
+}
+
+CMMAPlayer* MMAFunctionServer::FindPlayer(TInt aPlayerHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "MMAFunctionServer::FindPlayer");
+ CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayerHandle);
+ TInt index = iPlayers.Find(player);
+ if (index != KErrNotFound)
+ {
+ player = iPlayers[ index ];
+ LOG( EJavaMMAPI, EInfo, "MMAFunctionServer::FindPlayer: player found");
+ }
+ else
+ {
+ LOG( EJavaMMAPI, EInfo, "MMAFunctionServer::FindPlayer: player not found");
+ player = NULL;
+ }
+ return player;
+}
+#ifdef RD_JAVA_VOLUME_CONTROL
+void MMAFunctionServer::SetGlobalVolume(CMMAGlobalVolume* aGlobalVolume)
+{
+ delete iGlobalVolume;
+ iGlobalVolume = aGlobalVolume;
+}
+#endif // RD_JAVA_VOLUME_CONTROL
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/nativeplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has NativePlayerFactory JNI functions
+*
+*/
+
+#include <logger.h>
+
+#include "com_nokia_microedition_media_NativePlayerFactory.h"
+#include "cmmamanager.h"
+#include "cmmaplayer.h"
+
+#include "s60commonutils.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+/**
+ * Adds player to event source. If player could not be created
+ * handle KErrNone indicates in Java side that there wasn't suitable factory.
+ */
+LOCAL_C void HandleCreatePlayerL(CMMAPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ TInt* aHandle)
+{
+ if (aPlayer)
+ {
+ // Player was created, add it to event source
+ CleanupStack::PushL(aPlayer);
+ aEventSource->AddPlayerL(aPlayer);
+ *aHandle = reinterpret_cast<TInt>(aPlayer);
+ CleanupStack::Pop(aPlayer);
+ }
+ else
+ {
+ // Data was not supported and there is no error.
+ // Return KErrNone to java side
+ *aHandle = KErrNone;
+ }
+}
+
+/**
+ * Local function that calls CMMAManager's CreatePlayerL method.
+ */
+LOCAL_C void CreatePlayerHeaderDataL(CMMAManager* aManager,
+ MMAFunctionServer* aEventSource,
+ const TDesC8* aHeaderData,
+ TInt* aHandle)
+{
+ HandleCreatePlayerL(aManager->CreatePlayerL(*aHeaderData),
+ aEventSource,
+ aHandle);
+}
+
+/**
+ * JNI function from NativePlayerFactory class.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_NativePlayerFactory__1createPlayerHeaderData
+(JNIEnv* aJni, jclass,
+ jint aEventSourceHandle, jint aManagerHandle,
+ jbyteArray aHeaderData)
+{
+ // Development time check.
+ __ASSERT_DEBUG((aEventSourceHandle > 0) && (aManagerHandle > 0), User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager *>(aManagerHandle);
+
+ // Returning just KErrNone if there is no header data
+ TInt playerHandle = KErrNone;
+ if (aHeaderData)
+ {
+ // Get pointer to Java header data
+ jbyte* data = aJni->GetByteArrayElements(aHeaderData, NULL);
+ // if data is null Java data could not be obtained to native and
+ // KErrNoMemory is returned to Java
+ if (!data)
+ {
+ return KErrNoMemory;
+ }
+
+ TInt headerDataLength = aJni->GetArrayLength(aHeaderData);
+ TPtrC8 headerData((TUint8*)data, headerDataLength);
+ TInt err = eventSource->ExecuteTrap(&CreatePlayerHeaderDataL,
+ manager,
+ eventSource,
+ (const TDesC8*)&headerData,
+ &playerHandle);
+
+ // release bytes got with GetByteArrayElements
+ aJni->ReleaseByteArrayElements(aHeaderData,
+ data,
+ 0);
+ if (err != KErrNone)
+ {
+ // Leave occured return error code to Java
+ playerHandle = err;
+ ELOG1( EJavaMMAPI, "MMA::NativePlayerFactory createPlayerHeaderData err %d",
+ playerHandle);
+ }
+ }
+ return playerHandle;
+}
+
+/**
+ * Local function that calls CMMAManager's CreatePlayerL method.
+ */
+LOCAL_C void CreatePlayerLocatorL(CMMAManager* aManager,
+ MMAFunctionServer* aEventSource,
+ const TDesC* aProtocol,
+ const TDesC* aMiddlePart,
+ const TDesC* aParameters,
+ TInt* aHandle)
+{
+ HandleCreatePlayerL(aManager->CreatePlayerL(*aProtocol,
+ *aMiddlePart,
+ *aParameters),
+ aEventSource,
+ aHandle);
+}
+
+/**
+ * JNI function from NativePlayerFactory class.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_NativePlayerFactory__1createPlayerLocator
+(JNIEnv* aJni, jclass,
+ jint aEventSourceHandle, jint aManagerHandle,
+ jstring aProtocol, jstring aMiddlePart, jstring aParameters)
+{
+ // Development time check.
+ __ASSERT_DEBUG((aEventSourceHandle > 0) && (aManagerHandle > 0), User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager *>(aManagerHandle);
+
+ // Get Java strings to native
+ JStringUtils protocol(*aJni, aProtocol);
+ JStringUtils middlePart(*aJni, aMiddlePart);
+
+ // If Java parameters is null, empty descriptor will be given to
+ // CreatePlayerL method.
+ TPtrC parameters(KNullDesC);
+ JStringUtils* tmp = NULL;
+ if (aParameters != NULL)
+ {
+ tmp = new JStringUtils(*aJni, aParameters);
+ if (tmp)
+ {
+ parameters.Set(*tmp);
+ }
+ else
+ {
+ // failed to create string
+ return KErrNoMemory;
+ }
+ }
+
+ TInt playerHandle = KErrNoMemory;
+ TInt err = eventSource->ExecuteTrap(&CreatePlayerLocatorL,
+ manager,
+ eventSource,
+ (const TDesC*)&protocol,
+ (const TDesC*)&middlePart,
+ (const TDesC*)¶meters,
+ &playerHandle);
+ delete tmp;
+ if (err != KErrNone)
+ {
+ // Leave occured return error code to Java
+ playerHandle = err;
+ ELOG1( EJavaMMAPI, "MMA::NativePlayerFactory createPlayerLocator err %d",
+ playerHandle);
+ }
+ return playerHandle;
+}
+
+/**
+ * Local function that calls CMMAManager's CreatePlayerL method.
+ */
+LOCAL_C void CreatePlayerContentTypeL(CMMAManager* aManager,
+ MMAFunctionServer* aEventSource,
+ const TDesC* aContentType,
+ TInt* aHandle)
+{
+ HandleCreatePlayerL(aManager->CreatePlayerL(*aContentType),
+ aEventSource,
+ aHandle);
+}
+
+/**
+ * JNI function from NativePlayerFactory class.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_NativePlayerFactory__1createPlayerContentType
+(JNIEnv* aJni, jclass,
+ jint aEventSourceHandle, jint aManagerHandle,
+ jstring aContentType)
+{
+ // Development time check.
+ __ASSERT_DEBUG((aEventSourceHandle > 0) && (aManagerHandle > 0), User::Invariant());
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+ CMMAManager* manager = reinterpret_cast< CMMAManager* >(aManagerHandle);
+
+ JStringUtils contentType(*aJni, aContentType);
+ TInt playerHandle = KErrNoMemory;
+ TInt err = eventSource->ExecuteTrap(&CreatePlayerContentTypeL,
+ manager,
+ eventSource,
+ (const TDesC*)&contentType,
+ &playerHandle);
+ if (err != KErrNone)
+ {
+ // Leave occured return error code to Java
+ playerHandle = err;
+ ELOG1( EJavaMMAPI, "MMA::NativePlayerFactory createPlayerContentType err %d",
+ playerHandle);
+ }
+ return playerHandle;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAOutputStream
+*
+*/
+
+
+//#include "jutils.h"
+//#include "mmapiutils.h"
+#include "com_nokia_microedition_media_protocol_OutputStreamWriter.h"
+#include "cmmaoutputstream.h"
+#include "mmafunctionserver.h"
+
+// If eventsource is already disposed, then do nothing
+#define CHECK_HANDLE(x, j) { if ( !( x ) || ( ( x )->Players().Count() == 0 ) ) { return ( j ); } }
+
+LOCAL_C void ReadDataL(MMAFunctionServer* aEventSource,
+ TInt aPlayer,
+ CMMAOutputStream* aOutputStream,
+ TUint8* aOutputBuffer,
+ TInt* aOutputBufferSize,
+ TInt* aReadStatus)
+{
+ if (!aEventSource->FindPlayer(aPlayer))
+ {
+ // Native object was already deleted
+ User::Leave(KErrBadHandle);
+ }
+
+ aOutputStream->ReadDataL(aOutputBuffer, aOutputBufferSize, aReadStatus);
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_protocol_OutputStreamWriter__1readData
+(JNIEnv* aJni, jclass, jint aOutputStream, jint aEventSource,
+ jbyteArray aOutputBuffer, jintArray aOutputBufferSize, jint aLength, jint aPlayerHandle)
+{
+ MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSource);
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ CMMAOutputStream* outputStream = reinterpret_cast< CMMAOutputStream* >(aOutputStream);
+
+ TInt readStatus;
+ jbyte* outputBuffer = aJni->GetByteArrayElements(aOutputBuffer, NULL);
+
+ // NULL is returned if there is not enough memory
+ if (!outputBuffer)
+ {
+ return KErrNoMemory;
+ }
+
+ jint* outputBufferSize = aJni->GetIntArrayElements(aOutputBufferSize, NULL);
+ if (!outputBufferSize)
+ {
+ // outputBuffer was already allocated
+ aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, JNI_ABORT);
+ return KErrNoMemory;
+ }
+
+ *outputBufferSize = aLength; // size of the buffer
+
+ TInt err = eventSource->ExecuteTrap(ReadDataL,
+ eventSource,
+ aPlayerHandle,
+ outputStream,
+ (TUint8*) outputBuffer,
+ outputBufferSize, // returns readed size
+ &readStatus);
+
+ aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, JNI_COMMIT);
+ aJni->ReleaseIntArrayElements(aOutputBufferSize, outputBufferSize, JNI_COMMIT);
+
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ // Tells if there's more data available or not
+ return readStatus;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/pitchcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAPitchControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_PitchControl.h"
+#include "mmafunctionserver.h"
+#include "cmmamidipitchcontrol.h"
+#include <logger.h>
+
+static const int KPitchOffset = 1000000;
+
+/**
+ * Local function which can be used to call CMMAPitchControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMAPitchControl::aFunc( TInt aData )
+ *
+ * @param aPitchControl CMMAPitchControl pointer.
+ * @param aFunc Pointer to the CMMAPitchControl method.
+ * @param aData Parameter to passed to the aFunc method
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntParamIntFuncL(CMMAMIDIPitchControl* aPitchControl,
+ TInt(CMMAMIDIPitchControl::*aFuncL)(TInt),
+ TInt aData,
+ TInt* aReturnValue)
+{
+ // call TInt CMMAPitchControl::aFunc( TInt aData ) method.
+ *aReturnValue = (aPitchControl->*aFuncL)(aData);
+}
+
+/**
+ * Local function which can be used to call CMMAPitchControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMAPitchControl::aFunc()
+ *
+ * @param aPitchControl CMMAPitchControl pointer.
+ * @param aFunc Pointer to the CMMAPitchControl method.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntFuncL(CMMAMIDIPitchControl* aPitchControl,
+ TInt(CMMAMIDIPitchControl::*aFuncL)(),
+ TInt* aReturnValue)
+{
+ // call TInt CMMAPitchControl::aFunc() method.
+ *aReturnValue = (aPitchControl->*aFuncL)();
+}
+
+//
+// JNI functions. Prototypes are generated and commented in Java class
+// com_nokia_microedition_media_control_PitchControl
+//
+
+/**
+ * JNI function from com.nokia.microedition.media.control.PitchControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_PitchControl__1setPitch
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aPitch) // parameter boundary is checked in Java side.
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDIPitchControl* PitchControl =
+ reinterpret_cast< CMMAMIDIPitchControl *>(aControlHandle);
+
+ // Value returned from SetPitch method will be assigned to returnValue.
+ TInt returnValue = 0;
+
+ // Setting Pitch will not leave, it just assigns default
+ // value to the returnValue variable.
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntParamIntFuncL,
+ PitchControl,
+ &CMMAMIDIPitchControl::SetPitchL,
+ aPitch,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "PitchControl__1setPitch return value %d", returnValue);
+
+ return (error == KErrNone) ? (returnValue+KPitchOffset) : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.PitchControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_PitchControl__1getMinPitch
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAMIDIPitchControl* PitchControl =
+ reinterpret_cast< CMMAMIDIPitchControl* >(aControlHandle);
+
+ TInt returnValue = 0;
+
+ // Get value or the default.
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ PitchControl,
+ &CMMAMIDIPitchControl::MinPitchL,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "PitchControl__1setPitch return value %d", returnValue);
+
+ return (error == KErrNone) ? (returnValue+KPitchOffset) : error;
+}
+
+
+/**
+ * JNI function from com.nokia.microedition.media.control.PitchControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_PitchControl__1getMaxPitch
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDIPitchControl* PitchControl =
+ reinterpret_cast< CMMAMIDIPitchControl* >(aControlHandle);
+
+ TInt returnValue = 0;
+ TInt error;
+
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ PitchControl,
+ &CMMAMIDIPitchControl::MaxPitchL,
+ &returnValue);
+ LOG1( EJavaMMAPI, EInfo, "PitchControl__1getMaxRate return value %d", returnValue);
+
+ return (error == KErrNone) ? (returnValue+KPitchOffset) : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.PitchControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_PitchControl__1getPitch
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDIPitchControl* PitchControl =
+ reinterpret_cast< CMMAMIDIPitchControl* >(aControlHandle);
+
+ TInt returnValue = 0;
+ TInt error;
+
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ PitchControl,
+ &CMMAMIDIPitchControl::PitchL,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "PitchControl__1getPitch return value %d", returnValue);
+
+ return (error == KErrNone) ? (returnValue+KPitchOffset) : error;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/player.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAPlayer
+*
+*/
+
+
+//#include <jutils.h>
+#include "com_nokia_microedition_media_PlayerImpl.h"
+
+#include "mmafunctionserver.h"
+#include "cmmaplayer.h"
+#include "s60commonutils.h"
+#include <logger.h>
+
+using namespace java::util;
+
+// If eventsource is already disposed, then do nothing
+#define CHECK_HANDLE(x, j) { if ( !( x ) || ( ( x )->Players().Count() == 0 ) ) { return ( j ); } }
+/*
+ * Wrappers for calling non static methods
+ */
+
+TInt VoidFunc(TInt aPlayer, MMAFunctionServer* aEventSource,
+ TInt(CMMAPlayer::*aFunc)())
+{
+ CMMAPlayer* p = aEventSource->FindPlayer(aPlayer);
+ if (p)
+ {
+ return (p->*aFunc)();
+ }
+ else
+ {
+ return KErrBadHandle;
+ }
+}
+
+void BoolFuncL(TInt aPlayer, MMAFunctionServer* aEventSource,
+ void(CMMAPlayer::*aFunc)(TBool),
+ TBool aValue)
+{
+ CMMAPlayer* p = aEventSource->FindPlayer(aPlayer);
+ if (p)
+ {
+ (p->*aFunc)(aValue);
+ }
+ // ignore call if player is not found
+}
+
+void VVoidFuncL(TInt aPlayer, MMAFunctionServer* aEventSource, void(CMMAPlayer::*aFunc)())
+{
+ CMMAPlayer* p = aEventSource->FindPlayer(aPlayer);
+ if (p)
+ {
+ (p->*aFunc)();
+ }
+ // ignore call if player is not found
+}
+
+void IntFunc(TInt aPlayer,
+ MMAFunctionServer* aEventSource,
+ void(CMMAPlayer::*aFunc)(TInt),
+ TInt aData)
+{
+ CMMAPlayer* p = aEventSource->FindPlayer(aPlayer);
+ if (p)
+ {
+ (p->*aFunc)(aData);
+ }
+ // ignore call if player is not found
+}
+
+void TInt64Func(TInt aPlayer, MMAFunctionServer* aEventSource,
+ void(CMMAPlayer::*aFunc)(TInt64* aData),
+ TInt64* aData)
+{
+ CMMAPlayer* p = aEventSource->FindPlayer(aPlayer);
+ if (p)
+ {
+ (p->*aFunc)(aData);
+ }
+ else
+ {
+ *aData = KErrBadHandle;
+ }
+}
+
+
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _createPlayer
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1initPlayer
+(JNIEnv* aJni,
+ jobject aObject,
+ jobject aListenerObject,
+ jint aEventSourceHandle,
+ jint aPlayerHandle)
+{
+ LOG(EJavaMMAPI,EInfo,"jni_PlayerImpl__1initPlayer Enter... 1");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayerHandle);
+
+ // init player
+ jobject playerObject = aJni->NewWeakGlobalRef(aObject);
+LOG(EJavaMMAPI,EInfo,"jni_PlayerImpl__1initPlayer Enter... 5");
+ TInt err = eventSource->ExecuteTrap(&CMMAPlayer::StaticInitPlayerL,
+ player,
+ eventSource,
+ playerObject,
+ eventSource->getValidJniEnv());
+ if (err != KErrNone)
+ {
+ aJni->DeleteWeakGlobalRef((jweak)playerObject);
+ return err;
+ }
+
+ // set player listener
+ jobject playerListener = aJni->NewWeakGlobalRef(aListenerObject);
+ err = eventSource->ExecuteTrap(&CMMAPlayer::StaticSetPlayerListenerObjectL,
+ player,
+ eventSource,
+ playerListener,
+ eventSource->getValidJniEnv(),
+ (MMMAEventPoster*)eventSource);
+ if (err != KErrNone)
+ {
+ aJni->DeleteWeakGlobalRef((jweak)playerListener);
+ }
+ return err;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _start
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1start
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "jni_PlayerImpl__1start...");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+ CHECK_HANDLE(eventSource, KErrNone);
+ TInt err = eventSource->ExecuteTrap(&VVoidFuncL,
+ aPlayer,
+ eventSource,
+ &CMMAPlayer::StartL);
+ LOG1(EJavaMMAPI,EInfo,"jni_PlayerImpl__1start Enter... 3, err = %d",err);
+ // complete java side request in case of leave.
+ if (err != KErrNone)
+ {
+ CMMAPlayer* p = eventSource->FindPlayer(aPlayer);
+ p->PostActionCompleted(err); // java start return
+ }
+
+ return err;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _stop
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1stop
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt err = eventSource->ExecuteTrap(&BoolFuncL,
+ aPlayer,
+ eventSource,
+ &CMMAPlayer::StopL,
+ (TBool)ETrue);
+ return err;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _close
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1close
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ // if eventsource is already disposed, then do nothing
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ LOG( EJavaMMAPI, EInfo, "jni_Player.cpp__1close before &CMMAPlayer::CloseL");
+ TInt err = eventSource->ExecuteTrap(&VVoidFuncL,
+ aPlayer,
+ eventSource,
+ &CMMAPlayer::CloseL);
+ ELOG1( EJavaMMAPI, "jni_Player.cpp__1close %d", err);
+ return err;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _prefetch
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1prefetch
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ ELOG( EJavaMMAPI, "jni_Player.cpp__1prefetch ");
+ MMAFunctionServer* eventSource =
+ //JavaUnhand< MMAFunctionServer >(aEventSource);
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt err = eventSource->ExecuteTrap(&VVoidFuncL, aPlayer,
+ eventSource,
+ &CMMAPlayer::PrefetchL);
+
+ ELOG1( EJavaMMAPI, "jni_Player.cpp__1prefetch %d", err);
+
+ return err;
+}
+
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _realize
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1realize
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt err = eventSource->ExecuteTrap(&VVoidFuncL,
+ aPlayer, eventSource,
+ &CMMAPlayer::RealizeL);
+ return err;
+}
+
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _setLoopCount
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1setLoopCount
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer, jint aLoopCount)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ eventSource->ExecuteV(&IntFunc,
+ aPlayer, eventSource,
+ &CMMAPlayer::SetLoopCount,
+ aLoopCount);
+ return KErrNone;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _duration
+ * Signature: (II)J
+ */
+JNIEXPORT jlong JNICALL Java_com_nokia_microedition_media_PlayerImpl__1duration
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt64 duration(0);
+
+ TInt err = eventSource->ExecuteTrap(&TInt64Func,
+ aPlayer, eventSource,
+ &CMMAPlayer::GetDuration,
+ &duration);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+ return *reinterpret_cast< jlong* >(&duration);
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _setMediaTime
+ * Signature: (IIJ)J
+ */
+JNIEXPORT jlong JNICALL Java_com_nokia_microedition_media_PlayerImpl__1setMediaTime
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer, jlong aNow)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+
+ TInt64 time = *reinterpret_cast< TInt64* >(&aNow);
+
+ TInt err = eventSource->ExecuteTrap(&TInt64Func,
+ aPlayer, eventSource,
+ &CMMAPlayer::SetMediaTimeL,
+ &time);
+
+ if (err != KErrNone)
+ {
+ ELOG1( EJavaMMAPI, "MMA::Java_com_nokia_microedition_media_PlayerImpl__1setMediaTime error %d ",
+ err);
+ return err;
+ }
+ return *reinterpret_cast< jlong* >(&time);
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _deallocate
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1deallocate
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt err = eventSource->ExecuteTrap(&VVoidFuncL,
+ aPlayer, eventSource,
+ &CMMAPlayer::DeallocateL);
+ return err;
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _getMediaTime
+ * Signature: (II)J
+ */
+JNIEXPORT jlong JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getMediaTime
+(JNIEnv*, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ TInt64 mediaTime(0);
+
+ TInt err = eventSource->ExecuteTrap(&TInt64Func, aPlayer,
+ eventSource,
+ &CMMAPlayer::GetMediaTime,
+ &mediaTime);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+ return *reinterpret_cast< jlong* >(&mediaTime);
+}
+
+/*
+ * Class: com_nokia_microedition_media_PlayerImpl
+ * Method: _getState
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getState
+(JNIEnv *, jclass, jint aEventSource, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+LOG(EJavaMMAPI,EInfo,"MMA::Java_com_nokia_microedition_media_PlayerImpl__1getState before finding player ");
+ CMMAPlayer* player = eventSource->FindPlayer(aPlayer);
+LOG(EJavaMMAPI,EInfo,"MMA::Java_com_nokia_microedition_media_PlayerImpl__1getState after finding player ");
+ TInt state = CMMAPlayer::EClosed;
+ if (player != NULL)
+ {
+ state = player->State();
+ }
+
+LOG1(EJavaMMAPI,EInfo,"MMA::Java_com_nokia_microedition_media_PlayerImpl__1getState state %d ",
+ state);
+ return state;
+}
+
+/*
+ *
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1addSourceStream
+(JNIEnv* aJni, jclass, jint aEventSource, jint aPlayer, jobject aReader)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ CMMAPlayer* player = eventSource->FindPlayer(aPlayer);
+ CMMASourceStream* sourceStream;
+
+ jobject readerRef = aJni->NewWeakGlobalRef(aReader);
+
+ TInt err = KErrNotFound;
+ if (player != NULL)
+ {
+ err = eventSource->ExecuteTrap(&CMMAPlayer::StaticAddSourceStreamL,
+ eventSource->getValidJniEnv(),
+ player,
+ eventSource,
+ readerRef,
+ &sourceStream);
+ }
+ if (err != KErrNone)
+ {
+ aJni->DeleteWeakGlobalRef((jweak)readerRef);
+ return err;
+ }
+ return reinterpret_cast<TInt>(sourceStream);
+}
+
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getControlsCount
+(JNIEnv*, jclass, jint aEventSourceHandle, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+
+ TInt count = eventSource->Execute(&VoidFunc,
+ aPlayer, eventSource,
+ &CMMAPlayer::ControlCount);
+ return count;
+}
+
+
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getControlClassName
+(JNIEnv* aJniEnv, jclass, jint aEventSourceHandle, jint aControlHandle)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAControl* control = reinterpret_cast< CMMAControl* >(aControlHandle);
+
+ const TDesC* name = eventSource->Execute(CMMAControl::ClassNameJni,
+ control);
+ return S60CommonUtils::NativeToJavaString(*aJniEnv, *name);
+}
+
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getControlHandle
+(JNIEnv*, jclass, jint aEventSourceHandle, jint aPlayer, jint aIndex)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ CMMAPlayer* player = eventSource->FindPlayer(aPlayer);
+ CMMAControl* control = NULL;
+ if (player)
+ {
+ control = eventSource->Execute(CMMAPlayer::StaticControl,
+ player,
+ aIndex);
+ }
+ else
+ {
+ return KErrBadHandle;
+ }
+
+ return reinterpret_cast<TInt>(control);
+}
+
+LOCAL_C void DisposePlayer(MMAFunctionServer* aEventSource,
+ TInt aPlayer)
+{
+ CMMAPlayer* player = aEventSource->FindPlayer(aPlayer);
+ if (player)
+ {
+ aEventSource->DisposePlayer(player);
+ }
+ // else already disposed
+}
+
+JNIEXPORT void JNICALL Java_com_nokia_microedition_media_PlayerImpl__1dispose
+(JNIEnv*, jclass, jint aEventSourceHandle, jint aPlayer)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ // if eventsource is already disposed, then do nothing
+ if (!eventSource || eventSource->IsDisposed())
+ {
+ return;
+ }
+
+ eventSource->ExecuteV(&DisposePlayer,
+ eventSource,
+ aPlayer);
+}
+
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_PlayerImpl__1getContentType
+(JNIEnv* aJni, jclass,
+ jint aPlayerHandle)
+{
+ CMMAPlayer* player = reinterpret_cast< CMMAPlayer* >(aPlayerHandle);
+ jstring contentType = NULL;
+
+ // if content type is null, we just return NULL to Java
+ if (player->ContentType())
+ {
+ // need to create Java String object
+ contentType = S60CommonUtils::NativeToJavaString(*aJni, *player->ContentType());
+ }
+ return contentType;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/ratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMARateControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_RateControl.h"
+#include "mmafunctionserver.h"
+#include "cmmaratecontrol.h"
+#include <logger.h>
+
+//
+// Wrapper functions which are needed in event source execution.
+// If method to be called can leave ExecuteTrap must be used,
+// otherwise Execute and ExecuteV can be used.
+//
+//
+
+/**
+ * Local function which can be used to call CMMARateControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMARateControl::aFunc( TInt aData )
+ *
+ * @param aRateControl CMMARateControl pointer.
+ * @param aFunc Pointer to the CMMARateControl method.
+ * @param aData Parameter to passed to the aFunc method
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntParamIntFuncL(CMMARateControl* aRateControl,
+ TInt(CMMARateControl::*aFuncL)(TInt),
+ TInt aData,
+ TInt* aReturnValue)
+{
+ // call TInt CMMARateControl::aFunc( TInt aData ) method.
+ *aReturnValue = (aRateControl->*aFuncL)(aData);
+}
+
+/**
+ * Local function which can be used to call CMMARateControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMARateControl::aFunc()
+ *
+ * @param aRateControl CMMARateControl pointer.
+ * @param aFunc Pointer to the CMMARateControl method.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntFuncL(CMMARateControl* aRateControl,
+ TInt(CMMARateControl::*aFuncL)(),
+ TInt* aReturnValue)
+{
+ // call TInt CMMARateControl::aFunc() method.
+ *aReturnValue = (aRateControl->*aFuncL)();
+}
+
+//
+// JNI functions. Prototypes are generated and commented in Java class
+// com_nokia_microedition_media_control_RateControl
+//
+
+/**
+ * JNI function from com.nokia.microedition.media.control.RateControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_RateControl__1getMinRate
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARateControl* RateControl =
+ reinterpret_cast< CMMARateControl *>(aControlHandle);
+
+ TInt returnValue = 0;
+
+ // Get value or the default.
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ RateControl,
+ &CMMARateControl::MinRateL,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "RateControl__1getMinRate return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.RateControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_RateControl__1getRate
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARateControl* RateControl =
+ reinterpret_cast< CMMARateControl *>(aControlHandle);
+
+
+ TInt returnValue = 0;
+
+ // Get actual rate or the default value to the returnValue.
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ RateControl,
+ &CMMARateControl::RateL,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "RateControl__1getRate return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.RateControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_RateControl__1setRate
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aRate)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARateControl* RateControl =
+ reinterpret_cast< CMMARateControl *>(aControlHandle);
+
+ // Return value will be actual rate set or default value if rate is not
+ // available.
+ TInt returnValue = 0;
+
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntParamIntFuncL,
+ RateControl,
+ &CMMARateControl::SetRateL,
+ aRate,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "RateControl__1setRate return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.RateControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_RateControl__1getMaxRate
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARateControl* RateControl =
+ reinterpret_cast< CMMARateControl *>(aControlHandle);
+
+ TInt returnValue = 0;
+ TInt error;
+
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ RateControl,
+ &CMMARateControl::MaxRateL,
+ &returnValue);
+ LOG1( EJavaMMAPI, EInfo, "RateControl__1getMaxRate return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/recordcontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMARecordControl
+*
+*/
+
+
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+#include "com_nokia_microedition_media_control_RecordControl.h"
+#include "mmafunctionserver.h"
+#include "cmmarecordcontrol.h"
+#include "s60commonutils.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+
+void VVoidFuncL(CMMARecordControl* aControl, void(CMMARecordControl::*aFunc)())
+{
+ (aControl->*aFunc)();
+}
+
+void TIntFuncL(CMMARecordControl* aControl, TInt(CMMARecordControl::*aFunc)(TInt),
+ TInt* aReturnValue)
+{
+ *aReturnValue = (aControl->*aFunc)(*aReturnValue);
+}
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: int _startRecord( int aEventSourceHandle, int aRecordControlHandle );
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1startRecord
+(JNIEnv *, jclass, jint aEventSourceHandle, jint aRecordControlHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1startRecord");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl* >(aRecordControlHandle);
+
+ return eventSource->ExecuteTrap(&VVoidFuncL,
+ recordControl,
+ &CMMARecordControl::StartRecordL);
+}
+
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: int _stopRecord( int aEventSourceHandle, int aRecordControlHandle );
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1stopRecord
+(JNIEnv *, jclass, jint aEventSourceHandle, jint aRecordControlHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1stopRecord");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl* >(aRecordControlHandle);
+
+ return eventSource->ExecuteTrap(&VVoidFuncL,
+ recordControl,
+ &CMMARecordControl::StopRecordL);
+}
+
+void CMMAOutputStreamFunc(void(CMMARecordControl::*aFunc)(CMMAOutputStream*),CMMARecordControl* aControl,
+ CMMAOutputStream* aOutputStream)
+{
+ (aControl->*aFunc)(aOutputStream);
+}
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1setRecordStream
+(JNIEnv *aJni, jclass, jint aEventSourceHandle, jint aRecordControlHandle, jobject aOutputWriter)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1setRecordStream");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl* >(aRecordControlHandle);
+
+ jobject writerRef = aJni->NewWeakGlobalRef(aOutputWriter);
+ CMMAOutputStream* outputStream;
+
+ TInt err = eventSource->ExecuteTrap(CMMAOutputStream::CreateL,
+ &outputStream,
+ eventSource,
+ aJni,
+ (MMMAEventPoster*)eventSource,
+ writerRef);
+
+ if (err == KErrNone)
+ {
+ eventSource->ExecuteV(&CMMAOutputStreamFunc,
+ &CMMARecordControl::SetRecordStream,
+ recordControl,
+ outputStream);
+
+ return reinterpret_cast<TInt>(outputStream);
+ }
+ else
+ {
+ aJni->DeleteWeakGlobalRef((jweak)writerRef);
+ return err;
+ }
+}
+
+void HBufCFunc(CMMARecordControl* aControl, HBufC*(CMMARecordControl::*aFunc)(),
+ HBufC** aBuf)
+{
+ *aBuf = (aControl->*aFunc)();
+}
+
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: String _getContentType( int aEventSourceHandle, int aRecordControlHandle );
+ * Signature: (II)I
+ */
+JNIEXPORT jstring JNICALL Java_com_nokia_microedition_media_control_RecordControl__1getContentType
+(JNIEnv *aJniEnv, jclass, jint aEventSourceHandle, jint aRecordControlHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1getContentType");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl* >(aRecordControlHandle);
+
+ const HBufC* contentType = NULL;
+ eventSource->ExecuteTrap(&HBufCFunc,
+ recordControl,
+ &CMMARecordControl::GetContentTypeL,
+ (HBufC**)&contentType);
+
+ if (contentType != NULL)
+ {
+ return S60CommonUtils::NativeToJavaString(*aJniEnv, *contentType);
+ }
+ // ContentType is not known (Player not started?)
+ return S60CommonUtils::NativeToJavaString(*aJniEnv, KNullDesC);
+}
+
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: int _commit( int aEventSourceHandle, int aRecordControlHandle );
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1commit
+(JNIEnv *, jclass, jint aEventSourceHandle, jint aRecordControlHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1commit");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl* >(aRecordControlHandle);
+
+ return eventSource->ExecuteTrap(&VVoidFuncL,
+ recordControl,
+ &CMMARecordControl::CommitL);
+}
+
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: int _setRecordSizeLimit( int aEventSourceHandle, int aRecordControlHandle, int aSize );
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1setRecordSizeLimit
+(JNIEnv *, jclass, jint aEventSourceHandle, jint aRecordControlHandle, jint aSize)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1setRecordSizeLimit");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl *>(aRecordControlHandle);
+
+ TInt err = eventSource->ExecuteTrap(&TIntFuncL,
+ recordControl,
+ &CMMARecordControl::SetRecordSizeLimitL,
+ &aSize);
+ if (err != KErrNone)
+ {
+ return err;
+ }
+
+ // return size of the set record size
+ return aSize;
+}
+
+/*
+ * Class: com_nokia_microedition_media_RecordControl
+ * Method: int _reset( int aEventSourceHandle, int aRecordControlHandle );
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_RecordControl__1reset
+(JNIEnv *, jclass, jint aEventSourceHandle, jint aRecordControlHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_RecordControl__1reset");
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMARecordControl* recordControl =
+ reinterpret_cast< CMMARecordControl *>(aRecordControlHandle);
+
+ return eventSource->ExecuteTrap(&VVoidFuncL,
+ recordControl,
+ &CMMARecordControl::ResetL);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/rmmatempfile.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+// INCLUDE FILES
+
+#include "rmmatempfile.h"
+
+RMMATempFile::RMMATempFile()
+{
+ iFileHandle = KErrNone;
+ iMidletSuiteID = KErrNotFound;
+}
+
+void RMMATempFile::ConnectL()
+{
+ User::Leave(KErrNotSupported);
+}
+
+void RMMATempFile::CreateL()
+{
+ User::Leave(KErrNotSupported);
+}
+
+RFile& RMMATempFile::File()
+{
+ return iFile;
+}
+
+void RMMATempFile::SetMIDletSuiteID(TInt aMidletSuiteID)
+{
+ iMidletSuiteID = aMidletSuiteID;
+}
+
+void RMMATempFile::Close()
+{
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/sourcestreamreader.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMASourceStream
+*
+*/
+
+
+//#include "jutils.h"
+//#include "mmapiutils.h"
+#include "com_nokia_microedition_media_protocol_SourceStreamReader.h"
+#include "cmmasourcestream.h"
+#include "mmafunctionserver.h"
+
+// If eventsource is already disposed, then do nothing
+#define CHECK_HANDLE(x, j) { if ( !( x ) || ( ( x )->Players().Count() == 0 ) ) { return ( j ); } }
+LOCAL_C void WriteDataL(TInt aSourceStream,
+ TInt aPlayer,
+ MMAFunctionServer* aEventSource,
+ const TUint8* aData,
+ TInt aLength,
+ TInt aState)
+{
+ if (!aEventSource->FindPlayer(aPlayer))
+ {
+ // Native object was already deleted
+ User::Leave(KErrBadHandle);
+ }
+ CMMASourceStream* sourceStream =
+ reinterpret_cast< CMMASourceStream *>(aSourceStream);
+
+ sourceStream->WriteL(aData, aLength, aState);
+ LOG( EJavaMMAPI, EInfo, "jni SourceStreamReader.cpp: WriteDataL() -");
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_protocol_SourceStreamReader__1write
+(JNIEnv* aJni, jclass, jint aSourceStream, jint aEventSource,
+ jbyteArray aData, jint aLength, jint aState, jint aPlayerHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "SourceStreamReaderjni_write");
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CHECK_HANDLE(eventSource, KErrNone);
+
+ jbyte* data = aJni->GetByteArrayElements(aData, NULL);
+ LOG2( EJavaMMAPI, EInfo, "SourceStreamReaderjni_write , length = %d,state = %d",(TInt)aLength,(TInt)aState);
+ TInt err = eventSource->ExecuteTrap(&WriteDataL,
+ aSourceStream,
+ aPlayerHandle,
+ eventSource,
+ (const TUint8*)data,
+ aLength,
+ aState);
+ ELOG1( EJavaMMAPI, "SourceStreamReaderjni_write , err = %d",err);
+ aJni->ReleaseByteArrayElements(aData, data, JNI_ABORT);
+ return err;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/stoptimecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAStopTimeControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+#include "com_nokia_microedition_media_control_StopTimeControl.h"
+#include "mmafunctionserver.h"
+#include "cmmastoptimecontrol.h"
+
+
+JNIEXPORT jlong JNICALL Java_com_nokia_microedition_media_control_StopTimeControl__1getStopTime
+(JNIEnv *, jclass , jint aEventSource, jint aControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAStopTimeControl* control =
+ reinterpret_cast< CMMAStopTimeControl* >(aControl);
+
+ TInt64 time(0);
+ eventSource->ExecuteV(CMMAStopTimeControl::StaticGetStopTime,
+ control,
+ &time);
+
+ return *reinterpret_cast< jlong* >(&time);
+}
+
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_StopTimeControl__1setStopTime
+(JNIEnv *, jclass , jint aEventSource, jint aControl, jlong aTime)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAStopTimeControl* control =
+ reinterpret_cast< CMMAStopTimeControl* >(aControl);
+
+ TInt64 time;
+ time = *((TInt64*)&aTime); // convert 'long long' to TInt64
+
+ TInt err = eventSource->ExecuteTrap(CMMAStopTimeControl::StaticSetStopTimeL,
+ control,
+ &time);
+
+ return err;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/tempocontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMATempoControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_TempoControl.h"
+#include "mmafunctionserver.h"
+#include "cmmamiditempocontrol.h"
+#include <logger.h>
+
+//
+// Wrapper functions which are needed in event source execution.
+// If method to be called can leave ExecuteTrap must be used,
+// otherwise Execute and ExecuteV can be used.
+//
+//
+
+/**
+ * Local function which can be used to call CMMATempoControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMATempoControl::aFunc( TInt aData )
+ *
+ * @param aTempoControl CMMATempoControl pointer.
+ * @param aFunc Pointer to the CMMATempoControl method.
+ * @param aData Parameter to passed to the aFunc method
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntParamIntFuncL(CMMAMIDITempoControl* aTempoControl,
+ TInt(CMMAMIDITempoControl::*aFuncL)(TInt),
+ TInt aData,
+ TInt* aReturnValue)
+{
+ // call TInt CMMATempoControl::aFunc( TInt aData ) method.
+ *aReturnValue = (aTempoControl->*aFuncL)(aData);
+}
+
+/**
+ * Local function which can be used to call CMMATempoControl class methods.
+ * Type of of the function pointer must be
+ * TInt CMMATempoControl::aFunc()
+ *
+ * @param aTempoControl CMMATempoControl pointer.
+ * @param aFunc Pointer to the CMMATempoControl method.
+ * @param aReturnValue The return value of the aFunc will
+ * be assigned to this parameter.
+ */
+LOCAL_C void ReturnIntFuncL(CMMAMIDITempoControl* aTempoControl,
+ TInt(CMMAMIDITempoControl::*aFuncL)(),
+ TInt* aReturnValue)
+{
+ // call TInt CMMATempoControl::aFunc() method.
+ *aReturnValue = (aTempoControl->*aFuncL)();
+}
+
+//
+// JNI functions. Prototypes are generated and commented in Java class
+// com_nokia_microedition_media_control_TempoControl
+//
+
+/**
+ * JNI function from com.nokia.microedition.media.control.TempoControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_TempoControl__1setTempo
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle,
+ jint aTempo) // parameter boundary is checked in Java side.
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+ CMMAMIDITempoControl* tempoControl =
+ reinterpret_cast< CMMAMIDITempoControl* >(aControlHandle);
+
+ // Value returned from SetTempo method will be assigned to returnValue.
+ TInt returnValue = 0;
+
+ // Setting tempo will not leave, it just assigns default
+ // value to the returnValue variable.
+ TInt error;
+ error = eventSource->ExecuteTrap(&ReturnIntParamIntFuncL,
+ tempoControl,
+ &CMMAMIDITempoControl::SetTempoL,
+ aTempo,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "TempoControl__1setTempo return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+
+/**
+ * JNI function from com.nokia.microedition.media.control.TempoControl
+ */
+JNIEXPORT jint JNICALL
+Java_com_nokia_microedition_media_control_TempoControl__1getTempo
+(JNIEnv*,
+ jobject,
+ jint aControlHandle,
+ jint aEventSourceHandle)
+{
+ // Get pointer to native event source.
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ CMMAMIDITempoControl* tempoControl =
+ reinterpret_cast< CMMAMIDITempoControl* >(aControlHandle);
+
+ TInt returnValue = 0;
+ TInt error;
+
+ error = eventSource->ExecuteTrap(&ReturnIntFuncL,
+ tempoControl,
+ &CMMAMIDITempoControl::TempoL,
+ &returnValue);
+
+ LOG1( EJavaMMAPI, EInfo, "TempoControl__1getTempo return value %d", returnValue);
+
+ return (error == KErrNone) ? returnValue : error;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/tmmaparametervalidator.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for storing and parsing properties
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <mmfformatimplementationuids.hrh>
+#include <mmfcontrollerimplementationuids.hrh>
+#include "cmmaplayerproperties.h"
+#include <mmfcontrollerpluginresolver.h>
+
+
+#include "tmmaparametervalidator.h"
+
+// CONSTANTS
+
+// AUDIO PARAMETERS
+_LIT(KPropertyEncoding, "encoding");
+_LIT(KPropertyEncodingPcm, "pcm"); // Wav
+_LIT(KPropertyEncodingAmr, "amr"); // Amr
+_LIT(KPropertyEncodingGsm, "gsm");
+_LIT(KPropertyEncodingUlaw, "ulaw"); // Au
+_LIT(KPropertyEncodingAlaw, "alaw");
+_LIT(KPropertyEncodingRaw, "raw"); // Raw pcm
+_LIT(KPropertyEncodingNone, ""); // empty string
+
+_LIT(KContentTypeWav, "audio/wav");
+_LIT(KContentTypeAu, "audio/au");
+_LIT(KContentTypeAmr, "audio/amr");
+_LIT(KContentTypeRaw, "audio/raw");
+
+// Format used if not specified in locator
+_LIT(KDefaultAudioRecordContentType, "audio/wav");
+
+_LIT(KPropertyRate, "rate");
+_LIT(KPropertyBits, "bits");
+_LIT(KPropertyChannels, "channels");
+
+_LIT(KPropertyEndian, "endian");
+MMA_PARAMETER_STR(KPropertyEndianLittle, "little");
+MMA_PARAMETER_STR(KPropertyEndianBig, "big");
+MMA_PARAMETER_ARRAY(KValidEndianValues)
+{
+ {
+ &KPropertyEndianLittle
+ }, {&KPropertyEndianBig}
+};
+
+_LIT(KPropertySigned, "signed");
+MMA_PARAMETER_STR(KPropertySignedSigned, "signed");
+MMA_PARAMETER_STR(KPropertySignedUnsigned, "unsigned");
+MMA_PARAMETER_ARRAY(KValidSignedValues)
+{
+ {
+ &KPropertySignedSigned
+ }, {&KPropertySignedUnsigned}
+};
+
+// VIDEO PARAMETERS
+_LIT(KPropertyFps, "fps");
+_LIT(KPropertyWidth, "width");
+_LIT(KPropertyHeight, "height");
+
+const TInt KSizeNotSet = -1;
+
+// Format used if not specified in locator
+_LIT(KDefaultVideoRecordContentType, "video/3gpp");
+
+//IMAGE PARAMETERS
+_LIT(KPropertyType, "type");
+MMA_PARAMETER_STR(KPropertyJfif, "jfif");
+MMA_PARAMETER_STR(KPropertyExif, "exif");
+MMA_PARAMETER_ARRAY(KValidTypes)
+{
+ {
+ &KPropertyJfif
+ }, {&KPropertyExif}
+};
+
+_LIT(KFormatPng, "png");
+_LIT(KFormatJpg, "jpeg"); // not "jpg"
+_LIT(KFormatGif, "gif");
+_LIT(KFormatBmp, "bmp");
+_LIT(KContentTypePng, "image/png");
+_LIT(KContentTypeJpg, "image/jpeg");
+_LIT(KContentTypeJpg2,"image/jpg");
+_LIT(KContentTypeGif, "image/gif");
+_LIT(KContentTypeBmp, "image/bmp");
+
+_LIT(KPropertyColor, "colors");
+MMA_PARAMETER_STR(KPropertyRGB888, "rgb888");
+MMA_PARAMETER_STR(KPropertyRGB444, "rgb444");
+MMA_PARAMETER_STR(KPropertyGray16, "gray16");
+MMA_PARAMETER_STR(KPropertyGray8, "gray8");
+
+_LIT(KPropertyQuality, "quality");
+const TInt KDefaultQuality = 75; // digged out from ICL source
+const TInt KDefaultBpp = 24;
+const TInt KDefaultBpp444 = 12;
+const TInt KDefaultBppGray16 = 16;
+const TInt KDefaultBppGray8 = 8;
+const TInt KNoUserDefinedQuality = -1;
+const TReal32 KNoUserDefinedFps = -1;
+
+// CMMAImageSettings container destructor
+CMMAImageSettings::~CMMAImageSettings()
+{
+ delete iMimeType;
+ delete iType;
+ delete iImageData;
+}
+
+CMMAAudioSettings::~CMMAAudioSettings()
+{
+ delete iContentType;
+}
+
+CMMAAudioSettings *TMMAParameterValidator::ValidateAudioPropertiesL(const TDesC& aProperties)
+{
+ CMMAAudioSettings* settings = new(ELeave) CMMAAudioSettings;
+ CleanupStack::PushL(settings);
+
+ CMMAParameterRuleSet* rules = CMMAParameterRuleSet::NewLC();
+
+ // "bits" must be between 0 - 24
+ TMMAParameterRuleInt bitsRule(KPropertyBits, 0, 24);
+ rules->AppendRuleL(&bitsRule);
+
+ // "rate" must be positive
+ TMMAParameterRuleInt rateRule(KPropertyRate, 1);
+ rules->AppendRuleL(&rateRule);
+
+ // "channels" must be 1 or 2
+ TMMAParameterRuleInt channelsRule(KPropertyChannels, 1, 2);
+ rules->AppendRuleL(&channelsRule);
+
+ // "signed" must be "signed" or "unsigned"
+ TMMAParameterRuleDes signedRule(KPropertySigned, KValidSignedValues,
+ MMA_PARAMETER_ARRAY_SIZE(KValidSignedValues));
+ rules->AppendRuleL(&signedRule);
+
+ // "endian" must be "little" or "big"
+ TMMAParameterRuleDes endianRule(KPropertyEndian, KValidEndianValues,
+ MMA_PARAMETER_ARRAY_SIZE(KValidEndianValues));
+ rules->AppendRuleL(&endianRule);
+
+ // "encoding" must be one of valid values
+ TMMAParameterRuleDes encodingRule(KPropertyEncoding);
+ rules->AppendRuleL(&encodingRule);
+
+ CMMAPlayerProperties* properties = CMMAPlayerProperties::NewL(aProperties, *rules);
+ CleanupStack::PushL(properties);
+
+ // validating properties
+ properties->ValidateL();
+
+ TInt bits = KDefaultBits;
+ properties->GetProperty(KPropertyBits, bits);
+
+ settings->iRate = KDefaultRate;
+ properties->GetProperty(KPropertyRate, settings->iRate);
+
+ settings->iChannels = KDefaultChannels;
+ properties->GetProperty(KPropertyChannels, settings->iChannels);
+
+
+ // Normally encoders are not streamable
+ settings->iStreamableFormat = EFalse;
+
+ // signed=signed/unsigned (default is unsigned for 8bit, signed for 16bit)
+ TBool dataSigned = EFalse;
+ if (properties->Compare(KPropertyBits, 16))
+ {
+ dataSigned = ETrue;
+ }
+
+ if (properties->Compare(KPropertySigned, KPropertySignedSigned()))
+ {
+ dataSigned = ETrue;
+ }
+ else if (properties->Compare(KPropertySigned, KPropertySignedUnsigned()))
+ {
+ dataSigned = EFalse;
+ }
+
+ // little by default
+ TBool endianLittle = ETrue;
+ if (properties->Compare(KPropertyEndian, KPropertyEndianBig()))
+ {
+ endianLittle = EFalse;
+ }
+
+ settings->iDataType = KMMFFourCCCodeNULL;
+
+ // encoding specific
+
+ TPtrC encoding(NULL, 0);
+ properties->GetProperty(KPropertyEncoding, encoding);
+
+ if ((encoding == KPropertyEncodingAmr()) ||
+ (encoding == KPropertyEncodingGsm()))
+ {
+ // AMR format
+ encoding.Set(KContentTypeAmr());
+ }
+
+ else if (encoding == KPropertyEncodingUlaw())
+ {
+ // AU format, ulaw codec
+ encoding.Set(KContentTypeAu());
+ settings->iDataType = KMMFFourCCCodeMuLAW;
+ }
+
+ else if (encoding == KPropertyEncodingAlaw())
+ {
+ // AU format, alaw codec
+ encoding.Set(KContentTypeAu());
+ settings->iDataType = KMMFFourCCCodeALAW;
+ }
+
+ else if (encoding == KPropertyEncodingPcm())
+ {
+ // wav format
+ encoding.Set(KContentTypeWav());
+ }
+
+ else if (encoding == KPropertyEncodingRaw())
+ {
+ // raw format, default codec
+ encoding.Set(KContentTypeRaw());
+ }
+
+ else if ((encoding == KPropertyEncodingNone())) // this is the default case
+ {
+ encoding.Set(KDefaultAudioRecordContentType());
+ }
+
+ settings->iContentType = encoding.AllocL();
+
+
+ // wav specific
+ if (*settings->iContentType == KContentTypeWav())
+ {
+ if (bits == 8)
+ {
+ settings->iDataType = KMMFFourCCCodePCMU8;
+ }
+
+ else if (bits == 16)
+ {
+ settings->iDataType = KMMFFourCCCodePCM16;
+ }
+
+ else if (bits != KDefaultBits)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ }
+
+ // raw specific
+ if (*settings->iContentType == KContentTypeRaw())
+ {
+ if (bits == 8)
+ {
+ if (dataSigned)
+ {
+ settings->iDataType = KMMFFourCCCodePCM8;
+ }
+ else
+ {
+ settings->iDataType = KMMFFourCCCodePCMU8;
+ }
+ }
+
+ else if (bits == 16)
+ {
+ if (endianLittle)
+ {
+ if (dataSigned)
+ {
+ settings->iDataType = KMMFFourCCCodePCM16;
+ }
+ else
+ {
+ settings->iDataType = KMMFFourCCCodePCMU16;
+ }
+ }
+ else // Big endian
+ {
+ if (dataSigned)
+ {
+ settings->iDataType = KMMFFourCCCodePCM16B;
+ }
+ else
+ {
+ settings->iDataType = KMMFFourCCCodePCMU16B;
+ }
+ }
+ }
+
+ else if (bits != KDefaultBits) // bits not 8 or 16
+ {
+ User::Leave(KErrNotSupported);
+ }
+
+ settings->iEncoding = TUid::Uid(KMmfUidFormatRAWWrite);
+ settings->iController = TUid::Uid(KMmfUidControllerAudio);
+ }
+
+
+ CleanupStack::PopAndDestroy(2); // rules, properties
+ CleanupStack::Pop(settings);
+ return settings;
+}
+
+TMMAVideoSettings TMMAParameterValidator::ValidateVideoPropertiesL(const TDesC& aProperties)
+{
+ CheckEncodingL(aProperties);
+ TMMAVideoSettings settings;
+ CMMAParameterRuleSet* rules = CMMAParameterRuleSet::NewLC();
+
+ // "fps" is real, taking it as string and validating later
+ TMMAParameterRuleDes fpsRule(KPropertyFps);
+ rules->AppendRuleL(&fpsRule);
+
+ // "width" must be positive
+ TMMAParameterRuleInt widthRule(KPropertyWidth, 1);
+ rules->AppendRuleL(&widthRule);
+
+ // "height" must be positive
+ TMMAParameterRuleInt heightRule(KPropertyHeight, 1);
+ rules->AppendRuleL(&heightRule);
+
+ // "encoding" can be anything in this point (actual validation will be done by MMF)
+ TMMAParameterRuleDes encodingRule(KPropertyEncoding);
+ rules->AppendRuleL(&encodingRule);
+
+ CMMAPlayerProperties* properties = CMMAPlayerProperties::NewL(aProperties, *rules);
+ CleanupStack::PushL(properties);
+
+ // validating properties
+ properties->ValidateL();
+
+ properties->GetProperty(KPropertyWidth, settings.iWidth = KSizeNotSet);
+ properties->GetProperty(KPropertyHeight, settings.iHeight = KSizeNotSet);
+
+ TPtrC fps;
+ settings.iFps = KNoUserDefinedFps;
+ if (properties->GetProperty(KPropertyFps, fps))
+ {
+ TLex lex(fps);
+ TReal32 fpsReal;
+ // try to get fps value from string
+ TInt err = lex.Val(fpsReal);
+ if (err == KErrNone)
+ {
+ // Check if there other characters after
+ // number ( 34xxx )
+ if (!lex.Eos() ||
+ (fpsReal <= 0))
+ {
+ User::Leave(KErrArgument);
+ }
+ else
+ {
+ settings.iFps = fpsReal;
+ }
+ }
+ else if (err == KErrNoMemory)
+ {
+ User::Leave(KErrNoMemory);
+ }
+ else
+ {
+ // value is not available
+ User::Leave(KErrArgument);
+ }
+ }
+
+ settings.iEncoding.Set(KDefaultVideoRecordContentType());
+ properties->GetProperty(KPropertyEncoding, settings.iEncoding);
+
+ CleanupStack::PopAndDestroy(2); // rules, properties
+ return settings;
+}
+
+CMMAImageSettings* TMMAParameterValidator::ValidateImagePropertiesL(const TDesC& aProperties)
+{
+ CMMAImageSettings* settings = new(ELeave)CMMAImageSettings;
+ CleanupStack::PushL(settings);
+
+ CMMAParameterRuleSet* rules = CMMAParameterRuleSet::NewLC();
+
+ // "width" must be positive
+ TMMAParameterRuleInt widthRule(KPropertyWidth, 1);
+ rules->AppendRuleL(&widthRule);
+
+ // "height" must be positive
+ TMMAParameterRuleInt heightRule(KPropertyHeight, 1);
+ rules->AppendRuleL(&heightRule);
+
+ // "encoding" final validation is done with image encoder
+ TMMAParameterRuleDes encodingRule(KPropertyEncoding);
+ rules->AppendRuleL(&encodingRule);
+
+ // "color" can be anything in this point, it will be validated later
+ TMMAParameterRuleDes colorRule(KPropertyColor);
+ rules->AppendRuleL(&colorRule);
+
+ // "type" must be "jfif" or "exif"
+ TMMAParameterRuleDes typeRule(KPropertyType, KValidTypes,
+ MMA_PARAMETER_ARRAY_SIZE(KValidTypes));
+ rules->AppendRuleL(&typeRule);
+
+ // "quality" must be between 0 and 100
+ TMMAParameterRuleInt qualityRule(KPropertyQuality, 0, 100);
+ rules->AppendRuleL(&qualityRule);
+
+ CMMAPlayerProperties* properties = CMMAPlayerProperties::NewL(aProperties, *rules);
+ CleanupStack::PushL(properties);
+
+ // validating properties
+ properties->ValidateL();
+
+ properties->GetProperty(KPropertyWidth, settings->iWidth = KSizeNotSet);
+ properties->GetProperty(KPropertyHeight, settings->iHeight = KSizeNotSet);
+
+ // do not set quality if user has not defined it
+ TInt quality = KNoUserDefinedQuality;
+ properties->GetProperty(KPropertyQuality, quality);
+
+ TPtrC encoding;
+ if (properties->Compare(KPropertyEncoding, KFormatPng) ||
+ properties->Compare(KPropertyEncoding, KContentTypePng))
+ { //PNG
+ settings->iMimeType = CreateHBufC8FromUnicodeL(KContentTypePng);
+ TPngEncodeData* imageData = new(ELeave)TPngEncodeData();
+ imageData->iBitsPerPixel = KDefaultBpp;
+ imageData->iColor = ETrue;
+ imageData->iPaletted = EFalse;
+ imageData->iLevel = TPngEncodeData::EDefaultCompression;
+
+ CleanupStack::PushL(imageData);
+ TPtrC color;
+ if (properties->Compare(KPropertyColor, KPropertyRGB888()))
+ {
+ // default
+ }
+ else if (properties->Compare(KPropertyColor, KPropertyRGB444()))
+ {
+ imageData->iBitsPerPixel = KDefaultBpp444;
+ }
+ else if (properties->Compare(KPropertyColor, KPropertyGray16()))
+ {
+ imageData->iBitsPerPixel = KDefaultBppGray16;
+ imageData->iColor = EFalse;
+ }
+ else if (properties->Compare(KPropertyColor, KPropertyGray8()))
+ {
+ imageData->iBitsPerPixel = KDefaultBppGray8;
+ imageData->iColor = EFalse;
+ }
+ else if (properties->GetProperty(KPropertyColor, color))
+ {
+ // not valid color parameter
+ User::Leave(KErrArgument);
+ }
+ settings->iImageData = CFrameImageData::NewL();
+ User::LeaveIfError(settings->iImageData->AppendFrameData(imageData));
+ // CFrameImageData took ownership of imageData
+ CleanupStack::Pop(imageData);
+
+ // png quality setting not supported, "type" is only for jpeg.
+ TPtrC tmp;
+ if (quality != KNoUserDefinedQuality ||
+ properties->GetProperty(KPropertyType, tmp)
+ )
+ {
+ User::Leave(KErrArgument);
+ }
+ }
+ else if (properties->Compare(KPropertyEncoding, KFormatJpg) ||
+ properties->Compare(KPropertyEncoding, KContentTypeJpg) ||
+ properties->Compare(KPropertyEncoding, KContentTypeJpg2))
+ { // JPG
+ settings->iMimeType = CreateHBufC8FromUnicodeL(KContentTypeJpg);
+ if (properties->Compare(KPropertyType, KPropertyJfif()))
+ {
+ settings->iType = CreateHBufC8FromUnicodeL(KPropertyJfif());
+ }
+ else if (properties->Compare(KPropertyType, KPropertyExif()))
+ {
+ settings->iType = CreateHBufC8FromUnicodeL(KPropertyExif());
+ }
+ else
+ {
+ settings->iType = CreateHBufC8FromUnicodeL(KPropertyExif());
+ }
+
+ TJpegImageData* imageData = new(ELeave)TJpegImageData();
+ CleanupStack::PushL(imageData);
+ imageData->iQualityFactor = KDefaultQuality;
+ imageData->iSampleScheme = TJpegImageData::EColor444;
+ if (quality != KNoUserDefinedQuality)
+ {
+ imageData->iQualityFactor = quality;
+ }
+ settings->iImageData = CFrameImageData::NewL();
+ User::LeaveIfError(settings->iImageData->AppendImageData(imageData));
+ // CFrameImageData took ownership of imageData
+ CleanupStack::Pop(imageData);
+
+ TPtrC tmp;
+ // jpg encoders colors cannot be configured,
+ // notice that if there was "type" defined it must be "jfif"
+ // and encoder will check that anyway.
+ if (properties->GetProperty(KPropertyColor, tmp))
+ {
+ User::Leave(KErrArgument);
+ }
+ }
+ else if (properties->Compare(KPropertyEncoding, KFormatGif) ||
+ properties->Compare(KPropertyEncoding, KContentTypeGif))
+ {//GIF
+ settings->iMimeType = CreateHBufC8FromUnicodeL(KContentTypeGif);
+ TPtrC tmp;
+ // gif encoder is not configurable
+ if (properties->GetProperty(KPropertyColor, tmp) ||
+ properties->GetProperty(KPropertyType, tmp) ||
+ quality != KNoUserDefinedQuality)
+ {
+ User::Leave(KErrArgument);
+ }
+ }
+ else if (properties->Compare(KPropertyEncoding, KFormatBmp) ||
+ properties->Compare(KPropertyEncoding, KContentTypeBmp))
+ {//BMP
+ settings->iMimeType = CreateHBufC8FromUnicodeL(KContentTypeBmp);
+ TBmpImageData* imageData = new(ELeave)TBmpImageData();
+ CleanupStack::PushL(imageData);
+ imageData->iBitsPerPixel = KDefaultBpp;
+ TPtrC color;
+ if (properties->Compare(KPropertyColor, KPropertyRGB888()))
+ {
+ // default
+ }
+ else if (properties->Compare(KPropertyColor, KPropertyRGB444()))
+ {
+ imageData->iBitsPerPixel = KDefaultBpp444;
+ }
+ else if (properties->GetProperty(KPropertyColor, color))
+ {
+ // not valid color parameter
+ User::Leave(KErrArgument);
+ }
+
+ settings->iImageData = CFrameImageData::NewL();
+ User::LeaveIfError(settings->iImageData->AppendImageData(imageData));
+ // CFrameImageData took ownership of imageData
+ CleanupStack::Pop(imageData);
+
+ // quality not supported, "type" is only for jpg
+ TPtrC tmp;
+ if (quality != KNoUserDefinedQuality ||
+ properties->GetProperty(KPropertyType, tmp))
+ {
+ User::Leave(KErrArgument);
+ }
+ }
+ else if (properties->GetProperty(KPropertyEncoding, encoding))
+ { // OTHER POSSIBLE TYPE
+ // trying to create encoder with only content/mime-type
+ settings->iMimeType = CreateHBufC8FromUnicodeL(encoding);
+
+ // No extra parameters, only content-type
+ TPtrC tmp;
+ if (properties->GetProperty(KPropertyColor, tmp) ||
+ properties->GetProperty(KPropertyType, tmp) ||
+ quality != KNoUserDefinedQuality)
+ {
+ User::Leave(KErrArgument);
+ }
+ }
+ else // default: we had empty properties string
+ {
+ settings->iMimeType = CreateHBufC8FromUnicodeL(KContentTypePng);
+ }
+ CleanupStack::PopAndDestroy(properties);
+ CleanupStack::PopAndDestroy(rules);
+ CleanupStack::Pop(settings);
+ return settings;
+}
+
+void TMMAParameterValidator::CheckEncodingL(const TDesC& aProperties)
+{
+ TInt encodingPos = aProperties.Find(KPropertyEncoding);
+ // empty properties is valid and
+ // encoding must be first parameter and must exist every time
+ if ((aProperties.Length() > 0) &&
+ ((encodingPos == KErrNotFound) ||
+ (encodingPos != 0)))
+ {
+ User::Leave(KErrArgument);
+ }
+}
+
+HBufC8* TMMAParameterValidator::CreateHBufC8FromUnicodeL(const TDesC& aDes)
+{
+ HBufC8* tmp = HBufC8::NewL(aDes.Length());
+ tmp->Des().Copy(aDes);
+ return tmp;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/videocontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAVideoControl
+*
+*/
+
+
+//#include <jutils.h>
+//#include <lcdui.h>
+#include "com_nokia_microedition_media_control_VideoControl.h"
+#include "mmafunctionserver.h"
+#include "cmmavideocontrol.h"
+//#include "CMIDToolkit.h"
+#include "cmmadeleterefevent.h"
+#include <logger.h>
+
+#include <JniEnvWrapper.h>
+
+//#include <mswtclient.h>
+//#include <swtcliententry.h>
+#include "s60commonutils.h"
+#include "jstringutils.h"
+using namespace java::util;
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1construct
+(JNIEnv* aJni, jobject aControlObject, jint aControlHandle,
+ jint aEventSourceHandle, jint aToolkitHandle)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1construct + ");
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl* >(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
+
+
+ __ASSERT_DEBUG(videoControl,
+ User::Panic(_L("videocontrol::control is null"),
+ KErrArgument));
+ __ASSERT_DEBUG(eventSource,
+ User::Panic(_L("videocontrol::eventsource is null"),
+ KErrArgument));
+
+ // reference must be done, that events can sent to java side
+ jobject controlObject = aJni->NewWeakGlobalRef(aControlObject);
+
+ // CMIDToolkit* ptoolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle);
+
+ //JNIENV_TO_VM(aJni);
+ TInt error = eventSource->ExecuteTrap(&CMMAVideoControl::ConstructL,
+ videoControl,
+ controlObject,
+ eventSource,
+ eventSource->getValidJniEnv(), //Passes JavaVM*, not JNIEnv*.
+ (MMMAEventPoster*)eventSource/*,
+ ptoolkit*/);
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1construct - ");
+ return error;
+}
+
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty
+(JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
+ jint aPropertyA, jint aPropertyB, jint aPropertyType)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty");
+
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl* >(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ __ASSERT_DEBUG(videoControl,
+ User::Panic(_L("videocontrol::control is null"),
+ KErrArgument));
+ __ASSERT_DEBUG(eventSource,
+ User::Panic(_L("videocontrol::eventsource is null"),
+ KErrArgument));
+
+ TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetPropertyL,
+ videoControl,
+ aPropertyType,
+ aPropertyA,
+ aPropertyB));
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty -");
+ return error;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty
+(JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
+ jint aPropertyType)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty");
+
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl* >(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ __ASSERT_DEBUG(videoControl,
+ User::Panic(_L("videocontrol::control is null"),
+ KErrArgument));
+ __ASSERT_DEBUG(eventSource,
+ User::Panic(_L("videocontrol::evetnsource is null"),
+ KErrArgument));
+ TInt returnValue(KErrNone);
+
+ TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticGetPropertyL,
+ videoControl,
+ aPropertyType,
+ &returnValue));
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty - ");
+ if (error == KErrNone)
+ {
+ return returnValue;
+ }
+ return error;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot
+(JNIEnv* aJni, jobject, jint aControlHandle, jint aEventSourceHandle,
+ jstring aProperties)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot + ");
+
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl* >(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ __ASSERT_DEBUG(videoControl,
+ User::Panic(_L("videocontrol::control is null"),
+ KErrArgument));
+ __ASSERT_DEBUG(eventSource,
+ User::Panic(_L("videocontrol::evetnsource is null"),
+ KErrArgument));
+
+ JStringUtils properties(*aJni, aProperties);
+ TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::TakeSnapShotL,
+ videoControl,
+ (const TDesC*)&properties));
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot - ");
+ return error;
+}
+
+/**
+ * Initializes dynamic display mode
+ * @return handle to MMMADirectContent or error code
+ */
+LOCAL_C jint InitDynamicMode(MMAFunctionServer* aEventSource,
+ CMMAVideoControl* aVideoControl,
+ jobject aGUIObject,
+ CMMAEvent* aDeleteRefEvent)
+{
+ TInt contentHandle = 0;
+ TInt error = aEventSource->ExecuteTrap(
+ &CMMAVideoControl::StaticInitDynamicModeL,
+ aVideoControl,
+ &contentHandle,
+ aEventSource,
+ aGUIObject,
+ aDeleteRefEvent);
+
+ // if init failed return error code
+ if (error != KErrNone)
+ {
+ contentHandle = error;
+ }
+ return contentHandle;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode
+(JNIEnv* aJni, jobject aJavaVideoControl, jint aControlHandle, jint aEventSourceHandle,
+ jobject aJavaDisplayObj, jobject aComponent)
+{
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode +");
+ LOG1( EJavaMMAPI, EInfo, "aControlHandle = %d", aControlHandle);
+ LOG1( EJavaMMAPI, EInfo, "aEventSourceHandle = %d", aEventSourceHandle);
+// LOG1( EJavaMMAPI, EInfo, "aComponentHandle = %d", aComponentHandle);
+
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl* >(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ jobject javaVideoControlPeer = aJni->NewWeakGlobalRef(aJavaVideoControl);
+
+ // Reference need to created to the component that component won't be deleted
+ // before display associated to it.
+ jobject componentRef = aJni->NewGlobalRef(aComponent);
+ if (componentRef == NULL)
+ {
+ return KErrNoMemory;
+ }
+ // Component reference need to be deleted in controls destructor. Created here to
+ // be sure that reference can be deleted. .
+ CMMAEvent* deleteRefEvent = new CMMADeleteRefEvent(componentRef);
+ // Cleanup stack is not needed, because static init takes the ownership and
+ // cannot leave before that.
+ if (!deleteRefEvent)
+ {
+ aJni->DeleteGlobalRef(componentRef);
+ return KErrNoMemory;
+ }
+
+// for javaside display object // TODO: delete this object after its not required in destructor of control
+
+ // Reference need to created to the component that component won't be deleted
+ // before display associated to it.
+ jobject javaDisplayRef = aJni->NewGlobalRef(aJavaDisplayObj);
+ if (javaDisplayRef == NULL)
+ {
+ return KErrNoMemory;
+ }
+
+ /*// other modes has component
+ if (aComponentHandle == 0)
+ {
+ return InitDynamicMode(eventSource,
+ videoControl,
+ componentRef,
+ deleteRefEvent);
+ }
+ */
+ // MMIDComponent* component = JavaUnhand< MMIDComponent >(aComponentHandle);
+
+
+ __ASSERT_DEBUG(videoControl,
+ User::Panic(_L("videocontrol::control is null"),
+ KErrArgument));
+// __ASSERT_DEBUG(component,
+// User::Panic(_L("videocontrol::component is null"),
+// KErrArgument));
+ __ASSERT_DEBUG(eventSource,
+ User::Panic(_L("videocontrol::eventsource is null"),
+ KErrArgument));
+ TInt handle(0);
+
+ TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticInitL,
+ videoControl,
+ javaDisplayRef,
+ eventSource,
+ &handle,
+ deleteRefEvent));
+ LOG( EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode - ");
+ if (error == KErrNone)
+ {
+ return handle;
+ }
+ return error;
+}
+
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1setForeground
+(JNIEnv* /*aJni*/, jobject, jint aControlHandle, jint aEventSourceHandle, jint aIsForeground)
+{
+ LOG1( EJavaMMAPI, EInfo, "_1setForeground + FOREGROUND = %d",aIsForeground);
+ CMMAVideoControl* videoControl =
+ reinterpret_cast< CMMAVideoControl *>(aControlHandle);
+
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ TInt handle(0);
+ TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetForegroundL,
+ videoControl,
+ aIsForeground));
+ if (error == KErrNone)
+ {
+ LOG( EJavaMMAPI, EInfo, "_1setForeground -");
+ return handle;
+ }
+
+ LOG( EJavaMMAPI, EInfo, "_1setForeground -");
+ return error;
+}
+JNIEXPORT jboolean JNICALL Java_com_nokia_microedition_media_control_VideoControl__1isESWT
+(JNIEnv *, jobject)
+{/*
+ MSwtClient* client = NULL;
+ TRAP_IGNORE(client = SWT::CreateClientL());
+
+ if (!client)
+ {
+ return false; // LCDUI midlet running
+ }
+ else
+ {
+ delete client;
+ client = NULL;
+ return true; // eSWT midlet running
+ }
+*/
+ // enable above code once you have support for eswt in 3.2.3, it is already enable for 5.0
+return false;
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/baseline/src/volumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class has JNI wrappers for CMMAVolumeControl
+*
+*/
+
+//#include <jutils.h>
+//#include "mmapiutils.h"
+
+#include "com_nokia_microedition_media_control_VolumeControl.h"
+#include "mmafunctionserver.h"
+#include "cmmavolumecontrol.h"
+
+
+/*
+ * Class: com_nokia_microedition_media_control_VolumeControl
+ * Method: _setLevel
+ * Signature: (III)I
+ */
+
+JNIEXPORT int JNICALL Java_com_nokia_microedition_media_control_VolumeControl__1setLevel
+(JNIEnv *, jclass , jint aEventSource, jint aVolumeControl, jint aLevel)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAVolumeControl* volumeControl =
+ reinterpret_cast< CMMAVolumeControl* >(aVolumeControl);
+
+ TInt error = eventSource->ExecuteTrap(&CMMAVolumeControl::StaticSetLevelL,
+ volumeControl,
+ aLevel);
+ return error;
+}
+
+/*
+ * Class: com_nokia_microedition_media_control_VolumeControl
+ * Method: _getLevel
+ * Signature: (II)I
+ */
+
+JNIEXPORT int JNICALL Java_com_nokia_microedition_media_control_VolumeControl__1getLevel
+(JNIEnv *, jclass , jint aEventSource, jint aVolumeControl)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer* >(aEventSource);
+
+ CMMAVolumeControl* volumeControl =
+ reinterpret_cast< CMMAVolumeControl* >(aVolumeControl);
+
+ TInt level(0);
+ TInt error = eventSource->ExecuteTrap(&CMMAVolumeControl::StaticGetLevelL,
+ volumeControl, &level);
+ if (error == KErrNone)
+ {
+ return level;
+ }
+ return error;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,205 @@
+<!--
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+-->
+
+<project name="javamobilemedia" default="deploy" basedir=".">
+
+ <import file="../../../build/utilities.xml"/>
+
+
+ <!-- Needed by the utilities.xml. See the description form the utilities.xml
+ file -->
+
+ <target name="compile">
+ <omj.javac classpath="${classpath}:${compile.result.root}/eswtqt/classes/first:${compile.result.root}/openlcdui/classes/first:${compile.result.root}/javautils/classes/first"/>
+ </target>
+
+<!-- conditional compilation variation depending upon the platform
+-->
+ <target name="init.component.properties">
+ <condition property="java.src.paths" value="../baseline/javasrc:../volumekeys/javasrc:../baseline/javasrc.emc" else="../baseline/javasrc:../volumekeys/javasrc:../baseline/javasrc.mmf">
+ <isset property="RD_JAVA_HTTP_EMC_ENABLED"/>
+ </condition>
+ <echo message="java.src.paths = ${java.src.paths}"/>
+ </target>
+
+ <condition property="javah.classnames" value="com.nokia.microedition.media.BufferDataSource,
+ com.nokia.microedition.media.BufferSourceStream,
+ com.nokia.microedition.media.ConnectorDataSource,
+ com.nokia.microedition.media.ControlContainer,
+ com.nokia.microedition.media.HttpDataSource,
+ com.nokia.microedition.media.InputStreamDataSource,
+ com.nokia.microedition.media.InputStreamSeekControl,
+ com.nokia.microedition.media.InputStreamSourceStream,
+ com.nokia.microedition.media.InternalPlayer,
+ com.nokia.microedition.media.Locator,
+ com.nokia.microedition.media.ManagerImpl,
+ com.nokia.microedition.media.MMAInvokeListener,
+ com.nokia.microedition.media.NativePlayerFactory,
+ com.nokia.microedition.media.PlayerBase,
+ com.nokia.microedition.media.PlayerImpl,
+ com.nokia.microedition.media.PlayerListenerImpl,
+ com.nokia.microedition.media.PlugIn,
+ com.nokia.microedition.media.SeekControl,
+ com.nokia.microedition.media.Setup,
+ com.nokia.microedition.media.SourcePlayer,
+ com.nokia.microedition.media.SystemTimeBase,
+ com.nokia.microedition.media.control.ControlImpl,
+ com.nokia.microedition.media.control.FramePositioningControl,
+ com.nokia.microedition.media.control.MetaDataControl,
+ com.nokia.microedition.media.control.MIDIControl,
+ com.nokia.microedition.media.control.MMACanvasDisplay,
+ com.nokia.microedition.media.control.BaseDisplay,
+ com.nokia.microedition.media.control.MMAGUIFactory,
+ com.nokia.microedition.media.control.PitchControl,
+ com.nokia.microedition.media.control.RateControl,
+ com.nokia.microedition.media.control.RecordControl,
+ com.nokia.microedition.media.control.StopTimeControl,
+ com.nokia.microedition.media.control.TempoControl,
+ com.nokia.microedition.media.control.VideoControl,
+ com.nokia.microedition.media.control.VideoItem,
+ com.nokia.microedition.media.control.VolumeControl,
+ com.nokia.microedition.media.protocol.capture.audio.Protocol,
+ com.nokia.microedition.media.protocol.capture.devcam0.Protocol,
+ com.nokia.microedition.media.protocol.capture.devcam1.Protocol,
+ com.nokia.microedition.media.protocol.capture.video.Protocol,
+ com.nokia.microedition.media.protocol.capture.Protocol,
+ com.nokia.microedition.media.protocol.device.midi.Protocol,
+ com.nokia.microedition.media.protocol.device.tone.Protocol,
+ com.nokia.microedition.media.protocol.device.Protocol,
+ com.nokia.microedition.media.protocol.file.Protocol,
+ com.nokia.microedition.media.protocol.http.Protocol,
+ com.nokia.microedition.media.protocol.https.Protocol,
+ com.nokia.microedition.media.protocol.rtsp.Protocol,
+ com.nokia.microedition.media.protocol.ConnectorProtocol,
+ com.nokia.microedition.media.protocol.NativeBase,
+ com.nokia.microedition.media.protocol.OutputStreamWriter,
+ com.nokia.microedition.media.protocol.Protocol,
+ com.nokia.microedition.media.protocol.ProtocolFactory,
+ com.nokia.microedition.media.protocol.ProtocolPackage,
+ com.nokia.microedition.media.protocol.SeekThread,
+ com.nokia.microedition.media.protocol.SourceStreamReader,
+ com.nokia.microedition.media.tone.BlockEndEvent,
+ com.nokia.microedition.media.tone.BlockStartEvent,
+ com.nokia.microedition.media.tone.Event,
+ com.nokia.microedition.media.tone.EventList,
+ com.nokia.microedition.media.tone.MidiSequence,
+ com.nokia.microedition.media.tone.MidiSequenceException,
+ com.nokia.microedition.media.tone.MidiToneConstants,
+ com.nokia.microedition.media.tone.PlayBlockEvent,
+ com.nokia.microedition.media.tone.PlayToneImpl,
+ com.nokia.microedition.media.tone.RepeatEvent,
+ com.nokia.microedition.media.tone.ToneEvent,
+ com.nokia.microedition.media.tone.TonePlayer,
+ com.nokia.microedition.media.tone.ToneSequence,
+ com.nokia.microedition.media.tone.VolumeEvent,
+ com.nokia.microedition.volumekeys.ForegroundListener,
+ com.nokia.microedition.media.protocol.EMCSourceInfo"
+ else="com.nokia.microedition.media.BufferDataSource,
+ com.nokia.microedition.media.BufferSourceStream,
+ com.nokia.microedition.media.ConnectorDataSource,
+ com.nokia.microedition.media.ControlContainer,
+ com.nokia.microedition.media.HttpDataSource,
+ com.nokia.microedition.media.InputStreamDataSource,
+ com.nokia.microedition.media.InputStreamSeekControl,
+ com.nokia.microedition.media.InputStreamSourceStream,
+ com.nokia.microedition.media.InternalPlayer,
+ com.nokia.microedition.media.Locator,
+ com.nokia.microedition.media.ManagerImpl,
+ com.nokia.microedition.media.MMAInvokeListener,
+ com.nokia.microedition.media.NativePlayerFactory,
+ com.nokia.microedition.media.PlayerBase,
+ com.nokia.microedition.media.PlayerImpl,
+ com.nokia.microedition.media.PlayerListenerImpl,
+ com.nokia.microedition.media.PlugIn,
+ com.nokia.microedition.media.SeekControl,
+ com.nokia.microedition.media.Setup,
+ com.nokia.microedition.media.SourcePlayer,
+ com.nokia.microedition.media.SystemTimeBase,
+ com.nokia.microedition.media.control.ControlImpl,
+ com.nokia.microedition.media.control.FramePositioningControl,
+ com.nokia.microedition.media.control.MetaDataControl,
+ com.nokia.microedition.media.control.MIDIControl,
+ com.nokia.microedition.media.control.MMAGUIFactory,
+ com.nokia.microedition.media.control.PitchControl,
+ com.nokia.microedition.media.control.RateControl,
+ com.nokia.microedition.media.control.RecordControl,
+ com.nokia.microedition.media.control.StopTimeControl,
+ com.nokia.microedition.media.control.TempoControl,
+ com.nokia.microedition.media.control.VideoControl,
+ com.nokia.microedition.media.control.VideoItem,
+ com.nokia.microedition.media.control.VolumeControl,
+ com.nokia.microedition.media.protocol.capture.audio.Protocol,
+ com.nokia.microedition.media.protocol.capture.devcam0.Protocol,
+ com.nokia.microedition.media.protocol.capture.devcam1.Protocol,
+ com.nokia.microedition.media.protocol.capture.video.Protocol,
+ com.nokia.microedition.media.protocol.capture.Protocol,
+ com.nokia.microedition.media.protocol.device.midi.Protocol,
+ com.nokia.microedition.media.protocol.device.tone.Protocol,
+ com.nokia.microedition.media.protocol.device.Protocol,
+ com.nokia.microedition.media.protocol.file.Protocol,
+ com.nokia.microedition.media.protocol.http.Protocol,
+ com.nokia.microedition.media.protocol.https.Protocol,
+ com.nokia.microedition.media.protocol.rtsp.Protocol,
+ com.nokia.microedition.media.protocol.ConnectorProtocol,
+ com.nokia.microedition.media.protocol.NativeBase,
+ com.nokia.microedition.media.protocol.OutputStreamWriter,
+ com.nokia.microedition.media.protocol.Protocol,
+ com.nokia.microedition.media.protocol.ProtocolFactory,
+ com.nokia.microedition.media.protocol.ProtocolPackage,
+ com.nokia.microedition.media.protocol.SeekThread,
+ com.nokia.microedition.media.protocol.SourceStreamReader,
+ com.nokia.microedition.media.tone.BlockEndEvent,
+ com.nokia.microedition.media.tone.BlockStartEvent,
+ com.nokia.microedition.media.tone.Event,
+ com.nokia.microedition.media.tone.EventList,
+ com.nokia.microedition.media.tone.MidiSequence,
+ com.nokia.microedition.media.tone.MidiSequenceException,
+ com.nokia.microedition.media.tone.MidiToneConstants,
+ com.nokia.microedition.media.tone.PlayBlockEvent,
+ com.nokia.microedition.media.tone.PlayToneImpl,
+ com.nokia.microedition.media.tone.RepeatEvent,
+ com.nokia.microedition.media.tone.ToneEvent,
+ com.nokia.microedition.media.tone.TonePlayer,
+ com.nokia.microedition.media.tone.ToneSequence,
+ com.nokia.microedition.media.tone.VolumeEvent,
+ com.nokia.microedition.volumekeys.ForegroundListener,
+ com.nokia.microedition.volumekeys.LCDUIForegroundListener">
+ <isset property="RD_JAVA_HTTP_EMC_ENABLED"/>
+ </condition>
+
+
+ <target name="system.properties">
+ <properties>
+ audio.encodings=:mobilemedia.DynamicPropertyHandler
+ supports.video.capture=:mobilemedia.DynamicPropertyHandler
+ video.encodings=:mobilemedia.DynamicPropertyHandler
+ microedition.media.version=1.2
+ supports.audio.capture=true
+ supports.mixing=true
+ supports.recording=true
+ video.snapshot.encodings=encoding=png encoding=jpeg encoding=image/png encoding=image/jpeg encoding=image/jpg encoding=image/gif encoding=image/bmp
+ </properties>
+
+ </target>
+
+ <target name="create.internal.api.jar">
+ <omj.internal.apis includes="com/nokia/microedition/media/control/ControlImpl.class,
+ com/nokia/microedition/media/control/MMAGUIFactory.class"/>
+ </target>
+
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/bwins/javamobilemediau.def Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,79 @@
+EXPORTS
+ ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
+ ?SetLoopCount@CMMAPlayer@@UAEXH@Z @ 2 NONAME ; void CMMAPlayer::SetLoopCount(int)
+ ?PostObjectEvent@CMMAPlayer@@QAEXW4TEventType@CMMAPlayerEvent@@PAV_jobject@@@Z @ 3 NONAME ; void CMMAPlayer::PostObjectEvent(enum CMMAPlayerEvent::TEventType, class _jobject *)
+ ?PrefetchFileL@CMMAEMCAudioPlayer@@MAEXXZ @ 4 NONAME ; void CMMAEMCAudioPlayer::PrefetchFileL(void)
+ ?AddControlL@CMMAPlayer@@UAEXPAVCMMAControl@@@Z @ 5 NONAME ; void CMMAPlayer::AddControlL(class CMMAControl *)
+ ?NotifyWithStringEvent@CMMAVideoPlayer@@UAEXW4TEventType@CMMAPlayerEvent@@ABVTDesC16@@@Z @ 6 NONAME ; void CMMAVideoPlayer::NotifyWithStringEvent(enum CMMAPlayerEvent::TEventType, class TDesC16 const &)
+ ?PostStringEvent@CMMAPlayer@@QAEXW4TEventType@CMMAPlayerEvent@@ABVTDesC16@@@Z @ 7 NONAME ; void CMMAPlayer::PostStringEvent(enum CMMAPlayerEvent::TEventType, class TDesC16 const &)
+ ?SnapshotEncoded@CMMAVideoPlayer@@UAEPAVHBufC8@@XZ @ 8 NONAME ; class HBufC8 * CMMAVideoPlayer::SnapshotEncoded(void)
+ ?DoOpen@CMMAMMFPlayerBase@@MAEHVTUid@@ABVTDesC8@@01VTMMFPrioritySettings@@@Z @ 9 NONAME ; int CMMAMMFPlayerBase::DoOpen(class TUid, class TDesC8 const &, class TUid, class TDesC8 const &, class TMMFPrioritySettings)
+ ?StaticControl@CMMAPlayer@@SAPAVCMMAControl@@PAV1@H@Z @ 10 NONAME ; class CMMAControl * CMMAPlayer::StaticControl(class CMMAPlayer *, int)
+ ?Type@CMMAVideoPlayer@@MAEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CMMAVideoPlayer::Type(void)
+ ??0CMMAEMCAudioVolumeControl@@IAE@AAVCMMAEMCAudioPlayer@@@Z @ 12 NONAME ; CMMAEMCAudioVolumeControl::CMMAEMCAudioVolumeControl(class CMMAEMCAudioPlayer &)
+ ?PublicClassName@CMMAControl@@UBEABVTDesC16@@XZ @ 13 NONAME ; class TDesC16 const & CMMAControl::PublicClassName(void) const
+ ?PostActionCompletedStart@CMMAPlayer@@QAEXXZ @ 14 NONAME ; void CMMAPlayer::PostActionCompletedStart(void)
+ ?Controller@CMMAMMFPlayerBase@@QAEAAVRMMFController@@XZ @ 15 NONAME ; class RMMFController & CMMAMMFPlayerBase::Controller(void)
+ ?PrefetchDataL@CMMAAudioPlayer@@MAEXABVTDesC8@@@Z @ 16 NONAME ; void CMMAAudioPlayer::PrefetchDataL(class TDesC8 const &)
+ ??0CMMAVideoUrlPlayer@@IAE@PAVCMMAMMFResolver@@@Z @ 17 NONAME ; CMMAVideoUrlPlayer::CMMAVideoUrlPlayer(class CMMAMMFResolver *)
+ ?CloseL@CMMAVideoUrlPlayer@@UAEXXZ @ 18 NONAME ; void CMMAVideoUrlPlayer::CloseL(void)
+ ?SnapshotBitmap@CMMAVideoPlayer@@UAEPAVCFbsBitmap@@XZ @ 19 NONAME ; class CFbsBitmap * CMMAVideoPlayer::SnapshotBitmap(void)
+ ?NewL@CTimeOutTimer@@SAPAV1@HAAVMTimeOutNotify@@@Z @ 20 NONAME ; class CTimeOutTimer * CTimeOutTimer::NewL(int, class MTimeOutNotify &)
+ ?StartL@CMMAVideoUrlPlayer@@UAEXXZ @ 21 NONAME ; void CMMAVideoUrlPlayer::StartL(void)
+ ?ReadCompletedL@CMMAEMCAudioPlayer@@UAEXHABVTDesC8@@@Z @ 22 NONAME ; void CMMAEMCAudioPlayer::ReadCompletedL(int, class TDesC8 const &)
+ ?NewL@CMMAEMCAudioVolumeControl@@SAPAV1@AAVCMMAEMCAudioPlayer@@@Z @ 23 NONAME ; class CMMAEMCAudioVolumeControl * CMMAEMCAudioVolumeControl::NewL(class CMMAEMCAudioPlayer &)
+ ?HandleEvent@CMMAVideoUrlPlayer@@MAEXABVTMMFEvent@@@Z @ 24 NONAME ; void CMMAVideoUrlPlayer::HandleEvent(class TMMFEvent const &)
+ ?ConstructL@CMMAVideoUrlPlayer@@IAEXABVTDesC16@@@Z @ 25 NONAME ; void CMMAVideoUrlPlayer::ConstructL(class TDesC16 const &)
+ ?SetDisplayL@CMMAVideoPlayer@@UAEXPAVMMMADisplay@@@Z @ 26 NONAME ; void CMMAVideoPlayer::SetDisplayL(class MMMADisplay *)
+ ?TakeSnapshotL@CMMAVideoPlayer@@UAE?AW4TEncoding@MMMASnapshot@@PAVTRequestStatus@@ABVTSize@@ABVCMMAImageSettings@@@Z @ 27 NONAME ; enum MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(class TRequestStatus *, class TSize const &, class CMMAImageSettings const &)
+ ?StaticAddObjectFromHandleL@MMAFunctionServer@@SAXPAV1@H@Z @ 28 NONAME ; void MMAFunctionServer::StaticAddObjectFromHandleL(class MMAFunctionServer *, int)
+ ?SnapshotReady@CMMAVideoControl@@UAEXXZ @ 29 NONAME ; void CMMAVideoControl::SnapshotReady(void)
+ ?CreatePlayerL@CMMAMMFPlayerFactory@@MAEPAVCMMAPlayer@@PAVCMMFFormatSelectionParameters@@PBVTDesC16@@@Z @ 30 NONAME ; class CMMAPlayer * CMMAMMFPlayerFactory::CreatePlayerL(class CMMFFormatSelectionParameters *, class TDesC16 const *)
+ ?PlayCompleteL@CMMAEMCAudioPlayer@@MAEXH@Z @ 31 NONAME ; void CMMAEMCAudioPlayer::PlayCompleteL(int)
+ ?NewL@CMMAAudioVolumeControl@@SAPAV1@PAVCMMAAudioPlayer@@@Z @ 32 NONAME ; class CMMAAudioVolumeControl * CMMAAudioVolumeControl::NewL(class CMMAAudioPlayer *)
+ ?PrefetchDataL@CMMAEMCAudioPlayer@@MAEXABVTDesC8@@@Z @ 33 NONAME ; void CMMAEMCAudioPlayer::PrefetchDataL(class TDesC8 const &)
+ ?HandlePlaybackCompleteL@CMMAAudioPlayer@@UAEXXZ @ 34 NONAME ; void CMMAAudioPlayer::HandlePlaybackCompleteL(void)
+ ?RemoveStateListener@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 35 NONAME ; void CMMAPlayer::RemoveStateListener(class MMMAPlayerStateListener *)
+ ??0CMMAEMCAudioPlayer@@IAE@PAVCMMAEMCResolver@@@Z @ 36 NONAME ; CMMAEMCAudioPlayer::CMMAEMCAudioPlayer(class CMMAEMCResolver *)
+ ?MidiClient@CMMAMIDIPlayer@@QBEPAVCMidiClientUtility@@XZ @ 37 NONAME ; class CMidiClientUtility * CMMAMIDIPlayer::MidiClient(void) const
+ ??1CMMAVideoUrlPlayer@@UAE@XZ @ 38 NONAME ; CMMAVideoUrlPlayer::~CMMAVideoUrlPlayer(void)
+ ?ErrorPlaybackComplete@CMMAAudioPlayer@@UAEXH@Z @ 39 NONAME ; void CMMAAudioPlayer::ErrorPlaybackComplete(int)
+ ??1CMMAEMCAudioPlayer@@UAE@XZ @ 40 NONAME ; CMMAEMCAudioPlayer::~CMMAEMCAudioPlayer(void)
+ ?MMFactory@CMMAEMCPlayerBase@@QAEPAVCMultimediaFactory@multimedia@@XZ @ 41 NONAME ; class multimedia::CMultimediaFactory * CMMAEMCPlayerBase::MMFactory(void)
+ ?Players@MMAFunctionServer@@QAEAAV?$RPointerArray@VCMMAPlayer@@@@XZ @ 42 NONAME ; class RPointerArray<class CMMAPlayer> & MMAFunctionServer::Players(void)
+ ?PreparePluginSelectionParametersL@CMMAMMFPlayerFactory@@MAEXPAVCMMAMMFResolver@@PAVCMMFFormatSelectionParameters@@@Z @ 43 NONAME ; void CMMAMMFPlayerFactory::PreparePluginSelectionParametersL(class CMMAMMFResolver *, class CMMFFormatSelectionParameters *)
+ ?PostActionCompleted@CMMAPlayer@@QAEXH@Z @ 44 NONAME ; void CMMAPlayer::PostActionCompleted(int)
+ ?RealizeL@CMMAVideoUrlPlayer@@UAEXXZ @ 45 NONAME ; void CMMAVideoUrlPlayer::RealizeL(void)
+ ?SetPlayerInstanceObserver@MMAFunctionServer@@QAEXPAVMMMAPlayerInstanceObserver@@@Z @ 46 NONAME ; void MMAFunctionServer::SetPlayerInstanceObserver(class MMMAPlayerInstanceObserver *)
+ ?SetPlayerListenerObjectL@CMMAVideoPlayer@@UAEXPAV_jobject@@PAUJNIEnv_@@PAVMMMAEventPoster@@@Z @ 47 NONAME ; void CMMAVideoPlayer::SetPlayerListenerObjectL(class _jobject *, struct JNIEnv_ *, class MMMAEventPoster *)
+ ?RealizeL@CMMAEMCAudioPlayer@@UAEXXZ @ 48 NONAME ; void CMMAEMCAudioPlayer::RealizeL(void)
+ ?ControlCount@CMMAPlayer@@QAEHXZ @ 49 NONAME ; int CMMAPlayer::ControlCount(void)
+ ?DoSetLevelL@CMMAEMCAudioVolumeControl@@UAEXH@Z @ 50 NONAME ; void CMMAEMCAudioVolumeControl::DoSetLevelL(int)
+ ?PlayCompleteL@CMMAAudioPlayer@@MAEXH@Z @ 51 NONAME ; void CMMAAudioPlayer::PlayCompleteL(int)
+ ?SourceSize@CMMAVideoPlayer@@UAE?AVTSize@@XZ @ 52 NONAME ; class TSize CMMAVideoPlayer::SourceSize(void)
+ ?SnapshoterL@CMMAVideoPlayer@@UAEPAVMMMASnapshot@@XZ @ 53 NONAME ; class MMMASnapshot * CMMAVideoPlayer::SnapshoterL(void)
+ ?GetDuration@CMMAMMFPlayerBase@@UAEXPA_J@Z @ 54 NONAME ; void CMMAMMFPlayerBase::GetDuration(long long *)
+ ?AddPlayerFactoryL@CMMAManager@@QAEXPAVMMMAPlayerFactory@@@Z @ 55 NONAME ; void CMMAManager::AddPlayerFactoryL(class MMMAPlayerFactory *)
+ ??0CMMAVideoControl@@QAE@PAVMMMAGuiPlayer@@@Z @ 56 NONAME ; CMMAVideoControl::CMMAVideoControl(class MMMAGuiPlayer *)
+ ?ClassName@CMMAVideoControl@@UBEABVTDesC16@@XZ @ 57 NONAME ; class TDesC16 const & CMMAVideoControl::ClassName(void) const
+ ??1CMMAMMFPlayerFactory@@UAE@XZ @ 58 NONAME ; CMMAMMFPlayerFactory::~CMMAMMFPlayerFactory(void)
+ ?SetVolumeLevelL@CMMAVolumeControl@@QAEXHH@Z @ 59 NONAME ; void CMMAVolumeControl::SetVolumeLevelL(int, int)
+ ?PostActionCompletedFile@CMMAPlayer@@QAEXXZ @ 60 NONAME ; void CMMAPlayer::PostActionCompletedFile(void)
+ ?DoGetLevelL@CMMAEMCAudioVolumeControl@@UAEHXZ @ 61 NONAME ; int CMMAEMCAudioVolumeControl::DoGetLevelL(void)
+ ?ReadCompletedL@CMMAVideoPlayer@@MAEXHABVTDesC8@@@Z @ 62 NONAME ; void CMMAVideoPlayer::ReadCompletedL(int, class TDesC8 const &)
+ ?Type@CMMAEMCAudioPlayer@@UAEABVTDesC16@@XZ @ 63 NONAME ; class TDesC16 const & CMMAEMCAudioPlayer::Type(void)
+ ?GetMediaTime@CMMAVideoUrlPlayer@@UAEXPA_J@Z @ 64 NONAME ; void CMMAVideoUrlPlayer::GetMediaTime(long long *)
+ ?DeallocateL@CMMAVideoUrlPlayer@@UAEXXZ @ 65 NONAME ; void CMMAVideoUrlPlayer::DeallocateL(void)
+ ??0CMMAMMFPlayerFactory@@QAE@XZ @ 66 NONAME ; CMMAMMFPlayerFactory::CMMAMMFPlayerFactory(void)
+ ?AddStateListenerL@CMMAPlayer@@QAEXPAVMMMAPlayerStateListener@@@Z @ 67 NONAME ; void CMMAPlayer::AddStateListenerL(class MMMAPlayerStateListener *)
+ ?StreamControl@CMMAEMCPlayerBase@@QAEPAVMStreamControl@multimedia@@XZ @ 68 NONAME ; class multimedia::MStreamControl * CMMAEMCPlayerBase::StreamControl(void)
+ ?PrefetchFileL@CMMAAudioPlayer@@MAEXXZ @ 69 NONAME ; void CMMAAudioPlayer::PrefetchFileL(void)
+ ?PrefetchL@CMMAVideoUrlPlayer@@UAEXXZ @ 70 NONAME ; void CMMAVideoUrlPlayer::PrefetchL(void)
+ ?AddLevelL@CMMAVolumeControl@@QAEHXZ @ 71 NONAME ; int CMMAVolumeControl::AddLevelL(void)
+ ?ConstructL@CMMAEMCAudioPlayer@@IAEXXZ @ 72 NONAME ; void CMMAEMCAudioPlayer::ConstructL(void)
+ ?Control@CMMAPlayer@@QAEPAVCMMAControl@@H@Z @ 73 NONAME ; class CMMAControl * CMMAPlayer::Control(int)
+ ?PrefetchL@CMMAEMCAudioPlayer@@UAEXXZ @ 74 NONAME ; void CMMAEMCAudioPlayer::PrefetchL(void)
+ ?StopL@CMMAVideoUrlPlayer@@UAEXH@Z @ 75 NONAME ; void CMMAVideoUrlPlayer::StopL(int)
+ ??1CMMAVideoControl@@UAE@XZ @ 76 NONAME ; CMMAVideoControl::~CMMAVideoControl(void)
+ ?AddSourceStreamL@CMMAPlayer@@MAEPAVCMMASourceStream@@PAUJNIEnv_@@PAVMMAFunctionServer@@PAV_jobject@@@Z @ 77 NONAME ; class CMMASourceStream * CMMAPlayer::AddSourceStreamL(struct JNIEnv_ *, class MMAFunctionServer *, class _jobject *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/dc_exports.inf Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Exports for direct content subsystem
+*
+*/
+
+
+#ifndef __MULTIMEDIA11_DC_EXPORTS_INF__
+#define __MULTIMEDIA11_DC_EXPORTS_INF__
+
+PRJ_EXPORTS
+
+../baseline/inc/mmmacontainer.h |../../../javauis/inc/mmmacontainer.h
+../baseline/inc/mmmadirectcontent.h |../../../javauis/inc/mmmadirectContent.h
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/eabi/javamobilemediau.def Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,148 @@
+EXPORTS
+ _Z10jni_lookupPKc @ 1 NONAME
+ _ZN10CMMAPlayer11AddControlLEP11CMMAControl @ 2 NONAME
+ _ZN10CMMAPlayer12ControlCountEv @ 3 NONAME
+ _ZN10CMMAPlayer12SetLoopCountEi @ 4 NONAME
+ _ZN10CMMAPlayer15PostObjectEventEN15CMMAPlayerEvent10TEventTypeEP8_jobject @ 5 NONAME
+ _ZN10CMMAPlayer15PostStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 6 NONAME
+ _ZN10CMMAPlayer16AddSourceStreamLEP7JNIEnv_P17MMAFunctionServerP8_jobject @ 7 NONAME
+ _ZN10CMMAPlayer17AddStateListenerLEP23MMMAPlayerStateListener @ 8 NONAME
+ _ZN10CMMAPlayer19RemoveStateListenerEP23MMMAPlayerStateListener @ 9 NONAME
+ _ZN10CMMAPlayer7ControlEi @ 10 NONAME
+ _ZN11CMMAManager17AddPlayerFactoryLEP17MMMAPlayerFactory @ 11 NONAME
+ _ZN13CTimeOutTimer4NewLEiR14MTimeOutNotify @ 12 NONAME
+ _ZN15CMMAAudioPlayer13PlayCompleteLEi @ 13 NONAME
+ _ZN15CMMAAudioPlayer13PrefetchDataLERK6TDesC8 @ 14 NONAME
+ _ZN15CMMAAudioPlayer13PrefetchFileLEv @ 15 NONAME
+ _ZN15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 16 NONAME
+ _ZN15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 17 NONAME
+ _ZN15CMMAVideoPlayer10SourceSizeEv @ 18 NONAME
+ _ZN15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 19 NONAME
+ _ZN15CMMAVideoPlayer11SnapshoterLEv @ 20 NONAME
+ _ZN15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 21 NONAME
+ _ZN15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 22 NONAME
+ _ZN15CMMAVideoPlayer14SnapshotBitmapEv @ 23 NONAME
+ _ZN15CMMAVideoPlayer15SnapshotEncodedEv @ 24 NONAME
+ _ZN15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 25 NONAME
+ _ZN15CMMAVideoPlayer24SetPlayerListenerObjectLEP8_jobjectP7JNIEnv_P15MMMAEventPoster @ 26 NONAME
+ _ZN15CMMAVideoPlayer4TypeEv @ 27 NONAME
+ _ZN16CMMAVideoControl13SnapshotReadyEv @ 28 NONAME
+ _ZN16CMMAVideoControlC1EP13MMMAGuiPlayer @ 29 NONAME
+ _ZN16CMMAVideoControlC2EP13MMMAGuiPlayer @ 30 NONAME
+ _ZN16CMMAVideoControlD0Ev @ 31 NONAME
+ _ZN16CMMAVideoControlD1Ev @ 32 NONAME
+ _ZN16CMMAVideoControlD2Ev @ 33 NONAME
+ _ZN17CMMAEMCPlayerBase13StreamControlEv @ 34 NONAME
+ _ZN17CMMAEMCPlayerBase9MMFactoryEv @ 35 NONAME
+ _ZN17CMMAMMFPlayerBase10ControllerEv @ 36 NONAME
+ _ZN17CMMAMMFPlayerBase11GetDurationEPx @ 37 NONAME
+ _ZN17CMMAMMFPlayerBase6DoOpenE4TUidRK6TDesC8S0_S3_20TMMFPrioritySettings @ 38 NONAME
+ _ZN17CMMAVolumeControl15SetVolumeLevelLEii @ 39 NONAME
+ _ZN17CMMAVolumeControl9AddLevelLEv @ 40 NONAME
+ _ZN17MMAFunctionServer25SetPlayerInstanceObserverEP26MMMAPlayerInstanceObserver @ 41 NONAME
+ _ZN17MMAFunctionServer26StaticAddObjectFromHandleLEPS_i @ 42 NONAME
+ _ZN17MMAFunctionServer7PlayersEv @ 43 NONAME
+ _ZN18CMMAEMCAudioPlayer10ConstructLEv @ 44 NONAME
+ _ZN18CMMAEMCAudioPlayer13PlayCompleteLEi @ 45 NONAME
+ _ZN18CMMAEMCAudioPlayer13PrefetchDataLERK6TDesC8 @ 46 NONAME
+ _ZN18CMMAEMCAudioPlayer13PrefetchFileLEv @ 47 NONAME
+ _ZN18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 48 NONAME
+ _ZN18CMMAEMCAudioPlayer4TypeEv @ 49 NONAME
+ _ZN18CMMAEMCAudioPlayer8RealizeLEv @ 50 NONAME
+ _ZN18CMMAEMCAudioPlayer9PrefetchLEv @ 51 NONAME
+ _ZN18CMMAEMCAudioPlayerC1EP15CMMAEMCResolver @ 52 NONAME
+ _ZN18CMMAEMCAudioPlayerC2EP15CMMAEMCResolver @ 53 NONAME
+ _ZN18CMMAEMCAudioPlayerD0Ev @ 54 NONAME
+ _ZN18CMMAEMCAudioPlayerD1Ev @ 55 NONAME
+ _ZN18CMMAEMCAudioPlayerD2Ev @ 56 NONAME
+ _ZN18CMMAVideoUrlPlayer10ConstructLERK7TDesC16 @ 57 NONAME
+ _ZN18CMMAVideoUrlPlayer11DeallocateLEv @ 58 NONAME
+ _ZN18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 59 NONAME
+ _ZN18CMMAVideoUrlPlayer12GetMediaTimeEPx @ 60 NONAME
+ _ZN18CMMAVideoUrlPlayer5StopLEi @ 61 NONAME
+ _ZN18CMMAVideoUrlPlayer6CloseLEv @ 62 NONAME
+ _ZN18CMMAVideoUrlPlayer6StartLEv @ 63 NONAME
+ _ZN18CMMAVideoUrlPlayer8RealizeLEv @ 64 NONAME
+ _ZN18CMMAVideoUrlPlayer9PrefetchLEv @ 65 NONAME
+ _ZN18CMMAVideoUrlPlayerC1EP15CMMAMMFResolver @ 66 NONAME
+ _ZN18CMMAVideoUrlPlayerC2EP15CMMAMMFResolver @ 67 NONAME
+ _ZN18CMMAVideoUrlPlayerD0Ev @ 68 NONAME
+ _ZN18CMMAVideoUrlPlayerD1Ev @ 69 NONAME
+ _ZN18CMMAVideoUrlPlayerD2Ev @ 70 NONAME
+ _ZN20CMMAMMFPlayerFactory13CreatePlayerLEP29CMMFFormatSelectionParametersPK7TDesC16 @ 71 NONAME
+ _ZN20CMMAMMFPlayerFactory33PreparePluginSelectionParametersLEP15CMMAMMFResolverP29CMMFFormatSelectionParameters @ 72 NONAME
+ _ZN20CMMAMMFPlayerFactoryC2Ev @ 73 NONAME
+ _ZN20CMMAMMFPlayerFactoryD0Ev @ 74 NONAME
+ _ZN20CMMAMMFPlayerFactoryD1Ev @ 75 NONAME
+ _ZN20CMMAMMFPlayerFactoryD2Ev @ 76 NONAME
+ _ZN22CMMAAudioVolumeControl4NewLEP15CMMAAudioPlayer @ 77 NONAME
+ _ZN25CMMAEMCAudioVolumeControl11DoGetLevelLEv @ 78 NONAME
+ _ZN25CMMAEMCAudioVolumeControl11DoSetLevelLEi @ 79 NONAME
+ _ZN25CMMAEMCAudioVolumeControl4NewLER18CMMAEMCAudioPlayer @ 80 NONAME
+ _ZN25CMMAEMCAudioVolumeControlC1ER18CMMAEMCAudioPlayer @ 81 NONAME
+ _ZN25CMMAEMCAudioVolumeControlC2ER18CMMAEMCAudioPlayer @ 82 NONAME
+ _ZNK11CMMAControl15PublicClassNameEv @ 83 NONAME
+ _ZNK14CMMAMIDIPlayer10MidiClientEv @ 84 NONAME
+ _ZNK16CMMAVideoControl9ClassNameEv @ 85 NONAME
+ _ZTI10CMMAPlayer @ 86 NONAME
+ _ZTI11CMMAControl @ 87 NONAME
+ _ZTI13CTimeOutTimer @ 88 NONAME
+ _ZTI14CMMAMIDIPlayer @ 89 NONAME
+ _ZTI16CMMAVideoControl @ 90 NONAME
+ _ZTI17CMMAMMFPlayerBase @ 91 NONAME
+ _ZTI17CMMAStreamRequest @ 92 NONAME
+ _ZTI17CMMAVolumeControl @ 93 NONAME
+ _ZTI17MMAFunctionServer @ 94 NONAME
+ _ZTI18CHXMetaDataUtility @ 95 NONAME
+ _ZTI18CMMAVideoUrlPlayer @ 96 NONAME
+ _ZTI20CMMAMMFPlayerFactory @ 97 NONAME
+ _ZTI26CPlaybackCompletedCallback @ 98 NONAME
+ _ZTIN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 99 NONAME
+ _ZTIN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 100 NONAME
+ _ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 101 NONAME
+ _ZTIN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 102 NONAME
+ _ZTIN19CMMAStopTimeControl10CStopTimerE @ 103 NONAME
+ _ZTV10CMMAPlayer @ 104 NONAME
+ _ZTV11CMMAControl @ 105 NONAME
+ _ZTV13CTimeOutTimer @ 106 NONAME
+ _ZTV14CMMAMIDIPlayer @ 107 NONAME
+ _ZTV16CMMAVideoControl @ 108 NONAME
+ _ZTV17CMMAMMFPlayerBase @ 109 NONAME
+ _ZTV17CMMAStreamRequest @ 110 NONAME
+ _ZTV17CMMAVolumeControl @ 111 NONAME
+ _ZTV17MMAFunctionServer @ 112 NONAME
+ _ZTV18CHXMetaDataUtility @ 113 NONAME
+ _ZTV18CMMAVideoUrlPlayer @ 114 NONAME
+ _ZTV20CMMAMMFPlayerFactory @ 115 NONAME
+ _ZTV26CPlaybackCompletedCallback @ 116 NONAME
+ _ZTVN15CMMAMIDIControl23CChannelVolumeEventWaitE @ 117 NONAME
+ _ZTVN18CMMAVideoUrlPlayer26CMMAVideoUrlPlayerDelegateE @ 118 NONAME
+ _ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerClipStreamDelegateE @ 119 NONAME
+ _ZTVN18CMMAVideoUrlPlayer36CMMAVideoUrlPlayerLiveStreamDelegateE @ 120 NONAME
+ _ZTVN19CMMAStopTimeControl10CStopTimerE @ 121 NONAME
+ _ZThn160_N18CMMAVideoUrlPlayer11HandleEventERK9TMMFEvent @ 122 NONAME
+ _ZThn288_N15CMMAAudioPlayer21ErrorPlaybackCompleteEi @ 123 NONAME
+ _ZThn288_N15CMMAAudioPlayer23HandlePlaybackCompleteLEv @ 124 NONAME
+ _ZThn296_N15CMMAVideoPlayer10SourceSizeEv @ 125 NONAME
+ _ZThn296_N15CMMAVideoPlayer11SetDisplayLEP11MMMADisplay @ 126 NONAME
+ _ZThn296_N15CMMAVideoPlayer11SnapshoterLEv @ 127 NONAME
+ _ZThn296_N15CMMAVideoPlayer21NotifyWithStringEventEN15CMMAPlayerEvent10TEventTypeERK7TDesC16 @ 128 NONAME
+ _ZThn296_N18CMMAVideoUrlPlayerD0Ev @ 129 NONAME
+ _ZThn296_N18CMMAVideoUrlPlayerD1Ev @ 130 NONAME
+ _ZThn300_N15CMMAVideoPlayer13TakeSnapshotLEP14TRequestStatusRK5TSizeRK17CMMAImageSettings @ 131 NONAME
+ _ZThn300_N15CMMAVideoPlayer14SnapshotBitmapEv @ 132 NONAME
+ _ZThn300_N15CMMAVideoPlayer15SnapshotEncodedEv @ 133 NONAME
+ _ZThn300_N18CMMAVideoUrlPlayerD0Ev @ 134 NONAME
+ _ZThn300_N18CMMAVideoUrlPlayerD1Ev @ 135 NONAME
+ _ZThn4_N15CMMAVideoPlayer14ReadCompletedLEiRK6TDesC8 @ 136 NONAME
+ _ZThn4_N18CMMAEMCAudioPlayer14ReadCompletedLEiRK6TDesC8 @ 137 NONAME
+ _ZThn4_N18CMMAEMCAudioPlayerD0Ev @ 138 NONAME
+ _ZThn4_N18CMMAEMCAudioPlayerD1Ev @ 139 NONAME
+ _ZThn4_N18CMMAVideoUrlPlayerD0Ev @ 140 NONAME
+ _ZThn4_N18CMMAVideoUrlPlayerD1Ev @ 141 NONAME
+ _ZThn4_N20CMMAMMFPlayerFactoryD0Ev @ 142 NONAME
+ _ZThn4_N20CMMAMMFPlayerFactoryD1Ev @ 143 NONAME
+ _ZThn8_N16CMMAVideoControl13SnapshotReadyEv @ 144 NONAME
+ _ZThn8_N16CMMAVideoControlD0Ev @ 145 NONAME
+ _ZThn8_N16CMMAVideoControlD1Ev @ 146 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/exports.inf Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+PRJ_EXPORTS
+#include <platform_paths.hrh>
+#include "dc_exports.inf"
+
+../camerasound/data/CamcorderJavaCapture.wav /epoc32/release/winscw/udeb/z/system/sounds/digital/CamcorderJavaCapture.wav
+../camerasound/data/CamcorderJavaCapture.wav /epoc32/release/winscw/urel/z/system/sounds/digital/CamcorderJavaCapture.wav
+../camerasound/data/CamcorderJavaCapture.wav /epoc32/release/armv5/udeb/z/system/sounds/digital/CamcorderJavaCapture.wav
+../camerasound/data/CamcorderJavaCapture.wav /epoc32/release/armv5/urel/z/system/sounds/digital/CamcorderJavaCapture.wav
+
+../camerasound/data/CamcorderJavaStart.wav /epoc32/release/winscw/udeb/z/system/sounds/digital/CamcorderJavaStart.wav
+../camerasound/data/CamcorderJavaStart.wav /epoc32/release/winscw/urel/z/system/sounds/digital/CamcorderJavaStart.wav
+../camerasound/data/CamcorderJavaStart.wav /epoc32/release/armv5/udeb/z/system/sounds/digital/CamcorderJavaStart.wav
+../camerasound/data/CamcorderJavaStart.wav /epoc32/release/armv5/urel/z/system/sounds/digital/CamcorderJavaStart.wav
+
+// Generic configuration interface for mobilemedia cenrep settings
+// mobilemedia_102828A1 implementation specifics for cenrep data
+../conf/mobilemedia.confml APP_LAYER_CONFML(mobilemedia.confml)
+../conf/mobilemedia_102828A1.crml APP_LAYER_CRML(mobilemedia_102828A1.crml)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/build/javamobilemedia.pro Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,128 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TARGET=javamobilemedia
+TEMPLATE=lib
+CONFIG += omj java stl
+
+include(../../../inc/build_defines.pri)
+
+DEFINES += RD_JAVA_VOLUME_CONTROL
+DEFINES += RD_JAVA_OMA_DRM_V2
+
+INCLUDEPATH += /epoc32/include/mmf/common \
+# ../animated_gif/inc \
+ ../baseline/inc \
+ ../src_drmv2/inc \
+ ../directcontent/inc \
+ ../camerasound/inc \
+ ../volumekeys/inc \
+ ../audiostreaming/inc \
+ /epoc32/include/mw/Qt \
+ ../utils/inc
+
+# ../../remconobserver_akn/inc \
+
+SOURCES += ../baseline/src/*.cpp \
+ # ../animated_gif/src/*.cpp \
+ ../camerasound/src/*.cpp \
+ ../directcontent/src/*.cpp \
+ ../src_drmv2/src/*.cpp \
+ ../volumekeys/src/*.cpp \
+ ../audiostreaming/src/*.cpp \
+ ../utils/src/*.cpp
+
+contains(PROJECT_DEFINES,RD_JAVA_HTTP_EMC_ENABLED) {
+ INCLUDEPATH += ../baseline/inc.emc \
+ ../audiostreaming/inc.emc
+
+ SOURCES += ../baseline/src.emc/*.cpp \
+ ../audiostreaming/src.emc/*.cpp
+
+ LIBS += -lEnhancedMediaClient \
+ -lMetaDataUtility \
+ -lapmime\
+ -lapgrfx \
+ -lapmime \
+ -lflogger
+
+}
+else{
+ INCLUDEPATH += ../baseline/inc.mmf \
+ ../audiostreaming/inc.mmf
+
+ SOURCES += ../baseline/src.mmf/*.cpp \
+ ../audiostreaming/src.mmf/*.cpp
+}
+
+contains(PROJECT_DEFINES,RD_JAVA_NGA_ENABLED) {
+ INCLUDEPATH += ../baseline/inc.nga
+
+ SOURCES += ../baseline/src.nga/*.cpp
+
+ LIBS += -lmediaclientvideodisplay
+}
+else {
+ INCLUDEPATH += ../baseline/inc.dsa
+
+ SOURCES += ../baseline/src.dsa/*.cpp
+}
+
+LIBS += -lAknIcon \
+ -laknskins \
+ -laknskinsrv \
+ -lapgrfx \
+ -lapmime \
+ -lBitmapTransforms \
+ -lDRMHelper \
+ -lDrmAudioPlayUtility \
+ -lImageConversion \
+ -lIHL \
+ -lMMFControllerFramework \
+ -lMediaClientAudio \
+ -lMmfStandardCustomCommands \
+# -lRemConCoreApi \
+# -lRemConInterfaceBase \
+ -lbafl \
+ -lbitgdi \
+ -lcaf \
+ -lcafutils \
+ -lcentralrepository \
+ -lcone \
+ -lecam \
+ -lecom \
+ -leswtqt \
+ -lefsrv \
+ -leikcoctl \
+ -leikcore \
+ -lesock \
+ -leuser \
+ -lfbscli \
+ -lflogger \
+ -lmediaclientvideo \
+ -lmidiclient \
+ -lws32 \
+ -lhxmetadatautil \
+ -lQtGui \
+
+ # -ljavaremconobserver \
+
+
+!contains(PROJECT_DEFINES,RD_JAVA_HTTP_EMC_ENABLED) {
+ defBlock = "deffile ./~/javamobilemedia_5_0.def"
+}
+
+include(../../../build/omj.pri)
Binary file javauis/mmapi_qt/camerasound/data/CamcorderJavaCapture.wav has changed
Binary file javauis/mmapi_qt/camerasound/data/CamcorderJavaStart.wav has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/camerasound/inc/cmmacamerasound.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to play sound from file.
+*
+*/
+
+
+#ifndef CMMACAMERASOUND_H
+#define CMMACAMERASOUND_H
+
+// INCLUDES
+#include <mdaaudiosampleplayer.h>
+
+// CLASS DECLARATION
+/**
+* This class is used to play sound from file.
+*/
+NONSHARABLE_CLASS(CMMACameraSound) : public CBase,
+ public MMdaAudioPlayerCallback
+{
+public: // Constructor and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMMACameraSound* NewLC();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMMACameraSound();
+
+
+public: // New functions
+
+ /**
+ * Plays sound from a file when capturing a image.
+ */
+ static void PlayImageCaptureSoundL();
+
+ /**
+ * Plays sound from a file when video recording starts.
+ */
+ static void PlayVideoRecordSoundL();
+
+protected: // New functions
+
+ /**
+ * Plays sound from a file.
+ * @param aFileName - The full path name of the file
+ * containing the audio data.
+ */
+ void PlaySoundL(const TDesC& aFileName);
+
+
+public: // from MMdaAudioPlayerCallback
+
+ void MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds& /*aDuration*/);
+
+ void MapcPlayComplete(TInt aError);
+
+
+private: // Constructors
+
+ /**
+ * C++ default constructor.
+ */
+ CMMACameraSound();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private: //Data
+
+ CActiveSchedulerWait* iActiveSchedulerWait; // owned
+
+ TInt iError;
+};
+
+#endif // CMMACAMERASOUND_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/camerasound/src/cmmacamerasound.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to play sound from file
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cmmacamerasound.h"
+
+#include <mdaaudiosampleplayer.h>
+#include <logger.h>
+#include <AudioPreference.h>
+
+//CONSTANTS
+_LIT(KMMASnapshotSound, "Z:\\System\\Sounds\\Digital\\CamcorderJavaCapture.wav");
+_LIT(KMMAVideoSound, "Z:\\System\\Sounds\\Digital\\CamcorderJavaStart.wav");
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMMACameraSound::CMMACameraSound
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMMACameraSound::CMMACameraSound()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CMMACameraSound::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMMACameraSound* CMMACameraSound::NewLC()
+{
+ CMMACameraSound* self = new(ELeave) CMMACameraSound;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+
+// Destructor
+CMMACameraSound::~CMMACameraSound()
+{
+ delete iActiveSchedulerWait;
+}
+
+// -----------------------------------------------------------------------------
+// CMMACameraSound::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMMACameraSound::ConstructL()
+{
+ iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
+}
+
+// -----------------------------------------------------------------------------
+// PlayImageCaptureSoundL()
+// -----------------------------------------------------------------------------
+//
+void CMMACameraSound::PlayImageCaptureSoundL()
+{
+ CMMACameraSound* cameraSound = NewLC();
+ cameraSound->PlaySoundL(KMMASnapshotSound());
+ CleanupStack::PopAndDestroy(cameraSound);
+}
+
+// -----------------------------------------------------------------------------
+// PlayVideoRecordSoundL()
+// -----------------------------------------------------------------------------
+//
+void CMMACameraSound::PlayVideoRecordSoundL()
+{
+ CMMACameraSound* cameraSound = NewLC();
+ cameraSound->PlaySoundL(KMMAVideoSound());
+ CleanupStack::PopAndDestroy(cameraSound);
+}
+
+// -----------------------------------------------------------------------------
+// PlaySoundL()
+// -----------------------------------------------------------------------------
+//
+void CMMACameraSound::PlaySoundL(const TDesC& aFileName)
+{
+ iError = KErrNone;
+ CMdaAudioPlayerUtility* player =
+ CMdaAudioPlayerUtility::NewFilePlayerL(
+ aFileName, *this, KAudioPriorityVideoRecording,
+ TMdaPriorityPreference(KAudioPrefCamera), NULL);
+ CleanupStack::PushL(player);
+
+ //wait until init is completed
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ //leave if there was error in init
+ User::LeaveIfError(iError);
+
+ player->Play();
+ //wait until play is completed
+ if (!iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->Start();
+ }
+ //leave if there was error in play
+ User::LeaveIfError(iError);
+
+ //close player
+ player->Close();
+ CleanupStack::PopAndDestroy(player);
+}
+
+void CMMACameraSound::MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds& /*aDuration*/)
+{
+ iError = aError;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+}
+
+void CMMACameraSound::MapcPlayComplete(TInt aError)
+{
+ iError = aError;
+ if (iActiveSchedulerWait->IsStarted())
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+}
+
+// End of File
Binary file javauis/mmapi_qt/conf/mobilemedia.confml has changed
Binary file javauis/mmapi_qt/conf/mobilemedia_102828A1.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/inc/cmmadcdisplay.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef CMMADCDISPLAY_H
+#define CMMADCDISPLAY_H
+
+// INCLUDES
+#include "mmmadisplay.h"
+#include "mmmadirectcontent.h"
+#include "cmmadisplay.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class MMMAGuiPlayer;
+class MMMADisplayWindow;
+class MMMAContainer;
+class MMAFunctionServer;
+class CMMADCRepaintEvent;
+
+// CLASS DECLARATION
+/**
+* This class is used with dynamic display mode to render direct content
+* using direct container.
+*/
+NONSHARABLE_CLASS(CMMADCDisplay):
+ public CMMADisplay,
+ public MMMADirectContent
+{
+public:
+ /**
+ * Creates new instance.
+ * @param aPlayer provides content
+ */
+ static CMMADCDisplay* NewLC(MMMAGuiPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject);
+ virtual ~CMMADCDisplay();
+
+public: // From MMMADisplay
+ void DrawFrameL(const CFbsBitmap* aBitmap);
+ void SetDisplaySizeL(const TSize& aSize);
+ void SetDisplayLocationL(const TPoint& aPosition);
+ TPoint DisplayLocation();
+ void SetFullScreenL(TBool aFullScreen);
+ void SourceSizeChanged(const TSize& aSourceSize);
+ TBool IsVisible();
+
+ /**
+ * Gets notification that there is container to draw assigned
+ *
+ * @return ETrue if container have been set
+ * EFalse if container is not set
+ */
+ virtual TBool HasContainer();
+
+ /**
+ * Gets resources necessary to start DirectScreenAccess
+ * Doesn't run in mmapi event server thread!
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aThreadType" Indicates the thread type (ESWT or MMAPI)
+ */
+ void UIGetDSAResources(
+ MUiEventConsumer& aConsumer,
+ MMMADisplay::TThreadType aThreadType);
+
+ /**
+ * Invokes a callback in ESWT thread
+ *
+ * @since S60 v5.0
+ * @param "aConsumer" A consumer of callback
+ * @param "aCallbackId" A number identifying the callback
+ */
+ void UIGetCallback(MUiEventConsumer& aConsumer, TInt aCallbackId);
+
+public: // From MMMADirectContent
+ void MdcContainerVisibilityChanged(TBool aVisible);
+ void MdcContentRectChanged(const TRect& aContentRect,
+ const TRect& aClipRect);
+ void MdcContainerWindowRectChanged(const TRect& aRect);
+ void MdcContainerDestroyed();
+ void MdcSetContainer(MMMAContainer* aContainer);
+ CFbsBitmap* MdcFrameBuffer() const;
+ TSize MdcSourceSize();
+
+public: // From CMMADisplay
+ void MdcContentBoundsChanged(const TRect& aRect);
+
+private: // new methods
+ /**
+ * Creates bitmap when bitmap mode is used
+ * @return error code
+ */
+ TInt InitBitmapMode();
+
+ static void SetDrawRectL(CMMADCDisplay* aDisplay,
+ TSize* aSize);
+
+ CMMADCDisplay(MMMAGuiPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject);
+private: // data
+
+ // Not own.
+ MMMAContainer* iContainer;
+
+ // Own.
+ CFbsBitmap* iBitmap;
+
+ // Not own
+ MMAFunctionServer* iEventSource;
+
+ // direct content java object
+ jobject iGUIObject;
+
+ // Own
+ CMMADCRepaintEvent* iRepaint;
+
+ // Not own
+ MMMAGuiPlayer* iPlayer;
+};
+
+#endif // CMMADCDISPLAY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/inc/cmmadcfullscreenevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content fullscreen event.
+*
+*/
+
+
+#ifndef CMMADCFULLSCREENEVENT_H
+#define CMMADCFULLSCREENEVENT_H
+
+//#include <mevents.h>
+#include "cmmaevent.h"
+
+
+// CLASS DECLARATION
+/**
+* This class is used to send direct content fullscreen event.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMADCFullScreenEvent): public CMMAEvent
+{
+public:
+ /**
+ * Default constructor.
+ * @param aGUIObject Java object to set fullscreen status
+ * @param aFullScreen Indicates whether or not to render in full
+ * screen mode
+ */
+ CMMADCFullScreenEvent(jobject aGUIObject, TBool aFullScreen);
+
+private: // from CJavaEvent
+ /**
+ * @param aJni JNI environment
+ */
+ void Dispatch(JNIEnv& aJni);
+};
+
+#endif // CMMADCFULLSCREENEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/inc/cmmadcinvalidateevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content invalidate event
+*
+*/
+
+
+#ifndef CMMADCINVALIDATEEVENT_H
+#define CMMADCINVALIDATEEVENT_H
+
+//#include <mevents.h>
+#include "cmmaevent.h"
+
+
+// CLASS DECLARATION
+/**
+* This class is used to send direct content invalidate event.
+*
+*/
+NONSHARABLE_CLASS(CMMADCInvalidateEvent): public CMMAEvent
+{
+public:
+ /**
+ * Constructor.
+ * @param aGUIObject Java object to invalidate
+ * @param aSize New size for direct content
+ */
+ CMMADCInvalidateEvent(jobject aGUIObject, TSize aSize);
+
+private: // from CJavaEvent
+ /**
+ * @param aJni JNI environment
+ */
+ void Dispatch(JNIEnv& aJni);
+
+private:
+ // New size to set
+ TSize iSize;
+};
+
+#endif // CMMADCINVALIDATEEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/inc/cmmadcrepaintevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content repaint event.
+*
+*/
+
+
+#ifndef CMMADCREPAINTEVENT_H
+#define CMMADCREPAINTEVENT_H
+
+//#include <mevents.h>
+#include "cmmaevent.h"
+
+
+// CLASS DECLARATION
+/**
+* This class is used to send direct content repaint event.
+*
+*/
+NONSHARABLE_CLASS(CMMADCRepaintEvent): public CMMAEvent
+{
+public:
+ /**
+ * Default constructor.
+ * @param aGUIObject Java object to call.
+ */
+ CMMADCRepaintEvent(jobject aGUIObject);
+
+ /**
+ * @return true if this event is active and may not be sent
+ */
+ TBool IsActive();
+
+ /**
+ * Sets this event active and IsActive will return true.
+ * IsActive methos will return false after this event is dispatched.
+ */
+ void SetActive();
+
+private: // from CJavaEvent
+ /**
+ * @param aJni JNI environment
+ */
+ void Dispatch(JNIEnv& aJni);
+
+};
+
+#endif // CMMADCREPAINTEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcdisplay.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,361 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// Include Files
+#include <e32def.h>
+#include <fbs.h>
+#include <logger.h>
+
+#include "cmmaplayerevent.h"
+#include "mmmaguiplayer.h"
+#include "mmmadisplaywindow.h"
+#include "cmmadcdisplay.h"
+#include "mmmacontainer.h"
+#include "mmafunctionserver.h"
+#include "cmmadcrepaintevent.h"
+#include "cmmadcfullscreenevent.h"
+#include "cmmadcinvalidateevent.h"
+
+// CONSTRUCTION
+// Static constructor, leaves pointer to cleanup-stack
+CMMADCDisplay* CMMADCDisplay::NewLC(MMMAGuiPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject)
+{
+ CMMADCDisplay* self =
+ new(ELeave) CMMADCDisplay(aPlayer, aEventSource, aGUIObject);
+ CleanupStack::PushL(self);
+ self->iRepaint = new(ELeave) CMMADCRepaintEvent(aGUIObject);
+ return self;
+}
+
+// Destructor (virtual by CBase)
+CMMADCDisplay::~CMMADCDisplay()
+{
+ if (iContainer)
+ {
+ iContainer->MdcRemoveContent();
+ }
+ delete iBitmap;
+ delete iRepaint;
+}
+
+// interface MMMADisplay
+void CMMADCDisplay::DrawFrameL(const CFbsBitmap* aBitmap)
+{
+ // This method is called only if bitmap is used.
+ TInt err = InitBitmapMode();
+
+ if (iVisible && iWindow &&
+ iContainer && iContainer->MdcContainerVisibility() &&
+ err == KErrNone)
+ {
+ iWindow->DrawFrameL(aBitmap);
+
+ // container will draw bitmap obtained with MdcFrameBuffer method
+ if (!iRepaint->IsActive())
+ {
+ iRepaint->SetActive();
+ iEventSource->PostEvent(iRepaint, CMMAEvent::EEventPriority);
+ }
+ }
+}
+
+// interface MMMADisplay
+void CMMADCDisplay::SetDisplaySizeL(const TSize& aSize)
+{
+ LOG2( EJavaMMAPI, EInfo, "CMMADCDisplay::SetDisplaySizeL w %d h %d",
+ aSize.iWidth, aSize.iHeight);
+ // user rect contains size set from java.
+ iUserRect.SetSize(aSize);
+
+ if (iContainer)
+ {
+ CMMADCInvalidateEvent* event =
+ new(ELeave)CMMADCInvalidateEvent(iGUIObject, aSize);
+ iEventSource->PostEvent(event, CMMAEvent::EEventPriority);
+ }
+}
+
+// interface MMMADisplay
+void CMMADCDisplay::SetDisplayLocationL(const TPoint& /*aPosition*/)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADCDisplay::SetDisplayLocationL");
+ // This method only works when the USE_DIRECT_VIDEO mode is set.
+ // In USE_GUI_PRIMITIVE mode, this call will be ignored.
+}
+
+// interface MMMADisplay
+TPoint CMMADCDisplay::DisplayLocation()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADCDisplay::DisplayLocation");
+ // This method returns always (0,0),
+ // because SetDisplayLocationL call is ignored.
+ return TPoint(0, 0);
+}
+
+// interface MMMADisplay
+void CMMADCDisplay::SetFullScreenL(TBool aFullScreen)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMADCDisplay::SetFullScreenL %d", aFullScreen);
+ // This method tries to set eSWT Widget size to its parent size.
+ // If real full screen mode is needed parent Composite must be in
+ // fullscreen mode (for example with MobileShell's setFullScreenMode method).
+ if (iContainer)
+ {
+ CMMADCFullScreenEvent* event =
+ new(ELeave)CMMADCFullScreenEvent(iGUIObject, aFullScreen);
+ iEventSource->PostEvent(event, CMMAEvent::EEventPriority);
+ }
+}
+
+// interface MMMADisplay
+void CMMADCDisplay::SourceSizeChanged(const TSize& aSourceSize)
+{
+ LOG2( EJavaMMAPI, EInfo, "CMMADCDisplay::SourceSizeChanged %d %d",
+ aSourceSize.iWidth,
+ aSourceSize.iHeight);
+
+#ifdef RD_JAVA_NGA_ENABLED
+ if (iWindow)
+ {
+ TPoint topLeft(0, 0);
+ iWindow->SetVideoCropRegion(TRect(topLeft,aSourceSize));
+ }
+#endif
+
+ if (iWindow)
+ {
+ TRect tmp(TPoint(0, 0), aSourceSize);
+ iWindow->SetDrawRect(tmp);
+ iWindow->SetWindowRect(tmp,MMMADisplay::EMmaThread);
+
+ // set visibility without using event server because this is called
+ // from MMA thread
+ if (iContainer)
+ {
+ if (iContainer->MdcContainerVisibility())
+ {
+ iWindow->SetVisible(ETrue, EFalse);
+ }
+ }
+ }
+}
+
+// interface MMMADisplay
+TBool CMMADCDisplay::IsVisible()
+{
+ TBool visible = EFalse;
+ if (iContainer)
+ {
+ visible = iContainer->MdcContainerVisibility();
+ }
+ // else invisible
+
+ // return true if both are visible
+ return iVisible && visible;
+}
+
+
+// interface MMMADisplay
+TBool CMMADCDisplay::HasContainer()
+{
+ return iContainer != NULL;
+}
+
+
+// interface MMMADirectContent
+void CMMADCDisplay::MdcContainerVisibilityChanged(TBool aVisible)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcContainerVisibilityChanged aVisible %d",
+ aVisible);
+ if (iWindow)
+ {
+ iWindow->SetVisible(aVisible && iVisible);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcContainerVisibilityChanged OK");
+}
+
+// interface MMMADirectContent
+void CMMADCDisplay::MdcContentRectChanged(const TRect& aContentRect,
+ const TRect& aParentRect)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADCDisplay::MdcContentRectChanged");
+ if (iWindow)
+ {
+ TSize size = aContentRect.Size();
+ iWindow->SetDrawRectThread(TRect(size));
+ TInt err = iEventSource->ExecuteTrap(CMMADCDisplay::SetDrawRectL,
+ this,
+ &size);
+ if (err == KErrNone)
+ {
+ // bitmap window ignores window rect and position
+ iWindow->SetWindowRect(aParentRect,MMMADisplay::EUiThread);
+ iWindow->SetPosition(aContentRect.iTl - aParentRect.iTl);
+ }
+ }
+}
+
+void CMMADCDisplay::MdcContainerWindowRectChanged(const TRect&
+#ifdef RD_JAVA_NGA_ENABLED
+ aRect
+#endif
+ )
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcContainerWindowRectChanged");
+
+#ifdef RD_JAVA_NGA_ENABLED
+ if (iWindow)
+ {
+ iWindow->SetRWindowRect(aRect, MMMADisplay::EUiThread);
+ }
+#endif
+}
+
+// interface MMMADirectContent
+void CMMADCDisplay::MdcContainerDestroyed()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADCDisplay::MdcContainerDestroyed");
+ if (iContainer)
+ {
+ iContainer->MdcRemoveContent();
+ }
+
+ iContainer = NULL;
+ if (iWindow)
+ {
+ iWindow->SetVisible(EFalse);
+ iWindow->ContainerDestroyed();
+ }
+}
+
+// interface MMMADirectContent
+void CMMADCDisplay::MdcSetContainer(MMMAContainer* aContainer)
+{
+ iContainer = aContainer;
+ TSize sourceSize = iPlayer->SourceSize();
+ LOG2( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcSetContainer source size %d %d",
+ sourceSize.iWidth, sourceSize.iHeight);
+ aContainer->MdcInvalidate(sourceSize);
+ if (iWindow)
+ {
+ // Notify window that container has been set
+ iWindow->ContainerSet();
+
+ TRect controlRect;
+ TRect parentRect;
+ iContainer->MdcGetContentRect(controlRect, parentRect);
+
+ // bitmap window ignores window rect and position
+ iWindow->SetWindowRect(parentRect,MMMADisplay::EUiThread);
+ iWindow->SetPosition(controlRect.iTl - parentRect.iTl);
+
+ LOG1( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcSetContainer container visible %d",
+ aContainer->MdcContainerVisibility());
+ LOG1( EJavaMMAPI, EInfo, "CMMADCDisplay::MdcSetContainer content visible %d",
+ iVisible);
+
+ iWindow->SetVisible(aContainer->MdcContainerVisibility() &&
+ iVisible);
+ }
+}
+
+// interface MMMADirectContent
+CFbsBitmap* CMMADCDisplay::MdcFrameBuffer() const
+{
+ return iBitmap;
+}
+
+// interface MMMADirectContent
+TSize CMMADCDisplay::MdcSourceSize()
+{
+ return iPlayer->SourceSize();
+}
+
+void CMMADCDisplay::MdcContentBoundsChanged(const TRect& /*aRect*/)
+{
+}
+
+void CMMADCDisplay::UIGetDSAResources(
+ MUiEventConsumer& aConsumer,
+ MMMADisplay::TThreadType aThreadType)
+{
+ if (iContainer)
+ {
+ iContainer->MdcGetDSAResources(aConsumer, aThreadType);
+ }
+}
+
+void CMMADCDisplay::UIGetCallback(
+ MUiEventConsumer& aConsumer,
+ TInt aCallbackId)
+{
+ if (iContainer)
+ {
+ iContainer->MdcGetUICallback(aConsumer, aCallbackId);
+ }
+}
+
+TInt CMMADCDisplay::InitBitmapMode()
+{
+ TInt errCode = KErrNone;
+ // If there is no bitmap, create one and set it to window
+ if (!iBitmap && iWindow)
+ {
+ iBitmap = new CFbsBitmap;
+ if (iBitmap)
+ {
+ errCode = iBitmap->Create(iPlayer->SourceSize(),
+ EColor16MA);
+ }
+ else
+ {
+ errCode = KErrNoMemory;
+ }
+
+ if (errCode == KErrNone)
+ {
+ TRAP(errCode,
+ iWindow->SetDestinationBitmapL(iBitmap));
+ }
+ }
+ return errCode;
+}
+
+void CMMADCDisplay::SetDrawRectL(CMMADCDisplay* aDisplay, TSize* aSize)
+{
+ if (aDisplay->iBitmap)
+ {
+ User::LeaveIfError(aDisplay->iBitmap->Resize(*aSize));
+ aDisplay->iWindow->SetDestinationBitmapL(aDisplay->iBitmap);
+ }
+}
+
+CMMADCDisplay::CMMADCDisplay(MMMAGuiPlayer* aPlayer,
+ MMAFunctionServer* aEventSource,
+ jobject aGUIObject)
+{
+ iPlayer = aPlayer;
+ iEventSource = aEventSource;
+ iGUIObject = aGUIObject;
+ // GUI_PRIMITIVE is visible by default.
+ iVisible = ETrue;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcfullscreenevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content fullscreen event.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadcfullscreenevent.h"
+
+CMMADCFullScreenEvent::CMMADCFullScreenEvent(jobject aGUIObject, TBool aFullScreen):
+ CMMAEvent(EDisposableEvent)
+{
+ iListenerObject = aGUIObject;
+ iEventData = aFullScreen;
+}
+
+// from CJavaEvent
+void CMMADCFullScreenEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADCFullScreenEvent::Dispatch");
+ iHandleEventMethod = aJni.GetMethodID(aJni.GetObjectClass(iListenerObject),
+ "setFullScreen",
+ "(Z)V");
+ if (iHandleEventMethod &&
+ (aJni.IsSameObject(iListenerObject, 0) == JNI_FALSE))
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iEventData);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcinvalidateevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content invalidate event
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadcinvalidateevent.h"
+
+CMMADCInvalidateEvent::CMMADCInvalidateEvent(jobject aGUIObject,
+ TSize aSize):
+ CMMAEvent(EDisposableEvent)
+{
+ iListenerObject = aGUIObject;
+ iSize = aSize;
+}
+
+// from CJavaEvent
+void CMMADCInvalidateEvent::Dispatch(JNIEnv& aJni)
+{
+ LOG2( EJavaMMAPI, EInfo, "MMA::CMMADCInvalidateEvent::Dispatch w=%d h=%d",
+ iSize.iWidth,
+ iSize.iHeight);
+
+ iHandleEventMethod = aJni.GetMethodID(aJni.GetObjectClass(iListenerObject),
+ "invalidate",
+ "(II)V");
+
+ // IsSameObject method will return true if iListenerObject has disappeared
+ if (iHandleEventMethod &&
+ aJni.IsSameObject(iListenerObject, 0) == JNI_FALSE)
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod,
+ iSize.iWidth,
+ iSize.iHeight);
+ }
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/directcontent/src/cmmadcrepaintevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to send direct content repaint event.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadcrepaintevent.h"
+
+CMMADCRepaintEvent::CMMADCRepaintEvent(jobject aGUIObject):
+ CMMAEvent(EReusableEvent)
+{
+ iListenerObject = aGUIObject;
+ iEventData = KErrNone;
+}
+
+TBool CMMADCRepaintEvent::IsActive()
+{
+ return iEventData != KErrNone;
+}
+
+void CMMADCRepaintEvent::SetActive()
+{
+ iEventData = KErrInUse;
+}
+
+// from CJavaEvent
+void CMMADCRepaintEvent::Dispatch(JNIEnv& aJni)
+{
+ // create method id if not allready created
+ if (!iHandleEventMethod)
+ {
+ iHandleEventMethod = aJni.GetMethodID(aJni.GetObjectClass(iListenerObject),
+ "repaint",
+ "()V");
+ }
+
+ // There is internal error if method cannot be found
+ __ASSERT_DEBUG(iHandleEventMethod, User::Invariant());
+
+ // IsSameObject method will return true if iListenerObject has disappeared
+ if (iHandleEventMethod &&
+ aJni.IsSameObject(iListenerObject, 0) == JNI_FALSE)
+ {
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod);
+ }
+
+ // IsActive will return EFalse after this
+ iEventData = KErrNone;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmaudioplayer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for playing MIDI.
+*
+*/
+
+
+#ifndef CMMADRMAUDIOPLAYER_H
+#define CMMADRMAUDIOPLAYER_H
+
+// INCLUDES
+#include "cmmaaudioplayer.h"
+#include <DrmAudioSamplePlayer.h>
+#include <e32base.h>
+
+// CONSTANTS
+_LIT(KMMADRMPlayer, "DRMPlayer");
+
+// FORWARD DECLARATIONS
+class MMAFunctionServer;
+
+// CLASS DECLARATION
+/**
+* This class is used for playing DRM Audio.
+*
+*/
+
+NONSHARABLE_CLASS(CMMADRMAudioPlayer): public CMMAPlayer,
+ public MDrmAudioPlayerCallback
+
+{
+public: // Construction
+ static CMMADRMAudioPlayer* NewLC(const TDesC& aContentType,
+ TFileName aFileName);
+
+ // Destructor
+ ~CMMADRMAudioPlayer();
+
+protected:
+ // C++ constructor
+ CMMADRMAudioPlayer(TFileName aFileName);
+ void ConstructL(const TDesC& aContentType);
+
+public: // new methods
+ CDrmPlayerUtility* DRMUtility() const;
+
+public: // from CMMAPlayer
+ void StartL();
+ void StopL(TBool aPostEvent);
+ void RealizeL();
+ void PrefetchL();
+ void DeallocateL();
+ void GetDuration(TInt64* aDuration);
+ void SetMediaTimeL(TInt64* aTime);
+ void GetMediaTime(TInt64* aMediaTime);
+ void CloseL();
+ const TDesC& Type();
+
+public: // from CMMAPlayer
+ void PlayCompleteL(TInt aError);
+
+public: // from MDrmAudioPlayerCallback
+ void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
+ void MdapcPlayComplete(TInt aError);
+
+protected:
+ void CloseClientUtility();
+ void ErrorPlaybackComplete(TInt aError);
+
+private: // Data
+ CDrmPlayerUtility* iUtility;
+
+ TFileName iFileName;
+};
+
+#endif // CMMADRMAUDIOPLAYER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmmetadatacontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMADRMMetaDataControl is a concrete class for getting
+* metadata from drm files.
+*
+*/
+
+
+#ifndef CMMADRMMETADATACONTROL_H
+#define CMMADRMMETADATACONTROL_H
+
+// INCLUDES
+#include <mmfcontroller.h>
+
+#include "cmmadrmaudioplayer.h"
+#include "cmmametadatacontrol.h"
+
+// CLASS DECLARATION
+/**
+* This is a concrete class for getting metadata from drm files.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMADRMMetaDataControl): public CMMAMetaDataControl
+{
+public:
+ CMMADRMMetaDataControl(CMMADRMAudioPlayer* aPlayer);
+
+protected: // from CMMAMetaDataControl
+
+ TInt KeyCountL();
+ HBufC* KeyL(TInt aIndex);
+
+ HBufC* KeyValueL(const TDesC& aKey);
+
+private:
+ /**
+ * Used to query metadata
+ */
+ CMMADRMAudioPlayer* iPlayer;
+};
+
+#endif // CMMADRMMETADATACONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmplayerfactory.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating DRM v2 players.
+*
+*/
+
+
+#ifndef CMMADRMPLAYERFACTORY_H
+#define CMMADRMPLAYERFACTORY_H
+
+// INCLUDES
+#include "mmmaplayerfactory.h"
+#include "cmmavideoplayerfactory.h"
+
+class CMMAMMFResolver;
+
+// CLASS DECLARATION
+/**
+* This class is used for creating DRM players.
+*
+*
+*/
+NONSHARABLE_CLASS(CMMADRMPlayerFactory): public CBase, public MMMAPlayerFactory
+{
+public: // Constructor and destructor
+ static CMMADRMPlayerFactory* NewLC(CMMAVideoPlayerFactory* aVideoPlayerFactory);
+
+ CMMADRMPlayerFactory(CMMAVideoPlayerFactory* aVideoPlayerFactory);
+
+ ~CMMADRMPlayerFactory();
+
+public: // From MMMAPlayerFactory
+ CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
+
+ CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& aParameters);
+
+ CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
+
+ void GetSupportedContentTypesL(const TDesC& aProtocol,
+ CDesC16Array& aMimeTypeArray);
+
+ void GetSupportedProtocolsL(const TDesC& aContentType,
+ CDesC16Array& aProtocolArray);
+
+protected:
+ void UpdateRightsL(TInt aError,
+ const TDesC& aFileName);
+
+ CMMAPlayer* CreateAudioPlayerL(const TDesC& aContentType,
+ const TDesC& aFileName);
+
+ CMMAPlayer* CreateVideoPlayerL(const TDesC& aContentType,
+ const TDesC& aFileName);
+
+
+private: //data
+ CMMAVideoPlayerFactory* iVideoPlayerFactory;
+
+};
+
+#endif // CMMADRMPLAYERFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmratecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements RateControl for DRMv2 audio player.
+*
+*/
+
+
+#ifndef CMMADRMRATECONTROL_H
+#define CMMADRMRATECONTROL_H
+
+// INTERNAL INCLUDES
+#include "cmmaratecontrol.h" // base class
+#include "cmmadrmaudioplayer.h"
+
+// CLASS DECLARATION
+/**
+* This class implements RateControl for DRMv2 audio player.
+*
+*/
+NONSHARABLE_CLASS(CMMADRMRateControl): public CMMARateControl,
+ public MMMAPlayerStateListener
+{
+public:
+
+ static CMMADRMRateControl* NewL(CMMADRMAudioPlayer* aPlayer);
+
+ /**
+ * Destructor.
+ */
+ ~CMMADRMRateControl();
+
+protected:
+
+ /**
+ * Constructor.
+ */
+ CMMADRMRateControl(CMMADRMAudioPlayer* aPlayer);
+
+ void ConstructL();
+
+public: // from MMMAPlayerStateListener
+ virtual void StateChanged(TInt aState);
+
+public: // New methods
+ /**
+ * @param aRate Rate to set in "milli-percentage"..
+ * @return Actual rate set.
+ */
+ virtual TInt SetRateL(TInt aRate);
+
+ /**
+ * @return The current playback rate in "milli-percentage".
+ */
+ virtual TInt RateL();
+
+
+private: // Member data
+
+ /**
+ * Used to obtain RMMFController reference to stop/start
+ * playback.
+ */
+ CMMADRMAudioPlayer* iPlayer;
+
+ /**
+ * Hold current rate value.
+ */
+ TInt iCurrentRate;
+
+};
+
+#endif // CMMADRMRATECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/inc/cmmadrmvolumecontrol.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to audio player
+*
+*/
+
+
+#ifndef CMMADRMVOLUMECONTROL_H
+#define CMMADRMVOLUMECONTROL_H
+
+#include "cmmavolumecontrol.h"
+
+class CMMADRMAudioPlayer;
+
+// CLASS DEFINITION
+/*
+-----------------------------------------------------------------------------
+
+ DESCRIPTION
+ This class is used for setting volume to DRM audio player
+
+-----------------------------------------------------------------------------
+*/
+NONSHARABLE_CLASS(CMMADRMVolumeControl): public CMMAVolumeControl
+{
+public:
+ static CMMADRMVolumeControl* NewL(CMMADRMAudioPlayer* aPlayer);
+
+protected:
+ CMMADRMVolumeControl(CMMADRMAudioPlayer* aPlayer);
+ void ConstructL();
+
+
+public: // from CMMAVolumeControl
+ void DoSetLevelL(TInt aLevel);
+ TInt DoGetLevelL();
+
+private:
+ CMMADRMAudioPlayer* iPlayer;
+};
+
+#endif // CMMADRMVOLUMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/src/cmmadrmaudioplayer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,342 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for MIDI.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+#include <e32base.h>
+#include <AudioPreference.h>
+
+#include "cmmadrmaudioplayer.h"
+#include "mmmadisplay.h"
+
+const TInt KErrorMessageSize = 32;
+const TInt64 KDurationUnknown = -1;
+const TInt KMediaStartTime = 0;
+const TInt KMediaTimeDurationTreshold = 100000;
+
+_LIT(KErrDefaultError, "Symbian OS Error: %d");
+
+CMMADRMAudioPlayer* CMMADRMAudioPlayer::NewLC(const TDesC& aContentType,
+ TFileName aFileName)
+{
+ CMMADRMAudioPlayer* self = new(ELeave) CMMADRMAudioPlayer(aFileName);
+ CleanupStack::PushL(self);
+ self->ConstructL(aContentType);
+ return self;
+}
+
+CMMADRMAudioPlayer::~CMMADRMAudioPlayer()
+{
+ CloseClientUtility();
+ delete iUtility;
+
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMAudioPlayer::~CMMADRMAudioPlayer ");
+}
+
+void CMMADRMAudioPlayer::ConstructL(const TDesC& aContentType)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADRMAudioPlayer::ConstructL");
+ // Only file based sources are supported with DRM
+ if (iFileName == KNullDesC)
+ {
+ User::Leave(KErrNotSupported);
+ }
+ iContentType = aContentType.AllocL();
+ iUtility = CDrmPlayerUtility::NewL(*this, KAudioPriorityRealOnePlayer,
+ (TMdaPriorityPreference) KAudioPrefRealOneLocalPlayback);
+
+ CMMAPlayer::ConstructL();
+}
+
+CMMADRMAudioPlayer::CMMADRMAudioPlayer(TFileName aFileName):
+ CMMAPlayer(),
+ iFileName(aFileName)
+{
+}
+
+CDrmPlayerUtility* CMMADRMAudioPlayer::DRMUtility() const
+{
+ return iUtility;
+}
+
+
+void CMMADRMAudioPlayer::RealizeL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADRMAudioPlayer::RealizeL");
+ CMMAPlayer::RealizeL();
+}
+
+void CMMADRMAudioPlayer::PrefetchL()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMADRMAudioPlayer::PrefetchL");
+ // Prefetch will be completed in init callback
+ iUtility->OpenFileL(iFileName);
+}
+
+void CMMADRMAudioPlayer::DeallocateL()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: DeallocateL +");
+ if (iState == EPrefetched)
+ {
+ CloseClientUtility();
+ ChangeState(ERealized);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMAMidiPlayer: DeallocateL -");
+}
+
+void CMMADRMAudioPlayer::StartL()
+{
+ // start can't be called to not ready player
+ ASSERT(iState == EPrefetched);
+
+ TInt64 time = TInt64(KMediaStartTime);
+
+ // Media time is not fetched using GetMediaTime
+ // Because it adjusts the result if it is close
+ // to duration.
+
+ TTimeIntervalMicroSeconds position(KMediaStartTime);
+ User::LeaveIfError(iUtility->GetPosition(position));
+
+ time = position.Int64();
+
+ TInt64 duration;
+ GetDuration(&duration);
+ if ((duration > 0) && (time > duration - KMediaTimeDurationTreshold))
+ {
+ time = KMediaStartTime;
+ iUtility->SetPosition(time);
+ }
+
+ iUtility->Play();
+ PostActionCompletedStart();
+ // inform java side
+ PostActionCompleted(KErrNone); // java start return
+ PostLongEvent(CMMAPlayerEvent::EStarted, time);
+ ChangeState(EStarted);
+}
+
+void CMMADRMAudioPlayer::StopL(TBool aPostEvent)
+{
+ if (iState == EStarted)
+ {
+ User::LeaveIfError(iUtility->Pause());
+
+ if (aPostEvent)
+ {
+ TInt64 time;
+ GetMediaTime(&time);
+ PostLongEvent(CMMAPlayerEvent::EStopped, time);
+ }
+ // go back to prefetched state
+ ChangeState(EPrefetched);
+ }
+}
+
+void CMMADRMAudioPlayer::GetDuration(TInt64* aDuration)
+{
+ if (iState < EPrefetched)
+ {
+ *aDuration = KDurationUnknown;
+ }
+ else
+ {
+ *aDuration = iUtility->Duration().Int64();
+ }
+}
+
+void CMMADRMAudioPlayer::SetMediaTimeL(TInt64* aTime)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADRMAudioPlayer::SetMediaTimeL + aTime: %d", *aTime);
+ // Duration is needed so we do not try to set media time
+ // too far away. If duration is not known, setting media time
+ // is not allowed.
+
+ TInt64 duration = TInt64(KMediaStartTime);
+ GetDuration(&duration);
+ if (duration < KErrNone)
+ {
+ // If duration is not known, we will leave with suitable code.
+ User::Leave(KErrNotSupported);
+ }
+
+ // Check if desired media time is past media duration and
+ // set it to duration in that case. Negative values are not
+ // checked here because it's done already in Java side.
+
+ // If media time is attempted to set to duration, then
+ // it is set close to duration. This way
+ // when utility is then started, end of media event
+ // will come soon after. This is not indicated to Java
+ // side but instead returned that the media time was
+ // set to duration.
+
+ TTimeIntervalMicroSeconds position;
+ if (*aTime >= duration)
+ {
+ *aTime = duration;
+ position = duration - KMediaTimeDurationTreshold;
+ }
+ else
+ {
+ position = *aTime;
+ }
+
+ iUtility->SetPosition(position);
+
+ // Inform about the position change to the StateListeners
+ ChangeState(iState);
+
+ // Get the actual media time
+ GetMediaTime(aTime);
+}
+
+void CMMADRMAudioPlayer::GetMediaTime(TInt64* aMediaTime)
+{
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADRMAudioPlayer::GetMediaTime + aMediaTime: %d", *aMediaTime);
+ TTimeIntervalMicroSeconds position;
+ TInt64 duration = TInt64(KMediaStartTime);
+
+ // Error code discarded on purpose
+ GetDuration(&duration);
+
+ TInt error(iUtility->GetPosition(position));
+ if (error == KErrNone)
+ {
+ // set return value
+ *aMediaTime = position.Int64();
+ //if duration is unknown and position 0, player is realized and
+ //we can not know media time
+ if ((duration == KDurationUnknown) && (position == 0))
+ {
+ *aMediaTime = KTimeUnknown;
+ }
+ }
+ else
+ {
+ // media time cannot be get
+ *aMediaTime = KTimeUnknown;
+ }
+
+ // Second part of the set media time workaround.
+ // If position is close to duration, then media
+ // time of duration is returned instead.
+
+ // If the duration is zero or not known
+ // then this adjustment is not done.
+ if ((duration > KErrNone) &&
+ (*aMediaTime >= duration - KMediaTimeDurationTreshold))
+ {
+ *aMediaTime = duration;
+ }
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADRMAudioPlayer::GetMediaTime - aMediaTime: %d", *aMediaTime);
+}
+
+void CMMADRMAudioPlayer::CloseL()
+{
+ CMMAPlayer::CloseL();
+ CloseClientUtility();
+}
+
+const TDesC& CMMADRMAudioPlayer::Type()
+{
+ return KMMADRMPlayer;
+}
+
+void CMMADRMAudioPlayer::PlayCompleteL(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA: CMMADRMAudioPlayer: PlayCompleteL: Error=%d", aError);
+ TInt64 time;
+ GetDuration(&time);
+
+ // Send 'Stopped' only when stop() is called.
+ PostLongEvent(CMMAPlayerEvent::EEndOfMedia, time);
+
+ ChangeState(EPrefetched); // ready to play again
+
+ if (aError == KErrNone)
+ {
+ iRepeatCount++;
+
+ if (iRepeatForever || iRepeatCount < iRepeatNumberOfTimes)
+ {
+ StartL();
+ }
+ else
+ {
+ iRepeatCount = 0;
+ TTimeIntervalMicroSeconds position(time);
+ iUtility->SetPosition(position);
+ }
+ }
+ else
+ {
+ // error has occured, setting correct number of
+ // repeats for next start
+ SetLoopCount(iRepeatNumberOfTimes);
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMADRMAudioPlayer: PlayCompleteL -");
+}
+
+void CMMADRMAudioPlayer::MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMADRMAudioPlayer::MdapcInitComplete: aError = %d", aError);
+ if (!aError)
+ {
+ ChangeState(EPrefetched);
+ }
+ PostActionCompleted(aError);
+}
+
+void CMMADRMAudioPlayer::MdapcPlayComplete(TInt aError)
+{
+ if (aError)
+ {
+ ErrorPlaybackComplete(aError);
+ }
+ else
+ {
+ TRAPD(error, PlayCompleteL(KErrNone));
+ if (error)
+ {
+ ErrorPlaybackComplete(error);
+ }
+ }
+}
+
+void CMMADRMAudioPlayer::CloseClientUtility()
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMADRMAudioPlayer: CloseClientUtility +");
+ if (iUtility)
+ {
+ iUtility->Close();
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMADRMAudioPlayer: CloseClientUtility -");
+}
+
+void CMMADRMAudioPlayer::ErrorPlaybackComplete(TInt aError)
+{
+ ELOG1( EJavaMMAPI, "MMA::CMMADRMAudioPlayer::ErrorPlaybackComplete: aError = %d", aError);
+ TBuf<KErrorMessageSize> errorMessage;
+ errorMessage.Format(KErrDefaultError, aError);
+ PostStringEvent(CMMAPlayerEvent::EError, errorMessage);
+
+ CloseClientUtility();
+ ChangeState(ERealized);
+}
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/src/cmmadrmmetadatacontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CMMADRMMetaDataControl is a concrete class for getting
+* metadata from DRM files.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmadrmmetadatacontrol.h"
+
+CMMADRMMetaDataControl::CMMADRMMetaDataControl(
+ CMMADRMAudioPlayer* aPlayer)
+ : iPlayer(aPlayer)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMMetaDataControl constructor called.");
+}
+
+TInt CMMADRMMetaDataControl::KeyCountL()
+{
+ TInt entries;
+ User::LeaveIfError(iPlayer->DRMUtility()->GetNumberOfMetaDataEntries(entries));
+ return entries;
+}
+
+HBufC* CMMADRMMetaDataControl::KeyL(TInt aIndex)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMADRMMetaDataControl::KeyL");
+ CMMFMetaDataEntry* currEntry =
+ iPlayer->DRMUtility()->GetMetaDataEntryL(aIndex);
+ CleanupStack::PushL(currEntry);
+ HBufC* key = currEntry->Name().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+ return key;
+}
+
+
+/*
+ * Get the value of given drm metadata key. The ownership of the created value
+ * (descriptor) is passed to the caller.
+ */
+HBufC* CMMADRMMetaDataControl::KeyValueL(const TDesC& aKey)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA: CMMADRMMetaDataControl::KeyValueL");
+
+ HBufC* retVal = NULL;
+ CMMFMetaDataEntry* currEntry = NULL;
+
+ TInt nEntries;
+ User::LeaveIfError(iPlayer->DRMUtility()->GetNumberOfMetaDataEntries(nEntries));
+
+ for (TInt i = 0; i < nEntries; ++i)
+ {
+ currEntry = iPlayer->DRMUtility()->GetMetaDataEntryL(i);
+
+ if (0 == aKey.Compare(currEntry->Name()))
+ {
+ CleanupStack::PushL(currEntry);
+ retVal = currEntry->Value().AllocL();
+ CleanupStack::PopAndDestroy(); // currEntry
+ break;
+ }
+
+ delete currEntry;
+ }
+
+ User::LeaveIfNull(retVal);
+ return retVal;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/src/cmmadrmplayerfactory.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for creating DRM v2 player.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include <DRMCommon.h>
+#include <DRMHelper.h>
+#include <caf/stringattributeset.h>
+
+#include "cmmadrmplayerfactory.h"
+#include "cmmadrmaudioplayer.h"
+#include "cmmadrmvolumecontrol.h"
+#include "cmmastoptimecontrol.h"
+#include "cmmadrmmetadatacontrol.h"
+#include "cmmadrmratecontrol.h"
+#include "cmmavideoplayer.h"
+
+_LIT(KMMAAudio, "audio");
+// this (get from caf) cannot be recognized is it audio or video
+_LIT(KMMARMCafMimeType, "application/vnd.rn-realmedia");
+// drm v2 file suffix
+_LIT(KMMADRMv2SuffixODF, "odf");
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::NewLC
+// ---------------------------------------------------------------------------
+//
+CMMADRMPlayerFactory* CMMADRMPlayerFactory::NewLC(CMMAVideoPlayerFactory* aVideoPlayerFactory)
+{
+ CMMADRMPlayerFactory* pFactory =
+ new(ELeave) CMMADRMPlayerFactory(aVideoPlayerFactory);
+ CleanupStack::PushL(pFactory);
+ return pFactory;
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CMMADRMPlayerFactory
+// ---------------------------------------------------------------------------
+//
+CMMADRMPlayerFactory::CMMADRMPlayerFactory(CMMAVideoPlayerFactory* aVideoPlayerFactory)
+ :iVideoPlayerFactory(aVideoPlayerFactory)
+{
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::~CMMADRMPlayerFactory
+// ---------------------------------------------------------------------------
+//
+CMMADRMPlayerFactory::~CMMADRMPlayerFactory()
+{
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CreatePlayerL
+// ---------------------------------------------------------------------------
+//
+CMMAPlayer* CMMADRMPlayerFactory::CreatePlayerL(const TDesC& /*aContentType*/)
+{
+ // only file is supported
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CreatePlayerL
+// ---------------------------------------------------------------------------
+//
+CMMAPlayer* CMMADRMPlayerFactory::CreatePlayerL(
+ const TDesC& aProtocol,
+ const TDesC& aMiddlePart,
+ const TDesC& /*aProperties*/)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreatePlayerL +");
+ CMMAPlayer* player = NULL;
+ if (aProtocol == KMMAFileProtocol)
+ {
+ // we are most likely going to play this file
+ ContentAccess::TIntent intent = ContentAccess::EPlay;
+
+ ContentAccess::CContent* contentObj = ContentAccess::CContent::NewL(aMiddlePart);
+ CleanupStack::PushL(contentObj);
+
+ ContentAccess::CData* dataObj = NULL;
+ TRAPD(openContentErr, dataObj = contentObj->OpenContentL(intent));
+ CleanupStack::PushL(dataObj);
+
+ ELOG1( EJavaMMAPI, "MMA::CMMADRMPlayerFactory::CreatePlayerL openContentErr: %d", openContentErr);
+ if (KErrCA_LowerLimit <= openContentErr && openContentErr <= KErrCA_UpperLimit)
+ {
+ // handle error, possible update rights
+ UpdateRightsL(openContentErr, aMiddlePart);
+ User::Leave(openContentErr);
+ }
+ else
+ {
+ User::LeaveIfError(openContentErr);
+ }
+
+ ContentAccess::RStringAttributeSet stringAttributeSet;
+ CleanupClosePushL(stringAttributeSet);
+ stringAttributeSet.AddL(ContentAccess::EMimeType);
+
+ User::LeaveIfError(dataObj->GetStringAttributeSet(stringAttributeSet));
+
+ TBuf<KMaxName> mimeType;
+ TInt err = stringAttributeSet.GetValue(ContentAccess::EMimeType, mimeType);
+ if (err == KErrNone)
+ {
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreatePlayerL, no err, mime type = %S", mimeType.PtrZ());
+ // we use 16bit mimeType
+ HBufC* mimeTypeBuf = HBufC::NewLC(mimeType.Length());
+ mimeTypeBuf->Des().Copy(mimeType);
+
+ if (((mimeTypeBuf->Length() >= KMMAAudio().Length()) &&
+ (mimeTypeBuf->Left(KMMAAudio().Length()) == KMMAAudio)) ||
+ ((KErrNone == mimeTypeBuf->Compare(KMMARMCafMimeType)) &&
+ (aMiddlePart.Right(KMMADRMv2SuffixODF().Length()) ==
+ KMMADRMv2SuffixODF())))
+ {
+ // if content-type starts with "audio" or
+ // if it's KMMARMCafMimeType and file suffix is ODF
+ // then create audio player
+ player = CreateAudioPlayerL(*mimeTypeBuf, aMiddlePart);
+ }
+ else
+ {
+ // otherwise try video player
+ player = CreateVideoPlayerL(*mimeTypeBuf, aMiddlePart);
+ }
+ CleanupStack::PopAndDestroy(mimeTypeBuf);
+ }
+ else
+ {
+ ELOG1( EJavaMMAPI, "MMA::CMMADRMPlayerFactory::CreatePlayerL get mime err: %d", err);
+ LOG1( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreatePlayerL mime type = %S", mimeType.PtrZ());
+ User::Leave(err);
+ }
+ CleanupStack::PopAndDestroy(3); //dataObj, contentObj, stringAttributeSet
+ }
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreatePlayerL -");
+ return player;
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CreatePlayerL
+// ---------------------------------------------------------------------------
+//
+CMMAPlayer* CMMADRMPlayerFactory::CreatePlayerL(const TDesC8& /*aHeaderData*/)
+{
+ // only file is supported
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::GetSupportedContentTypesL
+// ---------------------------------------------------------------------------
+//
+void CMMADRMPlayerFactory::GetSupportedContentTypesL(const TDesC& /*aProtocol*/,
+ CDesC16Array& /*aMimeTypeArray*/)
+{
+ // DRM Supports same content-types as others, no need to add
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::GetSupportedProtocolsL
+// ---------------------------------------------------------------------------
+//
+void CMMADRMPlayerFactory::GetSupportedProtocolsL(
+ const TDesC& /*aContentType*/,
+ CDesC16Array& /*aProtocolArray*/)
+{
+ // DRM Supports same protocols as others, no need to add
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::UpdateRightsL
+// ---------------------------------------------------------------------------
+//
+void CMMADRMPlayerFactory::UpdateRightsL(TInt aError,
+ const TDesC& aFileName)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::UpdateRightsL +");
+ CDRMHelper* helper = CDRMHelper::NewLC();
+ TInt code = helper->HandleErrorL(aError, aFileName);
+ if (code == 0)
+ {
+ User::Leave(aError);
+ }
+ CleanupStack::PopAndDestroy(helper);
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CreateAudioPlayerL
+// ---------------------------------------------------------------------------
+//
+CMMAPlayer* CMMADRMPlayerFactory::CreateAudioPlayerL(const TDesC& aContentType,
+ const TDesC& aFileName)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreateAudioPlayerL +");
+ CMMADRMAudioPlayer* player = CMMADRMAudioPlayer::NewLC(aContentType,
+ aFileName);
+
+ CMMADRMVolumeControl* volumeControl = CMMADRMVolumeControl::NewL(player);
+ CleanupStack::PushL(volumeControl);
+ player->AddControlL(volumeControl);
+ CleanupStack::Pop(volumeControl);
+
+ CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player);
+ CleanupStack::PushL(stopTimeControl);
+ player->AddControlL(stopTimeControl);
+ CleanupStack::Pop(stopTimeControl);
+
+ CMMADRMMetaDataControl* metaDataControl =
+ new(ELeave)CMMADRMMetaDataControl(player);
+ CleanupStack::PushL(metaDataControl);
+ player->AddControlL(metaDataControl);
+ CleanupStack::Pop(metaDataControl);
+
+ CMMADRMRateControl* drmRateControl = CMMADRMRateControl::NewL(player);
+ CleanupStack::PushL(drmRateControl);
+ player->AddControlL(drmRateControl);
+ CleanupStack::Pop(drmRateControl);
+
+ CleanupStack::Pop(player);
+ return player;
+}
+
+// ---------------------------------------------------------------------------
+// CMMADRMPlayerFactory::CreateVideoPlayerL
+// ---------------------------------------------------------------------------
+//
+CMMAPlayer* CMMADRMPlayerFactory::CreateVideoPlayerL(const TDesC& aContentType,
+ const TDesC& aFileName)
+{
+ LOG( EJavaMMAPI, EInfo, "MMA::CMMADRMPlayerFactory::CreateVideoPlayerL +");
+ CMMAPlayer* player =
+ iVideoPlayerFactory->CreatePlayerWithFileL(aContentType, &aFileName);
+
+ return player;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/src/cmmadrmratecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class implements generic RateControl functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include "logger.h"
+#include <e32base.h>
+
+#include "cmmadrmratecontrol.h"
+
+CMMADRMRateControl* CMMADRMRateControl::NewL(CMMADRMAudioPlayer* aPlayer)
+{
+ CMMADRMRateControl* self = new(ELeave) CMMADRMRateControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMADRMRateControl::~CMMADRMRateControl()
+{
+ LOG(EJavaMMAPI,EInfo,"MMA:CMMADRMRateControl::~CMMADRMRateControl");
+ if (iPlayer)
+ {
+ iPlayer->RemoveStateListener(this);
+ }
+}
+
+CMMADRMRateControl::CMMADRMRateControl(CMMADRMAudioPlayer* aPlayer) :
+ iPlayer(aPlayer), iCurrentRate(KMMADefaultRate)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA:CMMADRMRateControl::CMMADRMRateControl");
+}
+
+void CMMADRMRateControl::ConstructL()
+{
+ iPlayer->AddStateListenerL(this);
+}
+
+void CMMADRMRateControl::StateChanged(TInt aState)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA:CMMADRMRateControl::StateChanged");
+ if (aState == CMMAPlayer::EStarted && iCurrentRate == KMMAMinRate)
+ {
+ iPlayer->DRMUtility()->Stop();
+ }
+}
+
+TInt CMMADRMRateControl::SetRateL(TInt aRate)
+{
+ LOG(EJavaMMAPI,EInfo,"MMA:CMMADRMRateControl::SetRateL");
+ if (aRate <= KMMAMinRate)
+ {
+ iCurrentRate = KMMAMinRate;
+ }
+ else
+ {
+ iCurrentRate = KMMADefaultRate;
+ }
+
+ if (iPlayer->State() == CMMAPlayer::EStarted)
+ {
+ if (iCurrentRate == KMMAMinRate)
+ {
+ iPlayer->DRMUtility()->Stop();
+ }
+ else
+ {
+ iPlayer->DRMUtility()->Play();
+ }
+ }
+ return iCurrentRate;
+}
+
+TInt CMMADRMRateControl::RateL()
+{
+ return iCurrentRate;
+}
+
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/src_drmv2/src/cmmadrmvolumecontrol.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for setting volume to DRMv2 audio player
+*
+*/
+
+
+#include "logger.h"
+#include "cmmadrmvolumecontrol.h"
+#include "cmmadrmaudioplayer.h"
+
+CMMADRMVolumeControl::CMMADRMVolumeControl(CMMADRMAudioPlayer* aPlayer)
+ : CMMAVolumeControl(aPlayer)
+{
+ iPlayer = aPlayer;
+}
+
+void CMMADRMVolumeControl::ConstructL()
+{
+ ConstructBaseL();
+}
+CMMADRMVolumeControl* CMMADRMVolumeControl::NewL(CMMADRMAudioPlayer* aPlayer)
+{
+ CMMADRMVolumeControl* self = new(ELeave)CMMADRMVolumeControl(aPlayer);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+void CMMADRMVolumeControl::DoSetLevelL(TInt aLevel)
+{
+ CDrmPlayerUtility* utility = iPlayer->DRMUtility();
+ TInt maxVolume = utility->MaxVolume();
+ utility->SetVolume(aLevel * maxVolume / KMMAVolumeMaxLevel);
+}
+
+TInt CMMADRMVolumeControl::DoGetLevelL()
+{
+ CDrmPlayerUtility* utility = iPlayer->DRMUtility();
+ TInt maxVolume = utility->MaxVolume();
+ TInt volume = 0;
+ User::LeaveIfError(utility->GetVolume(volume));
+ // result is in range 0..100
+ return (volume * KMMAVolumeMaxLevel / maxVolume);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/utils/inc/TimeOutTimer.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Timer for comms time-outs
+*
+*/
+
+
+#ifndef TIMEOUTTIMER_H
+#define TIMEOUTTIMER_H
+
+#include <e32base.h>
+#include <e32def.h>
+
+// MTimeOutNotify: used in conjunction with CTimeOutTimer class
+class MTimeOutNotify
+{
+public:
+ virtual void TimerExpired() = 0;
+};
+
+// CTimeOutTimer: timer for comms time-outs
+class CTimeOutTimer : public CTimer
+{
+public:
+ IMPORT_C static CTimeOutTimer* NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify);
+ ~CTimeOutTimer();
+
+protected:
+ CTimeOutTimer(const TInt aPriority);
+ void ConstructL(MTimeOutNotify& aTimeOutNotify);
+ virtual void RunL();
+
+private:
+ MTimeOutNotify* iNotify;
+};
+
+#endif // TIMEOUTTIMER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/utils/inc/mmapiutils.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,20 @@
+#ifndef MMAPIUTILS_H
+#define MMAPIUTILS_H
+#include "jni.h"
+#include "e32base.h"
+#include "BADESCA.H"
+
+class MMAPIUtils
+{
+public:
+
+ static TInt CopyToJava(JNIEnv& aJni, const TDesC8& aNativeBuffer,
+ jbyteArray aJavaBuffer, TInt aOffset, TInt aLength);
+ static jstring CreateJavaString(JNIEnv& aJni, const TDesC16& aString);
+
+ static jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni, const CDesCArray& aNativeArray);
+
+ static void AddToJavaStringArrayL(JNIEnv& aJni, jobjectArray& aContainer, TInt aPosition, const TDesC& aString);
+};
+
+#endif // MMAPIUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/utils/src/TimeOutTimer.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Timer for comms time-outs
+*
+*/
+
+
+#include "TimeOutTimer.h"
+
+CTimeOutTimer::CTimeOutTimer(const TInt aPriority)
+ : CTimer(aPriority)
+{
+}
+
+CTimeOutTimer::~CTimeOutTimer()
+{
+ Cancel();
+}
+
+
+EXPORT_C CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify)
+{
+ CTimeOutTimer *p = new(ELeave) CTimeOutTimer(aPriority);
+ CleanupStack::PushL(p);
+ p->ConstructL(aTimeOutNotify);
+ CleanupStack::Pop();
+ return p;
+}
+
+void CTimeOutTimer::ConstructL(MTimeOutNotify &aTimeOutNotify)
+{
+ iNotify=&aTimeOutNotify;
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+}
+
+void CTimeOutTimer::RunL()
+// Timer request has completed, so notify the timer's owner
+{
+ iNotify->TimerExpired();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/utils/src/mmapiutils.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,59 @@
+#include "mmapiutils.h"
+#include "s60commonutils.h"
+using namespace java::util;
+
+enum TJavaArrayPanic
+{
+ EBadOffsetIntoJavaArray,
+ EWritingOverEndOfJavaArray,
+ EBadOffsetIntoJavaArrayForRead,
+ EReadingOverEndOfJavaArray,
+};
+
+
+/**
+ * Copies data from the native to the Java array.
+ * @return The number of bytes copied.
+ */
+TInt MMAPIUtils::CopyToJava(JNIEnv& aJni, const TDesC8& aNativeBuffer,
+ jbyteArray aJavaBuffer, TInt aOffset, TInt aLength)
+{
+ __ASSERT_DEBUG(aOffset <= aJni.GetArrayLength(aJavaBuffer),
+ User::Panic(_L("ArrayUtils"), EBadOffsetIntoJavaArray));
+ __ASSERT_DEBUG(aLength <= aJni.GetArrayLength(aJavaBuffer) - aOffset,
+ User::Panic(_L("ArrayUtils"), EWritingOverEndOfJavaArray));
+
+ TInt nativeBufferLength = aNativeBuffer.Length();
+ TInt length = (nativeBufferLength < aLength) ? nativeBufferLength : aLength;
+ TUint8* nativeBufferPtr = const_cast<TUint8*>(aNativeBuffer.Ptr());
+ jbyte* jNativeBufferPtr = reinterpret_cast<jbyte*>(nativeBufferPtr);
+ aJni.SetByteArrayRegion(aJavaBuffer, aOffset, length, jNativeBufferPtr);
+ return length;
+}
+
+jobjectArray MMAPIUtils::CopyToNewJavaStringArrayL(JNIEnv& aJni, const CDesCArray& aNativeArray)
+{
+ jclass stringClass = aJni.FindClass("java/lang/String");
+ User::LeaveIfNull(stringClass);
+ //
+ jobjectArray result = aJni.NewObjectArray(aNativeArray.Count(), stringClass, NULL);
+ if (result != NULL)
+ {
+ TPtrC item;
+ for (int i=0; i<aNativeArray.Count(); ++i)
+ {
+ item.Set(aNativeArray[i]);
+ AddToJavaStringArrayL(aJni, result, i, item);
+ }
+ }
+ return result;
+}
+
+void MMAPIUtils::AddToJavaStringArrayL(JNIEnv& aJni, jobjectArray& aContainer, TInt aPosition, const TDesC& aString)
+{
+ jstring javaString = S60CommonUtils::NativeToJavaString(aJni, aString);
+ User::LeaveIfNull(javaString);
+ //
+ aJni.SetObjectArrayElement(aContainer, aPosition, javaString);
+ aJni.DeleteLocalRef(javaString);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/cmmaforeground.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class is used to find out from java is midlet foreground or not
+*
+*/
+
+
+#ifndef CMMAFOREGROUND_H
+#define CMMAFOREGROUND_H
+
+#include <e32base.h>
+
+#include "mmmaeventposter.h"
+#include "cmmadeleterefevent.h"
+#include "cmmaforegroundevent.h"
+
+// xm-radio fix
+//#include "CMIDToolkit.h"
+//#include "lcdui.h"
+
+#include <coemain.h>
+#include <eikenv.h>
+
+// CLASS DECLARATION
+/**
+*
+* Class is used to find out from java is midlet foreground or not
+*/
+NONSHARABLE_CLASS(CMMAForeground) : public CBase/*, public MMIDEnvObserver, public MCoeForegroundObserver*/
+{
+public:
+
+ /**
+ * Creates and returns a new instance of this class.
+ * @param aEventPoster for posting event to java side
+ * @param aForegroundListener java side foreground object
+ * @param aJavaMethod java side method id
+ * @return New instance from this class.
+ */
+ static CMMAForeground* NewL(MMMAEventPoster* aEventPoster,
+ jobject aForegroundListener,
+ jmethodID aJavaMethod/*,
+ CMIDToolkit* aToolkit*/); // xm-radio fix
+ /**
+ * Destructor.
+ */
+ ~CMMAForeground();
+
+protected:
+
+ /**
+ * C++ constructor
+ */
+ CMMAForeground();
+
+ /**
+ * Second phase constructor
+ * @param aEventPoster for posting event to java side
+ * @param aForegroundListener java side foreground object
+ * @param aJavaMethod java side method id
+ */
+ void ConstructL(MMMAEventPoster* aEventPoster,
+ jobject aForegroundListener,
+ jmethodID aJavaMethod/*,
+ CMIDToolkit* aToolkit*/); // xm-radio fix
+
+public: // New methods
+
+
+ /**
+ * Tells is midlet foreground or not
+ * @return boolean
+ */
+ TBool IsForeground();
+
+ /**
+ * Sets member boolean iIsForeground
+ */
+ void SetForeground(TBool aIsForeground);
+
+public: // from MMIDEnvObserver
+
+ // void HandleSwitchOnL(TBool /*aSwitchOn*/);
+
+ /**
+ * Handles the case when the MIDlet is brought to the foreground.
+ */
+ // void HandleForegroundL(TBool /*aForeground*/);
+
+ /**
+ * Handles a change to resources which are shared accross the environment.
+ */
+ // void HandleResourceChangeL(TInt /*aType*/);
+
+public:
+ /** Handles the application coming to the foreground. */
+ void HandleGainingForeground();
+
+ /** Handles the application going into the background. */
+ void HandleLosingForeground();
+
+private: // Member data
+
+ CActiveSchedulerWait* iActiveScheduler; // owned
+ MMMAEventPoster* iEventPoster; // not owned
+ CMMAForegroundEvent* iForegroundEvent; // owned
+
+ //Event is used to destroy reference to associated java object,
+ //when foreground is destroyed.
+ CMMADeleteRefEvent* iDeleteRefEvent; // owned
+
+ jobject iForegroundListener;
+ jmethodID iJavaMethod;
+
+ TBool iIsForeground;
+ // xm-radio fix
+ //CMIDToolkit* iToolkit;
+ //MMIDEnv* iMidEnv;
+};
+
+#endif // CMMAFOREGROUND_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/cmmaforegroundevent.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+#ifndef CMMAFOREGROUNDEVENT_H
+#define CMMAFOREGROUNDEVENT_H
+
+// INCLUDES
+#include "cmmaevent.h"
+
+// CLASS DECLARATION
+/**
+* This class is used to post events to the java.
+*
+*
+*/
+
+NONSHARABLE_CLASS(CMMAForegroundEvent) : public CMMAEvent
+{
+public: // Construction
+ /**
+ * Constructor.
+ *
+ * @param aNotifyObject java side foreground object
+ * @param aHandleEventMethod java side method id
+ * @param aDisposable Indicates if this event will be destroyed
+ * after dispatch.
+ */
+ CMMAForegroundEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable = EDisposableEvent);
+
+
+private: // from CMMAEvent
+
+ void Dispatch(JNIEnv& aJni);
+
+};
+
+#endif // CMMAFOREGROUNDEVENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/cmmaglobalvolume.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for global volume
+*
+*/
+
+
+#ifndef CMMAGLOBALVOLUME_H
+#define CMMAGLOBALVOLUME_H
+
+// INTERNAL INCLUDES
+#include "cmmavolumecontrol.h"
+#include "mmmavolumekeyslistener.h"
+
+class CMMAPlayer;
+class CMMAForeground;
+class CRepository;
+class CMMAVolumeKeysListener;
+
+// CLASS DECLARATION
+/**
+ * This class is used for global volume setting
+ * @since S60 3.2
+ */
+NONSHARABLE_CLASS(CMMAGlobalVolume) : public CBase,
+ public MMMAVolumeKeysListener
+{
+private: // Type definitions
+
+ // Volume control, index and player holder
+ class TMMAPlayerHolder
+ {
+ public:
+ // Volume index
+ TInt iVolumeIndex;
+ // Player which contains the volume control
+ CMMAPlayer* iPlayer;
+ // Volume control from the player
+ CMMAVolumeControl* iVolumeControl;
+ };
+
+public: // Constructor and destructors
+
+ /**
+ * NewL
+ * Creates an instance from this class
+ * @param aForeground Foreground listener. The ownership is transferred
+ * to this class
+ * @return New instance from this class. The caller takes ownership
+ * of the returned object
+ */
+ static CMMAGlobalVolume* NewL(CMMAForeground* aForeground);
+
+ /**
+ * Destructor
+ */
+ virtual ~CMMAGlobalVolume();
+
+public: // New methods
+
+ /**
+ * Adds new player for listening global volume. Players which
+ * do not have volume control are simply ignored
+ *
+ * @param aPlayer Player which receives volume key notifications
+ */
+ void AddPlayerL(CMMAPlayer* aPlayer);
+
+ /**
+ * Removes player from listening global volume
+ */
+ void RemovePlayer(CMMAPlayer* aPlayer);
+
+public: // From MMMAVolumeKeysListener
+
+ /**
+ * Handles volume up event
+ */
+ void VolumeUp();
+
+ /**
+ * Handles volume down event
+ */
+ void VolumeDown();
+
+private: // New methods
+
+ /**
+ * Finds volume control from a player
+ *
+ * @param aPlayer Player from which the volume control is searched
+ * @return Volume control instance. NULL is returned if the player
+ * does not support volume control feature
+ */
+ CMMAVolumeControl* FindVolumeControl(CMMAPlayer* aPlayer);
+
+ /**
+ * Sets volume level for all registered volume controls
+ * @param aLevel New volume level
+ */
+ void SetControlVolumeLevels(TInt aLevel);
+
+private: // Private constructors
+
+ /**
+ * C++ constructor
+ * @param aForeground Foreground listener
+ */
+ CMMAGlobalVolume(CMMAForeground* aForeground);
+
+ /**
+ * Second phase constructor
+ */
+ void ConstructL();
+
+protected: // Data
+
+ // Current global volume level
+ TInt iLevel;
+ // Foreground listener. Owned
+ CMMAForeground* iForeground;
+ // MMA setting repository. Owned
+ CRepository* iSettingsStore;
+ // Volume keys listener. Owned
+ CMMAVolumeKeysListener* iVolumeKeysListener;
+ // Array of volume controls
+ RArray< TMMAPlayerHolder > iControlList;
+};
+
+#endif // CMMAGLOBALVOLUME_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/cmmavolumekeyslistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class handles the volume keys update events
+*
+*
+*/
+
+
+#ifndef CMMAVOLUMEKEYSLISTENER_H
+#define CMMAVOLUMEKEYSLISTENER_H
+
+// EXTERNAL INCLUDES
+#include <e32base.h>
+/*#include <remconcoreapitargetobserver.h>
+#include <javaremconmanager.h>
+#include <javaremconobserver.h>
+*/
+// INTERNAL INCLUDES
+#include "mmmavolumekeyslistener.h"
+
+// CLASS DECLARATION
+class CRemConInterfaceSelector;
+class CRemConCoreApiTarget;
+
+// CLASS DECLARATION
+/**
+ *This class handles the volume keys update events
+ *
+ */
+NONSHARABLE_CLASS(CMMAVolumeKeysListener) : public CBase/*, public MRemConCoreApiTargetObserver*/
+{
+public: // Constructors and destructor
+
+ /**
+ * Creates and returns a new instance of this class.
+ * @param aListener Listener for key events
+ */
+ static CMMAVolumeKeysListener* NewL(MMMAVolumeKeysListener* aListener);
+
+ // Destructor
+ ~CMMAVolumeKeysListener();
+
+private: // Constructors
+
+ // Default constructor
+ CMMAVolumeKeysListener();
+
+ /**
+ * Second phase constructor.
+ * @param aListener Listener for key events
+ */
+ void ConstructL(MMMAVolumeKeysListener* aListener);
+
+public: // New functions
+
+
+ void HandleTimerEvent();
+
+
+ // From MRemConCoreApiTargetObserver
+ /* void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed,
+ TRemConCoreApiButtonAction aButtonAct);
+
+ void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct);
+
+ void MrccatoTuneFunction(TBool aTwoPart, TUint aMajorChannel,
+ TUint aMinorChannel,
+ TRemConCoreApiButtonAction aButtonAct);
+
+ void MrccatoSelectDiskFunction(TUint aDisk,
+ TRemConCoreApiButtonAction aButtonAct);
+
+ void MrccatoSelectAvInputFunction(
+ TUint8 aAvInputSignalNumber,
+ TRemConCoreApiButtonAction aButtonAct);
+ void MrccatoSelectAudioInputFunction(
+ TUint8 aAudioInputSignalNumber,
+ TRemConCoreApiButtonAction aButtonAct);
+
+ */
+
+private:
+
+ /**
+ * TimerCallback
+ * This is the callback function called from timer.
+ */
+ static TInt TimerCallback(TAny* aThis);
+
+private:
+ CRemConInterfaceSelector* iInterfaceSelector; //owned
+ CRemConCoreApiTarget* iCoreTarget; //owned by iInterfaceSelector
+
+ // For getting timer ticks/events, owned
+ CPeriodic* iTimer;
+ // Marks if volume is increased or decreased
+ TBool iUp;
+ // Listener listening events. Used
+ MMMAVolumeKeysListener* iListener;
+ /* CJavaRemConManager *iJavaRemConManager;
+ CJavaRemConObserver *iJavaRemConObserver;
+ */
+};
+
+#endif // CMMAVOLUMEKEYSLISTENER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/mmaprivatecrkeys.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MMA private Central Repository uids and keys
+*
+*/
+
+
+#ifndef MMAPRIVATECRKEYS_H
+#define MMAPRIVATECRKEYS_H
+
+// MMA settings store Central Repository uid
+const TUid KCRUidMobileMedia = { 0x102828A1 };
+// Key identifier for Volume level setting
+const TUint32 KMobileMediaVolumeLevel = 0x00000001;
+
+#endif // MMAPRIVATECRKEYS_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/inc/mmmavolumekeyslistener.h Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The class derived from this class handles the volume keys
+* update events
+*
+*
+*/
+
+
+
+#ifndef MMMAVOLUMEKEYSLISTENER_H
+#define MMMAVOLUMEKEYSLISTENER_H
+
+#include <e32def.h>
+
+// CLASS DECLARATION
+/**
+* The class derived from this class handles the volume keys
+* update events
+*/
+NONSHARABLE_CLASS(MMMAVolumeKeysListener)
+{
+public: // Constructors and destructor
+
+ //Virtual destructor, public allows delete
+ virtual ~MMMAVolumeKeysListener() {};
+
+public: // Abstract methods
+ /**
+ * Called when volume key is clicked/pressed up
+ */
+ virtual void VolumeUp() = 0;
+
+ /**
+ * Called when volume key is clicked/pressed down
+ */
+ virtual void VolumeDown() = 0;
+};
+
+#endif // MMMAVOLUMEKEYSLISTENER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/javasrc/com/nokia/microedition/volumekeys/ForegroundListener.java Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+ *
+*/
+
+
+// PACKAGE
+package com.nokia.microedition.volumekeys;
+
+// IMPORTS
+import com.nokia.microedition.media.NativeError;
+import java.lang.OutOfMemoryError;
+//import com.nokia.microedition.volumekeys.LCDUIForegroundListener;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import javax.microedition.lcdui.*;
+import org.eclipse.swt.widgets.Display;
+
+
+// for xm-radio fix
+//import com.symbian.midp.runtime.ToolkitInvoker;
+
+// CLASS DESCRIPTION
+/**
+ * Provides information about the state of the MIDlet
+ */
+public class ForegroundListener implements Listener
+{
+ //private final LCDUIForegroundListener iLCDUIForegroundListener;
+ private final int iForegroundHandle;
+ private final int iEventSourceHandle;
+ // Added for MMAPI UI 3.x
+ private boolean flagForground = true;
+ // private MMAPILCDUIInvokerImpl obj;
+
+ /*
+ * Constructor. Creates Foreground listener
+ * The listener is added to Event source native side
+ */
+ public ForegroundListener(int aEventSourceHandle)
+ {
+ iEventSourceHandle = aEventSourceHandle;
+ // Added for MMAPI UI 3.x
+ // obj = new MMAPILCDUIInvokerImpl();
+ // obj.AddObservertoDisplay(this);
+ System.out.println("inside ForgroundLIstener constructor before _initialize");
+ iForegroundHandle = _initialize(aEventSourceHandle, this/*, iToolkitHandle*/);
+ System.out.println("inside ForgroundLIstener constructor after _initialize");
+ if (iForegroundHandle < NativeError.KErrNone)
+ {
+ throw new OutOfMemoryError("Foreground initialization failed.");
+ }
+
+
+
+ }
+
+
+public void init()
+{
+final ForegroundListener listener = this;
+System.out.println("inside init()....");
+
+try{
+ final org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ System.out.println("inside init()....1");
+
+
+ disp.syncExec(new Runnable() {
+ public void run() {
+ org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+ disp.addFilter(SWT.Activate,listener);
+ disp.addFilter(SWT.Deactivate,listener);
+ }
+ });
+}
+catch(Exception e)
+{
+ System.out.println("inside init()....exception is " + e.toString());
+}
+
+
+}
+
+
+ // Added for MMAPI UI 3.x
+
+ public boolean isForeground()
+ {
+ return flagForground;
+ }
+
+ /*
+ * From org.eclipse.swt.widget.Listener interface
+ * Handling all the event
+ * Used to filter out the event which can be used for Foreground/Background notification
+ */
+ public void handleEvent(Event event)
+ {
+ System.out.println("ForegroundListener :handle event is called");
+ if(event.type == SWT.Activate)
+ {
+ System.out.println("handle event got a event: not in background");
+ flagForground = true;
+ // update();
+
+ }
+ else if(event.type == SWT.Deactivate)
+ {
+ System.out.println("handle event got a event: in background");
+ flagForground = false;
+ // update();
+ }
+ }
+
+ /*
+ * Called from handleEvent callback function to notify native about the midlet foreground status
+ */
+ public synchronized void update()
+ {
+ boolean isFg = isForeground();
+ System.out.println("ForegroundListener.java inside update() : before calling native function ");
+ _setForeground(iEventSourceHandle, iForegroundHandle, isFg);
+ System.out.println("ForegroundListener.java inside update() : after calling native function ");
+ }
+
+ private native int _initialize(int aEventSourceHandle,
+ Object aForegroundListener/*,
+ int atoolkitHandle*/); // xm-radio fix
+
+ private native void _setForeground(int aEventSourceHandle,
+ int aForegroundHandle,
+ boolean aForeground);
+
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/src/Foreground.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: JNI implementation for handling midlet foreground status
+*
+*/
+
+
+// EXTERNAL INCLUDES
+//#include <jutils.h>
+#include <logger.h>
+
+//#include <mswtclient.h>
+//#include <swtcliententry.h>
+
+// INTERNAL INCLUDES
+#include "com_nokia_microedition_volumekeys_ForegroundListener.h"
+#include "cmmaforeground.h"
+#include "mmafunctionserver.h"
+#include "cmmaglobalvolume.h"
+
+// for xm-radio fix
+//#include "CMIDToolkit.h"
+
+/**
+ * Static delegator function for initialize.
+ * @param aReturnHandle Native class object.
+ * @param aEventSource Event source handle.
+ * @param aForegroundListener ForegroundListener java object.
+ * @param aJavaMethod java method ID.
+ */
+LOCAL_C void CreateForegroundL(
+ TInt* aReturnHandle,
+ MMAFunctionServer* aEventSource,
+ jobject aForegroundListener,
+ jmethodID aJavaMethod/*,
+ CMIDToolkit* aToolkit*/) // xm-radio fix
+{
+ CMMAForeground* foreground =
+ CMMAForeground::NewL(aEventSource,
+ aForegroundListener,
+ aJavaMethod/*,
+ aToolkit */// xm-radio fix
+ );
+ CleanupStack::PushL(foreground);
+
+ // Create global volume which handles the volume events
+ CMMAGlobalVolume* globalVolume = CMMAGlobalVolume::NewL(foreground);
+ // Global volume takes the ownership of the foreground listener
+ CleanupStack::Pop(foreground);
+ // Set global volume to MMA event source. The ownership transfers to
+ // MMA event sources as it handles adding and removing players
+ aEventSource->SetGlobalVolume(globalVolume);
+ *aReturnHandle = reinterpret_cast <TInt>(foreground);
+}
+
+/*
+ * Class: com_nokia_microedition_volumekeys_ForegroundListener
+ * Method: _initialize
+ * Signature: (ILjava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_microedition_volumekeys_ForegroundListener__1initialize
+(JNIEnv* aJni,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jobject aForegroundListener /*,
+ jint aToolkitHandle*/) // for xm-radio fix
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
+
+ jobject fgListenerObject = NULL;
+ fgListenerObject = aJni->NewWeakGlobalRef(aForegroundListener);
+
+ jclass foregroundListenerClass = aJni->GetObjectClass(fgListenerObject);
+
+ jmethodID javaMethod = aJni->GetMethodID(
+ foregroundListenerClass,
+ "update",
+ "()V");
+
+ TInt foregroundHandle = NULL;
+
+ // xm-radio fix
+ /*
+ CMIDToolkit* ptoolkit = JavaUnhand< CMIDToolkit >(aToolkitHandle);
+*/
+ jint error = eventSource->ExecuteTrap(CreateForegroundL,
+ &foregroundHandle,
+ eventSource,
+ fgListenerObject,
+ javaMethod/*,
+ ptoolkit*/); // xm-radio fix
+
+ if (error != KErrNone)
+ {
+ aJni->DeleteGlobalRef(fgListenerObject);
+ }
+
+ return (error != KErrNone) ? error : foregroundHandle;
+}
+
+/**
+ * Static delegator function for setforeground
+ * @param aCMMAForeground native class.
+ * @param aIsForeground boolean is midlet foreground or not.
+
+ */
+LOCAL_C void SetForeground(
+ CMMAForeground* aCMMAForeground,
+ TBool aIsForeground)
+{
+ aCMMAForeground->SetForeground(aIsForeground);
+}
+
+/*
+* Class: com_nokia_microedition_volumekeys_ForegroundListener
+* Method: _setForeground
+* Signature: (IZ)V
+*/
+JNIEXPORT void JNICALL Java_com_nokia_microedition_volumekeys_ForegroundListener__1setForeground
+(JNIEnv* /*aJni*/,
+ jobject /*aJobject*/,
+ jint aEventSourceHandle,
+ jint aForegroundHandle,
+ jboolean aIsForeground)
+{
+ MMAFunctionServer* eventSource =
+ reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
+
+ CMMAForeground* nativeHandle =
+ reinterpret_cast<CMMAForeground*>(aForegroundHandle);
+
+ eventSource->ExecuteV(SetForeground,
+ nativeHandle,
+ (TBool) aIsForeground);
+}
+
+
+/*
+JNIEXPORT jboolean JNICALL Java_com_nokia_microedition_volumekeys_ForegroundListener__1isESWT
+(JNIEnv *, jobject)
+{
+
+
+ MSwtClient* client = NULL;
+ TRAP_IGNORE(client = SWT::CreateClientL());
+
+ if (!client)
+ {
+ return false; // LCDUI midlet running
+ }
+ else
+ {
+ delete client;
+ client = NULL;
+ return true; // eSWT midlet running
+ }
+}
+
+*/
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/src/cmmaforeground.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Class is used to find out from java is midlet foreground or not
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+
+#include "cmmaforeground.h"
+#include "cmmaforegroundevent.h"
+// INCLUDE FILES
+#include <logger.h>
+
+// xm-radio fix
+//#include "cmidenv.h"
+
+CMMAForeground* CMMAForeground::NewL(MMMAEventPoster* aEventPoster,
+ jobject aForegroundListener,
+ jmethodID aJavaMethod/* ,
+ CMIDToolkit* aToolkit*/)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::NewL + ");
+ CMMAForeground* self = new(ELeave) CMMAForeground;
+
+ CleanupStack::PushL(self);
+ self->ConstructL(aEventPoster, aForegroundListener, aJavaMethod/*, aToolkit*/);
+ CleanupStack::Pop();
+
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::NewL - ");
+ return self;
+}
+
+CMMAForeground::~CMMAForeground()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() + ");
+ /* if (iMidEnv)
+ {
+ // unregister for getting the foreground change event
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() : iMidEnv RemoveObserver +");
+ iMidEnv->RemoveObserver(*this);
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() : iMidEnv RemoveObserver -");
+ }
+
+ CEikonEnv* eikEnv = ((CEikonEnv*)CEikonEnv::Static());
+
+ if (eikEnv)
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() : eikEnv RemoveForegroundObserver +");
+ eikEnv->RemoveForegroundObserver(*this);
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() : eikEnv RemoveForegroundObserver -");
+ }
+*/
+ if (iEventPoster && iDeleteRefEvent)
+ {
+ iEventPoster->PostEvent(iDeleteRefEvent);
+ }
+ else
+ {
+ delete iDeleteRefEvent;
+ }
+ delete iForegroundEvent;
+ delete iActiveScheduler;
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::~CMMAForeground() - ");
+}
+
+CMMAForeground::CMMAForeground()
+ : iIsForeground(ETrue) // Initialize IsForeground to true, we might have already missed the event (HandleForegroundL), events before observer registration
+{
+}
+
+void CMMAForeground::ConstructL(MMMAEventPoster* aEventPoster,
+ jobject aForegroundListener,
+ jmethodID aJavaMethod /* ,
+ CMIDToolkit* aToolkit*/) // xm-radio fix
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAForeground::ConstructL + ISFOREGROUND = %d",iIsForeground);
+
+ iActiveScheduler = new(ELeave) CActiveSchedulerWait();
+ iEventPoster = aEventPoster;
+ iForegroundListener = aForegroundListener;
+ iJavaMethod = aJavaMethod;
+
+ iForegroundEvent = new(ELeave) CMMAForegroundEvent(
+ aForegroundListener,
+ aJavaMethod,
+ CMMAEvent::EReusableEvent);
+ iDeleteRefEvent = new(ELeave) CMMADeleteRefEvent(aForegroundListener);
+
+ // xm-radio fix
+ /*
+ iToolkit = aToolkit;
+
+ if (iToolkit)
+ {
+ DEBUG("CMMAForeground::ConstructL : iToolkit->Env(); +");
+ iMidEnv = iToolkit->Env();
+ DEBUG("CMMAForeground::ConstructL : iToolkit->Env(); -");
+ }
+
+ if (iMidEnv)
+ {
+ DEBUG("CMMAForeground::ConstructL : iMidEnv->AddObserverL + ");
+ // register for getting the foreground change event
+ iMidEnv->AddObserverL(*this);
+ DEBUG("CMMAForeground::ConstructL : iMidEnv->AddObserverL - ");
+ }
+
+ CEikonEnv* eikEnv = ((CEikonEnv*)CEikonEnv::Static());
+
+ if (eikEnv)
+ {
+ DEBUG("CMMAForeground::ConstructL - eikAppUi->AddForegroundObserverL() + ");
+ eikEnv->AddForegroundObserverL(*this);
+ DEBUG("CMMAForeground::ConstructL - eikAppUi->AddForegroundObserverL() - ");
+ }
+ */
+ LOG( EJavaMMAPI, EInfo, "CMMAForeground::ConstructL - ");
+}
+
+TBool CMMAForeground::IsForeground()
+{
+ LOG2( EJavaMMAPI, EInfo, "THREADID = %d : CMMAForeground::IsForeground : ISFOREGROUND = %d",RThread().Id().Id(),iIsForeground);
+ return iIsForeground;
+}
+
+void CMMAForeground::SetForeground(TBool aIsForeground)
+{
+ iIsForeground = aIsForeground;
+ LOG1( EJavaMMAPI, EInfo, "CMMAForeground::SetForeground - ISFOREGROUND = %d",iIsForeground);
+}
+
+// Implement MMIDEnvObserver
+/*
+void CMMAForeground::HandleSwitchOnL(TBool aSwitchOn)
+{
+ // Dummy implementation, no intent to do anything
+}
+*/
+/**
+ * Handles the case when the MIDlet is brought to the foreground.
+ */
+ /*
+void CMMAForeground::HandleForegroundL(TBool aForeground)
+{
+ LOG1( EJavaMMAPI, EInfo, "CMMAForeground::HandleForegroundL %d", aForeground);
+ iIsForeground = aForeground;
+}
+*/
+/**
+ * Handles a change to resources which are shared accross the environment.
+ */
+/*void CMMAForeground::HandleResourceChangeL(TInt aType)
+{
+ // Dummy implementation, no intent to do anything
+}
+*/
+// Handles the application coming to the foreground.
+void CMMAForeground::HandleGainingForeground()
+{
+ iIsForeground = ETrue;
+}
+
+// Handles the application going into the background.
+void CMMAForeground::HandleLosingForeground()
+{
+ iIsForeground = EFalse;
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/src/cmmaforegroundevent.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used to post events to the java.
+*
+*/
+
+
+// INCLUDE FILES
+#include <logger.h>
+
+#include "cmmaforegroundevent.h"
+
+CMMAForegroundEvent::CMMAForegroundEvent(jobject aNotifyObject,
+ jmethodID aHandleEventMethod,
+ TDisposability aDisposable):
+ CMMAEvent(aNotifyObject, aHandleEventMethod, aDisposable)
+{
+
+}
+
+void CMMAForegroundEvent::Dispatch(JNIEnv& aJni)
+{
+ aJni.CallVoidMethod(iListenerObject,
+ iHandleEventMethod);
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/src/cmmaglobalvolume.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class is used for global volume
+*
+*/
+
+
+// CLASS HEADER
+#include "cmmaglobalvolume.h"
+
+// INTERNAL INCLUDES
+#include "cmmaplayer.h"
+#include "cmmaforeground.h"
+#include "cmmavolumekeyslistener.h"
+#include "mmaprivatecrkeys.h"
+
+// EXTERNAL INCLUDES
+#include <centralrepository.h>
+#include <logger.h>
+
+// UNNAMED LOCAL NAMESPACE
+namespace
+{
+// Volume level step size
+const TInt KMMAVolumeLevelStep = 10;
+// Error when setting new volume level for a control
+_LIT(KMMAGlobalVolumeSetError, "Can't set volume level");
+}
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::NewL
+// ---------------------------------------------------------------------------
+//
+CMMAGlobalVolume* CMMAGlobalVolume::NewL(CMMAForeground* aForeground)
+{
+ CMMAGlobalVolume* self = new(ELeave) CMMAGlobalVolume(aForeground);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::~CMMAGlobalVolume
+// ---------------------------------------------------------------------------
+//
+CMMAGlobalVolume::~CMMAGlobalVolume()
+{
+ delete iVolumeKeysListener;
+ //delete iSettingsStore;
+ delete iForeground;
+ iControlList.Close();
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::AddPlayerL
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::AddPlayerL(CMMAPlayer* aPlayer)
+{
+ // Find if the player has a volume control
+ CMMAVolumeControl* control = FindVolumeControl(aPlayer);
+
+ // Ignore adding new player if it does not support volume control
+ if (control)
+ {
+ TMMAPlayerHolder playerHolder;
+ // Create new volume control and level index pair
+ playerHolder.iVolumeControl = control;
+ playerHolder.iVolumeIndex = control->AddLevelL();
+ playerHolder.iPlayer = aPlayer;
+ // Set current volume level for the control
+ control->SetVolumeLevelL(playerHolder.iVolumeIndex, iLevel);
+ // Add created pair to the control list
+ iControlList.AppendL(playerHolder);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::RemovePlayer
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::RemovePlayer(CMMAPlayer* aPlayer)
+{
+ // Find if the player has a volume control
+ CMMAVolumeControl* control = FindVolumeControl(aPlayer);
+
+ // Ignore adding new player if it does not support volume control
+ if (control)
+ {
+ // Check that if this type of volume control can be found from
+ // the control list and remove it
+ TInt count(iControlList.Count());
+ for (TInt i(0); i < count; i++)
+ {
+ const TMMAPlayerHolder& holder = iControlList[ i ];
+ if (control == holder.iVolumeControl)
+ {
+ iControlList.Remove(i);
+ break;
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::VolumeUp
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::VolumeUp()
+{
+ LOG1( EJavaMMAPI, EInfo, "THREADID = %d : CMMAGlobalVolume: VolumeUp: +", RThread().Id().Id());
+ // Adjust volume if midlet is in foreground and the volume level value
+ // is not too high, in this case it cannot be set over KMMAVolumeMaxLevel
+ if (iForeground->IsForeground() && (iLevel < KMMAVolumeMaxLevel))
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAGlobalVolume: VolumeUp: Volume up");
+ // Check that the current volume level is not increased too much
+ TInt level =
+ iLevel > (KMMAVolumeMaxLevel - KMMAVolumeLevelStep) ?
+ KMMAVolumeMaxLevel - iLevel : iLevel + KMMAVolumeLevelStep;
+ // Increase level by new value
+ SetControlVolumeLevels(level);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAGlobalVolume: VolumeUp: -");
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::VolumeDown
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::VolumeDown()
+{
+ LOG1( EJavaMMAPI, EInfo, "THREADID = %d : CMMAGlobalVolume: VolumeDown: +", RThread().Id().Id());
+ // Adjust volume if midlet is in foreground and the volume value
+ // is not too low, in this case it cannot be set under zero
+ if (iForeground->IsForeground() && (iLevel > 0))
+ {
+ LOG( EJavaMMAPI, EInfo, "CMMAGlobalVolume: VolumeDown: Volume down");
+ // Check that the currnet volume level is not decreased too much
+ TInt level =
+ iLevel < KMMAVolumeLevelStep ?
+ 0 : iLevel - KMMAVolumeLevelStep;
+ // Decrease level by new value
+ SetControlVolumeLevels(level);
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAGlobalVolume: VolumeDown: -");
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::FindVolumeControl
+// ---------------------------------------------------------------------------
+//
+CMMAVolumeControl* CMMAGlobalVolume::FindVolumeControl(CMMAPlayer* aPlayer)
+{
+ TInt count(aPlayer->ControlCount());
+ for (TInt i(0); i < count; i++)
+ {
+ CMMAControl* control = aPlayer->Control(i);
+ // Check that if this control supports volume control
+ if (control->ClassName() == KMMAVolumeControlName)
+ {
+ return static_cast< CMMAVolumeControl* >(control);
+ }
+ }
+ // Does not support volume control
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::SetControlVolumeLevels
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::SetControlVolumeLevels(TInt aLevel)
+{
+ TInt count(iControlList.Count());
+ // Adjust volume for all current volume controls associated
+ for (TInt i(0); i < count; i++)
+ {
+ const TMMAPlayerHolder& hdr = iControlList[ i ];
+ // Set new volume level for this control
+ TRAPD(error,
+ hdr.iVolumeControl->SetVolumeLevelL(hdr.iVolumeIndex, aLevel));
+ if (error != KErrNone)
+ {
+ hdr.iPlayer->PostStringEvent(
+ CMMAPlayerEvent::EError,
+ KMMAGlobalVolumeSetError());
+ }
+ }
+
+ iLevel = aLevel;
+ LOG1( EJavaMMAPI, EInfo,
+ "CMMAGlobalVolume::SetControlVolumeLevels - iLevel = %d", iLevel);
+
+ // Store new volume to MMA global settings. Error cannot be reported
+ // in any sophisticated way so we just have to ignore it. Debug builds
+ // may panic in this case
+ TInt error = iSettingsStore->Set(KMobileMediaVolumeLevel, aLevel);
+ __ASSERT_DEBUG(error == KErrNone, User::Invariant());
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::CMMAGlobalVolume
+// ---------------------------------------------------------------------------
+//
+CMMAGlobalVolume::CMMAGlobalVolume(CMMAForeground* aForeground) :
+ iLevel(KMMAVolumeMaxLevel),
+ iForeground(aForeground)
+{
+}
+
+// ---------------------------------------------------------------------------
+// CMMAGlobalVolume::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMMAGlobalVolume::ConstructL()
+{
+ iVolumeKeysListener = CMMAVolumeKeysListener::NewL(this);
+ // TO-DO remove TRAP_IGNORE
+ // TRAP_IGNORE(err,iSettingsStore = CRepository::NewL(KCRUidMobileMedia));
+
+ // Get level from the settings store
+ //User::LeaveIfError(iSettingsStore->Get(KMobileMediaVolumeLevel, iLevel));
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/mmapi_qt/volumekeys/src/cmmavolumekeyslistener.cpp Tue May 11 16:07:20 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class handles the volume keysupdate events
+*
+*/
+
+
+// INCLUDE FILES
+/*#include <remconcoreapitarget.h>
+#include <remconcoreapitargetobserver.h>
+#include <remconinterfaceselector.h>
+*/
+//#include <aknconsts.h>
+#include <logger.h>
+
+#include "cmmavolumekeyslistener.h"
+
+// CONSTANTS
+
+// Keyboard delays and repeat periods
+//const TInt KFirstTimerExpiryInterval = KAknKeyboardRepeatInitialDelay;
+// For second time onwards ,the duration of the time interval, is below
+// Should not be greater than 1 Minute
+// const TInt KTimerExpiryInterval = KAknStandardKeyboardRepeatRate;
+
+CMMAVolumeKeysListener* CMMAVolumeKeysListener::NewL(MMMAVolumeKeysListener* aListener)
+{
+ CMMAVolumeKeysListener* self = new(ELeave) CMMAVolumeKeysListener();
+ CleanupStack::PushL(self);
+ self->ConstructL(aListener);
+ CleanupStack::Pop();
+ return self;
+}
+
+CMMAVolumeKeysListener::~CMMAVolumeKeysListener()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::~CMMAVolumeKeysListener() +");
+ /* if ((NULL != iJavaRemConObserver) && (NULL != iJavaRemConManager))
+ {
+ iJavaRemConManager->RemoveObserver(*iJavaRemConObserver);
+ }
+
+ if (NULL != iJavaRemConObserver)
+ {
+ delete iJavaRemConObserver;
+ iJavaRemConObserver = NULL;
+ }
+
+ if (NULL != iJavaRemConManager)
+ {
+ delete iJavaRemConManager;
+ iJavaRemConManager = NULL;
+ }
+*/
+ if (NULL != iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::~CMMAVolumeKeysListener() -");
+}
+
+CMMAVolumeKeysListener::CMMAVolumeKeysListener()
+{
+}
+
+void CMMAVolumeKeysListener::ConstructL(MMMAVolumeKeysListener* aListener)
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::ConstructL +");
+ /*iJavaRemConObserver = CJavaRemConObserver::NewL(*this);
+ iJavaRemConManager = CJavaRemConManager::NewL();
+ iJavaRemConManager->SetObserverL(*iJavaRemConObserver);
+*/
+ // Timer for implementing Pressed/Released/Clicked feature.
+ iTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+ iListener = aListener;
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::ConstructL -");
+}
+
+/*
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoPlay()
+// Called when Play button is pressed/clicked/released
+// ----------------------------------------------------------------------------
+void CMMAVolumeKeysListener::MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+}
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoCommand()
+// This function receives the events when following buttons are press/click/rel
+// - Volume Up , Volume Down
+// ----------------------------------------------------------------------------
+void CMMAVolumeKeysListener::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+ switch (aOperationId)
+ {
+ case ERemConCoreApiVolumeUp:
+ {
+ iUp = ETrue;
+ switch (aButtonAct)
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ // Start Timer
+ if (!iTimer->IsActive())
+ {
+ // Start Timer
+ iTimer->Start(KFirstTimerExpiryInterval,
+ KTimerExpiryInterval,
+ TCallBack(TimerCallback, this));
+ }
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ if (iTimer->IsActive())
+ {
+ iTimer->Cancel();
+ }
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ iListener->VolumeUp();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ break;
+ }
+ case ERemConCoreApiVolumeDown:
+ {
+ iUp = EFalse;
+ switch (aButtonAct)
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ // Start Timer
+ if (!iTimer->IsActive())
+ {
+ // Start Timer
+ iTimer->Start(KFirstTimerExpiryInterval,
+ KTimerExpiryInterval,
+ TCallBack(TimerCallback, this));
+ }
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ if (iTimer->IsActive())
+ {
+ iTimer->Cancel();
+ }
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ iListener->VolumeDown();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoTuneFunction()
+//
+// ----------------------------------------------------------------------------
+
+void CMMAVolumeKeysListener::MrccatoTuneFunction(TBool aTwoPart,
+ TUint aMajorChannel,
+ TUint aMinorChannel,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+}
+
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoSelectDiskFunction()
+//
+// ----------------------------------------------------------------------------
+void CMMAVolumeKeysListener::MrccatoSelectDiskFunction(TUint aDisk,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+}
+
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoSelectAvInputFunction()
+//
+// ----------------------------------------------------------------------------
+void CMMAVolumeKeysListener::MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+}
+
+// ----------------------------------------------------------------------------
+// void CMMAVolumeKeysListener::MrccatoSelectAudioInputFunction()
+//
+// ----------------------------------------------------------------------------
+void CMMAVolumeKeysListener::MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+}
+
+*/
+// -----------------------------------------------------------------------
+// CMMAVolumeKeysListener::HandleTimerEvent
+// Description: When Timer is expired, this function is called from
+// callback function.
+// return :
+// -----------------------------------------------------------------------
+//
+void CMMAVolumeKeysListener::HandleTimerEvent()
+{
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::HandleTimerEvent +");
+ if (iUp)
+ {
+ iListener->VolumeUp();
+ }
+ else
+ {
+ iListener->VolumeDown();
+ }
+ LOG( EJavaMMAPI, EInfo, "CMMAVolumeKeysListener::HandleTimerEvent -");
+}
+
+// -----------------------------------------------------------------------
+// CMMAVolumeKeysListener::TimerCallback
+// Description: When Timer is expired, this function is called
+// return :
+// -----------------------------------------------------------------------
+//
+TInt CMMAVolumeKeysListener::TimerCallback(TAny* aThis)
+{
+ CMMAVolumeKeysListener* listener =
+ static_cast< CMMAVolumeKeysListener* >(aThis);
+ listener->HandleTimerEvent();
+ return 0;
+}
+
+// End of File
--- a/javauis/nokiasound_akn/build/javanokiasound_0x2002DCC4.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/nokiasound_akn/build/javanokiasound_0x2002DCC4.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -88,6 +87,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/nokiasound_akn/javasrc/com/nokia/mid/sound/Sound.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/nokiasound_akn/javasrc/com/nokia/mid/sound/Sound.java Tue May 11 16:07:20 2010 +0300
@@ -108,6 +108,7 @@
private static final int NOT_SUPPORTED_ERROR = 3;
private static final int ERR_NOT_READY = -18;
+ private static final int ERR_ARGUMENT = -6;
private int iHandle;
@@ -362,6 +363,10 @@
{
throw new RuntimeException(Integer.toString(err));
}
+ else if (err == ERR_ARGUMENT)
+ {
+ throw new IllegalArgumentException("Data is invalid");
+ }
iState = SOUND_STOPPED;
}
@@ -410,7 +415,7 @@
iCurrentType = type;
int err = _init(iHandle, iCurrentType, data, 0, 0);
- if (err == ERR_NOT_READY)
+ if (err == ERR_NOT_READY || err == ERR_ARGUMENT )
{
throw new IllegalArgumentException("Data is invalid");
}
--- a/javauis/nokiasound_akn/src/cmidsound.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/nokiasound_akn/src/cmidsound.cpp Tue May 11 16:07:20 2010 +0300
@@ -205,10 +205,18 @@
TInt CMIDSound::DoPlay(TInt aLoop)
{
JELOG2(EJavaUI);
- TInt state = iMIDSound->State();
- if (state != CMIDSoundImpl::EReadyToPlay)
+
+ if ( iMIDSound )
{
- return state;
+ TInt state = iMIDSound->State();
+ if (state != CMIDSoundImpl::EReadyToPlay)
+ {
+ return state;
+ }
+ }
+ else
+ {
+ return CMIDSoundImpl::ENotSupported;
}
if (!IsAudioEnabled())
{
--- a/javauis/nokiauiapi_qt/build/build.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/nokiauiapi_qt/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -36,8 +36,8 @@
<property name="javah.classnames" value="com.nokia.mid.ui.internal.OS"/>
<target name="create.public.api.jar">
- <omj.public.apis includes="com/nokia/mid/ui/TactileFeedback.class,
- com/nokia/mid/ui/internal/OS.class"/>
+ <omj.public.apis includes="com/nokia/mid/ui/TactileFeedback.class,
+ com/nokia/mid/ui/DeviceControl.class"/>
</target>
--- a/javauis/nokiauiapi_qt/library/os.cpp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/nokiauiapi_qt/library/os.cpp Tue May 11 16:07:20 2010 +0300
@@ -17,7 +17,7 @@
-#include<QWidget>
+#include <QWidget>
#include <coecntrl.h>
#include <touchfeedback.h>
#include <com_nokia_mid_ui_internal_OS.h>
--- a/javauis/remconobserver_akn/build/javaremconobserver_0x2002DCCA.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/remconobserver_akn/build/javaremconobserver_0x2002DCCA.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -85,6 +84,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/runtimeui_akn/build/javaruntimeui_0x2002DCCD.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/runtimeui_akn/build/javaruntimeui_0x2002DCCD.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -83,6 +82,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/runtimeui_akn/javasrc.s60/com/nokia/mj/impl/rt/ui/avkon/RuntimeUiAvkon.java Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/runtimeui_akn/javasrc.s60/com/nokia/mj/impl/rt/ui/avkon/RuntimeUiAvkon.java Tue May 11 16:07:20 2010 +0300
@@ -24,9 +24,6 @@
/**
* Runtime UI AVKON implementation.
- *
- * @author Nokia Corporation
- * @version $Rev: 0 $
*/
public class RuntimeUiAvkon extends RuntimeUi
{
--- a/javauis/runtimeui_akn/loc/javausermessages.loc Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/runtimeui_akn/loc/javausermessages.loc Tue May 11 16:07:20 2010 +0300
@@ -383,6 +383,12 @@
//
#define qtn_java_secur_cert_disabling "Disabling a certificate may prevent you from installing or running some applications. Continue?"
+// d:Certificate management message
+// d:for deleting certificate
+// l:popup_note_window
+//
+#define qtn_java_secur_cert_deleting "Deleting a certificate may prevent you from installing or running some applications. Continue?"
+
// d:Security message for platform message
// d:for using network
// l:popup_info_list_pane_t2/opt1
--- a/javauis/runtimeui_qt/build/build.xml Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/runtimeui_qt/build/build.xml Tue May 11 16:07:20 2010 +0300
@@ -23,9 +23,6 @@
<import file="../../../build/utilities.xml"/>
- <property name="localisation.file.base"
- value="javausermessages"/>
-
<target name="init.component.properties" if="target.s60">
<property name="javah.classnames"
value="com.nokia.mj.impl.rt.ui.qt.RuntimeUiQt"/>
--- a/javauis/softnotification_akn/build/javasoftnotification_0x2002DCD6.mmp Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/softnotification_akn/build/javasoftnotification_0x2002DCD6.mmp Tue May 11 16:07:20 2010 +0300
@@ -44,7 +44,6 @@
MACRO RD_JAVA_EPOCALLOWDLLDATA_FIX
MACRO RD_JAVA_HTTP_EMC_ENABLED
MACRO RD_JAVA_NGA_ENABLED
-MACRO RD_JAVA_UI_ALFDRAWER_ENABLED
MACRO RD_JAVA_PROXIMITY_LISTENER_ENABLED
MACRO RD_JAVA_OPENC_BETA_PATCH
MACRO RD_JAVA_INSTALLERUI_ENABLED
@@ -86,6 +85,9 @@
OPTION CW -wchar_t on
OPTION ARMCC --visibility_inlines_hidden
+#if defined(ARMCC_4_0)
+OPTION ARMCC --import_all_vtbl
+#endif
OPTION GCCE -fvisibility-inlines-hidden
VERSION 10.0
--- a/javauis/subsystem_qt.mk Fri Apr 30 10:40:48 2010 +0300
+++ b/javauis/subsystem_qt.mk Tue May 11 16:07:20 2010 +0300
@@ -14,4 +14,6 @@
# Description: Makefile for Qt based components and subsystems
#
-COMPONENTS += eswt_qt/build lcdui_qt/build runtimeui_qt/build nokiauiapi_qt/build
+COMPONENTS += eswt_qt/build lcdui_qt/build runtimeui_qt/build nokiauiapi_qt/build mmapi_qt/build
+
+SYMBIAN_ONLY += mmapi_qt/build
--- a/jrt_plat/java_env_info_api/inc/javaenvinfo.h Fri Apr 30 10:40:48 2010 +0300
+++ b/jrt_plat/java_env_info_api/inc/javaenvinfo.h Tue May 11 16:07:20 2010 +0300
@@ -71,7 +71,7 @@
IMPORT_C static HBufC* GetPlatformInfoL();
private:
- static TVersion JavaEnvInfo::GetJavaVersionL();
+ static TVersion GetJavaVersionL();
};
}
--- a/jrt_plat/java_registry_api/inc/javaregistryentry.h Fri Apr 30 10:40:48 2010 +0300
+++ b/jrt_plat/java_registry_api/inc/javaregistryentry.h Tue May 11 16:07:20 2010 +0300
@@ -148,8 +148,7 @@
* @return MJavaAttribute poiter to instance, which contain attribute.
* If attribute doesn't exist return NULL.
*/
- IMPORT_C const MJavaAttribute*
- CJavaRegistryEntry::AttributeL(const TDesC& aName) const;
+ IMPORT_C const MJavaAttribute* AttributeL(const TDesC& aName) const;
/**
* CJavaRegistryEntry::Attributes method gets the
@@ -158,8 +157,7 @@
* @since S60 v5.0
* @return RPointerArray& with all additional attributes.
*/
- IMPORT_C const RPointerArray<MJavaAttribute>&
- CJavaRegistryEntry::AttributesL() const;
+ IMPORT_C const RPointerArray<MJavaAttribute>& AttributesL() const;
protected: