display_utils.c File Reference

Display update wrapper functions. More...

#include <glib.h>
#include <stdio.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "er_error.h"
#include "log.h"
#include "display_utils.h"
Include dependency graph for display_utils.c:

Go to the source code of this file.

Defines

#define DMPORT   50555
#define DMSERVER   "127.0.0.1"

Functions

static void init_socket (void)
static void send_message (int take_control, int waveform)
void display_init ()
void display_finialize ()
void display_gain_control ()
void display_return_control ()
void display_update_return_control (int type)
void display_update_keep_control (int type)
void display_splash_lock ()
void display_update_keep_splash_lock ()
void display_splash_unlock ()

Variables

static int dm_socket = -1
static struct sockaddr_in dm_addr

Detailed Description

Display update wrapper functions.

Definition in file display_utils.c.


Define Documentation

#define DMPORT   50555

Copyright (C) 2009 iRex Technologies B.V. All rights reserved.

Definition at line 55 of file display_utils.c.

#define DMSERVER   "127.0.0.1"

Definition at line 56 of file display_utils.c.


Function Documentation

void display_finialize (  ) 

Definition at line 88 of file display_utils.c.

References dm_socket.

00089 {
00090     if (dm_socket != -1)
00091     {
00092         close(dm_socket);
00093     }
00094 }

void display_gain_control (  ) 

Definition at line 96 of file display_utils.c.

References DM_HINT_NONE, and send_message().

Referenced by erkeyb_stop_display_update(), fileview_stop_update_display(), main(), notepad_stop_display_update(), on_menu_move_scroll(), on_menu_move_selected(), on_phase_2_complete(), set_active(), show_busy(), show_splash(), and sys_set_orientation().

00097 {
00098     send_message(TRUE, DM_HINT_NONE);
00099 }

Here is the call graph for this function:

Here is the caller graph for this function:

void display_init ( void   ) 

Definition at line 79 of file display_utils.c.

00080 {
00081     if (dm_socket == -1)
00082     {
00083         init_socket();
00084     }
00085 }

void display_return_control (  ) 

Definition at line 102 of file display_utils.c.

References DM_HINT_NONE, and send_message().

Referenced by dialog_splash_remove(), notepad_start_display_update(), on_phase_3_complete(), show_busy(), and start_phase_2().

00103 {
00104     send_message(FALSE, DM_HINT_NONE);
00105 }

Here is the call graph for this function:

Here is the caller graph for this function:

void display_splash_lock (  ) 

Definition at line 120 of file display_utils.c.

References DM_HINT_LOCK, and send_message().

Referenced by show_splash().

00121 {
00122     send_message(TRUE, DM_HINT_LOCK);
00123 }

Here is the call graph for this function:

Here is the caller graph for this function:

void display_splash_unlock (  ) 

Definition at line 132 of file display_utils.c.

References DM_HINT_UNLOCK, and send_message().

Referenced by dialog_splash_remove().

00133 {
00134     send_message(TRUE, DM_HINT_UNLOCK);
00135 }

Here is the call graph for this function:

Here is the caller graph for this function:

void display_update_keep_control ( int  type  ) 

Definition at line 114 of file display_utils.c.

References send_message().

00115 {
00116     send_message(TRUE, type);
00117 }

Here is the call graph for this function:

void display_update_keep_splash_lock (  ) 

Definition at line 126 of file display_utils.c.

References DM_HINT_SPLASH, and send_message().

Referenced by dialog_rotated(), and on_splash_expose().

00127 {
00128     send_message(TRUE, DM_HINT_SPLASH);
00129 }

Here is the call graph for this function:

Here is the caller graph for this function:

void display_update_return_control ( int  type  ) 

Definition at line 108 of file display_utils.c.

References send_message().

00109 {
00110     send_message(FALSE, type);
00111 }

Here is the call graph for this function:

static void init_socket ( void   )  [static]

Definition at line 142 of file display_utils.c.

References dm_addr, dm_socket, DMPORT, and DMSERVER.

Referenced by display_init(), and send_message().

00143 {
00144     // create and bind socket
00145     dm_socket = socket(PF_INET, SOCK_DGRAM, 0);
00146     dm_addr.sin_family = AF_INET;
00147     dm_addr.sin_port = htons(DMPORT);
00148     dm_addr.sin_addr.s_addr = inet_addr(DMSERVER);
00149     memset(dm_addr.sin_zero, '\0', sizeof(dm_addr.sin_zero));
00150 }

Here is the caller graph for this function:

static void send_message ( int  take_control,
int  waveform 
) [static]

Definition at line 153 of file display_utils.c.

References dm_addr, dm_socket, init_socket(), LOGPRINTF, and msg.

Referenced by display_gain_control(), display_return_control(), display_splash_lock(), display_splash_unlock(), display_update_keep_control(), display_update_keep_splash_lock(), and display_update_return_control().

00154 {
00155     char msg[256];
00156     
00157     if (dm_socket == -1)
00158     {
00159         init_socket();
00160     }
00161     
00162     // send display update message
00163     snprintf(msg, sizeof(msg)-1, "!F,%d,%d,%d\n", getpid(), take_control > 0 ? 1 : 0, waveform);
00164     sendto(dm_socket, msg, strlen(msg), 0, (struct sockaddr*) &dm_addr, sizeof(dm_addr));
00165 
00166     LOGPRINTF("Sent: %s", msg);
00167 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct sockaddr_in dm_addr [static]

Definition at line 64 of file display_utils.c.

Referenced by init_socket(), and send_message().

int dm_socket = -1 [static]

Definition at line 63 of file display_utils.c.

Referenced by display_finialize(), display_init(), init_socket(), and send_message().

Generated by  doxygen 1.6.2-20100208