I'd like to be able to fill these 'OEM_X' strings from a file on a thumbdrive:
.jpg)
I believe this should work, but the strings aren't updating and 'couldNotMount' never gets called. I did a couple tests and I can confirm that the USB mounts correctly and the file is opened correctly. I tried removing the '!f.isEndOfFile()' thinking there was an issue with that and I get the same result.
Code: Select all
void $readUSB$ ()
{
mountUSB(EventIDs.getOEM, EventIDs.couldNotMount);
}
void $getOEM$ ()
{
file f;
// OEM.txt resides on the root of the USB drive
if (f.open("OEM.txt", "r") >= 0)
{
string line = "";
// read up to 8 lines until EOF is found
for (int i = 0; i < 8 && !f.isEndOfFile(); i++)
{
line = f.readLine();
// update oem line
switch(i)
{
case 0: cultureSetString(StringIDs.OEM_1, line, true); break;
case 1: cultureSetString(StringIDs.OEM_2, line, true); break;
case 2: cultureSetString(StringIDs.OEM_3, line, true); break;
case 3: cultureSetString(StringIDs.OEM_4, line, true); break;
case 4: cultureSetString(StringIDs.OEM_5, line, true); break;
case 5: cultureSetString(StringIDs.OEM_6, line, true); break;
case 6: cultureSetString(StringIDs.OEM_7, line, true); break;
case 7: cultureSetString(StringIDs.OEM_8, line, true); break;
}
}
f.close();
}
else
{
// flash screen if file can't be found (I'll do something more clever later)
SendAction(ApplicationIDs.System, ActionIDs.System_Backlight_Off, ActionData.Empty);
SendAction(ApplicationIDs.System, ActionIDs.System_Backlight_On, ActionData.Empty);
}
unmountUSB(EventIDs.Empty);
}
.jpg)
The contents of OEM.txt are:
test1
test2
test3
test4
test5