forked from u-blox/XPLR-IOT-1-software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx_led_func_shell_cmds.c
74 lines (58 loc) · 3.07 KB
/
x_led_func_shell_cmds.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright 2022 u-blox Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file
* @brief This file contains "functions" and "leds" shell commands
* implementation and defines the shell commands structure for the those
* root commands of the XPLR-IOT-1 Sensor Aggregation Use Case
*/
#include <shell/shell.h>
#include "x_sensor_aggregation_function.h"
#include "x_led.h"
#include "x_system_conf.h"
/* ----------------------------------------------------------------
* COMMAND FUNCTION IMPLEMENTATION (STATIC)
* -------------------------------------------------------------- */
void xFirmwareVersionType(const struct shell *shell, size_t argc, char **argv){
shell_print(shell, "Firmware Version: %d.%d\r\n", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR );
}
/* ----------------------------------------------------------------
* DEFINE MODULES SHELL COMMAND MENU
* -------------------------------------------------------------- */
/* Creating subcommands (level 1 command) array for command "led". */
SHELL_STATIC_SUBCMD_SET_CREATE(sub_led,
SHELL_CMD(off, NULL, "Led off", xLedOff),
SHELL_CMD(on, NULL, "Led on <color>", xLedOnCmd),
SHELL_CMD(blink, NULL, "blink <color> <times>", xLedBlinkCmd),
SHELL_CMD(fade, NULL, "Fade", xLedFadeCmd),
SHELL_SUBCMD_SET_END
);
/* Creating subcommands (level 1 command) array for command "functions". */
SHELL_STATIC_SUBCMD_SET_CREATE(sub_functions,
SHELL_CMD(wifi_start, NULL, "Start Sensor Aggregation via wifi", xSensorAggregationStartWifi),
SHELL_CMD(wifi_stop, NULL, "Stop Sensor Aggregation via wifi", xSensorAggregationStopWifi),
SHELL_CMD(cell_start, NULL, "Start Sensor Aggregation via cellular", xSensorAggregationStartCell),
SHELL_CMD(cell_stop, NULL, "Stop Sensor Aggregation via cellular", xSensorAggregationStopCell),
SHELL_CMD(status, NULL, "Get the status of Sensor Aggregation Function", xSensorAggregationTypeStatusCmd),
SHELL_CMD(set_period, NULL, "Set the sampling period of Sensor Aggregation Function", xSensorAggregationSetUpdatePeriodCmd),
//SHELL_CMD(NINAW156, &NINAW156, "NINAW156 control", NULL),
SHELL_SUBCMD_SET_END
);
/* Creating root (level 0) command "functions" without a handler */
SHELL_CMD_REGISTER(functions, &sub_functions, "C210 Sensor Aggragetion Main Functions", NULL);
/* Creating root (level 0) command "led" without a handler */
SHELL_CMD_REGISTER(led, &sub_led, "C210 Led testing", NULL);
/* Creating root (level 0) command "version" */
SHELL_CMD_REGISTER(version, NULL, "Get firmware version", xFirmwareVersionType );