Advertisement
Guest User

g15daemon_client.h

a guest
Apr 11th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.86 KB | None | 0 0
  1. /*
  2.     This file is part of g15daemon.
  3.  
  4.     g15daemon is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 2 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     g15daemon is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with g15daemon; if not, write to the Free Software
  16.     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17.    
  18.     (c) 2006-2008 Mike Lampard, Philip Lawatsch, and others
  19.    
  20.     $Revision: 410 $ -  $Date: 2008-01-13 13:28:55 +1030 (Sun, 13 Jan 2008) $ $Author: mlampard $
  21.  
  22.     This daemon listens on localhost port 15550 for client connections,
  23.     and arbitrates LCD display.  Allows for multiple simultaneous clients.
  24.     Client screens can be cycled through by pressing the 'L1' key.
  25. */
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30.  
  31. #define G15_WIDTH 160
  32. #define G15_HEIGHT 43
  33.  
  34. #define G15_BUFSIZE 6880
  35. #define G15DAEMON_VERSION g15daemon_version()
  36.  
  37. #define G15_PIXELBUF 0
  38. #define G15_TEXTBUF 1
  39. #define G15_WBMPBUF 2
  40. #define G15_G15RBUF 3
  41. #define G15_SHMRBUF 4
  42.  
  43. /* client / server commands - see README.devel for details on use */
  44.  #define G15DAEMON_KEY_HANDLER 0x10
  45.  #define G15DAEMON_MKEYLEDS 0x20
  46.  #define G15DAEMON_CONTRAST 0x40
  47.  #define G15DAEMON_BACKLIGHT 0x80
  48.  #define G15DAEMON_KB_BACKLIGHT 0x8
  49.  #define G15DAEMON_GET_KEYSTATE 'k'
  50.  #define G15DAEMON_SWITCH_PRIORITIES 'p'
  51.  #define G15DAEMON_IS_FOREGROUND 'v'
  52.  #define G15DAEMON_IS_USER_SELECTED 'u'
  53.  #define G15DAEMON_NEVER_SELECT 'n'
  54.  
  55. const char *g15daemon_version();
  56.  
  57. /* open a new connection to the g15daemon.  returns an fd to be used with g15_send & g15_recv */
  58. /* screentype should be either 0 (graphic/pixelbuffer) or 1 (textbuffer). only Graphic buffers are
  59.    supported in this version */
  60. int new_g15_screen(int screentype);
  61.  
  62. /* close connection - just calls close() */
  63. int g15_close_screen(int sock);
  64.  
  65. /* these two functions operate in the same way as send & recv, except they wont return
  66.  * until _all_ len bytes are sent or received, or an error occurs */
  67. int g15_send(int sock, char *buf, unsigned int len);
  68. int g15_recv(int sock, char *buf, unsigned int len);
  69.  
  70. /* send a command (defined above) to the daemon.  any replies from the daemon are returned */
  71. unsigned long g15_send_cmd (int sock, unsigned char command, unsigned char value);
  72. /* receive an oob byte from the daemon, used internally by g15_send_cmd, but useful elsewhere */
  73. #define G15_FOREGROUND_SENT_OOB 1
  74. int g15_recv_oob_answer(int sock);
  75. #ifdef __cplusplus
  76. }
  77. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement