2014年8月3日 星期日
[ Android ] : bluetooth HCI log ( >= android 4.3)
After android 4.2, the bluetooth stack was changed from bluez to bluedroid;
so... the log tool ( hci tools ) was abandoned.
But you can still get BT log by thess 3 steps :
1. enable BT HCI logger at "settings > developer" :
2. modify the log level you want trace :
a. the location of configure file at /etc/bluetooth/bt_stack.conf
b. then modify the file content:
============================================================
# Enable BtSnoop logging function
# valid value : true, false
BtSnoopLogOutput=false
# BtSnoop log output file
BtSnoopFileName=/sdcard/btsnoop_hci.log
# Enable trace level reconfiguration function
# Must be present before any TRC_ trace level settings
TraceConf=true
# Trace level configuration
# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
# BT_TRACE_LEVEL_API 3 ( API traces )
# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only.
TRC_BTM=2
TRC_HCI=2
TRC_L2CAP=2
TRC_RFCOMM=2
TRC_OBEX=2
TRC_AVCT=2
TRC_AVDT=2
TRC_AVRC=2
TRC_AVDT_SCB=2
TRC_AVDT_CCB=2
TRC_A2D=2
TRC_SDP=2
TRC_GATT=2
============================================================
you should change BtSnoopLogOutput=false >> BtSnoopLogOutput=true
and change the log level you interest, like : TRC_L2CAP=2 >> TRC_L2CAP=5
notice that the output log file at /sdcard/btsnoop_hci.log
3. read your output log file by wireshark :
2014年5月11日 星期日
[ Java ] : Bytes to hex string
public static String bytesToHex(byte[] bytes) {
char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 3];
for ( int j = 0; j < bytes.length; j++ ) {
int v = bytes[j] & 0xFF;
hexChars[j * 3] = hexArray[v >>> 4];
hexChars[j * 3 + 1] = hexArray[v & 0x0F];
hexChars[j * 3 + 2] = '-';
}
return new String(hexChars);
}
2014年3月12日 星期三
[ Android ] : enable settings page of your Aplication
You can easily add "Settings feature" to your android app, just following these 10 steps:
( Android 4.0 & 4.4 works fine )
1. You need create your android app project with eclipse first. (here sample project is "enableSettings")
2. right click your android project >> new >> others
( Android 4.0 & 4.4 works fine )
1. You need create your android app project with eclipse first. (here sample project is "enableSettings")
2. right click your android project >> new >> others
3. select "Android Activity"
4. select "Settings Activity"
5. No need to change, next step.
6. This "settings feature" need dependency android lib, if you can't press "Next" button, just install it.
7. Now just start your app see if can run normally, UI should like this:
8. then add this code in your android MainActivity.java, after that you should be able to go to "SettingsActivity" page:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
Intent i = new Intent(this, SettingsActivity.class);
startActivityForResult(i, 0);
break;
default:
break;
}
return true;
}
9. You can see the template settings from android now, and there are check box for boolean variable, editable dialog for string variable, list dialog for int & string ...etc, you can easily use what you need.
10. Next step you need to do a little study into the "SettingsActivity.java" file to know how to use it; and "SharedPreferences" class to access/store your app's preference.
2014年1月19日 星期日
[ Android ] : 10MinNews, dedicated app for CNN 10
Update : 2020/02/21
App Name : 10MinNews
Newest version : 1.4
App Type : English Learning / News
追蹤最近 60 天 CNN 10 的影片與簡稿;
可以邊看影片邊看簡稿比對學習,幫助你增加英文的聽讀能力。
Introduce :
Trace latest 60 videos & scripts of CNN 10.
You can watch video & script at same page / at same time.
Easily enhance your English reading & listening abilities.
主要功能包括 :
- 下載影片與簡稿到本地後可離線操作。
- 選取簡稿單字,翻譯並紀錄。
- 分享你的單字筆記。
Main Features include :
- You can download video & script to do offline learning.
- You can select a word to translate, to take a note.
- You can share your note.
Demo Pictures :
App Name : 10MinNews
Newest version : 1.4
App Type : English Learning / News
Install : install page
Download apk:from google cloud
簡介 :追蹤最近 60 天 CNN 10 的影片與簡稿;
可以邊看影片邊看簡稿比對學習,幫助你增加英文的聽讀能力。
Introduce :
Trace latest 60 videos & scripts of CNN 10.
You can watch video & script at same page / at same time.
Easily enhance your English reading & listening abilities.
主要功能包括 :
- 下載影片與簡稿到本地後可離線操作。
- 選取簡稿單字,翻譯並紀錄。
- 分享你的單字筆記。
Main Features include :
- You can download video & script to do offline learning.
- You can select a word to translate, to take a note.
- You can share your note.
Demo Pictures :
2013年10月8日 星期二
[ Apple ] : part of MFi ?
From MFi team reply (2013/10/08)
============================================
============================================
The MFi Program encompasses third-party hardware accessories which use
Apple's licensed technology to connect electronically to iPhone, iPad or iPod.
MFi licensed technology includes:
- Lightning and 30-pin connectors
- Authentication coprocessors
- iPod Accessory Protocol, the protocol used to communicate with
iPhone, iPad and iPod
- AirPlay audio technology
- Apple Wireless Accessory Configuration feature
- Apple Headphone Remote and Mic system
Non-electronic cases and accessories which do not use MFi licensed
technology are not part of the MFi Program.
2013年10月7日 星期一
2013年9月3日 星期二
[ C / C++ ] : Byte Array to Hex String
int index;
char hexString[512];
memset(hexString,
0x0,
sizeof(hexString));
for (index
= 0; index < byteArray.length; ++index) {
sprintf(hexString+index*3, "%02X ",
byteArray[index]);
}
printf("Hex
String : %s\n", hexString);
訂閱:
文章 (Atom)