CHDK_DE Vorschauversion  Trunk Rev. 5830
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
levent.c-Dateireferenz
#include "stdlib.h"
#include "stddef.h"
#include "string.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 33 der Datei levent.c.

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

Definiert in Zeile 46 der Datei levent.c.

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

Definiert in Zeile 20 der Datei levent.c.

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

Definiert in Zeile 7 der Datei levent.c.

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

Definiert in Zeile 55 der Datei levent.c.

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

Definiert in Zeile 65 der Datei levent.c.

66 {
67  unsigned id=levent_id_for_name(name);
68  if(id) {
70  return 1;
71  }
72  return 0;
73 }
void levent_set_play ( void  )

Definiert in Zeile 80 der Datei levent.c.

80  {
81  levent_post_to_ui_by_name("PressPBButton");
82  levent_post_to_ui_by_name("UnpressPBButton");
83 }
void levent_set_record ( void  )

Definiert in Zeile 75 der Datei levent.c.

75  {
76  levent_post_to_ui_by_name("PressRecButton");
77  levent_post_to_ui_by_name("UnpressRecButton");
78 }