MQTT-SN Gateway Library
Library that allows implementation of MQTT-SN gateway.
Loading...
Searching...
No Matches
Gateway.h
Go to the documentation of this file.
1//
2// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved.
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
10
11#pragma once
12
13#include <memory>
14#include <cstdint>
15#include <functional>
16
17namespace cc_mqttsn_gateway
18{
19
20class GatewayImpl;
27{
28public:
31
34
40 using NextTickProgramReqCb = std::function<void (unsigned ms)>;
41
57 using SendDataReqCb = std::function<void (const std::uint8_t* buf, std::size_t bufSize)>;
58
64
71
76 void setAdvertisePeriod(std::uint16_t value);
77
79 std::uint16_t getAdvertisePeriod() const;
80
84 void setGatewayId(std::uint8_t value);
85
87 std::uint8_t getGatewayId() const;
88
94 bool start();
95
97 void stop();
98
104 void tick();
105
106private:
107 std::unique_ptr<GatewayImpl> m_pImpl;
108};
109
110} // namespace cc_mqttsn_gateway
111
112
Interface for Gateway entity.
Definition Gateway.h:27
void setNextTickProgramReqCb(NextTickProgramReqCb &&func)
Set the callback to be invoked when new time measurement is required.
void stop()
Stop the operation of the object.
bool start()
Start the operation of the object.
Gateway()
Default constructor.
std::function< void(const std::uint8_t *buf, std::size_t bufSize)> SendDataReqCb
Type of callback used to request send the serialised ADVERTISE message.
Definition Gateway.h:57
void tick()
Notify the Gateway object about requested time period expiry.
std::function< void(unsigned ms)> NextTickProgramReqCb
Type of the callback used to request time measurement.
Definition Gateway.h:40
void setSendDataReqCb(SendDataReqCb &&func)
Set the callback to be invoked when new ADVERTISE message needs to be broadcasted.
void setAdvertisePeriod(std::uint16_t value)
Set period after which ADVERTISE message needs to be constatly sent.
std::uint8_t getGatewayId() const
Get current gateway numeric ID configuration.
void setGatewayId(std::uint8_t value)
Set gateway numeric ID to be advertised.
std::uint16_t getAdvertisePeriod() const
Get current configuration of the ADVERTISE message period.
Main namespace for all classes / functions of the gateway library.