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