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


C++ debug_msg函数代码示例

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


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

示例1: RRD_create

/* Warning: RRD_create will overwrite a RRdb if it already exists */
static int
RRD_create( char *rrd, int summary, unsigned int step, 
            unsigned int process_time, ganglia_slope_t slope)
{
   const char *data_source_type = "GAUGE";
   char *argv[128];
   int  argc=0;
   int heartbeat;
   char s[16], start[64];
   char sum[64];
   char num[64];
   int i;

   /* Our heartbeat is twice the step interval. */
   heartbeat = 8*step;

   switch( slope) {
   case GANGLIA_SLOPE_POSITIVE:
     data_source_type = "COUNTER";
     break;

   case GANGLIA_SLOPE_ZERO:
   case GANGLIA_SLOPE_NEGATIVE:
   case GANGLIA_SLOPE_BOTH:
   case GANGLIA_SLOPE_UNSPECIFIED:
     data_source_type = "GAUGE";
     break;
   }

   argv[argc++] = "dummy";
   argv[argc++] = rrd;
   argv[argc++] = "--step";
   sprintf(s, "%u", step);
   argv[argc++] = s;
   argv[argc++] = "--start";
   sprintf(start, "%u", process_time-1);
   argv[argc++] = start;
   sprintf(sum,"DS:sum:%s:%d:U:U",
           data_source_type,
           heartbeat);
   argv[argc++] = sum;
   if (summary) {
      sprintf(num,"DS:num:%s:%d:U:U", 
              data_source_type,
              heartbeat);
      argv[argc++] = num;
   }

   for(i = 0; i< gmetad_config.num_RRAs; i++)
     {
       argv[argc++] = gmetad_config.RRAs[i];
     }
#if 0
   /* Read in or defaulted in conf.c */
   argv[argc++] = "RRA:AVERAGE:0.5:1:240";
   argv[argc++] = "RRA:AVERAGE:0.5:24:240";
   argv[argc++] = "RRA:AVERAGE:0.5:168:240";
   argv[argc++] = "RRA:AVERAGE:0.5:672:240";
   argv[argc++] = "RRA:AVERAGE:0.5:5760:370";
#endif

   pthread_mutex_lock( &rrd_mutex );
   optind=0; opterr=0;
   rrd_clear_error();
   rrd_create(argc, argv);
   if(rrd_test_error())
      {
         err_msg("RRD_create: %s", rrd_get_error());
         pthread_mutex_unlock( &rrd_mutex );
         return 1;
      }
   debug_msg("Created rrd %s", rrd);
   pthread_mutex_unlock( &rrd_mutex );
   return 0;
}
开发者ID:dmangot,项目名称:monitor-core,代码行数:76,代码来源:rrd_helpers.c

示例2: if

QString
QMakeProperty::value(QString v, bool just_check)
{
    if(v == "QT_INSTALL_PREFIX")
        return QLibraryInfo::location(QLibraryInfo::PrefixPath);
    else if(v == "QT_INSTALL_DATA")
        return QLibraryInfo::location(QLibraryInfo::DataPath);
    else if(v == "QT_INSTALL_DOCS")
        return QLibraryInfo::location(QLibraryInfo::DocumentationPath);
    else if(v == "QT_INSTALL_HEADERS")
        return QLibraryInfo::location(QLibraryInfo::HeadersPath);
    else if(v == "QT_INSTALL_LIBS")
        return QLibraryInfo::location(QLibraryInfo::LibrariesPath);
    else if(v == "QT_INSTALL_BINS")
        return QLibraryInfo::location(QLibraryInfo::BinariesPath);
    else if(v == "QT_INSTALL_PLUGINS")
        return QLibraryInfo::location(QLibraryInfo::PluginsPath);
    else if(v == "QT_INSTALL_IMPORTS")
        return QLibraryInfo::location(QLibraryInfo::ImportsPath);
    else if(v == "QT_INSTALL_TRANSLATIONS")
        return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
    else if(v == "QT_INSTALL_CONFIGURATION")
        return QLibraryInfo::location(QLibraryInfo::SettingsPath);
    else if(v == "QT_INSTALL_EXAMPLES")
        return QLibraryInfo::location(QLibraryInfo::ExamplesPath);
    else if(v == "QT_INSTALL_DEMOS")
        return QLibraryInfo::location(QLibraryInfo::DemosPath);
    else if(v == "QMAKE_MKSPECS")
        return qmake_mkspec_paths().join(Option::dirlist_sep);
    else if(v == "QMAKE_VERSION")
        return qmake_version();
#ifdef QT_VERSION_STR
    else if(v == "QT_VERSION")
        return QT_VERSION_STR;
#endif

    initSettings();
    int slash = v.lastIndexOf('/');
    QVariant var = settings->value(keyBase(slash == -1) + v);
    bool ok = var.isValid();
    QString ret = var.toString();
    if(!ok) {
        QString version = qmake_version();
        if(slash != -1) {
            version = v.left(slash-1);
            v = v.mid(slash+1);
        }
        settings->beginGroup(keyBase(false));
        QStringList subs = settings->childGroups();
        settings->endGroup();
        subs.sort();
        for (int x = subs.count() - 1; x >= 0; x--) {
            QString s = subs[x];
            if(s.isEmpty() || s > version)
                continue;
            var = settings->value(keyBase(false) + s + "/" + v);
            ok = var.isValid();
            ret = var.toString();
            if (ok) {
                if(!just_check)
                    debug_msg(1, "Fell back from %s -> %s for '%s'.", version.toLatin1().constData(),
                              s.toLatin1().constData(), v.toLatin1().constData());
                return ret;
            }
        }
    }
    return ok ? ret : QString();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:68,代码来源:property.cpp

示例3: UserMainProc

void UserMainProc(void)
{
    NVTEVT evt;
    UINT32 paramNum;
    UINT32 paramArray[MAX_MESSAGE_PARAM_NUM];
    CHAR buffer[8]={0};	
    debug_msg("event loop - begin!\r\n");

//jacky lan for ACC power on detetion*********************
    //memcpy((void *)buffer, (void *)BLINFO_ACCPOWERON_FLAG, 8);
    if (rtc_getPWROnSource()==RTC_PWRON_SRC_PWR_SW4)
    {
        gbACCPowerOn=TRUE;
    }
    else if(rtc_getPWROnSource()==RTC_PWRON_SRC_PWR_SW)
    {
        gbACCPowerOn=FALSE;
    }
    else
    {
        gbACCPowerOn=FALSE;
    }		
    debug_msg("ACC FLAG :%d..\r\n",rtc_getPWROnSource());
//*************************************************	
#if (POWERON_TESTFLOW == ENABLE)
    //System_OnPowerPreInit();
    System_InstallMode();
    System_OnTimerInit();
    System_OnOutputInit();
    GxSystem_BootStart();

    if(GxSystem_GetPowerOnSource() == GX_PWRON_SRC_PWR_VBUS)
    {
        GxUSB_Init(TRUE);
    }
    if(gIsUSBChargePreCheck)
    {
        UINT32 uiChargeCurrent = USB_CHARGE_CURRENT_2P5MA;
        System_OnUsbInit();
        System_OnStrgInit_INMEM();
        System_OnStrgInit_EXMEM();
        Install_AppObj(); //must install before any event dispatch
        UI_UnlockEvent();
        debug_msg("wait USB - begin\r\n");
        do
        {
            UserWaitEvent(NVTEVT_USB_CHARGE_CURRENT, &paramNum, paramArray); //(paramNum == 1 && paramArray[0] == 0) //power-on begin
            uiChargeCurrent = paramArray[0];
            debug_msg("USB charging current(%d)\r\n",paramArray[0]);
        }
        while(uiChargeCurrent < USB_CHARGE_CURRENT_500MA);
        debug_msg("wait USB - end\r\n");
        //SxCmd_DoCommand("dma eclk");
        ///GxLED_SetCtrl(KEYSCAN_LED_FCS,TURNON_LED,TRUE);
    }
    //UserWaitEvent(NVTEVT_SYSTEM_BOOT, &paramNum, paramArray); //(paramNum == 1 && paramArray[0] == 0) //power-on begin

    //////////////////////////////////////////////////////////////
    // Direct boot flow

    //Init Device & Lib
    SysDbgUtCmd_Init(); //Init Once DbgUt
    System_OnVideoInit();
    System_OnAudioInit();
    if(!gIsUSBChargePreCheck)
    {
    System_OnStrgInit_INMEM();
    System_OnStrgInit_EXMEM();
    System_OnStrgInit_FWS();
    System_OnStrgInit_PS();
    System_OnStrgInit_FS();
    System_OnUsbInit();
    }
    System_OnLensInit();
    System_OnSensorInit();
    System_OnPowerInit();
    System_OnInputInit();

    //////////////////////////////////////////////////////////////

    //Init object list for UIControl event process
    if(!gIsUSBChargePreCheck)
        Install_AppObj(); //must install before any event dispatch

    //UserWaitEvent(NVTEVT_SYSTEM_BOOT, &paramNum, paramArray); //(paramNum == 1 && paramArray[0] == 0) //power-on begin
    Ux_SendEvent(0, NVTEVT_SYSTEM_BOOT, 1, 1);

#else

    System_OnStrgInit_INMEM();
    System_OnStrgInit_FWS();
    System_OnStrg_DownloadFW(UserSection_Order_full, UserSection_LoadCb);
    System_OnPowerPreInit();
    System_InstallMode();
    System_OnTimerInit();
    System_OnOutputInit();
    GxSystem_BootStart();
    //UserWaitEvent(NVTEVT_SYSTEM_BOOT, &paramNum, paramArray); //(paramNum == 1 && paramArray[0] == 0) //power-on begin

    //////////////////////////////////////////////////////////////
//.........这里部分代码省略.........
开发者ID:magic-gjh,项目名称:NT96655_K12B,代码行数:101,代码来源:SysMain.c

示例4: usb_get_busses

/** Return pointer to virtual bus list.
  */
struct usb_bus* usb_get_busses(void)
{
   //! \todo Merge both local - attached busses in future?
   debug_msg("returned %p", __remote_bus);
   return __remote_bus;
}
开发者ID:pettair,项目名称:libusbnet,代码行数:8,代码来源:usbnet.c

示例5: compare_file_blocks

// the third comparision
// 0 - same file
// 1 - different file
int compare_file_blocks(list_node *file1, list_node *file2)
{
    unsigned int file_size = (unsigned int)file1->filesize;
    if (debug_mod)
    {
        char *subpath[2];
        subpath[0] = pathtrim(file1->filepath);
        subpath[1] = pathtrim(file2->filepath);
        debug_msg("Block Checking: File name: %s\t%s", subpath[0], subpath[1]);
    }
    FILE *f1, *f2;
    char tmp1, tmp2;
    int i;
    f1 = fopen(file1->filepath, "rb");
    f2 = fopen(file2->filepath, "rb");
    if (f1 == NULL || f2 == NULL)
    {
        perror("File open failed");
    }
    debug_msg("Open files successfully");
    if (file_size > MIN_BLOCK_COMPARE_SIZE)
    {
        // scan the beginning
        debug_msg("Begin block checking...");
        fseek(f1, 0, SEEK_SET);
        fseek(f2, 0, SEEK_SET);
        for (i = 0; i < BLOCK_SIZE; i++)
        {
            fread(&tmp1, 1, 1, f1);
            fread(&tmp2, 1, 1, f2);
            //debug_msg("fread");
            if (tmp1 != tmp2)
            {
                //debug_msg("block diff 1");
                fclose(f1);
                fclose(f2);
                return 1;
            }
        }
        // scan the end
        debug_msg("End block checking...");
        fseek(f1, file_size - BLOCK_SIZE, SEEK_SET);
        fseek(f2, file_size - BLOCK_SIZE, SEEK_SET);
        for (i = 0; i < BLOCK_SIZE; i++)
        {
            fread(&tmp1, 1, 1, f1);
            fread(&tmp2, 1, 1, f2);
            if (tmp1 != tmp2)
            {
                debug_msg("block diff 2");
                fclose(f1);
                fclose(f2);
                return 1;
            }
        }
        // randomly scan the middle
        debug_msg("Random Checking...");
        long offset = (rand() % (file_size - 2 * BLOCK_SIZE)) + 100;
        fseek(f1, offset, SEEK_SET);
        fseek(f2, offset, SEEK_SET);
        for (i = 0; i < BLOCK_SIZE; i++)
        {
            fread(&tmp1, 1, 1, f1);
            fread(&tmp2, 1, 1, f2);
            if (tmp1 != tmp2)
            {
                debug_msg("block diff 3");
                fclose(f1);
                fclose(f2);
                return 1;
            }
        }
    }
    else
    {
        debug_msg("File too small, check the whole");
        for (i = 0; i < file_size; i++)
        {
            fread(&tmp1, 1, 1, f1);
            fread(&tmp2, 1, 1, f2);
            if (tmp1 != tmp2)
            {

                fclose(f1);
                fclose(f2);
                return 1;
            }
        }
    }
    fclose(f1);
    fclose(f2);
    debug_msg("Block Checking finished");
    return 0;
}
开发者ID:edwardfang,项目名称:Duplication-Cleaner,代码行数:97,代码来源:file_compare.c

示例6: GPSRecTsk

void GPSRecTsk(void)
{
    CHAR      cLen;
    USHORT    CheckSentenceType1, CheckSentenceType2;
    UINT32    CheckSentenceType3;
    CHAR      RecSentence[NMEA_SENTENCE_SIZE];
    CHAR      *pSentenceData;
    CHAR      *ptrGPSData;

    debug_msg("Enter GPS Receive task\r\n");
    ptrTmpGPSData = pGPSLogAddr;
    clr_flg(FLG_ID_GPS, GPS_FLAG_DATAVALID);

    while(1)
    {

        cLen = NMEA_SENTENCE_SIZE ;
        #if (RECEIVE_FROM_UART2)
        if (uart2_getString(RecSentence, &cLen) == E_PAR)
        #else
        if (uart_getString(RecSentence, &cLen) == E_PAR)
        #endif
            debug_err(("UART2: parameter error!\r\n"));


        //Each NMEA sentence begins with '$' (0x24)
        if (RecSentence[0] == 0x24)
        {
            pSentenceData = RecSentence;
            CheckSentenceType1 = *(USHORT *)(pSentenceData + 2);
            CheckSentenceType2 = *(USHORT *)(pSentenceData + 4);
            CheckSentenceType3 = ((UINT)CheckSentenceType2 << 16) | (UINT)CheckSentenceType1;

            switch(CheckSentenceType3)
            {
            case GSA_SENTENCE:
                //NMEASentence.GSA = RecSentence;
                //GPSRec_NMEAParser(RecSentence, (UINT32)cLen, GSA);
                break;

            case RMC_SENTENCE:
                // verify address to avoid buffer overflow !!
                if (bzLogGPS == TRUE)
                {
                    // get g-sensor axis data
                    //gsensor_GetData(&GS_Data);
                    ptrTmpGPSData = (CHAR *)GPSRec_VerifyBufAddr((UINT32)ptrTmpGPSData);
                    //ptrTmpGPSData += sprintf(ptrTmpGPSData,"$G&%s;$S&\r\n",&RecSentence[1]);
                    ptrTmpGPSData += sprintf(ptrTmpGPSData,"$%s\r\n",&RecSentence[1]);					
			 //ptrTmpGPSData = pGPSLogAddr;
			 //sprintf(ptrTmpGPSData,"$G&%s;$S&\r\n",&RecSentence[1]);
                }
                NMEASentence.RMC = RecSentence;
                NMEA_debug(("%s\r\n",RecSentence));
				
                GPSRec_NMEAParser(RecSentence, (UINT32)cLen, RMC);
                break;

            case GGA_SENTENCE:
                //NMEASentence.GGA = RecSentence;
                //GPSRec_NMEAParser(RecSentence, (UINT32)cLen, GGA);
                break;

            case GSV_SENTENCE:
                //NMEASentence.GSV = RecSentence;
                //GPSRec_NMEAParser(RecSentence, (UINT32)cLen, GSV);
                break;

            case GLL_SENTENCE:
                //NMEASentence.GLL = RecSentence;
                //GPSRec_NMEAParser(RecSentence, (UINT32)cLen, GLL);
                break;

            case VTG_SENTENCE:
                //NMEASentence.VTG = RecSentence;
                //GPSRec_NMEAParser(RecSentence, (UINT32)cLen, VTG);
                break;
            case ZDA_SENTENCE:
               GPS_debug(("#ZDA.... \r\n"));				
		   break;
            default:
                debug_err(("GPS: Can't identify this sentence 0x%X \r\n",CheckSentenceType3));
                break;
            }


        }




    }

}
开发者ID:magic-gjh,项目名称:NT96220_PW8403,代码行数:94,代码来源:GPS.c

示例7: main

int main(void)
{
   int s, t, len, skip_cmd = 0;
   struct sockaddr_un remote;
   char msgbuf[4096], buf[UNIX_PATH_MAX], *env;

   if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
     {
        perror("socket");
        exit(1);
     }

   printf("Trying to connect...\n");

   remote.sun_family = AF_UNIX;
   env = getenv("EVAS_CSERVE2_SOCKET");
   if (!env)
     {
        snprintf(buf, sizeof(buf), "/tmp/.evas-cserve2-%x.socket",
                 (int)getuid());
        env = buf;
     }
   eina_strlcpy(remote.sun_path, env, UNIX_PATH_MAX);
   len = strlen(remote.sun_path) + sizeof(remote.sun_family);
   if (connect(s, (struct sockaddr *)&remote, len) == -1)
     {
        perror("connect");
        exit(1);
     }

   printf("Connected.\n");

   while(!feof(stdin))
     {
        char cmd[1024];
        int i;
        int size;
        void *msg;

        if (skip_cmd)
          skip_cmd = 0;
        else
          printf("\n> ");
        if (!fgets(cmd, sizeof(cmd), stdin))
          break;
        len = strlen(cmd) - 1;
        cmd[len] = '\0';

        if (!len)
          {
             skip_cmd = 1;
             continue;
          }

        for (i = 0; _msg_types[i].name; i++)
          {
             if (!strcmp(cmd, _msg_types[i].name))
               break;
          }

        // discards the end of the message if we can't parse it
        if (!_msg_types[i].name)
          {
             printf("Invalid command.\n");
             continue;
          }

        if (!_msg_types[i].parse_func)
          {
             printf("Command %s still unhandled.\n", _msg_types[i].name);
             continue;
          }

        msg = _msg_types[i].parse_func(&size);

        if (send(s, &size, sizeof(size), MSG_NOSIGNAL) == -1)
          {
             perror("send size");
             exit(1);
          }
        if (send(s, msg, size, MSG_NOSIGNAL) == -1)
          {
             perror("send");
             exit(1);
          }

        free(msg);

        usleep(100000);

        if ((t=recv(s, &size, sizeof(size), MSG_DONTWAIT)) > 0)
          {
             len = recv(s, msgbuf, size, 0);
             printf("size of received message: %d\n", len);
             if (len != size)
               {
                  printf("couldn't read entire message.\n");
                  continue;
               }
             debug_msg(&size, sizeof(size));
//.........这里部分代码省略.........
开发者ID:RomainNaour,项目名称:efl,代码行数:101,代码来源:evas_cserve2_client.c

示例8: Ganglia_udp_send_channels_create

Ganglia_udp_send_channels
Ganglia_udp_send_channels_create( Ganglia_pool p, Ganglia_gmond_config config )
{
  apr_array_header_t *send_channels = NULL;
  cfg_t *cfg=(cfg_t *)config;
  int i, num_udp_send_channels = cfg_size( cfg, "udp_send_channel");
  apr_pool_t *context = (apr_pool_t*)p;

  /* Return null if there are no send channels specified */
  if(num_udp_send_channels <= 0)
    return (Ganglia_udp_send_channels)send_channels;

  /* Create my UDP send array */
  send_channels = apr_array_make( context, num_udp_send_channels, 
                                  sizeof(apr_socket_t *));

  for(i = 0; i< num_udp_send_channels; i++)
    {
      cfg_t *udp_send_channel;
      char *mcast_join, *mcast_if, *host;
      int port, ttl, bind_hostname;
      apr_socket_t *socket = NULL;
      apr_pool_t *pool = NULL;
      char *bind_address;

      udp_send_channel = cfg_getnsec( cfg, "udp_send_channel", i);
      host           = cfg_getstr( udp_send_channel, "host" );
      mcast_join     = cfg_getstr( udp_send_channel, "mcast_join" );
      mcast_if       = cfg_getstr( udp_send_channel, "mcast_if" );
      port           = cfg_getint( udp_send_channel, "port");
      ttl            = cfg_getint( udp_send_channel, "ttl");
      bind_address   = cfg_getstr( udp_send_channel, "bind" );
      bind_hostname  = cfg_getbool( udp_send_channel, "bind_hostname");

      debug_msg("udp_send_channel mcast_join=%s mcast_if=%s host=%s port=%d\n",
                mcast_join? mcast_join:"NULL", 
                mcast_if? mcast_if:"NULL",
                host? host:"NULL",
                port);

      if(bind_address != NULL && bind_hostname == cfg_true)
        {
          err_msg("udp_send_channel: bind and bind_hostname are mutually exclusive, both parameters can't be specified for the same udp_send_channel\n");
          exit(1);
        }

      /* Create a subpool */
      apr_pool_create(&pool, context);

      /* Join the specified multicast channel */
      if( mcast_join )
        {
          /* We'll be listening on a multicast channel */
          socket = create_mcast_client(pool, mcast_join, port, ttl, mcast_if, bind_address, bind_hostname);
          if(!socket)
            {
              err_msg("Unable to join multicast channel %s:%d. Exiting\n",
                  mcast_join, port);
              exit(1);
            }
        }
      else
        {
          /* Create a UDP socket */
          socket = create_udp_client( pool, host, port, mcast_if, bind_address, bind_hostname );
          if(!socket)
            {
              err_msg("Unable to create UDP client for %s:%d. Exiting.\n",
                      host? host: "NULL", port);
              exit(1);
            }
        }

      /* Add the socket to the array */
      *(apr_socket_t **)apr_array_push(send_channels) = socket;
    }

  return (Ganglia_udp_send_channels)send_channels;
}
开发者ID:AsherBond,项目名称:monitor-core,代码行数:79,代码来源:libgmond.c

示例9: UIFlowWndWiFiMovie_OnExeKeyShutter2

INT32 UIFlowWndWiFiMovie_OnExeKeyShutter2(BOOL StartOrStop)
{
    BOOL startRec =0;
    UINT32 uiNotifyAPPStatus = 0;
    UINT32 result = WIFIAPP_RET_OK;
    UINT32 curStatus = 0;

    startRec = StartOrStop;
    if (System_GetState(SYS_STATE_CURRMODE) != PRIMARY_MODE_MOVIE)
    {
        WifiCmd_Done(WIFIFLAG_RECORD_DONE,WIFIAPP_RET_STATE_ERR);
        UIFlowWndWiFiMovieErrMsg("not movie mode\r\n");
        return NVTEVT_CONSUME;
    }
    debug_msg("UIFlowWndWiFiMovie_OnExeKeyShutter2---\r\n");
    curStatus = UIFlowWndWiFiMovie_GetStatus();
    if(startRec)
    {
        if (curStatus == WIFI_MOV_ST_LVIEW)
        {
            UINT32 MaxTime = UIFlowWiFiMovie_GetMaxRecTime();

            if((MaxTime <= 2) && (SysGetFlag(FL_MOVIE_CYCLIC_REC) == MOVIE_CYCLICREC_OFF))
            {
                result = WIFIAPP_RET_STORAGE_FULL;
                UIFlowWndWiFiMovieErrMsg("recTime<2 sec\r\n");
            }
            else
            {
                // Reset Current record time
                FlowMovie_SetRecCurrTime(0);

                // Send socket to notify APP movie recording is started.
                // if(uiNotifyAPPStatus)
                // {
                //     WifiApp_SendCmd(WIFIAPP_CMD_NOTIFY_STATUS, WIFIAPP_RET_RECORD_STARTED);
                //  }
                //   else
                //   {
                WifiApp_SendCmd(WIFIAPP_CMD_NOTIFY_STATUS, WIFIAPP_RET_RECORD_STARTED);
                FlowWiFiMovie_StopRec();
                FlowWiFiMovie_StartRec(WIFI_RTSP_REC);
                //  }
            }
        }
        else if(curStatus == WIFI_MOV_ST_IDLE)
        {
            result = WIFIAPP_RET_FAIL;
            UIFlowWndWiFiMovieErrMsg("idle state,cannot record\r\n");
        }
    }
    else  //stop rec
    {
        UINT32 recordTime = FlowMovie_GetRecCurrTime();
        if ((curStatus == WIFI_MOV_ST_RECORD) && ((recordTime >= 1) || (SysGetFlag(FL_MOVIE_TIMELAPSE_REC) != MOVIE_TIMELAPSEREC_OFF)))
        {
            if(UxCtrl_IsShow(&UIMenuWndWiFiModeLink_PanelCtrl))
            {
                UxCtrl_SetShow(&UIMenuWndWiFiModeLink_PanelCtrl,FALSE);
            }
            if(UxCtrl_IsShow(&UIMenuWndWiFiMobileLinkOK_PanelCtrl))
            {
                UxCtrl_SetShow(&UIMenuWndWiFiMobileLinkOK_PanelCtrl,FALSE);
            }

            if(g_bgsensor==TRUE)
            {
                g_bgsensor = FALSE;
            }
            WifiApp_SendCmd(WIFIAPP_CMD_NOTIFY_STATUS, WIFIAPP_RET_RECORD_STOPPED);

            FlowWiFiMovie_StopRec();
            FlowWiFiMovie_StartRec(WIFI_RTSP_LIVEVIEW);
            // Notify Maximum Record Time
            UI_SetData(FL_WIFI_MOVIE_MAXRECTIME, UIMovRecObj_GetData(RECMOVIE_MAXSECOND));
        }
        else if ((curStatus == WIFI_MOV_ST_RECORD) &&(recordTime < 1))
        {
            result = WIFIAPP_RET_FAIL;
            UIFlowWndWiFiMovieErrMsg("recTime<1 sec %d sts %d\r\n",recordTime,UIFlowWndWiFiMovie_GetStatus());
        }
        else if(curStatus == WIFI_MOV_ST_IDLE)
        {
            result = WIFIAPP_RET_FAIL;
            UIFlowWndWiFiMovieErrMsg("idle state,cannot stop\r\n");
        }
    }
    // Notify Done
    WifiCmd_Done(WIFIFLAG_RECORD_DONE,result);
    return NVTEVT_CONSUME;
}
开发者ID:magic-gjh,项目名称:NT96655_SL508,代码行数:91,代码来源:UIFlowWndWiFiMovie.c

示例10: createMakefileGenerator

bool
BuildsMetaMakefileGenerator::write(const QString &oldpwd)
{
    Build *glue = 0;
    if(!makefiles.isEmpty() && !makefiles.first()->build.isNull()) {
        glue = new Build;
        glue->name = name;
        glue->makefile = createMakefileGenerator(project, true);
        makefiles += glue;
    }

    bool ret = true;
    const QString &output_name = Option::output.fileName();
    for(int i = 0; ret && i < makefiles.count(); i++) {
        Option::output.setFileName(output_name);
        Build *build = makefiles[i];

        bool using_stdout = false;
        if(build->makefile && (Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
                               Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
           && (!build->makefile->supportsMergedBuilds()
            || (build->makefile->supportsMergedBuilds() && (!glue || build == glue)))) {
            //open output
            if(!(Option::output.isOpen())) {
                if(Option::output.fileName() == "-") {
                    Option::output.setFileName("");
                    Option::output_dir = qmake_getpwd();
                    Option::output.open(stdout, QIODevice::WriteOnly | QIODevice::Text);
                    using_stdout = true;
                } else {
                    if(Option::output.fileName().isEmpty() &&
		       Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE)
                        Option::output.setFileName(project->first("QMAKE_MAKEFILE"));
                    Option::output_dir = oldpwd;
                    QString build_name = build->name;
                    if(!build->build.isEmpty()) {
                        if(!build_name.isEmpty())
                            build_name += ".";
                        build_name += build->build;
                    }
                    if(!build->makefile->openOutput(Option::output, build_name)) {
                        fprintf(stderr, "Failure to open file: %s\n",
                                Option::output.fileName().isEmpty() ? "(stdout)" :
                                Option::output.fileName().toLatin1().constData());
                        return false;
                    }
                }
            }
        } else {
           using_stdout = true; //kind of..
        }

        if(!build->makefile) {
            ret = false;
        } else if(build == glue) {
            ret = build->makefile->writeProjectMakefile();
        } else {
            ret = build->makefile->write();
            if (glue && glue->makefile->supportsMergedBuilds())
                ret = glue->makefile->mergeBuildProject(build->makefile);
        }
        if(!using_stdout) {
            Option::output.close();
            if(!ret)
                Option::output.remove();
        }

        // debugging
        if(Option::debug_level) {
            QMap<QString, QStringList> &vars = project->variables();
            for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
                if(!it.key().startsWith(".") && !it.value().isEmpty())
                    debug_msg(1, "%s === %s", it.key().toLatin1().constData(),
                              it.value().join(" :: ").toLatin1().constData());
            }
        }
    }
    return ret;
}
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:79,代码来源:metamakefile.cpp

示例11: UIFlowWndWiFiMovie_OnTimer

INT32 UIFlowWndWiFiMovie_OnTimer(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
{
    UINT32  uiEvent;
    uiEvent = paramNum ? paramArray[0] : 0;
    switch(uiEvent)
    {
    case NVTEVT_05SEC_TIMER:
        break;
        // Motion Detect function
        if (SysGetFlag(FL_MOVIE_MOTION_DET) == MOVIE_MOTIONDET_ON)
        {
            static UINT32  uiMotionDetGo = 0;
            static UINT32  uiMotionDetStop = 0;

            if (MD_Process()==TRUE)
            {
                uiMotionDetGo++;
                if (uiMotionDetGo>=2)
                {
                    uiMotionDetStop=0;
                    if (UIFlowWndWiFiMovie_GetStatus() == WIFI_MOV_ST_LVIEW)
                    {
                        debug_msg("^GStart Record\r\n");
                        // reset uiMotionDetGo
                        uiMotionDetGo = 0;
                        // Post event to record video and send socket to notify APP recording is started.
                        Ux_PostEvent(NVTEVT_WIFI_EXE_MOVIE_REC, 2, 1, 1);
                    }
                }
            }
            else
            {
                uiMotionDetStop++;
                if (uiMotionDetStop>=2) // 1 sec
                {
                    uiMotionDetGo=0;
                }
#if 1
                if (uiMotionDetStop>=20) // 10 Sec
#else
                if (uiMotionDetStop>=65536) // 10 Sec
#endif
                {
                    uiMotionDetStop = 0;
                    if (UIFlowWndWiFiMovie_GetStatus() == WIFI_MOV_ST_RECORD)
                    {
                        if (FlowMovie_GetRecCurrTime() >= 1 || (SysGetFlag(FL_MOVIE_TIMELAPSE_REC) != MOVIE_TIMELAPSEREC_OFF))
                        {
#if 0
                            FlowWiFiMovie_StopRec();
                            FlowWiFiMovie_StartRec(WIFI_RTSP_LIVEVIEW);
                            if ( FALSE == AE_Wait_Stable(3, 60) )
                                debug_msg("Motion Detection: AE do not stable\r\n");
#endif
                            debug_msg("^RWIFIAPP_RET_RECORD_STOPPED\r\n");
                            WifiApp_SendCmd(WIFIAPP_CMD_NOTIFY_STATUS, WIFIAPP_RET_RECORD_STOPPED);
                        }
                        break;
                    }
                }
            }
        }

        break;
    }

    Ux_DefaultEvent(pCtrl,NVTEVT_TIMER,paramNum,paramArray);
    return NVTEVT_CONSUME;
}
开发者ID:magic-gjh,项目名称:NT96655_SL508,代码行数:69,代码来源:UIFlowWndWiFiMovie.c

示例12: do_dos_command

int
do_dos_command (void)
{
	//XXX missing the rename command
  /* execute the DOS command in the buffer */
  int i = curr_client, dt = -1, ds = -1;
  /* scratch vars */
  int j, k, par, rv;
  unsigned int a,start;
  uchar path[1024], partition[8];
  uchar temp[1024];
  uchar name[80], id[80];
  debug_msg ("DOS Command: [%s]\n", dos_command[i]);
  if (dos_comm_len[i] == 0)
    /* null command needs null action */
    return (0);

    /* strip "0:" off the DOS command, leave only ':' */

//  for (j=0;j<=dos_comm_len[i];j++) {
//    if ((dos_command[i][j]=='0')&&(dos_command[i][j+1]==':')) {
//	for (k=j+1;k<=dos_comm_len[i];k++)
//	    dos_command[i][k-1]=dos_command[i][k];
//	dos_comm_len[i] = dos_comm_len[i]-1;
//    }
//  }
// debug_msg ("DOS Command: [%s]\n", dos_command[i]);


  /* parse out */
  switch (dos_command[i][0])
  {
  case 'M':
    {
      /* MkDir */
      switch (dos_command[i][1])
      {
      case '-':
        /* M-R and M-W */
        switch (dos_command[i][2])
        {
	case 'R':
	    { int addr, k;
	      addr = dos_command[i][3]+256*dos_command[i][4];
	      debug_msg("M-R on $%04x for $%02x\n",addr,dos_command[i][5]);
	      for (k=0;k<dos_command[i][5];k++) {
	        dos_status[i][k]=drive_memory[i][addr+k];
		}
	      dos_stat_len[i]=dos_command[i][5];
	      dos_comm_len[i] = 0;
	      return 0;
	    }
	    break;
	case 'W':
	    { int addr, k;
	      addr = dos_command[i][3]+256*dos_command[i][4];
	      debug_msg("M-W on $%04x for $%02x\n",addr,dos_command[i][5]);
	      for (k=0;k<dos_command[i][5];k++)
	        drive_memory[i][addr+k]=dos_status[i][k+6];
	      dos_comm_len[i] = 0;
	      set_error (0, 0, 0);
	      return 0;
	    }
	    break;
	}
	break;
      case 'D':
	/* make conventional dir */
	dos_comm_len[i] = 0;
	set_error (38, 0, 0);
	return (-1);
	break;
      case 'd':
      case 196:
	{
	  /* make special dir */
	  int dt = dos_command[i][2];
	  int media = 0, par, blocks = 0xffffff, size = 0;
	  uchar path[1024], sname[256], lname[256], ext[8];
	  fs64_filesystem fs;
	  fs.fsfile = 0;
	  switch (dt)
	  {
	  case '4':
	  case '6':		/* 1541 (D64) */
	    media = media_D64;
	    blocks = 683 + 1;
	    break;
	  case '7':		/* 1571 (D71) */
	    media = media_D71;
	    blocks = 683 * 2 + 1;
	    break;
	  case '8':		/* 1581 (D81) */
	    media = media_D81;
	    blocks = 80 * 40 + 1;
	    break;
	  case 'N':
	  case 'H':		/* CMD "Native" (DHD) */
	    media = media_DHD;
	    if (!dos_command[i][3])
//.........这里部分代码省略.........
开发者ID:ytmytm,项目名称:c64-64net2,代码行数:101,代码来源:dosemu.c

示例13: pthread_detach

void *SendHeartRun(void *arg)
{
  pthread_detach(pthread_self());


  char intervalOfSendPingREQ = 0;
  char intervalOfSendGetTime = 0;
  char intervalOfSendHeart = 0;
  char intervalKeepAlive = MQTT_KEEP_ALIVE / 10;


  _Bool needSendPublish = false;

  while(1)
    {
      debug_msg("5s");
      sleep(5);


      if (deviceModel == AP) {
        debug_msg("current deviceModel is AP");
        continue;
      }

      if (g_isCreated) {
        debug_msg("have created socket and connect to server\n");

        //                debug_msg("before wait semsendheart\n" );
        //                sem_wait(&g_semSendHeart);

        //                debug_msg("after wait semsendheart\n ");
        if (g_isConnected) { /* connected to mqtt server */

          debug_msg("g_isSubscribed = %d\n", g_isSubscribed);
          if (g_isSubscribed) {

            intervalOfSendPingREQ ++;
            intervalOfSendGetTime ++;
            intervalOfSendHeart ++;

            if (intervalOfSendPingREQ > intervalKeepAlive) {

              unsigned char pingREQ[2] = {0};
              pingREQ[0] = 0xC0;
              pingREQ[1] = 0x00;
              sendSocket(pingREQ, 2, "mqtt pingreq");

              intervalOfSendPingREQ = 0;
            }
            /* 120 * 5 = 600s = 1hour, so get current time from topicServer every 1 hour */
            if (intervalOfSendGetTime > 120) {
              intervalOfSendGetTime = 0;
              /* TODO: get time form topicServer */
            }

            if (intervalOfSendHeart > 12) {
              intervalOfSendHeart = 0;
              debug_msg("---");
              sendSocket(mqttHeart, mqttHeartLen, "mqttHeart");
            }

          } else {
            debug_msg("---");
            // is not received suback from server.

            /* so should send mqtt subscribe */
            struct mqttSend *mqtt = malloc(sizeof(struct mqttSend));

            /* set message type */
            mqtt->fixedHeader.messageType = SUBSCRIBE;

            /* set topic filter */
            printf("g_mac len = %d\n", strlen(g_mac));
            int count = LEN_OF_TOPICFILTER;
            int i = 0;

            mqtt->variableHeader.topicFilterArr = (char**)malloc(count * sizeof(char*));

            /* set topic filter length */
            mqtt->variableHeader.i_topicFilterArrCount = count;

            for (i = 0; i < count; i++) {
              unsigned char *topicFilter = malloc(strlen(g_subscribeTopicFilter[i]) + strlen(g_mac) + 1);
              
              bzero(topicFilter, strlen(g_subscribeTopicFilter[i]) + strlen(g_mac) + 1);

              memcpy(topicFilter, g_subscribeTopicFilter[i], strlen(g_subscribeTopicFilter[i]));

              memcpy(topicFilter + strlen(g_subscribeTopicFilter[i]), g_mac, strlen(g_mac));

              printf("topicFilter len = %lu\n", strlen(topicFilter));
              printf("topicFilter = %s\n", topicFilter);
              *(mqtt->variableHeader.topicFilterArr + i) = malloc(strlen(topicFilter) + 1);

              bzero(*(mqtt->variableHeader.topicFilterArr + i), strlen(topicFilter) + 1);

              memcpy(*(mqtt->variableHeader.topicFilterArr + i), topicFilter, strlen(topicFilter));

              free(topicFilter);
            }
//.........这里部分代码省略.........
开发者ID:weikent,项目名称:C,代码行数:101,代码来源:SendHeart.c

示例14: runQMake

int runQMake(int argc, char **argv)
{
    // stderr is unbuffered by default, but stdout buffering depends on whether
    // there is a terminal attached. Buffering can make output from stderr and stdout
    // appear out of sync, so force stdout to be unbuffered as well.
    // This is particularly important for things like QtCreator and scripted builds.
    setvbuf(stdout, (char *)NULL, _IONBF, 0);

    // parse command line
    int ret = Option::init(argc, argv);
    if(ret != Option::QMAKE_CMDLINE_SUCCESS) {
        if ((ret & Option::QMAKE_CMDLINE_ERROR) != 0)
            return 1;
        return 0;
    }

    QString oldpwd = qmake_getpwd();
#ifdef Q_WS_WIN
    if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/")))
#endif
    {
        if(oldpwd.right(1) != QString(QChar(QDir::separator())))
            oldpwd += QDir::separator();
    }
    Option::output_dir = oldpwd; //for now this is the output dir

    if(Option::output.fileName() != "-") {
        QFileInfo fi(Option::output);
        QString dir;
        if(fi.isDir()) {
            dir = fi.filePath();
        } else {
            QString tmp_dir = fi.path();
            if(!tmp_dir.isEmpty() && QFile::exists(tmp_dir))
                dir = tmp_dir;
        }
        if(!dir.isNull() && dir != ".")
            Option::output_dir = dir;
        if(QDir::isRelativePath(Option::output_dir))
            Option::output_dir.prepend(oldpwd);
        Option::output_dir = QDir::cleanPath(Option::output_dir);
    }

    QMakeProperty prop;
    if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY)
        return prop.exec() ? 0 : 101;

    QMakeProject project(&prop);
    int exit_val = 0;
    QStringList files;
    if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
        files << "(*hack*)"; //we don't even use files, but we do the for() body once
    else
        files = Option::mkfile::project_files;
    for(QStringList::Iterator pfile = files.begin(); pfile != files.end(); pfile++) {
        if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
           Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
            QString fn = Option::fixPathToLocalOS((*pfile));
            if(!QFile::exists(fn)) {
                fprintf(stderr, "Cannot find file: %s.\n", fn.toLatin1().constData());
                exit_val = 2;
                continue;
            }

            //setup pwd properly
            debug_msg(1, "Resetting dir to: %s", oldpwd.toLatin1().constData());
            qmake_setpwd(oldpwd); //reset the old pwd
            int di = fn.lastIndexOf(QDir::separator());
            if(di != -1) {
                debug_msg(1, "Changing dir to: %s", fn.left(di).toLatin1().constData());
                if(!qmake_setpwd(fn.left(di)))
                    fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).toLatin1().constData());
                fn = fn.right(fn.length() - di - 1);
            }

            // read project..
            if(!project.read(fn)) {
                fprintf(stderr, "Error processing project file: %s\n",
                        fn == "-" ? "(stdin)" : (*pfile).toLatin1().constData());
                exit_val = 3;
                continue;
            }
            if(Option::mkfile::do_preprocess) //no need to create makefile
                continue;
        }

        bool success = true;
        MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false, &success);
        if (!success)
            exit_val = 3;

        if(mkfile && !mkfile->write(oldpwd)) {
            if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
                fprintf(stderr, "Unable to generate project file.\n");
            else
                fprintf(stderr, "Unable to generate makefile for: %s\n", (*pfile).toLatin1().constData());
            exit_val = 5;
        }
        delete mkfile;
        mkfile = NULL;
//.........这里部分代码省略.........
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:101,代码来源:main.cpp

示例15: Ganglia_metadata_send_real

int
Ganglia_metadata_send_real( Ganglia_metric gmetric, Ganglia_udp_send_channels send_channels, char *override_string )
{
  int len, i;
  XDR x;
  char gmetricmsg[GANGLIA_MAX_MESSAGE_LEN];
  Ganglia_metadata_msg msg;
  const apr_array_header_t *arr;
  const apr_table_entry_t *elts;
  const char *spoof = SPOOF;
  apr_pool_t *gm_pool=(apr_pool_t*)gmetric->pool;

  if (myhost[0] == '\0') 
      apr_gethostname( (char*)myhost, APRMAXHOSTLEN+1, gm_pool);

  msg.id = gmetadata_full;
  memcpy( &(msg.Ganglia_metadata_msg_u.gfull.metric), gmetric->msg, sizeof(Ganglia_metadata_message));
  msg.Ganglia_metadata_msg_u.gfull.metric_id.name = apr_pstrdup (gm_pool, gmetric->msg->name);
  debug_msg("  msg.Ganglia_metadata_msg_u.gfull.metric_id.name: %s\n", msg.Ganglia_metadata_msg_u.gfull.metric_id.name);
  if ( override_string != NULL )
    {
      msg.Ganglia_metadata_msg_u.gfull.metric_id.host = apr_pstrdup (gm_pool, (char*)override_string);
      debug_msg("  msg.Ganglia_metadata_msg_u.gfull.metric_id.host: %s\n", msg.Ganglia_metadata_msg_u.gfull.metric_id.host);
      msg.Ganglia_metadata_msg_u.gfull.metric_id.spoof = TRUE;
    }
    else
    {
      msg.Ganglia_metadata_msg_u.gfull.metric_id.host = apr_pstrdup (gm_pool, (char*)myhost);
      debug_msg("  msg.Ganglia_metadata_msg_u.gfull.metric_id.host: %s\n", msg.Ganglia_metadata_msg_u.gfull.metric_id.host);
      msg.Ganglia_metadata_msg_u.gfull.metric_id.spoof = FALSE;
    }

  arr = apr_table_elts(gmetric->extra);
  elts = (const apr_table_entry_t *)arr->elts;
  msg.Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_len = arr->nelts;
  msg.Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val = 
      (Ganglia_extra_data*)apr_pcalloc(gm_pool, sizeof(Ganglia_extra_data)*arr->nelts);

  /* add all of the metadata to the packet */
  for (i = 0; i < arr->nelts; ++i) {
      if (elts[i].key == NULL)
          continue;

      /* Replace the host name with the spoof host if it exists in the metadata */
      if ((apr_toupper(elts[i].key[0]) == spoof[0]) && strcasecmp(SPOOF_HOST, elts[i].key) == 0) 
        {
          msg.Ganglia_metadata_msg_u.gfull.metric_id.host = apr_pstrdup (gm_pool, elts[i].val);
          msg.Ganglia_metadata_msg_u.gfull.metric_id.spoof = TRUE;
        }
      if ((apr_toupper(elts[i].key[0]) == spoof[0]) && strcasecmp(SPOOF_HEARTBEAT, elts[i].key) == 0) 
        {
          msg.Ganglia_metadata_msg_u.gfull.metric_id.name = apr_pstrdup (gm_pool, "heartbeat");
          msg.Ganglia_metadata_msg_u.gfull.metric.name = msg.Ganglia_metadata_msg_u.gfull.metric_id.name;
          msg.Ganglia_metadata_msg_u.gfull.metric_id.spoof = TRUE;
        }

      msg.Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].name = 
          apr_pstrdup(gm_pool, elts[i].key);
      msg.Ganglia_metadata_msg_u.gfull.metric.metadata.metadata_val[i].data = 
          apr_pstrdup(gm_pool, elts[i].val);
  }

  /* Send the message */
  xdrmem_create(&x, gmetricmsg, GANGLIA_MAX_MESSAGE_LEN, XDR_ENCODE);
  if(!xdr_Ganglia_metadata_msg(&x, &msg))
    {
      return 1;
    }
  len = xdr_getpos(&x); 
  /* Send the encoded data along...*/
  return Ganglia_udp_send_message( send_channels, gmetricmsg, len);
}
开发者ID:AsherBond,项目名称:monitor-core,代码行数:72,代码来源:libgmond.c


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