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"); } } }
static void hal_ota_save_crc16(uint16_t crc16) { aos_kv_set(KV_HAL_OTA_CRC16, &crc16, 2, 1); }
int be_osal_kv_set(const char *key, const void *value, int len, int sync) { return aos_kv_set(key, value, len, sync); }