wz_mini_hacks/libcallback_wz_mod/irled.c

25 lines
600 B
C
Raw Normal View History

2022-05-07 08:23:49 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern int local_sdk_close_night_light();
extern int local_sdk_open_night_light();
extern int local_sdk_auto_night_light();
extern void CommandResponse(int fd, const char *res);
char *IrLed(int fd, char *tokenPtr) {
char *p = strtok_r(NULL, " \t\r\n", &tokenPtr);
if(!p) return "error";
if(!strcmp(p, "on")) {
local_sdk_open_night_light();
} else if(!strcmp(p, "off")) {
local_sdk_close_night_light();
} else if(!strcmp(p, "auto")) {
local_sdk_auto_night_light();
} else {
return "error";
}
return "ok";
}