[30518.225322] usb 3-1.2: new full-speed USB device number 5 using xhci_hcd [30518.375490] usb 3-1.2: New USB device found, idVendor=0a12, idProduct=0001 [30518.375492] usb 3-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [30518.375493] usb 3-1.2: Product: CSR8510 A10
2018/6/14
dbus an simple service example in python
ref: Register a “Hello World” DBus service, object and method using Python
service 的 source code 就是..
service 的 source code 就是..
import gobject
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
OPATH = "/com/example/HelloHell"
IFACE = "com.example.HelloHell"
BUS_NAME = "com.example.HelloHell"
class Example(dbus.service.Object):
def __init__(self):
bus = dbus.SessionBus()
bus.request_name(BUS_NAME)
bus_name = dbus.service.BusName(BUS_NAME, bus=bus)
dbus.service.Object.__init__(self, bus_name, OPATH)
@dbus.service.method(dbus_interface=IFACE + ".SayHello",
in_signature="", out_signature="")
def SayHello(self):
print "hello, world"
if __name__ == "__main__":
a = Example()
loop = gobject.MainLoop()
loop.run()
用 python run 起來後,用 dbus-send 送message 給'他',就會print Hello 出來..
dbus-send --session --print-reply --type=method_call --dest=com.example.HelloHell /com/example/HelloHell com.example.HelloHell.SayHello.SayHello
2018/6/11
raspberry pi 3 and bluez
follow 這一篇 其中 update bluez 的部份。
把 bluez 由 5.43 升級到 5.49,這樣 bluetoothconf 的 error message 就消失了。
另外這一篇 也有更新到 5.48 的步驟
這一篇 的回答有 dbus-send 的用法。
這一篇用 pi 3 做 ibeacon
把 bluez 由 5.43 升級到 5.49,這樣 bluetoothconf 的 error message 就消失了。
另外這一篇 也有更新到 5.48 的步驟
這一篇 的回答有 dbus-send 的用法。
這一篇用 pi 3 做 ibeacon
2018/6/8
bookmark : nordic build with gcc on linux
官方文件 雖然寫的是 eclipse,但是也包含一些 command line 的操作方式。
大概是:
先到arm 下載安裝ㄤ arm gcc croos toolchain
apt-get install build-essential checkinstall
到nordic developer site 下載 SDK.zip,解開。
修改 components/toolchain/gcc/Makefile.posix
依照你的 arm gcc cross tool 安裝途徑,版本修改..,我的是..
make 完會在這個目錄下create _buil 目錄。
接著就是燒錄...
另一篇 也是一樣的步驟。
而且是在
EVB 是 nRF52840-DK,上面做jlink debugger 的是 PCA10056
有關linux 開發環境的文件: nRF52840-PCA10056
至於一般的 board user guide,在 download 的 SDK 解開後的 document 目錄:index.html
大概是:
先到arm 下載安裝ㄤ arm gcc croos toolchain
apt-get install build-essential checkinstall
到nordic developer site 下載 SDK.zip,解開。
修改 components/toolchain/gcc/Makefile.posix
依照你的 arm gcc cross tool 安裝途徑,版本修改..,我的是..
GNU_INSTALL_ROOT ?= /usr/bin/ GNU_VERSION ?= 5.4.1 GNU_PREFIX ?= arm-none-eabi然後就可以到 examples/peripheral/<board name>/blank/armgcc/ 下 make 了。
make 完會在這個目錄下create _buil 目錄。
接著就是燒錄...
另一篇 也是一樣的步驟。
而且是在
EVB 是 nRF52840-DK,上面做jlink debugger 的是 PCA10056
有關linux 開發環境的文件: nRF52840-PCA10056
至於一般的 board user guide,在 download 的 SDK 解開後的 document 目錄:index.html
2018/6/7
BLE GATT Example for Android 6
Android 6 之後,BLE Scan 需要得到 Location 權限。
所以以前的 example 就要修改了,否則 scan 不出東西,logcat 還會出現 need permission COARSE_LOCATION or FINE_LOCATION
文章參考"BLE Scan Not Working" 和 這裡
我也修改了一下,最少修改。放在: android-BluetoothLEGatt,branch : fixAndroid6
大概就是..
所以以前的 example 就要修改了,否則 scan 不出東西,logcat 還會出現 need permission COARSE_LOCATION or FINE_LOCATION
文章參考"BLE Scan Not Working" 和 這裡
我也修改了一下,最少修改。放在: android-BluetoothLEGatt,branch : fixAndroid6
大概就是..
diff --git a/Application/src/main/AndroidManifest.xml b/Application/src/main/AndroidManifest.xml
index d3cf257..7979018 100644
--- a/Application/src/main/AndroidManifest.xml
+++ b/Application/src/main/AndroidManifest.xml
@@ -32,6 +32,7 @@
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
diff --git a/Application/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java b/Application/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
index 9b86f7a..7c654dc 100644
--- a/Application/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
+++ b/Application/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
@@ -16,6 +16,7 @@
package com.example.android.bluetoothlegatt;
+import android.Manifest;
import android.app.Activity;
import android.app.ListActivity;
import android.bluetooth.BluetoothAdapter;
@@ -46,6 +47,7 @@ public class DeviceScanActivity extends ListActivity {
private BluetoothAdapter mBluetoothAdapter;
private boolean mScanning;
private Handler mHandler;
+ private static final int PERMISSION_REQUEST_CORASE_LOCATION = 7788;
private static final int REQUEST_ENABLE_BT = 1;
// Stops scanning after 10 seconds.
@@ -64,6 +66,8 @@ public class DeviceScanActivity extends ListActivity {
finish();
}
+ requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},PERMISSION_REQUEST_CORASE_LOCATION);
+
// Initializes a Bluetooth adapter. For API level 18 and above, get a reference to
// BluetoothAdapter through BluetoothManager.
final BluetoothManager bluetoothManager =
2018/6/6
Nordic nRFToolbox build from source
這是 Nordic 的 app,用來跟Nordic 的 EVB 連線用的。
原始source code 放在 Nordic 的 github repo :Android-nRF-Toolbox。
但是因為 build 起來有問題,要加一些修改才 build 得起來。
所以只好 fork 一份到自己的 github
說明一下 build 的方法...
這個 需要 Android BLE Library,而且有規定位置 (在 Settings.gradle)。
Android-BLE-Library 跟 Android-nRF-Toolbox 要放在同一層。
toolbox 的 settings.gradle 是這樣寫的..
也就是說..
原始source code 放在 Nordic 的 github repo :Android-nRF-Toolbox。
但是因為 build 起來有問題,要加一些修改才 build 得起來。
所以只好 fork 一份到自己的 github
說明一下 build 的方法...
這個 需要 Android BLE Library,而且有規定位置 (在 Settings.gradle)。
Android-BLE-Library 跟 Android-nRF-Toolbox 要放在同一層。
toolbox 的 settings.gradle 是這樣寫的..
project(':ble').projectDir = file('../Android-BLE-Library/ble')
也就是說..
$ git clone https://github.com/checko/Android-BLE-Library.git $ git clone https://github.com/checko/Android-nRF-Toolbox.git $ cd Android-nRF-Toolox $ git checkout fixRequstClassNotFound我是先 import Android-BLE-Library, build 好,再 import Android-nRF-Toolbox, build apk
2018/6/4
訂閱:
文章 (Atom)