Skip to content

Latest commit

 

History

History
141 lines (93 loc) · 4.16 KB

gk.md

File metadata and controls

141 lines (93 loc) · 4.16 KB

H4P Flyer

H4P_GateKeeper

Shortname gate

Manages the detection of network presence events which occur when nominated devices join/leave the network

For more information on how to use this plugin, see Network Presence Detection


Contents


Usage

This plugin is a "singleton" - there may be only one single instance of it in the app. It may be instantiated as any name the user chooses.

H4P_GateKeeper youcantcomeinwithoutabelton();

Dependencies

H4P_WiFi

Commands Added

N/A

Service Commands

stop / start have no effect

Callback functions

N/A


API (for "Roamers")

H4P_GateKeeper itself has no API, it merely manages and co-ordinates objects know as "Roamers" which represent various different device types whose joining / leaving can be detected.

Individual Roamers have different conctructors, but they all have a common API function:

string getIP(); // returns empty string if not in network

Roamers

Type of device Identifying features Example H4Plugins "Roamer" type
MDNS (.local) device protocol / service attributes tcp,http h4pRoamingDotLocal
H4 device device name bedroom h4pRoamingH4
any IP address 192.168.1.42 h4pRoamingIP
UPNP device UPNP Tag, value USN,uuid:Socket-1_0-upnpF9198B h4pRoamingUPNP

h4pRoamingDotLocal

/* Constructor
name = unique name to identify device to user
service = MDNS service type e.g. tcp or udp etc
protocol = MDNS protocol e.g. hrttp
*/
h4pRoamingDotLocal(const string& name,const string& service,const string& protocol);

Example Sketch 1

Example Sketch 2

h4pRoamingH4

/* Constructors
name = unique name to identify device to user
*/
h4pRoamingH4(const string& name);

Example Sketch 1

Example Sketch 2

h4pRoamingIP

/* Constructors
name = unique name to identify device to user
ip = the IP address that device will be recongised by
*/
h4pRoamingIP(const string& name,const string& ip);
h4pRoamingIP(const string& name,const IPAddress& ip);

Example Sketch 1

Example Sketch 2

Two additional examples show how to link joining / leaving automatically to a default Switch / Thing object (see "Things" and "Switches")

While the joining example and the leaving example are coded for h4pRoamingIP, the code applies equally to any of the Roamers.

h4pRoamingUPNP

/* Constructor
name = unique name to identify device to user
tag = UPNP/SSDP message tag, e.g. USN, MX, LOCATION etc
id = value of the tag considered to be a "match" NB take care, many duplicates my occur with poor choices of tag/id!
*/
h4pRoamingUPNP(const string& name,const string& tag,const string& id);

Example Sketch 1

Example Sketch 2


(c) 2021 Phil Bowles [email protected]