×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Question RComm::Write()->Not able to write 259 bytes at a time

    Hi,

    I am using RComm::Write() to download files to COM POrt. When I try to write 259 butes at a time, it only writes 3 bytes.
    But writing 55 bytes was successful.

    I had set receive buffer length to 4096bytes
    commPort.SetReceiveBufferLength (4096);

    Any one had faced this probelm??

    Thanks in advance
    Chandru

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,673

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Can it happen that you use some TUint8 or TInt8 variable and/or do some "& 255" or "& 0xFF" stuff for some reason? Note that 259=256+3.
    Post some code snippets.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Here is code snippet....


    RComm commPort;
    commPort.Config (portSettings);
    portSettings ().iRate = EBps115200;
    portSettings ().iParity = EParityNone;
    portSettings ().iDataBits = EData8;
    portSettings ().iStopBits = EStop1;
    portSettings ().iFifo = EFifoEnable;
    if (handshakingMode == '2')
    portSettings ().iHandshake = (KConfigObeyXoff | KConfigSendXoff); // for xon/xoff
    else if (handshakingMode == '1')
    portSettings ().iHandshake = (KConfigObeyCTS | KConfigFreeRTS); // for cts/rts
    else
    portSettings ().iHandshake = KConfigFailDSR; // for no handshaking
    ..
    ..
    ..
    commPort.Write(iReadWriteStatus , iActivateInfo , aLen);
    User::WaitForRequest (iReadWriteStatus);

    aLen = 259 and iActivateInfo is TBuf8<260>

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

    Re: RComm::Write()->Not able to write 259 bytes at a time

    What is the type of aLen? Is it calculated somehow? How?
    Which 3 bytes are transferred? The first 3? The last 3? Something else?

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Hi,

    aLen is of type TUint8....
    iActivateInfo is TBuf8<260>

    aLen = iActivateInfo.Length(); // its value is 259 in my case..

    I can not make out... whether it is first 3 or last 3 bytes are written to the port....

    Suprisingly
    iReadWriteStatus.Int() is equal to 0 after commPort.Write(iReadWriteStatus , iActivateInfo , aLen); is called....

    Chandru

  6. #6
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Quote Originally Posted by wizard_hu_ View Post
    Can it happen that you use some TUint8 or TInt8 variable and/or do some "& 255" or "& 0xFF" stuff for some reason? Note that 259=256+3.
    This is exactly what is happening :) Make aLen a TInt and it should work
    Regards,
    ivey

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

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Thanks Ivey :-)

    A slight addition: I am almost sure that the compiler produces a warning about this. (Ok, I acknowledge that there are also some annoying warning messages originating in the SDK, and their lengthy appearance can cover the other messages a bit)

  8. #8
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Re: RComm::Write()->Not able to write 259 bytes at a time

    Thanks a lot .... Its working now...

    It was really surprising...... I did not imagine this could be the problem...:))

    Thanks any way...

Similar Threads

  1. Bizarre calendar/time zone change handling in Nokia 9500
    By noetus in forum General Development Questions
    Replies: 0
    Last Post: 2005-09-19, 19:27
  2. Log time bug on 3650. Help me please.
    By hemenkap in forum General Development Questions
    Replies: 2
    Last Post: 2005-06-30, 07:18
  3. Nokia 30 SMS sending problem !!!!!
    By pgredelj in forum General Messaging
    Replies: 1
    Last Post: 2004-01-12, 12:48
  4. Loading Image data from 'raw' bytes
    By LongSteve in forum Mobile Java General
    Replies: 2
    Last Post: 2002-11-20, 17:38
  5. SMS time stamp format with time zone parameter?
    By turunhe in forum General Messaging
    Replies: 1
    Last Post: 2002-06-11, 07:00

Posting Permissions

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