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


C++ readResponse函数代码示例

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


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

示例1: readResponse

boolean VC0706::runCommand(uint8_t cmd, uint8_t *args, uint8_t argn, 
uint8_t resplen, boolean flushflag) {

  // flush out anything in the buffer?
  if (flushflag) {
    readResponse(100, 10); 
  }
//  Serial.print("SerialNum: ");
//  Serial.println(serialNum);
//  Serial.print("command: ");
//  Serial.println(cmd);
//  Serial.print("argn: ");
//  Serial.println(argn);
//  Serial.print("args: ");
//  for (int ii = 0; ii < argn; ii++)
//  {
//    Serial.print(args[ii]);
//    Serial.print(",");
//  }
//  Serial.println("\n");
  sendCommand(cmd, args, argn);
  if (readResponse(resplen, 200)!= resplen) 
  {
    Serial.println("Response not the right length or too late");
    return false;
  }
  if (! verifyResponse(cmd))
  {
    return false;
  }
  return true;
}
开发者ID:mrmoss,项目名称:puma_gcs,代码行数:32,代码来源:VC0706.cpp

示例2: debug

void DigiFi::endATMode()
{
    //back to trasparent mode
    Serial1.print("AT+E\r");
    debug(readResponse(0)); 
    Serial1.print("AT+ENTM\r");
    debug(readResponse(0));
    debug("exit at mode");
}
开发者ID:vimes79,项目名称:DigiFi,代码行数:9,代码来源:DigiFi.cpp

示例3: readResponse

boolean Camera::runCommand(uint8_t cmd, uint8_t *args, uint8_t argn,
	uint8_t resplen, boolean flushflag) {
	if (flushflag) {
		readResponse(100, 10);
	}
	sendCommand(cmd, args, argn);
	if (readResponse(resplen, 200) != resplen)
		return false;
	if (!verifyResponse(cmd))
		return false;
	return true;
}
开发者ID:sup4r,项目名称:DIY-Thermocam,代码行数:12,代码来源:Camera.cpp

示例4: readResponse

boolean camera_VC0706::runCommand(uint8_t cmd, uint8_t *args, uint8_t argn,
                                  uint8_t resplen, boolean flushflag) {
	// flush out anything in the buffer?
	if (flushflag) {
		readResponse(100, 10);
	}

	sendCommand(cmd, args, argn);
	if (readResponse(resplen, 200) != resplen)
		return false;
	if (! verifyResponse(cmd))
		return false;
	return true;
}
开发者ID:src-electricdunebuggy,项目名称:camera-testing,代码行数:14,代码来源:camera_VC0706.cpp

示例5: runCommand

int runCommand(uint8_t cmd, uint8_t *args, uint8_t argn,
	uint8_t resplen, int flushflag) {
	// flush out anything in the buffer?
	if (flushflag) {
		readResponse(100, 10);
	}

	sendCommand(cmd, args, argn);
	if (readResponse(resplen, 200) != resplen)
		return 0;
	if (!verifyResponse(cmd))
		return 0;
	return 1;
}
开发者ID:BrendanGraham14,项目名称:CDH-Subsystem_Common,代码行数:14,代码来源:camera.c

示例6: description

/* This function does initiate a search for a keyword in all EPG Event of the Channel channel_id in sectionsd.
   The parameter search_typ does specify the search mode
	 0: none 			-> all EPG events of the channel are returned
	 1: keyword search in EPG Title
	 2: keyword search in EPG short description (INFO1)
	 3: keyword search in EPG description (INFO2)
  In case of a match, the EPG event is added to the Eventlist eList.
  */
bool CSectionsdClient::getEventsServiceKeySearchAdd(CChannelEventList& eList,const t_channel_id channel_id,char search_typ,std::string& search_text)
{
	int nBufSize=0;

	nBufSize += sizeof(t_channel_id);
	nBufSize += sizeof(char);
	nBufSize += search_text.size()+1;

	char* pSData = new char[nBufSize];
	char* pSData_ptr = pSData;

	*(t_channel_id*)pSData_ptr = channel_id;
	pSData_ptr += sizeof(t_channel_id);
	*pSData_ptr = search_typ;
	pSData_ptr += sizeof(char);
	strcpy(pSData_ptr,search_text.c_str());

	if (send(sectionsd::allEventsChannelIDSearch, pSData, nBufSize))
	{
		int nBufSize2 = readResponse();

		if( nBufSize2 > 0)
		{
			char* pData = new char[nBufSize2];
			receive_data(pData, nBufSize2);

			char* dp = pData;

//			int a = eList.size();

			while(dp < pData + nBufSize2)
			{
				CChannelEvent aEvent;

				aEvent.eventID = *((event_id_t *) dp);
				dp+=sizeof(aEvent.eventID);

				aEvent.startTime = *((time_t *) dp);
				dp+=sizeof(aEvent.startTime);

				aEvent.duration = *((unsigned *) dp);
				dp+=sizeof(aEvent.duration);

				aEvent.description= dp;
				dp+=aEvent.description.length()+1;

				aEvent.text= dp;
				dp+=aEvent.text.length()+1;

				eList.push_back(aEvent);
			}
//			int b = eList.size() -a;
			delete[] pData;
		}
	}
	delete[] pSData;

	close_connection();
	return true;
}
开发者ID:n3wb13,项目名称:neutrinohd2,代码行数:68,代码来源:sectionsdclient.cpp

示例7: readResponse

void DigiFi::setPageDisplayMode(char *mode)//WEBSWITCH (iw|ew)
{
    Serial1.print("AT+WEBSWITCH=");
    Serial1.print(mode);
    Serial1.print("\r");
    readResponse(0);
}
开发者ID:vimes79,项目名称:DigiFi,代码行数:7,代码来源:DigiFi.cpp

示例8: autoLock

bool MtpDevice::sendObject(MtpObjectInfo* info, int srcFD) {
    Mutex::Autolock autoLock(mMutex);

    int remaining = info->mCompressedSize;
    mRequest.reset();
    mRequest.setParameter(1, info->mHandle);
    if (sendRequest(MTP_OPERATION_SEND_OBJECT)) {
        // send data header
        writeDataHeader(MTP_OPERATION_SEND_OBJECT, remaining);

        char buffer[65536];
        while (remaining > 0) {
            int count = read(srcFD, buffer, sizeof(buffer));
            if (count > 0) {
                int written = mData.write(mRequestOut, buffer, count);
                // FIXME check error
                remaining -= count;
            } else {
                break;
            }
        }
    }
    MtpResponseCode ret = readResponse();
    return (remaining == 0 && ret == MTP_RESPONSE_OK);
}
开发者ID:DARKPOP,项目名称:frameworks_av,代码行数:25,代码来源:MtpDevice.cpp

示例9: readResponse

std::string CSectionsdClient::getStatusinformation(void)
{
	std::string ret = "";

	if (send(sectionsd::dumpStatusinformation))
	{
		int nBufSize = readResponse();
		if( nBufSize > 0)
		{
			char* pData = new char[nBufSize];
			if (!receive_data(pData, nBufSize))
			{
				/* receive_data might have timed out etc. */
				delete[] pData;
				close_connection();
				return ret; // still empty.
			}

			ret = pData; 
			delete[] pData;
		}
		else
			printf("no response from sectionsd\n");
	}

	close_connection();
	
	return ret;
}
开发者ID:OpenDMM,项目名称:tuxbox-apps,代码行数:29,代码来源:sectionsdclient.cpp

示例10: readResponse

bool CSectionsdClient::getNVODTimesServiceKey(const t_channel_id channel_id, CSectionsdClient::NVODTimesList& nvod_list)
{
	if (send(sectionsd::timesNVODservice, (char*)&channel_id, sizeof(channel_id)))
	{
		nvod_list.clear();

		int nBufSize = readResponse();

		char* pData = new char[nBufSize];
		receive_data(pData, nBufSize);
		char* dp = pData;

		CSectionsdClient::responseGetNVODTimes response;

		while( dp< pData+ nBufSize )
		{
			response.service_id = *(t_service_id *) dp;			dp += sizeof(t_service_id);
			response.original_network_id = *(t_original_network_id *) dp;	dp += sizeof(t_original_network_id);
			response.transport_stream_id = *(t_transport_stream_id *) dp;	dp += sizeof(t_transport_stream_id);
			response.zeit = *(CSectionsdClient::sectionsdTime*) dp;		dp += sizeof(CSectionsdClient::sectionsdTime);

			nvod_list.insert( nvod_list.end(), response);
		}
		close_connection();
		return true;
	}
	else
	{
		close_connection();
		return false;
	}
}
开发者ID:GWARDAR,项目名称:OpenPLi-1,代码行数:32,代码来源:sectionsdclient.cpp

示例11: sendCommandName

// Try to make the modem go to sleep.
// It is recommended to call this after the modem has been 
// woken up through the wakeup pin.
bool Hiber::goToSleep(GoToSleepResult *result, int *reason, int *seconds_left)
{
  sendCommandName("go_to_sleep");
  sendCommandFinish();

  String arguments[2];
  int arguments_returned = 0;
  short code = readResponse(arguments, 2, &arguments_returned);

  switch (code) {
    case RESPONSE_STARTING_TO_SLEEP: {
      int _reason = arguments[0].toInt();
      if (_reason == 0) {
        *result = GTSR_OK_ONLY_WKUP0;
      }
      else {
        *result = GTSR_OK;
      }
      if (reason != nullptr) *reason = arguments[0].toInt();
      if (reason != nullptr) *seconds_left = arguments[1].toInt();
      return true;
    }
    case RESPONSE_CANNOT_SLEEP_WKUP0_HIGH: {
      *result = GTSR_WAKEUP0_HIGH;
      return false;
    }
    default: {
      *result = GTSR_ERROR;
      return false;
    }
  }
}
开发者ID:anbalaster,项目名称:arduino-devkit-code,代码行数:35,代码来源:HiberCalls.cpp

示例12: readResponse

CNetDataImpl* CNetRequestImpl::sendString(const String& strBody)
{
    CNetDataImpl* pNetData = new CNetDataImpl;

    do
    {
        if ( isError() )
            break;

        CAtlStringW strHeaders = L"Content-Type: application/x-www-form-urlencoded\r\n";
        if ( !HttpAddRequestHeaders( hRequest, strHeaders, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE ) )
        {
            pszErrFunction = L"HttpAddRequestHeaders";
            break;
        }

        if ( !HttpSendRequest( hRequest, NULL, 0, const_cast<char*>(strBody.c_str()), strBody.length() ) )
        {
            pszErrFunction = L"HttpSendRequest";
            break;
        }
        //Sleep(5000);
        readResponse(pNetData);
    }while(0);

    return pNetData;
}
开发者ID:ravitheja22,项目名称:rhodes,代码行数:27,代码来源:NetRequestImpl.cpp

示例13: send

void CSectionsdClient::freeMemory()
{
	send(sectionsd::freeMemory);

	readResponse();
	close_connection();
}
开发者ID:n3wb13,项目名称:neutrinohd2,代码行数:7,代码来源:sectionsdclient.cpp

示例14: readResponse

CNetResponseImpl* CNetRequestImpl::downloadFile(common::CRhoFile& oFile)
{
    CNetResponseImpl* pNetResp = new CNetResponseImpl;

    do
    {
        if ( isError() )
            break;

        if ( !HttpSendRequest( hRequest, NULL, 0, NULL, 0 ) )
        {
            pszErrFunction = L"HttpSendRequest";
            break;
        }

        readResponse(pNetResp);
        if ( isError() )
            break;

        readInetFile(hRequest,pNetResp, &oFile);

    }while(0);

    return pNetResp;
}
开发者ID:myogesh,项目名称:rhodes,代码行数:25,代码来源:NetRequestImpl.cpp

示例15: HTTP_DEBUG_PRINT

// The mother- generic request method.
//
int RestClient::request(const char* method, const char* path,
                  const char* body, String* response){

  HTTP_DEBUG_PRINT("HTTP: connect\n");

  if(client.connect(host, port)){
    HTTP_DEBUG_PRINT("HTTP: connected\n");
    HTTP_DEBUG_PRINT("REQUEST: \n");
    // Make a HTTP request line:
    write(method);
    write(" ");
    write(path);
    write(" HTTP/1.1\r\n");
    for(int i=0; i<num_headers; i++){
      write(headers[i]);
      write("\r\n");
    }
    write("Host: ");
    write(host);
    write("\r\n");
    write("Connection: close\r\n");

    if(body != NULL){
      char contentLength[30];
      sprintf(contentLength, "Content-Length: %d\r\n", strlen(body));
      write(contentLength);

      if(!contentTypeSet){
        write("Content-Type: application/x-www-form-urlencoded\r\n");
      }
    }

    write("\r\n");

    if(body != NULL){
      write(body);
      write("\r\n");
      write("\r\n");
    }

    //make sure you write all those bytes.
    delay(100);

    HTTP_DEBUG_PRINT("HTTP: call readResponse\n");
    int statusCode = readResponse(response);
    HTTP_DEBUG_PRINT("HTTP: return readResponse\n");

    //cleanup
    HTTP_DEBUG_PRINT("HTTP: stop client\n");
    num_headers = 0;
    client.stop();
    delay(50);
    HTTP_DEBUG_PRINT("HTTP: client stopped\n");

    return statusCode;
  }else{
    HTTP_DEBUG_PRINT("HTTP Connection failed\n");
    return 0;
  }
}
开发者ID:damgad,项目名称:spark-restclient,代码行数:62,代码来源:rest_client.cpp


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