UI Manipulation APIs

rs_send_custom_event

Defined in <sparklet_api.h>

Version

int32_t rs_send_custom_event (uint16_t u16_event_id);

Since 3.1

This function sends a custom event into the Sparklet engine that can be used to trigger state machine transitions, animations etc.

PARAMETERS:

u16_event_id

Event ID of custom event

RETURN VALUE:

0 - Success.

Example:

The code below triggers custom event 21.

rs_send_custom_event (21);

rs_sgui_widget_show

Defined in <sparklet_api.h>

Version

int32_t  rs_sgui_widget_show(uint32_t u32_ctrl_id, int show);

Since 3.1

This function is used to show/hide a widget with the given ID.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

show

1 – Shows the widget

0 – Hides the widget

RETURN VALUE:

0 - Success.

Example:

The code below shows widget with ID 512.

rs_sgui_widget_show(512, 1);

rs_sgui_widget_enable

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_widget_enable(uint32_t u32_ctrl_id, int enable);

Since 3.1

This function enables/disables the widget with the given ID. Disabling a widget typically prevents it from handling any user inputs.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

enable

1 - Enable

0 - Disable

RETURN VALUE:

0 - Success.

Example:

The below code enables widget with flint ID 512.

rs_sgui_widget_enable(512, 1);

rs_sgui_widget_redraw

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_widget_redraw(uint32_t u32_ctrl_id, int enable);

Since 3.1

This function forces the Sparklet engine to redraw the given widget.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

RETURN VALUE:

0 - Success.

Example:

The below code redraws widget with flint ID 512.

rs_sgui_widget_redraw(512);

rs_sgui_ctrl_set_internal_state

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_ctrl_set_internal_state (uint32_t u32_ctrl_id, int32_t s32_internal_state);

Since 3.1

This function sets the internal state of widget with the given value.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

s32_internal_state

Internal state of the widget. Must be 0 or in custom range (> 100)

RETURN VALUE:

0 - Success.

1 - Non-Zero Error code

Example:

The below code sets the internal state of widget with flint ID 512 as 101.

rs_sgui_ctrl_set_internal_state (512, 101);

rs_sgui_ctrl_get_internal_state

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_ctrl_get_internal_state (uint32_t u32_ctrl_id);

Since 1.1

This function is used to get the internal state of the given widget.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

RETURN VALUE:

Internal state of widget.

Example:

The code below gets the internal state of widget with flint ID 512.

internal_state = rs_sgui_ctrl_get_internal_state (512);

rs_hsm_get_current_state

Defined in <sparklet_api.h>

Version

int32_t rs_hsm_get_current_state (uint32_t u32_sm_id);

Since 1.1

This function is used to get the current state of the given state machine.

PARAMETERS:

u32_sm_id

State machine ID

RETURN VALUE:

HSM state of widget.

Example:

The below code gets the HSM state of state machine with ID 2.

state = rs_hsm_get_current_state (2);

rs_sgui_ctrl_set_ui_state

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_ctrl_set_ui_state (uint32_t u32_ctrl_id, int32_t s32_ui_state);

Since 3.1

This function sets the UI state of widget with the given value.

PARAMETERS:

u32_ctrl_id

Flint ID of widget

s32_ui_state

UI state of the widget

RETURN VALUE:

0 - Success.

1 - Non-Zero Error code

Example:

The code below sets the UI state of widget with flint ID 512 as 1.

rs_sgui_ctrl_set_internal_state (512, 1);

sgui_send_key_down_to_control

Defined in <sparklet_api.h>

Version

int sgui_send_key_down_to_control(INT16U u16_id, char gch_key);

Since 1.1

This function is used to send the given key code to the widget.

PARAMETERS:

u16_id

Widget to send event to

gch_key

ASCII value of the key

RETURN VALUE:

0 - Success

Example:

The below code sends key ‘a’ to the widget with ID 512.

sgui_send_key_down_to_control(512, a);

rs_sgui_placeholder_show_view

Defined in <sparklet_api.h>

Version

int32_t rs_sgui_placeholder_show_view (int32_t view_holder_id, int32_t view_id);

Since 1.1

This function shows the given view ID from those inside the specified placeholder.

PARAMETERS:

view_holder_id

ID of Place holder

view_id

View ID to be shown

RETURN VALUE:

0 - Success

Example:

The code below shows the view with ID 321 from the children of 230.

rs_sgui_placeholder_show_view (230, 321);

INT16S sgui_swipebutton_set_cur_percent_by_id (INT16U u16_id, INT16S s16_percent, INT16S s16_target_percent)

Defined in <sparklet_api.h>

Version

INT16S sgui_swipebutton_set_cur_percent_by_id(void *ptr_swipe, INT16S s16_percent, INT16S s16_target_percent);

Since 3.3

This function sets the percentage value for swipebutton from its current percentage to required target percentage.

PARAMETERS:

U16_id

ID of the swipe button

s16_percent

Current percent of swipe button

s16_target_percent

Required target percent of swipe button.

RETURN VALUE:

   0 - success

Example:

The code below sets the percentage value for swipe button with ID 101 from 35 to 85.

sgui_swipebutton_set_cur_percent_by_id(101, 35, 85);

void sgui_rh850_enable_camera (void)

This function is used to enable camera screen.