Code Monkey home page Code Monkey logo

javasmq's Introduction

Java and Android SMQ Client Library and Example

SMQ, based on the publish - subscribe pattern, provides features similar to other pub/sub protocols such as MQTT. However, SMQ extends the pub/sub pattern with additional features such as one-to-one messaging and sender's address, features typically required in device management.

The Java SMQ client library is designed for standard Java and Android.

Note that the SMQ protocol supports both non secure and secure (TLS) connections, however, the Java SMQ client library is designed to operate only over a secure TLS connection. The TLS connection used by Java SMQ is managed by the Java platform's TLS functionality.

TL;DR; IoT Quickstart

Setup your own IoT solution as follows:

  1. Download and compile the example code "as is". The example, when run, connects to the online test broker.
  2. Familiarize yourself with how the example works.
  3. Follow the Setting up a Low Cost SMQ IoT Broker for how to setup your own IoT solution.
  4. Modify the example code (LedSMQ.java @ line 42) and change the domain URL. The URL should be set to your own IoT server.

Java SMQ DZone Article

Java SMQ Example

Compiling the Included Java Swing Example

This example is designed for Swing and. An Android example is also provided (see below).

You may include the SMQ Java code in your Java build, but do not include the file RTL/SMQ/AndroidSMQ.java since this file is designed for Android.

You may compile and run the SMQ LED example on the command line as follows:

javac LedSMQ.java
java LedSMQ

The Swing example connects to the public SMQ test broker. You may control any of the connected devices, or you can run a simulated device by using the online device C example. Note that the Swing example also opens a browser window and redirects the browser to the LED example's HTML5 UI. This makes it easy for you to see how the Swing UI example can be synchronized in real time with the HTML5 UI example.

See the SMQ LED example's tutorial for more information on how this example works.

Compiling for Android

You may include the SMQ java code in your Android build, but do not include the file RTL/SMQ/SwingSMQ.java since this file is designed for Swing.

A ready-to-use Android example can be downloaded from the SMQ source code home page . A pre compiled example is available on Google Play.

SMQ Library Source Code

The SMQ Java library can be found in RTL/SMQ. Depending on what environment you are building for, delete RTL/SMQ/AndroidSMQ.java or RTL/SMQ/SwingSMQ.java.

Example Source Code

  • LedSMQ.java: the Swing LED example.
  • org/json: the JSON library used by LedSMQ.java.
  • eu/hansolo/steelseries: provides LED UI for LedSMQ.java.

Note: the Java SMQ library is not using any of the above and you should only include RTL/SMQ in your own build.

License

The source code is released under the Eclipse Public License - V 2.0: https://www.eclipse.org/legal/epl-v20.html

You may compile a Program licensed under the EPL without modification and commercially license the result in accordance with the terms of the EPL.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, version 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.