mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-26 23:27:18 +00:00
25 lines
600 B
C
25 lines
600 B
C
|
#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";
|
||
|
}
|