Intermec CK1 Programmer's Reference Manual

Manual is about: Intermec CK1: Reference Guide

Summary of CK1

  • Page 1

    Ck1 sdk programmer's reference manual.

  • Page 2

    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-m...

  • Page 3: Contents

    Contents ck1 sdk programmer’s reference manual iii contents before you begin............................................................................................................. Xxi safety summary...................................................................................................

  • Page 4

    Contents iv ck1 sdk programmer’s reference manual example code ..................................................................................................................19 designing the basic ui ........................................................................................19 comple...

  • Page 5

    Contents ck1 sdk programmer’s reference manual v disabling apm.......................................................................................60 entering normal mode ..........................................................................60 entering idle mode ..................................

  • Page 6

    Contents vi ck1 sdk programmer’s reference manual disabling the alarm function ................................................................89 getting the alarm value.........................................................................90 waiting for the alarm arrival ............................

  • Page 7

    Contents ck1 sdk programmer’s reference manual vii stopping scanning.............................................................................................128 starting scanning ..............................................................................................129 getting current set...

  • Page 8

    Contents viii ck1 sdk programmer’s reference manual otkbutton......................................................................................................................144 otk_button_init .................................................................................................144 ...

  • Page 9

    Contents ck1 sdk programmer’s reference manual ix otkicon..........................................................................................................................154 otk_icon_init.....................................................................................................154...

  • Page 10

    Contents x ck1 sdk programmer’s reference manual otktab ..........................................................................................................................165 otk_tab_init.......................................................................................................165...

  • Page 11

    Contents ck1 sdk programmer’s reference manual xi otkentry ........................................................................................................................178 otk_entry_init....................................................................................................179...

  • Page 12

    Contents xii ck1 sdk programmer’s reference manual otk_maskedit_set_flag .......................................................................................192 otk_maskedit_set ...............................................................................................192 otk_maskedit_set_sib...

  • Page 13

    Contents ck1 sdk programmer’s reference manual xiii otkscrollbar ..................................................................................................................206 otk_scrollbar_init ..............................................................................................206 ...

  • Page 14

    Contents xiv ck1 sdk programmer’s reference manual otkselection...................................................................................................................223 otk_selection_init ..............................................................................................223 o...

  • Page 15

    Contents ck1 sdk programmer’s reference manual xv otkmenuitem ................................................................................................................238 otk_menuitem_init............................................................................................238 otk_menui...

  • Page 16

    Contents xvi ck1 sdk programmer’s reference manual graphics api ..................................................................................................................252 synopsis.............................................................................................................2...

  • Page 17

    Contents ck1 sdk programmer’s reference manual xvii grdestroyfont () ..............................................................................................272 grgetfontinfo () ..............................................................................................272 grfontsetcfontsize...

  • Page 18

    Contents xviii ck1 sdk programmer’s reference manual grselectpadkeys() .............................................................................................286 grsettriggerenabled() ......................................................................................287 grgetcurrentkeymappi...

  • Page 19

    Contents ck1 sdk programmer’s reference manual xix programs in nor flash ....................................................................................325 bootloader............................................................................................327 bios ...............................

  • Page 20

    Contents xx ck1 sdk programmer’s reference manual.

  • Page 21: Before You Begin

    Before you begin ck1 sdk programmer’s reference manual xxi before you begin this section provides you with safety information, technical support information, and sources for additional product information. Safety summary your safety is extremely important. Read and follow all warnings and cautions i...

  • Page 22: Safety Icons

    Before you begin xxii ck1 sdk programmer’s reference manual safety icons this section explains how to identify and understand warnings, cautions, and notes that are in this document. A warning alerts you of an operating procedure, practice, condition, or statement that must be strictly observed to a...

  • Page 23: Related Documents

    Before you begin ck1 sdk programmer’s reference manual xxiii visit the intermec technical knowledge base (knowledge central) at http://intermec.Custhelp.Com to review technical information or to request technical support for your intermec product. Telephone support these services are available from ...

  • Page 24

    Before you begin xxiv ck1 sdk programmer’s reference manual.

  • Page 25

    Ck1 sdk programmer’s reference manual 1 installing and using the sdk this chapter explains how to install and use the software developer’s kit (sdk). This chapter covers these topics: • what is the sdk target wizard? • sdk appearance • creating a new project • editing a project • running a project o...

  • Page 26: Development Process Flow

    Chapter 1 — installing and using the sdk 2 ck1 sdk programmer’s reference manual what is the sdk target wizard? Ck1 sdk target wizard is an ide (integrated development environment). By using the sdk target wizard, you can speedily develop your application and run it to view the result under microsof...

  • Page 27: Sdk Appearance

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 3 running the sdk target wizard • select start > programs > esfia sdk wizard 2.0 > ck1 sdk. Or • double-click the ck1 sdk target wizard shortcut on your pc desktop. The main window appears. For a description, see the next...

  • Page 28: Understanding The Menus

    Chapter 1 — installing and using the sdk 4 ck1 sdk programmer’s reference manual understanding the menus the following table explains what functions are in the menus. Menu functions menu contents file there are new, open project or file, reopen, save, save as, save all, close, close all, close proje...

  • Page 29: Edit Region

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 5 edit region when you create a new source file or open a source file, the file is opened in the edit region. Status bar the status bar displays the basic information of the edit region. The information includes cursor po...

  • Page 30: Creating A Source File

    Chapter 1 — installing and using the sdk 6 ck1 sdk programmer’s reference manual 4 browse to where you want to save the project, and click save. The project name appears in the project tab. Your project is open and ready to be edited. Creating a source file when you first create a project, it is emp...

  • Page 31

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 7 to create a new source file from the project tab 1 right-click the project name in the project tab. 2 select new file. A blank source file opens in the edit region. Adding the source file to the project now that you hav...

  • Page 32: Editing A Project

    Chapter 1 — installing and using the sdk 8 ck1 sdk programmer’s reference manual to add source files into the project from the project tab 1 right-click the project name in the project tab. 2 select add to project. The open file dialog box appears. 3 select the source files and click open. The files...

  • Page 33

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 9 2 switch to the project directory you want to open, select the project file (*.Dev), and click open. The project appears in the project tab. Removing files from a project you can remove files from a project using the pr...

  • Page 34: Editing Files In A Project

    Chapter 1 — installing and using the sdk 10 ck1 sdk programmer’s reference manual editing files in a project you can edit files in a project using the file menu or using the project tab. To edit existing source files using the file menu 1 select file > open project or file and select the file. The s...

  • Page 35: Debugging A Project

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 11 if the make fails, correct the error according to the make message in the compile result area. Debugging a project if the make message in the compile result area displays warning or error messages, select debug > debug...

  • Page 36: Downloading To A Ck1

    Chapter 1 — installing and using the sdk 12 ck1 sdk programmer’s reference manual downloading to a ck1 after selecting execute > run in device and making sure the project runs correctly, you can download the executable binary file to the ck1. To download the executable binary file 1 connect the sdk ...

  • Page 37: Other Tools

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 13 other tools the sdk also provides some useful tools to configure the project and make the code developing process more convenient. The following sections describe these tools. Sdk environment you can set up the sdk env...

  • Page 38: Compile Result

    Chapter 1 — installing and using the sdk 14 ck1 sdk programmer’s reference manual project setting dialog box: on the flags tab, you can configure the flags for the project. Project setting dialog box: in the options tab, you can set the library options for the project. Compile result the functions o...

  • Page 39: Icon Editor

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 15 icon editor when you create an application to run on the ck1, the available icon images may not be appropriate for your application. The sdk provides an icon editor for you to draw icons. To create an icon 1 select too...

  • Page 40: Keyboard Remapping

    Chapter 1 — installing and using the sdk 16 ck1 sdk programmer’s reference manual note: the ck1 only supports big icons. Keyboard remapping you can remap the keys on a ck1 keyboard. To remap the keyboard 1 select tools > keyboard remapping. The ck1 keyboard remapping utility dialog box appears. 2 fa...

  • Page 41

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 17 in this example, you choose the default keyboard map file from the directory>\sdk\sdk. The default keyboard map has been loaded into the ck1 keyboard remapping utility dialog box. You can edit this keyboard map. 4 map ...

  • Page 42: Terminal

    Chapter 1 — installing and using the sdk 18 ck1 sdk programmer’s reference manual • you cannot map the same character to more than one key. 6 save the keyboard map by selecting file > save. The keyboard remapping tool generates a keyboard map file with the extension .Ckm. 7 there are two ways to use...

  • Page 43: Example Code

    Chapter 1 — installing and using the sdk ck1 sdk programmer’s reference manual 19 enter the ck1 ip address, user name, and password and click ok. The terminal dialog box logs into the ck1. To clear the terminal dialog box • click clear. All of the text in the terminal dialog box disappears. Example ...

  • Page 44: Complete Example Code

    Chapter 1 — installing and using the sdk 20 ck1 sdk programmer’s reference manual 4 set the basic properties of this window. The properties include the window style, frame width, and processing method. Props.Flags = gr_wm_flags_props; props.Props = gr_wm_props_noraise; grsetwmproperties(win, &props)...

  • Page 46

    Chapter 1 — installing and using the sdk 22 ck1 sdk programmer’s reference manual.

  • Page 47: Configuring The Ck1 System

    Ck1 sdk programmer’s reference manual 23 configuring the ck1 system this chapter provides an overview of the ck1 and its system and explains how to use the sdk functions to configure the ck1. This chapter covers these topics: • introducing the ck1 • scanning options for the ck1 • system apis 2.

  • Page 48: Introducing The Ck1

    Chapter 2 — configuring the ck1 system 24 ck1 sdk programmer’s reference manual introducing the ck1 the ck1 handheld computer is a programmable data collection computer that runs custom or preloaded applications. The computer has a flash drive to store applications and files. The ck1 is designed to ...

  • Page 49: Scanning Options For The Ck1

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 25 scanning options for the ck1 option description laser scanner integrated standard-range laser scanner (650nm) with a scan rate of 39 scans per second linear imager integrated linear imager with a scan rate of 200 scans p...

  • Page 50

    Chapter 2 — configuring the ck1 system 26 ck1 sdk programmer’s reference manual adjusting the system volume of the buzzer the system volume of the buzzer is the base magnitude of the volume of the ck1. When you play a sound by calling the devbuzzerplaysound() function, the actual magnitude of the vo...

  • Page 51

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 27 if you want to change the default volume (for example 70) by hand, log into the ck1 and type these commands: #echo “70” > /etc/config/default_buzzer #sh /etc/config/es_set_config.Sh changing the volume by /proc another w...

  • Page 52

    Chapter 2 — configuring the ck1 system 28 ck1 sdk programmer’s reference manual "d+", "f+", "g+", "a+"} ; //char chr_freq[num_cnt] = {'c', 'd', 'e', 'f', 'g', 'a', 'b', '1', '2', '3', '4', '5'} ; char chr_freq[num_cnt] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '='} ; int num_freq[num...

  • Page 53

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 29 printf("\t q or q -> quit"); printf("\tyour option:"); } int play_buzzer2(char * musiccode) { int i ; printf("\t==== easter play mode 1 ========================"); printf("\tplaying string: {%s}", musiccode); for(i...

  • Page 54

    Chapter 2 — configuring the ck1 system 30 ck1 sdk programmer’s reference manual buzzer_config.Length = 32 / len_bias ; buzzer_config.Volume = 30 + vol_bias ; devbuzzerplaysound((buzzer_config.Freq), (buzzer_config.Length), (buzzer_config.Volume) ); frq_bias = 1.0 ; len_bias = 1.0 ; } return (buzzer_...

  • Page 55

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 31 ///////////////// for easter mode ////////////////// case 't': printf("\t'1'(do), '2'(re), '3'(mi), '4'(fa), '5'(sol), '6'(la), '7'(si)"); printf("\t'8'(c+), '9'(d+), '0'(f+), '-'(g+), '='(a+)"); printf("\tplease ent...

  • Page 56

    Chapter 2 — configuring the ck1 system 32 ck1 sdk programmer’s reference manual setting system volume purpose: set the system volume with the specified value. This value is the default value after you cold boot the ck1. Syntax: int devbuzzersetsystemvolume(int newvolume) on-ck1 parameters: newvolume...

  • Page 57: Buzzer Application Apis

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 33 volume no action on-host return: always return 0 buzzer application apis the buzzer apis provide the basic low level driver access application interfaces. The buzzer application apis add more features to use the buzzer o...

  • Page 58

    Chapter 2 — configuring the ck1 system 34 ck1 sdk programmer’s reference manual #include #include #define buzappitemnum 3 //#define buz_app_test_debug 1 int buzzerappdumpmsg = 1; //////////////////////////////////////////////////////////////////////////// //delay = 1000 about 1 sec static void delay...

  • Page 59

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 35 envbuzzersetkeyclick(buzzerkeyclickon); getvalue = envbuzzergetkeyclick(); if(buzzerappdumpmsg == 1) printf("\tcurrent buzzer key_click status = %d", getvalue); if(getvalue != buzzerkeyclickon) printf("error!! Set buzz...

  • Page 60

    Chapter 2 — configuring the ck1 system 36 ck1 sdk programmer’s reference manual if(buzzerappdumpmsg == 1) printf("\tcurrent buzzzer warning status = %d", getvalue); if(getvalue != buzzerwarningoff) printf("error!! Set buzzer warning failed"); //recover buzzer warning original status if(buzzerapp...

  • Page 61

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 37 static void selectopt(char chi) { switch(chi) { case '1': buzzerkeyclick(); break; case '2': buzzerwarning(); break; case '3': buzzersystemprompt(); break; default: break; } } int main(int argc, char *argv[]) { int i, j,...

  • Page 62

    Chapter 2 — configuring the ck1 system 38 ck1 sdk programmer’s reference manual } for(i=0; ii++) { printf("\t***** buzzer app test %d times *****",i+1); for(j = 1; j chi = '0' + j; #ifdef buz_app_test_debug printf("chi = %c",chi); #endif selectopt(chi); } } }else{ printmsg(filename); return; } p...

  • Page 63

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 39 getting buzzer warning status purpose: get the current alarm status. Syntax: int envbuzzergetwarning(void) on-ck1 parameters: none on-ck1 return: buzzerwarningoff current warning status is off buzzerwarningon current war...

  • Page 64: Light Apis

    Chapter 2 — configuring the ck1 system 40 ck1 sdk programmer’s reference manual setting buzzer system-prompt status purpose: set the system-prompt status with the specified value. Syntax: int envbuzzersetsystemprompt (int iswitch) on-ck1 parameters: iswitch the value to use as the new system-prompt ...

  • Page 65

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 41 1 turn on the light 2 turn on the light and turn off after z seconds 3 turn off the light and turn on after z seconds z indicates the number of seconds to wait when you set y to either 2 or 3 example code ///////////////...

  • Page 66

    Chapter 2 — configuring the ck1 system 42 ck1 sdk programmer’s reference manual #define ledrtest_debug 1 #define led_num 3 #define menuitems_num 11 #define r_led (0) #define g_led (1) #define b_led (2) enum {off, on}; char* readstatus[2] = { "-", "+" } ; char* identledstr[led_num][2] = { { "red", "r...

  • Page 67

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 43 case '1': returncode = devledsetstatus(r_led, on); break; case '2': returncode = devledsetstatus(r_led, off); break; case '3': returncode = devledsetstatus(g_led, on); break; case '4': returncode = devledsetstatus(g_led,...

  • Page 68

    Chapter 2 — configuring the ck1 system 44 ck1 sdk programmer’s reference manual int main(int argc,char *argv[]) { char chi ; int i; //functional test printmenu(); while(((chi = getchar()) != 'q') && (chi != 'q') ) { if (chi == 10) continue ; selopt(chi); printmenu(); } return 0; } reading light stat...

  • Page 69: Liquid Crystal Display Apis

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 45 delaying turning on light purpose: the specified light is turned off immediately after the program calls this function and turns on after the specified seconds. All effects set by devleddelayon() and devleddelayoff() bef...

  • Page 70

    Chapter 2 — configuring the ck1 system 46 ck1 sdk programmer’s reference manual there are function calls to let you control the brightness of the ck1 display. After devlcdadjustbrightness() is called once or many times, you can call devlcdrestorebrightness(). The brightness of the display ck1 goes b...

  • Page 71

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 47 * how to use this program * ----------------------- * according to the "lcd brightness functional test menu" which appears when * user run this program. * *****************************************************************...

  • Page 72

    (strncmp(argv[1],"--help",6)==0)) ) { printf("*** lcdbias functional...

  • Page 73

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 49 case 's': delay(delaytime); devlcdgetstatus(&lcdinfo); printf(""); printf("\tpower = %s", readstatus[lcdinfo.Power]); printf("\tbacklight = %s", readstatus[lcdinfo.Backlight]); printf("\tbrightness = %d", lcdinfo...

  • Page 74

    Chapter 2 — configuring the ck1 system 50 ck1 sdk programmer’s reference manual setting brightness (continued) on-ck1 parameters: setvalue the new brightness value (0-100). On-ck1 return: -1 function failed 0 function succeeded on-host parameters: none on-host return: always return 0 adjusting brigh...

  • Page 75

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 51 turning off the lcd purpose: turn off the specified lcd/lcm device. Syntax: int devlcdturnoffpower(void) on-ck1 return: -1 function failed 0 function succeeded on-host parameters: none on-host return: always return 0 tur...

  • Page 76

    Chapter 2 — configuring the ck1 system 52 ck1 sdk programmer’s reference manual power management modes mode description normal cpu operates at full speed. All peripherals are enabled. Idle cpu operates at 10mhz; turns off unnecessary peripherals but leaves the lcd and keypad still. The ck1 returns t...

  • Page 77

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 53 • default_apm_mbatgood, default_apm_mbatlow, • default_apm_mbatverylow, default_apm_mbatcritical all the devapmset*() and devapmget*() functions get or change the value from or to the relative file in /etc/config/, and t...

  • Page 78

    Chapter 2 — configuring the ck1 system 54 ck1 sdk programmer’s reference manual example codes this section contains the following sample code: • sdk/examples/drv_api/apm_test/apmapi_test.C • sdk/examples/drv_api/apm_test/sigtest.C sdk/examples/drv_api/apm_test/apmapi_test.C /************************...

  • Page 79

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 55 char dest[256]; if( signal(sigusr1, sig_usr1_hdr) == sig_err ) return -1; printf(" auto=\t%d", devapmisauto()); printf(" el off sec=\t%d", devapmgetbacklightofftime()); printf(" idle sec=\t%d", devapmgetidletime())...

  • Page 80

    Chapter 2 — configuring the ck1 system 56 ck1 sdk programmer’s reference manual sleep(2); printf("done."); printf("does apm enable? %s", (devapmisauto() ? "yes" : "no") ); printf("set backlight on? (y/n)"); ans = getc(stdin); if( ans == 'y'){ devapmbacklightenable(); } printf("set backlight off?...

  • Page 81

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 57 printf("set main battery very low limit(%%) ? (y/n)"); do{ ans = getc(stdin); }while((ans != 'y')&&(ans != 'n')); if( ans == 'y'){ printf("insert value: "); scanf("%d", &valuesetting); devapmsetmainbatteryverylow(valuese...

  • Page 82

    Chapter 2 — configuring the ck1 system 58 ck1 sdk programmer’s reference manual scanf("%d", &valuesetting); devapmsetbackupbatterylow(valuesetting); } printf("set backup battery good limit(%%) ? (y/n)"); do{ ans = getc(stdin); }while((ans != 'y')&&(ans != 'n')); if( ans == 'y'){ printf("insert value...

  • Page 83

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 59 * behavior of this sample code * ---------------------------- * when apm tried to enter slow/suspend mode, it will send a signal (sigusr1) * to all user space applications. We demonstrate how the user space * application...

  • Page 84

    Chapter 2 — configuring the ck1 system 60 ck1 sdk programmer’s reference manual enabling apm purpose: enable the apm. If you use the devapmmanual() to disable the apm control by kernel, you can use this function to resume the apm to work. After enabling the apm, the ck1 automatically enters idle/sta...

  • Page 85

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 61 entering idle mode purpose: force the system into idle mode whether the apm is enabled or not. In idle mode, the mpu clock frequency is 10 mhz, and the system returns to normal mode when you press the keypad. When the sy...

  • Page 86

    Chapter 2 — configuring the ck1 system 62 ck1 sdk programmer’s reference manual entering standby mode (continued) 2 wait 2 seconds. Applications should write everything to flash disk after receiving the signal. 3 flush file system cache buffers to flash disk. 4 enter standby mode. Syntax: int devapm...

  • Page 87

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 63 0 function succeeded on-host parameters: none on-host return: always return 0 disabling backlight control purpose: apm does not control the backlight. But the time to enter idle mode is backlight off time plus idle time ...

  • Page 88

    Chapter 2 — configuring the ck1 system 64 ck1 sdk programmer’s reference manual disabling the ext5v output (continued) on-ck1 parameters: none on-ck1 return: -1 function failed 0 function succeeded on-host parameters: no action on-host return: 0 setting backlight timeout purpose: set the time for th...

  • Page 89

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 65 on-ck1 parameters: idlesecs the time you want to set for apm to control the system into idle mode after backlight off (limit: 0 to 3600). On-ck1 return: -1 setting failed -2 value failed to save 0 function succeeded on-h...

  • Page 90

    Chapter 2 — configuring the ck1 system 66 ck1 sdk programmer’s reference manual setting main battery good limit (continued) on-ck1 parameters: goodvalue percentage of battery power for power good limit. If this value smaller than current main battery low limit value, this value is set equal the main...

  • Page 91

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 67 on-ck1 return: -1 setting failed -2 value failed to save 0 function succeeded on-host parameters: none on-host return: always return 0 setting main battery critical limit purpose: set the main battery power critical limi...

  • Page 92

    Chapter 2 — configuring the ck1 system 68 ck1 sdk programmer’s reference manual setting backup battery low limit purpose: set the backup battery power low limit. You can use this function to determine the battery power low warning value. Application can use this value to do something when battery po...

  • Page 93

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 69 critical limit must be between 5% of the very low limit and must be lower or equal to 50%. This value is the default value at the next cold boot. Syntax: int devapmsetbackupbatterycritical( int value ) on-ck1 parameters:...

  • Page 94

    Chapter 2 — configuring the ck1 system 70 ck1 sdk programmer’s reference manual getting idle time purpose: get the time for the apm to place the system into idle mode after apm turns off the backlight. The application can use this function to know the value in the system. Syntax: int devapmgetidleti...

  • Page 95

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 71 getting backup battery life purpose: get the percentage of backup battery power life. The application can use this function to know the current backup battery power by percentage. Syntax: int devapmgetbackupbatterylifepe...

  • Page 96

    Chapter 2 — configuring the ck1 system 72 ck1 sdk programmer’s reference manual getting main battery very low limit purpose: get the main battery power very low limit value in the system. The application can use this function to know the value in the system to determine something to do or change thi...

  • Page 97

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 73 getting backup battery low limit purpose: get the backup battery power low limit value in the system. The application can use this function to know the value in the system to determine something to do or change this valu...

  • Page 98

    Chapter 2 — configuring the ck1 system 74 ck1 sdk programmer’s reference manual getting ac line status purpose: get the ac line status. The application can use this function to know the ac line is online or offline now and determine to do something when each ac line status. Syntax: int devapmgetacli...

  • Page 99

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 75 on-host return: always return 0 getting adc value from the main battery only once purpose: get the adc value from the main battery and do not use the battery calculating algorithm. Syntax: int devapmgetoncembatteryadc ( ...

  • Page 100: Ppp Api

    Chapter 2 — configuring the ck1 system 76 ck1 sdk programmer’s reference manual getting all apm information purpose: get all the apm information by one function. Syntax: int devapmgetallinfo ( apm_info *all ) on-ck1 parameters: all stores all information about apm; references for details on-ck1 retu...

  • Page 101

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 77 to use the ppp api • include in advance. Example code /************************************************************** * program : ppp test program * author : jackie wang * history : 2003/09/17 1 st release * ************...

  • Page 102

    Chapter 2 — configuring the ck1 system 78 ck1 sdk programmer’s reference manual *pppconfig) { printf("-- ppp configuration --"); printf("connect type = %d",connecttype); printf("mute = %d",pppconfig->mute); printf("arp proxy support = %d",pppconfig->arpproxysupport); printf("use peer dns =...

  • Page 103

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 79 printpppconfig(connecttype, &pppconfig); break; case '3' : if (resetpppconnection()) printf("fail reset ppp connection"); else printf("success reset ppp connection"); break; case '4' : if (requestpppstatus() != ppp_s...

  • Page 104

    Chapter 2 — configuring the ck1 system 80 ck1 sdk programmer’s reference manual break; } getchar(); //clear stdin buffer } exit (0); } ppp api illustrations there are four ppp configuration files for each ppp connect type: • ppp server over modem • ppp client over modem • ppp server over null modem ...

  • Page 105

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 81 if a client mode is configured, the ppp connection is in a client mode and does nothing until a dialpppconnection( ) is called. Guide to dialing to a peer at any status, you can call resetpppconnection( ) to disconnect o...

  • Page 106

    Chapter 2 — configuring the ck1 system 82 ck1 sdk programmer’s reference manual writing ppp configuration files purpose: writepppconfig( ) writes ppp configuration files belonging to each connection type. Writepppcurrenttype( ) modifies the active connection type, and the changes are active after re...

  • Page 107

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 83 “prefixnumber,phonenumber” for pppphonenumber 11.Pppconfig.Ttynumber : tty number we connect to modem. = 2 : we always use ttys2 for ck1 model. 12.Pppconfig.Baudrate : uart baud rate at bit per second. This value should ...

  • Page 108

    Chapter 2 — configuring the ck1 system 84 ck1 sdk programmer’s reference manual int connecttimeout=60; this should cause ppp client to stop connecting attempts after connect timeout. Mode 3 int connecttype = 3; indicates that we are in mode 3,device acts as ppp server over null modem int mute = 0; t...

  • Page 109

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 85 reading ppp configuration files purpose: readpppconfig( ) reads the ppp configuration files belonging to each connection type. Readpppcurrenttype( ) reads active connect type which is set by writepppcurrenttype( ). Synta...

  • Page 110

    Chapter 2 — configuring the ck1 system 86 ck1 sdk programmer’s reference manual requesting ppp status (continued) ppp_state_server_connected the ppp server is on and the connection is on. Ppp_state_client_notstart the ppp is configured as a ppp client. This stage is ready for a dial attempt. The con...

  • Page 111: Rtc Alarm Api

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 87 rtc alarm api the following section explains the system rtc alarm function. To use these apis • include header file eslib_rtc.H in your source code first. #include note: if you want to use the alarm function to wake up t...

  • Page 112

    Chapter 2 — configuring the ck1 system 88 ck1 sdk programmer’s reference manual * * 2. Use type "ctrl-c" in sdk's terminal to terminate this program * when this program running. * * ---------------- * programming note * ---------------- * 1. If you want to use alarm to wake up system in suspend mode...

  • Page 113

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 89 break; }while( (count if( devrtcalarmdisable() == -1 ){ fprintf(stderr, "disable alarm error !"); return -1; } return 0; } enabling the alarm function purpose: set the alarm time and start the alarm function in the use...

  • Page 114

    Chapter 2 — configuring the ck1 system 90 ck1 sdk programmer’s reference manual getting the alarm value purpose: get the alarm time set in the system. This function lets the application change the alarm time. Syntax: int devrtcalarmvalueget( int *a_hour, int *a_min, int *a_sec ) on-ck1 parameters: a...

  • Page 115: Remote Upgrade

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 91 remote upgrade this section contains: • an introduction to two kinds of connection between the pc and the ck1. • an explanation on how to configure the connections with a remote upgrade demonstration. • two sample test c...

  • Page 116

    Chapter 2 — configuring the ck1 system 92 ck1 sdk programmer’s reference manual remote upgrade this section explains how to configure and perform a remote upgrade. Configuring for remote upgrade 1 on the ck1, configure ppp over null modem server and telnet server. For help, see the ck1 handheld comp...

  • Page 117

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 93 ck1 partitions partition description kernel compressed kernel image rootfs root file system cramfs image usrlocal /usr/local directory upgrading the ck1 1 decide which partition to upgrade. Using the kernel partition as ...

  • Page 118

    Chapter 2 — configuring the ck1 system 94 ck1 sdk programmer’s reference manual default setting configuration files the factory default setting file is: /etc/default/default_ru_xxxxxx (read only) the current setting file is: /etc/config/default_ru_xxxxxx (read/write) you can call the apis to change ...

  • Page 119

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 95 * ---------------------------- * behavior of this sample code * ---------------------------- * input parameters: * $1: partition/image name (kernel/rootfs/usrlocal) * $2: vendor name * $3: product name * $4: version seri...

  • Page 120

    Chapter 2 — configuring the ck1 system 96 ck1 sdk programmer’s reference manual version = (char *) rugetversion(argv[1]); if(strncmp(argv[2], vendor, strlen(vendor)-1) != 0) { printf("vendor check error %s, %s", argv[2], vendor); return 1; } if(strncmp(argv[3], product, strlen(product)-1) != 0) { ...

  • Page 121

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 97 rusetloginname(“upgrade”); rusetpassword(“getimage”); rusetdefaultpath(“/images/031008”); rusetimagename(“kernel”, “zimage.031008”); return 0; } sdk/examples/app_api/remote_upgrade_test/get_image.C /*********************...

  • Page 122

    Chapter 2 — configuring the ck1 system 98 ck1 sdk programmer’s reference manual return 0; } if (strcmp(argv[1], product) != 0) { printf(“product isn’t same, failed!”); return 0; } if (strcmp(argv[2], version) printf(“version isn’t newer than image on pc’s ftp server, failed”); return 0; } result...

  • Page 123

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 99 getting host ip address purpose: get the host ip address of the remote upgrade host. Syntax: char *rugethostip(void) on-ck1 parameters: none on-ck1 return: host ip address of the remote upgrade host in the configuration ...

  • Page 124

    Chapter 2 — configuring the ck1 system 100 ck1 sdk programmer’s reference manual setting the default login name (continued) on-ck1 parameters: logname value to use as the user login name of the remote upgrade host on-ck1 return: -1 set failed 0 set succeeded config file: /etc/config/default_ru_name ...

  • Page 125

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 101 on-ck1 return: login path of the remote upgrade host in the configuration file config file: /etc/config/default_ru_path on-host parameters: none on-host return: always return null setting the default path purpose: set t...

  • Page 126

    Chapter 2 — configuring the ck1 system 102 ck1 sdk programmer’s reference manual setting the image name (continued) on-host parameters: specpart no action imagename no action on-host return: always return -1 getting the vendor information of the image file purpose: get the vendor information of this...

  • Page 127: System Configuration Setting

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 103 upgrading purpose: remote upgrade with assigned specified partition. Syntax: int ruupgrade(char *specpart) on-ck1 parameters: specpart {kernel, rootfs, usrlocal} on-ck1 return: -1 upgrade failed 0 upgrade succeeded on-h...

  • Page 128

    Chapter 2 — configuring the ck1 system 104 ck1 sdk programmer’s reference manual printf("error write boot flag"); else printf("success write boot flag"); if (readbootflag(flag)) printf("error read boot flag"); else printf("bootflag = %s",flag); if (readvendorname(flag)) printf("error read ve...

  • Page 129

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 105 getting the current setting of the boot flag purpose: get the current setting of the boot flag. Bootflag is less than 16 bytes. Syntax: int readbootflag(char *bootflag) the boot flag is passed to the caller by bootflag....

  • Page 130

    Chapter 2 — configuring the ck1 system 106 ck1 sdk programmer’s reference manual getting the version of the images on nor flash purpose: get the version of the images. There are four images on nor flash: bootloader, writer, bios, and diagnostic. The version has to be eight characters. This function ...

  • Page 131

    Chapter 2 — configuring the ck1 system ck1 sdk programmer’s reference manual 107 getting the current setting of ramdisk size purpose: get the current setting of the ramdisk. Syntax: int ramdiskgetsize(void) on-ck1 return: -1 function failed other value disk size in kb on-host return: always return 1...

  • Page 132

    Chapter 2 — configuring the ck1 system 108 ck1 sdk programmer’s reference manual.

  • Page 133: Scanner Support

    Ck1 sdk programmer’s reference manual 109 scanner support this chapter provides apis for managing and configuring the ck1 scanner and bar code symbologies. This chapter covers these topics: • introducing scanner support • general functions • function structure • guidelines for the apis • member func...

  • Page 134: Introducing Scanner Support

    Chapter 3 — scanner support 110 ck1 sdk programmer’s reference manual introducing scanner support the system links the bar code scanner by the hamster chip. Call the function scopen() to start linking before using scanner function and call the function scclose() to stop linking after using the scann...

  • Page 135: Function Structure

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 111 syntax: char *getbar codetypename(int type); char *getbar codeshorttypename(int type); parameter: type type number that the control program shows to the application return values: a string point to the type name of the number note...

  • Page 136: Guideline For The Apis

    Chapter 3 — scanner support 112 ck1 sdk programmer’s reference manual tpt functions (continued) function name tpt_scanner tpt_scankey description settodefault exist exist set the setting to default setpreamble dummy exist set pre-sent characters getpreamble dummy exist get pre-sent characters setpos...

  • Page 137

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 113 bar code type number returned from the hamster chip (continued) bar code type bar code type number upc e 5 i 2 of 5 6 codabar 7 code 128 8 code 93 9 s25 10 msi 11 ean 128 12 code 32 13 delta 14 label 15 plessey 16 code 11 17 toshi...

  • Page 138

    Chapter 3 — scanner support 114 ck1 sdk programmer’s reference manual bar code setting type code for hamster chip bar code type command code number set 0x39 enable 0x3a standard 0x3b check digit 0x3c send start/stop 0x3d minimum length 0x3e code 39 maximum length 0x3f set 0x40 enable 0x41 fix length...

  • Page 139

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 115 bar code setting type code for hamster chip (continued) bar code type command code number enable 0x58 minimum length 0x59 code 128 maximum length 0x5a set 0x5b enable 0x5c send check digit 0x5d check digit mode 0x5e minimum length...

  • Page 140

    Chapter 3 — scanner support 116 ck1 sdk programmer’s reference manual bar code setting type code for hamster chip (continued) bar code type command code number set 0x78 enable 0x79 send leading digit 0x7a send check digit 0x7b zero expansion 0x7c upc e nsc 0x7d set 0x7e enable 0x7f send leading digi...

  • Page 141

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 117 code 39 hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 full code 39 bit1 = 1 standard code 39 bit2&3 = 0 calculate and send check digit bit2&3 = 1 calculate and do not send check dig...

  • Page 142

    Chapter 3 — scanner support 118 ck1 sdk programmer’s reference manual interleaved 2 of 5 hamster setting status (continued) parameters type status action 0 enable fix length i 2 of 5 fix length 0x42 1 disable fix length 0 calculate and send check digit 1 calculate and do not send check digit i 2 of ...

  • Page 143

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 119 code 32 hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 send leading character bit1 = 1 do not send leading character bit2 = 0 send trailing character code 32 all settings 0x4d bit2 =...

  • Page 144

    Chapter 3 — scanner support 120 ck1 sdk programmer’s reference manual code 128 hamster setting status parameters type status action 0 disable code 128 0x58 1 enable code 128 minimum length 0x59 0 ∼ 64 default = 1 code 128 maximum length 0x5a 0 ∼64 default = 64 msi/plessey hamster setting status para...

  • Page 145

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 121 code 11 hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 one check digit bit1 = 1 two check digits bit2 = 0 send check digits code 11 all settings 0x64 bit2 = 1 do not send check digit...

  • Page 146

    Chapter 3 — scanner support 122 ck1 sdk programmer’s reference manual codabar hamster setting status (continued) parameters type status action codabar minimum length 0x6f 3 ∼ 48 default = 3 codabar maximum 0x70 3 ∼ 48 default = 48 label code hamster setting status parameters type status action bit0 ...

  • Page 147

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 123 upc e hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 send leading digit bit1 = 1 do not send leading digit bit2 = 0 send check digit bit2 = 1 do not send check digit bit3 = 0 zero ex...

  • Page 148

    Chapter 3 — scanner support 124 ck1 sdk programmer’s reference manual ean 13 hamster setting status (continued) parameters type status action 0 enable ean 13 bookland 0x82 1 disable ean 8 hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 send leading digi...

  • Page 149: Member Functions Of Tpt

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 125 delta code hamster setting status parameters type status action bit0 = 0 disable bit0 = 1 enable bit1 = 0 calculate check digit bit1 = 1 do not calculate check digit bit2 = 0 send check digit delta code all settings 0x8c bit2 = 1 ...

  • Page 150: Disabling Trigger

    Chapter 3 — scanner support 126 ck1 sdk programmer’s reference manual disabling trigger purpose: disable the trigger key. Syntax: void disablebarcode(); return value: none checking bar code input purpose: check if there is a bar code read from the decoder chip. This function is only called in tpt_sc...

  • Page 151: Setting Preamble String

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 127 getting bar code symbology setting from decoder chip purpose: get an individual bar code symbology from the bar code chip. Syntax: sc_bool getbar codepara(char type, int *status); parameters: type bar code type. For help, see the ...

  • Page 152: Setting Postamble String

    Chapter 3 — scanner support 128 ck1 sdk programmer’s reference manual setting postamble string purpose: send a postamble string to the keyboard buffer after the scanner data. The default postamble string is null, and its maximum length is 48 characters. Use this function with tpt_scankey. Syntax: in...

  • Page 153: Starting Scanning

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 129 return values: > or = 0 successfully stopped scanning failed to stop scanning starting scanning purpose: immediately start scanning. Syntax: int startscan(); return values: > or = 0 start to scan successfully fail to set to start ...

  • Page 154: Example Code

    Chapter 3 — scanner support 130 ck1 sdk programmer’s reference manual example code this section provides example code for scanning bar code labels. Scanning bar code labels the program uses tfmbarcodereadercreate to create the graphic interface. The main function starts the connection to the hamster...

  • Page 155

    Chapter 3 — scanner support ck1 sdk programmer’s reference manual 131 static otk_bool grab_event(otkwidget* widget, otk_event* event) { if (event->type == otk_event_type_key_up) { switch(event->keystroke.Ch) { case mwkey_escape: if (hamster_handle > 0) { tpt_scanner.Disablebarcode(); scclose(); } gr...

  • Page 156

    Chapter 3 — scanner support 132 ck1 sdk programmer’s reference manual } tfmbarcodereadercreate(&fmbarcodereader); otk_control_show(&fmbarcodereader.Cntlmain); prev_handler = fmmain->eventhandler; fmmain->eventhandler = grab_event; if (hamster_handle > 0) tpt_scanner.Enablebarcode(); otk_entry_set_fo...

  • Page 157: Sdk Components

    Ck1 sdk programmer’s reference manual 133 sdk components this chapter provides information on the october widget library for the ck1 sdk. This chapter covers these topics: • introducing the october widget library • otkapplication • otktogglebutton • otkwidget • otkeditable • otkarrowicon • otkentry ...

  • Page 158: Otkapplication

    Chapter 4 — sdk components 134 ck1 sdk programmer’s reference manual introducing the october widget library the october widget library is based on the nano-x server and its client api. It builds with an inherited-like idea. Since some cross compilers do not have the c++ compiler, the widget library ...

  • Page 159: Otk_App_Init

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 135 otk_app_init purpose: call otk_app_init before using any other otk functions in your applications. It initializes everything needed to operate the toolkit. Prototype: void otk_app_init (int screen_w, int screen_h); parameters: scre...

  • Page 160: Otk_App_Redraw

    Chapter 4 — sdk components 136 ck1 sdk programmer’s reference manual otk_app_redraw purpose: redraw the widgets that are visible on the screen. Prototype: void otk_app_redraw(); parameter: none return: none otk_app_get_current_event purpose: get the information of the event that occurred recently. P...

  • Page 161: Otk_App_Get_Gc

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 137 return: none otk_app_set_window_background_color purpose: set the background color for the window. The default background color of a window is white. Prototype: void otk_app_set_window_background_color(otk_window_id win, otk_color ...

  • Page 162: Otk_App_Get_Gc_User_Defined

    Chapter 4 — sdk components 138 ck1 sdk programmer’s reference manual otk_app_get_gc_user_defined purpose: get user-defined graphics contexts. The graphics contexts are usually reset in invoked time by demands of the widget. Prototype: otk_gc otk_app_get_gc_user_defined(int gc_mode, int font_size, ot...

  • Page 163: Otk_App_Get_Font_Size_Info

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 139 parameters: fontname string containing the name of a built in font to look for font_height desired height of the font otk_app_get_font_size_info purpose: retrieve the font size currently set on the ck1. Prototype: void otk_app_get_...

  • Page 164: Otk_App_Set_Showfamily

    Chapter 4 — sdk components 140 ck1 sdk programmer’s reference manual otk_app_set_showfamily purpose: show or hide the family set for the ime, power, and connection status. Prototype: otk_app_set_show_ime(otk_bool bshow); otk_app_set_show_power(otk_bool bshow); otk_app_set_show_link(otk_bool bshow); ...

  • Page 165: Otk_Widget_Set_Sensitive

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 141 parameters: widget pointer to the real instance visible otk_true if the widget is visible return: none otk_widget_set_sensitive purpose: set the sensitivity of this widget. Widgets that are not sensitive do not receive the event. S...

  • Page 166: Otk_Widget_Set_Gc_Font_Size

    Chapter 4 — sdk components 142 ck1 sdk programmer’s reference manual otk_widget_set_gc_font_size purpose: set the font size of the widget. The default font size is 12. Prototype: void otk_widget_set_gc_font_size (otkwidget* widget, int fontsize); parameters: widget pointer to the real instance fonts...

  • Page 167: Otk_Widget_Set_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 143 otk_widget_set_user_data purpose: set user data. Prototype: void otk_widget_set_user_data (otkwidget* widget, void* user_data); parameters: widget pointer to the real instance user_data pointer to the specified data return: none ot...

  • Page 168: Otkbutton

    Chapter 4 — sdk components 144 ck1 sdk programmer’s reference manual otkbutton you use the otkbutton widget to attach a function to what is called when the button is pressed. Otkbutton was inherited from otkwidget. The properties are: "label"(char*:read/write) the text of otkbutton. Only maintaining...

  • Page 169: Otk_Button_Set_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 145 otk_button_set_user_data purpose: set user data. Prototype: void otk_button_set_user_data (otkbutton* button, void* user_data); parameters: button pointer to the real instance user_data pointer to the specified data return: none ot...

  • Page 170: Otk_Cell_Box_Init

    Chapter 4 — sdk components 146 ck1 sdk programmer’s reference manual otk_cell_box_init purpose: initialize the instance to be an otkcellbox widget. Prototype: void otk_cell_box_init (otkcellbox* cellbox); parameter: cellbox pointer to the real instance return: none otk_cell_box_set_cells purpose: as...

  • Page 171: Otk_Cell_Box_Set_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 147 otk_cell_box_get_selected_row purpose: get the row index of the cell selected from the specified otkcellbox widget. Prototype: int otk_cell_box_get_selected_row(otkcellbox* cellbox); parameter: cellbox pointer to the real instance ...

  • Page 172: Otk_Check_Button_Set_Value

    Chapter 4 — sdk components 148 ck1 sdk programmer’s reference manual otk_check_button_set_value purpose: set the value of the check box. Prototype: void otk_check_button_set_value(otkcheckbutton* cbutton, otk_bool value); parameters: cbutton pointer to the real instance value otk_true if check box i...

  • Page 173: Otkcombo

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 149 otkcombo you use the otkcombo widget to choose from a list of valid choices. Otkcombo was inherited from otkbutton. The properties are: "user_data"(void*:read/write) otk_combo_init purpose: initialize the instance to be otkcombo. P...

  • Page 174: Otk_Combo_Get_User_Data

    Chapter 4 — sdk components 150 ck1 sdk programmer’s reference manual otk_combo_get_user_data purpose: get user data. Prototype: void* otk_combo_get_user_data (otkcombo* combo); parameters: combo pointer to the real instance return: pointer to the specified data otkcontrol a widget is inherited from ...

  • Page 175: Otk_Control_Show

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 151 parameters: contr pointer to the real instance size specified value return: none otk_control_show purpose: map the window of the specified otkcontrol widget and draw all the child widgets. The window starts to handle events hereaft...

  • Page 176: Otkdialog

    Chapter 4 — sdk components 152 ck1 sdk programmer’s reference manual otkdialog otkdialog widget provides a way to prompt you with messages or input requirements. Otkdialog was inherited from otkcontrol. Otk_dialog_init purpose: initialize the instance to be an otkdialog widget. In the meantime, a ne...

  • Page 177: Otk_Dialog_Get_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 153 otk_dialog_get_user_data purpose: get user data. Prototype: void* otk_dialog_get_user_data (otkdialog* dialog); parameter: dialog pointer to the real instance return: pointer to the specified data otkgroup a widget with a linked li...

  • Page 178: Otk_Group_Set_User_Data

    Chapter 4 — sdk components 154 ck1 sdk programmer’s reference manual otk_group_remove (continued) widget pointer to the object to be removed return: otk_true if okay otk_group_set_user_data purpose: set user data. Prototype: void otk_group_set_user_data (otkgroup* group, void* user_data); parameters...

  • Page 179: Otk_Icon_Set_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 155 parameters: icon pointer to the real instance bmp_width width of the bitmap bmp_height height of the bitmap bmp pointer to the bitmap return: none otk_icon_set_user_data purpose: set user data. Prototype: void otk_icon_set_user_dat...

  • Page 180: Otk_List_Set_Scrollbar

    Chapter 4 — sdk components 156 ck1 sdk programmer’s reference manual otk_list_set_scrollbar purpose: give the specified otkscrollbar widget to make the specified otklist widget scrollable. Prototype: void otk_list_set_scrollbar (otklist* list, otkscrollbar* scrlbar); parameters: list pointer to the ...

  • Page 181: Otk_List_Set_Column_Titles

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 157 otk_list_set_column_titles purpose: set the titles for the specified otklist widget. Prototype: void otk_list_set_column_titles (otklist* list, char* titles); parameters: list pointer to the real instance titles a string array. The...

  • Page 182: Otk_List_New_Item

    Chapter 4 — sdk components 158 ck1 sdk programmer’s reference manual otk_list_set_column_width (continued) col index to the specified column width new width value return: none otk_list_new_item purpose: call this function to create an otkitem object to use. Prototype: otkitem* otk_list_new_item (otk...

  • Page 183: Otk_List_Set_Text_And_Bitmap

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 159 otk_list_set_text_and_bitmap purpose: set the displayed text and bitmap image in the specified cell. Prototype: void otk_list_set_text_and_bitmap (otklist* list, otkitem* item, int col, char* text, otk_bitmap* bitmap, int bmp_w, in...

  • Page 184: Otk_List_Remove_Row

    Chapter 4 — sdk components 160 ck1 sdk programmer’s reference manual otk_list_remove_row purpose: remove the specified row from the otklist. Prototype: void otk_list_remove_row (otklist* list, int row); parameters: list pointer to the real instance row specified row index of the otklist return: none...

  • Page 185: Otk_List_Set_User_Data

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 161 otk_list_set_user_data purpose: set user data. Prototype: void otk_list_set_user_data (otklist* list, void* user_data); parameters: list pointer to the real instance user_data pointer to the specified data return: none otk_list_get...

  • Page 186: Otkpopupwindow

    Chapter 4 — sdk components 162 ck1 sdk programmer’s reference manual otkpopupwindow otkpopupwindow was inherited from otkcontrol. The properties are: "user_data"(void*:read/write) otk_popup_window_init purpose: initialize the instance to be an otkpopupwindow widget. In the meantime, a new window is ...

  • Page 187: Otkradiogroup

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 163 otk_popup_window_get_user_data purpose: get user data. Prototype: void* otk_popup_window_get_user_data (otkpopupwindow* popwin); parameter: popwin pointer to the real instance return: pointer to the specified data otkradiogroup otk...

  • Page 188: Otkscrolllist

    Chapter 4 — sdk components 164 ck1 sdk programmer’s reference manual otk_radio_group_get_grab_item purpose: get the choice from the otkradiogroup. Prototype: otktogglebutton* otk_radio_group_get_grab_item(otkradiogroup* radios); parameter: radios pointer to the real instance return: pointer to the c...

  • Page 189: Otk_Scroll_List_Get_List

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 165 otk_scroll_list_get_list purpose: every otkscrolllist widget has its own otklist widget. To operate the otklist functions more conveniently, use the otk_scroll_list_get_list function. Prototype: otklist* otk_scroll_list_get_list (o...

  • Page 190: Otk_Tab_Set_Label

    Chapter 4 — sdk components 166 ck1 sdk programmer’s reference manual otk_tab_set_label purpose: copy the given text to be the bookmark of the otktab widget. Prototype: void otk_tab_set_label(otktab* tab, char* label); parameters: tab pointer to the real instance label specified text return: none otk...

  • Page 191: Otk_Toggle_Button_Init

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 167 otk_toggle_button_init purpose: initialize the instance to be an otktogglebutton widget. Prototype: void otk_toggle_button_init(otktogglebutton* tbutton); parameter: tbutton pointer to the real instance return: none otk_toggle_butt...

  • Page 192: Otkeditable

    Chapter 4 — sdk components 168 ck1 sdk programmer’s reference manual otk_toggle_button_get_user_data (continued) parameter: tbutton pointer to the real instance return: pointer to the specified data otkeditable otkeditable is the base type for editable components including otkentry, otkmaskedit, otk...

  • Page 193: Otk_Editable_Init

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 169 otk_editable_init purpose: initialize the specified editable instance. Prototype: void otk_editable_init (otkeditable* oep); parameter: oep pointer of the specified editable instance return: none otk_editable_set_position purpose: ...

  • Page 194

    Chapter 4 — sdk components 170 ck1 sdk programmer’s reference manual otk_editable_set_prev_sibling purpose: set the previous sibling of the specified editable instance. Prototype: void otk_editable_set_prev_sibling (otkeditable* oep, otkwidget* prevwidget); parameters: oep pointer of the specified e...

  • Page 195: Otk_Editable_Set_Flag

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 171 otk_editable_set_flag purpose: set the flag of the specified editable instance. Prototype: void otk_editable_set_flag(otkeditable* oep, otk_flag_mask flag); parameters: oep pointer of the specified editable instance flag flag retur...

  • Page 196: Otk_Editable_Set_Modified

    Chapter 4 — sdk components 172 ck1 sdk programmer’s reference manual otk_editable_set_autoset (continued) parameters: oep pointer of the specified editable instance autoset new value of the auto set property return: none otk_editable_set_modified purpose: set the modified property of the specified e...

  • Page 197: Otk_Editable_Set_Textptr

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 173 parameters: oep pointer of the specified editable instance maxlength new value for the maximum length return: none otk_editable_set_textptr purpose: set the text property of the specified editable instance. Prototype: void otk_edit...

  • Page 198: Otk_Editable_Load_From_File

    Chapter 4 — sdk components 174 ck1 sdk programmer’s reference manual otk_editable_set_buffer (continued) parameters: oep pointer of the specified editable instance buffer pointer of the memory buffer bsize length of the text string in the memory buffer return: none otk_editable_load_from_file purpos...

  • Page 199: Otk_Editable_Clear_Selection

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 175 otk_editable_cut_to_clipboard purpose: cut the text content of the marked region to the clipboard. Prototype: int otk_editable_cut_to_clipboard (otkeditable* oep); parameter: oep pointer of the specified editable instance return: 1...

  • Page 200: Otk_Editable_Set_Seltextbuf

    Chapter 4 — sdk components 176 ck1 sdk programmer’s reference manual otk_editable_set_seltextbuf purpose: replace the text content of the marked region with a specified buffer content. Prototype: int otk_editable_set_seltextbuf (otkeditable* oep, char* buffer, int bsize, otk_bool marked); parameters...

  • Page 201: Otk_Editable_Insert

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 177 otk_editable_insert purpose: insert the specified text content at the specified cursor position in specified editable instance. Prototype: int otk_editable_insert (otkeditable* oep,char* itext, int isize, int cursor_pos); parameter...

  • Page 202: Otk_Editable_Next_Cursorpos

    Chapter 4 — sdk components 178 ck1 sdk programmer’s reference manual otk_editable_next_cursorpos purpose: calculate the next valid cursor position with a specified reference cursor position. Prototype: int otk_editable_next_cursorpos(otkeditable* oep, int ref_cur); parameters: oep pointer of the spe...

  • Page 203: Otk_Entry_Init

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 179 otk_entry_init purpose: initialize the specified entry. Prototype: void otk_entry_init (otkentry* oep); parameter: oep pointer of the specified entry instance return: none otk_entry_set_visible purpose: switch the visible state of ...

  • Page 204: Otk_Entry_Set_Position

    Chapter 4 — sdk components 180 ck1 sdk programmer’s reference manual otk_entry_set_gc_foreground_color purpose: set the foreground color of the specified entry. Prototype: void otk_entry_set_gc_foreground_color (otkentry* oep, otk_color fcolor); parameters: oep pointer of the specified entry instanc...

  • Page 205: Otk_Entry_Set_Prev_Sibling

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 181 otk_entry_set_prev_sibling purpose: set the previous sibling of the specified entry. Prototype: void otk_entry_set_prev_sibling (otkentry* oep, otkwidget* prevwidget); parameters: oep pointer of the specified entry instance prevwid...

  • Page 206: Otk_Entry_Set_Flag

    Chapter 4 — sdk components 182 ck1 sdk programmer’s reference manual otk_entry_set_flag purpose: set the flag of the specified entry. Prototype: void otk_entry_set_flag(otkentry* oep, otk_flag_mask flag); parameters: oep pointer of the specified entry instance flag flag return: none otk_entry_set pu...

  • Page 207: Otk_Entry_Set_Autoset

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 183 parameters: oep pointer of the specified entry instance fcolor new foreground color bcolor new background color return: none otk_entry_set_autoset purpose: set the auto set property of the specified entry. Prototype: void otk_entry...

  • Page 208: Otk_Entry_Set_Focused

    Chapter 4 — sdk components 184 ck1 sdk programmer’s reference manual otk_entry_set_focused purpose: set the focused property of the specified entry. Prototype: void otk_entry_set_focused (otkentry* oep, otk_bool focused); parameters: oep pointer of the specified entry instance focused new value of t...

  • Page 209: Otk_Entry_Cut_To_Clipboard

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 185 otk_entry_cut_to_clipboard purpose: cut the text content of the marked region to the clipboard. Prototype: int otk_entry_cut_to_clipboard (otkentry* oep); parameter: oep pointer of the specified entry instance return: 1 if succeede...

  • Page 210: Otk_Entry_Clear

    Chapter 4 — sdk components 186 ck1 sdk programmer’s reference manual otk_entry_clear purpose: clear all content in the text buffer of the specified entry. Prototype: int otk_entry_clear (otkentry* oep); parameter: oep pointer of the specified entry instance return: 1 if succeeded 0 if failed otk_ent...

  • Page 211: Otk_Entry_Set_Pswdmode

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 187 parameters: oep pointer of the specified entry instance restrictlength value of the restrict length return: none otk_entry_set_pswdmode purpose: set the password mode of the specified entry. Prototype: void otk_entry_set_pswdmode(o...

  • Page 212: Onreturnpress Event

    Chapter 4 — sdk components 188 ck1 sdk programmer’s reference manual onreturnpress event purpose: occur when you press enter. Prototype: void user_function(otkentry* oep); parameter: oep pointer of the specified entry that occurs at the onreturnpress event return: none example code the following exa...

  • Page 213: Otk_Maskedit_Init

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 189 otk_maskedit_init purpose: initialize the specified mask edit. Prototype: void otk_maskedit_init (otkmaskedit* oep); parameter: oep pointer of the specified mask edit instance return: none otk_maskedit_set_visible purpose: switch t...

  • Page 214: Otk_Maskedit_Set_Position

    Chapter 4 — sdk components 190 ck1 sdk programmer’s reference manual otk_maskedit_set_gc_foreground_color purpose: set the foreground color of the specified mask edit. Prototype: void otk_maskedit_set_gc_foreground_color (otkmaskedit* oep, otk_color fcolor); parameters: oep pointer of the specified ...

  • Page 215

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 191 otk_maskedit_set_prev_sibling purpose: set the previous sibling of the specified mask edit. Prototype: void otk_maskedit_set_prev_sibling (otkmaskedit* oep, otkwidget* prevwidget); parameters: oep pointer of the specified mask edit...

  • Page 216: Otk_Maskedit_Set_Flag

    Chapter 4 — sdk components 192 ck1 sdk programmer’s reference manual otk_maskedit_set_flag purpose: set the flag of the specified mask edit. Prototype: void otk_maskedit_set_flag(otkmaskedit* oep, otk_flag_mask flag); parameters: oep pointer of the specified mask edit instance flag flag return: none...

  • Page 217: Otk_Maskedit_Set_Color

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 193 otk_maskedit_set_color purpose: set the color of the specified mask edit. Prototype: void otk_maskedit_set_color(otkmaskedit* oep, otk_color fcolor, otk_color bcolor); parameters: oep pointer of the specified mask edit instance fco...

  • Page 218: Otk_Maskedit_Set_Focused

    Chapter 4 — sdk components 194 ck1 sdk programmer’s reference manual otk_maskedit_set_focused purpose: set the focused property of the specified mask edit. Prototype: void otk_maskedit_set_focused (otkmaskedit* oep, otk_bool focused); parameters: oep pointer of the specified mask edit instance focus...

  • Page 219: Otk_Maskedit_Clear_Selection

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 195 otk_maskedit_cut_to_clipboard purpose: cut the text content of the marked region to the clipboard. Prototype: int otk_maskedit_cut_to_clipboard (otkmaskedit* oep); parameter: oep pointer of the specified mask edit instance return: ...

  • Page 220: Otk_Maskedit_Clear

    Chapter 4 — sdk components 196 ck1 sdk programmer’s reference manual otk_maskedit_clear purpose: clear all content in the text buffer of the specified mask edit. Prototype: int otk_maskedit_clear (otkmaskedit* oep); parameter: oep pointer of the specified mask edit instance return: 1 if succeeded 0 ...

  • Page 221: Otk_Maskedit_Set_Font_Size

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 197 return: 1 if succeeded 0 if failed otk_maskedit_set_font_size purpose: set the font size of the specified mask edit. Prototype: void otk_maskedit_set_font_size(otkmaskedit* oep, int fontsize); parameters: oep pointer of the specifi...

  • Page 222: Otk_Maskedit_Set_Mask

    Chapter 4 — sdk components 198 ck1 sdk programmer’s reference manual otk_maskedit_set_mask purpose: set the mask of the specified mask edit. Prototype: void otk_maskedit_set_mask(otkmaskedit* oep, char* mask); parameters: oep pointer of the specified mask edit mask pointer of the buffer with mask fo...

  • Page 223: Otkpage

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 199 // set maskedit1 otk_maskedit_init (&maskedit1); otk_maskedit_set(&maskedit1,null, 50, 100,123,20); otk_maskedit_set_mask (&maskedit1, "9999/09/09"); otk_maskedit_set_buffer(&maskedit1, "2003/01/02", 10); otk_control_add_child (&co...

  • Page 224: Otk_Page_Set_Range

    Chapter 4 — sdk components 200 ck1 sdk programmer’s reference manual otk_page_set_range purpose: set the range of the page. Prototype: void otk_page_set_range (otkpage* page, int max, int min, int value); parameters: page pointer of the otkpage instance max maximum value of the page min minimum valu...

  • Page 225: Otk_Page_Set_Max

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 201 otk_page_set_max purpose: set the maximum value of the page. Prototype: void otk_page_set_max (otkpage* page, int max); parameters: page pointer of the otkpage instance max maximum value of the page return: none otk_page_set_min pu...

  • Page 226

    Chapter 4 — sdk components 202 ck1 sdk programmer’s reference manual otk_control_init (&contr1); otk_widget_set_size (otk_widget(&contr1), 160, 142); otk_widget_set_gc_background_color (otk_widget(&contr1), otk_col_white); otk_app_add(&contr1); otk_control_show(&contr1); // set page1 otk_page_init (...

  • Page 227: Otkrange

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 203 otkrange the otkrange is the base type for editable components including otkscrollbar, otkslider, otkspin, and otkpage. Do not create instances of otkrange. Use otkrange as a base class. Properties, methods, and functions of otkran...

  • Page 228: Otk_Range_Set_Min

    Chapter 4 — sdk components 204 ck1 sdk programmer’s reference manual otk_range_set_min purpose: set the minimum value of the range. Prototype: int otk_range_set_min (otkrange *range, int min); parameters: range pointer of the otkrange instance min minimum value of the range return: otk_false if fail...

  • Page 229: Otk_Range_Set_Range

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 205 otk_range_set_range purpose: set the maximum and the minimum of the range. Prototype: int otk_range_set_range (otkrange *range, int max, int min); parameters: range pointer of the otkrange instance max maximum value of the range mi...

  • Page 230: Onchange Event

    Chapter 4 — sdk components 206 ck1 sdk programmer’s reference manual onchange event purpose: check if the value of the range is changed. Prototype: otkrange* user_function(otkrange *range); parameter: range pointer of the otkrange instance return: otk_false if failed otk_true if succeeded otkscrollb...

  • Page 231: Otk_Scrollbar_Set_Size

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 207 otk_scrollbar_set_size purpose: set the size of the scrollbar. Prototype: void otk_scrollbar_set_size (otkscrollbar* scrollbar, int width, int height); parameters: scrollbar pointer of the otkscrollbar instance width width of the s...

  • Page 232: Otk_Scrollbar_Refresh

    Chapter 4 — sdk components 208 ck1 sdk programmer’s reference manual otk_scrollbar_set_step (continued) stepvalue step value of the scrollbar return: none otk_scrollbar_refresh purpose: redraw the scrollbar. After calling the setting functions and adding to the parent, this function needs to be call...

  • Page 233: Example Code

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 209 return: none example code #include #include #include "otkapplication.H" #include "otkscrollbar.H" otk_bool range_callback (otkwidget*, int, int); otk_bool togglebutton_callback (otkwidget*, int, int); otkcontrol contr1; otkscrollba...

  • Page 234: Otkscrollbar2

    Chapter 4 — sdk components 210 ck1 sdk programmer’s reference manual otk_widget_set_position(otk_widget(&enable_tog), 0, 0); otk_widget_set_gc_background_color (otk_widget(&enable_tog), otk_col_white); otk_widget_set_gc_foreground_color (otk_widget(&enable_tog), otk_col_black); otk_control_add_child...

  • Page 235: Otk_Scrollbar2_Set_Typeflag

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 211 return: none otk_scrollbar2_set_typeflag purpose: indicate the orientation of the scrollbar (vertical: 0, horizontal: 1). Prototype: void otk_scrollbar2_set_scrollbar2_typeflag (otkscrollbar2* scrollbar, int flag); parameters: scro...

  • Page 236: Otk_Scrollbar2_Set_Step

    Chapter 4 — sdk components 212 ck1 sdk programmer’s reference manual otk_scrollbar2_set_range (continued) max maximum value of the scrollbar min minimum value of the scrollbar value current value of the scrollbar return: none otk_scrollbar2_set_step purpose: set the step value of the scrollbar. Prot...

  • Page 237: Otk_Scrollbar2_Set_Value

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 213 parameters: scrollbar pointer of the otkscrollbar2 instance min minimum value of the scrollbar return: none otk_scrollbar2_set_value purpose: set the current value of the scrollbar. Prototype: void otk_scrollbar2_set_value (otkscro...

  • Page 238

    Chapter 4 — sdk components 214 ck1 sdk programmer’s reference manual // set scrollbar2 otk_scrollbar2_init (&scrollbar2); otk_scrollbar2_set_typeflag (&scrollbar2, 1); //vertical_scrollbar = 0, horizontal_scrollbar = 1 otk_scrollbar2_set_size (&scrollbar2, 150, 30); otk_scrollbar2_set_position (&scr...

  • Page 239: Otkspin

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 215 otkspin otkspin is a wrapper for a range control. Otkspin was inherited from otkwidget and otkrange. The properties are: property description “flag”(char:read) defines the orientation of the spin (vertical: 0, horizontal: 1). Otk_s...

  • Page 240: Otk_Spin_Set_Position

    Chapter 4 — sdk components 216 ck1 sdk programmer’s reference manual otk_spin_set_position purpose: set the position of the spin. Prototype: void otk_spin_set_position (otkspin* spin, int x, int y); parameters: spin pointer of the otkspin instance x x coordinate on the top left point of the spin y y...

  • Page 241: Otk_Spin_Set_Min

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 217 otk_spin_set_min purpose: set the minimum value of the spin. Prototype: void otk_spin_set_min (otkspin* spin, int min); parameters: spin pointer of the otkspin instance min minimum value of the spin return: none otk_spin_set_value ...

  • Page 242

    Chapter 4 — sdk components 218 ck1 sdk programmer’s reference manual otk_control_add_child (&contr1, otk_widget(&spin1)); otk_spin_refresh (&spin1); otk_widget_set_sensitive(otk_widget(&spin1), enable_tog.Value); otk_range_set_change_callback (otk_range(&spin1), range_callback); // set spin2 otk_spi...

  • Page 243: Otkslider

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 219 otkslider otkslider is a wrapper for a range control. Otkslider was inherited from otkwidget and otkrange. The properties are: property description “flag”(char:read) defines the orientation of the slider (vertical: 1, horizontal: 0...

  • Page 244: Otk_Slider_Set_Position

    Chapter 4 — sdk components 220 ck1 sdk programmer’s reference manual otk_slider_set_position purpose: set the position of the slider. Prototype: void otk_slider_set_position (otkslider* slider, int x, int y); parameters: slider pointer of the otkslider instance x x coordinate on the top left point o...

  • Page 245: Otk_Slider_Set_Max

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 221 return: none otk_slider_set_max purpose: set the maximum value of the slider. Prototype: void otk_slider_set_max (otkslider* slider, int max); parameters: slider pointer of the otkslider instance max maximum value of the slider ret...

  • Page 246

    Chapter 4 — sdk components 222 ck1 sdk programmer’s reference manual { otk_app_init(160, 142); otk_control_init (&contr1); otk_widget_set_size (otk_widget(&contr1), 160, 142); otk_widget_set_gc_background_color (otk_widget(&contr1), otk_col_white); otk_app_add(&contr1); otk_control_show(&contr1); //...

  • Page 247: Otkselection

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 223 return otk_true; } otk_bool togglebutton_callback (otkwidget* enable_tog_btn, int x, int y) { otktogglebutton* tp = otk_toggle_button(enable_tog_btn); otk_widget_set_sensitive(otk_widget(&slider1),tp->value); // otk_widget_set_visi...

  • Page 248: Otk_Selection_Set_Label

    Chapter 4 — sdk components 224 ck1 sdk programmer’s reference manual otk_selection_set_position (continued) x x coordinate on the top left point of the selection y y coordinate on the top left point of the selection return: none otk_selection_set_label_number purpose: set the number of the selection...

  • Page 249: Example Code

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 225 parameter: selection pointer of the otkselection instance return: none example code #include #include #include "otkapplication.H" #include "otkselection.H" otk_bool range_callback (otkwidget*, int, int); otk_bool togglebutton_callb...

  • Page 250: Otkselection2

    Chapter 4 — sdk components 226 ck1 sdk programmer’s reference manual otk_bool range_callback (otkwidget* sb, int x, int y) { otkrange* range = otk_range(sb); printf("__________range value______%d_______", range->value); return otk_true; } otk_bool togglebutton_callback (otkwidget* enable_tog_btn, ...

  • Page 251: Otk_Selection2_Set_Position

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 227 otk_selection2_set_position purpose: set the position of the selection2. Prototype: void otk_selection2_set_position (otkselection2* selection2, int x, int y); parameters: selection2 pointer of the otkselection2 instance x x coordi...

  • Page 252: Otk_Selection2_Refresh

    Chapter 4 — sdk components 228 ck1 sdk programmer’s reference manual otk_selection2_refresh purpose: redraw the selection2. After calling the setting functions and adding to the parent, this function needs to be called. Prototype: void otk_selection2_refresh (otkselection2* selection2); parameter: s...

  • Page 253: Otktabgroup

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 229 otk_control_add_child (&contr1, otk_widget(&enable_tog)); otk_toggle_button_set_value(&enable_tog, otk_false); otk_button_set_click_callback(otk_button(&enable_tog), togglebutton_callback); printf("run loop"); return otk_app_loop...

  • Page 254: Otk_Tab_Group_Set_User_Data

    Chapter 4 — sdk components 230 ck1 sdk programmer’s reference manual otk_tab_group_set_tab_button_size purpose: set the size of the tab buttons (the bookmarks) to match the specified values. Prototype: void otk_tab_group_set_tab_button_size(otktabgroup* tabgrp, int width, int height); parameters: ta...

  • Page 255: Otk_Custompopupmenu_Add_Item

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 231 otk_custompopupmenu_add_item purpose: add the specified item into the specified otkcustompopupmenu. Prototype: void otk_custompopupmenu_add_item(otkcustompopupmenu* opp, otkwidget* item); parameters: opp pointer of the otkcustompop...

  • Page 256: Otk_Custompopupmenu_Show

    Chapter 4 — sdk components 232 ck1 sdk programmer’s reference manual otk_custompopupmenu_get_child_item (continued) return: null if failed pointer of the item if succeeded otk_custompopupmenu_show purpose: show the specified otkcustompopupmenu at the specified position. Prototype: void otk_custompop...

  • Page 257: Onpopup Event

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 233 parameters: opp pointer of the specified otkcustompopupmenu instance submenu pointer of the specified otkcustompopupmenu instance that is set as opp’s active submenu return: none otk_custompopupmenu_hide_submenu purpose: hide the s...

  • Page 258: Otkpopupmenu

    Chapter 4 — sdk components 234 ck1 sdk programmer’s reference manual otkpopupmenu the otkpopupmenu is a popup menu component. It allows you to add menu items to form a popup menu. See also otkmenuitem. Otkpopupmenu was inherited from otkwidget, otkgroup, otkcontrol, otkpopupwindow, and otkcustompopu...

  • Page 259: Otk_Popupmenu_Hide

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 235 otk_popupmenu_hide purpose: hide the otkpopupmenu. Prototype: void otk_popupmenu_hide(otkpopupmenu* opp); parameter: opp pointer of the otkpopupmenu instance return: none otk_popupmenu_set_on_popup purpose: set the callback functio...

  • Page 260: Otk_Popupmenu_Show_Submenu

    Chapter 4 — sdk components 236 ck1 sdk programmer’s reference manual otk_popupmenu_show_submenu purpose: show the submenu. Prototype: void otk_popupmenu_show_submenu(otkpopupmenu* opp, otkpopupmenu* submenu, int x, int y); parameters: opp pointer of the otkpopupmenu instance submenu pointer of the s...

  • Page 261

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 237 // set popupmenu1 otk_popupmenu_init(&popupmenu1); // set menuitem otk_menuitem_init(&menuitem[0]); otk_menuitem_set(&menuitem[0], "test item",11, null,null,otk_true, &popupmenu2); otk_popupmenu_add_item (&popupmenu1, &menuitem[0])...

  • Page 262: Otkmenuitem

    Chapter 4 — sdk components 238 ck1 sdk programmer’s reference manual otkmenuitem the otkmenuitem needs to cooperate with otkpopupmenu. Otkmenuitem was inherited from otkwidget. The properties are: property description “cascade”(otk_bool:read) defines if the menu item has a submenu. “checkable”(otk_b...

  • Page 263: Otk_Menuitem_Set_Enabled

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 239 otk_menuitem_set_enabled purpose: switch the enabled state (enabled or disabled) of the specified menu item. Prototype: void otk_menuitem_set_enabled(otkmenuitem* omp, otk_bool enabled); parameters: omp pointer of the specified men...

  • Page 264: Otk_Menuitem_Set_Height

    Chapter 4 — sdk components 240 ck1 sdk programmer’s reference manual otk_menuitem_set (continued) icon pointer of the otk_bitmap instance on_clicked pointer of the function that is called when an onclick event occur cascade defines if the menu item has a submenu submenu pointer of the menu item’s su...

  • Page 265: Otk_Menuitem_Set_Color

    Chapter 4 — sdk components ck1 sdk programmer’s reference manual 241 otk_menuitem_set_color purpose: set the color of the specified menu item. Prototype: void otk_menuitem_set_color(otkmenuitem* omp, otk_color fcolor, otk_color bcolor); parameters: omp pointer of the specified menu item fcolor foreg...

  • Page 266

    Chapter 4 — sdk components 242 ck1 sdk programmer’s reference manual.

  • Page 267: Nano-X Apis

    Ck1 sdk programmer’s reference manual 243 nano-x apis this chapter provides the apis for the nano-x µclinux windows graphical user interface. This chapter covers these topics: • general api • window api • graphics api • events api • fonts api • pointer api • colors api • regions api • selections api...

  • Page 268: General Api

    Chapter 5 — nano-x apis 244 ck1 sdk programmer’s reference manual general api the name of this api is: general — synopsis void grflush (void); int gropen (void); void grclose (void); void grmainloop (gr_fncallbackevent fncb); void grgetscreeninfo (gr_screen_info *sip); gr_fncallbackevent grseterrorh...

  • Page 269: Grgetscreeninfo ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 245 grgetscreeninfo () purpose: fill in the specified gr_screen_info structure. Syntax: void grgetscreeninfo (gr_screen_info *sip); parameter: sip pointer to a gr_screen_info structure grseterrorhandler () purpose: set an error handling r...

  • Page 270: Grnewwindow ()

    Chapter 5 — nano-x apis 246 ck1 sdk programmer’s reference manual gr_coord x, gr_coord y, gr_size width, gr_size height); void grdestroywindow (gr_window_id wid); void grmapwindow (gr_window_id wid); void grunmapwindow (gr_window_id wid); void grraisewindow (gr_window_id wid); void grlowerwindow (gr...

  • Page 271: Grnewpixmap ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 247 height height of the new window bordersize width of the window border background color of the window background bordercolor color of the window border return: identification of the newly created window grnewpixmap () purpose: create a...

  • Page 272: Grdestroywindow ()

    Chapter 5 — nano-x apis 248 ck1 sdk programmer’s reference manual grdestroywindow () purpose: recursively unmap and free the data structures associated with the specified window and all of its children. Syntax: void grdestroywindow (gr_window_id wid); parameter: wid id of the window to destroy grmap...

  • Page 273: Grmovewindow ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 249 grmovewindow () purpose: move the specified window to the specified position relative to its parent window. Syntax: void grmovewindow (gr_window_id wid, gr_coord x, gr_coord y); parameters: wid identification of the window to move x x...

  • Page 274: Grsetwmproperties ()

    Chapter 5 — nano-x apis 250 ck1 sdk programmer’s reference manual grsetwmproperties () purpose: copy the provided gr_wm_properties structure into the gr_wm_properties structure of the specified window identification. Syntax: void grsetwmproperties (gr_window_id wid, gr_wm_properties *props); paramet...

  • Page 275: Grsetbackgroundpixmap ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 251 parameters: wid identification of the window to set the border color color color for the border grsetbackgroundpixmap () purpose: set the background of the specified window to the specified pixmap. The flags that specify how to draw t...

  • Page 276: Grkillwindow ()

    Chapter 5 — nano-x apis 252 ck1 sdk programmer’s reference manual grkillwindow () purpose: forcibly disconnect the client that owns this window with the specified identification number. Used to kill an application that has locked up and is not responding to close_req events. Syntax: void grkillwindo...

  • Page 277

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 253 gr_gc_id gc, gr_count count, gr_point *pointtable); void grellipse (gr_draw_id id, gr_gc_id gc, gr_coord x, gr_coord y, gr_size rx, gr_size ry); void grfillellipse (gr_draw_id id, gr_gc_id gc, gr_coord x, gr_coord y, gr_size rx, gr_si...

  • Page 278

    Chapter 5 — nano-x apis 254 ck1 sdk programmer’s reference manual void grarea (gr_draw_id id, gr_gc_id gc, gr_coord x, gr_coord y, gr_size width, gr_size height, void *pixels, int pixtype); void grcopyarea (gr_draw_id id, gr_gc_id gc, gr_coord x, gr_coord y, gr_size width, gr_size height, gr_draw_id...

  • Page 279: Grnewgc ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 255 gr_gc_id gc, gr_coord x1, gr_coord y1, gr_coord x2, gr_coord y2 int solid, int invis); void grlines (gr_draw_id id, gr_gc_id gc, gr_line *linetable, gr_count count, int solid, int invis); void grdrawlines (gr_draw_id id, gr_gc_id gc, ...

  • Page 280: Grdestroygc ()

    Chapter 5 — nano-x apis 256 ck1 sdk programmer’s reference manual grdestroygc () purpose: destroy the graphics context structure with the specified identification. Syntax: void grdestroygc (gr_gc_id gc); parameter: gc identification of the graphics context structure to destroy grline () purpose: dra...

  • Page 281: Grrect ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 257 syntax: void grpoints (gr_draw_id id, gr_gc_id gc, gr_count count, gr_point *pointtable); parameters: id identification of the drawable to draw a point on gc identification of the graphics context to use when drawing the point count n...

  • Page 282: Grpoly ()

    Chapter 5 — nano-x apis 258 ck1 sdk programmer’s reference manual grfillrect () (continued) y y coordinate of the rectangle relative to the drawable width width of the rectangle height height of the rectangle grpoly () purpose: draw an unfilled polygon on the specified drawable using the specified g...

  • Page 283: Grellipse ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 259 grellipse () purpose: draw the boundary of an ellipse at the specified position using the specified dimensions and graphics context on the specified drawable. Syntax: void grellipse (gr_draw_id id, gr_gc_id gc, gr_coord x, gr_coord y,...

  • Page 284: Grarcangle ()

    Chapter 5 — nano-x apis 260 ck1 sdk programmer’s reference manual grarc () (continued) gr_coord y, gr_size rx, gr_size ry, gr_coord ax, gr_coord ay, gr_coord bx, gr_coord by, int type); parameters: id identification of the drawable to draw the arc on gc graphics context to use when drawing the arc x...

  • Page 285: Grsetgcforeground ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 261 ry radius of the arc on the y axis angle1 angle of the start of the arc angle2 angle of the end of the arc type fill style to use when drawing the arc grsetgcforeground () purpose: change the foreground color of the specified graphics...

  • Page 286: Grsetgcfont ()

    Chapter 5 — nano-x apis 262 ck1 sdk programmer’s reference manual grsetgcmode () (continued) parameters: gc identification of the graphics context to set the drawing mode mode new drawing mode grsetgcfont () purpose: set the font to be used for text drawing in the specified graphics context to the s...

  • Page 287: Grarea ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 263 syntax: void grreadarea (gr_draw_id id, gr_coord x, gr_coord y, gr_size width, gr_size height, gr_pixelval *pixels); parameters: id identification of the drawable to read an area from x x coordinate to read the area from relative to t...

  • Page 288: Grcopyarea ()

    Chapter 5 — nano-x apis 264 ck1 sdk programmer’s reference manual grcopyarea () purpose: copy the specified area of the specified size between the specified drawables at the specified positions using the specified graphics context and rop codes. In most cases, 0 is a sensible default rop code. Synta...

  • Page 289: Grfreeimage ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 265 gc identification of the graphics context to use when drawing the bitmap x x coordinate to draw the bitmap at relative to the drawable y y coordinate to draw the bitmap at relative to the drawable width width of the bitmap height heig...

  • Page 290: Grloadimagefromfile ()

    Chapter 5 — nano-x apis 266 ck1 sdk programmer’s reference manual grdrawimagefromfile () (continued) parameters: id identification of the drawable to draw the image on gc identification of the graphics context to use when drawing the image x x coordinate to draw the image at relative to the drawable...

  • Page 291: Grdrawimagebits ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 267 gc identification of the graphics context to use when drawing the image x x coordinate to draw the image at relative to the drawable y y coordinate to draw the image at relative to the drawable width maximum image width height maximum...

  • Page 292: Grdashline ()

    Chapter 5 — nano-x apis 268 ck1 sdk programmer’s reference manual grtext () (continued) y y coordinate to draw the string at relative to the drawable str text string to draw count number of characters (not bytes) in the string flags flags specifying text encoding, alignment, etc. Grdashline () purpo...

  • Page 293: Grdrawlines ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 269 linetable lines to draw count number of lines contained in the line table solid points for each dash invis spacing for every dash; 0 for solid lines grdrawlines () purpose: draw lines using the specified graphics context on the specif...

  • Page 294: Grgetnextevent ()

    Chapter 5 — nano-x apis 270 ck1 sdk programmer’s reference manual grgetnextevent () purpose: get the next event from the event queue and places it in the specified gr_event structure. If the queue is currently empty, the ck1 sleeps until the next event arrives from the server or input is read on a f...

  • Page 295: Fonts Api

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 271 fonts api the name of this api is: fonts — synopsis gr_font_id grcreatefont (gr_char *name, gr_coord height, gr_logfont *plogfont); void grsetfontsize (gr_font_id fontid, gr_coord size); void grsetfontrotation (gr_font_id fontid, int ...

  • Page 296: Grsetfontsize ()

    Chapter 5 — nano-x apis 272 ck1 sdk programmer’s reference manual grsetfontsize () purpose: change the size of the specified font to the specified size. Syntax: void grsetfontsize (gr_font_id fontid, gr_coord size); parameters: fontid identification number of the font to change the size of size new ...

  • Page 297: Grfontsetcfontsize ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 273 syntax: void grgetfontinfo (gr_font_id font, gr_font_info *fip); parameters: font specified font fip pointer to a gr_font_info structure grfontsetcfontsize () purpose: change the double-byte font size of the specified font to the spec...

  • Page 298: Grmovecursor ()

    Chapter 5 — nano-x apis 274 ck1 sdk programmer’s reference manual grsetcursor () (continued) gr_size width, gr_size height, gr_coord hotx, gr_coord hoty, gr_color foreground, gr_color background, gr_bitmap *fbbitmap, gr_bitmap *bgbitmap); parameters: wid identification of the window to set the curso...

  • Page 299: Colors Api

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 275 mwcoord y, int button, int visible); parameters: x x coordinate of the pointer event relevant to the root window y y coordinate of the pointer event relevant to the root window button pointer button status visible whether to display t...

  • Page 300: Grfindcolor ()

    Chapter 5 — nano-x apis 276 ck1 sdk programmer’s reference manual grfindcolor () purpose: calculate the pixel value to use to display the specified color value. The color value is specified as a gr_color, which is a 32-bit true color value stored as rgbx. The pixel value size depends on the architec...

  • Page 301: Grnewregion ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 277 gr_coord y, gr_coord w, gr_coord h); gr_bool gremptyregion (gr_region_id region); gr_bool grequalregion (gr_region_id rgn1, gr_region_id rgn2); void groffsetregion (gr_region_id region, gr_size dx, gr_size dy); int grgetregionbox (gr_...

  • Page 302: Grsubtractregion ()

    Chapter 5 — nano-x apis 278 ck1 sdk programmer’s reference manual grunionregion () (continued) parameters: dst_rgn identification of the destination region src_rgn1 identification of the first source region src_rgn2 identification of the second source region grsubtractregion () purpose: subtract the...

  • Page 303: Grsetgcregion ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 279 grsetgcregion () purpose: set the clip mask of the specified graphics context to the specified region. Subsequent drawing operations using this graphics context do not draw outside the specified region. The region identification can b...

  • Page 304: Gremptyregion ()

    Chapter 5 — nano-x apis 280 ck1 sdk programmer’s reference manual gremptyregion () purpose: determine if the specified region is empty. Syntax: gr_bool gremptyregion (gr_region_id region); parameter: region identification of the region to examine return: gr_true if the region is empty gr_false if th...

  • Page 305: Grnewpolygonregion ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 281 grnewpolygonregion () purpose: create a new region structure, fills it with the region described by the specified polygon, and returns the identification used to refer to it. Syntax: gr_region_id grnewpolygonregion (int mode, gr_count...

  • Page 306: Grgetselectionowner ()

    Chapter 5 — nano-x apis 282 ck1 sdk programmer’s reference manual grsetselectionowner () (continued) the window that owns the current selection must be prepared to handle selection_lost events (received when another window takes ownership of the selection) and client_data_req events (received when a...

  • Page 307: Grsendclientdata ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 283 gr_mimetype mimetype); parameters: wid identification of the window requesting the data rid identification of the window to request the data from serial serial number of the request mimetype number of the desired mime type to request ...

  • Page 308: Grreqshmcmds ()

    Chapter 5 — nano-x apis 284 ck1 sdk programmer’s reference manual void grprepareselect (int *maxfd, void *rfdset); void grserviceselect (void *rfdset, gr_fncallbackevent fncb); void grbell (void); void grsetscreensavertimeout (gr_timeout timeout); void grinjectnanowmevent (gr_window_id wid, int type...

  • Page 309: Grregisterinput ()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 285 uch 32-bit unicode keystroke value to inject ch 8-bit ascii keystroke value to inject modif special special keys to inject content mask specifying which arguments are valid grregisterinput () purpose: register an extra file descriptor...

  • Page 310: Grbell ()

    Chapter 5 — nano-x apis 286 ck1 sdk programmer’s reference manual grbell () purpose: ask the server to ring the console bell on behalf of the client (intended for terminal applications to be able to ring the bell on the server even if they are running remotely). Syntax: void grbell (void); grsetscre...

  • Page 311: Grsettriggerenabled()

    Chapter 5 — nano-x apis ck1 sdk programmer’s reference manual 287 syntax: void grselectpadkeys (gr_window_id wid, int padbuttons); parameters: wid identification of the window to select keys padbutton pad keys to accept grsettriggerenabled() purpose: enable or disable the scan button. Syntax: void g...

  • Page 312: Grsetcodepage()

    Chapter 5 — nano-x apis 288 ck1 sdk programmer’s reference manual grsetcodepage() purpose: set the code page for displaying text. Syntax: void grsetcodepage (gr_codepage codepage); parameters: codepage codepage number refers to gr_codepage enumeration grgetcurrentcodepage() purpose: get the current ...

  • Page 313: Μclinux System

    Ck1 sdk programmer’s reference manual 289 µclinux system this appendix covers these topics: • introducing the µclinux system • linux kernel • µclinux • µclinux on the ck1 • gui system on the ck1 • developing applications under the µclinux system • supported libraries • device configuration files a.

  • Page 314: Introducing The

    Appendix a — µ clinux system 290 ck1 sdk programmer’s reference manual introducing the µclinux system this appendix is an overview of the ck1 µclinux system. The barrier between the ck1 embedded operating system and the general purpose system is becoming more blurred as embedded devices are evolving...

  • Page 315: Linux Kernel

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 291 the advantages that the general purpose linux offers can also be found from the ck1 embedded µclinux. The open nature of linux provides for quick modifications against the physical requirements, while still providing a reliable a...

  • Page 316

    Appendix a — µ clinux system 292 ck1 sdk programmer’s reference manual when the system is turned on, the processor starts to execute the instructions for getting the hardware ready for the operating system. In a personal computer these instructions look in the storage like rom, flash memory, or syst...

  • Page 317

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 293 descriptor table, saves system parameters, and detects the processor model. At the end, it jumps to init/main.C and in there the start_kernel()function, which completes the initialization of the linux kernel by calling different ...

  • Page 318

    Appendix a — µ clinux system 294 ck1 sdk programmer’s reference manual in 1991, when the linux kernel was released, the academic research was oriented to the microkernel approach of operating systems. As linus was designing the kernel structure, he noticed the advantages of the modularized approach ...

  • Page 319

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 295 away that they do not have any knowledge of the underlying physical hardware, so the kernel is responsible for giving a fair share of access to hardware resources. In order for the kernel to handle the different processes, it has...

  • Page 320

    Appendix a — µ clinux system 296 ck1 sdk programmer’s reference manual the scheduler under the linux kernel seeks for the process with the highest priority in the queue of the run state processes. The real-time processes are always executed first. This priority is ensured by giving the normal proces...

  • Page 321

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 297 area with other processes, and synchronize itself with other processes. Linux supports a number of ipc mechanisms such as pipes and signals, but it also supports many of the unix system v ipc mechanisms. A signal is a very short ...

  • Page 322

    Appendix a — µ clinux system 298 ck1 sdk programmer’s reference manual used to identify a system v ipc object. When creating an object, it remains in the system memory until it is explicitly removed. The client process willing to access to the object has to obtain the objects identifier. Each object...

  • Page 323

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 299 each of the sharing processes page table. Access to the shared memory is controlled via keys and access right checking. Once the process has access, there is no control of how the processes are using it, so to do this they can on...

  • Page 324

    Appendix a — µ clinux system 300 ck1 sdk programmer’s reference manual memory management in general purpose linux the different processes all require part of available memory from the system. Most often a computer offers some continuous space of physical ram and a separate memory management unit (mm...

  • Page 325

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 301 accessing the devices and services that the files represent is done through the system calls. The file system that you see is actually a user-level view of the physical organization of the hard drive. When interacting with these ...

  • Page 326

    Appendix a — µ clinux system 302 ck1 sdk programmer’s reference manual the ip layer, the kernel resolves the route to the host. If the packet is meant for another host, the ip layer sends it to an ethernet device and out over the physical medium. The following illustration shows the structure of the...

  • Page 327: Μclinux

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 303 tcp/ip networking communication. There are also several socket types representing the type of service that supports the connection. The possible values include stream sockets that are supported by the tcp protocol of the internet...

  • Page 328: History of

    Appendix a — µ clinux system 304 ck1 sdk programmer’s reference manual history of µclinux µclinux project was started in 1997, by a goal to derivate a version of the linux kernel 2.0 for low cost microcontrollers. It was jeff dionne, kenneth albanowski, and a group of other developers who discussed ...

  • Page 329

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 305 the directory /mm. Some other subsystems are also modified to meet the demands of a mmu-less processor. Also program loaders with position independent code have been added and a new flat binary object code format has been created...

  • Page 330

    Appendix a — µ clinux system 306 ck1 sdk programmer’s reference manual library on most platforms with mmu support. Although µclibc seems to provide a better platform, many times the older µc-libc provides a more convenient solution as it may be a little smaller and provides a more tested support for...

  • Page 331

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 307 source tree structure (continued) folder description vendors vendor specific build instructions. It includes subdirectories for all the support platforms. Images after the building process, this includes the final build binaries ...

  • Page 332: Μclinux Toolchains

    Appendix a — µ clinux system 308 ck1 sdk programmer’s reference manual hardware dependency under the µclinux as in linux, µclinux also provides support for different processors. In the regular linux kernel, the separation between hardware-dependent and hardware-independent source codes are made as c...

  • Page 333: Runtime Linker And Loader

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 309 the version of µclinux development tool is arm-elf-date toolchain, which can compile several different types of binaries. These tools provide a foundation for the development and can be obtained as a pre-build binary tool package...

  • Page 334

    Appendix a — µ clinux system 310 ck1 sdk programmer’s reference manual basically the linker and loader perform three different kinds of tasks: • program loading, by copying the program to main memory for execution. • relocating, assigning proper address for the code and data. It can be done by eithe...

  • Page 335

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 311 the µclinux elf toolchain is modified in such a way that when creating binaries, the linker ldis actually a script. The linker looks for the -elf2flt argument and if this is present it first runs the real elf link command and the...

  • Page 336

    Appendix a — µ clinux system 312 ck1 sdk programmer’s reference manual once the modified addresses has been calculated, the outcome is rather simple binary which can be fully relocated anywhere from the memory. In order to modify the code, the whole binary has to be loaded the ram memory so that new...

  • Page 337: Creating The Image

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 313 creating the image in the full µclinux distribution, the image is simply created with the make command. The command first changes the directory to the kernel directory, and then starts to build the individual components. The actu...

  • Page 338: Booting The Device

    Appendix a — µ clinux system 314 ck1 sdk programmer’s reference manual booting the device with storage cases of flash and ram, the processor is able to address directly to bits stored in them. In the simplest case, you can run µclinux kernel by placing the startup code to the flash into the processo...

  • Page 339

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 315 typically the flash partition under the µclinux holds the bootloader and some other configurations at the beginning and the rest of the flash reserved to the linux image. The following illustration shows a typical flash partition...

  • Page 340: Root File System

    Appendix a — µ clinux system 316 ck1 sdk programmer’s reference manual the location of the configuration scripts are the same as in linux. The /etc folder contains all the necessary scripts that are necessary to boot up the device. It also includes all the other general configuration files that the ...

  • Page 341

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 317 page of the file individually when storing it and decompressing it on the fly when reading it. This functionality enables random access to data. The only problem with this file system is that in order to access data it must be fi...

  • Page 342

    Appendix a — µ clinux system 318 ck1 sdk programmer’s reference manual the storing of data goes strictly linearly through the whole storage. The data can easily be appended until it reaches the end of the media. After this the data can only be written to the part that already contains this dirty spa...

  • Page 343

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 319 kernel block drivers the µclinux kernel supports three different types of block drivers. These drivers enable reading and writing fixed size blocks to the host file system such as a disk. The drivers are used as the lowest level ...

  • Page 344

    Appendix a — µ clinux system 320 ck1 sdk programmer’s reference manual memory allocation (malloc) is normally implemented at the low level using the brk system call. Under the unix environment, each created process owns a specific memory region called a heap. This is used for processing dynamic memo...

  • Page 345: User Applications

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 321 because it can not ensure that the pages would be loaded to the same location in ram. In general in embedded environments it also would not be acceptable to suspend an application in order to use more ram than is physically avail...

  • Page 346: Μclinux On The Ck1

    Appendix a — µ clinux system 322 ck1 sdk programmer’s reference manual general purpose linux distribution has also merged the µclinux 2.5.X patches to the main kernel source tree, beginning from the version linux- 2.5.46. This allows the developers for system architectures lacking an mmu to fetch an...

  • Page 347

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 323 the ck1 provides 1mb nor flash, 8mb nand flash, and 16mb of sdram. The ck1 also adds additional ti tl16c550 full rs232 chip and barcode decoder chip. These chips are configured to use a 16-bit wide bus. The system layout is shown...

  • Page 348

    Appendix a — µ clinux system 324 ck1 sdk programmer’s reference manual ck1 memory mapping the memory mapping of the ck1 is described in the following illustration. Size, layout, and position of memory the nor flash stores the bootloader, bios, diagnostic program, and flash writer programs. The funct...

  • Page 349: Programs In Nor Flash

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 325 detail nand layout (continued) name blocks use file system mount point config 401 … 431 user configuration jffs2 /etc/config home 432 … 1023 user application and data area jffs2 /home the block size mentioned above is 8kb. The de...

  • Page 350

    Appendix a — µ clinux system 326 ck1 sdk programmer’s reference manual bootloader check esc key from pc y y n first time cold boot check tab key from pc n y n stop here & wait for power key to interrupt check battery cover & battery value press power key n y y n enter bios keep ramdisk show menu on ...

  • Page 351

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 327 also, if a system has been booted, some user actions could possibly initiate when the system is in suspend mode in order to run diagnostic, cold boot (flag 2 in the following illustration), or warm boot (flag 1 in the following i...

  • Page 352

    Appendix a — µ clinux system 328 ck1 sdk programmer’s reference manual the device enters bios if the bootloader receives a tab character when cold boot is started. After checking for tab or escape keys from the pc, the bootloader checks the boot flag stored in the first block of nand flash, which is...

  • Page 353: Ck1

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 329 the boot command boots the device from the source. The only supported source is rom in the ck1 since there is no ethernet or other device in the ck1. The sysconf command does the configure process. The actions are set, manualset,...

  • Page 354: Root File System

    Appendix a — µ clinux system 330 ck1 sdk programmer’s reference manual µ clinux development tools (continued) tool description elf2flt an elf to flat converter. Gencramfs tool for creating romfs images. It is based on sourceforges romfs project, genromfs-0.5.1. The ck1 µclinux provides the ability t...

  • Page 355

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 331 nodev bdev nodev proc nodev sockfs nodev pipefs ext2 nodev ramfs jffs2 cramfs the user application in the ck1 µclinux is compiled into a rom file system, which the kernel mounts at the boot time. This file system is quite simple,...

  • Page 356: Ppp Connection

    Appendix a — µ clinux system 332 ck1 sdk programmer’s reference manual the ck1 is provided with a robust and reliable jffs2 file system that allows you to direct read/write flash so that the data does not get lost even when the system hangs or turns off unexpectedly. Since there is an average 100,00...

  • Page 357: Character Fonts

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 333 character fonts the ck1 µclinux provides ck1 with multi-language support capability. English and latin languages are supported as built in language fonts. You can download the simplified chinese and traditional chinese fonts to /...

  • Page 358

    Appendix a — µ clinux system 334 ck1 sdk programmer’s reference manual power management scenario if no user action occurs after standby time, the system enters suspend mode from normal or slow mode. If no user action occurs after idle time, the system enters slow mode from normal mode. If the schedu...

  • Page 359: Mounted Partitions

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 335 the system resumes from suspend mode when one of these events occurs: • rtc wake up • remote wake up • user action (press the power key) the window manager updates the system time and restarts the ppp server every time when the s...

  • Page 360: Μclinux System

    Appendix a — µ clinux system 336 ck1 sdk programmer’s reference manual s_image_file is not used in ck1. Title means the name displayed in the desktop. Exec_path is the full path of execution file. Exec_argv is the parameters passing to the program. Configuration of nano-x includes free type font and...

  • Page 361: Supported Libraries

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 337 • tool manager • print support • find and replace facilities • package manager, for easy installation of add-on libraries for help using the sdk wizard, see chapter 1, “installing and using the sdk.” supported libraries the libra...

  • Page 362: Device Configuration Files

    Appendix a — µ clinux system 338 ck1 sdk programmer’s reference manual fetch the function fetch gets the record that has the key pass to it. Count the function count gets the record count of the table. Example please look at the sample code testgdbm.C as an example to use the database. Device config...

  • Page 363

    Appendix a — µ clinux system ck1 sdk programmer’s reference manual 339 files in /etc/config (continued) file description hosts host resolve files to mapping hostnames with ip address. Inittab the init table of current. Inittab.Ppp, inittab.Console the init table of starting ppp or console getty. Pas...

  • Page 364: /home/etc

    Appendix a — µ clinux system 340 ck1 sdk programmer’s reference manual /home/etc the files in this folder are copied from /usr/local/etc. They are the configuration files of the gui system. Files in the home folder file description keypad_rc the keyboard mapping file. Ck1.Ime the definition of lock ...

  • Page 365: Index

    Ck1 sdk programmer’s reference manual 341 index i.

  • Page 366

    Index 342 ck1 sdk programmer’s reference manual symbols and numbers µclinux architecture, 304 block drivers, kernel, 319 booting, 314 ck1, 322 developing applications, 336 development tools, 329 flat file relocations, 311 future, 321 general scope, 303 hardware dependency, 308 history, 304 image, cr...

  • Page 367

    Index ck1 sdk programmer’s reference manual 343 pixmap, 251 backing up a file, 76 backlight control, getting status, 63 disabling control, 63 enabling control, 62 timeout getting status, 69 setting, 64 turning on, 51 backup battery critical limit getting, 73 setting, 69 good limit getting, 72 settin...

  • Page 368

    Index 344 ck1 sdk programmer’s reference manual buffer (continued) image destroying, 265 filling, 265 loading file to, 266 marking content of editable instance, 176 mask edit clearing, 196 marking content, 196 replacing text, 195 text content, 194 replacing text with content, 176, 185 returning id o...

  • Page 369

    Index ck1 sdk programmer’s reference manual 345 closing graphics device, 244 window, 251 codabar hamster setting status, 121 setting type codes, 115 type number, 113 code 11 hamster setting status, 121 setting type codes, 115 type number, 113 code 128 hamster setting status, 120 setting type codes, ...

  • Page 370

    Index 346 ck1 sdk programmer’s reference manual critical battery state, 52 current setting array, getting, 129 cursor position deleting text in editable instance, 177 inserting text in editable instance, 177 mask edit deleting text, 196 inserting text, 196 moving cursor to, 274 next valid, calculati...

  • Page 371

    Index ck1 sdk programmer’s reference manual 347 drawing function editable instance, 170 entry, 181 mask edit, 191 drawing stack bottom, placing window at, 248 top, placing at, 248 dynamic memory allocation, 320 e ean 128 hamster setting status, 119 setting type codes, 114 type number, 113 ean 13 ham...

  • Page 372

    Index 348 ck1 sdk programmer’s reference manual entry (continued) visibility, setting, 179 environment, sdk, 13 error handling routine, 245 message, human readable, 245 event api, 269 asking for next but not waiting, 285 callback function, calling, 285 discontinues handling for otkcontrol, 151 error...

  • Page 373

    Index ck1 sdk programmer’s reference manual 349 menu item size, 235 retrieving size, 139 rotation, 272 size, changing, 272 text drawing, 262 string size, 262 widget, size of, 142 forcibly disconnecting window client, 252 foreground color entry, 180 graphics context, 261 mask edit, 190 widget, 141 fo...

  • Page 374

    Index 350 ck1 sdk programmer’s reference manual grgetwmproperties (), 250 grinjectkeyboardevent (), 284 grinjectkeypadevent (), 286 grinjectnanownevent (), 286 grinjectpointerevent (), 274 grintersectregion (), 278 grkillwindow (), 252 grline (), 256 grlines (), 268 grloadimagefromfile (), 266 grlow...

  • Page 375

    Index ck1 sdk programmer’s reference manual 351 hiding entry, 187 mask edit, 197 otkcustompopupmenu, 232 popup menu, 235 submenu, 233 titles in otklist, 156 host ip address, getting, 99 human readable error message, 245 i i 2 of 5 hamster setting status, 117 setting type codes, 114 type number, 113 ...

  • Page 376

    Index 352 ck1 sdk programmer’s reference manual length (continued) mask edit, maximum, 194 text in editable instance, 176 libatm, 306 libc, 304 libjpeg, 306 libm, 306 libnet, 306 libpam, 306 libpng, 306 libraries, µclinux, 305 light /proc, changing by, 40 apis, 40 delaying turning off, 45 delaying t...

  • Page 377

    Index ck1 sdk programmer’s reference manual 353 replacing text, 195 sensitivity, 189 showing, 197 sibling next, 191 previous, 191 widgets, 192 size, 190 text from file, 194 unentered character, 198 visibility, 189 math library, 306 mbr, 292 member functions, tpt, 125 memory area, requesting shared, ...

  • Page 378

    Index 354 ck1 sdk programmer’s reference manual onselect event described, 161 user-defined function, otklist, 156 ontimeout event otklist user-defined data, 156 otklist, described, 161 opening graphics server connection, 244 project, 8 operating system µclinux, 290 file system, 300 linux kernel, 291...

  • Page 379

    Index ck1 sdk programmer’s reference manual 355 otk_editable_set_popupmenu, 173 otk_editable_set_position, 169 otk_editable_set_prev_sibling, 170 otk_editable_set_readonly, 172 otk_editable_set_seltextbuf, 176 otk_editable_set_sibling, 171 otk_editable_set_size, 169 otk_editable_set_textptr, 173 otk...

  • Page 380

    Index 356 ck1 sdk programmer’s reference manual otk_menuitem_set_checked, 239 otk_menuitem_set_clicked_callback, 240 otk_menuitem_set_color, 241 otk_menuitem_set_enabled, 239 otk_menuitem_set_groupid, 239 otk_menuitem_set_height, 240 otk_menuitem_set_label, 238 otk_menuitem_set_width, 240 otk_page_i...

  • Page 381

    Index ck1 sdk programmer’s reference manual 357 otk_widget_set_gc_background_color, 141 otk_widget_set_gc_font, 142 otk_widget_set_gc_font_size, 142 otk_widget_set_gc_foreground_color, 141 otk_widget_set_position, 142 otk_widget_set_sensitive, 141 otk_widget_set_size, 142 otk_widget_set_user_data, 1...

  • Page 382

    Index 358 ck1 sdk programmer’s reference manual popup menu (continued) owner otkcustompopupmenu, 231 otkpopupmenu, 235 showing, 234 portable network graphics, 306 operating system, 294 porting applications to µclinux, 321 position arc, 259, 260 deleting text in editable instance, 177 ellipse boundar...

  • Page 383

    Index ck1 sdk programmer’s reference manual 359 setting, 203 minimum value getting, 204 setting, 204 onchange event, 206 pages, 200 scrollbar, 207, 211 setting, 205 slider, 220 spin, 216 value getting, 204 setting, 204 ratio for page down, 200 reading bar code data, 126 gr_wm_properties, 250 light s...

  • Page 384

    Index 360 ck1 sdk programmer’s reference manual s sample test code, 94 scan button, enabling and disabling, 287 scanner support apis, guidelines, 112 bar code type name, getting, 110 closing connection to daemon, 110 function structure, 111 general functions, 110 opening connection to daemon, 110 sc...

  • Page 385

    Index ck1 sdk programmer’s reference manual 361 playing, 32 setting warning, 39 system-prompt, getting, 39 system-prompt, setting, 40 source file adding to project, 7 creating, 6 editing in a project, 10 removing from a project, 9 tree, µclinux, 306 spin current value, 217 maximum value, 216 minimum...

  • Page 386

    Index 362 ck1 sdk programmer’s reference manual time (continued) getting status, 70 setting, 64 standby getting status, 70 setting, 65 timeout backlight getting status, 69 setting, 64 event clearing, 136 setting, 136 grgetnexteventtimeout (), 270 titles of application, setting, 139 otklist setting, ...

  • Page 387

    Index ck1 sdk programmer’s reference manual 363 mask edit parent, 190 sibling, 192 october, introducing, 134 otktab, adding specified widget to, 166 parent of entry, 180 position, 142 redrawing visible, 136 sensitivity, 141 sibling, setting for editable instance, 171 size, 142 user data getting, 143...

  • Page 388

    Index 364 ck1 sdk programmer’s reference manual.

  • Page 390

    Corporate headquarters 6001 36th avenue west everett, washington 98203 u.S.A. Tel 425.348.2600 fax 425.355.9551 www.Intermec.Com ck1 sdk programmer's reference manual *073771-001* p/n 073771-001.