AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
IzPlatformFacebook.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CIZ_PLATFORM_FACEBOOK_H_)
00015 #define _CIZ_PLATFORM_FACEBOOK_H_
00016 
00017 #include "CzPlatform.h"
00018 #include "CzString.h"
00019 #include "CzScript.h"
00020 
00021 #define PLATFORM_FACEBOOK           PLATFORM->getFacebook()
00022 
00023 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00024 //
00025 // IzPlatformFacebook
00026 //
00027 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00028 class IzPlatformFacebook
00029 {
00030 public:
00031     enum eFBStatus 
00032     {
00033         FB_UNINITIALISED,
00034         FB_LOGGED_OUT,
00035         FB_LOGGING_IN,
00036         FB_LOGGED_IN
00037     };
00038 
00039     // Properties
00040 protected:
00041     bool                Available;          ///< Facebook available flag
00042     bool                Initialised;        ///< Classes iniitialised state
00043     CzString            AppID;              ///< Facebook App iD
00044     CzScriptCallback    ScriptCallback;     ///< Script call back
00045 public:
00046     bool                isAvailable() const                         { return Available; }
00047     bool                isInitialised() const                       { return Initialised; }
00048     void                setAppID(const char* app_id)                { AppID = app_id; }
00049     CzScriptCallback&   getScriptCallback()                         { return ScriptCallback; }
00050     // Properties end
00051 
00052 public:
00053     virtual int         Init() = 0;
00054     virtual void        Release() = 0;
00055 
00056     virtual bool        Login(const char** permissions, int num_permissions) = 0;
00057     virtual bool        Logout() = 0;
00058     virtual bool        Reauthorise(const char** permissions, int num_permissions) = 0;
00059     virtual CzFacebookRequest   InitRequest(const char* method_name, const char* http_method) = 0;
00060     virtual CzFacebookRequest   InitGraphRequest(const char* graph_path, const char* http_method) = 0;
00061     virtual bool        AddParamString(CzFacebookRequest request, const char* parameter, const char* value) = 0;
00062     virtual bool        AddParamNumber(CzFacebookRequest request, const char* parameter, int64 value) = 0;
00063     virtual bool        SendRequest(CzFacebookRequest request) = 0;
00064     virtual void        DeleteRequest(CzFacebookRequest request) = 0;
00065     virtual const char* GetResponse(CzFacebookRequest request) = 0;
00066     virtual int         GetErrorCode(CzFacebookRequest request) = 0;
00067     virtual const char* GetError(CzFacebookRequest request) = 0;
00068     virtual const char* GetAccessToken() = 0;
00069     virtual bool        IsLoggedIn() const = 0;
00070     virtual void        WaitForCallback() = 0;
00071 
00072 //  virtual bool    PostWall(const char* message, const char* link_uri, const char* image_uri, const char* name, const char* description) = 0;
00073 
00074     // Event handlers
00075     void                NotifyLoggedIn(CzFacebookRequest request);
00076     void                NotifyLoginError(CzFacebookRequest request);
00077     void                NotifyResponse(CzFacebookRequest request);
00078     void                NotifyResponseError(CzFacebookRequest request);
00079 };
00080 
00081 
00082 #endif  // _CIZ_PLATFORM_FACEBOOK_H_