extern si_t send_window_cancel_message(struct egui_uds* uds_ptr, union message* msg, si_t window_descripter) { union message msg_to_be_sent; copy_message(msg, &msg_to_be_sent); message_set_window_cancel(&msg_to_be_sent, window_descripter); return comm_send_message(uds_ptr, &msg_to_be_sent); }
/** * 客户端请求处理函数:这个函数是selector里面的客户端的通信句柄对应的回调函数 **/ si_t client_request_handler(struct egui_uds* uds_ptr, addr_t arg) { struct queue message_queue; si_t ret = 0; NOT_USED(arg); EGUI_PRINT_INFO("callback client_request_handler() is called"); queue_init(&message_queue); /** 接受request回应respond **/ ret = comm_recv_request_and_send_respond(uds_ptr, &message_queue, request_handler); if(EXIT_NUMBER == ret) { return SELECTER_RETURN_TYPE_END; } /** 发送相关消息 **/ while(!queue_empty(&message_queue)) { union message* message_ptr = (union message*)queue_front(&message_queue); if(0 != comm_send_message(uds_ptr, message_ptr)) { EGUI_PRINT_ERROR("failed to send message!"); } queue_pop(&message_queue); } queue_exit(&message_queue); return SELECTER_RETURN_TYPE_CONTINUE; }
extern si_t send_widget_resize_message(struct egui_uds* uds_ptr, union message* msg, si_t window_descripter, si_t x_axis, si_t y_axis, si_t x_size, si_t y_size) { union message msg_to_be_sent; struct rectangle area = {0}; copy_message(msg, &msg_to_be_sent); rectangle_set(&area, x_axis, y_axis, x_size, y_size); message_set_widget_resize(&msg_to_be_sent, window_descripter, &area); return comm_send_message(uds_ptr, &msg_to_be_sent); }
extern si_t send_widget_move_message(struct egui_uds* uds_ptr, union message* msg, si_t window_descripter, si_t x_offset, si_t y_offset) { union message msg_to_be_sent; struct point p = {0}; point_set(&p, x_offset, y_offset); copy_message(msg, &msg_to_be_sent); message_set_widget_move(&msg_to_be_sent, window_descripter, &p); return comm_send_message(uds_ptr, &msg_to_be_sent); }
extern si_t send_application_quit_message(struct egui_uds* uds_ptr) { /** * 其实只需要发送头部 但是这样为了一个application quit还要增加一种特殊的msg 所以就只填负载的type了 **/ union message msg_to_be_sent; message_set_type(&msg_to_be_sent, MESSAGE_TYPE_APPLICATION_QUIT); return comm_send_message(uds_ptr, &msg_to_be_sent); }
extern si_t send_input_message(struct egui_uds* uds_ptr, union message* msg, si_t window_descripter) { message_set_window_descriptor(msg, window_descripter); return comm_send_message(uds_ptr, msg); }