This shows you the differences between two versions of the page.
— | sdk:scripts:gps-monitor [2015/05/05 15:04] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SDK Script gps-monitor.are ====== | ||
+ | <code c gps-monitor.are> | ||
+ | /* DESC: A script for activating WLAN as soon as GPS position (lat,lon) is within a specified range. | ||
+ | * Copyright (C) 2012 NetModule AG, Switzerland | ||
+ | */ | ||
+ | |||
+ | LAT_MAX = 47.377892; | ||
+ | LAT_MIN = 47.377897; | ||
+ | |||
+ | LON_MAX = 8.540053; | ||
+ | LON_MIN = 8.540057; | ||
+ | |||
+ | while(1) { | ||
+ | status = nb_status(" | ||
+ | lat = struct_get(status, | ||
+ | lon = struct_get(status, | ||
+ | |||
+ | if (lat != " | ||
+ | printf(" | ||
+ | if (lat >= LAT_MIN && lat <= LAT_MAX && | ||
+ | lon >= LON_MIN && lon <= LON_MAX) { | ||
+ | |||
+ | printf(" | ||
+ | nb_config_set(" | ||
+ | } else { | ||
+ | printf(" | ||
+ | nb_config_set(" | ||
+ | } | ||
+ | } else { | ||
+ | printf(" | ||
+ | } | ||
+ | sleep(10); | ||
+ | } | ||
+ | |||
+ | exit(0); | ||
+ | |||
+ | </ | ||