Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit dfbbaae

Browse files
committed
Remove event fname
1 parent de20f54 commit dfbbaae

3 files changed

Lines changed: 50 additions & 97 deletions

File tree

src/event.cpp

Lines changed: 21 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -77,54 +77,41 @@ static void on_movie_end_command(ctx_dev *cam, char *fname)
7777
}
7878
}
7979

80-
static void on_motion_detected_command(ctx_dev *cam, char *fname)
80+
static void on_motion_detected_command(ctx_dev *cam)
8181
{
82-
(void)fname;
83-
8482
if (cam->conf->on_motion_detected != "") {
8583
util_exec_command(cam, cam->conf->on_motion_detected.c_str(), NULL);
8684
}
8785
}
8886

89-
static void on_area_command(ctx_dev *cam, char *fname)
87+
static void on_area_command(ctx_dev *cam)
9088
{
91-
(void)fname;
92-
9389
if (cam->conf->on_area_detected != "") {
9490
util_exec_command(cam, cam->conf->on_area_detected.c_str(), NULL);
9591
}
9692
}
9793

98-
static void on_event_start_command(ctx_dev *cam, char *fname)
94+
static void on_event_start_command(ctx_dev *cam)
9995
{
100-
(void)fname;
101-
10296
if (cam->conf->on_event_start != "") {
10397
util_exec_command(cam, cam->conf->on_event_start.c_str(), NULL);
10498
}
10599
}
106100

107-
static void on_event_end_command(ctx_dev *cam, char *fname)
101+
static void on_event_end_command(ctx_dev *cam)
108102
{
109-
(void)fname;
110-
111103
if (cam->conf->on_event_end != "") {
112104
util_exec_command(cam, cam->conf->on_event_end.c_str(), NULL);
113105
}
114106
}
115107

116-
static void event_stream_put(ctx_dev *cam, char *fname)
108+
static void event_stream_put(ctx_dev *cam)
117109
{
118-
(void)fname;
119-
120110
webu_stream_getimg(cam);
121111
}
122112

123-
124-
static void event_vlp_putpipe(ctx_dev *cam, char *fname)
113+
static void event_vlp_putpipe(ctx_dev *cam)
125114
{
126-
(void)fname;
127-
128115
if (cam->pipe >= 0) {
129116
if (vlp_putpipe(cam->pipe
130117
, cam->current_image->image_norm
@@ -135,10 +122,8 @@ static void event_vlp_putpipe(ctx_dev *cam, char *fname)
135122
}
136123
}
137124

138-
static void event_vlp_putpipem(ctx_dev *cam, char *fname)
125+
static void event_vlp_putpipem(ctx_dev *cam)
139126
{
140-
(void)fname;
141-
142127
if (cam->mpipe >= 0) {
143128
if (vlp_putpipe(cam->mpipe
144129
, cam->imgs.image_motion.image_norm
@@ -149,14 +134,12 @@ static void event_vlp_putpipem(ctx_dev *cam, char *fname)
149134
}
150135
}
151136

152-
static void event_image_detect(ctx_dev *cam, char *fname)
137+
static void event_image_detect(ctx_dev *cam)
153138
{
154139
char fullfilename[PATH_MAX];
155140
char filename[PATH_MAX];
156141
int passthrough, retcd;
157142

158-
(void)fname;
159-
160143
if (cam->new_img & NEWIMG_ON) {
161144
mystrftime(cam, filename, sizeof(filename)
162145
, cam->conf->picture_filename.c_str()
@@ -181,14 +164,12 @@ static void event_image_detect(ctx_dev *cam, char *fname)
181164
}
182165
}
183166

184-
static void event_imagem_detect(ctx_dev *cam, char *fname)
167+
static void event_imagem_detect(ctx_dev *cam)
185168
{
186169
char fullfilename[PATH_MAX];
187170
char filename[PATH_MAX];
188171
int retcd;
189172

190-
(void)fname;
191-
192173
if (cam->conf->picture_output_motion == "on") {
193174
mystrftime(cam, filename, sizeof(filename)
194175
, cam->conf->picture_filename.c_str()
@@ -225,16 +206,14 @@ static void event_imagem_detect(ctx_dev *cam, char *fname)
225206
}
226207
}
227208

228-
static void event_image_snapshot(ctx_dev *cam, char *fname)
209+
static void event_image_snapshot(ctx_dev *cam)
229210
{
230211
char fullfilename[PATH_MAX];
231212
char filename[PATH_MAX];
232213
char filepath[PATH_MAX];
233214
char linkpath[PATH_MAX];
234215
int offset, retcd, passthrough;
235216

236-
(void)fname;
237-
238217
offset = (int)cam->conf->snapshot_filename.length() - 8;
239218
if (offset < 0) {
240219
offset = 1;
@@ -306,15 +285,13 @@ static void event_image_snapshot(ctx_dev *cam, char *fname)
306285
cam->snapshot = 0;
307286
}
308287

309-
static void event_image_preview(ctx_dev *cam, char *fname)
288+
static void event_image_preview(ctx_dev *cam)
310289
{
311290
char previewname[PATH_MAX];
312291
char filename[PATH_MAX];
313292
ctx_image_data *saved_current_image;
314293
int passthrough, retcd;
315294

316-
(void)fname;
317-
318295
if (cam->imgs.image_preview.diffs) {
319296
saved_current_image = cam->current_image;
320297
cam->current_image = &cam->imgs.image_preview;
@@ -345,41 +322,33 @@ static void event_image_preview(ctx_dev *cam, char *fname)
345322
}
346323
}
347324

348-
static void event_camera_lost(ctx_dev *cam, char *fname)
325+
static void event_camera_lost(ctx_dev *cam)
349326
{
350-
(void)fname;
351-
352327
if (cam->conf->on_camera_lost != "") {
353328
util_exec_command(cam, cam->conf->on_camera_lost.c_str(), NULL);
354329
}
355330
}
356331

357-
static void event_secondary_detect(ctx_dev *cam, char *fname)
332+
static void event_secondary_detect(ctx_dev *cam)
358333
{
359-
(void)fname;
360-
361334
MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO,_("Event secondary detect"));
362335

363336
if (cam->conf->on_secondary_detect != "") {
364337
util_exec_command(cam, cam->conf->on_secondary_detect.c_str(), NULL);
365338
}
366339
}
367340

368-
static void event_camera_found(ctx_dev *cam, char *fname)
341+
static void event_camera_found(ctx_dev *cam)
369342
{
370-
(void)fname;
371-
372343
if (cam->conf->on_camera_found != "") {
373344
util_exec_command(cam, cam->conf->on_camera_found.c_str(), NULL);
374345
}
375346
}
376347

377-
static void event_movie_start(ctx_dev *cam, char *fname)
348+
static void event_movie_start(ctx_dev *cam)
378349
{
379350
int retcd;
380351

381-
(void)fname;
382-
383352
cam->movie_start_time = cam->frame_curr_ts.tv_sec;
384353

385354
if (cam->lastrate < 2) {
@@ -427,10 +396,8 @@ static void event_movie_start(ctx_dev *cam, char *fname)
427396
}
428397
}
429398

430-
static void event_movie_put(ctx_dev *cam, char *fname)
399+
static void event_movie_put(ctx_dev *cam)
431400
{
432-
(void)fname;
433-
434401
if (cam->movie_norm) {
435402
if (movie_put_image(cam->movie_norm
436403
, cam->current_image
@@ -454,12 +421,10 @@ static void event_movie_put(ctx_dev *cam, char *fname)
454421

455422
}
456423

457-
static void event_movie_end(ctx_dev *cam, char *fname)
424+
static void event_movie_end(ctx_dev *cam)
458425
{
459426
int retcd;
460427

461-
(void)fname;
462-
463428
if (cam->movie_norm) {
464429
cam->filetype = FTYPE_MOVIE;
465430
on_movie_end_command(cam, cam->movie_norm->full_nm);
@@ -526,12 +491,10 @@ static void event_movie_end(ctx_dev *cam, char *fname)
526491
}
527492
}
528493

529-
static void event_tlapse_start(ctx_dev *cam, char *fname)
494+
static void event_tlapse_start(ctx_dev *cam)
530495
{
531496
int retcd;
532497

533-
(void)fname;
534-
535498
if (!cam->movie_timelapse) {
536499
retcd = movie_init_timelapse(cam);
537500
if (retcd < 0) {
@@ -552,10 +515,8 @@ static void event_tlapse_start(ctx_dev *cam, char *fname)
552515

553516
}
554517

555-
static void event_tlapse_end(ctx_dev *cam, char *fname)
518+
static void event_tlapse_end(ctx_dev *cam)
556519
{
557-
(void)fname;
558-
559520
if (cam->movie_timelapse) {
560521
cam->filetype = FTYPE_MOVIE_TIMELAPSE;
561522
on_movie_end_command(cam, cam->movie_timelapse->full_nm);
@@ -663,21 +624,13 @@ struct event_handlers event_handlers[] = {
663624
};
664625

665626

666-
/**
667-
* event
668-
* defined with the following parameters:
669-
* - Type as defined in event.h (EVENT_...)
670-
* - The global context struct cam
671-
* - filename - A pointer to typically a string for a file path
672-
* - eventdata - A void pointer that can be cast to anything. E.g. FTYPE_...
673-
*/
674-
void event(ctx_dev *cam, motion_event evnt, char *fname)
627+
void event(ctx_dev *cam, motion_event evnt)
675628
{
676629
int i=-1;
677630

678631
while (event_handlers[++i].handler) {
679632
if (evnt == event_handlers[i].type) {
680-
event_handlers[i].handler(cam, fname);
633+
event_handlers[i].handler(cam);
681634
}
682635
}
683636
}

src/event.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ typedef enum {
4242
EVENT_LAST,
4343
} motion_event;
4444

45-
typedef void(* event_handler)(ctx_dev *cam, char *fname);
45+
typedef void(* event_handler)(ctx_dev *cam);
4646

47-
void event(ctx_dev *cam, motion_event evnt, char *fname);
47+
void event(ctx_dev *cam, motion_event evnt);
4848

4949
#endif /* _INCLUDE_EVENT_HPP_ */

0 commit comments

Comments
 (0)