# FcmDataHandler function, size of received data

**URL:** <https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649>\
**Category:** Open AT\
**Created:** [September 18, 2009, 10:26am UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649 "2009-09-18T10:26:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomb](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@tomb](https://forum.sierrawireless.com/u/tomb)\
**Post date:** [September 18, 2009, 10:26am UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649/1 "2009-09-18T10:26:00Z")

</div>

Hello, I have read in ADL doc(page 105) that ‘Data’ argument in FcmDataHandler() for UART is 120 bytes.

```auto
bool FcmDataHandler (u16 DataLen, u8 * Data){

    ascii buff123[200];
    ascii buff_num[6];

    wm_strcpy(buff123,"MSG#:");
    wm_sprintf (buff_num, "No %d",DataLen);
    wm_strncat(buff123,buff_No, 6);    

    wm_strncat(buff123,(ascii *) (Data), (u16)DataLen);
    return TRUE;
}
```

But I am expecting to received 200 characters on UART. And DataLen is always 56 characters. the rest 144 characters are missing.

How do I buffer this 200 using this functions? I don’t understand this credits mention in documentation.

Can someone give example?

BR  
Tom

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [September 18, 2009, 11:00am UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649/2 "2009-09-18T11:00:59Z")

</div>

> [@tomb](#):
>
> Hello, I have read in ADL doc(page 105)

Page numbers are meaningless without knowing the specific version of the document.

> [@](#):
>
> that ‘Data’ argument in FcmDataHandler() for UART is 120 bytes.

I’m sure it doesn’t say that!

> [@](#):
>
> But I am expecting to received 200 characters on UART. And DataLen is always 56 characters. the rest 144 characters are missing.

They should be delivered in subsequent events…

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [September 18, 2009, 12:18pm UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649/3 "2009-09-18T12:18:27Z")

</div>

Hiya,

> [@tomb](#):
>
> I have read in ADL doc(page 105) that ‘Data’ argument in FcmDataHandler() for UART is 120 bytes.

It says (in ADL guide for R7.4) that 120 bytes is the maximum buffer size.

There’s no guarantee that there will be this many bytes in the data packet - only that there won’t be any more than this. As awneil says, additional data will be delivered in subsequent events.

OpenAT is an Event Driven API - you have to deal with asynchronous events as they arrive and keep checking until the API says that there’s no more {data or events}. You can’t assube that if you send 200 bytes that it will all be there at the same time. You may even get the data one byte per event (yep, it happened to me on a slow link).

Also, make sure that you’re using RS232 flow control on your UART device. If not, you may simple lose data when the Wavecom module can’t accept any more (for whatever reason).

ciao, Dave

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [September 18, 2009, 12:40pm UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649/4 "2009-09-18T12:40:18Z")

</div>

> [@davidc](#):
>
> There’s no guarantee that there will be this many bytes in the data packet - only that there won’t be any more than this. As awneil says, additional data will be delivered in subsequent events.

In fact, the ADL User Guide, v6.11, itself says it quite clearly:

> [@ADL User Guide](#):
>
> If data size to be received by the Open AT® application exceeds this maximum packet size, data will be segmented by the Flow Control Manager, which will call several times the Data Handlers with the segmented packets.

Reference: WM\_DEV\_OAT\_UGD\_080  
Revision: 004  
Date: October 14, 2008

In that revision, it’s on page 98/449.

---

<div class="post-metadata">

**Author:** ![tomb](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@tomb](https://forum.sierrawireless.com/u/tomb)\
**Post date:** [November 13, 2009, 2:54pm UTC](https://forum.sierrawireless.com/t/fcmdatahandler-function-size-of-received-data/3649/5 "2009-11-13T14:54:15Z")

</div>

Thanks for answers.  
I did as you said, and it is working.  
Thanks davidc for advice for using RS232 flow control on your UART. I am going to implement this as well in order to not to lose any data.

BR/  
Tom
