Skip to content

Commit dda9b40

Browse files
committed
upd mealpager
1 parent 31dbb69 commit dda9b40

15 files changed

+279
-12
lines changed

non_catalog_apps/meal_pager/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This app triggers restaurant pagers in a brute force manner, useful to test if d
77
## Supported Pagers
88
- Retekess T119
99
- Retekess TD157
10-
- Retekess TD165 (coming soon)
11-
- Retekess TD174 (coming soon)
10+
- Retekess TD165
11+
- Retekess TD174
1212

1313
### Features
1414
- Select range of stations (needs improving for full range)

non_catalog_apps/meal_pager/application.fam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ App(
77
fap_icon="icons/meal_pager_10px.png",
88
fap_icon_assets="icons",
99
fap_category="Sub-GHz",
10-
fap_version="0.8",
10+
fap_version="1.0",
1111
fap_author="leedave",
1212
fap_weburl="https://github.com/leedave/flipper-zero-meal-pager",
1313
fap_description="This app triggers restaurant pagers in a brute force manner, useful to test if devices are still functional.",

non_catalog_apps/meal_pager/docs/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v1.0
2+
- Added support for TD174
3+
4+
## v0.9
5+
- Added support for TD165
6+
17
## v0.8
28
- Added Repeats feature
39
- Repeats configuration in settings

non_catalog_apps/meal_pager/helpers/meal_pager_storage.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void meal_pager_close_config_file(FlipperFormat* file) {
1515
flipper_format_free(file);
1616
}
1717

18-
bool meal_pager_save_subghz_buffer_file_start(void* context, FlipperFormat* ff, Storage* storage) {
18+
bool meal_pager_save_subghz_buffer_file_start(void* context, FlipperFormat* ff, Storage* storage, char* frequency) {
1919
// SubGhz TXRX can only be loaded with files, makes sense as to save RAM
2020
Meal_Pager* app = context;
2121
UNUSED(app);
@@ -56,12 +56,10 @@ bool meal_pager_save_subghz_buffer_file_start(void* context, FlipperFormat* ff,
5656
success =
5757
flipper_format_write_header_cstr(
5858
ff, MEAL_PAGER_SUBGHZ_FILE_TYPE, MEAL_PAGER_SUBGHZ_FILE_VERSION) &&
59-
flipper_format_write_string_cstr(ff, "Frequency", MEAL_PAGER_SUBGHZ_FILE_FREQUENCY) &&
59+
flipper_format_write_string_cstr(ff, "Frequency", frequency) &&
6060
flipper_format_write_string_cstr(ff, "Preset", MEAL_PAGER_SUBGHZ_FILE_PRESET) &&
6161
flipper_format_write_string_cstr(ff, "Protocol", MEAL_PAGER_SUBGHZ_FILE_Protocol);
62-
//UNUSED(success);
6362
return success;
64-
//return ff;
6563
}
6664

6765
void meal_pager_save_subghz_buffer_stop(void* context, FlipperFormat* ff) {

non_catalog_apps/meal_pager/helpers/meal_pager_storage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
#define MEAL_PAGER_SUBGHZ_FILE_TYPE "Flipper SubGhz RAW File"
2626
#define MEAL_PAGER_SUBGHZ_FILE_VERSION 1
2727
#define MEAL_PAGER_SUBGHZ_FILE_FREQUENCY "433920000"
28+
#define MEAL_PAGER_SUBGHZ_FILE_ALT_FREQUENCY "433889000"
2829
#define MEAL_PAGER_SUBGHZ_FILE_PRESET "FuriHalSubGhzPresetOok650Async"
2930
#define MEAL_PAGER_SUBGHZ_FILE_Protocol "RAW"
3031

31-
bool meal_pager_save_subghz_buffer_file_start(void* context, FlipperFormat* ff, Storage* storage);
32+
bool meal_pager_save_subghz_buffer_file_start(void* context, FlipperFormat* ff, Storage* storage, char* frequency);
3233

3334
void meal_pager_save_subghz_buffer_stop(void* context, FlipperFormat* ff);
3435

non_catalog_apps/meal_pager/helpers/retekess/meal_pager_retekess_t119.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bool meal_pager_retekess_t119_generate_all(void* context) {
107107

108108
Storage* storage = furi_record_open(RECORD_STORAGE);
109109
FlipperFormat* ff = flipper_format_file_alloc(storage);
110-
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage);
110+
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage, MEAL_PAGER_SUBGHZ_FILE_FREQUENCY);
111111

112112
if(!success) {
113113
FURI_LOG_D(TAG, "failed to save to buffer");

non_catalog_apps/meal_pager/helpers/retekess/meal_pager_retekess_t119.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33

44
#include "../../meal_pager_i.h"
55
#include "../meal_pager_calc.h"
6+
#include "../meal_pager_storage.h"
67

78
bool meal_pager_retekess_t119_generate_all(void* context);

non_catalog_apps/meal_pager/helpers/retekess/meal_pager_retekess_td157.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ bool meal_pager_retekess_td157_generate_all(void* context) {
9393

9494
Storage* storage = furi_record_open(RECORD_STORAGE);
9595
FlipperFormat* ff = flipper_format_file_alloc(storage);
96-
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage);
96+
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage, MEAL_PAGER_SUBGHZ_FILE_FREQUENCY);
9797

9898
if(!success) {
9999
FURI_LOG_D(TAG, "failed to save to buffer");

non_catalog_apps/meal_pager/helpers/retekess/meal_pager_retekess_td157.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33

44
#include "../../meal_pager_i.h"
55
#include "../meal_pager_calc.h"
6+
#include "../meal_pager_storage.h"
67

78
bool meal_pager_retekess_td157_generate_all(void* context);
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
2+
#include "meal_pager_retekess_td165.h"
3+
4+
static char* genRawDataTD165(int zero, int one, const char* bits) {
5+
int bitsLen = strlen(bits);
6+
int lineLen = 256; // Adjust the line length as needed
7+
char* line = (char*)malloc(lineLen * sizeof(char));
8+
9+
// Initialize the line with the first part
10+
char* res = (char*)malloc(lineLen * sizeof(char));
11+
res[0] = '\0'; // Null-terminate the result string
12+
13+
customConcat(res, "-6000");
14+
15+
// Append bits and create the line
16+
for(int i = 0; i < bitsLen; i++) {
17+
char c = bits[i];
18+
int t = (c == '0') ? zero : one;
19+
20+
if(i % 2 == 0) {
21+
snprintf(line, lineLen, " %d", t);
22+
} else {
23+
snprintf(line, lineLen, " -%d", t);
24+
}
25+
26+
// Concatenate the line to the result string
27+
customConcat(res, line);
28+
}
29+
30+
// Append the closing part to the line
31+
customConcat(res, " 200 -6000");
32+
33+
free(line); // Free memory allocated for the line
34+
35+
return res;
36+
}
37+
38+
static void meal_pager_retekess_td165_generate_pager(
39+
void* context,
40+
char* stationId,
41+
uint32_t pager,
42+
FlipperFormat* ff) {
43+
Meal_Pager* app = context;
44+
char pagerId[11];
45+
char* fullId = (char*)malloc(25 * sizeof(char));
46+
uint32_t action = 0;
47+
char actionId[2];
48+
app->current_pager = pager;
49+
meal_pager_transmit_model_set_pager(app->meal_pager_transmit, app->current_pager);
50+
FURI_LOG_D(TAG, "Generating TD165 Data for Pager %lu", pager);
51+
uint32ToBinaray(pager, pagerId, 10);
52+
reverse(pagerId);
53+
customConcat(fullId, stationId);
54+
customConcat(fullId, pagerId);
55+
uint32ToBinaray(action, actionId, 1);
56+
reverse(actionId);
57+
customConcat(fullId, actionId);
58+
char* manchester = encManchester(fullId, 0);
59+
char* rawSignal = genRawDataTD165(200, 600, manchester);
60+
for(u_int32_t i = 1; app->repeats >= i; i++) {
61+
flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
62+
}
63+
free(manchester);
64+
free(rawSignal);
65+
}
66+
67+
static void
68+
meal_pager_retekess_td165_generate_station(void* context, uint32_t station, FlipperFormat* ff) {
69+
Meal_Pager* app = context;
70+
FURI_LOG_D(
71+
TAG,
72+
"Generating TD165 Data for Station %lu. Pagers From %lu to %lu",
73+
station,
74+
app->first_pager,
75+
app->last_pager);
76+
app->current_station = station;
77+
app->current_pager = app->first_pager;
78+
char stationId[14];
79+
uint32ToBinaray(station, stationId, 13);
80+
reverse(stationId);
81+
meal_pager_transmit_model_set_station(app->meal_pager_transmit, app->current_station);
82+
for(u_int32_t i = app->current_pager; i <= app->last_pager; i++) {
83+
meal_pager_retekess_td165_generate_pager(app, stationId, i, ff);
84+
if(app->stop_transmit) {
85+
break;
86+
}
87+
}
88+
}
89+
90+
bool meal_pager_retekess_td165_generate_all(void* context) {
91+
Meal_Pager* app = context;
92+
93+
app->current_pager = 1;
94+
app->current_station = app->first_station;
95+
96+
Storage* storage = furi_record_open(RECORD_STORAGE);
97+
FlipperFormat* ff = flipper_format_file_alloc(storage);
98+
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage, MEAL_PAGER_SUBGHZ_FILE_FREQUENCY);
99+
100+
if(!success) {
101+
FURI_LOG_D(TAG, "failed to save to buffer");
102+
meal_pager_save_subghz_buffer_stop(app, ff);
103+
furi_record_close(RECORD_STORAGE);
104+
return success;
105+
}
106+
107+
for(u_int32_t i = app->current_station; i <= app->last_station; i++) {
108+
meal_pager_retekess_td165_generate_station(app, i, ff);
109+
if(app->stop_transmit) {
110+
break;
111+
}
112+
}
113+
114+
meal_pager_save_subghz_buffer_stop(app, ff);
115+
furi_record_close(RECORD_STORAGE);
116+
return success;
117+
}

0 commit comments

Comments
 (0)