×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Error opening port in Symbian S60 3rd edition FP1

    Hi

    I am trying to Read Write Data on Ports in Symbian S60 3RD EDITION FP1
    BUT THE CODE LEAVE WITH ERROR CODE -4 WHEN I TRY TO OPEN THE PORT....
    PLEASE HELP..
    THANKS IN ADVANCE
    GAURAV GUPTA

    void CRWPorts::testPorts()
    {
    // KillFaxModemProcess();

    _LIT(CSYMOD, "ECACM");
    _LIT(KACMPort1, "ACM::1");
    TInt ret = StartC32();

    if ( ret != KErrNone && ret != KErrAlreadyExists )
    {
    console->Printf(_L("RET\n"));
    User::Leave ( ret );
    console->Printf(_L("after RET\n"));
    }
    RCommServ server;

    User::LeaveIfError( server.Connect() );
    // Load CSY Module

    User::LeaveIfError( server.LoadCommModule( CSYMOD ) );

    TBuf16<KMaxPortName> portName;
    portName.Copy( KACMPort1 );
    // Open the comm. port
    RComm commPort;

    User::LeaveIfError( commPort.Open( server, portName, ECommShared ) ); // CODE LEAVES HERE
    // Verify capabilities of the port and configure it
    TCommCaps portCaps;
    commPort.Caps( portCaps );
    if (((portCaps().iRate & KCapsBps115200) == 0) |
    ((portCaps().iDataBits & KCapsData8) == 0) |
    ((portCaps().iStopBits & KCapsStop1) == 0) |
    ((portCaps().iParity & KCapsParityNone) == 0))
    {
    User::Leave( KErrNotSupported );
    }
    TCommConfig portCfg;
    commPort.Config( portCfg );
    portCfg().iRate = EBps115200;
    portCfg().iParity = EParityNone;
    portCfg().iDataBits = EData8;
    portCfg().iStopBits = EStop1;
    portCfg().iHandshake = 0;
    User::LeaveIfError( commPort.SetConfig( portCfg ) );
    commPort.Write(aStatus,_L8("Hello World"));

    console->Printf(_L("DAta sent"));
    User::After(3000000);
    TBuf8<20> iData;
    commPort.ReadOneOrMore(aStatus,iData);
    TBuf<20>iPrintData;
    iPrintData.Copy(iData);
    console->Printf(_L("data : %S"),&iPrintData);


    }

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Error opening port in Symbian S60 3rd edition FP1

    I found your other similar thread. Please do not start multiple thread for same question.

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

  3. #3
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    hi savaj sir
    Nobody gave me the solution on that thread so i thought that i should start a new one. could u please help on that...
    thanks in advance
    gaurav gupta

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Error opening port in Symbian S60 3rd edition FP1

    Socket server returns error -4 (KErrNoMemory) if there is any attempt to create a further connection through the socket server.

    Read this article and check whether samething is happening with comms server???
    http://wiki.forum.nokia.com/index.ph...cation_failure

  5. #5
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error writing on port in Symbian S60 3rd edition FP1

    Hi all
    i am able to open the port but when i write over it the code leaves..

    thanks

    Gaurav Gupta

    TInt ret = StartC32();
    if ( ret != KErrNone && ret != KErrAlreadyExists )
    {
    User::Leave ( ret );
    }

    TInt r=iCommServ.Connect();
    if(r==KErrNone)
    r=iCommServ.LoadCommModule(CSYMOD);
    console->Printf(_L("r "));
    // // OPEN
    //
    r= iCommPort.Open(iCommServ,_L("ACM::1"),ECommExclusive);

    console->Printf(_L("Ready"));
    console->Getch();
    iCommPort.Write(iStatus,_L8("hello0000"));

  6. #6
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Error opening port in Symbian S60 3rd edition FP1

    What is the panic code??? Have you implemented active object???

  7. #7
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    HI savaj sir

    i have tried both way .
    1 when i implement AO then there is no response ... application hangs
    2 when i dont implement AO then code leaves
    Plz help
    regards
    Gaurav Gupta

  8. #8
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Error opening port in Symbian S60 3rd edition FP1

    Quote Originally Posted by gaurav.gupta View Post
    NO when i implement active objects then code does not leaves..but again there is no activity then,,,
    Since RComm::Write() is asynchronous method, either you have to implement active object or use User::WaitForRequest(TRequestStatus &aStatus).

  9. #9
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    HI savaj sir


    but when i am writing on the port it is not going into RunL
    where i hv written the code of reading the data ...
    Plz help
    regards
    Gaurav Gupta

  10. #10
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    Quote Originally Posted by savaj View Post
    Since RComm::Write() is asynchronous method, either you have to implement active object or use User::WaitForRequest(TRequestStatus &aStatus).
    Sir As it is a asynchronous method .. then its RunL should be called as i am writing on data on port .. but nothing happens....

  11. #11
    Registered User
    Join Date
    Dec 2006
    Location
    London
    Posts
    41

    Re: Error opening port in Symbian S60 3rd edition FP1

    Hi,

    Have you tried using User::WaitForRequest instead of an AO? This is a bit more straightforward, just for checking purposes.

    Let us know what happens,

  12. #12
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    hi bdonegan
    no i have not tried User::waitforRequest.. as i have never used...
    how should i do that ..
    before writingto port...
    for eg ...

    User::WaitforRequest(iStatus);
    iCommPort.Write(iStatus,_L8("hello0000"));

    or where i am calling the function in which i am connecting to ports...

  13. #13
    Registered User
    Join Date
    Dec 2006
    Location
    London
    Posts
    41

    Re: Error opening port in Symbian S60 3rd edition FP1

    Just after you call the asynchronous function:

    TRequestStatus status;
    iCommPort.Write(status,_L8("hello0000");
    User::WaitForRequest(status);

    When it returns (if it does) you can check status.iInt for the error code. If it does return then you might not be using active objects correctly.

  14. #14
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: Error opening port in Symbian S60 3rd edition FP1

    hi
    This is the code that i am using to write to ports:
    but the moment it reaches write method code leaves ..
    plz help....
    Regards
    Gaurav Gupta


    _LIT(CSYMOD, "ECACM");
    _LIT(KACMPort1, "ACM::1");

    TInt ret = StartC32();
    if ( ret != KErrNone && ret != KErrAlreadyExists )
    {
    User::Leave ( ret );
    }

    TInt r=iCommServ.Connect();
    if(r==KErrNone)
    r=iCommServ.LoadCommModule(CSYMOD);

    r= iCommPort.Open(iCommServ,_L("ACM::1"),ECommExclusive);

    TRequestStatus aStatus;
    iCommPort.Write(aStatus,_L8("hello0000")); //code leaves here
    User::WaitForRequest(aStatus);
    [/SIZE][/SIZE]

  15. #15
    Registered User
    Join Date
    Apr 2009
    Posts
    12

    Re: Error opening port in Symbian S60 3rd edition FP1

    Hi gaurav,

    Really good font size. Someone from 100 miles away can read your post, even i think blind man can also able to read your post. really good.

    Regards,
    S.

Similar Threads

  1. How can i get Symbian OS v9.3 S60 3rd Edition
    By aamitgupta in forum Symbian Tools & SDKs
    Replies: 28
    Last Post: 2012-04-06, 14:29
  2. S60 3rd Edition FP1 and S60 3rd Edition v1.1.FP2
    By nadiuska in forum Mobile Java Tools & SDKs
    Replies: 9
    Last Post: 2009-04-09, 00:58
  3. Replies: 0
    Last Post: 2009-04-06, 09:19
  4. Python for S60 1.9.2 released
    By tvijayan in forum Symbian
    Replies: 26
    Last Post: 2009-03-11, 09:28

Posting Permissions

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