当前位置: 首页>>代码示例>>C++>>正文


C++ ARM_CFSTORE_DRIVER::GetValueLen方法代码示例

本文整理汇总了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;
}
开发者ID:AlessandroA,项目名称:mbed,代码行数:63,代码来源:cfstore_test.c


注:本文中的ARM_CFSTORE_DRIVER::GetValueLen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。