rasProject_01 / weSweetHome  R. 240
process control       /     RasPi software         by   weinert-automation
Loading...
Searching...
No Matches
getLocalWeatherData.c File Reference

A console program to fetch local weather data. More...

#include "sysBasic.h"
#include "we1wire.h"
#include <sys/file.h>
#include <signal.h>
#include <errno.h>
#include <getopt.h>
#include "weUtil.h"
#include "sweetHome.h"
#include "sweetHomeLocal.h"
#include <curl/curl.h>
#include <dirent.h>

Data Structures

struct  memAlloc_t
 Structure for allocated, re-allocatable memory. More...
 

Variables

char const prgNamPure []
 The pure program name. More...
 
char const prgSVNdat []
 The complete SVN date string. More...
 
char const prgSVNrev []
 The complete SVN revision string. More...
 

Detailed Description

A console program to fetch local weather data.

Copyright (c) 2018 Albrecht Weinert
weinert-automation.de a-weinert.de
/ / /\
/ /___ / \ |
\ /____\ /____\ | _|__
\ /\ / \ / \| |
\/ \/ \__/ \__/|_

Revision history

Rev. 236 2.02.2021
Rev. 144 12.06.2018 : new; just for testing algorithms and data acquisition
Rev. 147 16.06.2018 : time handling in library functions improved
Rev. 155 27.06.2018 : time handling debugged
Rev. 164 11.07.2018 : sunset/sunrise location params; 1-wire search
Rev. 168 21.07.2018 : 1-wire temperature sensor handling enhanced

Program functions

This program gets one or two JSON pages from open weather map and parses them for sunset sunrise (this day, this location) and cloudiness (dto. forecast from now.

The current and next day sunrise and sunset are calculated approximately by a cosine algorithm using integer lookup tables (no float arithmetic).

Additionally it determines the 1-wire sensors present and reveals their real location in the file system.

Library usage

The program uses the curl library to fetch data from internet.

Local build and compile on a Raspberry: g++ getLocalWeaterData.c -o getLocalWeatherData -lcurl

Cross-compile by:

arm-linux-gnueabihf-gcc -DF_CPU=1200000000 -DPLATFORM=raspberry_03
-DMCU=BCM2837 -DTARGET=raspi61 -I./include
-c -o getLocalWeatherData.o getLocalWeatherData.c
and so on ...
arm-linux-gnueabihf-gcc -I. -DPLATFORM=raspberry_03 -DMCU=BCM2837
-DTARGET=raspi61 -I./include getLocalWeatherData.o
weRasp/weUtil.o --output getLocalWeatherData.elf
-Wl,-Map=getLocalWeatherData.map,--cref
-lcurl

or by:

make PROGRAM=getLocalWeatherData TARGET=raspi61 clean all

program by:

make PROGRAM=getLocalWeatherData TARGET=meterPi FTPuser=pi:piSecret progapp

Variable Documentation

◆ prgNamPure

char const prgNamPure[]

The pure program name.

To be provided in the application's / program's source.

See also
progNam() progNamB()

◆ prgSVNrev

char const prgSVNrev[]

The complete SVN revision string.

To be provided in the application's / program's source.

See also
progRev()

◆ prgSVNdat

char const prgSVNdat[]

The complete SVN date string.

To be provided in the application's / program's source.

See also
progDat()