コード例 #1
0
ファイル: user_main.c プロジェクト: wangeshen/MICO
/* user main function, called by AppFramework after FogCloud connected.
 */
OSStatus user_main( mico_Context_t * const mico_context )
{
  user_log_trace();
  OSStatus err = kUnknownErr;
  
  /* init user modules (pins && sensor init)*/
  err = user_modules_init();
  require_noerr_action( err, exit, user_log("ERROR: user_modules_init err=%d.", err) );
  
  /* recovery user settings from flash && set initail state of user modules */
  //err = user_settings_recovery(mico_context, &g_user_context);
  //require_noerr_action( err, exit, user_log("ERROR: user_settings_recovery err=%d.", err) );
  
#if (MICO_CLOUD_TYPE != CLOUD_DISABLED)
  /* start properties notify task */
  err = mico_start_properties_notify(mico_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
  
  while(1){
    /* user thread running state */
    user_display(&g_user_context);
    user_test(&g_user_context);
    
    /* check every 1 seconds */
    mico_thread_msleep(1000);
    
    /* save user settings into flash */
    //err = user_settings_update(mico_context, &g_user_context);
    //require_noerr_action( err, exit, user_log("ERROR: user_settings_update err=%d.", err) );
  }
  
exit:
  user_log("ERROR: user_main exit with err=%d", err);
  return err;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: niXman/fs-storage-sort
int main() {

	user_test("test.dat", 10);

	return 0;
}