本文整理汇总了C++中ARM_CFSTORE_DRIVER::GetValueLen方法的典型用法代码示例。如果您正苦于以下问题:C++ ARM_CFSTORE_DRIVER::GetValueLen方法的具体用法?C++ ARM_CFSTORE_DRIVER::GetValueLen怎么用?C++ ARM_CFSTORE_DRIVER::GetValueLen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARM_CFSTORE_DRIVER
的用法示例。
在下文中一共展示了ARM_CFSTORE_DRIVER::GetValueLen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cfstore_test_dump
/* @brief function to dump contents of cfstore
*/
int32_t cfstore_test_dump(void)
{
const char* key_name_query = "*";
char* read_buf = NULL;
char key_name[CFSTORE_KEY_NAME_MAX_LENGTH+1];
uint8_t len = CFSTORE_KEY_NAME_MAX_LENGTH+1;
ARM_CFSTORE_SIZE vlen = 0;
int32_t ret = ARM_DRIVER_ERROR;
ARM_CFSTORE_DRIVER* drv = &cfstore_driver;
ARM_CFSTORE_HANDLE_INIT(next);
ARM_CFSTORE_HANDLE_INIT(prev);
ARM_CFSTORE_CAPABILITIES caps = cfstore_driver.GetCapabilities();
CFSTORE_FENTRYLOG("%s:entered\n", __func__);
CFSTORE_LOG("CFSTORE Flash Entries%s", "\n");
CFSTORE_LOG("=====================%s", "\n\n");
while((ret = drv->Find(key_name_query, prev, next)) == ARM_DRIVER_OK)
{
len = CFSTORE_KEY_NAME_MAX_LENGTH+1;
ret = drv->GetKeyName(next, key_name, &len);
if(ret < ARM_DRIVER_OK){
CFSTORE_ERRLOG("Error: failed to get key name%s", "\n");
break;
}
ret = drv->GetValueLen(next, &vlen);
if(ret < ARM_DRIVER_OK){
CFSTORE_ERRLOG("Error: failed to get value length%s", "\n");
break;
}
read_buf = (char*) malloc(vlen+1);
if(read_buf == NULL){
CFSTORE_ERRLOG("Error: failed to malloc() read buffer%s", "\n");
break;
}
ret = drv->Read(next, read_buf, &vlen);
if(ret < ARM_DRIVER_OK){
CFSTORE_ERRLOG("Error: failed to read key value%s", "\n");
free(read_buf);
break;
}
CFSTORE_LOG(" keyname : %s\n", key_name);
CFSTORE_LOG(" name len : %d\n", (int) len);
CFSTORE_LOG(" value len : %d\n", (int) vlen);
CFSTORE_LOG(" data :%s", "\n");
cfstore_test_dump_print_array((const char*) read_buf, vlen);
CFSTORE_LOG("%s", ".\n");
free(read_buf);
CFSTORE_HANDLE_SWAP(prev, next);
}
CFSTORE_LOG("%s", ".\n");
CFSTORE_LOG(" caps.asynchronous_ops : %d\n", (int) caps.asynchronous_ops);
CFSTORE_LOG("%s", ".\n");
CFSTORE_LOG("== End ==============%s", "\n\n");
if(ret == ARM_CFSTORE_DRIVER_ERROR_KEY_NOT_FOUND) {
/* As expected, no more keys have been found by the Find(). */
ret = ARM_DRIVER_OK;
}
return ret;
}