#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <string.h>
#include <ctype.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <libermanifest/ermanifest.h>
#include "stack.h"
#include "lister.h"
#include "erConnect.h"
#include "system.h"
#include "gtkPincodeScreen.h"
#include "control.h"
#include "metadataStoreManager.h"
Go to the source code of this file.
Classes | |
struct | command |
Defines | |
#define | MAX_DESC 80 |
#define | PREVIOUS 0x0001 |
#define | NEXT 0x0002 |
#define | CURRENT 0x0003 |
#define | DISPLAY_STACK 0x0004 |
#define | MENU_QUIT 0x0400 |
Functions | |
int | menu (char *mode) |
int | main (int argc, char *argv[]) |
Variables | |
static int | lastCmd = -1 |
struct command | commands [] |
#define CURRENT 0x0003 |
Definition at line 47 of file testMetadataStoreManager.c.
#define DISPLAY_STACK 0x0004 |
Definition at line 48 of file testMetadataStoreManager.c.
#define MAX_DESC 80 |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition at line 43 of file testMetadataStoreManager.c.
#define MENU_QUIT 0x0400 |
Definition at line 49 of file testMetadataStoreManager.c.
#define NEXT 0x0002 |
Definition at line 46 of file testMetadataStoreManager.c.
#define PREVIOUS 0x0001 |
Definition at line 45 of file testMetadataStoreManager.c.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 71 of file testMetadataStoreManager.c.
00072 { 00073 int result; 00074 int command; 00075 char commandDesc[MAX_DESC]; 00076 char mode[80]; 00077 mdsDirectory_t dir_1; 00078 00079 //int index; 00080 00081 // Initialize some variables 00082 strcpy(commandDesc, "NO DESCRIPTION"); 00083 00084 mdsInit(); 00085 00086 do 00087 { 00088 command = menu(mode); 00089 00090 switch (command) 00091 { 00092 case CURRENT: 00093 result = mdsScanCurrent(st_ContentTypeBooks); 00094 00095 if (result != ERMDS_CONTENT_SCAN_OK) 00096 { 00097 printf("mdsScanCurrent returned %d\n", result); 00098 } 00099 else 00100 { 00101 displayScanResult(); 00102 } 00103 break; 00104 00105 case PREVIOUS: 00106 result = mdsScanPrevious(st_ContentTypeBooks); 00107 00108 if (result != ERMDS_CONTENT_SCAN_OK) 00109 { 00110 printf("mdsScanPrevious returned %d\n", result); 00111 } 00112 else 00113 { 00114 displayScanResult(); 00115 } 00116 break; 00117 00118 case NEXT: 00119 strcpy(dir_1.szFilename, "/home/ann/contentExample/test_root/dir_1"); 00120 00121 printf("folder %s\n", dir_1.szFilename); 00122 00123 result = mdsScanNext(st_ContentTypeBooks, dir_1.szFilename, 0); 00124 00125 if (result != ERMDS_CONTENT_SCAN_OK) 00126 { 00127 printf("mdsScanPrevious returned %d\n", result); 00128 } 00129 else 00130 { 00131 displayScanResult(); 00132 } 00133 break; 00134 00135 case DISPLAY_STACK: 00136 stackDisplay(st_ContentTypeBooks); 00137 break; 00138 } 00139 00140 } 00141 while (command != MENU_QUIT); 00142 00143 mdsDestroy(); 00144 00145 exit(0); 00146 }
int menu | ( | char * | mode | ) |
Definition at line 148 of file testMetadataStoreManager.c.
00149 { 00150 int i; 00151 char ch; 00152 00153 printf("\n\nMenu: \n"); 00154 00155 if (lastCmd != -1) 00156 printf("Last selected command = '%s'\n\n", commands[lastCmd].desc); 00157 else 00158 printf("\n\n"); 00159 00160 for (i = 0; i < sizeof(commands) / sizeof(*commands); i++) 00161 { 00162 if (commands[i].key == 0) 00163 printf("\n"); 00164 else 00165 printf(" %c - %s\n", commands[i].key, commands[i].desc); 00166 } 00167 00168 printf("\nCommand: "); 00169 fflush(stdout); 00170 00171 while (1) 00172 { 00173 ch = toupper(getchar()); 00174 00175 for (i = 0; i < sizeof(commands) / sizeof(*commands); i++) 00176 { 00177 if (ch && ch == commands[i].key) 00178 { 00179 printf("%c\n\n", ch); 00180 lastCmd = i; 00181 return commands[i].code; 00182 } 00183 } 00184 } 00185 }
Initial value:
{ {'1', "Scan using the current content information", CURRENT}, {'2', "Scan NEXT", NEXT}, {'3', "Scan PREVIOUS", PREVIOUS}, {'4', "Display Stack", DISPLAY_STACK}, {0, NULL, 0}, {'Q', "Quit", MENU_QUIT} }
Definition at line 60 of file testMetadataStoreManager.c.
int lastCmd = -1 [static] |
Definition at line 51 of file testMetadataStoreManager.c.