Beispiel #1
0
static void handle_model_cmd(char *pwbuf, int blen, int argc, char **argv)
{
    #define MAX_MODEL_LENGTH 30
    char model[MAX_MODEL_LENGTH] = "light";
    int  model_len = sizeof(model);
    aos_kv_get("model", model, &model_len);

    if (argc == 1) {
        aos_cli_printf("Usage: model light/gateway. Model is currently %s\r\n", model);
        return;
    }

    if (strcmp(argv[1], "gateway") == 0) {
        if (strcmp(model, argv[1])) {
            aos_kv_del("alink");
            aos_kv_set("model", "gateway", sizeof("gateway"), 1);
            aos_cli_printf("Swith model to gateway, please reboot\r\n");
        } else {
            aos_cli_printf("Current model is already gateway\r\n");
        }
    } else {
        if (strcmp(model, argv[1])) {
            aos_kv_del("alink");
            aos_kv_set("model", "light", sizeof("light"), 1);
            aos_cli_printf("Swith model to light, please reboot\r\n");
        } else {
            aos_cli_printf("Current model is already light\r\n");
        }
    }
}
Beispiel #2
0
static void  hal_ota_save_crc16(uint16_t crc16)
{
    aos_kv_set(KV_HAL_OTA_CRC16, &crc16, 2, 1);
}
Beispiel #3
0
int be_osal_kv_set(const char *key, const void *value, int len, int sync)
{
	return aos_kv_set(key, value, len, sync);
}