Definition at line 21 of file TestTodos.java.
Static Public Member Functions | |
| static void | main (String[] args) |
| static void TestTodos::main | ( | String[] | args | ) | [inline, static] |
The main program for the TestTodos class
| args | The command line arguments |
Definition at line 28 of file TestTodos.java.
References org::gnu::pilotlink::PilotLink::close(), org::gnu::pilotlink::PilotLink::endSync(), org::gnu::pilotlink::ToDoRecord::getBuffer(), org::gnu::pilotlink::User::getLastSyncDate(), org::gnu::pilotlink::User::getName(), org::gnu::pilotlink::SysInfo::getProdID(), org::gnu::pilotlink::PilotLink::getRecordByIndex(), org::gnu::pilotlink::PilotLink::getRecordCount(), org::gnu::pilotlink::SysInfo::getRomVersion(), org::gnu::pilotlink::PilotLink::getSysInfo(), org::gnu::pilotlink::PilotLink::getUserInfo(), test::hexdump(), org::gnu::pilotlink::PilotLink::isConnected(), org::gnu::pilotlink::PilotLink::openDB(), port, and ToDoRecord.
00028 { 00029 String port; 00030 test tst = new test(); 00031 if (args.length == 0) { 00032 port = "/dev/usb/tts/1"; 00033 } else { 00034 port = args[0]; 00035 } 00036 File p = new File(port); 00037 System.out.println("looking for file " + port); 00038 if (!p.exists()) { 00039 System.out.println("File does not exist... USB? Waiting for port to appear"); 00040 00041 while (!p.exists()) { 00042 System.out.print("."); 00043 try { 00044 Thread.sleep(1000); 00045 } catch (Exception e) {} 00046 } 00047 } 00048 //System.out.println("Systemzeit: "+Long.toHexString(System.currentTimeMillis()/1000)); 00049 PilotLink pl = null; 00050 try { 00051 pl = new PilotLink(port); 00052 if (!pl.isConnected()) { 00053 System.out.println("Something went wrong. Check output!"); 00054 System.exit(1); 00055 } 00056 } catch (Exception e) { 00057 e.printStackTrace(); 00058 System.exit(1); 00059 } 00060 try { 00061 User u = pl.getUserInfo(); 00062 System.out.println("User: " + u.getName()); 00063 System.out.println("Last Synchronization Date: " + u.getLastSyncDate()); 00064 } catch (PilotLinkException e) { 00065 e.printStackTrace(); 00066 } 00067 try { 00068 SysInfo si = pl.getSysInfo(); 00069 System.out.println("Product ID: '" + si.getProdID() + "'"); 00070 System.out.println("Rom Version: " + si.getRomVersion()); 00071 } catch (PilotLinkException e) { 00072 e.printStackTrace(); 00073 } 00074 00075 try { 00076 int dbh = pl.openDB("ToDoDB"); 00077 System.out.println("db opened!"); 00078 System.out.println("Count: " + pl.getRecordCount(dbh)); 00079 for (int i = 0; i < pl.getRecordCount(dbh); i++) { 00080 Record r = pl.getRecordByIndex(dbh, i); 00081 ToDoRecord tdr = new ToDoRecord(r); 00082 System.out.println("READ IN:"); 00083 System.out.println(tdr); 00084 tst.hexdump(r.getBuffer()); 00085 00086 System.out.println("\nRE-PACKED:"); 00087 tst.hexdump(tdr.getBuffer()); 00088 System.out.println(); 00089 } 00090 } catch (PilotLinkException e1) { 00091 // TODO Auto-generated catch block 00092 e1.printStackTrace(); 00093 } 00094 try { 00095 pl.endSync(); 00096 } catch (PilotLinkException e) { 00097 e.printStackTrace(); 00098 } 00099 pl.close(); 00100 00101 }
Here is the call graph for this function:
