×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Red face Donot work IAP, Please Help me

    I created IAP below code, but Client can't connect to server used this AP I created.
    but If I created IAP via access point menu and using this IAP, A client can connect well.
    So I compared with IAP I created to IAP created via access point menu.
    but I didn't find different thing. I don't know what is the problem.
    If Anyone help me. I really appreciate it.

    I want to use IAP(OpenNetwork and AD-HOC).

    Create AccessPoint Code
    ---------------------------------------------------------
    void SerNetManager::CreateADHOCAP(const TDesC& aNetName)
    {
    enum TWEPKeyFormat
    {
    EAscII,
    EHexaDecimal
    };

    enum TWEPKeyInUse
    {
    EKeyNumber1,
    EKeyNumber2,
    EKeyNumber3,
    EKeyNumber4,
    };

    enum TWEPAuthentication
    {
    EAuthOpen,
    EAuthShared,
    };

    enum TWEPSecurityMode
    {
    E64bits,
    E128bits,
    E256bits,
    };

    TInt errorCode;

    CCommsDatabase* db = CCommsDatabase::NewL();
    CleanupStack::PushL(db);
    TInt err = db->BeginTransaction();

    // Create a wlan AP and fill its mandatory fields.
    CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC();
    CApAccessPointItem* wlanNewItem=CApAccessPointItem::NewLC();

    // Set Connection Name
    wlanAp->SetNamesL(_L("Adhoc"));

    // Set Data Bearer Type
    wlanAp->SetBearerTypeL(EApBearerTypeWLAN);

    // Set WLAN Network Name
    wlanAp->WriteTextL(EApWlanNetworkName, aNetName );
    // Give corrct Data as per the router configuration //L!nkSys@MdpNok!a


    //wlanAp->SetVpnAp(FALSE);

    //Security mode should be 2 for WEP network
    //1 for Open network
    //4 for E802_1x
    //8 for EWpa
    //16 for EWpa2
    wlanAp->WriteUint(EApWlanSecurityMode, 1);

    //Lan network mode should be 1 for infrastructure, 0 for adhoc
    wlanAp->WriteUint(EApWlanNetworkMode, 0);

    #if 0
    //Set ADHOC Channel
    wlanAp->WriteUint(EApWlanChannelId, 3);

    // Set IP address
    wlanAp->WriteTextL(EApWlanIpAddr, _L("168.254.89.89"));

    // Set Subnet Mask
    wlanAp->WriteTextL(EApWlanIpNetMask, _L("168.254.89.89"));

    // Set Gateway
    wlanAp->WriteTextL(EApWlanIpGateway, _L("168.254.89.89"));
    #endif

    // Store it into the iDb.
    TBool val =ETrue;
    TUint32 newalanid;
    TBuf<50> ibuff;

    CApDataHandler* handler = CApDataHandler::NewLC(*db);
    TUint32 apid;
    apid = handler->CreateFromDataL(*wlanAp);
    handler->UpdateAccessPointDataL(*wlanAp,val);
    handler->AccessPointDataL(apid,*wlanNewItem);
    wlanNewItem->ReadUint( EApIapServiceId, newalanid );
    wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff );


    #if 0
    TInt error;

    // Set Security Code
    TBuf8<50> keyData;
    //keyData.Copy(_L("12345"));
    keyData.Copy(_L("1234567890123"));


    TUint32 keyformat = EAscII;
    TUint32 KeyInUse = EKeyNumber1;
    TUint32 Authen = EAuthOpen;
    TUint32 SecuMode = E64bits;
    #endif

    CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC(
    TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid );

    errorCode = wLanServiceTable->GotoFirstRecord();

    if ( errorCode == KErrNone )
    {
    wLanServiceTable->UpdateRecord();
    }
    else
    {
    TUint32 dummyUid( KUidNone );
    User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
    // Save link to LAN service
    wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid );
    }


    #if 0

    // Save WepKey Index 0 -> WEPKEY1, 1 -> WEPKEY2, 2 -> WEPKEY3, 3 -> WEPKEY4
    TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ),
    KeyInUse ));

    //
    TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_AUTHENTICATION_MODE ),
    Authen ));

    TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ),
    keyformat ));

    TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_SECURITY_MODE ),
    SecuMode ));

    // Save first WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY1 ),
    keyData ));

    // Save second WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY2 ),
    keyData ));

    // Save third WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY3 ),
    keyData ));

    // Save fourth WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY4 ),
    keyData ));
    #endif


    wLanServiceTable->PutRecordChanges();
    err = db->CommitTransaction(); // End a transaction. Call after `InsertRecord()` or `UpdateRecord()`.
    CleanupStack::PopAndDestroy(5);

    }
    -------------------------------------------------------------------------------

    Have a GoodDay!!

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: Donot work IAP, Please Help me

    Hi,
    This forum is for the general discussion. There are various forum for specific programming language. You can get fast response if post your query in a specific Dibo.
    Jajal Mehul

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Donot work IAP, Please Help me

    This is your third thread for the same question. please do not start multiple thread for the same question.

    You already started this two tread.

    http://discussion.forum.nokia.com/fo...053#post577053

    http://discussion.forum.nokia.com/fo...d.php?t=165847

Similar Threads

  1. problem choosing default IAP using web application.
    By hitonly2008 in forum Symbian C++
    Replies: 0
    Last Post: 2009-04-16, 12:44
  2. Replies: 15
    Last Post: 2008-10-16, 09:51
  3. IAP selection in device..
    By deepchand86 in forum Symbian C++
    Replies: 8
    Last Post: 2008-10-14, 07:00
  4. IAP query
    By kumar_sai123 in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2008-07-21, 14:16
  5. Replies: 2
    Last Post: 2008-02-22, 11:49

Posting Permissions

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