1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
/***************************************************************************
*
* Project: OpenCPN
* Purpose: OpenCPN Android support utilities
* Author: David Register
*
***************************************************************************
* Copyright (C) 2015 by David S. Register *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
**************************************************************************/
#ifndef ANDROIDUTIL_H
#define ANDROIDUTIL_H
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif //precompiled headers
#include "OCPN_Sound.h"
class ArrayOfCDI;
#include <QString>
// Enumerators for OCPN menu actions requested by Android UI
#define OCPN_ACTION_FOLLOW 0x1000
#define OCPN_ACTION_ROUTE 0x1001
#define OCPN_ACTION_RMD 0x1002
#define OCPN_ACTION_SETTINGS_BASIC 0x1003
#define OCPN_ACTION_SETTINGS_EXPERT 0x1004
#define OCPN_ACTION_TRACK_TOGGLE 0x1005
#define OCPN_ACTION_MOB 0x1006
#define OCPN_ACTION_TIDES_TOGGLE 0x1007
#define OCPN_ACTION_CURRENTS_TOGGLE 0x1008
#define OCPN_ACTION_ENCTEXT_TOGGLE 0x1009
#define OCPN_ACTION_TRACK_ON 0x100a
#define OCPN_ACTION_TRACK_OFF 0x100b
#define OCPN_ACTION_ENCSOUNDINGS_TOGGLE 0x100c
#define OCPN_ACTION_ENCLIGHTS_TOGGLE 0x100d
#define GPS_OFF 0
#define GPS_ON 1
#define GPS_PROVIDER_AVAILABLE 2
#define GPS_SHOWPREFERENCES 3
extern bool androidUtilInit( void );
extern wxString androidGetDeviceInfo();
extern bool androidGetMemoryStatus( int *mem_total, int *mem_used );
extern double GetAndroidDisplaySize();
extern double getAndroidDPmm();
extern wxSize getAndroidDisplayDimensions( void );
extern double getAndroidDisplayDensity();
extern int getAndroidActionBarHeight();
extern void androidConfirmSizeCorrection();
extern void androidForceFullRepaint( bool bskipConfirm = false);
extern int androidGetVersionCode();
extern wxString androidGetVersionName();
extern bool LoadQtStyleSheet(wxString &sheet_file);
extern QString getQtStyleSheet( void );
extern void androidShowBusyIcon();
extern void androidHideBusyIcon();
extern void androidEnableBackButton(bool benable);
extern void androidEnableBackButtonCheck(bool benable);
extern wxString androidGetSupplementalLicense( void );
extern bool androidStartNMEA(wxEvtHandler *consumer);
extern bool androidStopNMEA();
extern wxString androidGPSService(int parm);
extern bool androidDeviceHasGPS();
extern bool androidDeviceHasBlueTooth();
extern bool androidStartBluetoothScan();
extern bool androidStopBluetoothScan();
extern wxArrayString androidGetBluetoothScanResults();
extern bool androidStartBT(wxEvtHandler *consumer, wxString mac_address );
extern bool androidStopBT();
extern bool androidSendBTMessage( wxString &payload );
extern wxArrayString *androidGetSerialPortsArray( void );
extern bool androidStartUSBSerial(wxString &portname, wxString baudRate, wxEvtHandler *consumer);
extern bool androidStopUSBSerial(wxString &portname);
extern bool androidWriteSerial(wxString &portname, wxString& message);
extern bool DoAndroidPreferences( void );
extern int androidFileChooser( wxString *result, const wxString &initDir, const wxString &title,
const wxString &suggestion, const wxString &wildcard, bool dirOnly = false, bool addFiles = false);
extern void androidSetChartTypeMaskSel( int mask, wxString &indicator);
extern void androidSetRouteAnnunciator(bool viz);
extern void androidSetFollowTool(int state, bool forceUpdate = false);
extern void androidSetTrackTool(bool bactive);
extern wxString androidGetHomeDir();
extern wxString androidGetPrivateDir(); // Used for logfile, config file, and the like
extern wxString androidGetSharedDir(); // Used for assets like uidata, s57data, etc
extern wxString androidGetCacheDir(); // Used for raster_texture_cache, mmsitoname.csv, etc
extern wxString androidGetExtStorageDir(); // Used for Chart storage, typically
extern int startAndroidFileDownload( const wxString &url, const wxString& destination, wxEvtHandler *evh, long *dl_ID );
extern int queryAndroidFileDownload( long dl_ID, wxString *result );
extern void finishAndroidFileDownload();
extern void cancelAndroidFileDownload( long dl_ID );
extern wxString doAndroidPOST( const wxString &url, wxString &parms, int timeoutMsec);
extern wxString getFontQtStylesheet(wxFont *font);
extern wxSize getAndroidConfigSize();
void resizeAndroidPersistents();
bool AndroidSecureCopyFile(wxString in, wxString out);
bool androidPlaySound( wxString soundfile, AudioDoneCallback callBack );
bool androidGetFullscreen();
bool androidSetFullscreen( bool bFull );
void androidDisableFullScreen();
void androidRestoreFullScreen();
void androidLaunchHelpView();
void androidTerminate();
void androidTestCPP();
int androidGetTZOffsetMins();
int androidApplySettingsString( wxString settings, ArrayOfCDI *pACDI);
bool androidShowDisclaimer( wxString title, wxString msg );
bool androidShowSimpleOKDialog( wxString title, wxString msg );
bool androidShowSimpleYesNoDialog( wxString title, wxString msg );
bool androidInstallPlaystoreHelp();
void androidLaunchBrowser( wxString URL );
bool androidCheckOnline();
unsigned int androidColorPicker( unsigned int initialColor);
wxArrayString androidTraverseDir( wxString dir, wxString filespec);
void androidEnableOptionsMenu( bool bEnable );
void prepareAndroidStyleSheets();
QString getAdjustedDialogStyleSheet();
QString getListBookStyleSheet();
QString getScrollBarsStyleSheet();
void setChoiceStyleSheet( wxChoice *win, int refDim);
void setMenuStyleSheet( wxMenu *win, const wxFont& font);
QString prepareAndroidSliderStyleSheet(int sliderWidth);
void androidDisplayTimedToast(wxString message, int timeMillisec);
void androidCancelTimedToast();
void androidDisplayToast(wxString message);
void androidEnableRotation( void );
void androidDisableRotation( void );
int androidGetScreenOrientation();
// SVG Support
wxBitmap loadAndroidSVG( const wxString filename, unsigned int width, unsigned int height );
wxString androidGetAndroidSystemLocale();
#endif //guard
|