Giter Club home page Giter Club logo

owm-weather's Introduction

owm-weather

Library for easy fetching of weather data from OpenWeatherMap.org.

Includes a simple test app as a proof of concept usage of a weather C API.

basalt

How to use

  • Obtain an API key from OpenWeatherMap.org.

  • Ensure 'enableMultiJS': true is set in your appinfo.json.

  • Run pebble package install pebble-owm-weather.

  • Require pebble-owm-weather in your your app.js file, and then instantiate an OWMWeather object.

var OWMWeather = require('lib/owm_weather.js');
var owmWeather = new OWMWeather();
  • Call owmWeather.appMessageHandler() in an appmessage handler so that it can message the C side.
Pebble.addEventListener('appmessage', function(e) {
  owmWeather.appMessageHandler(e);
});
  • Include the library in any C files that will use it:
#include <pebble-owm-weather/owm-weather.h>
  • Include the pebble-events library in your main file so you can initialise it:
#include <pebble-events/pebble-events.h>
  • Call owm_weather_init(api_key) to initialize the library when your app starts, supplying your API key.

  • Call events_app_message_open() after owm_weather_init and any other libraries you need to init.

  • Call owm_weather_fetch() after PebbleKit JS is ready, and supply a suitable callback for events.

That's it! When the fetch returns (successful or not), the callback will be called with a OWMWeatherInfo object for you to extract data from.

Documentation

Read include/owm-weather.h for function and enum documentation.

Data returned

Available now

  • Description, short description, temperature in K/C/F, location name.

Not implemented, but possible

Anything else detailed in the JSON response.

owm-weather's People

Contributors

c-d-lewis avatar cat-haines avatar katharine avatar orviwan avatar thintim avatar rozza-m avatar

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.