본문 바로가기

반응형

bluetooth

(3)
Android<->Mac Bluetooth 연결하기 Mac 을 Server로 하고 Android를 Client로 하여 서로 데이터를 주고 받도록 하는 것이 1차 목표였다.둘의 통신은 BLE가 아닌 기본 Bluetooth 이다.Mac은 IOBluetooth를 사용하지 않고 Python LightBlue library를 사용하여 작성하였다.아래는 기본 테스트이므로 접속이 완료되면 데이터를 주고 받고 끝난다. Android Codepackage com.yhg.bluetoothclient; import android.annotation.TargetApi; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.Bluetoo..
Install Lightblue Cross Platform 이 가능한 Bluetooth library를 찾다가 Mac, Linux, Nokia Series 60 을 지원하는 LightBlue를 발견했습니다.LightBlue는 Python bluetooth library입니다.공식사이트를 보면 몇년 전부터 지원을 중단했지만.. 개발자들이 새로 Github에 올려서 최신 OS에서도 빌드되도록 수정했습니다.여러 Github repository가 있지만 그중에서 pebble/lightblue-0.4 가 OSX 64bit 에서 오류 없이 빌드됩니다.설치과정은 간단합니다. 우선 lightblue library를 빌드하고 설치합니다. 명령어 하나로 끝납니다. 위와 같이 ** INSTALL SUCCEEDED ** 가 출력되면서 설치가 끝납니다.이제 ..
BlueZ 를 사용할때 컴파일 방법 BlueZ 라이브러리를 이용하여 프로그래밍을 할때 컴파일을 하였는데 /tmp/ccO6DVsB.o(.text+0x102): In function `main': : undefined reference to `ba2str' collect2: ld returned 1 exit status 이와 같은 오류가 뜬다면 옵션을 주지 않아서 입니다. gcc -o test test.c -lbluetooth -lbluetooth 를 붙여주면 오류없이 컴파일 됩니다. gcc 뿐만 아니라 g++ 도 같은 옵션이 존재하는 것 같습니다.

반응형