Sha256: adcd5dabc3dd98f683516a43eeb737cf7ee7c1af9210268074295c7228c4d419

Contents?: true

Size: 1.85 KB

Versions: 28

Compression:

Stored size: 1.85 KB

Contents

#ifndef _RHOGEOLOCATION_H_
#define _RHOGEOLOCATION_H_

#ifdef __cplusplus

#include "logging/RhoLog.h"
#include "net/INetRequest.h"
#include "common/IRhoClassFactory.h"

namespace rho {
namespace rubyext {

class CGeoLocation
{
public:
    DEFINE_LOGCLASS;
private:

    NetRequest m_NetRequest;
	int m_nGeoPingTimeoutSec;

    struct CGeoNotification
    {
        String m_strUrl, m_strParams;
        
        CGeoNotification(){}
        CGeoNotification(String strUrl, String strParams)
        { 
        	m_strUrl = strUrl; 
        	m_strParams = strParams; 
        }
    };
    CGeoNotification m_ViewNotify, m_Notify;
    common::CMutex   m_mxNotify;

    static CGeoLocation* m_pInstance;

    CGeoLocation();

public:

    static CGeoLocation* Create();
    static void Destroy();
    static CGeoLocation* getInstance(){ return m_pInstance; }

    void setGeoCallback(const char *url, char* params, int timeout_sec, boolean bView);
    void callGeoCallback(boolean bError, boolean bRunInThread=false);
    int getGeoTimeoutSec();


    static void callback_geolocation(void *arg, String const &/*query*/ );
private:

    int getDefaultPingTimeoutSec();
    void setPingTimeoutSec( int nTimeout );
    void callGeoCallback(const CGeoNotification& oNotify, boolean bError, boolean bRunInThread);

    net::CNetRequestWrapper getNet(){ return getNetRequest(&m_NetRequest); }
};

}
}

#endif //__cplusplus

#ifdef __cplusplus
extern "C" {
#endif //__cplusplus

void rho_geo_set_notification( const char *url, char* params, int timeout_sec);
void rho_geo_set_view_notification( const char *url, char* params, int timeout_sec);

void rho_geo_callcallback();
void rho_geo_callcallback_error();
int rho_geo_gettimeout_sec();

double rho_geo_haversine_distance(double lat1, double lon1, double lat2, double lon2);

#ifdef __cplusplus
};
#endif //__cplusplus

#endif //_RHOGEOLOCATION_H_

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rhodes-3.0.2 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.2.beta.1 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.8 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.7 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.6 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.5 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.4 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.3 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.1.beta.2 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.7 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.6 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.5 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.4 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.3 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.2 platform/shared/rubyext/GeoLocation.h
rhodes-3.0.0.beta.1 platform/shared/rubyext/GeoLocation.h
rhodes-2.4.1 platform/shared/rubyext/GeoLocation.h
rhodes-2.4.1.beta.1 platform/shared/rubyext/GeoLocation.h