×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    23

    S603rd BluetoothPMPExample - does not work after changes

    Hi all,

    I have followed instruction
    Debugging Symbian S60 with Carbide C++ Express and NCF 1.2 Bluetooth
    http://discussion.forum.nokia.com/fo...ad.php?t=88537

    and I modified CListener::SetSecurityL
    void CListener::SetSecurityL(TInt aChannel)
    {
    TRequestStatus status;
    RBTMan secManager;
    TBTServiceSecurity secSettings;
    TBTSockAddr listeningAddress;
    // Set the Port to listen to.
    listeningAddress.SetPort( aChannel );
    // setup security
    TUid settingsUID;
    settingsUID.iUid = KBT_serviceID;
    secSettings.SetUid(settingsUID);
    secSettings.SetAuthentication(EFalse);
    secSettings.SetAuthorisation(EFalse);
    secSettings.SetEncryption(EFalse);
    secSettings.SetDenied(EFalse);
    // register settings with security
    // Attach the security settings.
    listeningAddress.SetSecurity(secSettings);
    }
    but example app does not work.

    If I select "Discover devices" I got "Unable to execute file for security reason"
    I added "NetworkServices" and "ReadUserdata" capabilities.

    Most interesting that if I select "Start Slave" application crashes without any error message.

    What capabilities requires TBTServiceSecurity?
    What causes application to crash?

    Zdenko

  2. #2
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    185

    Re: S603rd BluetoothPMPExample - does not work after changes

    Hi, use the following cabs:
    CAPABILITY LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices

    Change the following:
    void CListener::StartListenerL(TInt& aChannel)
    {
    // get out if we're already running..
    if ( iState!=ENone )
    {
    User::Leave(KErrInUse);
    }

    // set this active object to connecting state
    iState=EConnecting;

    // load protocol, RFCOMM
    TProtocolDesc pdesc;
    User::LeaveIfError(iSocketServ.FindProtocol(KRfComm(), pdesc));

    // open a socket
    User::LeaveIfError(
    iListenSock.Open(iSocketServ,
    pdesc.iAddrFamily,pdesc.iSockType,KRFCOMM)
    );

    // get listening channel
    User::LeaveIfError(iListenSock.GetOpt(KRFCOMMGetAvailableServerChannel,
    KSolBtRFCOMM, aChannel));

    // bluetooth socket address object
    TBTSockAddr btsockaddr;
    btsockaddr.SetPort(aChannel);
    // bind socket
    User::LeaveIfError(iListenSock.Bind(btsockaddr));
    // listen on port
    iListenSock.Listen(KSizeOfListenQueue);

    //now set security

    //old way to set security is in Listener.cpp
    //CListener::SetSecurityL(TInt aChannel)
    TBTServiceSecurity secSettings;

    TUid settingsUID;
    settingsUID.iUid = KBT_serviceID;
    secSettings.SetUid(settingsUID);
    //the old way involved the following two steps:
    //secSettings.SetChannelID(aChannel);
    //secSettings.SetProtocolID(KSolBtRFCOMM);
    secSettings.SetAuthentication(EFalse);
    secSettings.SetAuthorisation(EFalse);
    secSettings.SetEncryption(EFalse);

    // attach the security settings.
    btsockaddr.SetSecurity(secSettings);

    // close old accepted socket if open
    iSock.Close();

    // open blank socket and pass it to accept to be assigned a proper
    // socket upon completion of Accept()
    User::LeaveIfError(iSock.Open(iSocketServ));

    // set to accept incoming connections, active object will handle
    iListenSock.Accept(iSock,iStatus);
    SetActive();
    }

    Works for me. There will be an updated version soon of BT PMP example which will support 3rd edition.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    17

    Re: S603rd BluetoothPMPExample - does not work after changes

    thanks so much pkosonen, for that reply, i wanted to ask you why the bluetoothpmpexample doest create the sys file when i compile it?

    It's the same project that is on the nokia website

    i am using s60 3d edition

    thanks for any tip

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: S603rd BluetoothPMPExample - does not work after changes

    In what environment do you compile it, and how?

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    17

    Re: S603rd BluetoothPMPExample - does not work after changes

    Hi, thanks for the reply, i am working on carbide c/c++, i did the change that pkosonen told me and i still have the same error, it says "Unable to execute file, for security reasons"

    And what pkosonen means with
    "Hi, use the following cabs:
    CAPABILITY LocalServices UserEnvironment ReadUserData WriteUserData NetworkServices"

    Any thoughts?

    Thanks so much

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    17

    Re: S603rd BluetoothPMPExample - does not work after changes

    if it is necesarry i have this two methods

    void CListener::StartListenerL(TInt& aChannel)
    {
    // get out if we're already running..
    if ( iState!=ENone )
    {
    User::Leave(KErrInUse);
    }

    // set this active object to connecting state
    iState=EConnecting;

    // load protocol, RFCOMM
    TProtocolDesc pdesc;
    User::LeaveIfError(iSocketServ.FindProtocol(KRfComm(), pdesc));

    // open a socket
    User::LeaveIfError(
    iListenSock.Open(iSocketServ,
    pdesc.iAddrFamily,pdesc.iSockType,KRFCOMM)
    );

    // get listening channel
    User::LeaveIfError(iListenSock.GetOpt(KRFCOMMGetAvailableServerChannel,
    KSolBtRFCOMM, aChannel));

    // bluetooth socket address object
    TBTSockAddr btsockaddr;
    btsockaddr.SetPort(aChannel);
    // bind socket
    User::LeaveIfError(iListenSock.Bind(btsockaddr));
    // listen on port
    iListenSock.Listen(KSizeOfListenQueue);

    //now set security

    //old way to set security is in Listener.cpp
    //CListener::SetSecurityL(TInt aChannel)
    TBTServiceSecurity secSettings;

    TUid settingsUID;
    settingsUID.iUid = KBT_serviceID;
    secSettings.SetUid(settingsUID);
    //the old way involved the following two steps:
    //secSettings.SetChannelID(aChannel);
    //secSettings.SetProtocolID(KSolBtRFCOMM);
    secSettings.SetAuthentication(EFalse);
    secSettings.SetAuthorisation(EFalse);
    secSettings.SetEncryption(EFalse);

    // attach the security settings.
    btsockaddr.SetSecurity(secSettings);

    // close old accepted socket if open
    iSock.Close();

    // open blank socket and pass it to accept to be assigned a proper
    // socket upon completion of Accept()
    User::LeaveIfError(iSock.Open(iSocketServ));

    // set to accept incoming connections, active object will handle
    iListenSock.Accept(iSock,iStatus);
    SetActive();

    }


    // ----------------------------------------------------------------------------
    // CListener::SetSecurityL(TInt aChannel)
    //
    // sets the security of given bluetooth channel. these settings will turn
    // off authentication, authorisation and encryption on given channel.
    // ----------------------------------------------------------------------------
    void CListener::SetSecurityL(TInt aChannel)
    {

    // setup channel security
    TRequestStatus status;
    RBTMan secManager;

    RBTSecuritySettings secDatabase;
    TBTServiceSecurity secSettings;
    // connect to security manager
    User::LeaveIfError(secManager.Connect());
    CleanupClosePushL(secManager);
    User::LeaveIfError(secDatabase.Open(secManager));
    CleanupClosePushL(secDatabase);
    // setup security
    TUid settingsUID;
    settingsUID.iUid = KBT_serviceID;
    secSettings.SetUid(settingsUID);
    secSettings.SetChannelID(aChannel);
    secSettings.SetProtocolID(KSolBtRFCOMM);
    secSettings.SetAuthentication(EFalse);
    secSettings.SetAuthorisation(EFalse);
    secSettings.SetEncryption(EFalse);
    // register settings with security
    secDatabase.RegisterService(secSettings, status);
    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy(2,&secManager);//SecDatabase, secManager

    }

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: S603rd BluetoothPMPExample - does not work after changes

    I am not sure if anyone has tested this example with NCF... Also note that now it is 2008, and the most recent BTPMP example has just been released 1-2 months ago. Pkosonen's suggestions from 2006 might not be really valid for it.
    However I am not sure about your security warning, since it should not appear (the CAPABILITY line is already present in the .mmp file - if it is not, you might have picked a wrong .mmp).

Similar Threads

  1. Replies: 2
    Last Post: 2004-04-27, 10:36
  2. CommConnection does not work with Series 60 SDK, but works in JWT
    By jackiechan2001 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2004-02-04, 09:07
  3. Does SDK v2.0 work on Series60 V6.1?
    By liying in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2004-02-02, 08:57
  4. does irda function work with the emulator ?
    By IGhost in forum Symbian
    Replies: 0
    Last Post: 2002-12-07, 17:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×