class project main.cpp publish

Dependencies:   mbed C12832_lcd USBHost USBHostPTP LCD_Menu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PTPMenu.cpp Source File

PTPMenu.cpp

00001 #include "PTPMenu.h"
00002 
00003 
00004 void PTPMenu::GenerateMenu(void) {
00005     menus.push_back(Menu("root")); 
00006     menus.push_back(Menu("Test menu")); 
00007     menus[1].add(Selection(DUMPDEVICEINFO,      0, NULL, "Dump Device Info")); // The function argument of selection can be added directly
00008     menus[1].add(Selection(GETALLJPG,           1, NULL, "Get All Images")); // The function argument of selection can be added directly
00009     menus[1].add(Selection(GETNUMOBJ,           2, NULL, "Get Number of Objects"));
00010     menus[1].add(Selection(GETNUMJPG,           3, NULL, "Get Number of Images"));
00011     menus[1].add(Selection(ENABLEDECODER,       4, NULL, "Enable Decoder"));
00012     //testMenu.add(Selection(NULL, 5, NULL, "Get Number of Thumbnails"));
00013     menus[1].add(Selection(CLOSESESSION,        5, NULL, "Close Session"));
00014     menus[1].add(Selection((void (*)())NULL,    6, &menus[0], "  Go back"));  // always add a Selection at the end to point to the parent
00015     
00016     menus.push_back(Menu("About Menu")); // about menu crediting us :)
00017     menus[2].add(Selection((void (*)())NULL,    0, NULL, "Author:"));
00018     menus[2].add(Selection((void (*)())NULL,    1, NULL, " Dwayne S Dilbeck"));
00019     menus[2].add(Selection((void (*)())NULL,    2, NULL, " 8/29/2013"));
00020     menus[2].add(Selection((void (*)())NULL,    3, NULL, " USB Device Interface:"));
00021     menus[2].add(Selection((void (*)())NULL,    4, NULL, " Architecture,"));
00022     menus[2].add(Selection((void (*)())NULL,    5, NULL, " Protocols,"));
00023     menus[2].add(Selection((void (*)())NULL,    6, NULL, " and programming."));
00024     menus[2].add(Selection((void (*)())NULL,    7, &menus[0], "  Go back"));
00025     
00026     menus.push_back(Menu("Capture Menu"));
00027     menus[3].add(Selection(CAPTUREMODEON,       0, NULL, "Enable Capture Mode"));
00028     menus[3].add(Selection(CAPTUREMODEOFF,      1, NULL, "Disable Capture Mode"));
00029     menus[3].add(Selection(VFINDERON,           2, NULL, "Enable View Finder"));
00030     menus[3].add(Selection(VFINDEROFF,          3, NULL, "Disable View Finder"));
00031     menus[3].add(Selection(TAKEPHOTO,           4, NULL, "Take Photo"));
00032     menus[3].add(Selection((void (*)())NULL,    5, &menus[0], "  Go back"));
00033     
00034     menus[0].add(Selection((void (*)())NULL,    0, &menus[1], "TEST MENU"));
00035     menus[0].add(Selection((void (*)())NULL,    1, &menus[3], "Capture menu"));
00036     menus[0].add(Selection((void (*)())NULL,    2, &menus[2], "About menu"));   
00037     navigator = new Navigator(&menus[0], lcd);
00038 }
00039 
00040 
00041 void PTPMenu::poll(void) {
00042     navigator->poll(&command);
00043 }