/**
 * 2.15.可登录的站点列表
 * @param email               用户的email或id
 * @param password            登录密码
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::GetValidSiteId(
                                                    string email,
                                                    string password
                                                    ) {
    HttpEntiy entiy;
    
    if( email.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_EMAIL, email.c_str());
    }
    
    if( password.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_PASSWORD2, password.c_str());
    }
    
    string url = GET_VALID_SITEID_PATH;
    FileLog("httprequest", "RequestAuthorizationController::GetValidSietId( "
            "email : %s, "
            "password : %s, "
            ")",
            email.c_str(),
            password.c_str()
            );
    
    return StartRequest(url, entiy, this, PublicSite);
}
Exemplo n.º 2
0
void CUSBBluetoothDevice::RegisterHCIEventHandler (TUSBBluetoothHCIEventHandler *pHandler)
{
	m_pEventHandler = pHandler;
	assert (m_pEventHandler != 0);

	StartRequest ();
}
/**
 * 11.1.获取Love Call列表接口
 * @param pageIndex			当前页数
 * @param pageSize			每页行数
 * @param searchType		查询类型(0:Request,1:Scheduled)
 * @return					请求唯一标识
 */
long RequestLoveCallController::QueryLoveCallList(int pageIndex, int pageSize, int searchType) {
	HttpEntiy entiy;
	char temp[16];

	sprintf(temp, "%d", pageIndex);
	entiy.AddContent(COMMON_PAGE_INDEX, temp);

	sprintf(temp, "%d", pageSize);
	entiy.AddContent(COMMON_PAGE_SIZE, temp);

	sprintf(temp, "%d", searchType);
	entiy.AddContent(LOVECALL_QUERY_LIST_TYPE, temp);

	string url = LOVECALL_QUERY_LIST_PATH;
	FileLog("httprequest", "RequestLoveCallController::QueryLoveCallList( "
			"url : %s, "
			"pageIndex : %d, "
			"pageSize : %d, "
			"searchType : %d "
			")",
			url.c_str(),
			pageIndex,
			pageSize,
			searchType
			);

	return StartRequest(url, entiy, this);
}
Exemplo n.º 4
0
bool AskService::SubmitQuestion(IAnswer *answerCB, char16* nickname, char16* password, char16* questionText, int32 numberOfPhotos, int32 responseType, ArrayOfString *customResponses, int32 durationType, bool isPrivate)
{
    if (!StartRequest(answerCB, AskService::EPS_SUBMITQUESTION))
    {
        return false;
    }

    PacketStream *str = pServer->GetStream();
    bool isOk = true;

    isOk = isOk && str->WriteInt32(16);//request id

  
    isOk = isOk &&  str->WriteWString(nickname);
    isOk = isOk &&  str->WriteWString(password);
    isOk = isOk &&  str->WriteWString(questionText);
    isOk = isOk &&  str->WriteInt32(numberOfPhotos);
    isOk = isOk &&  str->WriteInt32(responseType);
    isOk = isOk &&  customResponses->WriteToStream(str);
    isOk = isOk &&  str->WriteInt32(durationType);
    isOk = isOk &&  str->WriteInt8((int8)isPrivate);

    return isOk && EndRequest();

}
// ----------------------- AdmirerListAd -----------------------
long RequestAdvertController::AdmirerListAd(const string& deviceId, const string& advertId, long firstGottime, int showTimes, int clickTimes)
{
    char temp[16];
    HttpEntiy entiy;
    
    // deviceId
    entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
    // advertId
    if (!advertId.empty()) {
        entiy.AddContent(ADVERT_REQUEST_ADVERTID, advertId);
        // firstGottime
        sprintf(temp, "%ld", firstGottime);
        entiy.AddContent(ADVERT_REQUEST_FIRSTGOTTIME, temp);
        // showTimes
        sprintf(temp, "%d", showTimes);
        entiy.AddContent(ADVERT_REQUEST_SHOWTIMES, temp);
        // clickTimes
        sprintf(temp, "%d", clickTimes);
        entiy.AddContent(ADVERT_REQUEST_CLICKTIMES, temp);
    }
    
    
    string url = ADVERT_ADMIRERLIST_PATH;
    FileLog("httprequest", "RequestAdvertController::AdmirerListAd"
            "( url:%s, deviceId:%s, advertId:%s, showTimes:%d, clickTimes:%d, firstGottime:%ld)",
            url.c_str(), deviceId.c_str(), advertId.c_str(), showTimes, clickTimes, firstGottime);
    
    return StartRequest(url, entiy, this);
}
/**
 * 10.4.删除已标记like的女士
 * @param likeListId	喜爱的女士列表
 * @return				请求唯一标识
 */
long RequestQuickMatchController::RemoveQuickMatchLikeLadyList(list<string> likeListId) {

	HttpEntiy entiy;

	string likeId = "";
	for(list<string>::iterator itr = likeListId.begin(); itr != likeListId.end(); itr++) {
		likeId += *itr;
		likeId += ",";
	}
	if( likeId.length() > 0 ) {
		likeId = likeId.substr(0, likeId.length() - 1);
		entiy.AddContent(QUICKMATCH_UPLOAD_CONFIRMTYPE, likeId);
	}

	string url = QUICKMATCH_REMOVE_PATH;
	FileLog("httprequest", "RequestQuickMatchController::RemoveQuickMatchLikeLadyList( "
			"url : %s, "
			"likeId : %s "
			")",
			url.c_str(),
			likeId.c_str()
			);

	return StartRequest(url, entiy, this);
}
//// ----------------------- AdmirerListAd -----------------------
long RequestAdvertController::Html5Ad(const string& deviceId, const string& advertId, long firstGottime, int showTimes, int clickTimes, AdvertHtmlSpaceType adspaceId, const string& adOverview)
{
    char temp[16];
    HttpEntiy entiy;

    // deviceId
    entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
    // advertId
    if (!advertId.empty()) {
        entiy.AddContent(ADVERT_REQUEST_ADVERTID, advertId);
        // firstGottime
        sprintf(temp, "%ld", firstGottime);
        entiy.AddContent(ADVERT_REQUEST_FIRSTGOTTIME, temp);
        // showTimes
        sprintf(temp, "%d", showTimes);
        entiy.AddContent(ADVERT_REQUEST_SHOWTIMES, temp);
        // clickTimes
        sprintf(temp, "%d", clickTimes);
        entiy.AddContent(ADVERT_REQUEST_CLICKTIMES, temp);
    }

    sprintf(temp, "%d", GetAdvertHtmlSpaceTypeToInt(adspaceId));
    entiy.AddContent(ADVERT_REQUEST_ADSPACEID, temp);
    
    if (!adOverview.empty()) {
        entiy.AddContent(ADVERT_REQUEST_ADOVERVIEW, adOverview);
    }

    string url = ADVERT_HTLM5_PATH;
    FileLog("httprequest", "RequestAdvertController::AdmirerListAd"
            "( url:%s, deviceId:%s, advertId:%s, showTimes:%d, clickTimes:%d, firstGottime:%ld, adspaceId:%d spaceType:%d)",
            url.c_str(), deviceId.c_str(), advertId.c_str(), showTimes, clickTimes, firstGottime, adspaceId, GetAdvertHtmlSpaceTypeToInt(adspaceId));

    return StartRequest(url, entiy, this);
}
/**
 * 2.10.获取token
 * @param siteType        前往的站点ID
 * @param clientType      前往的客户端标识(可无, 默认是app)
 * @param url             前往分站的目标url(可无, App端默认为无)
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::GetWebsiteUrlToken(OTHER_SITE_TYPE siteType, VERIFY_CLIENT_TYPE clientType, string siteUrl) {
    //char temp[16] = {0};
    HttpEntiy entiy;

    // siteid
    string strSite("");
    strSite = GetSiteId(siteType);
    entiy.AddContent(AUTHORIZATION_TOID, strSite);

    string strClient("");
    strClient = GetVerifyClientType(clientType);
    entiy.AddContent(AUTHORIZATION_CLIENT, strClient);

    if (siteUrl.length() > 0) {
        entiy.AddContent(AUTHORIZATION_URL, siteUrl.c_str());
    }

    string url = GET_WEBSITEURL_TOKEN_PATH;
    FileLog("httprequest", "RequestAuthorizationController::GetWebsiteUrlToken( "
                           "url : %s, "
                           "siteType : %d, "
                           "clientType : %d, "
                           "siteUrl : %s, "
                           ")",
            url.c_str(),
            siteType,
            clientType,
            siteUrl.c_str());

    return StartRequest(url, entiy, this);
}
// ----------------------- MainAdvert -----------------------
long RequestAdvertController::MainAdvert(const string& deviceId, const string& advertId, int showTimes, int clickTimes)
{
	char temp[16];
	HttpEntiy entiy;

	// deviceId
	entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
	// advertId
	if (!advertId.empty()) {
		entiy.AddContent(ADVERT_REQUEST_ADVERTID, advertId);
		// showTimes
		sprintf(temp, "%d", showTimes);
		entiy.AddContent(ADVERT_REQUEST_SHOWTIMES, temp);
		// clickTimes
		sprintf(temp, "%d", clickTimes);
		entiy.AddContent(ADVERT_REQUEST_CLICKTIMES, temp);
	}

	string url = ADVERT_MAINADVERT_PATH;
	FileLog("httprequest", "RequestAdvertController::MainAdvert"
			"( url:%s, deviceId:%s, advertId:%s, showTimes:%d, clickTimes:%d)",
			url.c_str(), deviceId.c_str(), advertId.c_str(), showTimes, clickTimes);

	return StartRequest(url, entiy, this);
}
/**
 * 2.11. 添加App token
 * @param tokenId
 */
long RequestAuthorizationController::SummitAppToken(string deviceId, string tokenId, string appId) {
    HttpEntiy entiy;

    if (deviceId.length() > 0) {
        entiy.AddContent(AUTHORIZATION_TOKEN_DEVICE_ID, deviceId.c_str());
    }

    if (tokenId.length() > 0) {
        entiy.AddContent(AUTHORIZATION_TOKEN_ID, tokenId.c_str());
    }

    if (appId.length() > 0) {
        entiy.AddContent(AUTHORIZATION_APP_ID, appId.c_str());
    }

    string url = SUMMIT_APP_TOKEN_PATH;
    FileLog("httprequest", "RequestAuthorizationController::SummitAppToken( "
                           "url : %s, "
                           "deviceId : %s, "
                           "tokenId : %s, "
                           "appId : %s, "
                           ")",
            url.c_str(),
            deviceId.c_str(),
            tokenId.c_str(),
            appId.c_str());

    return StartRequest(url, entiy, this);
}
/**
 * 2.8.固定电话获取认证短信
 * @param landline            电话号码
 * @param telephone_cc        国家区号,参考数组<CountryArray>
 * @param landline_ac        区号
 * @param device_id            设备唯一标识
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::GetFixedPhone(string landline, int telephone_cc, string landline_ac,
                                                   string device_id) {
    HttpEntiy entiy;

    if (landline.length() > 0) {
        entiy.AddContent(AUTHORIZATION_LANDLINE, landline.c_str());
    }

    string strCountry = GetCountryCode(telephone_cc);
    if (!strCountry.empty()) {
        entiy.AddContent(AUTHORIZATION_LANDLINE_CC, strCountry.c_str());
    }

    if (landline_ac.length() > 0) {
        entiy.AddContent(AUTHORIZATION_LANDLINE_AC, landline_ac.c_str());
    }

    string url = GET_FIXED_PHONE_PATH;
    FileLog("httprequest", "RequestAuthorizationController::GetFixedPhone( "
                           "url : %s, "
                           "landline : %s, "
                           "telephone_cc : %d, "
                           "landline_ac : %s, "
                           ")",
            url.c_str(),
            landline.c_str(),
            telephone_cc,
            landline_ac.c_str());

    return StartRequest(url, entiy, this);
}
// ----------------------- WomanListAdvert -----------------------
long RequestAdvertController::WomanListAdvert(const string& deviceId, const string& advertId, int showTimes, int clickTimes, AdvertSpaceType adspaceId)
{
	char temp[16];
	HttpEntiy entiy;

	// deviceId
	entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
	// advertId
	if (!advertId.empty()) {
		entiy.AddContent(ADVERT_REQUEST_ADVERTID, advertId);
		// showTimes
		sprintf(temp, "%d", showTimes);
		entiy.AddContent(ADVERT_REQUEST_SHOWTIMES, temp);
		// clickTimes
		sprintf(temp, "%d", clickTimes);
		entiy.AddContent(ADVERT_REQUEST_CLICKTIMES, temp);
	}
    sprintf(temp, "%d", GetAdvertSpaceTypeToInt(adspaceId));
    entiy.AddContent(ADVERT_REQUEST_ADSPACEID, temp);

	string url = ADVERT_WOMANLISTADVERT_PATH;
	FileLog("httprequest", "RequestAdvertController::WomanListAdvert"
            "( url:%s, deviceId:%s, advertId:%s, showTimes:%d, clickTimes:%d, adspaceId:%d spaceType:%d)",
			url.c_str(), deviceId.c_str(), advertId.c_str(), showTimes, clickTimes, adspaceId, GetAdvertSpaceTypeToInt(adspaceId));

	return StartRequest(url, entiy, this);
}
/**
 * 2.6.手机获取认证短信
 * @param telephone            电话号码
 * @param telephone_cc        国家区号,参考参考数组<CountryArray>
 * @param device_id            设备唯一标识
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::GetSms(string telephone, int telephone_cc, string device_id) {
    HttpEntiy entiy;

    if (telephone.length() > 0) {
        entiy.AddContent(AUTHORIZATION_TELEPHONE, telephone.c_str());
    }

    string strCountry = GetCountryCode(telephone_cc);
    if (!strCountry.empty()) {
        entiy.AddContent(AUTHORIZATION_TELEPHONE_CC, strCountry.c_str());
    }

    if (device_id.length() > 0) {
        entiy.AddContent(AUTHORIZATION_DEVICE_ID, device_id.c_str());
    }

    string url = GET_SMS_PATH;
    FileLog("httprequest", "RequestAuthorizationController::GetSms( "
                           "url : %s, "
                           "telephone : %s, "
                           "telephone_cc : %d, "
                           "device_id : %s, "
                           ")",
            url.c_str(),
            telephone.c_str(),
            telephone_cc,
            device_id.c_str());

    return StartRequest(url, entiy, this);
}
long RequestAuthorizationController::CheckPhoneVerifyCode(
                                                          string email,
                                                          string verifyCode,
                                                          string deviceId
                                                          ) {
    HttpEntiy entiy;
    
    if( email.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_EMAIL, email.c_str());
    }
    
    if( verifyCode.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_VERIFYCODE, verifyCode.c_str());
    }
    
    if( deviceId.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_DEVICEID, deviceId.c_str());
    }
    
    
    string url = CHECK_PHONEVERIFYCODE_PATH;
    FileLog("httprequest", "CheckPhoneVerifyCode::GetPhoneVerifyCode( "
            "email : %s, "
            "verifyCode : %s, "
            "deviceId : %s, "
            ")",
            email.c_str(),
            verifyCode.c_str(),
            deviceId.c_str()
            );
    
    return StartRequest(url, entiy, this);
}
long RequestAuthorizationController::GetPhoneVerifyCode(
                                                        string sendMmail,
                                                        string checkCode,
                                                        string deviceId
                                                        ) {
    HttpEntiy entiy;
    
    if( sendMmail.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_SENDMAIL, sendMmail.c_str());
    }
    
    if( checkCode.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_CHECKCODE, checkCode.c_str());
    }
    
    if( deviceId.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_DEVICEID, deviceId.c_str());
    }
    
    string url = GET_PHONE_VERIFYCODE_PATH;
    FileLog("httprequest", "RequestAuthorizationController::GetPhoneVerifyCode( "
            "sendMmail : %s, "
            "checkCode : %s, "
            "deviceId : %s, "
            ")",
            sendMmail.c_str(),
            checkCode.c_str(),
            deviceId.c_str()
            );
    
    return StartRequest(url, entiy, this);
}
/**
 * 2.18.通知服务器发送验证邮件
 * @param sendmail            用户注册的邮箱
 * @param checkCode           验证码
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::SendVerifyEmail(
                                                     string sendMmail,
                                                     string checkCode
                                                     ) {
    HttpEntiy entiy;
    
    if( sendMmail.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_SENDMAIL, sendMmail.c_str());
    }
    
    if( checkCode.length() > 0 ) {
        entiy.AddContent(AUTHORIZATION_CHECKCODE, checkCode.c_str());
    }
    
    string url = SEND_VERIFY_EMAIL_PATH;
    FileLog("httprequest", "RequestAuthorizationController::SendVerifyEmail( "
            "sendMmail : %s, "
            "checkCode : %s, "
            ")",
            sendMmail.c_str(),
            checkCode.c_str()
            );
    
    return StartRequest(url, entiy, this);
}
Exemplo n.º 17
0
bool RequestBaseTask::Start() {
	if( BaseTask::Start() ) {
		if( -1 != StartRequest() ) {
			return true;
		} else {
			OnTaskFinish();
		}
	}
	return false;
}
long RequestAuthorizationController::ActivationAllSite() {
    HttpEntiy entiy;
    
    string url = ACTIVATION_ALL_SITE_PATH;
    FileLog("httprequest", "RequestAuthorizationController::ActivationAllSite( "
            ")"
            );
    
    return StartRequest(url, entiy, this);
}
/**
 * 2.14.token登录认证
 * @param token               用于登录其他站点的加密串
 * @param memberId            会员
 * @param deviceId            设备唯一标识
 * @param versioncode         客户端内部版本号
 * @param model               移动设备型号
 * @param manufacturer        制造厂商
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::TokenLogin(
    string token,
    string memberId,
    string deviceId,
    string versioncode,
    string model,
    string manufacturer) {
    HttpEntiy entiy;

    entiy.SetSaveCookie(true);

    if (token.length() > 0) {
        entiy.AddContent(AUTHORIZATION_TOKEN_ID, token.c_str());
    }

    if (memberId.length() > 0) {
        entiy.AddContent(AUTHORIZATION_MEMBER_ID, memberId.c_str());
    }

    if (deviceId.length() > 0) {
        entiy.AddContent(AUTHORIZATION_DEVICEID, deviceId.c_str());
    }

    if (versioncode.length() > 0) {
        entiy.AddContent(AUTHORIZATION_VERSIONCODE, versioncode.c_str());
    }

    if (model.length() > 0) {
        entiy.AddContent(AUTHORIZATION_MODEL, model.c_str());
    }

    if (manufacturer.length() > 0) {
        entiy.AddContent(AUTHORIZATION_MANUFACTURER, manufacturer.c_str());
    }

    string url = VERIFY_TOKEN_LOGIN_PATH;
    FileLog("httprequest", "TokenLogin::Login( "
                           "url : %s, "
                           "token : %s, "
                           "memberId : %s, "
                           "deviceId : %s, "
                           "versioncode : %s, "
                           "model : %s, "
                           "manufacturer : %s "
                           ")",
            url.c_str(),
            token.c_str(),
            memberId.c_str(),
            deviceId.c_str(),
            versioncode.c_str(),
            model.c_str(),
            manufacturer.c_str());

    return StartRequest(url, entiy, this);
}
Exemplo n.º 20
0
bool FHttpRequestWinInet::ProcessRequest()
{
	bool bStarted = false;

	// Disabled http request processing
	if (!FHttpModule::Get().IsHttpEnabled())
	{
		UE_LOG(LogHttp, Verbose, TEXT("Http disabled. Skipping request. url=%s"), *GetURL());
	}
	// Prevent overlapped requests using the same instance
	else if (CompletionStatus == EHttpRequestStatus::Processing)
	{
		UE_LOG(LogHttp, Warning, TEXT("ProcessRequest failed. Still processing last request."));
	}
	// Make sure Internet connection has been setup 
	else if (!FWinInetConnection::Get().IsConnectionValid() &&
			 !FWinInetConnection::Get().InitConnection())
	{
		UE_LOG(LogHttp, Warning, TEXT("ProcessRequest failed. Could not initialize Internet connection."));
	}
	// Nothing to do without a valid URL
	else if (RequestURL.GetURL().IsEmpty())
	{
		UE_LOG(LogHttp, Warning, TEXT("ProcessRequest failed. No URL was specified."));
	}
	// Make sure the URL is parsed correctly with a valid HTTP scheme
	else if (RequestURL.GetURLComponents().nScheme != INTERNET_SCHEME_HTTP &&
			 RequestURL.GetURLComponents().nScheme != INTERNET_SCHEME_HTTPS)
	{
		UE_LOG(LogHttp, Warning, TEXT("ProcessRequest failed. URL '%s' is not a valid HTTP request. %p"), 
			*RequestURL.GetURL(), this);
	}
	else
	{
		// Mark as in-flight to prevent overlapped requests using the same object
		CompletionStatus = EHttpRequestStatus::Processing;
		// Response object to handle data that comes back after starting this request
		Response = MakeShareable(new FHttpResponseWinInet(*this));
		// Add to global list while being processed so that the ref counted request does not get deleted
		FHttpModule::Get().GetHttpManager().AddRequest(SharedThis(this));
		// Try to start the connection and send the Http request
		bStarted = StartRequest();
	}
	
	if (!bStarted)
	{
		// No response since connection failed
		Response = NULL;
		// Cleanup and call delegate
		FinishedRequest();
	}

	// Successfully started the request
	return bStarted;
}
/**
 * 2.13. 重新激活账号
 */
long RequestAuthorizationController::ReactivateMemberShip() {
    HttpEntiy entiy;

    string url = REACTIVATE_MEMBER_SHIP_PATH;
    FileLog("httprequest", "RequestAuthorizationController::ReactivateMemberShip( "
                           "url : %s, "
                           ")",
            url.c_str());

    return StartRequest(url, entiy, this);
}
/**
 * 2.12. 销毁App token
 */
long RequestAuthorizationController::UnbindAppToken() {
    HttpEntiy entiy;

    string url = UNBIND_APP_TOKEN_PATH;
    FileLog("httprequest", "RequestAuthorizationController::UnbindAppToken( "
                           "url : %s, "
                           ")",
            url.c_str());

    return StartRequest(url, entiy, this);
}
Exemplo n.º 23
0
NS_IMETHODIMP
nsEnigMimeListener::OnStopRequest(nsIRequest* aRequest,
                                  nsISupports* aContext,
                                  nsresult aStatus)
{
  nsresult rv = NS_OK;

  DEBUG_LOG(("nsEnigMimeListener::OnStopRequest: (%p)\n", this));

  // Ensure that OnStopRequest call chain does not break by failing softly

  if (!mRequestStarted) {

    if (mHeadersFinalCR) {
      // Handle special case of terminating CR with no content
      mHeadersFinalCR = PR_FALSE;

      mLinebreak = "\r";
      mHeaders = mDataStr;

      if (mSkipHeaders) {
        // Skip headers
        mDataStr = "";
      }
    }

    rv = StartRequest(aRequest, aContext);
    if (NS_FAILED(rv))
      aStatus = NS_BINDING_ABORTED;
  }

  if (mDecoderData) {
    // Clear decoder buffer
    MimeDecoderDestroy(mDecoderData, PR_FALSE);
    mDecoderData = nsnull;
  }

  if (mListener) {
    rv = mListener->OnStopRequest(aRequest,
                                  mContext ? mContext.get() : aContext,
                                  aStatus);
    if (NS_FAILED(rv))
      aStatus = NS_BINDING_ABORTED;
  }

  // Release owning refs
  mListener = nsnull;
  mContext = nsnull;

  return (aStatus == NS_BINDING_ABORTED) ? NS_ERROR_FAILURE : NS_OK;
}
// ----------------------- popNoticeAdvert -----------------------
long RequestAdvertController::PopNoticeAdvert(const string& deviceId)
{
    //	char temp[16];
    HttpEntiy entiy;
    
    // deviceId
    entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
    
    string url = ADVERT_POP_NOTICE_PATH;
    FileLog("httprequest", "RequestAdvertController::PopNoticeAdvert"
            "( url:%s, deviceId:%s)",url.c_str(), deviceId.c_str());
    
    return StartRequest(url, entiy, this);
}
/**
 * 10.1.查询女士图片列表
 * @param deviceId		设备唯一标识
 * @return				请求唯一标识
 */
long RequestQuickMatchController::QueryQuickMatchLadyList(string deviceId) {
	HttpEntiy entiy;

	entiy.AddContent(QUICKMATCH_QUERY_DEVICEID, deviceId.c_str());

	string url = QUICKMATCH_LIST_PATH;
	FileLog("httprequest", "RequestQuickMatchController::QueryQuickMatchLadyList( "
			"url : %s, "
			"deviceId : %s "
			")",
			url.c_str(),
			deviceId.c_str()
			);

	return StartRequest(url, entiy, this);
}
/**
 * 2.9.固定电话短信认证
 * @param verify_code        验证码
 * @return                    请求唯一标识
 */
long RequestAuthorizationController::VerifyFixedPhone(string verify_code) {
    HttpEntiy entiy;

    if (verify_code.length() > 0) {
        entiy.AddContent(AUTHORIZATION_VERIFY_CODE, verify_code.c_str());
    }

    string url = VERIFY_FIXED_PHONE_PATH;
    FileLog("httprequest", "RequestAuthorizationController::VerifyFixedPhone( "
                           "url : %s, "
                           "verify_code : %s, "
                           ")",
            url.c_str(),
            verify_code.c_str());

    return StartRequest(url, entiy, this);
}
Exemplo n.º 27
0
bool AskService::GetQuestionIDs(IAnswer *answerCB, char16* nickname, char16* password)
{
    if (!StartRequest(answerCB, AskService::EPS_GETQUESTIONIDS))
    {
        return false;
    }

    PacketStream *str = pServer->GetStream();
    bool isOk = true;

    isOk = isOk && str->WriteInt32(12);//request id

  
    isOk = isOk &&  str->WriteWString(nickname);
    isOk = isOk &&  str->WriteWString(password);

    return isOk && EndRequest();

}
Exemplo n.º 28
0
boolean CUSBHIDDevice::Configure (void)
{
	if (GetNumEndpoints () < 1)
	{
		ConfigurationError (FromUSBHID);

		return FALSE;
	}
	
	TUSBEndpointDescriptor *pEndpointDesc =
		(TUSBEndpointDescriptor *) GetDescriptor (DESCRIPTOR_ENDPOINT);
	if (   pEndpointDesc == 0
	    || (pEndpointDesc->bEndpointAddress & 0x80) != 0x80		// Input EP
	    || (pEndpointDesc->bmAttributes     & 0x3F)	!= 0x03)	// Interrupt EP
	{
		ConfigurationError (FromUSBHID);

		return FALSE;
	}

	assert (m_pReportEndpoint == 0);
	m_pReportEndpoint = new CUSBEndpoint (GetDevice (), pEndpointDesc);
	assert (m_pReportEndpoint != 0);

	if (!CUSBFunction::Configure ())
	{
		CLogger::Get ()->Write (FromUSBHID, LogError, "Cannot set interface");

		return FALSE;
	}

	if (GetHost ()->ControlMessage (GetEndpoint0 (),
					REQUEST_OUT | REQUEST_CLASS | REQUEST_TO_INTERFACE,
					SET_PROTOCOL, BOOT_PROTOCOL,
					GetInterfaceNumber (), 0, 0) < 0)
	{
		CLogger::Get ()->Write (FromUSBHID, LogError, "Cannot set boot protocol");

		return FALSE;
	}

	return StartRequest ();
}
// ----------------------- PushAdvert -----------------------
long RequestAdvertController::PushAdvert(const string& deviceId, const string& pushId)
{
//	char temp[16];
	HttpEntiy entiy;

	// deviceId
	entiy.AddContent(ADVERT_REQUEST_DEVICEID, deviceId);
	// pushId
	if (!pushId.empty()) {
		entiy.AddContent(ADVERT_REQUEST_PUSHID, pushId);
	}

	string url = ADVERT_PUSHADVERT_PATH;
	FileLog("httprequest", "RequestAdvertController::PushAdvert"
			"( url:%s, deviceId:%s, pushId:%s)",
			url.c_str(), deviceId.c_str(), pushId.c_str());

	return StartRequest(url, entiy, this);
}
// 11.3 获取LoveCall未处理数
long RequestLoveCallController::QueryLoveCallRequestCount(int searchType)
{
	HttpEntiy entiy;
	char temp[16];

	sprintf(temp, "%d", searchType);
	entiy.AddContent(LOVECALL_QUERY_REQUESTCOUNT_TYPE, temp);

	string url = LOVECALL_QUERY_REQUESTCOUNT_PATH;
	FileLog("httprequest", "RequestLoveCallController::QueryLoveCallRequestCount( "
			"url : %s, "
			"searchType : %d "
			")",
			url.c_str(),
			searchType
			);

	return StartRequest(url, entiy, this);
}