mirror of
https://github.com/eclipse/wakaama.git
synced 2025-05-08 23:31:37 +08:00
Add send callback to lwm2mserver example
The send callback has been added to the server example to demonstrate its use.
This commit is contained in:
parent
7761974462
commit
975b5a29b7
@ -984,20 +984,22 @@ static void prv_monitor_callback(lwm2m_context_t *lwm2mH, uint16_t clientID, lwm
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#ifndef LWM2M_VERSION_1_0
|
||||
static void prv_reporting_send_callback(lwm2m_context_t *lwm2mH, uint16_t clientID, lwm2m_uri_t *uriP, int status,
|
||||
block_info_t *block_info, lwm2m_media_type_t format, uint8_t *data,
|
||||
size_t dataLength, void *userData) {
|
||||
lwm2m_client_t *clientP;
|
||||
|
||||
/* unused parameter */
|
||||
(void)userData;
|
||||
|
||||
fprintf(stdout, "\r\nClient #%d send.\r\n", clientID);
|
||||
output_data(stdout, block_info, format, data, dataLength, 1);
|
||||
clientP = (lwm2m_client_t *)LWM2M_LIST_FIND(lwm2mH->clientList, clientID);
|
||||
|
||||
fprintf(stdout, "\r\nSend callback called with status: %d.\r\n", status);
|
||||
prv_dump_client(clientP);
|
||||
|
||||
fprintf(stdout, "\r\n> ");
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void prv_quit(lwm2m_context_t *lwm2mH,
|
||||
char * buffer,
|
||||
@ -1168,6 +1170,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stdout, "> "); fflush(stdout);
|
||||
|
||||
lwm2m_set_monitoring_callback(lwm2mH, prv_monitor_callback, NULL);
|
||||
lwm2m_reporting_set_send_callback(lwm2mH, prv_reporting_send_callback, NULL);
|
||||
|
||||
#ifndef LWM2M_VERSION_1_0
|
||||
lwm2m_reporting_set_send_callback(lwm2mH, prv_reporting_send_callback, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user