legit-fork
flowswitch 2019-02-20 01:57:12 +01:00 committed by GitHub
parent 1385c5794a
commit 7e454d7618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 24 deletions

View File

@ -1,24 +0,0 @@
"""Manufacturer commands"""
from struct import pack, unpack
from .base import BaseCommand, InvalidResponse
class AuthError(Exception):
pass
class WriteSN(BaseCommand):
def __init__(self, dev, sn, auth):
super(WriteSN, self).__init__(dst=dev, cmd=0x18, arg=0x10, data=pack("<14sL", sn, auth), has_response=True)
self.dev = dev
def handle_response(self, response):
if len(response.data)!=0:
raise InvalidResponse("WriteSN {0:X}".format(self.dev))
if response.arg!=1:
raise AuthError("WriteSN {0:X}".format(self.dev))
return True
__all__=["AuthError", "WriteSN"]