30#if defined(APPMESSAGE_HAS_PHONE)
31#define OUTBOX_PHONE_SLOTS 1
33#define OUTBOX_PHONE_SLOTS 0
35#if defined(APPMESSAGE_HAS_MUSIC)
36#define OUTBOX_MUSIC_SLOTS 1
38#define OUTBOX_MUSIC_SLOTS 0
42#define OUTBOX_QUEUE_MAX (6 + OUTBOX_PHONE_SLOTS + OUTBOX_MUSIC_SLOTS)
117 for (
int i = 0; i < outbox->
queue_len; i++)
164 for (
int i = 1; i < outbox->
queue_len; i++)
Which of the phone's optional features a face has, worked out from the message keys it declares....
static void outbox_hold_failed(OutboxQueue *outbox, OutboxJob job)
Hold a nacked job for the next pass, if it still has retries.
Definition outbox_queue.h:213
static bool outbox_push(OutboxQueue *outbox, OutboxKind kind, int retries)
Add a job to the work queue unless its kind is already pending.
Definition outbox_queue.h:144
OutboxKind
What an outbox job sends.
Definition outbox_queue.h:48
static bool outbox_busy(const OutboxQueue *outbox)
Whether anything is in flight, which is what says the outbox is busy.
Definition outbox_queue.h:88
static int outbox_retry_pass(OutboxQueue *outbox)
Move the whole failed set back into the work queue for another pass.
Definition outbox_queue.h:236
static bool outbox_pending(const OutboxQueue *outbox, OutboxKind kind)
Whether this kind is already somewhere in the outbox.
Definition outbox_queue.h:103
static void outbox_clear(OutboxQueue *outbox)
Forget everything waiting, for a phone that is no longer there.
Definition outbox_queue.h:262
static void outbox_take_head(OutboxQueue *outbox)
Take the head of the queue as the job now in flight.
Definition outbox_queue.h:183
static void outbox_pop_front(OutboxQueue *outbox)
Drop the front job off the work queue, shifting the rest forward.
Definition outbox_queue.h:162
static OutboxJob outbox_release(OutboxQueue *outbox)
Mark whatever was in flight as settled, whichever way it went.
Definition outbox_queue.h:200
#define OUTBOX_QUEUE_MAX
Most jobs the work queue or the failed set holds at once.
Definition outbox_queue.h:42
@ OUTBOX_STOCK
A stock request.
Definition outbox_queue.h:53
@ OUTBOX_CALENDAR
A calendar request.
Definition outbox_queue.h:54
@ OUTBOX_FRESH
The short settings reply, only whether the watch booted with nothing saved.
Definition outbox_queue.h:52
@ OUTBOX_MUSIC
A now playing request.
Definition outbox_queue.h:56
@ OUTBOX_SETTINGS
The settings reply.
Definition outbox_queue.h:51
@ OUTBOX_NONE
The zero value, so a default-initialized job slot reads as nothing rather than a real request.
Definition outbox_queue.h:49
@ OUTBOX_WEATHER
A weather request.
Definition outbox_queue.h:50
@ OUTBOX_PHONE
A phone battery request.
Definition outbox_queue.h:55
One job waiting to go out, or already in flight.
Definition outbox_queue.h:63
OutboxKind kind
What this job sends.
Definition outbox_queue.h:64
int retries_left
Retry passes left after a failed send.
Definition outbox_queue.h:65
Everything the outbox is holding: what is waiting, what nacked, and what is out.
Definition outbox_queue.h:74
OutboxJob queue[OUTBOX_QUEUE_MAX]
This pass's work queue, oldest first.
Definition outbox_queue.h:75
OutboxJob inflight
The job in flight, OUTBOX_NONE when nothing is out.
Definition outbox_queue.h:79
int failed_len
How many jobs are in the failed set.
Definition outbox_queue.h:78
OutboxJob failed[OUTBOX_QUEUE_MAX]
Requests that nacked this pass, held for the next.
Definition outbox_queue.h:77
int queue_len
How many jobs are in the queue.
Definition outbox_queue.h:76