2017-03-28 5 views
1

나는 C#에서 Gear S3 및 UWP 용 Win-App 용 웹 응용 프로그램을 작성 중입니다. 내가 원하는 것은 : BT 서버 역할을하는 S3, 데이터를 보내는 Win-App, 데이터를 수신해야하는 클라이언트로 Win-App. 다음 나 서비스에 연결하려고 C#에서Gear S3의 Bluetooth 서비스에 어떻게 연결할 수 있습니까?

function publishTransferService() { 

if(remoteDevice.isConnented){ 
    console.log("Connection Status: " + remoteDevice.isConnected); 
    var TRANS_SERVICE_UUID = '5BCE9431-6C75-32AB-AFE0-2EC108A30860'; 
    adapter.registerRFCOMMServiceByUUID(TRANS_SERVICE_UUID, 'My Service', ServiceSuccessCb, 
      function(e) { 
     console.log("Could not register service record, Error: " + e.message); 
    }); 
}else{ 
    console.error("Connection Status: " + remoteDevice.isConnected); 
    } 

: 는 타 이젠에서 I는 아래 registerRfcommServiceByUUID() 함수를 사용

 //to ulong converted MAC-Address of the Gear 
     ulong gearBtAddress = 145914022804881; 
     //create device-instance of the gear 
     BluetoothDevice gearDevice = await BluetoothDevice.FromBluetoothAddressAsync(gearBtAddress); 
     //list the services found on the gear and connect to the one with 
     //the same uuid as in tizen 
     var gearServices = await gearDevice.GetRfcommServicesAsync(); 
     foreach (var service in gearServices.Services) 
     { 
      if(service.ServiceId == RfcommServiceId.FromUuid(Guid.Parse("5BCE9431-6C75-32AB-AFE0-2EC108A30860"))) 
      { 
       _service = await RfcommDeviceService.FromIdAsync(service.ToString()); 
      } 

     } 

I 직면하고 문제가되면, C# 1 원 그 여러 다른 uuids를 발견하더라도 원하는 Uuid를 찾지 못합니다. 나는 어디서 길을 잃어버린 지 안다?

미리 감사드립니다.

+0

여기를 보시려면 https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Network.html을 방문하십시오. –

답변

1

나는 그것을 스스로 해결했다. 문제는 UUID가 캐시되지 않았다는 것이다. 다음을 모두 추가하면됩니다.

 var cacheMode = BluetoothCacheMode.Uncached; 
     var gearServices = await gearDevice.GetRfcommServicesAsync(cacheMode);