+ // Can't dispense if the machine is not connected
+ if( giCoke_SerialFD == -1 )
+ return -2;
+
+ #if TRACE_COKE
+ printf("Coke_DoDispense: flushing input");
+ #endif
+ // Flush the input buffer
+ {
+ char tmpbuf[512];
+ read(giCoke_SerialFD, tmpbuf, sizeof(tmpbuf));
+ }
+
+ // Wait for prompt
+ i = 0;
+ do {
+ #if TRACE_COKE
+ printf("Coke_DoDispense: sending 'd7'");
+ #endif
+ write(Item, "d7\r\n", 4);
+ } while( WaitForColon() && i++ < 3 );