2012-09-18 7 views
1

TI의 CC2540 (TI의 keyfob과 connectblue OLP425의 다른 장치)을 기반으로하는 BLE 장치에 Motorola RAZR을 연결하려고합니다. 멀리 내가 소스에 액세스 할 수없는 시장에 전파라는 응용 프로그램입니다. CC2540 블루투스 LE 장치와 연결

가이 코드 그러나 나는 이해하지 못하는 가장 큰 것으로, 장치에 연결을 시도한 UUID가,

내가이 아이 패드 3에 응용 프로그램을 다운로드하고 난 장치는 다음과 같은 UUID를 가지고 발견 00000000 -0000-0000-ff31-1a064f8c5966

private static final UUID SPP_UUID = UUID.fromString("00000000-0000-0000-ff31-1a064f8c5966"); 
BluetoothDevice bd =BluetoothAdapter.getDefaultAdapter().getBondedDevices().iterator().next(); 
//I only have I device paired that is the Bluetooth Low Energy Device so using the first Device returned by the iterator is fine. 
    try { 
     BluetoothSocket bs = bd.createRfcommSocketToServiceRecord(UUID); 
     bs.connect(); 
    } catch (IOException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 

내가 할 모든

을 사용하는 거의 모든 예 모두에서

로그 캣

에 실패한 서비스의 발견이다 나는 응용 프로그램에 더 이상 갈 경우

00000000-0000-1000-8000-00805f9b34fb

는 배터리 서비스는이 서비스의 값을 읽고 난 그냥 응용 프로그램을 만들고 싶습니다

0x180f UUID이라고 syas 간단한 십진법 값

과거에는 BLE 장치와 어떤 succes도 짝을 이루고 있습니까?

내가 심장 박동 모니터 내 CC2540에 연결할 수있었습니다 당신

조나단

+0

당신이 보여 코드는 기존의 블루투스 장치에 연결하기위한 것입니다. 그건 르를 위해 작동하지 않습니다. – TJD

+0

고마워, 모토로라 API의 connectLe 및 connectGatt 기능을 찾았지만, 아직 성공적이지는 못했지만 계속 노력할 것입니다. – gimpycpu

답변

0

감사합니다. CCDebugger를 사용하여 펌웨어를 플래시하고 0000180d-0000-1000-8000-00805f9b34fbas를 사용하여 UUID를 읽었습니다. 값을 읽을 수있었습니다.

일부 수정 사항이있는 Motorola_BLE_profile 샘플 앱 사용.

primaryServices = mGattService.getGattPrimaryServices(device); 
if (primaryServices == null) { 
    String message = "Connection failed !"; 
    Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); 
    return; 
} 
for (i = 0; i < primaryServices.length; i++) { 
    Log.v(TAG, "primary service " + primaryServices[i]); 
    if (primaryServices[i].equalsIgnoreCase(hrmUUID)) { 
    try { 
     status = mGattService.connectGatt(device, hrmUUID, callback1); 
     if (status == true){ 
     mDevice = device; 
     mLeState = CONNECTING; 
     BluetoothLeReceiver.isDevicePickerPending = false; 
     } else { 
     String message = "Connection failed !"; 
     Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); 
     } 

} catch (Exception e) { 
    Log.e(TAG,"Exception while calling gatt Connect"); 
} 
return; 
if (i == primaryServices.length) { 
Log.v(TAG,"Primary Service not found"); 
String message = "Connection failed !"; 
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); 

}

관련 문제