diff --git a/.github/scripts/run-ios-simulator.sh b/.github/scripts/run-ios-simulator.sh new file mode 100755 index 0000000..1533100 --- /dev/null +++ b/.github/scripts/run-ios-simulator.sh @@ -0,0 +1,137 @@ +#!/usr/bin/env bash +# Boot an iOS simulator, install a built app bundle, and launch it. +# This script is intended for macOS GitHub Actions runners. +set -euo pipefail + +function usage() { + cat <<'USAGE' +Usage: run-ios-simulator.sh [--help] + +Environment variables: + APP_BUNDLE Path to the .app bundle to install (required). + BUNDLE_ID Bundle identifier used to launch the app (required). + SIM_DEVICE_NAME Simulator name to create/use. Default: iPhone 15 + SIM_RUNTIME Simulator runtime identifier. Default: iOS (auto-detect latest) + SIM_TIMEOUT Seconds to wait for boot and launch. Default: 180 + +The script will create the simulator if missing, boot it headlessly, +install APP_BUNDLE, and launch BUNDLE_ID while streaming device logs. +USAGE +} + +if [[ ${1:-} == "--help" || ${1:-} == "-h" ]]; then + usage + exit 0 +fi + +if [[ -z ${APP_BUNDLE:-} || -z ${BUNDLE_ID:-} ]]; then + echo "APP_BUNDLE and BUNDLE_ID must be set" >&2 + exit 1 +fi + +SIM_DEVICE_NAME=${SIM_DEVICE_NAME:-"iPhone 15"} +SIM_RUNTIME=${SIM_RUNTIME:-"iOS"} +SIM_TIMEOUT=${SIM_TIMEOUT:-180} + +function info() { + echo "[ios-sim] $*" >&2 +} + +function ensure_device() { + # Try to find the exact runtime first, or fallback to the latest available iOS runtime + # We extract the last column which is the runtime identifier + local runtime_id + runtime_id=$(xcrun simctl list runtimes | awk -v r="$SIM_RUNTIME" '/com.apple.CoreSimulator.SimRuntime/ && $0 ~ r {print $NF}' | sort | tail -n 1) + + if [[ -z $runtime_id && "$SIM_RUNTIME" == "iOS" ]]; then + runtime_id=$(xcrun simctl list runtimes | awk '/com.apple.CoreSimulator.SimRuntime.iOS/ {print $NF}' | sort | tail -n 1) + fi + + if [[ -z $runtime_id ]]; then + echo "Simulator runtime matching '$SIM_RUNTIME' not found" >&2 + echo "Available runtimes:" >&2 + xcrun simctl list runtimes >&2 + exit 1 + fi + + info "Selected runtime: $runtime_id" + + local existing + # Safely extract UDID using grep and delimiter-based awk to avoid regex issues with parenthesis + existing=$(xcrun simctl list devices "$runtime_id" | grep -F "$SIM_DEVICE_NAME (" | head -n 1 | awk -F '[()]' '{print $2}') + + if [[ -n $existing ]]; then + echo "$existing" + return + fi + + # Create device + local device_type="com.apple.CoreSimulator.SimDeviceType.iPhone-15" + local udid + udid=$(xcrun simctl create "$SIM_DEVICE_NAME" "$device_type" "$runtime_id") + echo "$udid" +} + +function boot_device() { + local udid=$1 + info "Booting simulator $SIM_DEVICE_NAME ($udid)" + xcrun simctl boot "$udid" >/dev/null 2>&1 || true + + # Wait for boot completion manually since --timeout might be unsupported on some versions + info "Waiting for boot status..." + local attempts=0 + local booted="false" + while [[ "$booted" == "false" ]]; do + local state + state=$(xcrun simctl list devices | grep "$udid" | grep "(Booted)" || true) + if [[ -n "$state" ]]; then + booted="true" + else + sleep 5 + ((attempts+=5)) + if (( attempts > SIM_TIMEOUT )); then + echo "Timeout waiting for simulator boot" >&2 + exit 1 + fi + fi + done + info "Simulator booted" +} + +function install_and_launch() { + local udid=$1 + + # Check if APP_BUNDLE exists + if [[ ! -e "$APP_BUNDLE" ]]; then + echo "Error: APP_BUNDLE not found at $APP_BUNDLE" >&2 + echo "Listing contents of target directory:" >&2 + # Assume APP_BUNDLE is something like BTDemo/target/ios-sim/BTDemo.app + # Try to list the parent directory to see what's there + local parent_dir + parent_dir=$(dirname "$APP_BUNDLE") + if [[ -d "$parent_dir" ]]; then + ls -F "$parent_dir" >&2 + elif [[ -d "$(dirname "$parent_dir")" ]]; then + echo "Parent $parent_dir not found, listing grandparent:" >&2 + ls -F "$(dirname "$parent_dir")" >&2 + else + echo "Grandparent directory not found either." >&2 + find . -maxdepth 4 -name "*.app" >&2 + fi + exit 1 + fi + + info "Installing $APP_BUNDLE" + xcrun simctl install "$udid" "$APP_BUNDLE" + info "Launching $BUNDLE_ID" + # Stream logs in the background to aid debugging + xcrun simctl spawn "$udid" log stream --style compact --predicate "processImagePath CONTAINS '$BUNDLE_ID'" >"/tmp/ios-sim-${udid}.log" 2>&1 & + xcrun simctl launch "$udid" "$BUNDLE_ID" + info "Recent simulator logs:" + tail -n 50 "/tmp/ios-sim-${udid}.log" || true +} + +udid=$(ensure_device) +boot_device "$udid" +install_and_launch "$udid" +info "Simulator run complete" diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 48a4d43..562b024 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -8,9 +8,8 @@ on: jobs: build: - runs-on: ubuntu-latest - + timeout-minutes: 15 steps: - uses: actions/checkout@v2 - name: Set up JDK 11 @@ -23,4 +22,134 @@ jobs: mkdir -p ~/.codenameone wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar - name: Build with Maven - run: mvn install + run: cd cn1-bluetooth && mvn install -DskipTests && cd .. + + android: + runs-on: ubuntu-22.04 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + - name: Set JAVA17_HOME + run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV + - name: Install Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + - name: Setup Codename One Build Client + run: | + mkdir -p ~/.codenameone + wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar + - name: Install Libraries (JDK 11) + run: cd cn1-bluetooth && mvn install -DskipTests && cd .. + - name: Enable KVM for Android emulator + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Install Framebuffer + run: sudo apt-get update && sudo apt-get install xvfb + - name: Build BTDemo Source (JDK 11) + env: + APP_DIR: BTDemo + run: | + cd BTDemo + xvfb-run -a ./mvnw install + xvfb-run -a ./mvnw cn1:build -e -Dcodename1.platform=android -Dcodename1.buildTarget=android-source + cd .. + - name: Compile APK (Gradle) + env: + JAVA_HOME: ${{ env.JAVA17_HOME }} + run: | + # Locate the Gradle project root + GRADLE_ROOT=$(find BTDemo/android/target -name "gradlew" -type f -exec dirname {} \; | head -n 1) + + if [[ -z "$GRADLE_ROOT" ]]; then + echo "Error: Gradle project not found in BTDemo/android/target" + echo "Listing directories recursively:" + ls -R . + exit 1 + fi + + echo "Found Gradle project at: $GRADLE_ROOT" + cd "$GRADLE_ROOT" + chmod +x gradlew + ./gradlew assembleDebug + + # Move artifact to a predictable location + mkdir -p ../../../../build/android + find . -name "*.apk" -exec cp {} ../../../../build/android/app-debug.apk \; + + - name: Run Android Emulator + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 31 + arch: x86_64 + target: google_apis + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: | + adb install -r build/android/app-debug.apk + adb shell am start -n com.codename1.btle/.BTDemoStub + adb logcat -d | tail -n 200 + + ios: + runs-on: macos-15 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + - name: Setup Codename One Build Client + run: | + mkdir -p ~/.codenameone + wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar + - name: Install Libraries (JDK 11) + run: cd cn1-bluetooth && mvn install -DskipTests && cd .. + - name: Build BTDemo Source (Maven) + env: + APP_DIR: BTDemo + BUILD_TARGET: ios-source + run: | + cd BTDemo + ./mvnw install + ./mvnw cn1:build -Dcodename1.platform=ios -Dcodename1.buildTarget=ios-source + cd .. + - name: Compile iOS App (Xcode) + run: | + # Find the generated Xcode project + XCODE_PROJ=$(find BTDemo/ios/target -name "*.xcodeproj" -type d | head -n 1) + + if [[ -z "$XCODE_PROJ" ]]; then + echo "Error: Xcode project not found in BTDemo/target" + echo "Listing BTDemo/ios/target recursively:" + ls -R BTDemo/ios/target + exit 1 + fi + + echo "Found Xcode project: $XCODE_PROJ" + + # Build the app for the simulator + xcodebuild -project "$XCODE_PROJ" \ + -scheme "BTDemo" \ + -configuration Debug \ + -sdk iphonesimulator \ + -destination "generic/platform=iOS Simulator" \ + CONFIGURATION_BUILD_DIR=build/ios-sim \ + clean build + + - name: Boot simulator, install, and launch + env: + APP_BUNDLE: build/ios-sim/BTDemo.app + BUNDLE_ID: com.codename1.btle + run: | + .github/scripts/run-ios-simulator.sh diff --git a/BTDemo/.mvn/jvm.config b/BTDemo/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java b/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..b901097 --- /dev/null +++ b/BTDemo/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/BTDemo/.mvn/wrapper/maven-wrapper.jar b/BTDemo/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/BTDemo/.mvn/wrapper/maven-wrapper.jar differ diff --git a/BTDemo/.mvn/wrapper/maven-wrapper.properties b/BTDemo/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/BTDemo/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/BTDemo/.vscode/extensions.json b/BTDemo/.vscode/extensions.json new file mode 100644 index 0000000..24d1c3c --- /dev/null +++ b/BTDemo/.vscode/extensions.json @@ -0,0 +1 @@ +{"recommendations": ["vscjava.vscode-java-pack"]} \ No newline at end of file diff --git a/BTDemo/.vscode/settings.json b/BTDemo/.vscode/settings.json new file mode 100644 index 0000000..a079bcd --- /dev/null +++ b/BTDemo/.vscode/settings.json @@ -0,0 +1,58 @@ +{"maven.terminal.favorites": [ + { + "alias": "Cloud > iOS Release Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=ios\" \"-Dcodename1.buildTarget=ios-device-release\" \"-U\" \"-e\"" + }, + { + "alias": "Tools > Codename One Settings", + "command": "\"cn1:settings\" \"-U\" \"-e\"" + }, + { + "alias": "Run in Simulator", + "command": "\"verify\" \"-Psimulator\" \"-DskipTests\" \"-Dcodename1.platform=javase\" \"-e\"" + }, + { + "alias": "Cloud > Mac Desktop Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=javase\" \"-Dcodename1.buildTarget=mac-os-x-desktop\" \"-U\" \"-e\"" + }, + { + "alias": "Cloud > Android Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=android\" \"-Dcodename1.buildTarget=android-device\" \"-U\" \"-e\"" + }, + { + "alias": "Tools > Update Codename One", + "command": "\"cn1:update\" \"-U\" \"-e\"" + }, + { + "alias": "Cloud > iOS Debug Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=ios\" \"-Dcodename1.buildTarget=ios-device\" \"-U\" \"-e\"" + }, + { + "alias": "Local > Xcode iOS Project", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=ios\" \"-Dcodename1.buildTarget=ios-source\" \"-U\" \"-e\"" + }, + { + "alias": "Cloud > Javascript Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=javascript\" \"-Dcodename1.buildTarget=javascript\" \"-U\" \"-e\"" + }, + { + "alias": "Cloud > Windows Desktop Build", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=javase\" \"-Dcodename1.buildTarget=windows-desktop\" \"-U\" \"-e\"" + }, + { + "alias": "Run as Desktop App", + "command": "\"verify\" \"-Prun-desktop\" \"-DskipTests\" \"-Dcodename1.platform=javase\" \"-e\"" + }, + { + "alias": "Cloud > Windows Device Build (UWP)", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=win\" \"-Dcodename1.buildTarget=windows-device\" \"-U\" \"-e\"" + }, + { + "alias": "Local > Gradle Android Project", + "command": "\"package\" \"-DskipTests\" \"-Dcodename1.platform=android\" \"-Dcodename1.buildTarget=android-source\" \"-U\" \"-e\"" + }, + { + "alias": "Local > Cross-platform (JavaSE) Desktop App", + "command": "\"-Pexecutable-jar\" \"package\" \"-Dcodename1.platform=javase\" \"-DskipTests\" \"-U\" \"-e\"" + } +]} \ No newline at end of file diff --git a/BTDemo/CodeNameOneBuildClient.jar b/BTDemo/CodeNameOneBuildClient.jar deleted file mode 100644 index 54b8e97..0000000 Binary files a/BTDemo/CodeNameOneBuildClient.jar and /dev/null differ diff --git a/BTDemo/JavaSE.jar b/BTDemo/JavaSE.jar deleted file mode 100644 index 257e003..0000000 Binary files a/BTDemo/JavaSE.jar and /dev/null differ diff --git a/BTDemo/README.adoc b/BTDemo/README.adoc new file mode 100644 index 0000000..3c48268 --- /dev/null +++ b/BTDemo/README.adoc @@ -0,0 +1,43 @@ += Codename One Project + +This is a multi-module maven project for building a Codename One application. Codename One applications written in Java and/or Kotlin, and are built as native apps and can be built and deployed to iOS, Android, Mac, Windows, Linux, and also to the Web. + +== Getting Started + +=== Java + +If you plan to use Java as your primary language, https://shannah.github.io/cn1-maven-archetypes/cn1app-archetype-tutorial/getting-started.html[start here]. + +=== Kotlin + +If you plan to use Kotlin as your primary language, https://shannah.github.io/cn1app-archetype-kotlin-template/getting-started.html[start here]. + + +== Eclipse Users + +IMPORTANT: If you use Eclipse as your IDE, **read this first** + +The _tools/eclipse_ directory contains eclipse ".launch" files that will add common Maven goals as menu items inside Eclipse. + +**After importing this project into Eclipse, you should import the launch files.** + +=== Additional Steps for CodeRAD projects + +CodeRAD includes an annotation processor that needs to be activated. There are a few additional steps required to enable this in Eclipse. + +. Add `org.eclipse.m2e.apt.mode=jdt_apt` to the `./common/.settings/org.eclipse.m2e.apt.prefs` +. Add `target/generated-sources/rad-views` to the .classpath. + +See https://github.com/codenameone/CodenameOne/issues/3724[this issue] for more details. + +== NetBeans Users + +This project is a multi-module Maven project that was generated from a Maven archetype. + +== IntelliJ Users + +The project should work in IntelliJ out of the box. No need to copy any files. + +== Help and Support + +See the https://www.codenameone.com[Codename One Web Site]. \ No newline at end of file diff --git a/BTDemo/Versions.properties b/BTDemo/Versions.properties deleted file mode 100644 index f4f76b2..0000000 --- a/BTDemo/Versions.properties +++ /dev/null @@ -1,7 +0,0 @@ -# -#Mon Jan 11 15:28:17 PST 2021 -CodeNameOneBuildClientJar=163 -CodenameOne_SRCzip=165 -CodenameOneJar=165 -JavaSEJar=165 -CLDC11Jar=163 diff --git a/BTDemo/android/pom.xml b/BTDemo/android/pom.xml new file mode 100644 index 0000000..ce784af --- /dev/null +++ b/BTDemo/android/pom.xml @@ -0,0 +1,134 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-android + 1.0-SNAPSHOT + + btdemo-android + + + UTF-8 + 1.8 + 1.8 + android + android + android-device + + + src/main/empty + + + + src/main/java + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-android + package + + build + + + + + + + + + + + com.codenameone + codenameone-core + provided + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + run-android + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/../common/codenameone_settings.properties + + + + + + + + maven-antrun-plugin + + + adb-install + verify + + run + + + + Running adb install + + + + + + + Trying to start app on device using adb + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/build.bat b/BTDemo/build.bat new file mode 100644 index 0000000..b7ccc0e --- /dev/null +++ b/BTDemo/build.bat @@ -0,0 +1,108 @@ +@echo off +setlocal EnableDelayedExpansion +setlocal EnableExtensions + + + +set MVNW=mvnw.cmd + +SET CMD=%1 +if "%CMD%"=="" ( + set CMD=jar +) +goto %CMD% + +goto :EOF +:mac_desktop +!MVNW! package -DskipTests -Dcodename1.platform^=javase -Dcodename1.buildTarget^=mac-os-x-desktop -U -e + +goto :EOF +:windows_desktop +!MVNW! package -DskipTests -Dcodename1.platform^=javase -Dcodename1.buildTarget^=windows-desktop -U -e + +goto :EOF +:windows_device +!MVNW! package -DskipTests -Dcodename1.platform^=win -Dcodename1.buildTarget^=windows-device -U -e + +goto :EOF +:uwp +set /a _0_%~2=^(1 + %~2^) +call :windows_device _1_%~2 !_0_%~2! +echo | set /p ^=!_1_%~2! + +goto :EOF +:javascript +!MVNW! package -DskipTests -Dcodename1.platform^=javascript -Dcodename1.buildTarget^=javascript -U -e + +goto :EOF +:android +!MVNW! package -DskipTests -Dcodename1.platform^=android -Dcodename1.buildTarget^=android-device -U -e + +goto :EOF +:xcode +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-source -U -e + +goto :EOF +:ios_source +set /a _0_%~2=^(1 + %~2^) +call :xcode _1_%~2 !_0_%~2! +echo | set /p ^=!_1_%~2! + +goto :EOF +:android_source +!MVNW! package -DskipTests -Dcodename1.platform^=android -Dcodename1.buildTarget^=android-source -U -e + +goto :EOF +:ios +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-device -U -e + +goto :EOF +:ios_release +!MVNW! package -DskipTests -Dcodename1.platform^=ios -Dcodename1.buildTarget^=ios-device-release -U -e + +goto :EOF +:jar +!MVNW! -Pexecutable-jar package -Dcodename1.platform^=javase -DskipTests -U -e + +goto :EOF +:help +echo build.sh [COMMAND] +echo Local Build Commands: +echo The following commands will build the app locally ^(i.e. does NOT use the Codename One build server^) +echo +echo jar +echo Builds app as desktop app executable jar file to javase/target directory +echo android_source +echo Generates an android gradle project that can be opened in Android studio +echo *Requires android development tools installed. +echo *Requires ANDROID_HOME environment variable +echo *Requires either GRADLE_HOME environment variable^, or for gradle to be in PATH +echo ios_source +echo Generates an Xcode Project that you can open and build using Apple^'s development tools +echo *Requires a Mac with Xcode installed +echo +echo Build Server Commands: +echo The following commands will build the app using the Codename One build server^, and require +echo a Codename One account. See https://www.codenameone.com +echo +echo ios +echo Builds iOS app. +echo ios_release +echo Builds iOS app for submission to Apple appstore. +echo android +echo Builds android app. +echo mac_desktop +echo Builds Mac OS desktop app. +echo *Mac OS Desktop builds are a Pro user feature. +echo windows_desktop +echo Builds Windows desktop app. +echo *Windows Desktop builds are a Pro user feature. +echo windows_device +echo Builds UWP Windows app. +echo javascript +echo Builds as a web app. +echo *Javascript builds are an Enterprise user feature + +goto :EOF +:settings +!MVNW! cn:settings -U -e diff --git a/BTDemo/build.sh b/BTDemo/build.sh new file mode 100755 index 0000000..8a99f56 --- /dev/null +++ b/BTDemo/build.sh @@ -0,0 +1,99 @@ +#!/bin/bash +set -e +MVNW="./mvnw" + +function mac_desktop { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javase" "-Dcodename1.buildTarget=mac-os-x-desktop" "-U" "-e" +} +function windows_desktop { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javase" "-Dcodename1.buildTarget=windows-desktop" "-U" "-e" +} +function windows_device { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=win" "-Dcodename1.buildTarget=windows-device" "-U" "-e" +} +function uwp { + + "windows_device" +} +function javascript { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=javascript" "-Dcodename1.buildTarget=javascript" "-U" "-e" +} +function android { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=android" "-Dcodename1.buildTarget=android-device" "-U" "-e" +} +function xcode { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-source" "-U" "-e" +} +function ios_source { + "xcode" +} +function android_source { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=android" "-Dcodename1.buildTarget=android-source" "-U" "-e" +} +function ios { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-device" "-U" "-e" +} +function ios_release { + + "$MVNW" "package" "-DskipTests" "-Dcodename1.platform=ios" "-Dcodename1.buildTarget=ios-device-release" "-U" "-e" +} +function jar { + + "$MVNW" "-Pexecutable-jar" "package" "-Dcodename1.platform=javase" "-DskipTests" "-U" "-e" +} +function help { + "echo" "-e" "build.sh [COMMAND]" + "echo" "-e" "Local Build Commands:" + "echo" "-e" " The following commands will build the app locally (i.e. does NOT use the Codename One build server)" + "echo" "-e" "" + "echo" "-e" " jar" + "echo" "-e" " Builds app as desktop app executable jar file to javase/target directory" + "echo" "-e" " android_source" + "echo" "-e" " Generates an android gradle project that can be opened in Android studio" + "echo" "-e" " *Requires android development tools installed." + "echo" "-e" " *Requires ANDROID_HOME environment variable" + "echo" "-e" " *Requires either GRADLE_HOME environment variable, or for gradle to be in PATH" + "echo" "-e" " ios_source" + "echo" "-e" " Generates an Xcode Project that you can open and build using Apple's development tools" + "echo" "-e" " *Requires a Mac with Xcode installed" + "echo" "-e" "" + "echo" "-e" "Build Server Commands:" + "echo" "-e" " The following commands will build the app using the Codename One build server, and require" + "echo" "-e" " a Codename One account. See https://www.codenameone.com" + "echo" "-e" "" + "echo" "-e" " ios" + "echo" "-e" " Builds iOS app." + "echo" "-e" " ios_release" + "echo" "-e" " Builds iOS app for submission to Apple appstore." + "echo" "-e" " android" + "echo" "-e" " Builds android app." + "echo" "-e" " mac_desktop" + "echo" "-e" " Builds Mac OS desktop app." + "echo" "-e" " *Mac OS Desktop builds are a Pro user feature." + "echo" "-e" " windows_desktop" + "echo" "-e" " Builds Windows desktop app." + "echo" "-e" " *Windows Desktop builds are a Pro user feature." + "echo" "-e" " windows_device" + "echo" "-e" " Builds UWP Windows app." + "echo" "-e" " javascript" + "echo" "-e" " Builds as a web app." + "echo" "-e" " *Javascript builds are an Enterprise user feature" +} +function settings { + + "$MVNW" "cn:settings" "-U" "-e" +} +CMD="$1" + +if [ "$CMD" == "" ]; then + CMD="jar" +fi +"$CMD" \ No newline at end of file diff --git a/BTDemo/build.xml b/BTDemo/build.xml deleted file mode 100644 index cdf2047..0000000 --- a/BTDemo/build.xml +++ /dev/null @@ -1,550 +0,0 @@ - - - - - - Builds, tests, and runs the project BTDemo. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller - code size and wider device support - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BTDemo/common/codenameone_settings.properties b/BTDemo/common/codenameone_settings.properties new file mode 100644 index 0000000..8270d4a --- /dev/null +++ b/BTDemo/common/codenameone_settings.properties @@ -0,0 +1,29 @@ +codename1.android.keystore= +codename1.android.keystoreAlias= +codename1.android.keystorePassword= +codename1.arg.ios.newStorageLocation=true +codename1.arg.java.version=8 +codename1.displayName=BTDemo +codename1.icon=icon.png +codename1.ios.appid=Q5GHSKAL2F.com.codename1.btle +codename1.ios.certificate= +codename1.ios.certificatePassword= +codename1.ios.debug.certificate= +codename1.ios.debug.certificatePassword= +codename1.ios.debug.provision= +codename1.ios.provision= +codename1.ios.release.certificate= +codename1.ios.release.certificatePassword= +codename1.ios.release.provision= +codename1.j2me.nativeTheme=nbproject/nativej2me.res +codename1.kotlin=false +codename1.languageLevel=5 +codename1.mainName=BTDemo +codename1.packageName=com.codename1.btle +codename1.rim.certificatePassword= +codename1.rim.signtoolCsk= +codename1.rim.signtoolDb= +codename1.secondaryTitle=Hello World +codename1.vendor=CodenameOne +codename1.version=1.0 +codename1.cssTheme=true diff --git a/BTDemo/common/icon.png b/BTDemo/common/icon.png new file mode 100644 index 0000000..1f4fa5d Binary files /dev/null and b/BTDemo/common/icon.png differ diff --git a/BTDemo/common/pom.xml b/BTDemo/common/pom.xml new file mode 100644 index 0000000..003c71e --- /dev/null +++ b/BTDemo/common/pom.xml @@ -0,0 +1,383 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-common + 1.0-SNAPSHOT + jar + + + + + com.codenameone + codenameone-core + provided + + + + com.codename1 + cn1-bluetooth-lib + 1.0-SNAPSHOT + pom + + + + + + + + + + + install-codenameone + ${user.home}/.codenameone/guibuilder.jar + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + validate + + run + + + + + + + + + + + + + + + + + + + + + + + + + kotlin + + + + ${basedir}/src/main/kotlin + + + + 1.3.72 + true + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + + org.jetbrains + annotations + 13.0 + + + com.codenameone + java-runtime + provided + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/codenameone_settings.properties + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + -no-reflect + -no-jdk + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + -no-reflect + -no-jdk + + + + + + + + + + + + + javase + + + codename1.platform + javase + + + + javase + + + + + org.codehaus.mojo + exec-maven-plugin + + java + true + + -Xmx1024M + + -classpath + + ${exec.mainClass} + ${cn1.mainClass} + + + + + + + + + + simulator + + javase + + + + + + ios-debug + + + iphone + + + ios + + + + + ios-release + + + iphone + true + + + ios + true + + + + + javascript + + javascript + javascript + + + + + android + + android + android + + + + + uwp + + windows + win + + + + + windows + + desktop_windows + javase + + + + + mac + + desktop_macosx + javase + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/codenameone_settings.properties + + + + + + + + com.codenameone + codenameone-maven-plugin + + + + generate-gui-sources + process-sources + + generate-gui-sources + + + + cn1-process-classes + process-classes + + compliance-check + css + + + + + attach-test-artifact + test + + attach-test-artifact + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + + + diff --git a/BTDemo/common/src/main/css/theme.css b/BTDemo/common/src/main/css/theme.css new file mode 100644 index 0000000..1b64520 --- /dev/null +++ b/BTDemo/common/src/main/css/theme.css @@ -0,0 +1,54 @@ +/** Define Theme Constants here */ +#Constants { + includeNativeBool: true; + defaultSourceDPIInt: "0"; +} + +/** Style for Button class */ +Button { + font-family: "native:MainLight"; + font-size: 3mm; +} + +/** Style for App Title Bar Text */ +Title { + font-family: "native:MainLight"; + font-size: 6mm; +} + +/** Style for Dialog body */ +DialogBody { + font-family: "native:MainLight"; + font-size: 2.8mm; +} + +/** Style for Dialog title bar text */ +DialogTitle { + font-family: "native:MainLight"; + font-size: 4.5mm; +} + +/** Style for the side menu */ +SideNavigationPanel { + background: white; + padding: 2mm 1mm 1mm 1mm; +} + +@media platform-ios { + /** iOS Only styles for side menu. */ + SideNavigationPanel { + /** Extra top padding to deal with notch on iPhoneX */ + padding: 6mm 1mm 1mm 1mm; + } +} + +/** Style for commands in side menu. */ +SideCommand { + padding: 1mm; + border: none; + text-decoration: none; + color: black; + font-family: "native:MainLight"; + font-size: 4mm; + border-bottom: 2px solid #cccccc; +} diff --git a/BTDemo/src/main/java/com/codename1/btle/BTDemo.java b/BTDemo/common/src/main/java/com/codename1/btle/BTDemo.java similarity index 100% rename from BTDemo/src/main/java/com/codename1/btle/BTDemo.java rename to BTDemo/common/src/main/java/com/codename1/btle/BTDemo.java diff --git a/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java b/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java new file mode 100644 index 0000000..9ac5f12 --- /dev/null +++ b/BTDemo/common/src/test/java/com/codename1/btle/MyFirstTest.java @@ -0,0 +1,23 @@ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.codename1.btle; + +import com.codename1.testing.AbstractTest; + +/** + * + * @author shannah + */ +public class MyFirstTest extends AbstractTest { + + @Override + public boolean runTest() throws Exception { + return true; + } + + +} diff --git a/BTDemo/dist/BTDemo.jar b/BTDemo/dist/BTDemo.jar deleted file mode 100644 index 11b38cb..0000000 Binary files a/BTDemo/dist/BTDemo.jar and /dev/null differ diff --git a/BTDemo/dist/README.TXT b/BTDemo/dist/README.TXT deleted file mode 100644 index a7a14d3..0000000 --- a/BTDemo/dist/README.TXT +++ /dev/null @@ -1,32 +0,0 @@ -======================== -BUILD OUTPUT DESCRIPTION -======================== - -When you build an Java application project that has a main class, the IDE -automatically copies all of the JAR -files on the projects classpath to your projects dist/lib folder. The IDE -also adds each of the JAR files to the Class-Path element in the application -JAR files manifest file (MANIFEST.MF). - -To run the project from the command line, go to the dist folder and -type the following: - -java -jar "BTDemo.jar" - -To distribute this project, zip up the dist folder (including the lib folder) -and distribute the ZIP file. - -Notes: - -* If two JAR files on the project classpath have the same name, only the first -JAR file is copied to the lib folder. -* Only JAR files are copied to the lib folder. -If the classpath contains other types of files or folders, these files (folders) -are not copied. -* If a library on the projects classpath also has a Class-Path element -specified in the manifest,the content of the Class-Path element has to be on -the projects runtime path. -* To set a main class in a standard Java project, right-click the project node -in the Projects window and choose Properties. Then click Run and enter the -class name in the Main Class field. Alternatively, you can manually type the -class name in the manifest Main-Class element. diff --git a/BTDemo/dist/lib/CLDC11.jar b/BTDemo/dist/lib/CLDC11.jar deleted file mode 100644 index e7cdab1..0000000 Binary files a/BTDemo/dist/lib/CLDC11.jar and /dev/null differ diff --git a/BTDemo/dist/lib/CodenameOne.jar b/BTDemo/dist/lib/CodenameOne.jar deleted file mode 100644 index 43a9f4a..0000000 Binary files a/BTDemo/dist/lib/CodenameOne.jar and /dev/null differ diff --git a/BTDemo/dist/lib/CodenameOne_SRC.zip b/BTDemo/dist/lib/CodenameOne_SRC.zip deleted file mode 100644 index 0e964f7..0000000 Binary files a/BTDemo/dist/lib/CodenameOne_SRC.zip and /dev/null differ diff --git a/BTDemo/dist/lib/JavaSE.jar b/BTDemo/dist/lib/JavaSE.jar deleted file mode 100644 index 261c47e..0000000 Binary files a/BTDemo/dist/lib/JavaSE.jar and /dev/null differ diff --git a/BTDemo/icon.png b/BTDemo/icon.png deleted file mode 100644 index d056eed..0000000 Binary files a/BTDemo/icon.png and /dev/null differ diff --git a/BTDemo/ios/pom.xml b/BTDemo/ios/pom.xml new file mode 100644 index 0000000..74459fa --- /dev/null +++ b/BTDemo/ios/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-ios + 1.0-SNAPSHOT + + btdemo-ios + + + UTF-8 + 1.8 + 1.8 + ios + ios + ios-device + + + + + src/main/objectivec + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-ios + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/BTDemo/javascript/pom.xml b/BTDemo/javascript/pom.xml new file mode 100644 index 0000000..b455c36 --- /dev/null +++ b/BTDemo/javascript/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-javascript + 1.0-SNAPSHOT + + btdemo-javascript + + + UTF-8 + 1.8 + 1.8 + javascript + javascript + javascript + + + + + src/main/javascript + + + src/main/resources + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-javascript + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/BTDemo/javase/pom.xml b/BTDemo/javase/pom.xml new file mode 100644 index 0000000..eefc818 --- /dev/null +++ b/BTDemo/javase/pom.xml @@ -0,0 +1,788 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-javase + 1.0-SNAPSHOT + + btdemo-javase + + + UTF-8 + 1.8 + 1.8 + javase + javase + + + ${project.basedir}/../common/src/test/java + + + codenameone-maven-plugin + com.codenameone + ${cn1.plugin.version} + + + add-se-sources + + generate-javase-sources + + generate-sources + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + com.codenameone + codenameone-core + test + + + com.codenameone + codenameone-core + provided + + + com.codenameone + codenameone-javase + test + + + com.codenameone + codenameone-javase + provided + + + + + + + + executable-jar + + javase + com.codename1.btle.BTDemoStub + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + src/main/resources + src/desktop/resources + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + ${basedir}/../common/codenameone_settings.properties + + + + + + + com.codenameone + codenameone-maven-plugin + + + generate-icons + generate-sources + + generate-desktop-app-wrapper + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ + + ${codename1.packageName}.${codename1.mainName}Stub + + + + + + + maven-antrun-plugin + + + generate-javase-zip + package + + + + + + + + + + + + + + + + + run + + + + + + + + + + + run-desktop + + javase + com.codename1.btle.BTDemoStub + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + src/main/resources + src/desktop/resources + + + + com.codenameone + codenameone-maven-plugin + + + generate-icons + generate-sources + + generate-desktop-app-wrapper + + + + + + org.codehaus.mojo + exec-maven-plugin + + + run-desktop + verify + + java + + + + + + + + + + desktop_build + + + codename1.buildTarget + + + + + com.codenameone + codenameone-core + provided + + + com.codenameone + codenameone-javase + provided + + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-desktop-macosx + package + + build + + + + + + + + + + + test + + + true + + + + javase + com.codename1.impl.javase.Simulator + + + + com.codenameone + codenameone-core + compile + + + + com.codenameone + codenameone-javase + compile + + + + + + com.codenameone + codenameone-maven-plugin + + + + + cn1-tests + test + + test + + + + + + + + + + + + debug-simulator + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + + -Xdebug + -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} + -Xmx1024M + -Xmx1024M + + + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + + debug-eclipse + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + + -Xdebug + -Xrunjdwp:transport=dt_socket,server=y,address=${jpda.address},suspend=y + -Xmx1024M + -Xmx1024M + + + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + simulator + + javase + com.codename1.impl.javase.Simulator + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${basedir}/../common + + java + true + + -Xmx1024M + + + -Dcef.dir=${cef.dir} + + + -Dcodename1.designer.jar=${codename1.designer.jar} + + + -Dcodename1.css.compiler.args.input=${codename1.css.compiler.args.input} + + + -Dcodename1.css.compiler.args.output=${codename1.css.compiler.args.output} + + + -Dcodename1.css.compiler.args.merge=${codename1.css.compiler.args.merge} + ${codename1.exec.args.debug} + ${codename1.exec.args.runjdwp.transport} + -classpath + + ${exec.mainClass} + ${codename1.mainClass} + + + + + run-in-simulator + verify + + exec + + + + + + + + + + idea-simulator + + javase + com.codename1.impl.javase.Simulator + true + + + + com.codenameone + codenameone-core + compile + + + com.codenameone + codenameone-javase + compile + + + + + + + com.codenameone + codenameone-maven-plugin + + + prepare-simulator-environment + initialize + + + prepare-simulator-classpath + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + + ${basedir}/../common + + true + + ${codename1.mainClass} + + + + + + cef.dir + ${cef.dir} + + + + codename1.designer.jar + ${codename1.designer.jar} + + + + codename1.css.compiler.args.input + ${codename1.css.compiler.args.input} + + + + codename1.css.compiler.args.output + ${codename1.css.compiler.args.output} + + + + codename1.css.compiler.args.merge + ${codename1.css.compiler.args.merge} + + + + + cn1.class.path + ${cn1.class.path} + + + + + + + + run-in-simulator-idea + verify + + java + + + + + + + + + + + + diff --git a/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java b/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java new file mode 100644 index 0000000..132562b --- /dev/null +++ b/BTDemo/javase/src/desktop/java/com/codename1/btle/BTDemoStub.java @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Codename One designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Codename One through http://www.codenameone.com/ if you + * need additional information or have any questions. + */ + +package com.codename1.btle; + +import com.codename1.impl.javase.JavaSEPort; +import com.codename1.ui.Display; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.File; +import java.util.Arrays; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/** + * A wrapper class around a Codename One app, allows building desktop Java + * applications. + * + * @author Shai Almog + */ +public class BTDemoStub implements Runnable, WindowListener { + private static final String APP_TITLE = "Hi World"; + private static final String APP_NAME = "BTDemo"; + private static final String APP_VERSION = "1.0"; + private static final int APP_WIDTH = 800; + private static final int APP_HEIGHT = 600; + private static final boolean APP_ADAPT_TO_RETINA = true; + private static final boolean APP_RESIZEABLE = true; + private static final boolean APP_FULLSCREEN = false; + public static final String BUILD_KEY = ""; + public static final String PACKAGE_NAME = ""; + public static final String BUILT_BY_USER = ""; + private static final boolean isWindows; + static { + isWindows = File.separatorChar == '\\'; + } + + private static final String[] fontFaces = null; + + private static JFrame frm; + private BTDemo mainApp; + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + try { + Class.forName("org.cef.CefApp"); + System.setProperty("cn1.javase.implementation", "cef"); + //System.setProperty("cn1.cef.bundled", "true"); + } catch (Throwable ex){} + + JavaSEPort.setNativeTheme("/NativeTheme.res"); + JavaSEPort.blockMonitors(); + JavaSEPort.setAppHomeDir("." + APP_NAME); + JavaSEPort.setExposeFilesystem(true); + JavaSEPort.setTablet(true); + JavaSEPort.setUseNativeInput(true); + JavaSEPort.setShowEDTViolationStacks(false); + JavaSEPort.setShowEDTWarnings(false); + JavaSEPort.setFullScreen(APP_FULLSCREEN); + + if(fontFaces != null) { + JavaSEPort.setFontFaces(fontFaces[0], fontFaces[1], fontFaces[2]); + } else { + // workaround for a bug in Windows where Arials unicode version isn't used + if(isWindows) { + JavaSEPort.setFontFaces("ArialUnicodeMS", "SansSerif", "Monospaced"); + } else { + JavaSEPort.setFontFaces("Arial", "SansSerif", "Monospaced"); + } + } + + + frm = new JFrame(APP_TITLE); + Toolkit tk = Toolkit.getDefaultToolkit(); + JavaSEPort.setDefaultPixelMilliRatio(tk.getScreenResolution() / 25.4 * JavaSEPort.getRetinaScale()); + Display.init(frm.getContentPane()); + Display.getInstance().setProperty("build_key", BUILD_KEY); + Display.getInstance().setProperty("package_name", PACKAGE_NAME); + Display.getInstance().setProperty("built_by_user", BUILT_BY_USER); + //placeholder + Display.getInstance().setProperty("AppName", APP_NAME); + Display.getInstance().setProperty("AppVersion", APP_VERSION); + Display.getInstance().setProperty("Platform", System.getProperty("os.name")); + Display.getInstance().setProperty("OSVer", System.getProperty("os.version")); + + SwingUtilities.invokeLater(new BTDemoStub()); + } + + public void run() { + frm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + frm.addWindowListener(this); + ImageIcon ic16 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic20 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic32 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic40 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + ImageIcon ic64 = new ImageIcon(getClass().getResource("/applicationIconImage_16x16.png")); + frm.setIconImages(Arrays.asList(ic16.getImage(), ic20.getImage(), ic32.getImage(), ic40.getImage(), ic64.getImage())); + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + if(APP_FULLSCREEN && gd.isFullScreenSupported()) { + frm.setResizable(false); + frm.setUndecorated(true); + gd.setFullScreenWindow(frm); + + } else { + frm.setLocationByPlatform(true); + frm.setResizable(APP_RESIZEABLE); + int w = APP_WIDTH; + int h = APP_HEIGHT; + + frm.getContentPane().setPreferredSize(new java.awt.Dimension(w, h)); + frm.getContentPane().setMinimumSize(new java.awt.Dimension(w, h)); + frm.getContentPane().setMaximumSize(new java.awt.Dimension(w, h)); + + // replaceable with the build hint desktop.framePrepare + framePrepare(frm); + } + Display.getInstance().callSerially(new Runnable() { + @Override + public void run() { + if(Display.getInstance().isEdt()) { + mainApp = new BTDemo(); + mainApp.init(this); + mainApp.start(); + SwingUtilities.invokeLater(this); + } else { + + // replaceable with the build hint desktop.frameShow + frameShow(frm); + } + } + }); + } + + private void framePrepare(JFrame frm) { + frm.pack(); + } + + private void frameShow(JFrame frm) { + frm.setVisible(true); + } + + @Override + public void windowOpened(WindowEvent e) { + } + + @Override + public void windowClosing(WindowEvent e) { + Display.getInstance().callSerially(new Runnable() { + @Override + public void run() { + mainApp.stop(); + mainApp.destroy(); + Display.getInstance().exitApplication(); + } + }); + } + + @Override + public void windowClosed(WindowEvent e) { + } + + @Override + public void windowIconified(WindowEvent e) { + } + + @Override + public void windowDeiconified(WindowEvent e) { + } + + @Override + public void windowActivated(WindowEvent e) { + } + + @Override + public void windowDeactivated(WindowEvent e) { + // fix for https://stackoverflow.com/questions/6178132/fullscreen-java-app-minimizes-when-screensaver-turns-on + if(APP_FULLSCREEN) { + GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + frm.setExtendedState(JFrame.MAXIMIZED_BOTH); + if(gd.isFullScreenSupported()) { + frm.setResizable(false); + frm.setUndecorated(true); + gd.setFullScreenWindow(frm); + } + } + } +} diff --git a/BTDemo/javase/src/desktop/resources/NativeTheme.res b/BTDemo/javase/src/desktop/resources/NativeTheme.res new file mode 100644 index 0000000..83e067b Binary files /dev/null and b/BTDemo/javase/src/desktop/resources/NativeTheme.res differ diff --git a/BTDemo/lib/CLDC11.jar b/BTDemo/lib/CLDC11.jar deleted file mode 100644 index 0a251c9..0000000 Binary files a/BTDemo/lib/CLDC11.jar and /dev/null differ diff --git a/BTDemo/lib/CN1Bluethooth.cn1lib b/BTDemo/lib/CN1Bluethooth.cn1lib deleted file mode 100644 index d7314b3..0000000 Binary files a/BTDemo/lib/CN1Bluethooth.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CN1Bluetooth.cn1lib b/BTDemo/lib/CN1Bluetooth.cn1lib deleted file mode 100644 index f4c7378..0000000 Binary files a/BTDemo/lib/CN1Bluetooth.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CN1JSON.cn1lib b/BTDemo/lib/CN1JSON.cn1lib deleted file mode 100644 index f161413..0000000 Binary files a/BTDemo/lib/CN1JSON.cn1lib and /dev/null differ diff --git a/BTDemo/lib/CodenameOne.jar b/BTDemo/lib/CodenameOne.jar deleted file mode 100644 index 978dfb0..0000000 Binary files a/BTDemo/lib/CodenameOne.jar and /dev/null differ diff --git a/BTDemo/lib/CodenameOne_SRC.zip b/BTDemo/lib/CodenameOne_SRC.zip deleted file mode 100644 index feb2ba8..0000000 Binary files a/BTDemo/lib/CodenameOne_SRC.zip and /dev/null differ diff --git a/BTDemo/manifest.mf b/BTDemo/manifest.mf deleted file mode 100644 index 328e8e5..0000000 --- a/BTDemo/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/BTDemo/mvnw b/BTDemo/mvnw new file mode 100755 index 0000000..41c0f0c --- /dev/null +++ b/BTDemo/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/BTDemo/mvnw.cmd b/BTDemo/mvnw.cmd new file mode 100644 index 0000000..8611571 --- /dev/null +++ b/BTDemo/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/BTDemo/nbproject/build-impl.xml b/BTDemo/nbproject/build-impl.xml deleted file mode 100644 index 6e45f03..0000000 --- a/BTDemo/nbproject/build-impl.xml +++ /dev/null @@ -1,1413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BTDemo/nbproject/genfiles.properties b/BTDemo/nbproject/genfiles.properties deleted file mode 100644 index c64d878..0000000 --- a/BTDemo/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=65812561 -build.xml.script.CRC32=c17a4175 -build.xml.stylesheet.CRC32=28e38971@1.44.1.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=65812561 -nbproject/build-impl.xml.script.CRC32=3705395b -nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.1.48 diff --git a/BTDemo/nbproject/nativej2me.res b/BTDemo/nbproject/nativej2me.res deleted file mode 100644 index 6b33caf..0000000 Binary files a/BTDemo/nbproject/nativej2me.res and /dev/null differ diff --git a/BTDemo/nbproject/project.properties b/BTDemo/nbproject/project.properties deleted file mode 100644 index 124dc8b..0000000 --- a/BTDemo/nbproject/project.properties +++ /dev/null @@ -1,102 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=BTDemo -application.vendor=Codename One -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.modulepath=\ - ${run.modulepath} -debug.test.classpath=\ - ${run.test.classpath} -debug.test.modulepath=\ - ${run.test.modulepath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/BTDemo.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.native-internal_tmp=native/internal_tmp -file.reference.CLDC11.jar=lib/CLDC11.jar -file.reference.CodenameOne.jar=lib/CodenameOne.jar -file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip -file.reference.BTDemo-override=override -file.reference.impl-cls=lib/impl/cls -file.reference.impl-stubs=lib/impl/stubs -file.reference.JavaSE.jar=JavaSE.jar -includes=** -jar.compress=true -javac.classpath=\ - ${file.reference.CLDC11.jar}:\ - ${file.reference.CodenameOne.jar}:\ - ${file.reference.CodenameOne_SRC.zip}:\ - ${file.reference.BTDemo-override}:\ - ${file.reference.impl-cls}:\ - ${file.reference.impl-stubs} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.modulepath= -javac.processormodulepath= -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.modulepath=\ - ${javac.modulepath} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=com.codename1.impl.javase.Simulator -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${file.reference.JavaSE.jar}:\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${file.reference.native-internal_tmp} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.modulepath=\ - ${javac.modulepath} -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -run.test.modulepath=\ - ${javac.test.modulepath} -source.encoding=windows-1252 -src.dir=src -test.src.dir=test diff --git a/BTDemo/nbproject/project.xml b/BTDemo/nbproject/project.xml deleted file mode 100644 index 4d2f86c..0000000 --- a/BTDemo/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - BTDemo - - - - - - - - - diff --git a/BTDemo/pom.xml b/BTDemo/pom.xml index 95ace51..7576058 100644 --- a/BTDemo/pom.xml +++ b/BTDemo/pom.xml @@ -1,63 +1,185 @@ - - - 4.0.0 - - com.codename1 - cn1-bluetooth - 1.0-SNAPSHOT - - com.codename1.btle - BTDemo - 1.0-SNAPSHOT - jar - - BTDemo - + + 4.0.0 + com.codename1.btle + btdemo + 1.0-SNAPSHOT + pom + btdemo + btdemo + https://www.codenameone.com + + + GPL v2 With Classpath Exception + https://openjdk.java.net/legal/gplv2+ce.html + repo + A business-friendly OSS license + + + +common + + + 7.0.215 + LATEST + UTF-8 + 1.8 + 11 + 1.7.11 + 3.8.0 + 1.8 + 1.8 + 1.8 + btdemo + + - - com.codenameone - codenameone-core - ${cn1.version} - - - com.codenameone - codenameone-javase - ${cn1.version} - - - com.codename1 - cn1-bluetooth-lib - ${project.version} - pom - + + com.codenameone + java-runtime + ${cn1.version} + + + com.codenameone + codenameone-core + ${cn1.version} + + + com.codenameone + codenameone-javase + ${cn1.version} + + + com.codenameone + codenameone-buildclient + ${cn1.version} + system + ${user.home}/.codenameone/CodeNameOneBuildClient.jar + - - - - - com.codenameone - codenameone-maven-plugin - ${cn1.plugin.version} - - com.codename1.btle.BTDemo - - - - - build - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - - + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + maven-antrun-plugin + org.apache.maven.plugins + 3.1.0 + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + + + + + + + + javascript + + + codename1.platform + javascript + + + + javascript + + + + ios + + + codename1.platform + ios + + + + ios + + + + win + + + codename1.platform + win + + + + win + + + + android + + + codename1.platform + android + + + + android + + + + javase + + + codename1.platform + javase + + true + + + javase + + + + cn1libs + + + ${basedir}/cn1libs/pom.xml + + + + cn1libs + + + diff --git a/BTDemo/run.bat b/BTDemo/run.bat new file mode 100644 index 0000000..f8b979c --- /dev/null +++ b/BTDemo/run.bat @@ -0,0 +1,40 @@ +@echo off +setlocal EnableDelayedExpansion +setlocal EnableExtensions + + +set MVNW=mvnw.cmd + +SET CMD=%1 +if "%CMD%"=="" ( + set CMD=simulator +) +goto %CMD% + +:simulator +!MVNW! verify -Psimulator -DskipTests -Dcodename1.platform^=javase -e + +goto :EOF +:desktop +!MVNW! verify -Prun-desktop -DskipTests -Dcodename1.platform^=javase -e + +goto :EOF +:settings +!MVNW! cn1:settings -e + +goto :EOF +:update +!MVNW! cn1:update -U -e + +goto :EOF +:help +echo run.bat [COMMAND] +echo Commands: +echo simulator +echo Runs app using Codename One Simulator +echo desktop +echo Runs app as a desktop app. +echo settings +echo Opens Codename One settings +echo update +echo Update Codename One libraries diff --git a/BTDemo/run.sh b/BTDemo/run.sh new file mode 100755 index 0000000..ef0a12c --- /dev/null +++ b/BTDemo/run.sh @@ -0,0 +1,37 @@ +#!/bin/bash +MVNW="./mvnw" + +function simulator { + + "$MVNW" "verify" "-Psimulator" "-DskipTests" "-Dcodename1.platform=javase" "-e" +} +function desktop { + + "$MVNW" "verify" "-Prun-desktop" "-DskipTests" "-Dcodename1.platform=javase" "-e" +} +function settings { + + "$MVNW" "cn1:settings" "-e" +} +function update { + + "$MVNW" "cn1:update" "-U" "-e" +} +function help { + "echo" "-e" "run.sh [COMMAND]" + "echo" "-e" "Commands:" + "echo" "-e" " simulator" + "echo" "-e" " Runs app using Codename One Simulator" + "echo" "-e" " desktop" + "echo" "-e" " Runs app as a desktop app." + "echo" "-e" " settings" + "echo" "-e" " Opens Codename One settings" + "echo" "-e" " update" + "echo" "-e" " Update Codename One libraries" +} +CMD=$1 + +if [ "$CMD" == "" ]; then + CMD="simulator" +fi +"$CMD" \ No newline at end of file diff --git a/BTDemo/src/main/resources/codenameone_settings.properties b/BTDemo/src/main/resources/codenameone_settings.properties deleted file mode 100644 index 3492965..0000000 --- a/BTDemo/src/main/resources/codenameone_settings.properties +++ /dev/null @@ -1,51 +0,0 @@ -# -#Wed Aug 05 08:50:57 PDT 2020 -codename1.ios.appid=Q5GHSKAL2F.com.codename1.btle -codename1.ios.release.provision= -codename1.arg.java.version=8 -codename1.arg.rim.obfuscation=false -codename1.arg.ios.newStorageLocation=true -codename1.j2me.nativeTheme=nbproject/nativej2me.res -codename1.arg.ios.project_type=ios -foobarfoo=This is a description of what we are going to do -codename1.arg.ios.interface_orientation=UIInterfaceOrientationPortrait\:UIInterfaceOrientationPortraitUpsideDown\:UIInterfaceOrientationLandscapeLeft\:UIInterfaceOrientationLandscapeRight -codename1.displayName=BTDemo -codename1.arg.ios.pods.platform=,11.0 -codename1.android.keystoreAlias= -codename1.ios.release.certificate= -codename1.arg.ios.background_modes=,bluetooth-central,bluetooth-peripheral -codename1.android.keystorePassword= -codename1.ios.provision= -codename1.arg.ios.add_libs=;CoreBluetooth.framework; -codename1.arg.ios.dsym=false -codename1.arg.android.release=true -codename1.arg.ios.statusbar_hidden=false -codename1.languageLevel=5 -codename1.android.keystore= -codename1.arg.ios.pods=,Cordova,Cordova ~> 6.1 -codename1.vendor=CodenameOne -codename1.arg.win.ver=8 -codename1.ios.certificatePassword= -codename1.ios.debug.certificatePassword= -codename1.mainName=BTDemo -codename1.ios.release.certificatePassword= -codename1.arg.ios.prerendered_icon=false -codename1.ios.debug.certificate= -libVersion=111 -codename1.arg.android.xpermissions= -codename1.arg.ios.application_exits=false -codename1.secondaryTitle=CodenameOne_Template -codename1.description= -codename1.ios.debug.provision= -codename1.arg.j2me.nativeThemeConst=0 -codename1.rim.certificatePassword= -codename1.version=1.0 -codename1.ios.certificate= -codename1.icon=icon.png -codename1.rim.signtoolCsk= -codename1.arg.ios.plistInject=NSBluetoothPeripheralUsageDescription${foobarfoo} -codename1.arg.android.debug=false -codename1.rim.signtoolDb= -codename1.arg.ios.testFlight=false -codename1.arg.ios.includePush=false -codename1.packageName=com.codename1.btle diff --git a/BTDemo/src/main/resources/theme.res b/BTDemo/src/main/resources/theme.res deleted file mode 100644 index 591a33a..0000000 Binary files a/BTDemo/src/main/resources/theme.res and /dev/null differ diff --git a/BTDemo/tools/eclipse/BTDemo - Build Android Studio Project.launch b/BTDemo/tools/eclipse/BTDemo - Build Android Studio Project.launch new file mode 100644 index 0000000..f3920cb --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Build Android Studio Project.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Build JavaSE Desktop App.launch b/BTDemo/tools/eclipse/BTDemo - Build JavaSE Desktop App.launch new file mode 100644 index 0000000..eab04af --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Build JavaSE Desktop App.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Build iOS Xcode Project.launch b/BTDemo/tools/eclipse/BTDemo - Build iOS Xcode Project.launch new file mode 100644 index 0000000..5c8067e --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Build iOS Xcode Project.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Debug Simulator.launch b/BTDemo/tools/eclipse/BTDemo - Debug Simulator.launch new file mode 100644 index 0000000..a4a933d --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Debug Simulator.launch @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Debug in Simulator.launch b/BTDemo/tools/eclipse/BTDemo - Debug in Simulator.launch new file mode 100644 index 0000000..55686ad --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Debug in Simulator.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Remote Debug Simulator.launch b/BTDemo/tools/eclipse/BTDemo - Remote Debug Simulator.launch new file mode 100644 index 0000000..adb8319 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Remote Debug Simulator.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Run Desktop.launch b/BTDemo/tools/eclipse/BTDemo - Run Desktop.launch new file mode 100644 index 0000000..37f57c8 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Run Desktop.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Run Simulator.launch b/BTDemo/tools/eclipse/BTDemo - Run Simulator.launch new file mode 100644 index 0000000..1d0cf66 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Run Simulator.launch @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send Android Build.launch b/BTDemo/tools/eclipse/BTDemo - Send Android Build.launch new file mode 100644 index 0000000..808cbd1 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send Android Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send Javascript Build.launch b/BTDemo/tools/eclipse/BTDemo - Send Javascript Build.launch new file mode 100644 index 0000000..e6c1e9f --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send Javascript Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send Mac Desktop Build.launch b/BTDemo/tools/eclipse/BTDemo - Send Mac Desktop Build.launch new file mode 100644 index 0000000..2180adc --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send Mac Desktop Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send Windows Desktop Build.launch b/BTDemo/tools/eclipse/BTDemo - Send Windows Desktop Build.launch new file mode 100644 index 0000000..215df5b --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send Windows Desktop Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send Windows UWP Build.launch b/BTDemo/tools/eclipse/BTDemo - Send Windows UWP Build.launch new file mode 100644 index 0000000..14b9475 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send Windows UWP Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send iOS Debug Build.launch b/BTDemo/tools/eclipse/BTDemo - Send iOS Debug Build.launch new file mode 100644 index 0000000..4b8b0f2 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send iOS Debug Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Send iOS Release Build.launch b/BTDemo/tools/eclipse/BTDemo - Send iOS Release Build.launch new file mode 100644 index 0000000..a2530dd --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Send iOS Release Build.launch @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo - Update Codename One.launch b/BTDemo/tools/eclipse/BTDemo - Update Codename One.launch new file mode 100644 index 0000000..cd57b37 --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo - Update Codename One.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/eclipse/BTDemo Settings.launch b/BTDemo/tools/eclipse/BTDemo Settings.launch new file mode 100644 index 0000000..a8902be --- /dev/null +++ b/BTDemo/tools/eclipse/BTDemo Settings.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BTDemo/tools/netbeans/nb-configuration.xml b/BTDemo/tools/netbeans/nb-configuration.xml new file mode 100644 index 0000000..cddcc7d --- /dev/null +++ b/BTDemo/tools/netbeans/nb-configuration.xml @@ -0,0 +1,55 @@ + + + + + + + android-device + android + + + android-source + android + + + javase + + + javascript + javascript + + + mac-os-x-desktop + javase + + + javase + + + windows-desktop + javase + + + windows-device + win + + + ios-device + ios + + + ios-device-release + ios + + + ios-source + ios + + + + diff --git a/BTDemo/tools/netbeans/nbactions-Desktop App.xml b/BTDemo/tools/netbeans/nbactions-Desktop App.xml new file mode 100644 index 0000000..53068a1 --- /dev/null +++ b/BTDemo/tools/netbeans/nbactions-Desktop App.xml @@ -0,0 +1,12 @@ + + + + run + + verify + + + true + + + diff --git a/BTDemo/tools/netbeans/nbactions-JavaSE Desktop App.xml b/BTDemo/tools/netbeans/nbactions-JavaSE Desktop App.xml new file mode 100644 index 0000000..f1c86c5 --- /dev/null +++ b/BTDemo/tools/netbeans/nbactions-JavaSE Desktop App.xml @@ -0,0 +1,112 @@ + + + + run + + verify + + + true + + + run-desktop + + + + build + + * + + + package + + + true + + + executable-jar + + + + rebuild + + * + + + clean + package + + + true + + + executable-jar + + + + test + + * + + + test + + + simulator + + + + + clean + + * + + + clean + + + executable-jar + + + + build-with-dependencies + also-make + + * + + + package + + + executable-jar + + + + CUSTOM-Generate iOS Xcode Project + Generate iOS Xcode Project + + package + + + ios + ios-source + true + + + !run-desktop + + + + debug + + verify + + + true + true + + + debug-simulator + + + diff --git a/BTDemo/tools/netbeans/nbactions-Simulator.xml b/BTDemo/tools/netbeans/nbactions-Simulator.xml new file mode 100644 index 0000000..b970763 --- /dev/null +++ b/BTDemo/tools/netbeans/nbactions-Simulator.xml @@ -0,0 +1,90 @@ + + + + run + + verify + + + true + + + simulator + + + + debug + + verify + + + + javase + true + true + + + debug-simulator + !simulator + + + + build + + * + + + package + + + true + + + executable-jar + !simulator + + + + rebuild + + * + + + clean + package + + + true + + + executable-jar + !simulator + + + + build-with-dependencies + also-make + + * + + + package + + + true + + + executable-jar + !simulator + + + + test + + * + + + test + + + diff --git a/BTDemo/tools/netbeans/nbactions.xml b/BTDemo/tools/netbeans/nbactions.xml new file mode 100644 index 0000000..eab8d61 --- /dev/null +++ b/BTDemo/tools/netbeans/nbactions.xml @@ -0,0 +1,149 @@ + + + + run + + verify + + + true + javase + + + simulator + + + + debug + + verify + + + true + javase + true + + + + + + + + + + + debug-simulator + + + + CUSTOM-Open Control Center + Open Control Center + + cn1:settings + + + + build + + * + + + package + + + true + + android-device + + + + clean + + * + + + clean + + + true + + + + + + rebuild + + * + + + clean + package + + + true + + android-device + + + + build-with-dependencies + also-make + + * + + + package + + + true + + android-device + + + + test + + * + + + test + + + + javase + + + + simulator + + + + CUSTOM-Open in GUI Builder + Open in GUI Builder + + cn1:guibuilder + + + ${packageClassName} + + + + + + + CUSTOM-Update Codename One + Update Codename One + + cn1:update + + + + + + + + + + + + diff --git a/BTDemo/win/pom.xml b/BTDemo/win/pom.xml new file mode 100644 index 0000000..272d55d --- /dev/null +++ b/BTDemo/win/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.codename1.btle + btdemo + 1.0-SNAPSHOT + + com.codename1.btle + btdemo-win + 1.0-SNAPSHOT + + btdemo-win + + + UTF-8 + 1.8 + 1.8 + win + win + windows-device + + + + + + com.codenameone + codenameone-maven-plugin + ${cn1.plugin.version} + + + build-android + package + + build + + + + + + + + + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + + + ${project.groupId} + ${cn1app.name}-common + ${project.version} + tests + test + + + + + + + + + diff --git a/android/pom.xml b/cn1-bluetooth/android/pom.xml similarity index 99% rename from android/pom.xml rename to cn1-bluetooth/android/pom.xml index 2adf47a..aea33a6 100644 --- a/android/pom.xml +++ b/cn1-bluetooth/android/pom.xml @@ -27,7 +27,7 @@ org.apache.maven.plugins maven-antrun-plugin - + package @@ -121,5 +121,5 @@ - + diff --git a/android/src/main/java/com/codename1/bluetoothle/BluetoothLePlugin.java b/cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/BluetoothLePlugin.java similarity index 100% rename from android/src/main/java/com/codename1/bluetoothle/BluetoothLePlugin.java rename to cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/BluetoothLePlugin.java diff --git a/android/src/main/java/com/codename1/bluetoothle/Operation.java b/cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/Operation.java similarity index 100% rename from android/src/main/java/com/codename1/bluetoothle/Operation.java rename to cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/Operation.java diff --git a/android/src/main/java/com/codename1/bluetoothle/SequentialCallbackContext.java b/cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/SequentialCallbackContext.java similarity index 100% rename from android/src/main/java/com/codename1/bluetoothle/SequentialCallbackContext.java rename to cn1-bluetooth/android/src/main/java/com/codename1/bluetoothle/SequentialCallbackContext.java diff --git a/android/src/main/java/com/codename1/cordova/CallbackContext.java b/cn1-bluetooth/android/src/main/java/com/codename1/cordova/CallbackContext.java similarity index 100% rename from android/src/main/java/com/codename1/cordova/CallbackContext.java rename to cn1-bluetooth/android/src/main/java/com/codename1/cordova/CallbackContext.java diff --git a/android/src/main/java/com/codename1/cordova/CordovaNativeImpl.java b/cn1-bluetooth/android/src/main/java/com/codename1/cordova/CordovaNativeImpl.java similarity index 100% rename from android/src/main/java/com/codename1/cordova/CordovaNativeImpl.java rename to cn1-bluetooth/android/src/main/java/com/codename1/cordova/CordovaNativeImpl.java diff --git a/android/src/main/java/com/codename1/cordova/CordovaPlugin.java b/cn1-bluetooth/android/src/main/java/com/codename1/cordova/CordovaPlugin.java similarity index 100% rename from android/src/main/java/com/codename1/cordova/CordovaPlugin.java rename to cn1-bluetooth/android/src/main/java/com/codename1/cordova/CordovaPlugin.java diff --git a/android/src/main/java/com/codename1/cordova/PluginResult.java b/cn1-bluetooth/android/src/main/java/com/codename1/cordova/PluginResult.java similarity index 100% rename from android/src/main/java/com/codename1/cordova/PluginResult.java rename to cn1-bluetooth/android/src/main/java/com/codename1/cordova/PluginResult.java diff --git a/android/src/main/java/com/codename1/util/JSONParserUtils.java b/cn1-bluetooth/android/src/main/java/com/codename1/util/JSONParserUtils.java similarity index 100% rename from android/src/main/java/com/codename1/util/JSONParserUtils.java rename to cn1-bluetooth/android/src/main/java/com/codename1/util/JSONParserUtils.java diff --git a/android/src/main/java/com/codename1/util/JSONUtils.java b/cn1-bluetooth/android/src/main/java/com/codename1/util/JSONUtils.java similarity index 100% rename from android/src/main/java/com/codename1/util/JSONUtils.java rename to cn1-bluetooth/android/src/main/java/com/codename1/util/JSONUtils.java diff --git a/common/codenameone_library_appended.properties b/cn1-bluetooth/common/codenameone_library_appended.properties similarity index 86% rename from common/codenameone_library_appended.properties rename to cn1-bluetooth/common/codenameone_library_appended.properties index be10ad9..1fbf405 100644 --- a/common/codenameone_library_appended.properties +++ b/cn1-bluetooth/common/codenameone_library_appended.properties @@ -1,11 +1,9 @@ -#Place here properties that should be appended to an existed property if exists +#Place here properties that should be appended to an existed property if exists #in the project codenameone_settings.properties for example codename1.arg.android.xpermissions #is an appended type property. # #Wed Jan 09 17:59:31 IST 2013 codename1.arg.android.xpermissions= -codename1.arg.ios.pods=,Cordova ~> 6.1 -codename1.arg.ios.pods.platform=,11.0 codename1.arg.ios.add_libs=;CoreBluetooth.framework; codename1.arg.ios.background_modes=,bluetooth-central,bluetooth-peripheral diff --git a/common/codenameone_library_required.properties b/cn1-bluetooth/common/codenameone_library_required.properties similarity index 50% rename from common/codenameone_library_required.properties rename to cn1-bluetooth/common/codenameone_library_required.properties index d503554..4d6e9ce 100644 --- a/common/codenameone_library_required.properties +++ b/cn1-bluetooth/common/codenameone_library_required.properties @@ -1,3 +1,3 @@ # -#Sun May 15 15:25:38 IDT 2016 +#Thu Aug 25 16:25:22 PDT 2016 codename1.arg.java.version=8 diff --git a/common/pom.xml b/cn1-bluetooth/common/pom.xml similarity index 95% rename from common/pom.xml rename to cn1-bluetooth/common/pom.xml index faf28a2..2534314 100644 --- a/common/pom.xml +++ b/cn1-bluetooth/common/pom.xml @@ -1,6 +1,6 @@ - + com.codename1 cn1-bluetooth @@ -43,6 +43,13 @@ generate-gui-sources + + cn1-compliance-check + process-classes + + compliance-check + + build-legacy-cn1lib package @@ -54,16 +61,16 @@ - + - @@ -134,7 +141,7 @@ - + appended-properties @@ -149,7 +156,7 @@ org.apache.maven.plugins maven-antrun-plugin - + copy-library-appended-properties @@ -186,7 +193,7 @@ org.apache.maven.plugins maven-antrun-plugin - + copy-library-required-properties @@ -225,7 +232,7 @@ org.apache.maven.plugins maven-antrun-plugin - + copy-css @@ -241,7 +248,7 @@ - + @@ -268,7 +275,7 @@ zip cn1css - + diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/bluetoothle/Bluetooth.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/bluetoothle/Bluetooth.java new file mode 100644 index 0000000..d508fca --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/bluetoothle/Bluetooth.java @@ -0,0 +1,193 @@ +package com.codename1.bluetoothle; + + +/** + * + * @author Chen + */ +public class Bluetooth { + + public static final int SCAN_MODE_BALANCED = 1; + + public static final int SCAN_MODE_LOW_LATENCY = 2; + + public static final int SCAN_MODE_LOW_POWER = 0; + + public static final int SCAN_MODE_OPPORTUNISTIC = -1; + + public static final int MATCH_MODE_AGGRESSIVE = 1; + + public static final int MATCH_MODE_STICKY = 2; + + public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; + + public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; + + public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; + + public static final int CALLBACK_TYPE_ALL_MATCHES = 1; + + public static final int CALLBACK_TYPE_FIRST_MATCH = 2; + + public static final int CALLBACK_TYPE_MATCH_LOST = 4; + + public static final int CONNECTION_PRIORITY_LOW = 0; + + public static final int CONNECTION_PRIORITY_BALANCED = 1; + + public static final int CONNECTION_PRIORITY_HIGH = 2; + + public Bluetooth() { + } + + public boolean initialize(boolean request, boolean statusReceiver, String restoreKey) { + } + + /** + * Not supported by iOS. With throw an IOException if called on iOS. + * @throws IOException + */ + public void enable() { + } + + /** + * Not supported by iOS. With throw an IOException if called on iOS. + * @throws IOException + */ + public void disable() { + } + + public void startScan(ActionListener callback, java.util.ArrayList services, boolean allowDuplicates, int scanMode, int matchMode, int matchNum, int callbackType) { + } + + public void stopScan() { + } + + public void retrieveConnected(ActionListener callback, java.util.ArrayList services) { + } + + public void connect(ActionListener callback, String address) { + } + + public void reconnect(ActionListener callback, String address) { + } + + public void disconnect(String address) { + } + + public void close(String address) { + } + + /** + * Not currently supported on iOS. Currently does nothing if called on iOS. + * @param callback + * @param address + * @throws IOException + */ + public void discover(ActionListener callback, String address) { + } + + public void services(ActionListener callback, String address, java.util.ArrayList services) { + } + + public void characteristics(ActionListener callback, String address, String service, java.util.ArrayList characteristics) { + } + + public void descriptors(ActionListener callback, String address, String service, String characteristic) { + } + + public void read(ActionListener callback, String address, String service, String characteristic) { + } + + public void subscribe(ActionListener callback, String address, String service, String characteristic) { + } + + public void unsubscribe(ActionListener callback, String address, String service, String characteristic) { + } + + public void write(ActionListener callback, String address, String service, String characteristic, String value, boolean noResponse) { + } + + public void writeQ(ActionListener callback, String address, String service, String characteristic, String value, boolean noResponse) { + } + + public void readDescriptor(ActionListener callback, String address, String service, String characteristic, String descriptor) { + } + + public void writeDescriptor(ActionListener callback, String address, String service, String characteristic, String descriptor, String value) { + } + + public void rssi(ActionListener callback, String address) { + } + + /** + * Not supported by iOS. With throw an IOException if called on iOS. + * @param callback + * @param address + * @param mtu + * @throws IOException + */ + public void mtu(ActionListener callback, String address, int mtu) { + } + + /** + * Not supported by iOS. With throw an IOException if called on iOS. + * + * @param callback + * @param address + * @param priority + * @throws IOException + */ + public void requestConnectionPriority(ActionListener callback, String address, int priority) { + } + + public boolean isInitialized() { + } + + public boolean isEnabled() { + } + + public boolean isScanning() { + } + + public boolean wasConnected(String address) { + } + + public boolean isConnected(String address) { + } + + public boolean isDiscovered(String address) { + } + + /** + * Not supported on iOS. Will throw IOException if called on iOS. + * @return + * @throws IOException + */ + public boolean hasPermission() { + } + + /** + * Not supported on iOS. Will throw IOException if called on iOS. + * @return + * @throws IOException + */ + public boolean requestPermission() { + } + + /** + * Not supported on iOS. Will throw IOException if called on iOS. + * @return + * @throws IOException + */ + public boolean isLocationEnabled() { + } + + /** + * Not supported on iOS. Will throw IOException if called on iOS. + * @return + * @throws IOException + */ + public boolean requestLocation() { + } +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/Cordova.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/Cordova.java new file mode 100644 index 0000000..564f2f1 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/Cordova.java @@ -0,0 +1,15 @@ +package com.codename1.cordova; + + +/** + * + * @author Chen + */ +public class Cordova { + + public Cordova() { + } + + public boolean execute(String action, String jsonArgs, CordovaCallback callback) { + } +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallback.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallback.java new file mode 100644 index 0000000..a7eb477 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallback.java @@ -0,0 +1,45 @@ +package com.codename1.cordova; + + +/** + * + * @author Chen + */ +public class CordovaCallback { + + public CordovaCallback() { + } + + public CordovaCallback(ActionListener listener) { + } + + public void onError(String jsonStr) { + } + + public void onError(java.util.Map json) { + } + + public void onSuccess(String jsonStr) { + } + + public void onSuccess(java.util.Map json) { + } + + public void sendResult(String jsonStr) { + } + + public void sendResult(java.util.Map json) { + } + + public java.util.Map getResponse() { + } + + public getResponseAsync(int timeout) { + } + + public java.util.Map getResponseAndWait(int timeout) { + } + + public boolean isError() { + } +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallbackManager.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallbackManager.java new file mode 100644 index 0000000..1435d53 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaCallbackManager.java @@ -0,0 +1,33 @@ +package com.codename1.cordova; + + +/** + * + * @author Chen + */ +public class CordovaCallbackManager { + + public CordovaCallbackManager() { + } + + public static void setMethodCallback(String method, CordovaCallback callback) { + } + + public static void removeMethodCallback(String method) { + } + + public static void sendResult(String method, String result, boolean success, boolean keepCallback) { + } + + public static void sendResult(String method, String result, boolean success) { + } + + public static void onSuccess(String method, String result) { + } + + public static void onError(String method, String result) { + } + + public static void sendResult(String method, String result) { + } +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaNative.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaNative.java new file mode 100644 index 0000000..c060b75 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/cordova/CordovaNative.java @@ -0,0 +1,11 @@ +package com.codename1.cordova; + + +/** + * + * @author Chen + */ +public interface CordovaNative { + + public boolean execute(String action, String jsonArgs); +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONParserUtils.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONParserUtils.java new file mode 100644 index 0000000..6bc6228 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONParserUtils.java @@ -0,0 +1,11 @@ +package com.codename1.util; + + +public class JSONParserUtils { + + public JSONParserUtils() { + } + + public static java.util.Map parse(String json) { + } +} diff --git a/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONUtils.java b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONUtils.java new file mode 100644 index 0000000..961ced4 --- /dev/null +++ b/cn1-bluetooth/common/src/main/build/stubs/com/codename1/util/JSONUtils.java @@ -0,0 +1,11 @@ +package com.codename1.util; + + +public class JSONUtils { + + public JSONUtils() { + } + + public static String toJSON(Object o) { + } +} diff --git a/cn1-bluetooth/common/src/main/css/theme.css b/cn1-bluetooth/common/src/main/css/theme.css new file mode 100644 index 0000000..e69de29 diff --git a/common/src/main/java/com/codename1/bluetoothle/Bluetooth.java b/cn1-bluetooth/common/src/main/java/com/codename1/bluetoothle/Bluetooth.java similarity index 100% rename from common/src/main/java/com/codename1/bluetoothle/Bluetooth.java rename to cn1-bluetooth/common/src/main/java/com/codename1/bluetoothle/Bluetooth.java diff --git a/common/src/main/java/com/codename1/cordova/Cordova.java b/cn1-bluetooth/common/src/main/java/com/codename1/cordova/Cordova.java similarity index 100% rename from common/src/main/java/com/codename1/cordova/Cordova.java rename to cn1-bluetooth/common/src/main/java/com/codename1/cordova/Cordova.java diff --git a/common/src/main/java/com/codename1/cordova/CordovaCallback.java b/cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaCallback.java similarity index 100% rename from common/src/main/java/com/codename1/cordova/CordovaCallback.java rename to cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaCallback.java diff --git a/common/src/main/java/com/codename1/cordova/CordovaCallbackManager.java b/cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaCallbackManager.java similarity index 100% rename from common/src/main/java/com/codename1/cordova/CordovaCallbackManager.java rename to cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaCallbackManager.java diff --git a/common/src/main/java/com/codename1/cordova/CordovaNative.java b/cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaNative.java similarity index 100% rename from common/src/main/java/com/codename1/cordova/CordovaNative.java rename to cn1-bluetooth/common/src/main/java/com/codename1/cordova/CordovaNative.java diff --git a/common/src/main/java/com/codename1/util/JSONParserUtils.java b/cn1-bluetooth/common/src/main/java/com/codename1/util/JSONParserUtils.java similarity index 100% rename from common/src/main/java/com/codename1/util/JSONParserUtils.java rename to cn1-bluetooth/common/src/main/java/com/codename1/util/JSONParserUtils.java diff --git a/common/src/main/java/com/codename1/util/JSONUtils.java b/cn1-bluetooth/common/src/main/java/com/codename1/util/JSONUtils.java similarity index 100% rename from common/src/main/java/com/codename1/util/JSONUtils.java rename to cn1-bluetooth/common/src/main/java/com/codename1/util/JSONUtils.java diff --git a/cn1-bluetooth/common/src/test/java/com/codename1/FilechooserTest.java b/cn1-bluetooth/common/src/test/java/com/codename1/FilechooserTest.java new file mode 100644 index 0000000..fef58fb --- /dev/null +++ b/cn1-bluetooth/common/src/test/java/com/codename1/FilechooserTest.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.codename1; + +import com.codename1.testing.AbstractTest; + +/** + * + * @author shannah + */ +public class FilechooserTest extends AbstractTest { + + @Override + public boolean runTest() throws Exception { + return true; + } + +} diff --git a/ios/pom.xml b/cn1-bluetooth/ios/pom.xml similarity index 99% rename from ios/pom.xml rename to cn1-bluetooth/ios/pom.xml index a366032..c859d2c 100644 --- a/ios/pom.xml +++ b/cn1-bluetooth/ios/pom.xml @@ -30,5 +30,5 @@ - + diff --git a/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.h b/cn1-bluetooth/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.h similarity index 100% rename from ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.h rename to cn1-bluetooth/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.h diff --git a/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.m b/cn1-bluetooth/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.m similarity index 100% rename from ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.m rename to cn1-bluetooth/ios/src/main/objectivec/BluetoothLeCommandDelegateImpl.m diff --git a/ios/src/main/objectivec/BluetoothLePlugin.h b/cn1-bluetooth/ios/src/main/objectivec/BluetoothLePlugin.h similarity index 99% rename from ios/src/main/objectivec/BluetoothLePlugin.h rename to cn1-bluetooth/ios/src/main/objectivec/BluetoothLePlugin.h index bf860f9..789cc08 100644 --- a/ios/src/main/objectivec/BluetoothLePlugin.h +++ b/cn1-bluetooth/ios/src/main/objectivec/BluetoothLePlugin.h @@ -1,4 +1,4 @@ -#import +#import "CDV.h" #import @interface BluetoothLePlugin : CDVPlugin { diff --git a/ios/src/main/objectivec/BluetoothLePlugin.m b/cn1-bluetooth/ios/src/main/objectivec/BluetoothLePlugin.m similarity index 100% rename from ios/src/main/objectivec/BluetoothLePlugin.m rename to cn1-bluetooth/ios/src/main/objectivec/BluetoothLePlugin.m diff --git a/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.h b/cn1-bluetooth/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.h similarity index 100% rename from ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.h rename to cn1-bluetooth/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.h diff --git a/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.m b/cn1-bluetooth/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.m similarity index 100% rename from ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.m rename to cn1-bluetooth/ios/src/main/objectivec/com_codename1_cordova_CordovaNativeImpl.m diff --git a/javascript/pom.xml b/cn1-bluetooth/javascript/pom.xml similarity index 99% rename from javascript/pom.xml rename to cn1-bluetooth/javascript/pom.xml index 624846e..2c6b037 100644 --- a/javascript/pom.xml +++ b/cn1-bluetooth/javascript/pom.xml @@ -30,5 +30,5 @@ - + diff --git a/javase/pom.xml b/cn1-bluetooth/javase/pom.xml similarity index 98% rename from javase/pom.xml rename to cn1-bluetooth/javase/pom.xml index a6c15d7..3bac257 100644 --- a/javase/pom.xml +++ b/cn1-bluetooth/javase/pom.xml @@ -11,13 +11,13 @@ 1.0-SNAPSHOT cn1-bluetooth-javase - + UTF-8 1.8 1.8 - - + + @@ -34,5 +34,5 @@ - + diff --git a/lib/pom.xml b/cn1-bluetooth/lib/pom.xml similarity index 93% rename from lib/pom.xml rename to cn1-bluetooth/lib/pom.xml index 36a1749..1e27389 100644 --- a/lib/pom.xml +++ b/cn1-bluetooth/lib/pom.xml @@ -11,13 +11,13 @@ 1.0-SNAPSHOT pom cn1-bluetooth-lib - + UTF-8 1.8 1.8 - - + + @@ -26,6 +26,14 @@ ${cn1lib.name}-common ${project.version} + + ${project.groupId} + ${cn1lib.name}-common + ${project.version} + cn1css + zip + + @@ -110,5 +118,5 @@ - + diff --git a/pom.xml b/cn1-bluetooth/pom.xml similarity index 91% rename from pom.xml rename to cn1-bluetooth/pom.xml index 4831d13..bbf6cac 100644 --- a/pom.xml +++ b/cn1-bluetooth/pom.xml @@ -44,12 +44,12 @@ --> - + 7.0.26 7.0.26 UTF-8 - + 1.8 11 3.8.0 @@ -68,7 +68,6 @@ javase win lib - BTDemo @@ -92,7 +91,7 @@ kotlin-stdlib ${kotlin.version} - + @@ -104,7 +103,7 @@ - + @@ -137,8 +136,8 @@ test-compile - - test-compile + + test-compile @@ -154,7 +153,7 @@ maven-antrun-plugin 3.1.0 - + com.codenameone codenameone-maven-plugin @@ -278,31 +277,4 @@ https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - central - Central Repository - https://repo.maven.apache.org/maven2 - default - - false - - - - sonatype-snapshots - Sonatype Snapshots - https://oss.sonatype.org/content/repositories/snapshots - - true - - - - sonatype-staging - Sonatype Staging - https://oss.sonatype.org/content/repositories/staging - - false - - - diff --git a/win/pom.xml b/cn1-bluetooth/win/pom.xml similarity index 99% rename from win/pom.xml rename to cn1-bluetooth/win/pom.xml index f08b334..a26efa5 100644 --- a/win/pom.xml +++ b/cn1-bluetooth/win/pom.xml @@ -30,5 +30,5 @@ - + diff --git a/common/manifest.properties b/common/manifest.properties deleted file mode 100644 index 4da354b..0000000 --- a/common/manifest.properties +++ /dev/null @@ -1,2 +0,0 @@ -# Codename One libray manifest - diff --git a/javascript/src/main/javascript/com_codename1_cordova_CordovaNative.js b/javascript/src/main/javascript/com_codename1_cordova_CordovaNative.js deleted file mode 100644 index 89d4b52..0000000 --- a/javascript/src/main/javascript/com_codename1_cordova_CordovaNative.js +++ /dev/null @@ -1,15 +0,0 @@ -(function(exports){ - -var o = {}; - - o.execute__java_lang_String_java_lang_String = function(param1, param2, callback) { - callback.error(new Error("Not implemented yet")); - }; - - o.isSupported_ = function(callback) { - callback.complete(false); - }; - -exports.com_codename1_cordova_CordovaNative= o; - -})(cn1_get_native_interfaces()); diff --git a/javase/src/main/java/com/codename1/cordova/CordovaNativeImpl.java b/javase/src/main/java/com/codename1/cordova/CordovaNativeImpl.java deleted file mode 100644 index 5814640..0000000 --- a/javase/src/main/java/com/codename1/cordova/CordovaNativeImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.codename1.cordova; - -import java.util.Map; -import com.codename1.ui.Display; - -public class CordovaNativeImpl implements com.codename1.cordova.CordovaNative{ - public boolean execute(String param, String param1) { - installBuildHints(); - return false; - } - - public boolean isSupported() { - installBuildHints(); - return false; - } - - private boolean bluetoothUsageDescriptionChecked; - - private void checkBluetoothUsageDescription() { - if (!bluetoothUsageDescriptionChecked) { - bluetoothUsageDescriptionChecked = true; - - Map m = Display.getInstance().getProjectBuildHints(); - if(m != null) { - if(!m.containsKey("ios.NSBluetoothPeripheralUsageDescription")) { - Display.getInstance().setProjectBuildHint("ios.NSBluetoothPeripheralUsageDescription", "Some functionality of the application requires Bluetooth functionality"); - } - if(!m.containsKey("ios.NSBluetoothAlwaysUsageDescription")) { - Display.getInstance().setProjectBuildHint("ios.NSBluetoothAlwaysUsageDescription", "Some functionality of the application requires Bluetooth functionality"); - } - } - } - } - - private void installBuildHints() { - checkBluetoothUsageDescription(); - } - -} diff --git a/win/src/main/csharp/com/codename1/cordova/CordovaNativeImpl.cs b/win/src/main/csharp/com/codename1/cordova/CordovaNativeImpl.cs deleted file mode 100644 index 508daea..0000000 --- a/win/src/main/csharp/com/codename1/cordova/CordovaNativeImpl.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace com.codename1.cordova{ - -using System; -using System.Windows; - -public class CordovaNativeImpl { - public bool execute(String param, String param1) { - return false; - } - - public bool isSupported() { - return false; - } - -} -}