diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-04-27 23:37:53 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-28 17:27:35 -0500 |
commit | 41ce6212a1e03d4468f194edfcfce96b1675c1aa (patch) | |
tree | 81b37dd69c9058e5f689873a0e573dff2f01dbea /gatchat/gathdlc.c | |
parent | 7c6c72f558709d59da590d9b7d3f631d17b43abe (diff) | |
download | ofono-41ce6212a1e03d4468f194edfcfce96b1675c1aa.tar.bz2 |
gathdlc: Add receive ACCM support
Diffstat (limited to 'gatchat/gathdlc.c')
-rw-r--r-- | gatchat/gathdlc.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c index ebb693c1..06deb2d5 100644 --- a/gatchat/gathdlc.c +++ b/gatchat/gathdlc.c @@ -54,12 +54,29 @@ struct _GAtHDLC { guint16 decode_fcs; gboolean decode_escape; guint32 xmit_accm[8]; + guint32 recv_accm; GAtReceiveFunc receive_func; gpointer receive_data; GAtDebugFunc debugf; gpointer debug_data; }; +void g_at_hdlc_set_recv_accm(GAtHDLC *hdlc, guint32 accm) +{ + if (hdlc == NULL) + return; + + hdlc->recv_accm = accm; +} + +guint32 g_at_hdlc_get_recv_accm(GAtHDLC *hdlc) +{ + if (hdlc == NULL) + return 0; + + return hdlc->recv_accm; +} + static void new_bytes(GAtHDLC *hdlc) { unsigned int len = ring_buffer_len(hdlc->read_buffer); @@ -87,7 +104,8 @@ static void new_bytes(GAtHDLC *hdlc) hdlc->decode_fcs = HDLC_INITFCS; hdlc->decode_offset = 0; - } else { + } else if (*buf >= 0x20 || + (hdlc->recv_accm & (1 << *buf)) == 0) { hdlc->decode_buffer[hdlc->decode_offset++] = *buf; hdlc->decode_fcs = HDLC_FCS(hdlc->decode_fcs, *buf); } @@ -179,6 +197,7 @@ GAtHDLC *g_at_hdlc_new(GIOChannel *channel) hdlc->xmit_accm[0] = ~0U; hdlc->xmit_accm[3] = 0x60000000; /* 0x7d, 0x7e */ + hdlc->recv_accm = ~0U; hdlc->read_buffer = ring_buffer_new(BUFFER_SIZE); if (!hdlc->read_buffer) |