HRESULT CTongshiDVBSourceStream::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pRequest) 
{
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::DecideBufferSize()");
  HRESULT hr;
  CAutoLock cAutoLock(m_pFilter->pStateLock());

  CheckPointer(pAlloc, E_POINTER);
  CheckPointer(pRequest, E_POINTER);

  // If the bitmap file was not loaded, just fail here.

  // Ensure a minimum number of buffers
  if (pRequest->cBuffers == 0)
  {
    pRequest->cBuffers = 1;
  }
  pRequest->cbBuffer = MAX_BUFFER_SIZE;

  ALLOCATOR_PROPERTIES Actual;
  hr = pAlloc->SetProperties(pRequest, &Actual);
  if (FAILED(hr)) 
  {
    return hr;
  }

  // Is this allocator unsuitable?
  if (Actual.cbBuffer < pRequest->cbBuffer) 
  {
    return E_FAIL;
  }
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::DecideBufferSize() - finished");

  return S_OK;
}
//
// Stop
//
// Overriden to close the dump file
//
STDMETHODIMP CNetworkProviderFilter::Stop()
{
	CAutoLock cObjectLock(m_pLock);
	LOG4CPLUS_DEBUG(logger,"CNetworkProviderFilter::Stop()");
	HRESULT result =  CBaseFilter::Stop();
	LOG4CPLUS_DEBUG(logger,"CNetworkProviderFilter::Stop() completed");
	return result;
}
//
// Pause
//
// Overriden to open the dump file
//
STDMETHODIMP CNetworkProviderFilter::Pause()
{
	LOG4CPLUS_DEBUG(logger,"CNetworkProviderFilter::Pause()");
	CAutoLock cObjectLock(m_pLock);
	if (m_pNetworkProvider != NULL){
	}
	LOG4CPLUS_DEBUG(logger,"CNetworkProviderFilter::Pause() finished");
	return CBaseFilter::Pause();
}
void ContentQuotaScheduler::SetActiveMaxCap(const uint32_t p_maxcap)
{
    LOG4CPLUS_DEBUG(g_logger, "ENTER: SetActiveMaxCap--max_active_rid_num: " << max_active_rid_num << " p_maxcap:" << p_maxcap 
        << "active_minute_count: " << active_minute_count );
    max_active_rid_num = p_maxcap;
    active_minute_count = max_active_rid_num;
    LOG4CPLUS_DEBUG(g_logger, "EXIT: SetActiveMaxCap--max_active_rid_num: " << max_active_rid_num << " p_maxcap:" << p_maxcap 
        << "active_minute_count: " << active_minute_count );
}
Esempio n. 5
0
	static void ForwardString(log4cplus::Logger &app_instance,
		LogLevel log_level, const char *out_string) {
		if (out_string == NULL)
			out_string = "";
#ifdef _Windows
# pragma warning(push)
# pragma warning(disable:4127)
#endif // #ifdef _Windows
		switch (log_level) {
			case LogLevel_Literal   :
				LOG4CPLUS_TRACE(app_instance, out_string);
				break;
			case LogLevel_Spam      :
				LOG4CPLUS_TRACE(app_instance, out_string);
				break;
			case LogLevel_Minutiae  :
				LOG4CPLUS_TRACE(app_instance, out_string);
				break;
			case LogLevel_Debug     :
				LOG4CPLUS_DEBUG(app_instance, out_string);
				break;
			case LogLevel_Detail    :
				LOG4CPLUS_DEBUG(app_instance, out_string);
				break;
			case LogLevel_Info      :
				LOG4CPLUS_INFO(app_instance, out_string);
				break;
			case LogLevel_Notice    :
				LOG4CPLUS_WARN(app_instance, out_string);
				break;
			case LogLevel_Warning   :
				LOG4CPLUS_WARN(app_instance, out_string);
				break;
			case LogLevel_Error     :
				LOG4CPLUS_ERROR(app_instance, out_string);
				break;
			case LogLevel_Critical  :
				LOG4CPLUS_ERROR(app_instance, out_string);
				break;
			case LogLevel_Alert     :
				LOG4CPLUS_ERROR(app_instance, out_string);
				break;
			case LogLevel_Emergency :
				LOG4CPLUS_ERROR(app_instance, out_string);
				break;
			case LogLevel_Fatal     :
				LOG4CPLUS_FATAL(app_instance, out_string);
				break;
			default						:
				LOG4CPLUS_ERROR(app_instance, out_string);
				break;
#ifdef _Windows
# pragma warning(pop)
#endif // #ifdef _Windows
		}
	}
void ContentQuotaScheduler::QuotaRestore(const int target)
{
    LOG4CPLUS_DEBUG(g_logger, "ENTER: QuotaRestore--daily_count:" << daily_count
        << " minute_count:" << minute_count << " target:" << target);
    if (target > 0) {
        daily_count += target;
        minute_count += target;
    }
    LOG4CPLUS_DEBUG(g_logger, "EXIT: QuotaRestore--daily_count:" << daily_count
        << " minute_count:" << minute_count << " target:" << target);

}
bool CNetworkProvider::CheckCapabilities(IBaseFilter* filter){
	IBDA_Topology* topology;
	LOG4CPLUS_DEBUG(logger,"CheckCapabilities - START");
	if(filter->QueryInterface(_uuidof(IBDA_Topology),  (void**) &topology) == S_OK){
		// Check For interfaces
		CheckInterfaces(topology);
		// Check for tuning Types
		CheckTuningType(topology);
	}
	LOG4CPLUS_DEBUG(logger,"CheckCapabilities - FINISHED");
	return S_OK;
}
void RTSPMJPEGClient::threadLoop(RTSPMJPEGClientParameters *parameters)
{
    int clientId = parameters->clientId;

    RTSPMJPEGClient *instance = getInstance();
    RTSPMJPEGClientStruct *pClient = instance->clients[clientId];

    if (pClient == NULL)
    {
        pClient = new RTSPMJPEGClientStruct;

        pClient->clientId = clientId;
        pClient->state = RTSPMJPEGCLIENT_STATE_CLEANED;
        pClient->isWaiting = false;
        pClient->newFramesNum = 0;
        pClient->next = 0;

        for (int i = 0; i < RTSPMJPEGCLIENT_FRAME_QUEUE_LEN; i++)
        {
            pClient->frameQueue[i] = (uint8_t * ) av_malloc(RTSPMJPEGCLIENT_FRAME_BUFFER_SIZE);
            pClient->frameSizes[i] = 0;
        }

        instance->clients[clientId] = pClient;

        LOG4CPLUS_DEBUG(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] allocated space for a new client...");
    }

    LOG4CPLUS_TRACE(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] threadLoop()...");

    pClient->address = ((RTSPMJPEGClientParameters * ) parameters)->address;

    delete parameters;

    if (instance->_init(pClient) < 0)
    {
        instance->_clean(pClient, RTSPMJPEGCLIENT_STATE_ERROR);
        LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_ERROR_LOGGER)), "[CLIENT " << pClient->clientId << "] init failed!");
        LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] init failed!");

        return;
    }

    pClient->state = RTSPMJPEGCLIENT_STATE_LOOPING;

    while (pClient->state == RTSPMJPEGCLIENT_STATE_LOOPING && instance->_readFrame(pClient) == 0)
        LOG4CPLUS_DEBUG(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] while()...");

    // set CLEANED only if it was correctly stopped. ERROR otherwise. Don't set
    // any state greater then CLEANED because they're all states indicating an
    // action being taken
    instance->_clean(pClient, pClient->state == RTSPMJPEGCLIENT_STATE_STOPPING ? RTSPMJPEGCLIENT_STATE_CLEANED : RTSPMJPEGCLIENT_STATE_ERROR);
}
HRESULT CNetworkProvider::RegisterDeviceFilter(IUnknown* pUnkFilterControl,ULONG* ppvRegisitrationContext) {
	RegisterDevice* device;
	FILTER_INFO filterinfo;
	HRESULT hr;
	IBaseFilter* filter;
	LOG4CPLUS_INFO(logger,"RegisterDeviceFilter start");
	IMpeg2Demultiplexer* demux;
	if (m_pNetworkProviderPin->GetConnected() != NULL){
		hr = m_pNetworkProviderPin->CreateOutputPin(m_pNetworkProviderPin->GetConnected());
	}
	CAutoLock lock(&m_Lock);
	if (pUnkFilterControl == NULL){
		return E_POINTER;
	}
	if (&ppvRegisitrationContext == NULL ){
		return E_POINTER;
	}
	hr = pUnkFilterControl->QueryInterface(IID_IBaseFilter, (void**) &filter);
	if (hr != S_OK ){
		return S_FALSE;
	}
	hr = filter->QueryFilterInfo(&filterinfo);
	filterinfo.pGraph = NULL;
	if (hr != S_OK ){
		return S_FALSE;
	}
	LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter checks finished");
	m_fid = m_fid + 1;
	device = new RegisterDevice();
	device->id = m_fid;
	device->control = filter;
	wcstombs( device->name, filterinfo.achName, sizeof(device->name)); 
	ppvRegisitrationContext = &m_fid;
	hr = pUnkFilterControl->QueryInterface(IID_IMpeg2Demultiplexer, (void**) &demux);
	if (hr == S_OK ){
		LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
		device->control = NULL;
		delete device;
		LOG4CPLUS_INFO(logger,"RegisterDeviceFilter demux skipped");
		return S_FALSE;
	}else{
		LOG4CPLUS_INFO(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
		IBDA_DeviceControl* ctrl;
		if( filter->QueryInterface(_uuidof(IBDA_DeviceControl), (void**) &ctrl)==S_OK){
			device->deviceControl=ctrl;
		}
		m_vecDevices.push_back(device);
		CheckCapabilities(filter);
	}
	LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter finished");
	return S_OK;
}
Esempio n. 10
0
void KeyPanel::keyThreadReader() {
  Logger logdev = Logger::getInstance(LOGDEVICE);
  this->running = true;
  struct input_event ev;
  int size = sizeof(ev);
  int nread = 0;
  while (running) {
    // blocking event reader
    nread = read(this->fd, &ev, size);
    if (nread != size) {
      LOG4CPLUS_WARN(
          logdev,
          "read size error (s=" << (running ? "true" : "false") << " r="
              << nread << "e=" << size << ")");
      if (running)
        continue;
    }
    if (!running)
      break;
    LOG4CPLUS_TRACE(
        logdev,
        "(" << keyCounter << ") code=" << ev.code << " type=" << ev.type
            << " value=" << ev.value << " s=" << ev.time.tv_sec << " u="
            << ev.time.tv_usec);

    switch (ev.type) {
      case EV_KEY:
        this->key.loadEvent(ev);
        LOG4CPLUS_DEBUG(logdev, "EV_KEY " << string(this->key));
        break;
      case EV_SYN:
        this->key.validateEvent(ev);
        keyCounter++;
        LOG4CPLUS_DEBUG(
            logdev,
            "EV_SYN (" << std::to_string(keyCounter) << string(") ")
                << string(this->key));
        if (this->key.isPressEvent()) {
          keyPressObs(this->key);
        } else {
          keyReleaseObs(this->key);
        }

        if (this->key.isLongEvent()) {
          keyLongPressObs(this->key);
        }
        break;
    }

  }
  LOG4CPLUS_DEBUG(logdev, "KeyPanel thread exit\n");
}
Esempio n. 11
0
  /**
   * event reader
   */
  void key_thread_reader() {
    Logger logdev = Logger::getInstance(LOGDEVICE);
    this->running = true;
    struct input_event ev;
    int size = sizeof(ev);
    int nread = 0;
    while (running) {
      // blocking event reader
      nread = read(this->fd, &ev, size);
      if (nread != size) {
        LOG4CPLUS_WARN(
            logdev,
            "read size error (s=" << (running ? "true" : "false") << " r="
                << nread << "e=" << size << ")");
        if (running)
          continue;
      }
      if (!running)
        break;
      LOG4CPLUS_TRACE(
          logdev,
          "(" << key_counter << ") code=" << ev.code << " type=" << ev.type
              << " value=" << ev.value << " s=" << ev.time.tv_sec << " u="
              << ev.time.tv_usec);

      switch (ev.type) {
        case EV_KEY:
          this->key.load_event(ev);
          LOG4CPLUS_DEBUG(logdev, "EV_KEY " << string(this->key));
          break;
        case EV_SYN:
          this->key.validate_event(ev);
          key_counter++;
          //TODO: overload operator << for keybutton
          LOG4CPLUS_DEBUG(logdev, "EV_SYN " << string(this->key));
          if (this->key.isPressEvent()) {
            key_press_obs(this->key);
          } else {
            key_release_obs(this->key);
          }

          if (this->key.isLongEvent()) {
            key_long_obs(this->key);
          }
          break;
      }

    }
    LOG4CPLUS_DEBUG(logdev, "KeyPanel thread exit\n");
  }
Esempio n. 12
0
void CTongshiDVBSourceStream::Clear() 
{
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::Clear()");

  if(CAMThread::ThreadExists())
  {
    CAMThread::CallWorker(CMD_EXIT);
    CAMThread::Close();
  }
  if(m_dataPort!=NULL){
    TSDVB_DeleteDataPort(m_dataPort);
    m_dataPort = NULL;
  }
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::Clear() - finished");
}
Esempio n. 13
0
bool writeToQueue(std::string jsonResult)
{
  try
  {
    Beanstalk::Client client(BEANSTALK_QUEUE_HOST, BEANSTALK_PORT);
    client.use(BEANSTALK_TUBE_NAME);

    int id = client.put(jsonResult);
    
    if (id <= 0)
    {
      LOG4CPLUS_ERROR(logger, "Failed to write data to queue");
      return false;
    }
    
    LOG4CPLUS_DEBUG(logger, "put job id: " << id );

  }
  catch (const std::runtime_error& error)
  {
    LOG4CPLUS_WARN(logger, "Error connecting to Beanstalk.  Result has not been saved.");
    return false;
  }
  return true;
}
Esempio n. 14
0
  int start() {
    Logger logdev = Logger::getInstance(LOGDEVICE);

    if (running || event_dev.empty()) {
      LOG4CPLUS_ERROR(
          logdev,
          (running ? "Already running" : "")
              << (event_dev.empty() ? "No event device" : "") << endl);
      return (-1);
    }

    if ((fd = open(this->event_dev.c_str(), O_RDONLY)) < 0) {
      LOG4CPLUS_ERROR(
          logdev,
          __PRETTY_FUNCTION__
              << (string("unable to open ") + this->event_dev
                  + string(strerror(errno))).c_str());
      throw std::runtime_error(
          (string("unable to open ") + this->event_dev + string(strerror(errno)))
              .c_str());
    }
    this->key_thread = std::thread([&] {KeyPanel::key_thread_reader();});
    LOG4CPLUS_DEBUG(logdev, "key reader started");
    return (0);
  }
Esempio n. 15
0
STDMETHODIMP CTongshiDVBSource::DeactivateCard () {
  CAutoLock lock(&m_Lock);
  LOG4CPLUS_DEBUG(logger,"CTongshiDVBSource::DeactivateCard");
  try{
    if(m_cardHandle==NULL){
      LOG4CPLUS_DEBUG(logger,"CTongshiDVBSource::DeactivateCard - no card handle available");
      return S_FALSE;
    }
    TSDVB_CloseDevice(m_cardHandle);
    m_cardHandle = NULL;
  }catch(...){
    m_cardHandle = NULL;
  }
  LOG4CPLUS_DEBUG(logger,"CTongshiDVBSource::DeactivateCard - finish");
  return S_OK;
}
Esempio n. 16
0
HRESULT CTongshiDVBSourceStream::FillBuffer(IMediaSample *pSamp)
{
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::FillBuffer()");

  BYTE *pData;
  long cbData;
  DWORD dwByteRead = 0;
  CheckPointer(pSamp, E_POINTER);

  CAutoLock cAutoLock(m_pFilter->pStateLock());

  // Access the sample's data buffer
  pSamp->GetPointer(&pData);
  cbData = pSamp->GetSize();

  if(m_dataPort!=NULL){
    TSDVB_ReadDataPort(m_dataPort,pData,cbData,&dwByteRead);
  }

  REFERENCE_TIME rtStart = m_seqNumber;
  REFERENCE_TIME rtStop  = rtStart + 1;

  pSamp->SetTime(&rtStart, &rtStop);
  pSamp->SetActualDataLength(dwByteRead);

  m_seqNumber++;
  pSamp->SetSyncPoint(TRUE);
  LOG4CPLUS_INFO(logger, "CTongshiDVBSourceStream::FillBuffer() - finished");

  return S_OK;
}
int ContentQuotaScheduler::QuerySchedulerForQuota(const int target)
{
    //we first check whether we are in pause time frame.
    LOG4CPLUS_DEBUG(g_logger, "ENTER: QuerySchedulerForQuota--daily_count: " << daily_count 
        << "minute_count: " << minute_count << " target: " << target);
    if ( (daily_count >= target) && (minute_count >= target) ) {
        daily_count -= target;
        minute_count -= target;
        LOG4CPLUS_DEBUG(g_logger, "EXIT1: QuerySchedulerForQuota--daily_count: " << daily_count 
            << "minute_count: " << minute_count << " target: " << target);
        return target;
    }
    LOG4CPLUS_DEBUG(g_logger, "EXIT2: QuerySchedulerForQuota--daily_count: " << daily_count 
        << "minute_count: " << minute_count << " target: " << target);
    return 0;
}
int ContentQuotaScheduler::QuerySchedulerForActiveQuota(const int target, int quota_type)
{
    LOG4CPLUS_DEBUG(g_logger, "ENTER: QuerySchedulerForActiveQuota--active_minute_count: " << active_minute_count << " target: " << target);
    if (active_minute_count >= target) {
        active_minute_count -= target;
        active_daily_total += target;
        if (quota_type == 1) {
            vip_daily_total += target;
            vip_minute_total += target;
        }
        LOG4CPLUS_DEBUG(g_logger, "EXIT1: QuerySchedulerForActiveQuota--active_minute_count: " << active_minute_count << " target: " << target);
        return target;
    }
    LOG4CPLUS_DEBUG(g_logger, "EXIT2: QuerySchedulerForActiveQuota--active_minute_count: " << active_minute_count << " target: " << target);
    return 0;
}
Esempio n. 19
0
void Logging::Debug(const string& msg) {
    if("" == logger_name_) {
        fprintf(stderr, "has not set logger\n");
        return;
    }
    LOG4CPLUS_DEBUG(logger_, msg);
}
Esempio n. 20
0
int CCrawl::response_status_function()
{
	m_responseheaders.getResponseparameterFromSrc(m_CRequestUrl.getCRequestUrl(), m_httpRequest->m_responseHeader);

	int status_code = 0;
	status_code = atoi(m_responseheaders.getStatusCode().c_str());
	LOG4CPLUS_DEBUG(ClogCPP::m_logger, status_code);
	return status_code;
	switch(status_code)
	{
	case 200:
		response_return_code_200();
		break;
	case 204:
		response_return_code_204();
		break;
	case 206:
		response_return_code_206();
		break;
	case 301:
		response_return_code_301();
		break;
	case 302:
		response_return_code_302();
		break;
	case 303:
		response_return_code_303();
		break;
	case 304:
		response_return_code_304();
		break;
	case 307:
		response_return_code_307();
		break;
	case 400:
		response_return_code_400();
		break;
	case 401:
		response_return_code_401();
		break;
	case 403:
		response_return_code_403();
		break;
	case 404:
		response_return_code_404();
		break;
	case 405:
		response_return_code_200();
		break;
	case 500:
		response_return_code_500();
		break;
	case 503:
		response_return_code_503();
		break;
	default:
		break;
	}
	return status_code;
}
Esempio n. 21
0
/**
 * Calculate pose of the camera. Since no translation are made
 * Only the rotation is calculated.
 *
 * [R|T]
 */
CvMat* MultipleViewGeomOld::calculateRotationMatrix(float angle) {

    // | R T |
    // | 0 1 |
    // 1 	 0 	    0 	0
    // 0 cos() -sin()   0
    // 0 sin()  cos()   0
    // 0     0      0   1

    float sinTeta = sin(angle);
    float cosTeta = cos(angle);

    float a[] = { 1, 0, 0, 0, 0, cosTeta, -sinTeta, 0, 0, sinTeta, cosTeta, 0,
                  0, 0, 0, 1
                };

    //CvMat rtMat = cvMat(4, 4, CV_32FC1, a);
    //rtMat = *cvCloneMat(&rtMat);

    CvMat* rtMat = cvCreateMat(4, 4, CV_32F);
    cvInitMatHeader(rtMat, 4, 4, CV_32F, a);
    rtMat = cvCloneMat(rtMat);

    LOG4CPLUS_DEBUG(myLogger,"Rotation R|T matrix for angle: " << angle << endl << printCvMat(rtMat));

    return rtMat;

}
Esempio n. 22
0
/**
 * Projects a point in real world coordinates against the image
 * Output: image coordinate in pixels
 */
CvPoint MultipleViewGeomOld::getProjectionOf(float angle, CvPoint3D32f point) {

    //
    map<float, CvMat*>::iterator iter = projMatList.find(angle);

    CvMat *projMat = cvCreateMat(4, 3, CV_32FC1);

    if (iter == projMatList.end()) {
        // project matrix does not exist!!

        // Calculate rotation matrix
        CvMat* rtMat = calculateRotationMatrix(angle);

        // Calculate projection matrix
        projMat = calculateProjectionMatrix(rtMat);

        projMat = cvCloneMat(projMat);

        projMatList.insert(pair<float, CvMat*> (angle, projMat));

    } else {
        // otherwise it exists
        projMat = iter->second;
    }

    LOG4CPLUS_DEBUG(myLogger,"Projection matrix for angle: " << radToDegree(angle) << " and points: " << point << endl <<  printCvMat(projMat));

    //  [u v 1] = proj * [X Y Z 1]

    float uvContents[3];
    //CvMat* uvMat = cvMat(3, 1, CV_32F, uvContents);
    CvMat* uvMat = cvCreateMat(3, 1, CV_32F);
    cvInitMatHeader(uvMat, 3, 1, CV_32F, uvContents);


    float xyzContents[] = { point.x, point.y, point.z, 1 };
    //CvMat* xyzMat = cvMat(4, 1, CV_32F, xyzContents);
    CvMat* xyzMat = cvCreateMat(4, 1, CV_32F);
    cvInitMatHeader(xyzMat, 4, 1, CV_32F, xyzContents);

    cvMatMul (projMat, xyzMat,uvMat);

    LOG4CPLUS_DEBUG(myLogger, "Result [u v 1] = proj * [X Y Z 1]: " << endl << printCvMat(uvMat));

    return cvPoint(cvRound(cvmGet(uvMat, 0, 0)), cvRound(cvmGet(uvMat, 1, 0)));

}
Esempio n. 23
0
int CCrawl::getResponseData()
{
	try
	{
	sendUrl(m_httpRequest);
	sendHeaders(m_httpRequest);
	m_httpRequest->initCurlData();
	sendProxy(m_httpRequest);
	m_httpRequest->getHeaderData();
	if(m_requestMode == GET)
	{
        LOG4CPLUS_DEBUG(ClogCPP::m_logger,"http request mode: GET");
		m_httpRequest->perform();
		m_httpRequest->getContentType();
	    if(m_httpRequest->m_contentType.find("text", 0) == 0)
	    {
			m_httpRequest->getWritaData();
			m_httpRequest->perform();
	    }
	    else if(m_httpRequest->m_contentType.find("image", 0) == 0) //app faild
	    {
			string cmd = string("wget -P ./ ")+m_CRequestUrl.getCRequestUrl();
			//cout<<cmd<<endl;
			system(cmd.c_str());
			//m_httpRequest->getWritaDataToFile(m_CRequestUrl.getFilename());
			//m_httpRequest->perform();
	    }
	}
	if(m_requestMode == POST)
	{
        LOG4CPLUS_DEBUG(ClogCPP::m_logger,"http request mode: POST");
		sendPostdata(m_httpRequest);
		m_httpRequest->getWritaData();
		m_httpRequest->perform();
	}
	}catch(std::exception &e)
	{
		cout<<e.what()<<endl;
		return 0;
	}catch(...)
	{
		printf("error catch! \n");
		return 0;
	}

}
Esempio n. 24
0
	ServiceModule::ServiceModule(void)
		: m_bService(false)
		, ThreadID(0)
	{
		log = log4cplus::Logger::getInstance("chilli.ServiceModule");
		lstrcpy(m_szServiceName,SERVICENAME_DEFAULT);
		LOG4CPLUS_DEBUG(log,"constructor.");
	}
Esempio n. 25
0
HRESULT CTongshiDVBSourceStream::GetMediaType(__inout CMediaType *pMediaType) 
{
  LOG4CPLUS_DEBUG(logger, "CTongshiDVBSourceStream::GetMediaType()");

  pMediaType->majortype = MEDIATYPE_Stream;
  pMediaType->subtype = MEDIASUBTYPE_MPEG2_TRANSPORT;

  return S_OK;
}
Esempio n. 26
0
//
// Run
//
// Overriden to open the dump file
//
STDMETHODIMP CNetworkProviderFilter::Run(REFERENCE_TIME tStart)
{
	LOG4CPLUS_DEBUG(logger,"CNetworkProviderFilter::Run()");
	CAutoLock cObjectLock(m_pLock);
	if(m_pNetworkProvider!=NULL){
		m_pNetworkProvider->Retune();
	}
	return CBaseFilter::Run(tStart);
}
Esempio n. 27
0
// ÐÂsession£¬
int CSessionManager::newSession(const CSession &csSession)
{
    m_mapSession[csSession.m_strSession] = csSession;

    Maintain();

    LOG4CPLUS_DEBUG(LOG_WEBSERVICES, "newSession:" << csSession.m_strSession);

    return 0;
}
Esempio n. 28
0
void AsyncRedisMgr::connect_callback(const redisAsyncContext * c,int status)
{
	if (status != REDIS_OK)
	{
		LOG4CPLUS_ERROR(logger,"connect redis fail: "<<c->errstr);
		return;
	}

	LOG4CPLUS_DEBUG(logger,"connect redis succ.");
}
Esempio n. 29
0
bool GoodsHandler::decodeParam(IDataX * ptr, int& game_id, int & tooltype)
{
	if(NULL == ptr) return false;

	bool rst = ptr->GetInt(DataID_GameId, game_id);
	rst = ptr->GetInt(DataID_ToolType, tooltype);
	LOG4CPLUS_DEBUG(FLogger, "decodeParam GoodsHandler game_id = "<< game_id << " tooltype = " << tooltype);
	
	return rst;
}
Esempio n. 30
0
	long ServiceModule::RegisterServer(bool bService)
	{
		LOG4CPLUS_DEBUG(log,"register server.");
		Uninstall();
		if (bService)
		{
			return Install();
		}
		return 0;
	}