/**************************************************************************** Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT be copied by any method or incorporated into another program without the express written consent of Aerospace C.Power. This Information or any portion thereof remains the property of Aerospace C.Power. The Information contained herein is believed to be accurate and Aerospace C.Power assumes no responsibility or liability for its use in any way and conveys no license or title under any patent or copyright and makes no representation or warranty that this Information is free from patent or copyright infringement. ****************************************************************************/ #include "iot_errno_api.h" #include "iot_app_pib_sta_api.h" #if PLC_SUPPORT_STA_ROLE extern app_pib_rw_t *iot_get_rw_pib_info(void); uint8_t iot_app_get_scan_band_in_pib(uint8_t **scan_band_bitmap) { app_pib_rw_t *pib_rw = iot_get_rw_pib_info(); *scan_band_bitmap = NULL; if (pib_rw == NULL) { return 0; } if (pib_rw->scan_band_valid) { *scan_band_bitmap = pib_rw->scan_band_bitmap; return IOT_PLC_BAND_BITMAP_SIZE; } return 0; } uint8_t iot_app_save_scan_band_to_pib(uint8_t *scan_band, uint32_t size) { uint16_t ticket; uint8_t ref; app_pib_rw_t *pib_rw = iot_get_rw_pib_info(); if (pib_rw == NULL) { return ERR_FAIL; } if (size != IOT_PLC_BAND_BITMAP_SIZE) { return ERR_FAIL; } iot_pib_acquire_app_commit_ref(&ref); pib_rw->scan_band_valid = 1; os_mem_cpy(pib_rw->scan_band_bitmap, scan_band, size); iot_pib_release_app_commit_ref(&ref); iot_pib_app_commit(&ticket); return ERR_OK; } #else /* PLC_SUPPORT_STA_ROLE */ uint8_t iot_app_get_scan_band_in_pib(uint8_t **scan_band_bitmap) { /* cco not support */ (void)scan_band_bitmap; return 0; } uint8_t iot_app_save_scan_band_to_pib(uint8_t *scan_band, uint32_t size) { /* cco not support */ (void)scan_band; (void)size; return ERR_FAIL; } #endif /* PLC_SUPPORT_STA_ROLE */