Intermec CK1 Serial Dock Programmer's Reference Manual

  • Hello! I am an AI chatbot trained to assist you with the Intermec CK1 Serial Dock Programmer's Reference Manual. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
CK1 SDK
Programmer's
Reference Manual
ii CK1 SDK Programmer’s Reference Manual
Intermec Technologies Corporation
Corporate Headquarters
6001 36th Ave. W.
Everett, WA 98203
U.S.A.
www.intermec.com
The information contained herein is proprietary and is provided solely for the purpose of allowing customers
to operate and service Intermec-manufactured equipment and is not to be released, reproduced, or used for
any other purpose without written permission of Intermec.
Information and specifications contained in this document are subject to change without prior notice and do
not represent a commitment on the part of Intermec Technologies Corporation.
© 2004 by Intermec Technologies Corporation. All rights reserved.
The word Intermec, the Intermec logo, Norand, ArciTech, CrossBar, Data Collection Browser, dcBrowser,
Duratherm, EasyCoder, EasyLAN, Enterprise Wireless LAN, EZBuilder, Fingerprint, i-gistics, INCA (under
license), InterDriver, Intermec Printer Network Manager, IRL, JANUS, LabelShop, Mobile Framework,
MobileLAN, Nor*Ware, Pen*Key, Precision Print, PrintSet, RoutePower, TE 2000, Trakker Antares, UAP,
Universal Access Point, and Virtual Wedge are either trademarks or registered trademarks of Intermec
Technologies Corporation.
Throughout this manual, trademarked names may be used. Rather than put a trademark (™ or ®) symbol in
every occurrence of a trademarked name, we state that we are using the names only in an editorial fashion,
and to the benefit of the trademark owner, with no intention of infringement.
There are U.S. and foreign patents pending.
Contents
CK1 SDK Programmer’s Reference Manual
iii
Contents
Before You Begin.............................................................................................................xxi
Safety Summary..................................................................................................xxi
Safety Icons .......................................................................................................xxii
Global Services and Support..............................................................................xxii
Who Should Read This Document? .................................................................xxiii
Related Documents ..........................................................................................xxiii
Installing and Using the SDK................................................................................................ 1
What Is the SDK Target Wizard? .......................................................................................2
Development Process Flow ....................................................................................2
Installing the SDK Target Wizard .........................................................................2
Running the SDK Target Wizard ..........................................................................3
SDK Appearance ................................................................................................................3
Understanding the Menus .....................................................................................4
Toolbar .................................................................................................................4
Project, Classes, and Debug Tabs ..........................................................................4
Edit Region ...........................................................................................................5
Status Bar ..............................................................................................................5
Compile Result Area..............................................................................................5
Creating a New Project.......................................................................................................5
Creating a Source File............................................................................................6
Adding the Source File to the Project.....................................................................7
Editing a Project.................................................................................................................8
Opening a Project..................................................................................................8
Removing Files From a Project ..............................................................................9
Editing Files in a Project......................................................................................10
Running a Project on a PC ...............................................................................................10
Compiling a Project.............................................................................................10
Debugging a Project ............................................................................................11
Running a Project................................................................................................11
Running a Project on a CK1.............................................................................................11
Downloading to a CK1 ....................................................................................................12
Other Tools......................................................................................................................13
SDK Environment...............................................................................................13
Project Setting .....................................................................................................13
Compile Result....................................................................................................14
Icon Editor ..........................................................................................................15
Keyboard Remapping ..........................................................................................16
Terminal..............................................................................................................18
1
Contents
iv
CK1 SDK Programmer’s Reference Manual
Example Code ..................................................................................................................19
Designing the Basic UI........................................................................................19
Complete Example Code.....................................................................................20
Configuring the CK1 System .............................................................................................. 23
Introducing the CK1 ........................................................................................................24
Scanning Options for the CK1 .........................................................................................25
System APIs......................................................................................................................25
Buzzer APIs .........................................................................................................25
Changing the Default Volume by Command Line Operation ................26
Changing the Volume by /proc...............................................................27
Example Code ........................................................................................27
Reading System Volume.........................................................................31
Adjusting System Volume.......................................................................31
Setting System Volume...........................................................................32
Restoring System Volume.......................................................................32
Playing Sound ........................................................................................32
Buzzer Application APIs ......................................................................................33
Example Code ........................................................................................33
Getting Buzzer Keyclick Status ...............................................................38
Setting Buzzer Keyclick Status ................................................................38
Getting Buzzer Warning Status ..............................................................39
Setting Buzzer Warning Status................................................................39
Getting Buzzer System-Prompt Status ....................................................39
Setting Buzzer System-Prompt Status .....................................................40
Light APIs ...........................................................................................................40
Changing the Light Status by /proc ........................................................40
Example Code ........................................................................................41
Reading Light Status...............................................................................44
Setting Light...........................................................................................44
Delaying Turning On Light ...................................................................45
Delaying Turning Off Light ...................................................................45
Liquid Crystal Display APIs ................................................................................45
Changing the Default Brightness by Command Line Operation.............46
Changing the Brightness by /proc...........................................................46
Example Code ........................................................................................46
Getting LCD Status................................................................................49
Setting Brightness...................................................................................49
Adjusting Brightness...............................................................................50
Restoring Brightness...............................................................................50
Turning On the LCD.............................................................................50
Turning Off the LCD ............................................................................51
Turning On the Backlight ......................................................................51
Turning Off the Backlight......................................................................51
Advanced Power Management APIs ....................................................................51
Changing the APM Function by Command Line Operation..................52
Changing the APM Function by /proc ...................................................53
Example Codes.......................................................................................54
Enabling APM........................................................................................60
2
Contents
CK1 SDK Programmer’s Reference Manual
v
Disabling APM.......................................................................................60
Entering Normal Mode ..........................................................................60
Entering Idle Mode ................................................................................61
Entering Standby Mode..........................................................................61
Enabling Backlight Control....................................................................62
Disabling Backlight Control...................................................................63
Getting Status of Backlight Control........................................................63
Enabling EXT5V Output.......................................................................63
Disabling the EXT5V Output ................................................................63
Setting Backlight Timeout......................................................................64
Setting Idle Time....................................................................................64
Setting Standby Time .............................................................................65
Setting Main Battery Good Limit...........................................................65
Setting Main Battery Low Limit .............................................................66
Setting Main Battery Very Low Limit.....................................................66
Setting Main Battery Critical Limit ........................................................67
Setting Backup Battery Good Limit........................................................67
Setting Backup Battery Low Limit..........................................................68
Setting Backup Battery Very Low Limit .................................................68
Setting Backup Battery Critical Limit .....................................................68
Making Sure APM Is Working ...............................................................69
Getting Backlight Timeout.....................................................................69
Getting Idle Time...................................................................................70
Getting Standby Time............................................................................70
Getting Main Battery Life.......................................................................70
Getting Backup Battery Life ...................................................................71
Getting Main Battery Good Limit..........................................................71
Getting Main Battery Low Limit ............................................................71
Getting Main Battery Very Low Limit....................................................72
Getting Main Battery Critical Limit .......................................................72
Getting Backup Battery Good Limit.......................................................72
Getting Backup Battery Low Limit.........................................................73
Getting Backup Battery Very Low Limit ................................................73
Getting Backup Battery Critical Limit....................................................73
Getting AC Line Status...........................................................................74
Getting APM Status ...............................................................................74
Setting BIOS Resume Voltage ................................................................74
Getting ADC Value From the Main Battery Only Once ........................75
Getting the Main Battery Power Level....................................................75
Restoring APM Factory Default Values ..................................................75
Getting All APM Information ................................................................76
Backup File.............................................................................................76
PPP API ..............................................................................................................76
Example Code ........................................................................................77
PPP API Illustrations..............................................................................80
Writing PPP Configuration Files............................................................82
Reading PPP Configuration Files ...........................................................85
Requesting PPP Status............................................................................85
Resetting PPP .........................................................................................86
Dialing the PPP Connection ..................................................................86
RTC Alarm API ..................................................................................................87
Example Code ........................................................................................87
Enabling the Alarm Function .................................................................89
Contents
vi
CK1 SDK Programmer’s Reference Manual
Disabling the Alarm Function ................................................................89
Getting the Alarm Value.........................................................................90
Waiting for the Alarm Arrival.................................................................90
Remote Upgrade..................................................................................................91
Connecting the CK1 to a PC..................................................................91
Remote Upgrade.....................................................................................92
Remote Upgrade APIs ............................................................................98
System Configuration Setting ............................................................................103
Example Code ......................................................................................103
Getting the Current Setting of the Boot Flag........................................105
Setting a New Boot Flag .......................................................................105
Getting the Current Setting of the Vendor Name.................................105
Getting the Product Name ...................................................................105
Getting the Version of the Images on NOR Flash.................................106
Getting the Current Setting of the Vendor Serial..................................106
Getting the Current Setting of the Var Serial........................................106
Getting the Current Setting of RAMdisk Size.......................................107
Setting New RAMdisk Size...................................................................107
Scanner Support...................................................................................................................... 109
Introducing Scanner Support..........................................................................................110
General Functions ..........................................................................................................110
Opening ............................................................................................................110
Closing ..............................................................................................................110
Getting Bar Code Type Name...........................................................................110
Function Structure..........................................................................................................111
Guideline for the APIs ....................................................................................................112
Bar Code Scanning Program..............................................................................112
Scanning by Pressing Scan Button ........................................................113
Scanning Under Program Control........................................................113
Bar Code Parameter Setting Program ................................................................113
Getting the Settings ..............................................................................125
Setting the Settings ...............................................................................125
Member Functions of TPT.............................................................................................125
Enabling Trigger................................................................................................125
Disabling Trigger ..............................................................................................126
Checking Bar Code Input..................................................................................126
Reading Bar Code Data.....................................................................................126
Setting Bar Code Symbology Into Decoder Chip ..............................................126
Getting Bar Code Symbology Setting From Decoder Chip................................127
Resetting All Symbologies to Default.................................................................127
Setting Preamble String .....................................................................................127
Getting Preamble String ....................................................................................127
Setting Postamble String....................................................................................128
Getting Postamble String...................................................................................128
Setting Delimiter String.....................................................................................128
Getting Delimiter String....................................................................................128
3
Contents
CK1 SDK Programmer’s Reference Manual
vii
Stopping Scanning.............................................................................................128
Starting Scanning ..............................................................................................129
Getting Current Setting Array ...........................................................................129
Example Code ................................................................................................................130
Scanning Bar Code Labels .................................................................................130
SDK Components .................................................................................................................... 133
Introducing the October Widget Library........................................................................134
OtkApplication...............................................................................................................134
otk_app_init......................................................................................................135
otk_app_loop ....................................................................................................135
otk_app_add......................................................................................................135
otk_app_remove................................................................................................135
otk_app_redraw.................................................................................................136
otk_app_get_current_event ...............................................................................136
otk_app_set_event_timeout...............................................................................136
otk_app_unset_event_timeout...........................................................................136
otk_app_new_window ......................................................................................136
otk_app_set_window_background_color ..........................................................137
otk_app_set_window_border_size .....................................................................137
otk_app_get_gc .................................................................................................137
otk_app_get_gc_user_defined ...........................................................................138
otk_app_new_font ............................................................................................138
otk_app_get_font_default..................................................................................138
otk_app_set_font_default ..................................................................................138
otk_app_get_font_size_info...............................................................................139
otk_app_get_root_window_width.....................................................................139
otk_app_get_root_window_height....................................................................139
otk_app_exit......................................................................................................139
otk_app_set_title ...............................................................................................139
otk_app_set_showfamily ...................................................................................140
otk_app_register_fd...........................................................................................140
OtkWidget .....................................................................................................................140
otk_widget_init .................................................................................................140
otk_widget_set_visible.......................................................................................140
otk_widget_set_sensitive....................................................................................141
otk_widget_set_gc_background_color...............................................................141
otk_widget_set_gc_foreground_color................................................................141
otk_widget_set_gc_font_size .............................................................................142
otk_widget_set_gc_font.....................................................................................142
otk_widget_set_position....................................................................................142
otk_widget_set_size ...........................................................................................142
otk_widget_set_user_data..................................................................................143
otk_widget_get_user_data .................................................................................143
OtkArrowIcon................................................................................................................143
otk_arrow_icon_init..........................................................................................143
otk_arrow_icon_set_align..................................................................................143
4
Contents
viii
CK1 SDK Programmer’s Reference Manual
OtkButton......................................................................................................................144
otk_button_init.................................................................................................144
otk_button_set_label .........................................................................................144
otk_button_set_click_callback...........................................................................144
otk_button_set_user_data..................................................................................145
otk_button_get_user_data .................................................................................145
OnClick Event ..................................................................................................145
OtkCellBox ....................................................................................................................145
otk_cell_box_init...............................................................................................146
otk_cell_box_set_cells .......................................................................................146
otk_cell_box_clear_selected ...............................................................................146
otk_cell_box_get_selected_column....................................................................146
otk_cell_box_get_selected_row..........................................................................147
otk_cell_box_set_user_data ...............................................................................147
otk_cell_box_get_user_data...............................................................................147
OtkCheckButton............................................................................................................147
otk_check_button_init ......................................................................................147
otk_check_button_set_value..............................................................................148
otk_check_button_get_value .............................................................................148
otk_check_button_set_user_data.......................................................................148
otk_check_button_get_user_data ......................................................................148
OtkCombo.....................................................................................................................149
otk_combo_init.................................................................................................149
otk_combo_get_list ...........................................................................................149
otk_combo_add_list_item .................................................................................149
otk_combo_set_user_data .................................................................................149
otk_combo_get_user_data.................................................................................150
OtkControl ....................................................................................................................150
otk_control_init ................................................................................................150
otk_control_add_child ......................................................................................150
otk_control_set_border_size..............................................................................150
otk_control_show..............................................................................................151
otk_control_hide ...............................................................................................151
otk_control_set_user_data.................................................................................151
otk_control_get_user_data ................................................................................151
OtkDialog ......................................................................................................................152
otk_dialog_init ..................................................................................................152
otk_dialog_show................................................................................................152
otk_dialog_set_user_data...................................................................................152
otk_dialog_get_user_data ..................................................................................153
OtkGroup ......................................................................................................................153
otk_group_init ..................................................................................................153
otk_group_append ............................................................................................153
otk_group_remove ............................................................................................153
otk_group_set_user_data...................................................................................154
otk_group_get_user_data ..................................................................................154
Contents
CK1 SDK Programmer’s Reference Manual
ix
OtkIcon..........................................................................................................................154
otk_icon_init.....................................................................................................154
otk_icon_set_bitmap .........................................................................................154
otk_icon_set_user_data .....................................................................................155
otk_icon_get_user_data.....................................................................................155
OtkList...........................................................................................................................155
otk_list_init.......................................................................................................155
otk_list_set_scrollbar .........................................................................................156
otk_list_set_select_callback................................................................................156
otk_list_set_timeout_callback............................................................................156
otk_list_set_title_visible.....................................................................................156
otk_list_set_column_titles .................................................................................157
otk_list_set_column_title ..................................................................................157
otk_list_set_column_align.................................................................................157
otk_list_set_column_width ...............................................................................157
otk_list_new_item .............................................................................................158
otk_list_item_set_text........................................................................................158
otk_list_item_set_bitmap ..................................................................................158
otk_list_set_text_and_bitmap............................................................................159
otk_list_item_set_user_data...............................................................................159
otk_list_remove_item ........................................................................................159
otk_list_remove_row .........................................................................................160
otk_list_remove_selected ...................................................................................160
otk_list_remove_all ...........................................................................................160
otk_list_get_selected..........................................................................................160
otk_list_get_item...............................................................................................160
otk_list_set_user_data........................................................................................161
otk_list_get_user_data .......................................................................................161
OnSelect Event..................................................................................................161
OnTimeout Event .............................................................................................161
OtkPopupWindow.........................................................................................................162
otk_popup_window_init...................................................................................162
otk_popup_window_show ................................................................................162
otk_popup_window_set_user_data....................................................................162
otk_popup_window_get_user_data ...................................................................163
OtkRadioGroup .............................................................................................................163
otk_radio_group_init ........................................................................................163
otk_radio_group_append ..................................................................................163
otk_radio_group_set_grab_item........................................................................163
otk_radio_group_get_grab_item .......................................................................164
otk_radio_group_set_user_data.........................................................................164
otk_radio_group_get_user_data ........................................................................164
OtkScrollList ..................................................................................................................164
otk_scroll_list_init.............................................................................................164
otk_scroll_list_get_list.......................................................................................165
otk_scroll_list_set_user_data .............................................................................165
otk_scroll_list_get_user_data.............................................................................165
Contents
x
CK1 SDK Programmer’s Reference Manual
OtkTab ..........................................................................................................................165
otk_tab_init.......................................................................................................165
otk_tab_set_label...............................................................................................166
otk_tab_add ......................................................................................................166
otk_tab_set_user_data .......................................................................................166
otk_tab_get_user_data.......................................................................................166
OtkToggleButton ...........................................................................................................166
otk_toggle_button_init......................................................................................167
otk_toggle_button_set_value .............................................................................167
otk_toggle_button_get_value.............................................................................167
otk_toggle_button_set_user_data ......................................................................167
otk_toggle_button_get_user_data......................................................................167
OtkEditable....................................................................................................................168
otk_editable_init ...............................................................................................169
otk_editable_set_position ..................................................................................169
otk_editable_set_size .........................................................................................169
otk_editable_set_parent.....................................................................................169
otk_editable_set_prev_sibling............................................................................170
otk_editable_set_next_sibling............................................................................170
otk_editable_set_event_handler.........................................................................170
otk_editable_set_drawing_func .........................................................................170
otk_editable_set_flag .........................................................................................171
otk_editable_set.................................................................................................171
otk_editable_set_sibling.....................................................................................171
otk_editable_set_autoset....................................................................................171
otk_editable_set_modified.................................................................................172
otk_editable_set_readonly .................................................................................172
otk_editable_set_focused ...................................................................................172
otk_editable_set_maxlength...............................................................................172
otk_editable_set_textptr ....................................................................................173
otk_editable_set_popupmenu............................................................................173
otk_editable_show_popupmenu........................................................................173
otk_editable_set_buffer .....................................................................................173
otk_editable_load_from_file..............................................................................174
otk_editable_get_sel_buffer ...............................................................................174
otk_editable_get_text_buffer .............................................................................174
otk_editable_cut_to_clipboard ..........................................................................175
otk_editable_copy_to_clipboard........................................................................175
otk_editable_paste_from_clipboard...................................................................175
otk_editable_clear_selection ..............................................................................175
otk_editable_set_seltextbuf................................................................................176
otk_editable_clear..............................................................................................176
otk_editable_select_all.......................................................................................176
otk_editable_get_text_length.............................................................................176
otk_editable_insert ............................................................................................177
otk_editable_delete............................................................................................177
otk_editable_calcursor .......................................................................................177
otk_editable_next_cursorpos .............................................................................178
otk_editable_prev_cursorpos .............................................................................178
Contents
CK1 SDK Programmer’s Reference Manual
xi
OtkEntry........................................................................................................................178
otk_entry_init....................................................................................................179
otk_entry_set_visible .........................................................................................179
otk_entry_set_sensitive......................................................................................179
otk_entry_set_gc_background_color .................................................................179
otk_entry_set_gc_foreground_color ..................................................................180
otk_entry_set_position ......................................................................................180
otk_entry_set_size .............................................................................................180
otk_entry_set_parent.........................................................................................180
otk_entry_set_prev_sibling................................................................................181
otk_entry_set_next_sibling................................................................................181
otk_entry_set_event_handler .............................................................................181
otk_entry_set_drawing_func .............................................................................181
otk_entry_set_flag .............................................................................................182
otk_entry_set.....................................................................................................182
otk_entry_set_sibling.........................................................................................182
otk_entry_set_color ...........................................................................................182
otk_entry_set_autoset........................................................................................183
otk_entry_set_modified.....................................................................................183
otk_entry_set_readonly......................................................................................183
otk_entry_set_focused .......................................................................................184
otk_entry_set_maxlength...................................................................................184
otk_entry_set_buffer..........................................................................................184
otk_entry_load_from_file..................................................................................184
otk_entry_cut_to_clipboard ..............................................................................185
otk_entry_paste_from_clipboard.......................................................................185
otk_entry_clear_selection ..................................................................................185
otk_entry_set_seltextbuf ....................................................................................185
otk_entry_clear..................................................................................................186
otk_entry_select_all ...........................................................................................186
otk_entry_set_font_size.....................................................................................186
otk_entry_set_align ...........................................................................................186
otk_entry_set_restrict_length.............................................................................186
otk_entry_set_pswdmode ..................................................................................187
otk_entry_show.................................................................................................187
otk_entry_hide ..................................................................................................187
otk_entry_refresh...............................................................................................187
OnReturnPress Event ........................................................................................188
Example Code ...................................................................................................188
OtkMaskEdit..................................................................................................................188
otk_maskedit_init..............................................................................................189
otk_maskedit_set_visible ...................................................................................189
otk_maskedit_set_sensitive ................................................................................189
otk_maskedit_set_gc_background_color ...........................................................189
otk_maskedit_set_gc_foreground_color ............................................................190
otk_maskedit_set_position ................................................................................190
otk_maskedit_set_size........................................................................................190
otk_maskedit_set_parent ...................................................................................190
otk_maskedit_set_prev_sibling ..........................................................................191
otk_maskedit_set_next_sibling ..........................................................................191
otk_maskedit_set_event_handler .......................................................................191
otk_maskedit_set_drawing_func........................................................................191
Contents
xii
CK1 SDK Programmer’s Reference Manual
otk_maskedit_set_flag .......................................................................................192
otk_maskedit_set...............................................................................................192
otk_maskedit_set_sibling...................................................................................192
otk_maskedit_set_color .....................................................................................193
otk_maskedit_set_autoset ..................................................................................193
otk_maskedit_set_modified ...............................................................................193
otk_maskedit_set_readonly................................................................................193
otk_maskedit_set_focused .................................................................................194
otk_maskedit_set_maxlength.............................................................................194
otk_maskedit_set_buffer....................................................................................194
otk_maskedit_load_from_file ............................................................................194
otk_maskedit_cut_to_clipboard ........................................................................195
otk_maskedit_paste_from_clipboard .................................................................195
otk_maskedit_clear_selection.............................................................................195
otk_maskedit_set_seltextbuf ..............................................................................195
otk_maskedit_clear............................................................................................196
otk_maskedit_select_all .....................................................................................196
otk_maskedit_insert...........................................................................................196
otk_maskedit_delete ..........................................................................................196
otk_maskedit_set_font_size ...............................................................................197
otk_maskedit_show ...........................................................................................197
otk_maskedit_hide ............................................................................................197
otk_maskedit_refresh.........................................................................................197
otk_maskedit_set_mask .....................................................................................198
otk_maskedit_set_unentered_char.....................................................................198
OnReturnPress Event ........................................................................................198
Example Code ...................................................................................................198
OtkPage..........................................................................................................................199
otk_page_init.....................................................................................................199
otk_page_set_size ..............................................................................................199
otk_page_set_position .......................................................................................199
otk_page_set_range ...........................................................................................200
otk_page_set_step..............................................................................................200
otk_page_show_value_ratio...............................................................................200
otk_page_refresh................................................................................................200
otk_page_set_max .............................................................................................201
otk_page_set_min..............................................................................................201
otk_page_set_value............................................................................................201
Example Code ...................................................................................................201
OtkRange .......................................................................................................................203
otk_range_init ...................................................................................................203
otk_range_set_max............................................................................................203
otk_range_get_max ...........................................................................................203
otk_range_set_min ............................................................................................204
otk_range_get_min............................................................................................204
otk_range_set_value ..........................................................................................204
otk_range_get_value..........................................................................................204
otk_range_set_range ..........................................................................................205
otk_range_get_range..........................................................................................205
otk_range_set_change_callback .........................................................................205
OnChange Event...............................................................................................206
Contents
CK1 SDK Programmer’s Reference Manual
xiii
OtkScrollBar ..................................................................................................................206
otk_scrollbar_init ..............................................................................................206
otk_scrollbar_set_typeflag..................................................................................206
otk_scrollbar_set_size ........................................................................................207
otk_scrollbar_set_position.................................................................................207
otk_scrollbar_set_range .....................................................................................207
otk_scrollbar_set_step........................................................................................207
otk_scrollbar_refresh .........................................................................................208
otk_scrollbar_set_max .......................................................................................208
otk_scrollbar_set_min .......................................................................................208
otk_scrollbar_set_value......................................................................................208
Example Code ...................................................................................................209
OtkScrollBar2 ................................................................................................................210
otk_scrollbar2_init ............................................................................................210
otk_scrollbar2_set_typeflag................................................................................211
otk_scrollbar2_set_size ......................................................................................211
otk_scrollbar2_set_position...............................................................................211
otk_scrollbar2_set_range ...................................................................................211
otk_scrollbar2_set_step......................................................................................212
otk_scrollbar2_refresh .......................................................................................212
otk_scrollbar2_set_max .....................................................................................212
otk_scrollbar2_set_min .....................................................................................212
otk_scrollbar2_set_value....................................................................................213
Example Code ...................................................................................................213
OtkSpin..........................................................................................................................215
otk_spin_init .....................................................................................................215
otk_spin_set_typeflag ........................................................................................215
otk_spin_set_size...............................................................................................215
otk_spin_set_position........................................................................................216
otk_spin_set_range............................................................................................216
otk_spin_refresh ................................................................................................216
otk_spin_set_max..............................................................................................216
otk_spin_set_min ..............................................................................................217
otk_spin_set_value ............................................................................................217
Example Code ...................................................................................................217
OtkSlider........................................................................................................................219
otk_slider_init ...................................................................................................219
otk_slider_set_typeflag ......................................................................................219
otk_slider_set_size .............................................................................................219
otk_slider_set_position......................................................................................220
otk_slider_set_range ..........................................................................................220
otk_slider_set_step ............................................................................................220
otk_slider_refresh ..............................................................................................220
otk_slider_set_max ............................................................................................221
otk_slider_set_min ............................................................................................221
otk_slider_set_value...........................................................................................221
Example Code ...................................................................................................221
Contents
xiv
CK1 SDK Programmer’s Reference Manual
OtkSelection...................................................................................................................223
otk_selection_init ..............................................................................................223
otk_selection_set_size ........................................................................................223
otk_selection_set_position.................................................................................223
otk_selection_set_label_number ........................................................................224
otk_selection_set_label ......................................................................................224
otk_selection_set_default...................................................................................224
otk_selection_refresh .........................................................................................224
Example Code ...................................................................................................225
OtkSelection2.................................................................................................................226
otk_selection2_init ............................................................................................226
otk_selection2_set_size ......................................................................................226
otk_selection2_set_position...............................................................................227
otk_selection2_set_label_number ......................................................................227
otk_selection2_set_label ....................................................................................227
otk_selection2_set_default.................................................................................227
otk_selection2_refresh .......................................................................................228
Example Code ...................................................................................................228
OtkTabGroup ................................................................................................................229
otk_tab_group_init............................................................................................229
otk_tab_group_append......................................................................................229
otk_tab_group_set_tab_button_size ..................................................................230
otk_tab_group_set_user_data ............................................................................230
OtkCustomPopupMenu.................................................................................................230
otk_custompopupmenu_init .............................................................................230
otk_custompopupmenu_add_item....................................................................231
otk_custompopupmenu_set_owner...................................................................231
otk_custompopupmenu_set_on_popup ............................................................231
otk_custompopupmenu_get_child_item ...........................................................231
otk_custompopupmenu_show...........................................................................232
otk_custompopupmenu_hide............................................................................232
otk_custompopupmenu_hide_all ......................................................................232
otk_custompopupmenu_set_active_submenu....................................................232
otk_custompopupmenu_hide_submenu............................................................233
otk_custompopupmenu_check_visible_chain_wid ............................................233
OnPopup Event ................................................................................................233
OtkPopupMenu .............................................................................................................234
otk_popupmenu_init.........................................................................................234
otk_popupmenu_add_item ...............................................................................234
otk_popupmenu_show......................................................................................234
otk_popupmenu_hide .......................................................................................235
otk_popupmenu_set_on_popup........................................................................235
otk_popupmenu_set..........................................................................................235
otk_popupmenu_set_owner ..............................................................................235
otk_popupmenu_show_submenu......................................................................236
Example Code ...................................................................................................236
Contents
CK1 SDK Programmer’s Reference Manual
xv
OtkMenuItem ................................................................................................................238
otk_menuitem_init............................................................................................238
otk_menuitem_set_label....................................................................................238
otk_menuitem_set_enabled ...............................................................................239
otk_menuitem_set_checked...............................................................................239
otk_menuitem_set_groupid...............................................................................239
otk_menuitem_set.............................................................................................239
otk_menuitem_set_clicked_callback..................................................................240
otk_menuitem_set_height .................................................................................240
otk_menuitem_set_width ..................................................................................240
otk_menuitem_set_color ...................................................................................241
otk_menuitem_refresh.......................................................................................241
OnClick Event ..................................................................................................241
Nano-X APIs................................................................................................................................ 243
General API....................................................................................................................244
Synopsis.............................................................................................................244
GrFlush ()..........................................................................................................244
GrOpen () .........................................................................................................244
GrClose ()..........................................................................................................244
GrMainLoop ()..................................................................................................244
GrGetScreenInfo ()............................................................................................245
GrSetErrorHandler () ........................................................................................245
GrDefaultErrorHandler () .................................................................................245
Window API ..................................................................................................................245
Synopsis.............................................................................................................245
GrNewWindow () .............................................................................................246
GrNewPixmap ()...............................................................................................247
GrNewInputWindow () ....................................................................................247
GrDestroyWindow () ........................................................................................248
GrMapWindow () .............................................................................................248
GrUnmapWindow ().........................................................................................248
GrRaiseWindow () ............................................................................................248
GrLowerWindow ()...........................................................................................248
GrMoveWindow ()............................................................................................249
GrResizeWindow ()...........................................................................................249
GrReparentWindow ().......................................................................................249
GrGetWindowInfo () ........................................................................................249
GrSetWMProperties () ......................................................................................250
GrGetWMProperties () .....................................................................................250
GrSetFocus () ....................................................................................................250
GrGetFocus () ...................................................................................................250
GrSetBorderColor ()..........................................................................................250
GrSetBackgroundPixmap ()...............................................................................251
GrClearWindow () ............................................................................................251
GrCloseWindow ()............................................................................................251
GrKillWindow ()...............................................................................................252
5
Contents
xvi
CK1 SDK Programmer’s Reference Manual
Graphics API ..................................................................................................................252
Synopsis.............................................................................................................252
GrNewGC ().....................................................................................................255
GrCopyGC ()....................................................................................................255
GrGetGCInfo ()................................................................................................255
GrDestroyGC () ................................................................................................256
GrLine () ...........................................................................................................256
GrPoint ()..........................................................................................................256
GrPoints () ........................................................................................................256
GrRect () ...........................................................................................................257
GrFillRect ()......................................................................................................257
GrPoly () ...........................................................................................................258
GrFillPoly () ......................................................................................................258
GrEllipse ()........................................................................................................259
GrFillEllipse ()...................................................................................................259
GrArc ().............................................................................................................259
GrArcAngle ()....................................................................................................260
GrSetGCForeground () .....................................................................................261
GrSetGCBackground ().....................................................................................261
GrSetGCUseBackground ()...............................................................................261
GrSetGCMode () ..............................................................................................261
GrSetGCFont () ................................................................................................262
GrGetGCTextSize () .........................................................................................262
GrReadArea () ...................................................................................................262
GrArea () ...........................................................................................................263
GrCopyArea ()...................................................................................................264
GrBitmap ().......................................................................................................264
GrFreeImage () ..................................................................................................265
GrGetImageInfo () ............................................................................................265
GrDrawImageFromFile ()..................................................................................265
GrLoadImageFromFile ()...................................................................................266
GrDrawImageToFit ().......................................................................................266
GrDrawImageBits ()..........................................................................................267
GrText ()...........................................................................................................267
GrDashLine () ...................................................................................................268
GrLines ()..........................................................................................................268
GrDrawLines () .................................................................................................269
Events API......................................................................................................................269
Synopsis.............................................................................................................269
GrSelectEvents ()...............................................................................................269
GrGetNextEvent ()............................................................................................270
GrGetNextEventTimeout () ..............................................................................270
GrCheckNextEvent ()........................................................................................270
GrPeekEvent ()..................................................................................................270
Fonts API .......................................................................................................................271
Synopsis.............................................................................................................271
GrCreateFont ().................................................................................................271
GrSetFontSize ()................................................................................................272
GrSetFontRotation () ........................................................................................272
GrSetFontAttr ()................................................................................................272
Contents
CK1 SDK Programmer’s Reference Manual
xvii
GrDestroyFont () ..............................................................................................272
GrGetFontInfo () ..............................................................................................272
GrFontSetCFontSize ()......................................................................................273
Pointer API.....................................................................................................................273
Synopsis.............................................................................................................273
GrSetCursor ()...................................................................................................273
GrMoveCursor () ..............................................................................................274
GrInjectPointerEvent ().....................................................................................274
Colors API......................................................................................................................275
Synopsis.............................................................................................................275
GrGetSystemPalette () .......................................................................................275
GrSetSystemPalette () ........................................................................................275
GrFindColor ()..................................................................................................276
GrGetSysColor () ..............................................................................................276
Regions API....................................................................................................................276
Synopsis.............................................................................................................276
GrNewRegion ()................................................................................................277
GrDestroyRegion ()...........................................................................................277
GrUnionRectWithRegion ()..............................................................................277
GrUnionRegion ().............................................................................................277
GrSubtractRegion () ..........................................................................................278
GrXorRegion () .................................................................................................278
GrIntersectRegion ()..........................................................................................278
GrSetGCRegion ().............................................................................................279
GrPointInRegion () ...........................................................................................279
GrRectInRegion ().............................................................................................279
GrEmptyRegion ().............................................................................................280
GrEqualRegion () ..............................................................................................280
GrOffsetRegion ()..............................................................................................280
GrGetRegionBox () ...........................................................................................280
GrNewPolygonRegion () ...................................................................................281
Selections API.................................................................................................................281
Synopsis.............................................................................................................281
GrSetSelectionOwner ().....................................................................................281
GrGetSelectionOwner ()....................................................................................282
GrRequestClientData ().....................................................................................282
GrSendClientData () .........................................................................................283
Miscellaneous API ..........................................................................................................283
Synopsis.............................................................................................................283
GrReqShmCmds ()............................................................................................284
GrInjectKeyboardEvent () .................................................................................284
GrRegisterInput ().............................................................................................285
GrPrepareSelect ()..............................................................................................285
GrServiceSelect () ..............................................................................................285
GrBell () ............................................................................................................286
GrSetScreenSaverTimeout () .............................................................................286
GrInjectNanowmEvent ()..................................................................................286
GrInjectKeypadEvent ().....................................................................................286
Contents
xviii
CK1 SDK Programmer’s Reference Manual
GrSelectPadKeys() .............................................................................................286
GrSetTriggerEnabled() ......................................................................................287
GrGetCurrentKeyMapping().............................................................................287
GrSetKeyMapping() ..........................................................................................287
GrSetKeyboardMappingFile() ...........................................................................287
GrSetKeyboardMappingDefault() .....................................................................287
GrSetCodepage() ...............................................................................................288
GrGetCurrentCodepage()..................................................................................288
GrTranslateCodepageToName() .......................................................................288
µClinux System......................................................................................................................... 289
Introducing the µClinux System.....................................................................................290
Linux Kernel...................................................................................................................291
Booting Sequence ..............................................................................................291
General Purpose Linux Kernel Architecture.......................................................293
Processes...............................................................................................294
Reentrant Kernel ..................................................................................296
Interprocess Communication................................................................296
Threads Under Linux ...........................................................................299
Memory Management in General Purpose Linux .................................300
File Systems..........................................................................................300
Networking Interface............................................................................301
Device Drivers......................................................................................303
µClinux ..........................................................................................................................303
History of µClinux ............................................................................................304
µClinux Architecture.........................................................................................304
µClinux Libraries..................................................................................305
Source Tree ..........................................................................................306
Hardware Dependency Under the µClinux ..........................................308
µClinux Toolchains...........................................................................................308
Runtime Linker and Loader...............................................................................309
Flat File Relocations .............................................................................311
Creating the Image ............................................................................................313
Booting the Device ............................................................................................314
Root File System................................................................................................316
Serial Flash File System.........................................................................316
Kernel Block Drivers ............................................................................319
Changes in Programming Interfaces ..................................................................319
Memory Management ..........................................................................320
User Applications ..............................................................................................321
Porting Applications.............................................................................321
Future of µClinux..............................................................................................321
µClinux on the CK1.......................................................................................................322
CK1 Hardware Architecture and Memory Mapping..........................................322
CK1 Hardware Architecture.................................................................322
CK1 Memory Mapping........................................................................324
A
Contents
CK1 SDK Programmer’s Reference Manual
xix
Programs in NOR Flash ....................................................................................325
Bootloader............................................................................................327
BIOS ....................................................................................................328
Diagnostic Program..............................................................................329
Flash Writer..........................................................................................329
CK1 µClinux Toolchains ..................................................................................329
Kernel Initialization for CK1.............................................................................330
Root File System................................................................................................330
Serial Flash File System.........................................................................331
Kernel Block Drivers ............................................................................332
PPP Connection................................................................................................332
Remote Upgrade................................................................................................332
Character Fonts .................................................................................................333
Power Management on CK1 .............................................................................333
Mounted Partitions ...........................................................................................335
GUI System on the CK1 ................................................................................................335
Developing Applications Under the µClinux System......................................................336
Supported Libraries ........................................................................................................337
C Library...........................................................................................................337
Nano-X Library .................................................................................................337
GDBM Database Library ..................................................................................337
New and Update ..................................................................................337
First and Next.......................................................................................337
Fetch ....................................................................................................338
Count...................................................................................................338
Example................................................................................................338
Device Configuration Files .............................................................................................338
/etc/config .........................................................................................................338
/home/etc ..........................................................................................................340
Index...............................................................................................................................................341
I
Contents
xx
CK1 SDK Programmer’s Reference Manual
/