안드로이드 블루투스통신 예제는 인터넷에 많이 있을 것이다. 예를들면 블루투스통신 채팅 같은 예제.. 그러나 예제를 수정하여 블루투스 통신을 구현하려고 할 때 연결이 잘 안될수도 있다. 블루투스 프로토콜 종류가 많이 있기 때문에 프로토콜이 맞지 않아서 생기는 원인같다. 아래 리스트에서 사용하는 블루투스 통신의 성격에 맞는 프로토콜을 찾아서 사용하도록 하자.

 블루투스 통신을 찾다보면 BluetoothChat이라는 예제 프로젝트를 볼 수 있는데 이 예제는 스마트폰끼리 채팅하는 예제이기 때문에 다른 블루투스 기기와 연결이 안될것이다. BluetoothChatService.java에 들어가서 UUID를 바꿔주면 아마 될 것이다. 

private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

MY_UUID부분을 아래 UUID 리스트에서 찾아서 프로토콜에 맞게 변경해주자!

블루투스 프로토콜 UUID 리스트

BASE UUID
SDP_PROTOCOL_UUID
UDP_PROTOCOL_UUID
RFCOMM_PROTOCOL_UUID
TCP_PROTOCOL_UUID
TCSBIN_PROTOCOL_UUID
TCSAT_PROTOCOL_UUID
OBEX_PROTOCOL_UUID
IP_PROTOCOL_UUID
FTP_PROTOCOL_UUID
HTTP_PROTOCOL_UUID
WSP_PROTOCOL_UUID
BNEP_PROTOCOL_UUID
UPNP_PROTOCOL_UUID
HID_PROTOCOL_UUID
HCCC_PROTOCOL_UUID
HCDC_PROTOCOL_UUID
HN_PROTOCOL_UUID
AVCTP_PROTOCOL_UUID
AVDTP_PROTOCOL_UUID
CMPT_PROTOCOL_UUID
UDI_C_PLANE_PROTOCOL_UUID
L2CAP_PROTOCOL_UUID

= '{00000000-0000-1000-8000-00805F9B34FB}';
= '{00000001-0000-1000-8000-00805F9B34FB}';
= '{00000002-0000-1000-8000-00805F9B34FB}';
= '{00000003-0000-1000-8000-00805F9B34FB}';
= '{00000004-0000-1000-8000-00805F9B34FB}';
= '{00000005-0000-1000-8000-00805F9B34FB}';
= '{00000006-0000-1000-8000-00805F9B34FB}';
= '{00000008-0000-1000-8000-00805F9B34FB}';
= '{00000009-0000-1000-8000-00805F9B34FB}';
= '{0000000A-0000-1000-8000-00805F9B34FB}';
= '{0000000C-0000-1000-8000-00805F9B34FB}';
= '{0000000E-0000-1000-8000-00805F9B34FB}';
= '{0000000F-0000-1000-8000-00805F9B34FB}';
= '{00000010-0000-1000-8000-00805F9B34FB}';
= '{00000011-0000-1000-8000-00805F9B34FB}';
= '{00000012-0000-1000-8000-00805F9B34FB}';
= '{00000014-0000-1000-8000-00805F9B34FB}';
= '{00000016-0000-1000-8000-00805F9B34FB}';
= '{00000017-0000-1000-8000-00805F9B34FB}';
= '{00000019-0000-1000-8000-00805F9B34FB}';
= '{0000001B-0000-1000-8000-00805F9B34FB}';
= '{0000001D-0000-1000-8000-00805F9B34FB}';
= '{00000100-0000-1000-8000-00805F9B34FB}'; 

ServiceDiscoveryServerServiceClassID_UUID
BrowseGroupDescriptorServiceClassID_UUID
PublicBrowseGroupServiceClass_UUID
SerialPortServiceClass_UUID
LANAccessUsingPPPServiceClass_UUID
DialupNetworkingServiceClass_UUID
IrMCSyncServiceClass_UUID
OBEXObjectPushServiceClass_UUID
OBEXFileTransferServiceClass_UUID
IrMCSyncCommandServiceClass_UUID
HeadsetServiceClass_UUID
CordlessTelephonyServiceClass_UUID
AudioSourceServiceClass_UUID
AudioSinkServiceClass_UUID
AVRemoteControlTargetServiceClass_UUID
AdvancedAudioDistributionServiceClass_UUID
AVRemoteControlServiceClass_UUID
VideoConferencingServiceClass_UUID
IntercomServiceClass_UUID
FaxServiceClass_UUID
HeadsetAudioGatewayServiceClass_UUID
WAPServiceClass_UUID
WAPClientServiceClass_UUID
PANUServiceClass_UUID
NAPServiceClass_UUID
GNServiceClass_UUID
DirectPrintingServiceClass_UUID
ReferencePrintingServiceClass_UUID
ImagingServiceClass_UUID
ImagingResponderServiceClass_UUID
ImagingAutomaticArchiveServiceClass_UUID
ImagingReferenceObjectsServiceClass_UUID
HandsfreeServiceClass_UUID
HandsfreeAudioGatewayServiceClass_UUID

= '{00001000-0000-1000-8000-00805F9B34FB}';
= '{00001001-0000-1000-8000-00805F9B34FB}';
= '{00001002-0000-1000-8000-00805F9B34FB}';
= '{00001101-0000-1000-8000-00805F9B34FB}';
= '{00001102-0000-1000-8000-00805F9B34FB}';
= '{00001103-0000-1000-8000-00805F9B34FB}';
= '{00001104-0000-1000-8000-00805F9B34FB}';
= '{00001105-0000-1000-8000-00805F9B34FB}';
= '{00001106-0000-1000-8000-00805F9B34FB}';
= '{00001107-0000-1000-8000-00805F9B34FB}';
= '{00001108-0000-1000-8000-00805F9B34FB}';
= '{00001109-0000-1000-8000-00805F9B34FB}';
= '{0000110A-0000-1000-8000-00805F9B34FB}';
= '{0000110B-0000-1000-8000-00805F9B34FB}';
= '{0000110C-0000-1000-8000-00805F9B34FB}';
= '{0000110D-0000-1000-8000-00805F9B34FB}';
= '{0000110E-0000-1000-8000-00805F9B34FB}';
= '{0000110F-0000-1000-8000-00805F9B34FB}';
= '{00001110-0000-1000-8000-00805F9B34FB}';
= '{00001111-0000-1000-8000-00805F9B34FB}';
= '{00001112-0000-1000-8000-00805F9B34FB}';
= '{00001113-0000-1000-8000-00805F9B34FB}';
= '{00001114-0000-1000-8000-00805F9B34FB}';
= '{00001115-0000-1000-8000-00805F9B34FB}';
= '{00001116-0000-1000-8000-00805F9B34FB}';
= '{00001117-0000-1000-8000-00805F9B34FB}';
= '{00001118-0000-1000-8000-00805F9B34FB}';
= '{00001119-0000-1000-8000-00805F9B34FB}';
= '{0000111A-0000-1000-8000-00805F9B34FB}';
= '{0000111B-0000-1000-8000-00805F9B34FB}';
= '{0000111C-0000-1000-8000-00805F9B34FB}';
= '{0000111D-0000-1000-8000-00805F9B34FB}';
= '{0000111E-0000-1000-8000-00805F9B34FB}';
= '{0000111F-0000-1000-8000-00805F9B34FB}';

DirectPrintingReferenceObjectsServiceClass_UUID
ReflectedUIServiceClass_UUID
BasicPringingServiceClass_UUID
PrintingStatusServiceClass_UUID
HumanInterfaceDeviceServiceClass_UUID
HardcopyCableReplacementServiceClass_UUID
HCRPrintServiceClass_UUID
HCRScanServiceClass_UUID
CommonISDNAccessServiceClass_UUID
VideoConferencingGWServiceClass_UUID
UDIMTServiceClass_UUID
UDITAServiceClass_UUID
AudioVideoServiceClass_UUID
PnPInformationServiceClass_UUID
GenericNetworkingServiceClass_UUID
GenericFileTransferServiceClass_UUID
GenericAudioServiceClass_UUID
GenericAudioServiceClass_UUID
GenericTelephonyServiceClass_UUID
UPnPServiceClass_UUID
UPnPIpServiceClass_UUID
ESdpUPnPIpPanServiceClass_UUID
ESdpUPnPIpLapServiceClass_UUID
EdpUPnpIpL2CAPServiceClass_UUID

= '{00001120-0000-1000-8000-00805F9B34FB}';
= '{00001121-0000-1000-8000-00805F9B34FB}';
= '{00001122-0000-1000-8000-00805F9B34FB}';
= '{00001123-0000-1000-8000-00805F9B34FB}';
= '{00001124-0000-1000-8000-00805F9B34FB}';
= '{00001125-0000-1000-8000-00805F9B34FB}';
= '{00001126-0000-1000-8000-00805F9B34FB}';
= '{00001127-0000-1000-8000-00805F9B34FB}';
= '{00001128-0000-1000-8000-00805F9B34FB}';
= '{00001129-0000-1000-8000-00805F9B34FB}';
= '{0000112A-0000-1000-8000-00805F9B34FB}';
= '{0000112B-0000-1000-8000-00805F9B34FB}';
= '{0000112C-0000-1000-8000-00805F9B34FB}';
= '{00001200-0000-1000-8000-00805F9B34FB}';
= '{00001201-0000-1000-8000-00805F9B34FB}';
= '{00001202-0000-1000-8000-00805F9B34FB}';
= '{00001203-0000-1000-8000-00805F9B34FB}';
= '{00001203-0000-1000-8000-00805F9B34FB}';
= '{00001204-0000-1000-8000-00805F9B34FB}';
= '{00001205-0000-1000-8000-00805F9B34FB}';
= '{00001206-0000-1000-8000-00805F9B34FB}';
= '{00001300-0000-1000-8000-00805F9B34FB}';
= '{00001301-0000-1000-8000-00805F9B34FB}';
= '{00001302-0000-1000-8000-00805F9B34FB}'; 


+ Recent posts