Code Monkey home page Code Monkey logo

mqtt-images's Introduction

MQTT-Images

This program allows the reception of base64 encoded images via the MQTT protocol and is able to send the received images to Social Media sites such as Twitter and Facebook.

This program was part of a university module 'Project de spécialité' in the FabLab domain. Machine à café sourire

Running the program

NOTE: The program requires a running mqtt server to receive messages

- java -jar ImagesMQTT.jar [INPUT ...]
  -h --help         shows help
  -i --ip   <arg>   sets MQTT server ip
  -p --port <arg>   sets MQTT server port
  -height   <arg>   specifies image height
  -width    <arg>   specifies image width
  -t --twitter      use twitter
  -f --facebook     use facebook
  -as --automaticSocialMedia  update automatically on Social Media
  -ex --exampleImage          sends example image at the start of the program

Default values

  • -ip localhost
  • -port 1883. This is also the defaut port for the MQTT messaging protocol.
  • -height 480
  • -width 320
  • -twitter false
  • -facebook false
  • automaticSocialMediafalse
  • -exampleImage false

Received images

Both the received bit file and the transformed image are being stored in the images/ folder. Images are being named by the current time.

Example usage

Testing the program with an example image to the local ip. The example image is stored in the main folder as imagedata. The file represents the known Lenna picture in a 512x512 resolution, transformed into base64. Assumes local MQTT server (ex. mosquitto) is running. To verify the correctness of the program, an image should appear in images/ folder.

  java -jar ImagesMQTT.jar -ip 127.0.0.1 -port 1883 -height 512 -width 512 -ex

Assuming non-local MQTT server with automatic Twitter and Facebook updates, but default image resolution.

  java -jar ImagesMQTT.jar -ip 192.168.2.24 -t -f -as

MQTT specific messaging

The program is by default subscribed to the channel sourire, where all incoming communication is handled. This can be changed in the MainCoffeeClass at the variable mqtt_subscribed_topic.

The incoming images are assumed to be encoded in base64 and in BGR format, where the size of an image is heightwidth3 (Blue + Green + Red). An image in the default size is hence 480*320*3 = 460800 bits or 57.6 kilobytes. Although the MQTT protol is not made for big data transmission, the maximum size a message can have is 260 megabytes.

Updating to Social Media

If the automaticSocialMedia flag is set to false, it is up to the users to send the status update command. This is done in the sourire channel with the keyword Update to Social Media

Used libraries

  -mqqt-client-0.4.0
  -commons-cli-1.3.1
  -hamcrest-core-1.3
  -junit-4.12
  -twitter4j
  -facebook4j

Social Media authentification

To use this programs Social Media capabilities, it is necessary to copy the relevant OAuth data into the resources/twitter.properties and resources/facebook.properties files.

##Tests All unit testing is done via JUnit together with a test suite. Due to the nature of this program - very networking dependent - the main functionallities are not being tested with the unit tests.

mqtt-images's People

Contributors

suknuk avatar

Stargazers

alainrohr avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

tvikneshwar

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.