Changeset be15256 in mainline
- Timestamp:
- 2019-11-05T08:00:18Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b2d1df3
- Parents:
- b3c185b6
- git-author:
- Jiri Svoboda <jiri@…> (2019-10-04 19:00:15)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-11-05 08:00:18)
- Location:
- uspace/srv/hid/display
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/client.c
rb3c185b6 rbe15256 34 34 */ 35 35 36 #include <disp_srv.h>37 36 #include <errno.h> 38 37 #include <stdlib.h> … … 44 43 * 45 44 * @param display Parent display 45 * @param cb Client callbacks 46 * @param cb_arg Callback argument 46 47 * @param rclient Place to store pointer to new client. 47 48 * @return EOK on success, ENOMEM if out of memory 48 49 */ 49 errno_t ds_client_create(ds_display_t *display, d isplay_srv_t *srv,50 ds_client_t **rclient)50 errno_t ds_client_create(ds_display_t *display, ds_client_cb_t *cb, 51 void *cb_arg, ds_client_t **rclient) 51 52 { 52 53 ds_client_t *client; … … 58 59 list_initialize(&client->windows); 59 60 prodcons_initialize(&client->events); 60 client->srv = srv; 61 client->cb = cb; 62 client->cb_arg = cb_arg; 61 63 62 64 ds_display_add_client(display, client); … … 195 197 /* Notify the client */ 196 198 // TODO Do not send more than once until client drains the queue 197 display_srv_ev_pending(client->srv);199 client->cb->ev_pending(client->cb_arg); 198 200 199 201 return EOK; -
uspace/srv/hid/display/client.h
rb3c185b6 rbe15256 37 37 #define CLIENT_H 38 38 39 #include <disp_srv.h>40 39 #include "types/display/client.h" 41 40 #include "types/display/display.h" 42 41 43 extern errno_t ds_client_create(ds_display_t *, display_srv_t *, ds_client_t **); 42 extern errno_t ds_client_create(ds_display_t *, ds_client_cb_t *, void *, 43 ds_client_t **); 44 44 extern void ds_client_destroy(ds_client_t *); 45 45 extern errno_t ds_client_add_window(ds_client_t *, ds_window_t *); -
uspace/srv/hid/display/main.c
rb3c185b6 rbe15256 52 52 53 53 static void display_client_conn(ipc_call_t *, void *); 54 static void display_client_ev_pending(void *); 55 56 static ds_client_cb_t display_client_cb = { 57 .ev_pending = display_client_ev_pending 58 }; 54 59 55 60 static void display_kbd_event(void *arg, kbd_event_t *event) … … 59 64 printf("display_kbd_event\n"); 60 65 ds_display_post_kbd_event(disp, event); 66 } 67 68 static void display_client_ev_pending(void *arg) 69 { 70 display_srv_t *srv = (display_srv_t *) arg; 71 printf("display_client_ev_pending\n"); 72 display_srv_ev_pending(srv); 61 73 } 62 74 … … 137 149 if (svc_id != 0) { 138 150 /* Create client object */ 139 rc = ds_client_create(disp, & srv, &client);151 rc = ds_client_create(disp, &display_client_cb, &srv, &client); 140 152 if (rc != EOK) { 141 153 async_answer_0(icall, ENOMEM); -
uspace/srv/hid/display/test/display.c
rb3c185b6 rbe15256 39 39 PCUT_TEST_SUITE(display); 40 40 41 static void test_ds_ev_pending(void *); 42 43 static ds_client_cb_t test_ds_client_cb = { 44 .ev_pending = test_ds_ev_pending 45 }; 46 47 static void test_ds_ev_pending(void *arg) 48 { 49 printf("test_ds_ev_pending\n"); 50 } 51 52 41 53 /** Display creation and destruction. */ 42 54 PCUT_TEST(display_create_destroy) … … 62 74 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 63 75 64 rc = ds_client_create(disp, NULL, &client);76 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 65 77 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 66 78 -
uspace/srv/hid/display/test/window.c
rb3c185b6 rbe15256 47 47 errno_t rc; 48 48 49 rc = ds_client_create(NULL, NULL, &client);49 rc = ds_client_create(NULL, NULL, NULL, &client); 50 50 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 51 51 -
uspace/srv/hid/display/types/display/client.h
rb3c185b6 rbe15256 39 39 #include <adt/list.h> 40 40 #include <adt/prodcons.h> 41 #include <disp_srv.h>42 41 43 42 typedef sysarg_t ds_wnd_id_t; 43 44 /** Display server client callbacks */ 45 typedef struct { 46 void (*ev_pending)(void *); 47 } ds_client_cb_t; 44 48 45 49 /** Display server client */ … … 47 51 /** Parent display */ 48 52 struct ds_display *display; 49 /** Display protocol per-connection structure */ 50 display_srv_t *srv; 53 /** Callbacks */ 54 ds_client_cb_t *cb; 55 /** Callback argument */ 56 void *cb_arg; 51 57 /** Link to @c display->clients */ 52 58 link_t lclients;
Note:
See TracChangeset
for help on using the changeset viewer.