// == CODE ===
int Snack_InitHandler()
{
- giSnack_SerialFD = open(gsSnack_SerialPort, O_RDWR);
+ giSnack_SerialFD = InitSerial(gsSnack_SerialPort, 9600);
+ if( giSnack_SerialFD == -1 ) {
+ fprintf(stderr, "ERROR: Unable to open snack serial port ('%s')\n", gsSnack_SerialPort);
+ }
+
regcomp(&gSnack_ResponseRegex, "^(\\d\\d\\d)(.*)$", REG_EXTENDED);
return 0;
}
-int Snack_CanDispense(int User, int Item)
+int Snack_CanDispense(int UNUSED(User), int Item)
{
// Sanity please
if( Item < 0 || Item > 99 ) return -1;
- return 1;
+ // Hmm... could we implement slot statuses?
+
+ return 0;
}
/**
* \brief Actually do a dispense from the coke machine
*/
-int Snack_DoDispense(int User, int Item)
+int Snack_DoDispense(int UNUSED(User), int Item)
{
char tmp[32];
regmatch_t matches[4];
return 0;
}
-
-