On Monday, January 20, 2003, at 08:47 AM, julien genestoux wrote: Hi everyone... I'm just trying to build and run a small App I made using BT :IOBluetoothUtilities.h and particularly this function IOReturn IOBluetoothNSStringToDeviceAddress( NSString * inNameString, BluetoothDeviceAddress * outDeviceAddress ); But it seems it's not working, does someone experienced problems with it? here's my code : NOte that the device address was obtained previously : so it's good. devAddressString=@"00-08-c6-13-45-e9"; BluetoothDeviceAddress * devAddress=nil; NSLog(devAddressString); IOBluetoothNSStringToDeviceAddress(devAddressString, devAddress); BtDevice=[IOBluetoothDevice withAddress:devAddress]; NSLog(@"the new name %s ",[BtDevice getName]); here's what happens: 00-08-c6-13-45-e9 the new name (null) And it bugs if I want to obtain the new device Address' Thanks for helping... I'm guessing that the problem is that you're declaring devAddress to be a BluetoothDeviceAddress * and passing that into IOBluetoothNSStringToDeviceAddress() instead of declaring it as a BluetoothDeviceAddress and passing a pointer to it into the function. With your code, you end up passing nil as the address parameter, so you don't actually get a valid address. Then, you likely get nil back from +[IOBluetoothDevice withAddress:]. Additionally, it is well worth checking the return codes from any of the functions or methods. In this case, you should see IOBluetoothNSStringToDeviceAddress() returning kIOReturnBadArgument. One other comment is that -[IOBluetoothDevice getName] only returns the cached name for that device. If a remote name request hasn't yet been issued for that device, you will get a nil back from the call. To actually issue the remote name request command, you need to call -[IOBluetoothDevice remoteNameRequest:]. Once that call is complete, you can then call -getName to get the device's name. To find out the date and time of the last remote name request, you can call -[IOBluetoothDevice getLastNameUpdate]. - Eric _______________________________________________ bluetooth-dev mailing list | bluetooth-dev@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/bluetooth-dev Do not post admin requests to the list. They will be ignored.
participants (1)
-
Eric Brown