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
IzPlatformSys.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_SYS_H_)
00015 #define _CIZ_PLATFORM_SYS_H_
00016 
00017 #include "CzPlatform.h"
00018 
00019 #define PLATFORM_SYS        PLATFORM->getSys()
00020 
00021 #define CZ_Malloc(size)         (PLATFORM_SYS->Malloc(size))
00022 #define CZ_Realloc(mem, size)   (PLATFORM_SYS->Realloc(mem, size))
00023 #define CZ_Free(mem)            (PLATFORM_SYS->Free(mem))
00024 
00025 enum eCzDeviceType
00026 {
00027     CzDeviceType_Unsupported    = -1,
00028     CzDeviceType_iPhone         = 0,
00029     CzDeviceType_iPad           = 1,
00030     CzDeviceType_Android        = 2,
00031     CzDeviceType_Bada           = 3,
00032     CzDeviceType_QNX            = 4,
00033     CzDeviceType_Symbian        = 5,
00034     CzDeviceType_WinMobile      = 6,
00035     CzDeviceType_WebOS          = 7,
00036     CzDeviceType_Windows        = 8,
00037     CzDeviceType_OSX            = 9,
00038     CzDeviceType_Vita           = 10,
00039     CzDeviceType_WP8            = 11,
00040     CzDeviceType_TIZEN          = 12,
00041     CzDeviceType_ROKU           = 13,
00042 };
00043 
00044 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00045 //
00046 // IzPlatformSys
00047 //
00048 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00049 class IzPlatformSys
00050 {
00051     // Properties
00052 protected:
00053     bool        Initialised;
00054     bool        Suspended;
00055     CzCallback  SuspendedCallback;          // Callback to be called when device is suspended
00056     CzCallback  ResumedCallback;            // Callback to be called when device is resuming
00057     CzCallback  VolumeUpCallback;           // Callback to be called when device volume up is pressed
00058     CzCallback  VolumeDownCallback;         // Callback to be called when device volume down is pressed
00059     CzCallback  NetworkOnlineCallback;      // Callback to be called when device network goes online
00060     CzCallback  NetworkOfflineCallback;     // Callback to be called when device network goes offline
00061     CzCallback  ScreenSizeChangedCallback;  // Callback to be called when device screen size changes
00062 public:
00063     bool        isInitialised() const                               { return Initialised; }
00064     bool        isSuspended() const                                 { return Suspended; }
00065     void        setSuspendedCallback(CzCallback callback)           { SuspendedCallback         = callback; }
00066     void        setResumedCallback(CzCallback callback)             { ResumedCallback           = callback; }
00067     void        setVolumeUpCallback(CzCallback callback)            { VolumeUpCallback          = callback; }
00068     void        setVolumeDownCallback(CzCallback callback)          { VolumeDownCallback        = callback; }
00069     void        setNetworkOnlineCallback(CzCallback callback)       { NetworkOnlineCallback     = callback; }
00070     void        setNetworkOfflineCallback(CzCallback callback)      { NetworkOfflineCallback    = callback; }
00071     void        setScreenSizeChangedCallback(CzCallback callback)   { ScreenSizeChangedCallback = callback; }
00072     // Properties end
00073 public:
00074     IzPlatformSys() :   SuspendedCallback(NULL), ResumedCallback(NULL), VolumeUpCallback(NULL), VolumeDownCallback(NULL), NetworkOnlineCallback(NULL), NetworkOfflineCallback(NULL), 
00075                         ScreenSizeChangedCallback(NULL), Suspended(false), Initialised(false) {}
00076 
00077     virtual int     Init() = 0;
00078     virtual void    Release() = 0;
00079 
00080     // Backlight
00081     virtual void    BacklightOn() = 0;
00082 
00083     // Time
00084     virtual uint64  getTimeInMs() = 0;
00085     virtual int64   getTimeUTC() = 0;
00086 
00087     // OS calls
00088     virtual void    YieldToOS(int time_ms) = 0;
00089     virtual bool    ExecuteViaOS(const char* name, bool exit_app) = 0;
00090     virtual void    RequestQuit() = 0;
00091 
00092     // Event notification
00093     virtual void    NotifySuspended() = 0;
00094     virtual void    NotifyResumed() = 0;
00095     virtual void    NotifyVolumeUp() = 0;
00096     virtual void    NotifyVolumeDown() = 0;
00097     virtual void    NotifyNetworkOnline() = 0;
00098     virtual void    NotifyNetworkOffline() = 0;
00099     virtual void    NotifyScreenSizeChanged() = 0;
00100 
00101     // App exit
00102     virtual bool    CheckAppQuit() = 0;
00103 
00104     // Memory
00105     virtual int     getFreeMemory() const = 0;
00106     virtual int     getUsedMemory() const = 0;
00107     virtual void*   Malloc(int size) = 0;
00108     virtual void*   Realloc(void* mem, int size) = 0;
00109     virtual void    Free(void* mem) = 0;
00110 
00111     // Console output
00112     virtual void    ConsoleWrite(const char* message) = 0;
00113 
00114     // Device type query
00115     virtual eCzDeviceType   getDeviceType() = 0;
00116 
00117     // Device OS version query
00118     virtual const char*     getDeviceOSVersion() = 0;
00119 
00120     // Device UDID
00121     virtual int             getDeviceUDID() = 0;
00122 
00123     // Device language locale
00124     virtual const char*     getDeviceLocale() = 0;
00125 
00126     // Endianness query
00127     virtual bool            isLittleEndian() = 0;
00128 
00129 };
00130 
00131 
00132 #endif  // _CIZ_PLATFORM_SYS_H_