Skip to content
Mbed Cloud SDK for Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
backends
config
docs
examples
gradle/wrapper
lwm2m Fixing blocking issue Nov 14, 2018
scripts
src
support-annotations
tests
.gitattributes
.gitignore
CHANGELOG.md
CONTRIBUTING.md
DEVELOPMENT.md
Dockerfile
LICENCE
README.md
build.gradle
docker-compose.yml
gradle.properties
gradlew
gradlew.bat
settings.gradle
version.toml

README.md

Mbed Cloud SDK for Java

Status

The Mbed Cloud SDK provides a simplified interface to the Mbed Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.

Prerequisites

Logging

  • The SDK uses SLF4j and hence, any supported logging framework (e.g. java.util.logging, logback, log4j) can be used by your application.

Distribution

In order to best meet your requirements, Java SDK is packaged in 3 different ways:

  • Individual Jars
  • Distribution ZIP. See related gradle plugin for more details.
  • A fat jar comprising the SDK and all its dependencies.

Getting started

Download

Artefacts listed above are published on JCenter and Maven Central. They can therefore be retrieved and included into your project using the package manager of your choice. To do so, please follow the instructions present on one of these artefact repositories (Bintray page of the project).

For example, if using Gradle, add the following compile dependency to build.gradle:

compile 'com.arm.mbed.cloud.sdk:mbed-cloud-sdk:1.x.y'

Current artefacts are not fully tailored for Android but can be used as is on this mobile platform. However, oltu dependency will have to be excluded to remove any compilation issue (e.g. Error converting bytecode to dex:\nCause: com.android.dex.DexException: Multiple dex files define Lorg/apache/oltu/oauth2/common/domain/credentials/Credentials). To do so, import the SDK in the gradle file, as follows:

implementation( 'com.arm.mbed.cloud.sdk:mbed-cloud-sdk:1.x.y' ){
    // Excluding a particular transitive dependency:
    exclude group: 'org.apache.oltu.oauth2'
}

Usage

These instructions can also be found in the official documentation:

  1. Create an API key on Mbed Cloud Portal.
  2. Import the SDK to your project using one of the packages listed above.
  3. Create a configuration object:
        String logLevel = "BODY"; //Defines the logging level of HTTP communications. See CallLogLevel for more information.
        String apiKey = "<apikey>"; //API key to use for contacting Mbed Cloud.
        ConnectionOptions config = new ConnectionOptions(apiKey);
        config.setClientLogLevel(CallLogLevel.getLevel(logLevel));
  4. You are ready to go.
        DeviceDirectory deviceApi = new DeviceDirectory(config);
        try {
            System.out.println(deviceApi.listDevices(null));
        } catch (MbedCloudException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Versioning

The current version scheme used by the SDK reflects the version of the API it abstracts (e.g. 1.2.3 refers to 1.2 version of Mbed Cloud APIs). The last digit of the version corresponds to the SDK incremental version.

Documentation and examples

See the full documentation and API reference (i.e. javadoc) at https://cloud.mbed.com/docs/latest/mbed-cloud-sdk-java/. For usage examples, please have a look at the example project.

Contributing

Mbed Cloud SDK for Java is open source and we would like your help. There is a brief guide on how to get started in CONTRIBUTING.md.

Project

  • All code inside *.internal.* packages or annotated as @Internal is considered private API and should not be relied upon at all.
  • Classes annotated as @Module contain all Arm Mbed Cloud APIs
  • Methods annotated as @API are the functions which can be used to interact with Mbed Cloud.
  • APIs, objects or methods annotated as @Deprecated are supported until the next major release and will be removed later on. It is highly recommended to stop using them.
  • Methods with @Daemon annotation should be used to monitor SDK daemon threads.

Licence

License

Mbed Cloud SDK for Java is free-to-use and licensed under the Apache License 2.0. See LICENCE file for more information.

You can’t perform that action at this time.