예제 #1
0
 virtual void onSuccess(double latitude, double longitude, const char* adress) {
     char* buf = new char[2048];
     
     if (buf == NULL) {
         RAWLOG_ERROR("can not allocate temporary char buffer in GeoLocation callback");
         return;
     }
     
     if (adress != NULL) {
         rho::String coded_adr = adress;
         coded_adr = rho::net::URI::urlEncode(coded_adr);
         sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f&adress=%s", mTag, (float)latitude, (float)longitude, coded_adr.c_str()); 
     }
     else {
         sprintf(buf,"&rho_callback=1&status=ok&tag=%d&latitude=%f&longitude=%f", mTag, (float)latitude, (float)longitude); 
     }
     
         
     char* norm_url = rho_http_normalizeurl(mCallback.c_str());
     rho_net_request_with_data(norm_url, buf);
     rho_http_free(norm_url);
             
     delete buf;
     //delete this;
 }
예제 #2
0
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_camera_Camera_callback
  (JNIEnv *env, jclass, jstring callback_url, jstring body)
{
    rho_net_request_with_data(
            RHODESAPP().canonicalizeRhoUrl(rho_cast<std::string>(env, callback_url)).c_str(),
            rho_cast<std::string>(env, body).c_str());
}
예제 #3
0
void RhoBluetoothManager::fireRhodeCallback(const char* callback_url, const char* body) {
	LOG(INFO)  + "RhoBluetoothManager::fireRhodeCallback( "+callback_url+", "+body+")";
	rho_net_request_with_data(rho_http_normalizeurl(callback_url), body);
	//rho_rhodesapp_callBluetoothCallback(callback_url, body);
	/*
	HWND main_wnd = getMainWnd();
	char* mcallback = new char[strlen(callback_url)+1];
	strcpy(mcallback, callback_url);
	char* mbody = new char[strlen(body)+1];
	strcpy(mbody, body);
	::PostMessage(main_wnd, WM_BLUETOOTH_CALLBACK, (WPARAM)mcallback, (LPARAM)mbody);
	*/
}
예제 #4
0
파일: barcode.cpp 프로젝트: 4nkh/rhodes
RHO_GLOBAL void JNICALL Java_com_rhomobile_barcode_Barcode_enumeratecallback
(JNIEnv *env, jclass, jstring callback_url) {
    char* url = rho_http_normalizeurl(rho_cast<std::string>(env, callback_url).c_str());
    
    char body[2048];
    
	strcpy(body, "&status=ok&rho_callback=1&");
	strcat(body, (RHODESAPP().addCallbackObject( new RhoScannersListContainer(), "scannerArray")).c_str());
    char* norm_url = rho_http_normalizeurl(url);
    
    rho_net_request_with_data(norm_url, body);
    rho_http_free(norm_url);    
    
    
    
}
예제 #5
0
 virtual void onError(rho::String const &description) {
     char* buf = new char[2048];
     
     if (buf == NULL) {
         RAWLOG_ERROR("can not allocate temporary char buffer in GeoLocation callback");
         return;
     }
     
     sprintf(buf,"&rho_callback=1&status=error&description=%s", description.c_str()); 
     
     char* norm_url = rho_http_normalizeurl(mCallback.c_str());
     rho_net_request_with_data(norm_url, buf);
     rho_http_free(norm_url);
     
     delete buf;
     //delete this;
 }
예제 #6
0
static void callPreloadCallback(const char* callback, const char* status, int progress) {
    char body[2048];

    snprintf(body, sizeof(body), "&rho_callback=1&status=%s&progress=%d", status, progress);
    rho_net_request_with_data(RHODESAPP().canonicalizeRhoUrl(callback).c_str(), body);    
}
예제 #7
0
파일: barcode.cpp 프로젝트: gregoryo/rhodes
RHO_GLOBAL void JNICALL Java_com_rhomobile_barcode_Barcode_callback
  (JNIEnv *env, jclass, jstring callback_url, jstring body) {
    rho_net_request_with_data(rho_http_normalizeurl(rho_cast<std::string>(callback_url).c_str()), rho_cast<std::string>(body).c_str());
}