CHDK_DE Vorschauversion  Trunk Rev. 5209
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
levent.c-Dateireferenz
#include "stdlib.h"
#include "levent.h"
+ Include-Abhängigkeitsdiagramm für levent.c:

gehe zum Quellcode dieser Datei

Funktionen

unsigned levent_index_for_name (const char *name)
 
unsigned levent_index_for_id (unsigned id)
 
unsigned levent_count (void)
 
unsigned levent_id_for_name (const char *name)
 
const char * levent_name_for_id (unsigned id)
 
int levent_post_to_ui_by_name (const char *name)
 
void levent_set_record (void)
 
void levent_set_play (void)
 

Dokumentation der Funktionen

unsigned levent_count ( void  )

Definiert in Zeile 31 der Datei levent.c.

32 {
33  static unsigned num_levents = 0;
34  if(!num_levents) {
35  levent_def *ev;
36  // TODO could check for id=-1 or id=0, both show up at end of table ?
37  for (ev = levent_table; ev->name; ev++) {
38  num_levents++;
39  }
40  }
41  return num_levents;
42 }
unsigned levent_id_for_name ( const char *  name)

Definiert in Zeile 44 der Datei levent.c.

45 {
46  unsigned i = levent_index_for_name(name);
47  if (i!=LEVENT_INVALID_INDEX)
48  return levent_table[i].id;
49  else
50  return 0; // or -1 ? both appear at the end of the event list
51 }
unsigned levent_index_for_id ( unsigned  id)

Definiert in Zeile 18 der Datei levent.c.

19 {
20  unsigned i;
21  // TODO could check for id=-1 or id=0, both show up at end of table ?
22  for (i=0; levent_table[i].name; i++) {
23  // case insensitive might be better
24  if (id == levent_table[i].id) {
25  return i;
26  }
27  }
28  return LEVENT_INVALID_INDEX;
29 }
unsigned levent_index_for_name ( const char *  name)

Definiert in Zeile 5 der Datei levent.c.

6 {
7  unsigned i;
8  // TODO could check for id=-1 or id=0, both show up at end of table ?
9  for (i=0; levent_table[i].name; i++) {
10  // case insensitive might be better
11  if (strcmp(levent_table[i].name,name) == 0) {
12  return i;
13  }
14  }
15  return LEVENT_INVALID_INDEX;
16 }
const char* levent_name_for_id ( unsigned  id)

Definiert in Zeile 53 der Datei levent.c.

54 {
55  unsigned i = levent_index_for_id(id);
56  if (i!=LEVENT_INVALID_INDEX)
57  return levent_table[i].name;
58  else
59  return NULL;
60 }
int levent_post_to_ui_by_name ( const char *  name)

Definiert in Zeile 63 der Datei levent.c.

64 {
65  unsigned id=levent_id_for_name(name);
66  if(id) {
68  return 1;
69  }
70  return 0;
71 }
void levent_set_play ( void  )

Definiert in Zeile 78 der Datei levent.c.

78  {
79  levent_post_to_ui_by_name("PressPBButton");
80  levent_post_to_ui_by_name("UnpressPBButton");
81 }
void levent_set_record ( void  )

Definiert in Zeile 73 der Datei levent.c.

73  {
74  levent_post_to_ui_by_name("PressRecButton");
75  levent_post_to_ui_by_name("UnpressRecButton");
76 }