Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r273a45daf0a9fd45d363d0b5ce16691c874a5eec -ra26a5f04dba3e525469d3039e993909df7389d70 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 273a45daf0a9fd45d363d0b5ce16691c874a5eec) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision a26a5f04dba3e525469d3039e993909df7389d70) @@ -25,13 +25,11 @@ DenaliMessage, DenaliChannels) + class DG: """ - \class DG - Dialysate Generator (DG) Dialin object API. It provides the basic interface to communicate with the DG firmware. - """ # DG message IDs @@ -77,14 +75,12 @@ """ DG constructor using can bus - \param can_interface: string with can bus name, e.g. "can0" - \returns DG object that allows communication with board via port - - \details For example: - + For example: dg_object = DG(can_interface='can0') or dg_object = DG('can0') + @param can_interface: string with can bus name, e.g. "can0" + @return: DG object that allows communication with board via port """ # Create listener self.can_interface = DenaliCanMessenger(can_interface=can_interface) @@ -95,10 +91,10 @@ channel_id = DenaliChannels.dg_sync_broadcast_ch_id msg_id = self.MSG_ID_DG_OPERATION_MODE_BROADCAST self.can_interface.register_receiving_publication_function(channel_id, msg_id, - self.handler_dg_op_mode_sync) + self._handler_dg_op_mode_sync) self.can_interface.register_receiving_publication_function(DenaliChannels.dg_sync_broadcast_ch_id, self.MSG_ID_DG_DG_VERSION_RESPONSE, - self.handler_dg_version) + self._handler_dg_version) # initialize variables that will be populated by DG version response self.dg_version = None @@ -115,17 +111,17 @@ self.ro_pump = DGROPump(self.can_interface) self.drain_pump = DGDrainPump(self.can_interface) - def handler_dg_version(self, message): + def _handler_dg_version(self, message): """ Handler for response from DG regarding its version. - \param message: response message from HD regarding valid treatment parameter ranges.\n + @param message: response message from HD regarding valid treatment parameter ranges.\n U08 Major \n U08 Minor \n U08 Micro \n U16 Build \n - \returns None if unsuccessful, the version string if unpacked successfully + @return: None if unsuccessful, the version string if unpacked successfully """ major = struct.unpack('B', bytearray( message['message'][self.START_POS_MAJOR:self.END_POS_MAJOR])) @@ -141,13 +137,13 @@ print(self.dg_version) return self.dg_version - def handler_dg_op_mode_sync(self, message): + def _handler_dg_op_mode_sync(self, message): """ Handles published DG operation mode messages. Current DG operation mode is captured for reference. - \param message: published DG operation mode broadcast message - \returns none + @param message: published DG operation mode broadcast message + @return: None """ mode = struct.unpack('i', bytearray( @@ -163,7 +159,7 @@ Constructs and sends a login command via CAN bus. Login required before \n other commands can be sent to the DG. - \returns 1 if logged in, 0 if log in failed + @return: 1 if logged in, 0 if log in failed """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, @@ -190,9 +186,9 @@ Constructs and sends the insert DG message command. Given message will \n be inserted into the DG's received message queue for processing. - \param msg: byte array - properly formatted DG message to insert + @param msg: byte array - properly formatted DG message to insert - \returns 1 if successful, zero otherwise + @return: 1 if successful, zero otherwise """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id,