Skip to content

Commit 4fd2578

Browse files
authored
Merge pull request #13 from LittleBuster/add-missing-getters
Add missing getters
2 parents b8accd4 + 8720d9e commit 4fd2578

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=FastBot2
2-
version=1.0.5
2+
version=1.0.6
33
author=AlexGyver <alex@alexgyver.ru>
44
maintainer=AlexGyver <alex@alexgyver.ru>
55
sentence=Fast and universal Arduino/ESP8266/ESP32 library for Telegram bot

src/core/core.h

+20
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ class Core : public Http {
5757
http.setTimeout(timeout);
5858
}
5959

60+
// получить таймаут ожидания ответа сервера
61+
uint16_t getTimeout() {
62+
return _clientTout;
63+
}
64+
6065
// ============================== SYSTEM ==============================
6166

6267
// установить токен
@@ -74,11 +79,21 @@ class Core : public Http {
7479
_limit = limit;
7580
}
7681

82+
// получить лимит памяти на ответ сервера
83+
size_t getMemLimit(void) {
84+
return _limit;
85+
}
86+
7787
// установить лимит - кол-во сообщений в одном обновлении (умолч. 3)
7888
void setLimit(uint8_t limit = 3) {
7989
_poll_limit = limit ? limit : 1;
8090
}
8191

92+
// получить лимит - кол-во сообщений в одном обновлении
93+
uint8_t getLimit(void) {
94+
return _limit;
95+
}
96+
8297
// установить режим и период опроса (умолч. Poll::Sync и 4000 мс)
8398
void setPollMode(Poll mode = Poll::Sync, uint16_t period = 4000) {
8499
_poll_mode = mode;
@@ -90,6 +105,11 @@ class Core : public Http {
90105
return _poll_mode;
91106
}
92107

108+
// получить период опроса
109+
uint16_t getPollPeriod() {
110+
return _poll_prd;
111+
}
112+
93113
// пропустить непрочитанные сообщения, отрицательное число, соответствует количеству пропусков. Вызывать однократно
94114
// https://core.telegram.org/bots/api#getupdates
95115
void skipUpdates(int32_t offset = -1) {

src/core/http.h

+18
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,25 @@ class Http {
1313
// установить proxy
1414
void setProxy(const char* host, uint16_t port) {
1515
http.setHost(host, port);
16+
_ip.fromString(host);
17+
_port = port;
1618
}
1719

1820
// установить proxy
1921
void setProxy(const IPAddress& ip, uint16_t port) {
2022
http.setHost(ip, port);
23+
_ip = ip;
24+
_port = port;
25+
}
26+
27+
// получить proxy IP
28+
const IPAddress& getProxyIP() {
29+
return _ip;
30+
}
31+
32+
// Получить proxy port
33+
uint16_t getProxyPort() {
34+
return _port;
2135
}
2236

2337
// удалить proxy
@@ -27,6 +41,10 @@ class Http {
2741

2842
protected:
2943
ghttp::Client http;
44+
45+
private:
46+
IPAddress _ip;
47+
uint16_t _port;
3048
};
3149

3250
} // namespace fb

0 commit comments

Comments
 (0)