[docs]classEcuTask:def__init__(self,dll:CANapeDll,asap3_handle:cnp_class.TAsap3Hdl,# type: ignore[valid-type]module_handle:cnp_class.TModulHdl,task_info:cnp_class.TTaskInfo2,)->None:"""The :class:`~pycanape.ecu_task.EcuTask` class is not meant to be instantiated by the user. :class:`~pycanape.ecu_task.EcuTask` instances are returned by :meth:`~pycanape.module.Module.get_ecu_tasks`. :param asap3_handle: :param module_handle: :param task_info: """self._dll=dllself._asap3_handle=asap3_handleself._module_handle=module_handleself._task_info=task_infodef__str__(self)->str:returnf"EcuTask {self.description}"def__repr__(self)->str:returnself.__str__()@propertydefdescription(self)->str:"""Description text"""returnself._task_info.description.decode(RC["ENCODING"])@propertydeftask_id(self)->int:"""Identification number. The task Id is dynamically generated by CANape depending on internal definitions. """returnself._task_info.taskId@propertydeftask_cycle(self)->int:"""Cycle rate in msec. 0 if not a cyclic task or unknown. In case of modes polling or cycle this parameter has no sense. """returnself._task_info.taskCycle@propertydefevent_channel(self)->int:returnself._task_info.eventChannel
[docs]defdaq_setup_channel(self,measurement_object_name:str,polling_rate:int,save_to_file:bool)->None:"""Add a measurement object to the data acquisition channel list. :param measurement_object_name: Name of object to measure :param polling_rate: If accquisition mode is polling this specifies the polling rate. Reduce the original sample rate of ECU data. Example: If the sample rate of the ECU is 1 per 10msec, but the CANapeAPI client is set to receive data only every 50msec, the option 'downsampling' must be set to 5. :param save_to_file: Save this channel to measurement file. Therefore the currently selected Recorder will be used """self._dll.Asap3SetupDataAcquisitionChnl(self._asap3_handle,self._module_handle,measurement_object_name.encode(RC["ENCODING"]),cnp_constants.TFormat.PHYSICAL_REPRESENTATION,self.task_id,polling_rate,save_to_file,)
[docs]defdaq_check_overrun(self,reset_overrun:bool=False)->None:"""Check if data have been lost due to FIFO overrun. Asap3CheckOverrun doesn't have any impact to the FIFO data. All data are available excluding the data record which caused the overrun. :param reset_overrun: If True reset the overrun flag in CANape """self._dll.Asap3CheckOverrun(self._asap3_handle,self._module_handle,self.task_id,reset_overrun,)
[docs]defdaq_get_fifo_level(self)->int:"""Get number of samples in FIFO."""fifo_level=self._dll.Asap3GetFifoLevel(self._asap3_handle,self._module_handle,self.task_id,)returnfifo_level