def _getservicetuple(servicerecord):
addr = _macutil.formatdevaddr(servicerecord.getDevice().getAddressString())<EOL>name = servicerecord.getServiceName()<EOL>try:<EOL><INDENT>result, channel = servicerecord.getRFCOMMChannelID_(None) <EOL><DEDENT>except TypeError:<EOL><INDENT>result, channel = servicerecord.getRFCOMMChannelID_()<EOL><DEDENT>if result != _macutil.kIOReturnSuccess:<EOL><INDENT>try:<EOL><INDENT>result, channel = servicerecord.getL2CAPPSM_(None) <EOL><DEDENT>except:<EOL><INDENT>result, channel = servicerecord.getL2CAPPSM_()<EOL><DEDENT>if result != _macutil.kIOReturnSuccess:<EOL><INDENT>channel = None<EOL><DEDENT><DEDENT>return (addr, channel, name)<EOL>
Returns a (device-addr, service-channel, service-name) tuple from the given
IOBluetoothSDPServiceRecord.