My question is: Astream_NewData presumably interrupts whatever else is going on. Does it run at the end of the running Sub, or at the end of the running program command line? Or at some other point?
My program creates a queue of commands in a SQLite database (database initialized in Starter activity). These commands are sent via Bluetooth. Bluetooth Serial is initialized in a service. Every Bluetooth command gets a response which is processed, then the next command is sent.
The main activity might use a For...Next loop which generates, say 500 commands. The first one is sent as it is created then subsequent commands are sent as the previous reply is received.
This means that commands are being created, sent and replied to and processed concurrently. Commands typically get a response after 150mS. The next command seems to get sent about 20mS after the last one is received.
All generally works well but every few hundred commands there is a blip when things seem to get out of sync. I do not intentionally send any command until I have received and processed the previous one.
My question is: Astream_NewData presumably interrupts whatever else is going on. Does it run at the end of the running Sub, or at the end of the running program command line? Or at some other point?
My program creates a queue of commands in a SQLite database (database initialized in Starter activity). These commands are sent via Bluetooth. Bluetooth Serial is initialized in a service. Every Bluetooth command gets a response which is processed, then the next command is sent.
The main activity might use a For...Next loop which generates, say 500 commands. The first one is sent as it is created then subsequent commands are sent as the previous reply is received.
This means that commands are being created, sent and replied to and processed concurrently. Commands typically get a response after 150mS. The next command seems to get sent about 20mS after the last one is received.
All generally works well but every few hundred commands there is a blip when things seem to get out of sync. I do not intentionally send any command until I have received and processed the previous one.
My question is: Astream_NewData presumably interrupts whatever else is going on. Does it run at the end of the running Sub, or at the end of the running program command line? Or at some other point?