1.1.6 • Published 9 years ago

pebble-generic-weather v1.1.6

Weekly downloads
37
License
MIT
Repository
github
Last release
9 years ago

pebble-generic-weather

Library for easy fetching of weather data from various providers.

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

basalt

This library is a fork of the excellent owm-weather one. A lot of code has not been changed or just a little. All the credits go to @C-D-Lewis @cat-haines and @Katharine ! Thanks for your work

How to use

  • Run pebble package install pebble-generic-weather.

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

var GenericWeather = require('pebble-generic-weather');
var genericWeather = new GenericWeather();
  • Call genericWeather.appMessageHandler() in an appmessage handler so that it can message the C side.
Pebble.addEventListener('appmessage', function(e) {
  genericWeather.appMessageHandler(e);
});
  • Include the library in any C files that will use it:
#include <pebble-generic-weather/pebble-generic-weather.h>
  • Include the pebble-events library in your main file so you can initialise it:
#include <pebble-events/pebble-events.h>
  • Call generic_weather_init() to initialize the library when your app starts.

  • Call generic_weather_set_provider(GenericWeatherProviderXXX) to configure your provider.

  • Call generic_weather_set_api_key("myapikey") to configure your api key for the provider.

  • Call generic_weather_set_feels_like(true || false) to configure whether or not to use "feels like" temperature if available.

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

  • Call generic_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 GenericWeatherInfo object for you to extract data from.

Documentation

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

Providers supported

Data returned

Available now

  • Description, temperature in K/C/F, location name, condition code, day/night status, sunrise/sunset
1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago