brewpanel/sdlgui.h

Mon, 15 Apr 2024 17:04:57 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 15 Apr 2024 17:04:57 +0200
changeset 678
cc49115e769e
parent 638
186f0c2d3e76
permissions
-rw-r--r--

Better websocket broadcast messages. Added GLOBAL JSON command to the server. Better logic to trigger websocket and mqtt data updates for the fermenter units. Websocket receive added fermenter mode, stage, setpoints, switches. Added more css styles for the fermenter screen. Added the fermenter screen php and javascript.

#ifndef _SDLGUI_H
#define _SDLGUI_H

#ifdef HAVE_SDL2_SDL_H

enum
{
  SGBOX,
  SGTEXT,
  SGTTF,
  SGBUTTON,
  SGLCD,
  SGLEDRED,
  SGLEDGREEN,
  SGLEDBLUE,
  SGLEDYELLOW
};


/* Object flags: */
#define SG_TOUCHEXIT		 1   /* Exit immediately when mouse button is pressed down */
#define SG_EXIT			 2   /* Exit when mouse button has been pressed (and released) */
#define SG_DEFAULT		 4   /* Marks a default button, selectable with return key */
#define SG_CANCEL		 8   /* Marks a cancel button, selectable with ESC key */
#define SG_HIDE			16   /* Button is inactive */

/* Object states: */
#define SG_SELECTED		 1
#define	SG_LCD_BLINK		 2
#define	SG_LCD_CURSOR		 4
#define	SG_LCD_DISPLAY		 8
#define	SG_LCD_BLIGHT		16

/* Return codes: */
#define SDLGUI_ERROR		-1
#define SDLGUI_QUIT		-2
#define SDLGUI_UNKNOWNEVENT	-3


typedef struct
{
    int		type;			/* What type of object */
    int		flags;			/* Object flags */
    int		state;			/* Object state */
    int		x, y;			/* The offset to the upper left corner */
    int		w, h;			/* Width and height */
    char	*txt;			/* Text string */
}  SGOBJ;



void SDLGui_LED(SGOBJ *dlg, int fd, int LED, int on);
void SDLGui_Cursor(SGOBJ *dlg, int fd, int x, int y, int on, int blink);
void SDLGui_CGChar(SGOBJ *dlg, int fd, int x, int y, Uint8 dataf[8]);
void SDLGui_Char(SGOBJ *dlg, int fd, int x, int y, Uint8 c);
void SDLGui_DrawLCD(SGOBJ *bdlg, int objnum);
int  SDLGui_Init(void);
int  SDLGui_UnInit(void);
int  SDLGui_SetScreen(void);
void SDLGui_DrawDialog(SGOBJ *dlg);
int  SDLGui_DoDialogInit(SGOBJ *dlg);
int  SDLGui_DoDialogLoop(SGOBJ *dlg);
void SDLGui_DoDialogEnd(void);
void SDLGui_CenterDlg(SGOBJ *dlg);
int  SDLGui_LCDinit(SGOBJ *dlg, int *x, int *y, int *w, int *h, int *cols, int *rows, int lcdindex);
void SDLGui_LCDwrite(SGOBJ *dlg, int fd, int x, int y, Uint8 c, int lcdindex);

#endif

#endif

mercurial