eurotech 게이트웨이에 설치 될 OSGi 번들을 만들려고합니다 (1050에 응답). 이 번들은 기본적으로 게이트웨이를 BLE 장치에 연결합니다. kura 프레임 워크를 사용하여 BLE 장치에 연결할 때 주소 유형을 "random static"으로 지정하는 방법
내가 쿠라 V1.2.0 프레임 워크의 상단에 별도의 레이어를 추가 Everyware ™ 소프트웨어 프레임 워크 (ESF)라고 EUROTECH에서 제공하는 프레임 워크를 사용, 이렇게하려면.catch는 BLE 장치가 임의의 정적 주소 유형 만 허용합니다.
나는 콘솔에서 다음 명령을 사용하여 BLE 장치에 수동으로 게이트웨이를 연결하는 관리 :hcitool -i hci0 lecc --random <BD_ADDR>
다음
gatttool -i hci0 -b <BD_ADDR> --interactive
이 잘 작동합니다. 어려운 부분은 ESF/kura 프레임 워크를 사용하여 코드에서 동일한 작업을하려고 할 때입니다.
org.eclipse.kura.bluetooth.BluetoothAdapter;
org.eclipse.kura.bluetooth.BluetoothDevice;
org.eclipse.kura.bluetooth.BluetoothGattSecurityLevel;
org.eclipse.kura.bluetooth.BluetoothGattService;
org.eclipse.kura.bluetooth.BluetoothLeScanListener;
org.eclipse.kura.bluetooth.BluetoothService;
org.eclipse.kura.bluetooth.BluetoothDevice;
org.eclipse.kura.bluetooth.BluetoothGatt;
org.eclipse.kura.bluetooth.BluetoothGattCharacteristic;
org.eclipse.kura.bluetooth.BluetoothLeNotificationListener;
: 여기
다음은 샘플 검사와의 연결을 설정하는 데 사용하는 일부 개체의 목록입니다 내가이 pagepublic boolean connect(String adapterName) {
this.bluetoothGatt = this.device.getBluetoothGatt();
boolean connected = false;
try {
connected = this.bluetoothGatt.connect(adapterName);
} catch (KuraException e) {
logger.error(e.toString());
}
if (connected) {
this.bluetoothGatt.setBluetoothLeNotificationListener(this);
this.isConnected = true;
return true;
} else {
// If connect command is not executed, close gatttool
this.bluetoothGatt.disconnect();
this.isConnected = false;
return false;
}
}
에 발견 사용 샘플에서 미리보기입니다 그래서 나는 API를 통해 doc을 검색했지만 아무것도 찾지 못했습니다.
흥미로운 점은 SO post에는 장치에 보낼 명령 코드가 나와 있습니다.
나는 kura 프레임 워크에서 도움이 될 수있는 방법을 발견했습니다. 여기 서명입니다 :
void ExecuteCmd(java.lang.String ogf, java.lang.String ocf, java.lang.String parameter)
하지만 난 모든 문서 오피 코드 명령 필드 (OCF)에 관련된 동작 코드 그룹 필드 (OGF) 알아낼 수있다 (필자는 블루투스 4.0 코어의 ~ 2,300 페이지를 미끄러 져 투기). 누구든지 검색 할 위치를 알고 있다면 ... :)
마지막으로 질문 : kura 프레임 워크에서 주소 유형을 hcitool 명령과 같이 임의로 설정하는 방법이 있습니까? 아니면 완전히 오도됩니까? :/
어쨌든, 나는 정말로 쿠라와 생태계에 익숙하지 않으므로 미안하다. 분명히 할 수있는 것처럼 보이지만 영감이 없어져서 손을 완전히 사용할 수 있다고 느낀다!
추신 : 축하해 주시면 축하드립니다!
안녕하세요, 감사합니다. 그래, 그 클래스를 보았는데, org.kura.linux.bluetooth 패키지를 번들 dependencie로 가져 와서이 메소드를 사용할 수있게했다. hcitoolCmd (String name, String [] cmd, BluetoothProcessListener listener); 기본적으로 startSession() 메서드를 "오버로드"합니다. 그러나 블루투스. * 패키지의 클래스가 해결되지 않았다고 말하는 번들을 내보낼 때 오류가 발생했습니다. * 한숨 *. 나는 이것이 유효한 한 가지 방법이라고 생각합니다. – ChrisCarneiro