.NET Components for Mobility

getServiceRecords returns error code

Last post 12-13-2006 9:25 PM by Anonymous. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-11-2006 10:08 PM

    • ds-76
    • Not Ranked
    • Joined on 12-11-2006
    • Posts 0

    getServiceRecords returns error code

    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
     

    Filed under: , ,
  • 12-13-2006 9:25 PM In reply to

    Re: getServiceRecords returns error code

    This error is raised only in .NET CF1.

    CF2 works normal.

    Please, can you fix it?

Page 1 of 1 (2 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.