int record_fd;
gboolean in_read_handler;
gboolean destroyed;
+ gboolean wakeup_sent;
+ gboolean start_frame_marker;
gboolean no_carrier_detect;
GAtSuspendFunc suspend_func;
gpointer suspend_data;
GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
{
GAtHDLC *hdlc;
- unsigned char *buf;
struct ring_buffer* write_buffer;
if (io == NULL)
g_queue_push_tail(hdlc->write_queue, write_buffer);
- /* Write an initial 0x7e as wakeup character */
- buf = ring_buffer_write_ptr(write_buffer, 0);
- *buf = HDLC_FLAG;
- ring_buffer_write_advance(write_buffer, 1);
-
hdlc->decode_buffer = g_try_malloc(BUFFER_SIZE);
if (!hdlc->decode_buffer)
goto error;
i = 0;
buf = ring_buffer_write_ptr(write_buffer, 0);
+ if (hdlc->start_frame_marker == TRUE) {
+ /* Protocol requires 0x7e as start marker */
+ *buf++ = HDLC_FLAG;
+ pos++;
+ } else if (hdlc->wakeup_sent == FALSE) {
+ /* Write an initial 0x7e as wakeup character */
+ *buf++ = HDLC_FLAG;
+ pos++;
+ hdlc->wakeup_sent = TRUE;
+ }
+
while (pos < avail && i < size) {
if (escape == TRUE) {
fcs = HDLC_FCS(fcs, data[i]);
if (pos + 1 > avail)
return FALSE;
+ /* Add 0x7e as end marker */
*buf = HDLC_FLAG;
pos++;
return TRUE;
}
+void g_at_hdlc_set_start_frame_marker(GAtHDLC *hdlc, gboolean marker)
+{
+ if (hdlc == NULL)
+ return;
+
+ hdlc->start_frame_marker = marker;
+}
+
void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect)
{
if (hdlc == NULL)
GAtIO *g_at_hdlc_get_io(GAtHDLC *hdlc);
+void g_at_hdlc_set_start_frame_marker(GAtHDLC *hdlc, gboolean marker);
void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect);
void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,