Context clues innit
This commit is contained in:
parent
93e4445f24
commit
f16908e7fb
5 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,7 @@ static void usage(int argc, char **argv) {
|
|||
}
|
||||
|
||||
static int answer_phone_version_message(skipstone_message_service *service,
|
||||
void *buf, uint16_t size, uint16_t id) {
|
||||
void *buf, uint16_t size, uint16_t id, void *context) {
|
||||
uint8_t response[13] = {
|
||||
1, 0xff, 0xff, 0xff, 0xff, 0x80, 0, 0, 0, 0, 0, 0, 0x32
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ static int answer_phone_version_message(skipstone_message_service *service,
|
|||
}
|
||||
|
||||
static int answer_media_message(skipstone_message_service *service,
|
||||
void *buf, uint16_t size, uint16_t id) {
|
||||
void *buf, uint16_t size, uint16_t id, void *context) {
|
||||
struct {
|
||||
uint8_t command;
|
||||
uint8_t artist_len;
|
||||
|
|
|
@ -11,7 +11,7 @@ static void usage(int argc, char **argv) {
|
|||
}
|
||||
|
||||
static int answer_phone_version_message(skipstone_message_service *service,
|
||||
void *buf, uint16_t size, uint16_t id) {
|
||||
void *buf, uint16_t size, uint16_t id, void *context) {
|
||||
uint8_t response[13] = {
|
||||
1, 0xff, 0xff, 0xff, 0xff, 0x80, 0, 0, 0, 0, 0, 0, 0x32
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ static int answer_phone_version_message(skipstone_message_service *service,
|
|||
}
|
||||
|
||||
static int answer_media_message(skipstone_message_service *service,
|
||||
void *buf, uint16_t size, uint16_t id) {
|
||||
void *buf, uint16_t size, uint16_t id, void *context) {
|
||||
struct {
|
||||
uint8_t command;
|
||||
uint8_t artist_len;
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef struct _skipstone_message_header {
|
|||
typedef struct _skipstone_message_service skipstone_message_service;
|
||||
|
||||
typedef int (skipstone_message_handler)(skipstone_message_service *service,
|
||||
void *buf, uint16_t size, uint16_t id);
|
||||
void *buf, uint16_t size, uint16_t id, void *context);
|
||||
|
||||
skipstone_message_service *skipstone_message_service_new();
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ int skipstone_message_service_run(skipstone_message_service *service,
|
|||
}
|
||||
|
||||
if ((endpoint = skipstone_map_get(service->endpoints, id)) != NULL) {
|
||||
if (endpoint->handler(service, buf, size, id) < 0) {
|
||||
if (endpoint->handler(service, buf, size, id, endpoint->context) < 0) {
|
||||
goto error_io;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ int skipstone_message_service_run(skipstone_message_service *service,
|
|||
}
|
||||
|
||||
if ((endpoint = skipstone_map_get(service->endpoints, id)) != NULL) {
|
||||
if (endpoint->handler(service, buf, size, id) < 0) {
|
||||
if (endpoint->handler(service, buf, size, id, endpoint->context) < 0) {
|
||||
goto error_io;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue