|
|
(11 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| == Keys Datasheet==
| | {{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/firmware/utilize-q1-buttons}} |
| {| class="wikitable" | |
| |-
| |
| ! Key!! Value!! Description
| |
| |-
| |
| | Period || KeyEvent.KEYCODE_PERIOD || The black dot key on the right-bottom of keyboard.
| |
| |-
| |
| | QRCode|| 232 || The orange key on the middle-bottom of keyboard
| |
| |-
| |
| | Back|| KeyEvent.KEYCODE_ESCAPE|| The red X key on the left-bottom of keyboard
| |
| |-
| |
| | Scanner|| 229|| The orange key on the left of the LED
| |
| |-
| |
| | Delete|| KeyEvent.KEYCODE_DEL|| The yellow triangle key on the right-top of keyboard
| |
| |-
| |
| | Enter|| KeyEvent.KEYCODE_ENTER|| The green circle key on the right-bottom of keyboard
| |
| |}
| |
| The others are number keys, defined in android system. See android.view.KeyEvent.
| |
| == Scanner Key or QRCode Key==
| |
| === Use Specification ===
| |
| The Scanner Key and the QRCode Key can start the scanner application quickly. If one of the keys is pressed, the system will search all the applications installed in the system, the applications with the intent-filter of scanner will be started. If there are many applications, the system will provide a list for the user to select, the selected will be start, The contents in the intent-filter of scanner are as follows:
| |
| <action android:name="android.intent.action.SCAN" />
| |
| <category android:name="android.intent.category.DEFAULT" />
| |
| Press the Scanner Key or the QRCode Key will not effect when none of the applications in the system defines the intent-filter of scanner.
| |
| === Sample ===
| |
| There are two ways to use the Scanner Key and the QRCode Key:
| |
| * To start scanner application quickly. The application must define the intent-filter of scanner in its’ android manifest file, the category and the action definition are as below:
| |
| <activity
| |
| android:name="com.XX.activity.MainActivity"
| |
| android:label="@string/app_name" >
| |
| <intent-filter>
| |
| <!-- 设置当有人按下scan按键后调用扫描应用 -->
| |
| <action android:name="android.intent.action.SCAN" />
| |
| <category android:name="android.intent.category.DEFAULT" />
| |
| </intent-filter>
| |
| </activity>
| |
| | |
| * Use like the other keys, when press the key , the activated and top task will get the key value and do as its logic source code. Firstly the application must override the function of onKeydown, as follows:
| |
| <syntaxhighlight lang="java">
| |
| /** Key code constant: left scan key. */
| |
| public static final int KEYCODE_SCAN_LEFT = 229;
| |
| | |
| /** Key code constant: right scan key. */
| |
| public static final int KEYCODE_SCAN_RIGHT = 230;
| |
| | |
| /** Key code constant: qr key. */
| |
| public static final int KEYCODE_QR = 232;
| |
| | |
| public boolean onKeyDown(int keyCode, KeyEvent event) {
| |
| // listen the key code
| |
| if (keyCode == KEYCODE_SCAN_LEFT|| keyCode ==KEYCODE_SCAN_RIGHT|| keyCode ==KEYCODE_QR) {
| |
| //do something, for example:scanner……
| |
| return true;
| |
| }
| |
| return super.onKeyDown(keyCode, event);
| |
| } | |
| | |
| </syntaxhighlight >
| |