With this API it should be possible to do most things, although, there may still be some functionality missing. If you would like a specific function added, please do send us a mail.
In future versions of MoSync an extension API will be provided that will allow you to create your own custom syscalls.
Some Caveats:
The Runtime expects alignment rules to be followed. Writing or reading to unaligned memory will cause a MoSync Panic.
Some functions may also cause a panic if they are passed incorrect parameters. A complete reference of these panics can be found here.
The codepage for functions that use strings is platform-dependent beyond 7-bit ASCII. Most use Latin-1, but you should still be wary.
Additional notes:
There are different types of handles: Connection, Store and Resource. They are all represented as positive signed integers. When a handle is passed to a function, it must have the proper type.
Each MoSync program has a Resource array. It is acccessed and manipulated by certain syscalls, but it cannot be accessed directly. Each resource (aka Object) is represented by a handle. There are different types of resources, for example Image, Binary data, Sound or Placeholder. A placeholder object is not a real object, but just a handle which you can use to construct new objects dynamically. Resources can also be defined at compile time, by using MoSync's resource compiler. Placeholders can either be defined at compile time using a resource compiler directive or created dynamically at runtime using maCreatePlaceholder(). See the tutorials, examples and the resource compiler reference documentation for more information.
There is an event queue which contains keypad events and results from asynchronous operations. Use maWait() and maGetEvent() to handle it.
There are different types of connection operations. For each connection, only one of each type of operation may be active at the same time.
Classes | |
struct | MAPoint2d |
struct | MARect |
struct | MACopyData |
struct | MAConnAddrInet4 |
struct | MABtAddr |
struct | MAConnAddrBt |
struct | MAConnAddr |
struct | MAConnEventData |
struct | MAEvent |
struct | MAPanicReport |
struct | MABtDevice |
struct | MAUUID |
struct | MABtServiceSize |
struct | MABtService |
struct | MALocation |
struct | MAFrameBufferInfo |
Bluetooth discovery | |
These structures and functions are used for asynchronous device and service discovery. Only one operation may be active at a time. When a device or service is found, its information is stored in internal buffers for later retrieval by maBtGetNewDevice() or maBtGetNewService(), then a BT event is generated. A BT event is also generated when the operation is complete. A BT event contains the state of the Bluetooth Discovery operation. This is <0 (a CONNERR value) on failure, 0 while still working and ((number of devices/services found) + 1) on success.
The buffers are cleared when the respective operation is started, so any devices or services left over in the buffers from an earlier operation will be lost. | |
void * | memset (void *dst, int val, ulong size) |
void * | memcpy (void *dst, const void *src, ulong size) |
int | strcmp (const char *str1, const char *str2) |
char * | strcpy (char *dst, const char *src) |
double | __adddf3 (double a, double b) |
double | __subdf3 (double a, double b) |
double | __muldf3 (double a, double b) |
double | __divdf3 (double a, double b) |
double | __negdf2 (double a) |
int | __fixdfsi (double a) |
double | __floatsidf (int a) |
double | f2d (float a) |
int | dcmp (double a, double b) |
float | __addsf3 (float a, float b) |
float | __subsf3 (float a, float b) |
float | __mulsf3 (float a, float b) |
float | __divsf3 (float a, float b) |
float | __negsf2 (float a) |
int | __fixsfsi (float a) |
float | __floatsisf (int a) |
float | d2f (double a) |
int | fcmp (float a, float b) |
double | sin (double x) |
double | cos (double x) |
double | tan (double x) |
double | sqrt (double x) |
int | maSetColor (int rgb) |
void | maSetClipRect (int left, int top, int width, int height) |
void | maGetClipRect (MARect *out) |
void | maPlot (int posX, int posY) |
void | maLine (int startX, int startY, int endX, int endY) |
void | maFillRect (int left, int top, int width, int height) |
void | maFillTriangleStrip (const MAPoint2d *points, int count) |
void | maFillTriangleFan (const MAPoint2d *points, int count) |
MAExtent | maGetTextSize (const char *str) |
void | maDrawText (int left, int top, const char *str) |
void | maUpdateScreen (void) |
void | maResetBacklight (void) |
MAExtent | maGetScrSize (void) |
void | maDrawImage (MAHandle image, int left, int top) |
void | maDrawRGB (const MAPoint2d *dstPoint, const void *src, const MARect *srcRect, int scanlength) |
void | maDrawImageRegion (MAHandle image, const MARect *srcRect, const MAPoint2d *dstPoint, int transformMode) |
MAExtent | maGetImageSize (MAHandle image) |
void | maGetImageData (MAHandle image, void *dst, const MARect *srcRect, int scanlength) |
MAHandle | maSetDrawTarget (MAHandle image) |
int | maFindLabel (const char *name) |
int | maCreateImageFromData (MAHandle placeholder, MAHandle data, int offset, int size) |
int | maCreateImageRaw (MAHandle placeholder, const void *src, MAExtent size, int alpha) |
int | maCreateDrawableImage (MAHandle placeholder, int width, int height) |
int | maCreateData (MAHandle placeholder, int size) |
MAHandle | maCreatePlaceholder (void) |
void | maDestroyObject (MAHandle handle) |
int | maGetDataSize (MAHandle data) |
void | maReadData (MAHandle data, void *dst, int offset, int size) |
void | maWriteData (MAHandle data, const void *src, int offset, int size) |
void | maCopyData (const MACopyData *params) |
MAHandle | maOpenStore (const char *name, int flags) |
int | maWriteStore (MAHandle store, MAHandle data) |
int | maReadStore (MAHandle store, MAHandle placeholder) |
void | maCloseStore (MAHandle store, int remove) |
MAHandle | maConnect (const char *url) |
void | maConnClose (MAHandle conn) |
void | maConnRead (MAHandle conn, void *dst, int size) |
void | maConnWrite (MAHandle conn, const void *src, int size) |
void | maConnReadToData (MAHandle conn, MAHandle data, int offset, int size) |
void | maConnWriteFromData (MAHandle conn, MAHandle data, int offset, int size) |
int | maConnGetAddr (MAHandle conn, MAConnAddr *addr) |
MAHandle | maHttpCreate (const char *url, int method) |
void | maHttpSetRequestHeader (MAHandle conn, const char *key, const char *value) |
int | maHttpGetResponseHeader (MAHandle conn, const char *key, char *buffer, int bufSize) |
void | maHttpFinish (MAHandle conn) |
int | maLoadResources (MAHandle data) |
void | maLoadProgram (MAHandle data, int reload) |
int | maGetKeys (void) |
int | maGetEvent (MAEvent *event) |
void | maWait (int timeout) |
int | maTime (void) |
int | maLocalTime (void) |
int | maGetMilliSecondCount (void) |
int | maFreeObjectMemory (void) |
int | maTotalObjectMemory (void) |
int | maVibrate (int ms) |
void | maExit (int result) __attribute__((noreturn)) |
void | maPanic (int result, const char *message) __attribute__((noreturn)) |
int | maSoundPlay (MAHandle sound_res, int offset, int size) |
void | maSoundStop (void) |
int | maSoundIsPlaying (void) |
int | maSoundGetVolume (void) |
void | maSoundSetVolume (int vol) |
int | maInvokeExtension (int function, int a, int b, int c) |
int | maIOCtl (int function, int a, int b, int c) |
static int | maCheckInterfaceVersion (int hash) |
static int | maReportCallStack (void) |
static void | maProtectMemory (const void *start, int length) |
static void | maUnprotectMemory (const void *start, int length) |
static void | maSetMemoryProtection (int enable) |
static int | maGetMemoryProtection (void) |
static int | maGetBatteryCharge (void) |
static int | maLockKeypad (void) |
static int | maUnlockKeypad (void) |
static int | maKeypadIsLocked (void) |
static int | maWriteLog (const void *src, int size) |
static int | maBtStartDeviceDiscovery (int names) |
static int | maBtGetNewDevice (MABtDevice *d) |
static int | maBtStartServiceDiscovery (const MABtAddr *address, const MAUUID *uuid) |
static int | maBtGetNextServiceSize (MABtServiceSize *dst) |
static int | maBtGetNewService (MABtService *dst) |
static int | maBtCancelDiscovery (void) |
static int | maLocationStart (void) |
static int | maLocationStop (void) |
static int | maPlatformRequest (const char *url) |
static int | maSendTextSMS (const char *dst, const char *msg) |
static int | maFrameBufferGetInfo (MAFrameBufferInfo *info) |
static int | maFrameBufferInit (const void *data) |
static int | maFrameBufferClose (void) |
static int | maSendToBackground (void) |
static int | maBringToForeground (void) |
static int | maGetSystemProperty (const char *key, char *buf, int size) |
Defines | |
#define | MAIDL_HASH ((int)0x167e12d8) |
A hash of the abstract representation of the API described in this file. Identifiers, declarations and definitions are included in the calculation of the hash, but documentation is not. | |
#define | ATTRIBUTE(a, func) func __attribute__ ((a)) |
#define | GCCATTRIB(a) __attribute__ ((a)) |
#define | MOSYNC_API |
#define | EXTENT_Y(e) ((short)(e)) |
Returns the height of an MAExtent. | |
#define | EXTENT_X(e) ((short)((e) >> 16)) |
Returns the width of an MAExtent. | |
#define | EXTENT(x, y) ((MAExtent)((((int)(x)) << 16) | ((y) & 0xFFFF))) |
Creates an MAExtent. | |
#define | TRANS_NONE 0 |
The image is copied unchanged. | |
#define | TRANS_ROT90 5 |
The image is rotated clockwise by 90 degrees. | |
#define | TRANS_ROT180 3 |
The image is rotated clockwise by 180 degrees. | |
#define | TRANS_ROT270 6 |
The image is rotated clockwise by 270 degrees. | |
#define | TRANS_MIRROR 2 |
The image is reflected about its vertical center. | |
#define | TRANS_MIRROR_ROT90 7 |
The image is reflected about its vertical center, then rotated clockwise by 90 degrees. | |
#define | TRANS_MIRROR_ROT180 1 |
The image is reflected about its vertical center, then rotated clockwise by 180 degrees. | |
#define | TRANS_MIRROR_ROT270 4 |
The image is reflected about its vertical center, then rotated clockwise by 270 degrees. | |
#define | HANDLE_SCREEN 0 |
This handle refers to the back buffer, which is initially black. | |
#define | HANDLE_LOCAL 0 |
#define | RES_OUT_OF_MEMORY -1 |
#define | RES_BAD_INPUT -2 |
#define | RES_OK 1 |
#define | MAS_CREATE_IF_NECESSARY 1 |
#define | STERR_GENERIC -2 |
Generic error. | |
#define | STERR_FULL -3 |
The storage medium is full. | |
#define | STERR_NONEXISTENT -5 |
The store does not exist. | |
#define | CONNERR_GENERIC -2 |
Generic error. | |
#define | CONNERR_MAX -3 |
The maximum number of open connections allowed has been reached. | |
#define | CONNERR_DNS -4 |
DNS resolution error. | |
#define | CONNERR_INTERNAL -5 |
Internal error. Please report any occurrences to Mobile Sorcery. | |
#define | CONNERR_CLOSED -6 |
The connection was closed by the remote peer. | |
#define | CONNERR_READONLY -7 |
You attempted to write to a read-only connection. | |
#define | CONNERR_FORBIDDEN -8 |
The OS does not trust you enough to let you open this connection. | |
#define | CONNERR_UNINITIALIZED -9 |
No operation has been started yet. | |
#define | CONNERR_CONLEN -10 |
The Content-Length header could not be found. | |
#define | CONNERR_URL -11 |
You supplied a malformed URL. | |
#define | CONNERR_UNAVAILABLE -12 |
The protocol is not available. | |
#define | CONNERR_CANCELED -13 |
You canceled the operation. | |
#define | CONNERR_PROTOCOL -14 |
The server gave an invalid response. | |
#define | CONNERR_NETWORK -15 |
The network connection could not be established. | |
#define | CONNERR_NOHEADER -16 |
The requested header could not be found. | |
#define | CONNERR_USER -1000000 |
#define | CONNOP_READ 1 |
#define | CONNOP_WRITE 2 |
#define | CONNOP_CONNECT 5 |
#define | CONNOP_FINISH 11 |
#define | CONN_MAX 32 |
The maximum number of open connections allowed. | |
#define | BTADDR_LEN 6 |
#define | CONN_FAMILY_INET4 1 |
#define | CONN_FAMILY_BT 2 |
#define | HTTP_GET 1 |
#define | HTTP_POST 2 |
#define | HTTP_HEAD 3 |
#define | MAK_UNKNOWN 0 |
#define | MAK_FIRST 0 |
#define | MAK_BACKSPACE 8 |
#define | MAK_TAB 9 |
#define | MAK_CLEAR 12 |
#define | MAK_RETURN 13 |
#define | MAK_PAUSE 19 |
#define | MAK_ESCAPE 27 |
#define | MAK_SPACE 32 |
#define | MAK_EXCLAIM 33 |
#define | MAK_QUOTEDBL 34 |
#define | MAK_POUND 35 |
#define | MAK_HASH 35 |
#define | MAK_GRID 35 |
#define | MAK_DOLLAR 36 |
#define | MAK_AMPERSAND 38 |
#define | MAK_QUOTE 39 |
#define | MAK_LEFTPAREN 40 |
#define | MAK_RIGHTPAREN 41 |
#define | MAK_ASTERISK 42 |
#define | MAK_STAR 42 |
#define | MAK_PLUS 43 |
#define | MAK_COMMA 44 |
#define | MAK_MINUS 45 |
#define | MAK_PERIOD 46 |
#define | MAK_SLASH 47 |
#define | MAK_0 48 |
#define | MAK_1 49 |
#define | MAK_2 50 |
#define | MAK_3 51 |
#define | MAK_4 52 |
#define | MAK_5 53 |
#define | MAK_6 54 |
#define | MAK_7 55 |
#define | MAK_8 56 |
#define | MAK_9 57 |
#define | MAK_COLON 58 |
#define | MAK_SEMICOLON 59 |
#define | MAK_LESS 60 |
#define | MAK_EQUALS 61 |
#define | MAK_GREATER 62 |
#define | MAK_QUESTION 63 |
#define | MAK_AT 64 |
#define | MAK_LEFTBRACKET 91 |
#define | MAK_BACKSLASH 92 |
#define | MAK_RIGHTBRACKET 93 |
#define | MAK_CARET 94 |
#define | MAK_UNDERSCORE 95 |
#define | MAK_BACKQUOTE 96 |
#define | MAK_A 97 |
#define | MAK_B 98 |
#define | MAK_C 99 |
#define | MAK_D 100 |
#define | MAK_E 101 |
#define | MAK_F 102 |
#define | MAK_G 103 |
#define | MAK_H 104 |
#define | MAK_I 105 |
#define | MAK_J 106 |
#define | MAK_K 107 |
#define | MAK_L 108 |
#define | MAK_M 109 |
#define | MAK_N 110 |
#define | MAK_O 111 |
#define | MAK_P 112 |
#define | MAK_Q 113 |
#define | MAK_R 114 |
#define | MAK_S 115 |
#define | MAK_T 116 |
#define | MAK_U 117 |
#define | MAK_V 118 |
#define | MAK_W 119 |
#define | MAK_X 120 |
#define | MAK_Y 121 |
#define | MAK_Z 122 |
#define | MAK_DELETE 127 |
#define | MAK_KP0 256 |
#define | MAK_KP1 257 |
#define | MAK_KP2 258 |
#define | MAK_KP3 259 |
#define | MAK_KP4 260 |
#define | MAK_KP5 261 |
#define | MAK_KP6 262 |
#define | MAK_KP7 263 |
#define | MAK_KP8 264 |
#define | MAK_KP9 265 |
#define | MAK_KP_PERIOD 266 |
#define | MAK_KP_DIVIDE 267 |
#define | MAK_KP_MULTIPLY 268 |
#define | MAK_KP_MINUS 269 |
#define | MAK_KP_PLUS 270 |
#define | MAK_KP_ENTER 271 |
#define | MAK_KP_EQUALS 272 |
#define | MAK_UP 273 |
#define | MAK_DOWN 274 |
#define | MAK_RIGHT 275 |
#define | MAK_LEFT 276 |
#define | MAK_INSERT 277 |
#define | MAK_HOME 278 |
#define | MAK_END 279 |
#define | MAK_PAGEUP 280 |
#define | MAK_PAGEDOWN 281 |
#define | MAK_FIRE 284 |
#define | MAK_SOFTLEFT 285 |
#define | MAK_SOFTRIGHT 286 |
#define | MAK_PEN 291 |
#define | MAK_BACK 292 |
#define | MAK_MENU 293 |
#define | MAK_RSHIFT 303 |
#define | MAK_LSHIFT 304 |
#define | MAK_RCTRL 305 |
#define | MAK_LCTRL 306 |
#define | MAK_RALT 307 |
#define | MAK_LALT 308 |
#define | MAKB_LEFT 0x00001 |
#define | MAKB_UP 0x00002 |
#define | MAKB_RIGHT 0x00004 |
#define | MAKB_DOWN 0x00008 |
#define | MAKB_FIRE 0x00010 |
#define | MAKB_SOFTLEFT 0x00020 |
#define | MAKB_SOFTRIGHT 0x00040 |
#define | MAKB_0 0x00080 |
#define | MAKB_1 0x00100 |
#define | MAKB_2 0x00200 |
#define | MAKB_3 0x00400 |
#define | MAKB_4 0x00800 |
#define | MAKB_5 0x01000 |
#define | MAKB_6 0x02000 |
#define | MAKB_7 0x04000 |
#define | MAKB_8 0x08000 |
#define | MAKB_9 0x10000 |
#define | MAKB_ASTERISK 0x20000 |
#define | MAKB_STAR 0x20000 |
#define | MAKB_HASH 0x40000 |
#define | MAKB_POUND 0x40000 |
#define | MAKB_GRID 0x40000 |
#define | MAKB_CLEAR 0x80000 |
#define | EVENT_BUFFER_SIZE 128 |
#define | EVENT_CLOSE_TIMEOUT 2000 |
In milliseconds. | |
#define | EVENT_TYPE_CLOSE 1 |
#define | EVENT_TYPE_KEY_PRESSED 2 |
#define | EVENT_TYPE_KEY_RELEASED 3 |
#define | EVENT_TYPE_CONN 4 |
Connection. | |
#define | EVENT_TYPE_BT 5 |
Bluetooth discovery. | |
#define | EVENT_TYPE_POINTER_PRESSED 8 |
#define | EVENT_TYPE_POINTER_RELEASED 9 |
#define | EVENT_TYPE_POINTER_DRAGGED 10 |
#define | EVENT_TYPE_FOCUS_LOST 13 |
#define | EVENT_TYPE_FOCUS_GAINED 14 |
#define | EVENT_TYPE_LOCATION 16 |
Has MAEvent::data point to an MALocation. | |
#define | EVENT_TYPE_LOCATION_PROVIDER 17 |
MAEvent::state is one of the MA_LPS constants. | |
#define | EVENT_TYPE_SCREEN_CHANGED 21 |
#define | RUNTIME_MORE 1 |
The MoSync Reference Environment, also known as the Emulator. | |
#define | RUNTIME_JAVA 2 |
Java ME. | |
#define | RUNTIME_SYMBIAN 3 |
Symbian. | |
#define | RUNTIME_WINCE 4 |
Windows CE, also known as Windows Mobile. | |
#define | REPORT_PANIC 1 |
Caused by a MoSync Panic. MAPanicReport::code is the panic code. | |
#define | REPORT_EXCEPTION 2 |
Caused by a native exception. MAPanicReport::string describes the exception. | |
#define | REPORT_PLATFORM_CODE 3 |
Caused by a platform-specific error. MAPanicReport::code is valid. | |
#define | REPORT_USER_PANIC 4 |
#define | REPORT_TIMEOUT 5 |
Caused by the Close event timeout. Neither code or string are valid. | |
#define | MA_LOC_NONE 1 |
#define | MA_LOC_INVALID 2 |
#define | MA_LOC_UNQUALIFIED 3 |
#define | MA_LOC_QUALIFIED 4 |
#define | MA_LPS_AVAILABLE 1 |
#define | MA_LPS_TEMPORARILY_UNAVAILABLE 2 |
#define | MA_LPS_OUT_OF_SERVICE 3 |
#define | IOCTL_UNAVAILABLE -1 |
Typedefs | |
typedef char * | MAString |
typedef void * | MAAddress |
typedef int | MAHandle |
typedef int | MAExtent |
typedef unsigned char | byte |
typedef unsigned short | ushort |
typedef unsigned int | uint |
typedef unsigned long | ulong |
|
A hash of the abstract representation of the API described in this file. Identifiers, declarations and definitions are included in the calculation of the hash, but documentation is not.
|
|
|
|
|
|
|
|
Returns the height of an MAExtent.
|
|
Returns the width of an MAExtent.
|
|
Creates an MAExtent.
|
|
The image is copied unchanged.
|
|
The image is rotated clockwise by 90 degrees.
|
|
The image is rotated clockwise by 180 degrees.
|
|
The image is rotated clockwise by 270 degrees.
|
|
The image is reflected about its vertical center.
|
|
The image is reflected about its vertical center, then rotated clockwise by 90 degrees.
|
|
The image is reflected about its vertical center, then rotated clockwise by 180 degrees.
|
|
The image is reflected about its vertical center, then rotated clockwise by 270 degrees.
|
|
This handle refers to the back buffer, which is initially black.
|
|
|
|
|
|
|
|
|
|
|
|
Generic error.
|
|
The storage medium is full.
|
|
The store does not exist.
|
|
Generic error.
|
|
The maximum number of open connections allowed has been reached.
|
|
DNS resolution error.
|
|
Internal error. Please report any occurrences to Mobile Sorcery.
|
|
The connection was closed by the remote peer. Happens when HTTP servers finish sending data. |
|
You attempted to write to a read-only connection.
|
|
The OS does not trust you enough to let you open this connection.
|
|
No operation has been started yet.
|
|
The Content-Length header could not be found.
|
|
You supplied a malformed URL.
|
|
The protocol is not available.
|
|
You canceled the operation.
|
|
The server gave an invalid response.
|
|
The network connection could not be established.
|
|
The requested header could not be found.
|
|
If you wish to share the CONNERR codespace, use values below this for your own error codes. |
|
|
|
|
|
|
|
|
|
The maximum number of open connections allowed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In milliseconds.
|
|
This event is posted when the operating system sends MoSync a command to exit. Causes include the OS shutting down and OS-controlled user commands.
|
|
|
|
|
|
Connection.
|
|
Bluetooth discovery.
|
|
|
|
|
|
|
|
While MoSync doesn't have focus, no key events will arrive and the screen will not be updated. If the keypad is locked, no application will have focus.
|
|
|
|
Has MAEvent::data point to an MALocation.
|
|
MAEvent::state is one of the MA_LPS constants.
|
|
|
|
The MoSync Reference Environment, also known as the Emulator.
|
|
Java ME.
|
|
Symbian.
|
|
Windows CE, also known as Windows Mobile.
|
|
Caused by a MoSync Panic. MAPanicReport::code is the panic code.
|
|
Caused by a native exception. MAPanicReport::string describes the exception.
|
|
Caused by a platform-specific error. MAPanicReport::code is valid.
|
|
Caused by a call to maPanic(). MAPanicReport::code and MAPanicReport::string are the parameters from the call. |
|
Caused by the Close event timeout. Neither code or string are valid.
|
|
|
|
|
|
|
|
|
|
Availability status code: the location provider is available. |
|
Availability status code: the location provider is temporarily unavailable. Temporary unavailability means that the method is unavailable due to reasons that can be expected to possibly change in the future and the provider to become available. An example is not being able to receive the signal because the signal used by the location method is currently being obstructed, e.g. when deep inside a building for satellite based methods. However, a very short transient obstruction of the signal should not cause the provider to toggle quickly between TEMPORARILY_UNAVAILABLE and AVAILABLE. |
|
Availability status code: the location provider is out of service. Being out of service means that the method is unavailable and the implementation is not able to expect that this situation would change in the near future. An example is when using a location method implemented in an external device and the external device is detached. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sets size bytes, starting at dst, to the specified value, interpreted as an unsigned char.
|
|
Copies the values of size bytes from the location pointed by src directly to the memory block pointed by dst. The underlying type of the objects pointed by both the source and destination pointers are irrelevant for this function; The result is a binary copy of the data. The function does not check for any terminating null character in source - it always copies exactly size bytes. To avoid overflows, the size of the arrays pointed by both the destination and source parameters, shall be at least size bytes, and should not overlap (for overlapping memory blocks, memmove() is a safe approach).
|
|
Compares the C string str1 to the C string str2. This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminanting null-character is reached.
|
|
Copies the C string pointed by src into the array pointed by dst, including the terminating null character. To avoid overflows, the size of the array pointed by dst shall be long enough to contain the same C string as src (including the terminating null character), and should not overlap in memory with src.
|
|
Returns a + b. |
|
Returns a - b. |
|
Returns a * b. |
|
Returns a / b. If b == 0, a MoSync Panic is thrown. |
|
Returns -a. |
|
Returns the integer part of a. |
|
Returns the double representation of a. |
|
Returns the double representation of a. |
|
Returns >0 if a > b, 0 if a == b and <0 if a < b. If either argument is Not a Number, the result is undefined. |
|
Returns a + b. |
|
Returns a - b. |
|
Returns a * b. |
|
Returns a / b. If b == 0, a MoSync Panic is thrown. |
|
Returns -a. |
|
Returns the integer part of a. |
|
Returns the float representation of a. |
|
Returns the double representation of a. |
|
Returns >0 if a > b, 0 if a == b and <0 if a < b. If either argument is Not a Number, the result is undefined. |
|
Returns the sine of x.
|
|
Returns the cosine of x.
|
|
Returns the tangent of x.
|
|
Returns the square root of x. |
|
Sets the color used by drawing functions. Returns previous color. Initial color is 0 (black).
|
|
Sets the clipping rectangle for the current draw target. The screen and every drawable image each maintains a clipping rectangle. Drawing operations have no effect outside the clipping rectangle. The default clipping rectangle covers the entire draw target, so that clipping occurs at the draw target's edges. |
|
Returns the clipping rectangle for the current draw target. |
|
Draws a single pixel using the current color. |
|
Draws a line using the current color. |
|
Draws a filled rectangle using the current color. Width and height must be greater than zero. |
|
Draws a filled triangle strip using the current color.
|
|
Draws a filled triangle fan using the current color.
|
|
Returns the size in pixels of Latin-1 text as it would appear on-screen. |
|
Draws Latin-1 text using the current color. |
|
Copies the back buffer to the physical screen. |
|
Normally, a phone's backlight turns itself off after a few seconds of the user not pressing any keys. To avoid this behaviour, call this function periodically. As the timeout period is different for every device, and sometimes even user-configurable, it's recommended that you call this function at least once every 500 milliseconds to ensure that the light stays on at all times. |
|
Returns the screen size. |
|
Draws an image. It it placed on the draw target with the top left corner according to the parameters. |
|
Draws an image. The source is an array of ints that represent pixels in XRGB format.
|
|
Draws a portion of an image using a transformation.
|
|
Returns the size of an image. |
|
Copies an image into an array of ints that represent pixels in ARGB format. The destination rectangle is defined as { 0,0, srcRect.width, srcRect.height }. Parts of the destination array that are outside the destination rectangle are not modified. If srcRect is outside the bounds of the source image, or if srcRect.width is greater than scanlength, a MoSync Panic is thrown.
|
|
Sets the current draw target. The handle must be a drawable image or HANDLE_SCREEN, which represents the back buffer. The initial draw target is the back buffer. If an image is set as draw target, its object handle goes into flux, which prevents its destruction or use as a source in maDrawImage. When a different draw target is set, the image's handle is restored. Returns the the previously set draw target.
|
|
Finds the label resource with the specified name and returns its index. If it is not found, -1 is returned. |
|
Creates an image object using encoded data from a data object. All platforms support the PNG format. Some platforms may also support JPEG and/or GIF.
|
|
Creates an image object using raw ARGB data.
|
|
Creates a drawable image of the specified size. A drawable image has no alpha channel, which is to say, no transparency. Its initial contents are undefined, so you should draw onto the entire surface to be sure what will happen when you draw this image onto something else.
|
|
Creates a data object of the specified size, in bytes. Its initial contents are undefined.
|
|
Creates a new placeholder and returns the handle to it. |
|
Destroys an object of any type. The handle becomes a placeholder. |
|
Returns the size, in bytes, of a data object. |
|
Reads size bytes from a data object, starting at offset, into memory pointed to by dst.
|
|
Writes size bytes to a data object, starting at offset, from memory pointed to by src. |
|
Copies size bytes from data object src to dst, at the specified offsets. |
|
Opens a permanent data store, optionally creates one if it doesn't exist already. Returns a Store MAHandle on success. Returns STERR_NONEXISTENT if !(flags & MAS_CREATE_IF_NECESSARY) and the store does not exist. Returns another STERR code if the store could not be opened for another reason.
|
|
Writes the contents of a data object to a store. Destroys any data currently in the store. Returns > 0 on success, STERR_FULL if the storage system is full, or another STERR code if the write failed for another reason.
|
|
Creates a data object and copies the contents of a store to it. Use maGetDataSize to get the size of the data.
|
|
Closes a store. Also removes that store if remove is non-zero. |
|
Asynchronously opens a connection using the specified URL. A URL takes the following form:
In the On a few devices, using ports numbered below 1024 may cause system crashes. Therefore, it is advisable to use ports above 1024 if you can choose.
For the
Example TCP url:
Example HTTP url:
Example Bluetooth url: To find Bluetooth addresses, use the Bluetooth discovery API. See maBtStartDeviceDiscovery(). The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_CONNECT.
The success value is > 0. For the When you're done with the connection, maConnClose() must be called to free the resources associated with the handle. This must be done even if the connect operation failed. There is a limit of CONN_MAX open connection handles at any time, so if you keep opening connections without closing them, you'll eventually recieve the CONNERR_MAX error code instead of new connection handles.
|
|
Closes a connection, freeing any resources associated with the handle. Cancels any active operations on the connection. Such operations will finish with CONNERR_CANCELED. |
|
Asynchronously reads at least one and at most size bytes from a connection to memory. The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_READ. The success value is the number of bytes read.
|
|
Asynchronously writes size bytes to a connection from memory. The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_WRITE. The success value is > 0.
|
|
Asynchronously reads at least one and at most size bytes from a connection to a data object, starting at the specified offset. During the read, the data object being written to will be in flux. Any attempt to access it will result in a Panic. The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_READ. The success value is is the number of bytes read.
|
|
Asynchronously writes size bytes to a connection from a data object, starting at the specified offset. During the write, the data object being read from will be in flux. Any attempt to access it will result in a Panic. The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_WRITE. The success value is > 0.
|
|
Retrieves the address of a connection. On server connections, you'll get the local address. On normal connections, you'll get the remote address. You can pass HANDLE_LOCAL to retrieve the local address. In that case, you must set MAConnAddr::family before calling this function, to tell it which address to retrieve. Also, the port member is not set.
|
|
Creates an unfinished HTTP/1.0 connection. You cannot read from this connection until it's been Finished. Before then, you can set request headers. After, you can get response headers. POST connections are special; they let you write to the connection before it's Finished. The first write causes the underlying TCP connection to be established and request headers transmitted. After the first write has begun, you may no longer set request headers.
|
|
Sets a request header of an HTTP connection. Overwrites any existing header with the same key. The keys is case-insensitive. If the connection's method is HTTP_POST, it must not have been written to.
|
|
Stores an HTTP response header in the specified buffer. The buffer may be too small to contain the header and the terminating zero; in that case, the buffer will not be filled and you should create a bigger buffer and call this function again.
|
|
Asynchronously finishes an HTTP connection. This entails making the underlying TCP connection and sending request headers, unless that has already been done by a HTTP_POST write, and recieving the response headers. The result of the operation will be delivered in a CONN event, with MAConnEventData::opType set to CONNOP_FINISH. The success value is the HTTP response code.
|
|
Loads a new object array from the a data object. The old object array is overwritten, except where the new array has SKIP objects. In those cases, the old objects are saved. Returns zero on error, >0 on success. On error, the old object array remains unchanged.
|
|
Loads a new program from the a data object, closes the running program, and starts the new one. The format of the data object is a MoSync program file concatenated with a resource file. If this function returns, there was an error.
|
|
Returns a bitmask consisting of MAKB flags describing the current key state. |
|
There is a FIFO buffer that contains up to EVENT_BUFFER_SIZE events. Each event has a type. Some types have additional data. This function retrieves the next event, unless the queue is empty. Use maWait() to wait until more events are available.
After the Close event has been posted, most syscalls will stop working, returning default values and doing nothing. Only the following groups of functions are guaranteed to remain operational: Memory management, math, Resource management, Store, time, logging, maExit() and maPanic().
|
|
Suspends execution until there is an event in the buffer, or timeout milliseconds have passed. A timeout <= 0 is considered infinite. Timer accuracy is platform-specific, but should be better than 20 ms. Use this function rather than idle loops to save CPU/battery power.
|
|
Returns the number of seconds that have passed since 00:00:00, Jan 1st, 1970, UTC, according to the device clock. |
|
Returns the number of seconds that have passed since 00:00:00, Jan 1st, 1970, local time, according to the device clock. |
|
Returns the number of milliseconds that has passed since some platform-specific point in time. Accuracy is platform-specific, but should be better than 20 ms. |
|
Returns an approximation to the amount of memory currently available for allocating new objects, measured in bytes. There may be more memory available than reported by this function. Conversely, in the time between calling this function and allocating an object, another program may have allocated an object of its own, decreasing the available memory. The amount of memory required to allocate any specific object is device-dependent. When using this function to determine whether or not to allocate an object, always leave some memory alone for use by the system, preferably about 10% of the device's total memory, as reported by maTotalObjectMemory(). |
|
Returns the total amount of memory available to MoSync, measured in bytes. May change over time, even as the program is running. |
|
Switches on the vibrator for the requested number of milliseconds, or switches it off if the requested duration is zero. A call to this function will override the previous call. Returns non-zero if the operation was allowed, zero if it wasn't. |
|
Shuts down the system. This function does not return.
|
|
Displays a message to the user, then shuts down the system. This function does not return.
|
|
Starts playing a sound. If a sound was already playing, it is stopped. The sound data is formatted as follows: <mime type><null terminator byte><encoded data>. The .media directive in the MoSync resource compiler creates this formatting. If you download or generate sound clips dynamically, you'll have to take care of the formatting yourself, or use a library that does it for you, for example MAUtil::AudioDownloader. To play .media resources, use offset 0 and maGetDataSize(). Do not touch the resource while it's playing, or there will be... trouble.
|
|
Stops the sound and rewinds it. |
|
Returns > 0 if sound is playing, zero if it's not. |
|
Returns the volume, in the range 0-100, used by the sound engine. The initial volume is 100. |
|
Sets the volume, which is a value in the range 0-100. All other values will be clamped to the allowed range. |
|
Invokes an extension function. Normally you don't call this function directly. |
|
These functions are available only on certain platforms. Returns -1 if the function is not available. |
|
Compares the runtime's interface version with yours, using a hash of the interface's contents. If the versions do not match, a MoSync Panic is generated. This function returns the runtime's hash. However, if there is a version mismatch, syscall and IOCTL numbers may differ between the runtime and your version of the header files, causing a different function than this to be called. The hash appears as a 32-bit random number, so it is very unlikely that the return value from any other function is the same as the runtime's hash. Therefore, you should always compare the return value from this function to your hash and exit your program, preferably using maPanic(), if they don't match.
|
|
Sends the current call stack to the report pipe. Returns 0 if succeeded. |
|
Protects a piece of the data memory. Any attempt to write to that piece of memory will raise a panic.
|
|
Unprotects a piece of the data memory.
|
|
Toggles memory protection.
|
|
Returns if memory protection is enabled or not.
|
|
Returns the percentage of battery power remaining. This is an integer between 0 and 100. Currently only available on some Symbian and Windows Mobile phones. |
|
Calls on the operating system to lock the phone's keypad. Returns > 0 if successful. |
|
Calls on the operating system to unlock the phone's keypad. Returns > 0 if successful. |
|
Returns > 0 if the phone's keypad is locked by the operating system, zero otherwise. |
|
Writes data to the MoSync system log file. Useful only for debugging purposes. |
|
Starts a device discovery operation.
|
|
Fills an MABtDevice structure with information about a device. Removes the data from an internal queue filled by maBtStartDeviceDiscovery(). If the names parameter of maBtStartDeviceDiscovery() was zero, all members of d except address are ignored and unchanged. The space needed to store the device name and its terminating zero may be greater than a nameBufSize. In that case, the copy is truncated. The maximum length of a device name according to the Bluetooth 2.0 specification is 248 bytes, excluding the terminating zero. However, it's recommended that you don't provide buffers larger than what your application has a use for.
|
|
Starts a service discovery operation. Takes a device address and the UUID of the service class to search for. For example, pass RFCOMM_PROTOCOL_MAUUID and you'll get all connectable services. Pass SerialPort_Service_MAUUID and you'll get only that type of service.
|
|
Fills an MABtServiceSize structure with meta-data about the next service. Does not remove the service from the queue.
|
|
Fills an MABtService structure with information about the next service. Removes the data from the internal queue filled by maBtStartServiceDiscovery().
|
|
Cancels any active discovery operation. If an operation was canceled, its last BT event will have the status CONNERR_CANCELED. This is an asynchronous operation. It is not safe to start another discovery before you've recieved the CONNERR_CANCELED event.
|
|
Starts collecting location information. Does nothing if collection is already active. May cause a system popup asking for the user's permission. LOCATION events will be generated as the estimated location is updated. LOCATION_PROVIDER events will be generated when the location provider state changes.
|
|
Stops collecting location information, and stops generating events. Does nothing if collection is not active.
|
|
Requests that the operating system handle (for example, display or install) the indicated URL. If the platform has the appropriate capabilities and resources available, it SHOULD bring the appropriate application to the foreground and let the user interact with the content, while keeping the MoSync application running in the background. If the platform does not have appropriate capabilities or resources available, it MAY wait to handle the request until after the MoSync application exits. In this case, when the requesting MoSync application exits, the platform MUST then bring the appropriate application (if one exists) to the foreground to let the user interact with the content.
The URL can be of the form
The URL can also be of the form If the URL refers to a packaged application (a .JAR file on Java platforms, .SIS on Symbian or .CAB on Windows Mobile), the request is interpreted as a request to install that application. The application being requested can be an update of the calling application. In that case, the calling application must always exit before the request can be processed.
|
|
Sends a text SMS. Since this may cost money for the user, some platforms ask the user for permission, by displaying a modal Yes/No message box.
|
|
Get frame buffer info. Use info.sizeInBytes to allocate memory for framebuffer.
|
|
Pass a pointer to your framebuffer here. Each time an maUpdateScreen is performed, this piece of memory will be copied to the actual screen memory.
|
|
Close the framebuffer. The graphics sub-system will be set to use the standard framebuffer.
|
|
Sends the application to the background, unless it's already there. Generates a FOCUS_LOST event.
|
|
Brings the application to the foreground, unless it's already there. Generates a FOCUS_GAINED event.
|
|
Retrieves the value of a Java System Property.
|