# -*- coding: utf-8 -*-
# (c) Copyright 2020 Sensirion AG, Switzerland
##############################################################################
##############################################################################
# _____ _ _ _______ _____ ____ _ _
# / ____| /\ | | | |__ __|_ _/ __ \| \ | |
# | | / \ | | | | | | | || | | | \| |
# | | / /\ \| | | | | | | || | | | . ` |
# | |____ / ____ \ |__| | | | _| || |__| | |\ |
# \_____/_/ \_\____/ |_| |_____\____/|_| \_|
#
# THIS FILE IS AUTOMATICALLY GENERATED AND MUST NOT BE EDITED MANUALLY!
#
# Generator: sensirion-shdlc-interface-generator 0.8.2
# Product: SVM40
# Version: 0.3.0
#
##############################################################################
##############################################################################
# flake8: noqa
from __future__ import absolute_import, division, print_function
from sensirion_shdlc_driver.command import ShdlcCommand
from struct import pack, unpack
import logging
log = logging.getLogger(__name__)
[docs]class Svm40CmdGetProductType(Svm40CmdDeviceInformationBase):
"""
Get Product Type Command
Gets the product type from the device.
"""
[docs] def __init__(self):
"""
Constructor.
"""
super(Svm40CmdGetProductType, self).__init__(
data=b"".join([bytes(bytearray([0x00]))]),
max_response_time=0.05,
post_processing_time=0.0,
min_response_length=0,
max_response_length=255
)
[docs] @staticmethod
def interpret_response(data):
"""
:return: String containing the product type.
:rtype: str
"""
product_type = str(data[0:].decode('utf-8').rstrip('\0')) # string
return product_type
[docs]class Svm40CmdGetProductName(Svm40CmdDeviceInformationBase):
"""
Get Product Name Command
Gets the product name from the device.
"""
[docs] def __init__(self):
"""
Constructor.
"""
super(Svm40CmdGetProductName, self).__init__(
data=b"".join([bytes(bytearray([0x01]))]),
max_response_time=0.05,
post_processing_time=0.0,
min_response_length=0,
max_response_length=255
)
[docs] @staticmethod
def interpret_response(data):
"""
:return: String containing the product name.
:rtype: str
"""
product_name = str(data[0:].decode('utf-8').rstrip('\0')) # string
return product_name
[docs]class Svm40CmdGetSerialNumber(Svm40CmdDeviceInformationBase):
"""
Get Serial Number Command
Gets the serial number from the device.
"""
[docs] def __init__(self):
"""
Constructor.
"""
super(Svm40CmdGetSerialNumber, self).__init__(
data=b"".join([bytes(bytearray([0x03]))]),
max_response_time=0.05,
post_processing_time=0.0,
min_response_length=0,
max_response_length=255
)
[docs] @staticmethod
def interpret_response(data):
"""
:return: String containing the serial number.
:rtype: str
"""
serial_number = str(data[0:].decode('utf-8').rstrip('\0')) # string
return serial_number