I am trying to determine the services on a mobile phone using another mobile. I have written this code and looked at the post which demos the getServiceRecords Method.
private void listView1_ItemActivate(object sender, EventArgs e)
{
int index = listView1.SelectedIndices[0];
MessageBox.Show(index.ToString(), "Index");
Guid[] guids = devices[index].InstalledServices;
foreach (Guid guid in guids)
{
getServiceRecords(devices[index], guid);
}
getServiceRecords(devices[index], BluetoothService.ObexFileTransfer);
getServiceRecords(devices[index], BluetoothService.PublicBrowseGroup);
}
private void getServiceRecords(BluetoothDeviceInfo device, Guid serviceToFind)
{
MessageBox.Show(serviceToFind.ToString(), "SGUID");
try
{
ServiceRecord[] records = device.GetServiceRecords(serviceToFind);
MessageBox.Show(records.Length.ToString(), "Got SR");
foreach (ServiceRecord record in records)
{
Byte[] b = record.ToByteArray();
MessageBox.Show(BitConverter.ToString(b), serviceToFind.ToString());
}
}
catch (System.Net.Sockets.SocketException sex)
{
MessageBox.Show(sex.ErrorCode.ToString() + " \n" + sex.NativeErrorCode, "Ex Code");
if (sex.ErrorCode == 10108)
{
// Due to no records result.
MessageBox.Show("No records [WSASERVICE_NOT_FOUND].", "Err");
}
else
{
MessageBox.Show("GetSvcRcds ex: " + sex.Message + "\n" + sex.ErrorCode + "\n" + sex.InnerException, "Err2");
}
}
}
The client mobile is the C600 and the mobile with the services is a C500. I am at a loss as to what to do now.
The error codes are:
6 on the first run then 10022 every time after that. the message for both is : Could not find resource assembly