黑莓.常用函数

来源:互联网 发布:淘宝卖家中心登录 编辑:程序博客网 时间:2024/05/19 10:35

一、  初始化篇:

1.1、int screen_create_context( screen_context_t *pctx, int flags );

#include <screen/screen.h>

Function:创建一个新的背景

pctx:context指针;

flags:创建类型,包括SCREEN_APPLICATION_CONTEXT、SCREEN_WINDOW_MANAGER_CONTEXT、SCREEN_INPUT_PROVIDER_CONTEXT、SCREEN_POWER_MANAGER_CONTEXT;

返回值:0(窗口创建成功)、-1(窗口创建失败);

 

1.2、int bps_initialize(void)

#include <sys/platform.h>

#include "bps/event.h"

Function:初始化BPS

 

 

1.3、bbutil_init_egl()

#include< bbutil.h>Function:初始化egl

返回值:存在返回值,EXIT_SECCUSS表示失败。

 

1.4、 screen_destroy_context(screen_cxt);

#include< bbutil.h>

Function:关闭背景;

返回值:暂时不知道存不存在;

 

1.5、int navigator_request_events(int flags)

#include <stdbool.h>

#include <sys/platform.h>

#include "bps/event.h"

Function:声明本应用需要获取“Navigator”事件。

flags: 零(任何事情都處理),非零

返回值:BPS_SUCCESS 表示成功; BPS_FAILURE 表示失敗。

 

1.6、int bps_get_event(bps_event_t **event, int timeout_ms)

#include <sys/platform.h>

#include "bps/event.h"

Function:获取事件

event: even用来储存事件

timeout_ms:获取事件的方式,可为零、负值、正值。负数则表示bps_get_event方法会一直等待到获取到一个事件为止。如果第二个参数是零则表示bps_get_event不会等待,有事件就获取,没有事件就继续执行后面的代码。如果第二个参数是一个正整数则表示等待指定的时间,期间获取到事件就返回,没有获取到事件就在指定的时间结束后返回。

返回值:BPS_SUCCESS(成功)、, BPS_FAILURE(出错) 、BPS_SUCCESS(成功但是事件为空);

 

1.7、intlocale_request_events(int flags)

#include <sys/platform.h>

#include "bps/event.h"

Function:starts to deliver locale status change events to your applicationusing BPS

flag: Thetypes of events to deliver. A value of zero indicates that all events arerequested. The meaning of non-zero values is reserved for future use.

 

1.8、int bps_event_get_domain(bps_event_t *event)

#include <sys/platform.h>

#include <stdint.h>

Function:獲得事件event的domain

返回值:會event的domain

 

1.9、int navigator_rotation_lock(bool locked)

#include <stdbool.h>

#include <sys/platform.h>

#include "bps/event.h"

Function:鎖定屏幕;

1.10、int screen_request_events(screen_context_t context)

#include <screen/screen.h>

#include <sys/platform.h>

#include "bps/event.h"

context:The libscreen context to use for event retrieval.

Function:申明使用屏幕事件。

 

二、   创建使用对话框篇:

 2.1、int dialog_request_events(int flags)

#include <sys/platform.h>
#include <stdbool.h>
#include "bps/event.h"
Function:starts to deliver dialog events to your application using BPS

flagsThe types of events to deliver

 

2.2、int dialog_create_alert(dialog_instance_t *dialog)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

Function:创建一个对话框。

dialog:对话框指针;

return : BPS_SUCCESS(成功), BPS_FAFILURE(失败);

 

2.3、int dialog_set_alert_message_text(dialog_instance_t dialog, constchar *text)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

Function:设置对话框的。。。。。

dialog:The dialog to update.

text :The message text to display

Return:BPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise

 

2.4、int dialog_set_size(dialog_instance_t dialog, dialog_size_t size)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

Function:Set the size of a dialog.

dialog: 对话框名称

size:大小。typedef enum {

     DIALOG_SIZE_SMALL = 0  

     DIALOG_SIZE_MEDIUM = 1  

     DIALOG_SIZE_LARGE = 2  

     DIALOG_SIZE_TALL = 3  

     DIALOG_SIZE_FULL = 4  

} dialog_size_t;

Return:BPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise.

 

2.5、int dialog_set_cancel_required(dialog_instance_t dialog, boolcancel_required)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

Function:指定应用程序是否需要明确取消对话框。

dialog:The dialog to update.

cancel_required:If true the application must cancel thedialog explicitly, if false the application doesn't need to cancel the dialogexplicitly.

Return:BPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise.

 

2.6、intdialog_show(dialog_instance_t dialog)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

Function:显示出对话框。

dialog:显现的对话框指针。

Return:BPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise

 

2.7、int dialog_set_alert_message_text(dialog_instance_t dialog, const char *text)
#include <sys/platform.h>
#include <stdbool.h>
#include "bps/event.h"
Function:Set the message text of an alert dialog;
dialog:对话框指针。
text: The message text to display.
ReturnBPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise.
 

2.8、int dialog_update(dialog_instance_t dialog)

#include <sys/platform.h>

#include <stdbool.h>

#include "bps/event.h"

FunctionUpdate a dialog, 刷新,显现字符。

dialog:The dialog to update.

ReturnBPS_SUCCESS upon success,BPS_FAILURE with errno set otherwise.

 

2.9、int dialog_destroy(dialog_instance_t dialog)

#include <sys/platform.h>

#include <stdbool.h>

#include"bps/event.h"

Function:Destroy a dialog.

dialog:对话框指针。

Return:BPS_SUCCESS upon success, BPS_FAILUREwith errno set otherwise.

 

三、  窗口创建使用篇():先建立一个context然后再这之上建立窗口;

窗口的类型:SCREEN_APPLICATION_WINDOW:创建时的坐标相对于全屏幕而已;

                         SCREEN_CHILD_WINDOW(子窗口):创建时的坐标对于父窗口而言,一般用来存放对话框(dialog),需要在窗口组添加。

                         SCREEN_EMBEDDED_WINDOW:Used to embed a window control within an object. Like the childwindow, the X and Y coordinates of the embedded window are all relative to thetop left corner of the application window. You must add an embedded window toan application's window group, otherwise the embedded window is invisible(此我无法正确用中文表达出来).

3.1、int screen_create_context( screen_context_t *pctx, int flags );

#include <screen/screen.h>

Function:创建一个新的背景

pctx:窗口指针;

flags:创建类型,包括SCREEN_APPLICATION_CONTEXT、SCREEN_WINDOW_MANAGER_CONTEXT、SCREEN_INPUT_PROVIDER_CONTEXT、SCREEN_POWER_MANAGER_CONTEXT;

返回值:0(窗口创建成功)、-1(窗口创建失败);

 

3.2、int screen_create_window( screen_window_t * pwin,                screen_context_t ctx );

#include <screen/screen.h>

Funtction:在某个context创建一个window。

pwin:窗口指针

ctx :cxt所要城建窗口的context

Return:0(成功)、-1(失败)。

3.3、pid_t getpid( void );

#include <process.h>

Function:Get the process ID

3.4、int screen_create_window_group( screen_win1dow_t win, const char *name )

#include <screen/screen.h>

Function:Create a window group that other windows can join.

win:需要放在这个window group中的窗口

name:可以用3.3来获取;

(设置窗口属性):

3.5、#include <screen/screen.h>

int screen_set_window_property_cv(screen_window_t win, int pname, int len, const char * param );

int screen_set_window_property_iv(screen_window_t win, int pname, const int * param );

int screen_set_window_property_llv(screen_window_t win, int pname, const long long * param );

int screen_set_window_property_pv(screen_window_t win, int pname, void ** param );

Function:设置窗口的属性。

3.6、int paymentservice_purchase_request

 

 

四、虚拟键盘及事件获取使用篇():

4.1、int virtualkeyboard_request_events(int flags)

#include <stdbool.h>
#include <sys/platform.h>
#include "bps/event.h"
#include <bps/virtualkeyboard.h>

flags: Thetypes of events to deliver. A value of zero indicates that all events arerequested. The meaning of non-zero values is reserved for future use.

Function:申明开始virtualkeyboard事件。

ReturnBPS_SUCCESS upon success, BPS_FAILURE with errno set otherwise.

 

4.2、void virtualkeyboard_show()

#include <stdbool.h>
#include <bps/virtualkeyboard.h>
#include <sys/platform.h>
#include "bps/event.h"

Function:打开虚拟键盘。

 

4.3、void virtualkeyboard_hide()

#include <stdbool.h>
#include <sys/platform.h>
#include "bps/event.h”
Function:隐藏虚拟键盘。
4.4、int bps_get_event(bps_event_t **event, int timeout_ms)
#include <sys/platform.h>
#include "bps/event.h"
Function:接收事件。
event:事件指针。
timeout_ms:等待的时间(可以为-1,代表知道下一个事件发生为止)。
Return:BPS_SUCCESS(成功,时间超时也返回这,但是event是空指针), BPS_FAILURE (失败)
4.5、int bps_event_get_domain(bps_event_t *event)
#include <sys/platform.h>
#include <stdint.h>
Function:gets the domain of a BPS event。(可以说获取bps流).
event: The event to get the domain of.
Return: The domain of the event.
4.6、int screen_get_domain()
#include <screen/screen.h>
#include <sys/platform.h>
#include "bps/event.h"
Function: gets the unique domain ID for the screen.(可以说是获取screen流)。(程序里面可以用4.5和4.6来判断是否是屏幕事件)
Return:The domain ID for the screen.
4.7、int navigator_get_domain()
#include <stdbool.h>
#include <sys/platform.h>
#include "bps/event.h"
Function:gets the unique domain ID for the navigator service.
Return: The domain ID for the navigator service.(程序里面可以用4、7和4.7来判断是否是navigator service事件)
4.8、unsigned int bps_event_get_code(bps_event_t *event)
#include <sys/platform.h>
#include <stdint.h>
event:The event to get the code of.
Function:识别具体的的事件。
Return:The code of the event.
4.9、screen_event_t screen_event_get_event(bps_event_t *event)
#include <screen/screen.h>
#include <sys/platform.h>
#include "bps/event.h"
Function:extracts the libscreen screen_event_t that is stored within a BPS event.(识别是什么屏幕事件并且存储在event中,只有是屏幕事件才可以使用);
Return:The libscreen screen_event_t.
4.10、#include <winmgr/iow.h>
 
int screen_set_event_property_cv( screen_event_t ev, int pname, int len, const char * param);
int screen_set_event_property_iv( screen_event_t ev, int pname,const int * param);
int screen_set_event_property_llv( screen_event_t ev, int pname, const long long * param);
 int screen_set_event_property_pv( screen_event_t ev, int pname, void ** param);
参数:
 
ev:事件(4.9中所获取到的event);
pname: The name of the property whose value must change.有以下几种:
    Event type: SCREEN_EVENT_CLOSESCREEN_PROPERTY_WINDOW
 
    Event type: SCREEN_EVENT_CREATESCREEN_PROPERTY_WINDOW
    SCREEN_PROPERTY_GROUP
 
    Event type: SCREEN_EVENT_DISPLAYSCREEN_PROPERTY_DISPLAY
    SCREEN_PROPERTY_ATTACHED
    SCREEN_PROPERTY_MIRROR_MODE
    SCREEN_PROPERTY_MODE
    SCREEN_PROPERTY_PROTECTION_ENABLE
 
    Event type: SCREEN_EVENT_EFFECT_COMPLETESCREEN_PROPERTY_EFFECT
 
    Event type: SCREEN_EVENT_IDLESCREEN_PROPERTY_IDLE_STATE
 
    Event type: SCREEN_EVENT_INPUTSCREEN_PROPERTY_DEVICE_INDEX
    SCREEN_PROPERTY_INPUT_VALUE
 
    Event type: SCREEN_EVENT_JOGSCREEN_PROPERTY_DEVICE_INDEX
    SCREEN_PROPERTY_JOG_COUNT
 
    Event type: SCREEN_EVENT_KEYBOARDSCREEN_PROPERTY_DEVICE_INDEX
    SCREEN_PROPERTY_KEY_CAP
    SCREEN_PROPERTY_KEY_FLAGS
    SCREEN_PROPERTY_KEY_MODIFIERS
    SCREEN_PROPERTY_KEY_SCAN
    SCREEN_PROPERTY_KEY_SYM
 
       Event type: SCREEN_EVENT_MTOUCH_RELEASESCREEN_PROPERTY_TIMESTAMP
    SCREEN_PROPERTY_POSITION
    SCREEN_PROPERTY_SEQUENCE_ID
SCREEN_PROPERTY_SIZE
SCREEN_PROPERTY_SOURCE_POSITION
SCREEN_PROPERTY_SOURCE_SIZE
SCREEN_PROPERTY_TOUCH_ID
SCREEN_PROPERTY_TOUCH_ORIENTATION
SCREEN_PROPERTY_TOUCH_PRESSURE
SCREEN_PROPERTY_TIMESTAMP
SCREEN_PROPERTY_WINDOW
 
Event type: SCREEN_EVENT_POINTERSCREEN_PROPERTY_BUTTONS
SCREEN_PROPERTY_DEVICE_INDEX
SCREEN_PROPERTY_POSITION
SCREEN_PROPERTY_SOURCE_POSITION
SCREEN_PROPERTY_WINDOW
 
Event type: SCREEN_EVENT_POSTSCREEN_PROPERTY_WINDOW
 
Event type: SCREEN_EVENT_PROPERTYSCREEN_PROPERTY_NAME
SCREEN_PROPERTY_WINDOW
 
Event type: SCREEN_EVENT_USERSCREEN_PROPERTY_USER_DATA
功能:
screen_set_event_property_cv():Takes a char value of a given
length.screen_set_event_property_iv():Takes an integer
value.screen_set_event_property_llv():Takes a long long
value.screen_set_event_property_pv():Takes a pointer to an opaque handle type.
Return:Nothing
4.11、void virtualkeyboard_change_options(virtualkeyboard_layout_t layout, virtualkeyboard_enter_t enter)
#include <stdbool.h>
#include <sys/platform.h>
#include "bps/event.h"
Function:changes the virtual keyboard layout and Enter key options.
参数:
    Layout:#include <stdbool.h>
           #include <sys/platform.h>
           #include "bps/event.h"
           typedef enum {
                   VIRTUALKEYBOARD_LAYOUT_DEFAULT = 0   
                   VIRTUALKEYBOARD_LAYOUT_URL = 1   
                   VIRTUALKEYBOARD_LAYOUT_EMAIL = 2   
                   VIRTUALKEYBOARD_LAYOUT_WEB = 3   
                   VIRTUALKEYBOARD_LAYOUT_NUM_PUNC = 4   
                   VIRTUALKEYBOARD_LAYOUT_SYMBOL = 5   
                   VIRTUALKEYBOARD_LAYOUT_PHONE = 6   
                   VIRTUALKEYBOARD_LAYOUT_PIN = 7   
           } virtualkeyboard_layout_t;
       enter:
           #include <stdbool.h>
               #include <sys/platform.h>
               #include "bps/event.h"
               typedef enum {
                       VIRTUALKEYBOARD_ENTER_DEFAULT = 0   
                       VIRTUALKEYBOARD_ENTER_GO = 1   
                       VIRTUALKEYBOARD_ENTER_JOIN = 2   
                       VIRTUALKEYBOARD_ENTER_NEXT = 3   
                       VIRTUALKEYBOARD_ENTER_SEARCH = 4   
                       VIRTUALKEYBOARD_ENTER_SEND = 5   
                       VIRTUALKEYBOARD_ENTER_SUBMIT = 6   
                       VIRTUALKEYBOARD_ENTER_DONE = 7   
                       VIRTUALKEYBOARD_ENTER_CONNECT = 8   
           } virtualkeyboard_enter_t;