+ // TODO: Handle "not ok" response to D7
+
+ // Ask the coke machine
+ sprintf(tmp, "s%i\r\n", Item);
+ write(giCoke_SerialFD, tmp, 4);
+
+ ret = ReadLine(sizeof(tmp)-1, tmp);
+ printf("ret = %i, tmp = '%s'\n", ret, tmp);
+// if( !ret )
+// ret = ReadLine(sizeof(tmp)-1, tmp);
+ printf("ret = %i, tmp = '%s'\n", ret, tmp);
+
+ // Catch an error
+ if( ret <= 0 ) {
+ fprintf(stderr, "Coke machine is not being chatty (read = %i)\n", ret);
+ if( ret == -1 ) {
+ perror("Coke Machine");
+ }
+ return -1;
+ }
+
+ // Parse status response
+ ret = RunRegex(&gCoke_StatusRegex, tmp, sizeof(matches)/sizeof(matches[0]), matches, "Bad Response");
+ if( ret ) {
+ return -1;
+ }
+
+ // Get slot status