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


C++ require_noerr_action函数代码示例

本文整理汇总了C++中require_noerr_action函数的典型用法代码示例。如果您正苦于以下问题:C++ require_noerr_action函数的具体用法?C++ require_noerr_action怎么用?C++ require_noerr_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了require_noerr_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MVDInit

OSStatus MVDInit(mico_Context_t* const inContext)
{
  OSStatus err = kUnknownErr;
  
  //init MVD status
  inContext->appStatus.virtualDevStatus.isCloudConnected = false;
  inContext->appStatus.virtualDevStatus.RecvRomFileSize = 0;
  
  //init MCU connect interface
  //err = MVDDevInterfaceInit(inContext);
  //require_noerr_action(err, exit, 
  //                     mvd_log("ERROR: virtual device mcu interface init failed!") );
  
  //init cloud service interface
  err = MVDCloudInterfaceInit(inContext);
  require_noerr_action(err, exit, 
                       mvd_log("ERROR: virtual device cloud interface init failed!") );
  
  // wifi notify
  err = mico_rtos_init_semaphore(&_wifi_station_on_sem, 1);
  require_noerr_action(err, exit, 
                       mvd_log("ERROR: mico_rtos_init_semaphore (_wifi_station_on_sem) failed!") );
  
  err = MICOAddNotification( mico_notify_WIFI_STATUS_CHANGED, (void *)mvdNotify_WifiStatusHandler );
  require_noerr_action(err, exit, 
                       mvd_log("ERROR: MICOAddNotification (mico_notify_WIFI_STATUS_CHANGED) failed!") );
 
  // start MVD main thread
  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "MVD main", 
                                MVDMainThread, STACK_SIZE_MVD_MAIN_THREAD, 
                                inContext );
  
exit:
  return err;
}
开发者ID:287631983,项目名称:MICO,代码行数:35,代码来源:MicoVirtualDevice.c

示例2: application_start

int application_start(void)
{
    app_log_trace();
    OSStatus err = kNoErr;
    mico_uart_config_t uart_config;
    app_context_t* app_context;
    mico_Context_t* mico_context;

    /* Create application context */
    app_context = ( app_context_t *)calloc(1, sizeof(app_context_t) );
    require_action( app_context, exit, err = kNoMemoryErr );

    /* Create mico system context and read application's config data from flash */
    mico_context = mico_system_context_init( sizeof( application_config_t) );
    app_context->appConfig = mico_system_context_get_user_data( mico_context );

    /* mico system initialize */
    err = mico_system_init( mico_context );
    require_noerr( err, exit );

    /* Bonjour for service searching */
    MICOStartBonjourService( Station, app_context );

    /* Protocol initialize */
    sppProtocolInit( app_context );

    /*UART receive thread*/
    uart_config.baud_rate    = app_context->appConfig->USART_BaudRate;
    uart_config.data_width   = DATA_WIDTH_8BIT;
    uart_config.parity       = NO_PARITY;
    uart_config.stop_bits    = STOP_BITS_1;
    uart_config.flow_control = FLOW_CONTROL_DISABLED;
    if(mico_context->flashContentInRam.micoSystemConfig.mcuPowerSaveEnable == true)
        uart_config.flags = UART_WAKEUP_ENABLE;
    else
        uart_config.flags = UART_WAKEUP_DISABLE;
    
    ring_buffer_init  ( (ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, UART_BUFFER_LENGTH );
    MicoUartInitialize( UART_FOR_APP, &uart_config, (ring_buffer_t *)&rx_buffer );
    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, STACK_SIZE_UART_RECV_THREAD, (void*)app_context );
    require_noerr_action( err, exit, app_log("ERROR: Unable to start the uart recv thread.") );

    /* Local TCP server thread */
    if(app_context->appConfig->localServerEnable == true)
    {
        err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, STACK_SIZE_LOCAL_TCP_SERVER_THREAD, (void*)app_context );
        require_noerr_action( err, exit, app_log("ERROR: Unable to start the local server thread.") );
    }

    /* Remote TCP client thread */
    if(app_context->appConfig->remoteServerEnable == true)
    {
        err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Remote Client", remoteTcpClient_thread, STACK_SIZE_REMOTE_TCP_CLIENT_THREAD, (void*)app_context );
        require_noerr_action( err, exit, app_log("ERROR: Unable to start the remote client thread.") );
    }

exit:
    mico_rtos_delete_thread(NULL);
    return err;
}
开发者ID:xlfdan,项目名称:SDK_MiCOKit_v2.3.0.2,代码行数:60,代码来源:MICOAppEntrance.c

示例3: MICOStartApplication

/* MICO APP entrance */
OSStatus MICOStartApplication( mico_Context_t * const mico_context )
{
  app_log_trace();
  OSStatus err = kNoErr;
    
  require_action(mico_context, exit, err = kParamErr);
    
  // LED on when Wi-Fi connected.
  MicoSysLed(false);
    
  /* Bonjour for service searching */
  if(mico_context->flashContentInRam.micoSystemConfig.bonjourEnable == true) {
    MICOStartBonjourService( Station, mico_context );
  }
  
  /* start cloud service */
#if (MICO_CLOUD_TYPE == CLOUD_FOGCLOUD)
  err = MicoStartFogCloudService( mico_context );
  app_log("MICO CloudService: FogCloud.");
  require_noerr_action( err, exit, app_log("ERROR: Unable to start FogCloud service.") );
#elif (MICO_CLOUD_TYPE == CLOUD_ALINK)
  app_log("MICO CloudService: Alink.");
#elif (MICO_CLOUD_TYPE == CLOUD_DISABLED)
  app_log("MICO CloudService: disabled.");
#else
  #error "MICO cloud service type is not defined"?
#endif
  
  /* start user thread */
  err = startUserMainThread( mico_context );
  require_noerr_action( err, exit, app_log("ERROR: start user_main thread failed!") );

exit:
  return err;
}
开发者ID:hujg,项目名称:mico_v2.2.0,代码行数:36,代码来源:MICOAppEntrance.c

示例4: HealthInit

OSStatus HealthInit(app_context_t *app_context)
{
    u8 idx;
    OSStatus err;
    
    for(idx = 0; idx < MAX_DEPTH_PUTDOWN; idx++) {
        putdown_timer[idx].index = idx;
    }

    // check if schedule remind timneout every 1 minute
    for(idx = 0; idx < MAX_DEPTH_SCHEDULE; idx++) {
        schedule_timer[idx].index = idx;
        err = mico_init_timer(&schedule_timer[idx].timer, 60*UpTicksPerSecond(), ScheduleTimeout, &schedule_timer[idx]);
        if(kNoErr != err) {
            user_log("[ERR]HealthInit: create schedule_timer[%d] failed", idx);
        }
        else {
            user_log("[DBG]HealthInit: create schedule_timer[%d] success", idx);
        }

        err = mico_start_timer(&schedule_timer[idx].timer);
        if(kNoErr != err) {
            user_log("[ERR]HealthInit: start schedule_timer[%d] failed", idx);
        }
        else {
            user_log("[DBG]HealthInit: start schedule_timer[%d] success", idx);
        }
    }

#if 0
    // initialize if outTrigger is implement by semaphore
    err = mico_rtos_init_semaphore(&semaphore_getup, 1);
    require_noerr_action(err, exit, user_log("[ERR]HealthInit: create semaphore_getup failed"));
    user_log("[DBG]HealthInit: create semaphore_getup success");

    err = mico_rtos_init_semaphore(&semaphore_putdown, 1);
    require_noerr_action(err, exit, user_log("[ERR]HealthInit: create semaphore_putdown failed"));
    user_log("[DBG]HealthInit: create semaphore_putdown success");
#endif

/*
    err = mico_init_timer(&timer_health_notify, 2*UpTicksPerSecond(), MOChangedNotification, app_context);
    require_noerr_action(err, exit, user_log("[ERR]HealthInit: create timer_health_notify failed"));
    user_log("[DBG]HealthInit: create timer_health_notify success");

    err = mico_start_timer(&timer_health_notify);
    require_noerr_action(err, exit, user_log("[ERR]HealthInit: start timer_health_notify failed"));
    user_log("[DBG]HealthInit: start timer_health_notify success");
*/

    // start the health monitor thread
    err = mico_rtos_create_thread(&health_monitor_thread_handle, MICO_APPLICATION_PRIORITY, "health_monitor", 
                                  health_thread, STACK_SIZE_HEALTH_THREAD, 
                                  app_context);
    require_noerr_action( err, exit, user_log("[ERR]HealthInit: create health thread failed!"));
    user_log("[DBG]HealthInit: create health thread success!");
    
exit:
    return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:60,代码来源:HealthMonitor.c

示例5: MICOStartApplication

OSStatus MICOStartApplication( mico_Context_t * const inContext )
{
  app_log_trace();

  OSStatus err = kNoErr;
  require_action(inContext, exit, err = kParamErr);

  haProtocolInit(inContext);
  PlatformUartInitialize(inContext);

  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, 0x500, (void*)inContext );
  require_noerr_action( err, exit, app_log("ERROR: Unable to start the uart recv thread.") );

 if(inContext->flashContentInRam.appConfig.localServerEnable == true){
   err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, 0x200, (void*)inContext );
   require_noerr_action( err, exit, app_log("ERROR: Unable to start the local server thread.") );
 }

 if(inContext->flashContentInRam.appConfig.remoteServerEnable == true){
   err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Remote Client", remoteTcpClient_thread, 0x500, (void*)inContext );
   require_noerr_action( err, exit, app_log("ERROR: Unable to start the remote client thread.") );
 }

exit:
  return err;
}
开发者ID:dks5826350,项目名称:MICO,代码行数:26,代码来源:MICOAppEntrance.c

示例6: ConfigSoftApWillStart

void ConfigSoftApWillStart(mico_Context_t * const inContext )
{
  OSStatus err;
  mico_uart_config_t uart_config;

  mico_stop_timer(&_Led_EL_timer);
  mico_deinit_timer( &_Led_EL_timer );
  mico_init_timer(&_Led_EL_timer, SYS_LED_TRIGGER_INTERVAL_AFTER_EASYLINK, _led_EL_Timeout_handler, NULL);
  mico_start_timer(&_Led_EL_timer);
  
  sppProtocolInit(inContext);
  
   /*UART receive thread*/
  uart_config.baud_rate    = inContext->flashContentInRam.appConfig.USART_BaudRate;
  uart_config.data_width   = DATA_WIDTH_8BIT;
  uart_config.parity       = NO_PARITY;
  uart_config.stop_bits    = STOP_BITS_1;
  uart_config.flow_control = FLOW_CONTROL_DISABLED;
  ring_buffer_init  ( (ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, UART_BUFFER_LENGTH );
  MicoUartInitialize( UART_FOR_APP, &uart_config, (ring_buffer_t *)&rx_buffer );
  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, STACK_SIZE_UART_RECV_THREAD, (void*)inContext );
  require_noerr_action( err, exit, config_delegate_log("ERROR: Unable to start the uart recv thread.") );

 if(inContext->flashContentInRam.appConfig.localServerEnable == true){
   err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, STACK_SIZE_LOCAL_TCP_SERVER_THREAD, (void*)inContext );
   require_noerr_action( err, exit, config_delegate_log("ERROR: Unable to start the local server thread.") );
 }

exit:
  return;
}
开发者ID:brucehelen,项目名称:MICO,代码行数:31,代码来源:MICOConfigDelegate.c

示例7: user_main

/* user main function, called by AppFramework.
 */
OSStatus user_main( app_context_t * const app_context )
{
  user_log_trace();
  OSStatus err = kUnknownErr;
  
  user_log("User main thread start...");
  
  // start prop get/set thread
  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "prop_recv", property_recv, 
                                STACK_SIZE_PROP_RECV_THREAD, (void*)app_context);
  require_noerr_action( err, exit, user_log("ERROR: Unable to start the prop_recv thread.") );
  
  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "prop_update", property_update, 
                                STACK_SIZE_PROP_UPDATE_THREAD, (void*)app_context);
  require_noerr_action( err, exit, user_log("ERROR: Unable to start the prop_update thread.") );

  /* main loop for user display */
  while(1){
    // system work state show on OLED
    system_state_display(app_context);
    mico_thread_sleep(1);
  }
  
exit:
  user_log("ERROR: user_main exit with err=%d", err);
  return err;
}
开发者ID:HargicStudio,项目名称:SmartCup_MiCOKit_v2.4.0.0,代码行数:29,代码来源:user_main.c

示例8: MicoStartFogCloudService

OSStatus MicoStartFogCloudService(mico_Context_t* const inContext)
{
  OSStatus err = kUnknownErr;
  
  //init MicoFogCloud status
  inContext->appStatus.fogcloudStatus.isCloudConnected = false;
  inContext->appStatus.fogcloudStatus.RecvRomFileSize = 0;
  inContext->appStatus.fogcloudStatus.isActivated = inContext->flashContentInRam.appConfig.fogcloudConfig.isActivated;
  inContext->appStatus.fogcloudStatus.isOTAInProgress = false;
  
  //init fogcloud service interface
  err = fogCloudInit(inContext);
  require_noerr_action(err, exit, 
                       fogcloud_log("ERROR: FogCloud interface init failed!") );
  
  err = MICOAddNotification( mico_notify_WIFI_STATUS_CHANGED, (void *)fogNotify_WifiStatusHandler );
  require_noerr_action(err, exit, 
                       fogcloud_log("ERROR: MICOAddNotification (mico_notify_WIFI_STATUS_CHANGED) failed!") );
  
  // start MicoFogCloud main thread (dev reset && ota check, then start fogcloud service)
  err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "fog_main", 
                                fogcloud_main_thread, STACK_SIZE_FOGCLOUD_MAIN_THREAD, 
                                inContext );
  
exit:
  return err;
}
开发者ID:bangkr,项目名称:MiCO_ELink407,代码行数:27,代码来源:MicoFogCloud.c

示例9: user_uartInit

OSStatus user_uartInit(void)
{
    OSStatus err = kUnknownErr;
    mico_uart_config_t uart_config;

    //USART init
    uart_config.baud_rate    = 115200;
    uart_config.data_width   = DATA_WIDTH_8BIT;
    uart_config.parity       = NO_PARITY;
    uart_config.stop_bits    = STOP_BITS_1;
    uart_config.flow_control = FLOW_CONTROL_DISABLED;
    uart_config.flags = UART_WAKEUP_DISABLE;
    ring_buffer_init  ( (ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, USER_UART_BUFFER_LENGTH );

    MicoUartInitialize( USER_UART, &uart_config, (ring_buffer_t *)&rx_buffer );

    //USART receive thread		启动uart接收线程
    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv",
                                  uartRecv_thread, STACK_SIZE_USART_RECV_THREAD,
                                  NULL );
    require_noerr_action( err, exit, user_uart_log("ERROR: Unable to start the USART recv thread.") );


    //ZCB Msg Handle Thread		启动 ZCB Msg 处理线程
    err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "ZCB Msg Handle",
                                  ZCB_MessageHandle_thread, STACK_SIZE_ZCBMSG_HANDLE_THREAD,
                                  NULL );
    require_noerr_action( err, exit, user_uart_log("ERROR: Unable to start the zcbMsg hdl thread.") );


    return kNoErr;

exit:
    return err;
}
开发者ID:ilittlerui,项目名称:SDK_MiCOKit_v2.3.0.2,代码行数:35,代码来源:user_uart.c

示例10: user_main

/* user main function, called by AppFramework.
 */
OSStatus user_main( app_context_t * const app_context )
{
  user_log_trace();
  OSStatus err = kUnknownErr;
  
  user_log("User main task start...");
  
  
  
  err = user_uartInit();
  require_noerr_action( err, exit, user_log("ERROR: user_uartInit err = %d.", err) );
 
  
  
  user_log("start photo...");
  unsigned char* image="hello world";
  user_uartSend( image,strlen(image));
  char aa[200];
  
  memset(aa, '\0', 200);
  
  mico_thread_sleep(5);
  
  int len=user_uartRecv((unsigned char *)aa, 200);
  user_log("uart_data_recv: [%d][%.*s]", len,  len,(unsigned char*)aa);
  user_log("end...");
  
  
 
#if (MICO_CLOUD_TYPE != CLOUD_DISABLED)
  /* start fogcloud msg handle task */
  err = start_fog_msg_handler(app_context);
  require_noerr_action( err, exit, user_log("ERROR: start_fog_msg_handler err = %d.", err) );

  /* start properties notify task(upload data) */
  err = mico_start_properties_notify(app_context, service_table, 
                                     MICO_PROPERTIES_NOTIFY_INTERVAL_MS, 
                                     STACK_SIZE_NOTIFY_THREAD);
  require_noerr_action( err, exit, user_log("ERROR: mico_start_properties_notify err = %d.", err) );
#endif
  
  /* main loop for user display */
  while(1){
    // check every 1 seconds
    mico_thread_sleep(1);
    
    // system work state show on OLED
    system_state_display(app_context, &g_user_context);
  }
  
exit:
  user_log("ERROR: user_main exit with err=%d", err);
  return err;
}
开发者ID:karlnet,项目名称:mico,代码行数:56,代码来源:user_main.c

示例11: MICOStartApplication

/* MICO APP entrance */
OSStatus MICOStartApplication( mico_Context_t * const mico_context )
{
  app_log_trace();
  OSStatus err = kNoErr;
  LinkStatusTypeDef wifi_link_status;
    
  require_action(mico_context, exit, err = kParamErr);
    
  app_log("Application version: %s", mico_context->flashContentInRam.appConfig.fogcloudConfig.romVersion);
  
  // LED on when Wi-Fi connected.
  MicoSysLed(false);
  
  // init application wifi link status
  do{
    err = micoWlanGetLinkStatus(&wifi_link_status);
    if(kNoErr != err){
      mico_thread_sleep(3);
    }
  }while(kNoErr != err);
  
  if(1 ==  wifi_link_status.is_connected){
    mico_context->appStatus.isWifiConnected = true;
  }
  else{
    mico_context->appStatus.isWifiConnected = false;
  }
    
  /* Bonjour for service searching */
  if(mico_context->flashContentInRam.micoSystemConfig.bonjourEnable == true) {
    MICOStartBonjourService( Station, mico_context );
  }
  
  /* start cloud service */
#if (MICO_CLOUD_TYPE == CLOUD_FOGCLOUD)
  app_log("MICO CloudService: FogCloud.");
  err = MicoStartFogCloudService( mico_context );
  require_noerr_action( err, exit, app_log("ERROR: Unable to start FogCloud service.") );
#elif (MICO_CLOUD_TYPE == CLOUD_ALINK)
  app_log("MICO CloudService: Alink.");
#elif (MICO_CLOUD_TYPE == CLOUD_DISABLED)
  app_log("MICO CloudService: disabled.");
#else
  #error "MICO cloud service type is not defined"?
#endif
  
  /* start user thread */
  err = startUserMainThread( mico_context );
  require_noerr_action( err, exit, app_log("ERROR: start user_main thread failed!") );

exit:
  return err;
}
开发者ID:liquanqing,项目名称:RGBLED_Text,代码行数:54,代码来源:MICOAppEntrance.c

示例12: web_send_wifisetting_page

static int web_send_wifisetting_page(httpd_request_t *req)
{
  OSStatus err = kNoErr;
  
  err = httpd_send_all_header(req, HTTP_RES_200, sizeof(wifisetting), HTTP_CONTENT_HTML_STR);
  require_noerr_action( err, exit, app_httpd_log("ERROR: Unable to send http wifisetting headers.") );
  
  err = httpd_send_body(req->sock, wifisetting, sizeof(wifisetting));
  require_noerr_action( err, exit, app_httpd_log("ERROR: Unable to send http wifisetting body.") );
  
exit:
  return err; 
}
开发者ID:HargicStudio,项目名称:smartCup_micokit_V2.3.0.2,代码行数:13,代码来源:app_httpd.c

示例13: fogCloudDevActivate

OSStatus fogCloudDevActivate(app_context_t* const inContext,
                             MVDActivateRequestData_t devActivateRequestData)
{
    cloud_if_log_trace();
    OSStatus err = kUnknownErr;

    cloud_if_log("Device activate...");

    //ok, set cloud context
    strncpy(easyCloudContext.service_config_info.loginId,
            devActivateRequestData.loginId, MAX_SIZE_LOGIN_ID);
    strncpy(easyCloudContext.service_config_info.devPasswd,
            devActivateRequestData.devPasswd, MAX_SIZE_DEV_PASSWD);
    strncpy(easyCloudContext.service_config_info.userToken,
            devActivateRequestData.user_token, MAX_SIZE_USER_TOKEN);

    // activate request
    err = FogCloudActivate(&easyCloudContext);
    require_noerr_action(err, exit,
                         cloud_if_log("ERROR: fogCloudDevActivate failed! err=%d", err) );

    inContext->appStatus.fogcloudStatus.isActivated = true;

    // write activate data back to flash
    mico_rtos_lock_mutex(&inContext->mico_context->flashContentInRam_mutex);
    inContext->appConfig->fogcloudConfig.isActivated = true;
    strncpy(inContext->appConfig->fogcloudConfig.deviceId,
            easyCloudContext.service_status.deviceId, MAX_SIZE_DEVICE_ID);
    strncpy(inContext->appConfig->fogcloudConfig.masterDeviceKey,
            easyCloudContext.service_status.masterDeviceKey, MAX_SIZE_DEVICE_KEY);

    strncpy(inContext->appConfig->fogcloudConfig.loginId,
            easyCloudContext.service_config_info.loginId, MAX_SIZE_LOGIN_ID);
    strncpy(inContext->appConfig->fogcloudConfig.devPasswd,
            easyCloudContext.service_config_info.devPasswd, MAX_SIZE_DEV_PASSWD);
    strncpy(inContext->appConfig->fogcloudConfig.userToken,
            easyCloudContext.service_config_info.userToken, MAX_SIZE_USER_TOKEN);

    err = mico_system_context_update(inContext->mico_context);
    mico_rtos_unlock_mutex(&inContext->mico_context->flashContentInRam_mutex);
    require_noerr_action(err, exit,
                         cloud_if_log("ERROR: activate write flash failed! err=%d", err) );

    return kNoErr;

exit:
    return err;
}
开发者ID:xlfdan,项目名称:SDK_MiCOKit_v2.3.0.2,代码行数:48,代码来源:fogCloud.c

示例14: MVDCloudInterfaceResetCloudDevInfo

OSStatus MVDCloudInterfaceResetCloudDevInfo(mico_Context_t* const inContext,
                                            MVDResetRequestData_t devResetRequestData)
{
  OSStatus err = kUnknownErr;
  
  // login_id/dev_passwd ok ?
  if((0 != strncmp(inContext->flashContentInRam.appConfig.virtualDevConfig.loginId, 
                   devResetRequestData.loginId, 
                   strlen(inContext->flashContentInRam.appConfig.virtualDevConfig.loginId))) ||
     (0 != strncmp(inContext->flashContentInRam.appConfig.virtualDevConfig.devPasswd, 
                   devResetRequestData.devPasswd, 
                   strlen(inContext->flashContentInRam.appConfig.virtualDevConfig.devPasswd))))
  {
    // devPass err
    cloud_if_log("ERROR: MVDCloudInterfaceResetCloudDevInfo: loginId/devPasswd mismatch!");
    return kMismatchErr;
  }
  cloud_if_log("MVDCloudInterfaceResetCloudDevInfo: loginId/devPasswd ok!");
  
  err = EasyCloudDeviceReset(&easyCloudContext);
  require_noerr_action( err, exit, cloud_if_log("ERROR: EasyCloudDeviceReset failed! err=%d", err) );
  
  mico_rtos_lock_mutex(&inContext->flashContentInRam_mutex);
  inContext->flashContentInRam.appConfig.virtualDevConfig.isActivated = false;  // need to reActivate
  sprintf(inContext->flashContentInRam.appConfig.virtualDevConfig.deviceId, DEFAULT_DEVICE_ID);
  sprintf(inContext->flashContentInRam.appConfig.virtualDevConfig.masterDeviceKey, DEFAULT_DEVICE_KEY);
  sprintf(inContext->flashContentInRam.appConfig.virtualDevConfig.loginId, DEFAULT_LOGIN_ID);
  sprintf(inContext->flashContentInRam.appConfig.virtualDevConfig.devPasswd, DEFAULT_DEV_PASSWD);
  inContext->appStatus.virtualDevStatus.isCloudConnected = false;
  MICOUpdateConfiguration(inContext);
  mico_rtos_unlock_mutex(&inContext->flashContentInRam_mutex);
  
exit:
  return err;
}
开发者ID:bangkr,项目名称:MiCO_ELink407,代码行数:35,代码来源:MVDCloudInterfaces.c

示例15: bme280_sensor_deinit

// bme280_sensor_init
OSStatus bme280_sensor_deinit(void)
{
  OSStatus err = kUnknownErr;
  s32 com_rslt = BME280_ERROR;
  
  err = MicoI2cFinalize(&user_i2c_device);
  require_noerr_action( err, exit, bme280_user_log("BME280_ERROR: MicoI2cFinalize err = %d.", err));
  
  /*********************** START DE-INITIALIZATION ************************/
  /*	For de-initialization it is required to set the mode of
  *	the sensor as "SLEEP"
  *	the device reaches the lowest power consumption only
  *	In SLEEP mode no measurements are performed
  *	All registers are accessible
  *	by using the below API able to set the power mode as SLEEP*/
  /* Set the power mode as SLEEP*/
  com_rslt = bme280_set_power_mode(BME280_SLEEP_MODE);
  /************************** END DE-INITIALIZATION ***********************/
  if(0 == com_rslt){
    err = kNoErr;
  }
  
exit:
  return err;
}
开发者ID:MrZANE42,项目名称:WiFiMCU,代码行数:26,代码来源:bme280_user.c


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