Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  * Copyright (C) 2016 Mopria Alliance, Inc.
      4  * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 #ifndef __IFC_WPRINT_H__
     19 #define __IFC_WPRINT_H__
     20 
     21 #include "wprint_msgq.h"
     22 #include "wtypes.h"
     23 
     24 #ifdef __cplusplus
     25 extern "C"
     26 {
     27 #endif
     28 
     29 /*
     30  * An interface for capturing job data as it is spooled for debugging purposes
     31  */
     32 typedef struct {
     33     void (*debug_start_job)(wJob_t job_handle, const char *ext);
     34 
     35     void (*debug_job_data)(wJob_t job_handle, const unsigned char *buff, unsigned long nbytes);
     36 
     37     void (*debug_end_job)(wJob_t job_handle);
     38 
     39     void (*debug_start_page)(wJob_t job_handle, int page_number, int width, int height);
     40 
     41     void (*debug_page_data)(wJob_t job_handle, const unsigned char *buff, unsigned long nbytes);
     42 
     43     void (*debug_end_page)(wJob_t job_handle);
     44 } ifc_wprint_debug_stream_t;
     45 
     46 /*
     47  * Interface for global wprint functions
     48  */
     49 typedef struct {
     50     /*
     51      * Create a FIFO message queue
     52      */
     53     msg_q_id (*msgQCreate)(int max_mesgs, int max_msg_length);
     54 
     55     /*
     56      * Delete a previously created message queue. Returns OK or ERROR.
     57      */
     58     status_t (*msgQDelete)(msg_q_id msgQ);
     59 
     60     /**
     61      * Sends a message to a message queue. Returns OK or ERROR.
     62      */
     63     status_t (*msgQSend)(msg_q_id msgQ, const char *buffer, unsigned long nbytes, int timeout,
     64             int priority);
     65 
     66     /**
     67      * Collects a message, returning 0 if successful. timeout may be WAIT_FOREVER or NO_WAIT.
     68      */
     69     status_t (*msgQReceive)(msg_q_id msgQ, char *buffer, unsigned long max_nbytes, int timeout);
     70 
     71     /**
     72      * Returns the number of messages in the queue or ERROR.
     73      */
     74     int (*msgQNumMsgs)(msg_q_id msgQ);
     75 
     76     /*
     77      * Returns an interface used for debugging data delivered for a job
     78      */
     79     const ifc_wprint_debug_stream_t *(*get_debug_stream_ifc)(wJob_t id);
     80 } ifc_wprint_t;
     81 
     82 #ifdef __cplusplus
     83 }
     84 #endif
     85 
     86 #endif // __IFC_WPRINT_H__