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

A very simple MQTT subsciber. More...

#include <signal.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <mosquitto.h>
#include <getopt.h>

Variables

char clientId [30]
 Id of this MQTT subscriber. More...
 
char mqttHost [68]
 The MQTT broker URL or name. More...
 
int mqttPort
 MQTT port 1883.
 
char topicS [60]
 Root of topics to log.
 

Detailed Description

A very simple MQTT subsciber.

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

cross-compile by:

make PROGRAM=mosquiSub TARGET=meterPi clean all

program respectively transfer to target machine by:

make PROGRAM=mosquiSub TARGET=raspi61 FTPuser=pi:piSecret progapp

The building of the application is governed by the make include makeProg_mosquiSub_settings.mk:

# A makefile include for raspberry projects
# program include for one program
# makeProg_mosquiSub_settings.mk
# Copyright 2017 Albrecht Weinert < a-weinert.de >
MAKE_INCLUDE_PROGRAM = mosquiSub
MAKE_PROGRAM_LAST_CHANGE = '$Date: 2021-02-02 18:11:02 +0100 (Di, 02 Feb 2021) $ '
MAKE_PROGRAM_REVISION = '$Revision: 236 $ '
ifndef COPYRIGHT_YEAR
$(error includefile $(MAKE_INCLUDE_PROGRAM) used directly.)
endif
# PROGRAM or MAIN_F might have been given in wrong case (at least on Windows)
override MAIN_F = $(MAKE_INCLUDE_PROGRAM)
# An optional short multiline description of this program's specifica.
# May be empty. But, do not change the three lines define endef and export.
define PROG_DES_TEXTT
Program mosquiSub
This program is a first example of a MQTT subscriber as well as a minimal
test program to see whats going on with subjects labExp/sweetHome/#.
endef
export PROG_DES_TEXT
extraLDFLAGS = -lmosquitto
# extraSOURCES = weRasp/weUtil.c weRasp/weShareMem.c weRasp/weCGIajax.c
# FTPdir = var/www/cgi

Variable Documentation

◆ mqttHost

char mqttHost[68]

The MQTT broker URL or name.

May be set by option –mqttHost meterPi or –mqttBroker 192.168.178.87

default: localhost MQTTBroker (currently localhost !)

◆ clientId

char clientId[30]

Id of this MQTT subscriber.

MQTT client ID.