add get_message_id stub

This commit is contained in:
Tomasz Moń
2009-03-03 11:46:28 +01:00
parent baa3829263
commit eb48d0b9d2

14
gdigi.c
View File

@@ -195,6 +195,14 @@ static void send_message(gint procedure, gchar *data, gint len)
g_string_free(msg, TRUE); g_string_free(msg, TRUE);
} }
static gint get_message_id(GString *msg)
{
if (msg->len > 7) {
return (u_char)msg->str[7];
}
return -1;
}
/* /*
id - ID as found in preset file id - ID as found in preset file
position - Position as found in preset file position - Position as found in preset file
@@ -372,7 +380,11 @@ GStrv query_preset_names(guint bank)
send_data(command, sizeof(command)); send_data(command, sizeof(command));
/* read reply */ /* read reply */
data = read_data(); do {
if (data)
g_string_free(data, TRUE);
data = read_data();
} while (get_message_id(data) != RECEIVE_PRESET_NAMES);
if (data != NULL) { if (data != NULL) {
char preset_reply_magic[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x22, 0x00, 0x01}; char preset_reply_magic[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x22, 0x00, 0x01};