×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Observing port by RComm::NotifyDataAvailable()

    Hi
    I want to observe a port on my device to notify when a data is available.
    I created and initialized a piece of code like below:
    Code:
       RComm iComm;
       RCommServ iCommServer;
       TCommConfig iConfig;
       .
       iCommServer.Connect();
       iCommServer.LoadCommModule(iCommPort.iCsy);
       iComm.Open ( iCommServer, iCommPort.iPort, ECommShared, ECommRoleDCE);
       .
       .
    and then when I execute the :
    Code:
     iComm.NotifyDataAvailable(iStatus);
    I get KERN-EXEC 0 panic.

    Do you know where is the problem?
    Thanks.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,021

    Re: Observing port by RComm::NotifyDataAvailable()

    The following three lines must have returned a code,if its something negative then problem lies there only.

    iCommServer.Connect();
    iCommServer.LoadCommModule(iCommPort.iCsy);
    iComm.Open ( iCommServer, iCommPort.iPort, ECommShared, ECommRoleDCE);

  3. #3
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Observing port by RComm::NotifyDataAvailable()

    The mentioned lines are encapsulated in User::LeaveIfError().
    I didnt write them for conciseness.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Observing port by RComm::NotifyDataAvailable()

    basically the KERN-EXEC 0 means that you are trying to use R-Class that is not initialized properly, i.e. the opening/connecting has failed for some reason, thus I would suggest re-debugging the code and seeing what line of code is actually giving that, and then seeing what has been done for thr R-Class object used in that line, and seeing all initialization has been done without errors.

  5. #5
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Observing port by RComm::NotifyDataAvailable()

    Hi
    the line
    Code:
    iComm.Open ( iCommServer, iCommPort.iPort, ECommShared, ECommRoleDCE);
    returns KErrLocked. Whats the reason?
    If i change the TCommRole parameter to ECommRoleDTE no error will be returned.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  6. #6
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Observing port by RComm::NotifyDataAvailable()

    Hi again
    Not getting any response, I decided to explain the situation more.
    I have a class which make it easy for me to write to and read from ports easily. In the factory function of this class i take a RCommServ object and a TCommPort object which were opened and configured before. For Example:
    Code:
    class MyPortClass : public CActive
    {
    public:
    static MyPortClass* NewL(MyPortClassObserver&, RCommServ&, TCommPort&);  
    void SendL(TDesC&);
    void ReceiveL(TDesC&);
    .
    .
    private:
    InitializeL(RCommServ&, TCommPort&);
    .
    RComm   iComm;
    .
    };
    In the InitilizeL() method I always get an error like KErrAccessDenied, KErrLocked,....
    The implementation of InitilizeL() is:
    Code:
    void MyPortClass::Initialize(RcommSer& aServer, TCommPort& aPort)
    {
       .
       // I always get an error here.
       User::LeaveIfError(iComm.Open(aServer, aPort.iPort, ECommShared, ECommRoleDCE));
       .
    }
    If I change the ECommRoleDCE to ECommRoleDTE the error would be solved.
    Whats the differences between these enumerators?
    Why I get KErrLocked when I opened the port by ECommShared?

    If I just create one instance of MyPortClass in my project, I get KErrAccessDenied and if I creat e more objects i get KErrLocked.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  7. #7
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Observing port by RComm::NotifyDataAvailable()

    I changed the code a bit.
    At present, Although the result of opening iComm object is 0, when I invoke iComm.Write(), I get KERN-EXEC 0 panic.
    What is the problem?
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  8. #8
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Observing port by RComm::NotifyDataAvailable()

    The RComm::Open() needs some CAPABILITIES like:
    NetworkControl
    NetworkServicies
    CommDD
    (I added LocalServicies but not sure it is mandatory).

    Unfortunately, I still can't use functions like RComm::Write() and RComm::Read() properly, Since the former never activate RunL() and the late returns with iStatus.Int() == KErrInUse.

    I wish someone could provide us with a class to easily write to and read from ports.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

Similar Threads

  1. problems with serial port (RComm)
    By red_shi in forum Symbian
    Replies: 5
    Last Post: 2010-08-19, 15:26
  2. Replies: 4
    Last Post: 2008-07-06, 17:58
  3. Serial and NotifyDataAvailable
    By hamssi in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-06-12, 09:15
  4. NotifyDataAvailable returns with -5
    By ehdgh32 in forum Symbian
    Replies: 2
    Last Post: 2007-06-04, 10:03
  5. problems writing to Comm Port (RComm)
    By pribhi in forum Symbian
    Replies: 8
    Last Post: 2007-04-18, 13:57

Posting Permissions

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