+ // TODO: Regex instead?
+ if( strcmp(tmp, "ok") == 0 ) {
+ // We think dispense worked
+ // - The machine returns 'ok' if an empty slot is dispensed, even if
+ // it doesn't actually try to dispense (no sound)
+ ret = 0;
+ }
+ else {
+ printf("Coke_DoDispense: Machine returned unknown value '%s'\n", tmp);
+ ret = -1;
+ }
+
+ TRACE("Updating slot status\n");
+
+ // Update status
+ WaitForColon();
+ Writef("s%i\r\n", Item);
+ len = ReadLine(sizeof tmp, tmp);
+ if(len == -1) gaCoke_CachedStatus[Item] = -1;
+ Coke_int_GetSlotStatus(tmp, Item);
+ {
+ char buf[512];
+ read(giCoke_SerialFD, buf, 512); // Flush
+ }