Reworked AT queuing, with queues for send, recv, async recv and sync recv
[hayes-ril.git] / hayes-ril.c
index ff36106..4617cda 100644 (file)
@@ -96,17 +96,19 @@ void *ril_dispatch(void *data)
                        if(response == NULL)
                                break;
 
-                       if(response->command == NULL) {
-                               at_response_free(response);
-                               continue;
-                       }
-
                        // Dequeue works now
                        if(i != 5)
                                i = 5;
 
-                       rc = at_response_expect_to_func(response);
+                       // Handle async
+                       rc = at_async_response_dequeue(response);
                        if(rc < 0) {
+                               // Handle UNSOL
+                               if(response->command == NULL) {
+                                       at_response_free(response);
+                                       continue;
+                               }
+
                                for(j=0 ; j < ril_globals.dispatch_unsol_count ; j++) {
                                        if(at_commands_compare(response->command, ril_globals.dispatch_unsol[j].command) && ril_globals.dispatch_unsol[j].func != NULL) {
                                                ril_globals.dispatch_unsol[j].func(response);
@@ -152,7 +154,7 @@ void ril_globals_init(void)
 
        ril_globals.radio_state = RADIO_STATE_OFF;
 
-       at_responses_handling_init();
+       at_handling_init();
 }
 
 const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv)