#include #include "RilMonitor.h" #include "RilExceptions.h" #include "debug.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { DebugSetLogfile("rilmon.log"); rilmonitor m; m.DumpDriverInfo(); long siglevel; requesthandler_ptr rl= m.GetSignalQuality(siglevel); rl->wait(); if (!rl->errorcode()) debug("signallevel: %d\n", siglevel); #if 0 eventqueue signal; m.SignalQualityEvent(signal); #endif //for (int fileid=0x2f00 ; fileid<0x7000 ; fileid=(fileid==0x3000)?0x4f00:(fileid==0x5000)?0x5f00:(fileid==0x6000)?0x6f00:(fileid+1)) for (int fileid=0x6f00 ; fileid<0x8000 ; fileid++) { try { int type=0; size_t itemcount=0, itemsize=0; requesthandler_ptr rs= m.GetSimRecordStatus(fileid, type, itemcount, itemsize); rs->wait(); if (rs->errorcode()) continue; requesthandler_ptr rc; if (type==RIL_SIMRECORDTYPE_CYCLIC || type==RIL_SIMRECORDTYPE_LINEAR) { for (size_t recnr=1 ; recnr<=itemcount ; recnr++) { try { rc= m.SendRestrictedSimCmd(RIL_SIMCMD_READRECORD, fileid, NULL, 0, 3, recnr, 4, itemsize); rc->wait(); } catch(...) { debug("exc in sendrestrictedsimcmd\n"); } } } else if (type==RIL_SIMRECORDTYPE_TRANSPARENT) { rc= m.SendRestrictedSimCmd(RIL_SIMCMD_READBINARY, fileid, NULL, 0, 3, 0, 0, itemsize); rc->wait(); } else if (type==RIL_SIMRECORDTYPE_DEDICATED || type==RIL_SIMRECORDTYPE_MASTER) { // todo : select DF, and enumerate contents. } else { debug("unhandled simrecord type: %d\n", type); } } catch(ril_error& e) { debug("rilerr: %08lx: %s\n", e.err, e.name.c_str()); } catch(ril_structsize_error& e) { debug("rilsize: got %d, expected %d\n", e.got, e.expect); } catch(...) { debug("unknown exception\n"); } } }