+
+ // Open modbus
+ if( !gbCoke_DummyMode )
+ {
+ Coke_int_ConnectToPLC();
+ }
+
+ return 0;
+}
+
+int Coke_CanDispense(int UNUSED(User), int Item)
+{
+ int slot;
+
+ // Check for 'dummy' mode
+ if( gbCoke_DummyMode )
+ return 0;
+
+ // Get slot
+ slot = Coke_int_GetSlotFromItem(Item, 0);
+ if(slot < 0) return -1;
+
+ return Coke_int_IsSlotEmpty(slot);
+}
+
+/**
+ * \brief Actually do a dispense from the coke machine
+ */
+int Coke_DoDispense(int UNUSED(User), int Item)
+{
+ int slot;
+ // Check for 'dummy' mode
+ if( gbCoke_DummyMode )
+ return 0;
+
+ // Get slot
+ slot = Coke_int_GetSlotFromItem(Item, 1);
+ if(slot < 0) return -1;