コード例 #1
0
    def getSetupPacket(commandType, crownstoneId, adminKey, memberKey,
                       guestKey, meshAccessAddress, ibeaconUUID, ibeaconMajor,
                       ibeaconMinor):
        """
		:param commandType:      	uint8 number
		:param crownstoneId:  		uint8 number
		:param adminKey:      		byteString (no conversion required)
		:param memberKey:     		byteString (no conversion required)
		:param guestKey:      		byteString (no conversion required)
		:param meshAccessAddress: 	hexstring
		:param ibeaconUUID: 		string  (ie. "1843423e-e175-4af0-a2e4-31e32f729a8a")
		:param ibeaconMajor:        uint16 number
		:param ibeaconMinor:        uint16 number
		:return:
		"""
        data = []
        data.append(commandType)
        data.append(crownstoneId)

        data += list(adminKey)
        data += list(memberKey)
        data += list(guestKey)

        if type(meshAccessAddress) is str:
            data += Conversion.hex_string_to_uint8_array(meshAccessAddress)
        else:
            data += Conversion.uint32_to_uint8_array(meshAccessAddress)

        data += Conversion.ibeaconUUIDString_to_reversed_uint8_array(
            ibeaconUUID)
        data += Conversion.uint16_to_uint8_array(ibeaconMajor)
        data += Conversion.uint16_to_uint8_array(ibeaconMinor)

        return ControlPacket(ControlType.SETUP).loadByteArray(data).getPacket()
コード例 #2
0
    def __init__(self, address, rssi, nameText, serviceData, serviceUUID=None):
        self.address = address
        self.rssi = rssi
        self.name = nameText

        self.serviceUUID = serviceUUID
        self.serviceData = None
        self.operationMode = None

        dataString = serviceData

        if serviceData is not None:
            if isinstance(serviceData, str):
                dataArray = Conversion.hex_string_to_uint8_array(dataString)
                self.serviceUUID = Conversion.uint8_array_to_uint16(
                    [dataArray[0], dataArray[1]])
                # pop the service UUID
                dataArray.pop(0)
                dataArray.pop(0)
            else:
                dataArray = serviceData

            if dataArray:
                self.serviceData = ServiceData(dataArray)

            self.operationMode = "NORMAL"
コード例 #3
0
    def __init__(self, address, rssi, nameText, serviceDataText):
        self.address = address
        self.rssi = rssi
        self.name = nameText

        dataString = serviceDataText

        if serviceDataText is not None:
            dataArray = Conversion.hex_string_to_uint8_array(dataString)
            self.serviceUUID = Conversion.uint8_array_to_uint16(
                [dataArray[0], dataArray[1]])

            # pop the service UUID
            dataArray.pop(0)
            dataArray.pop(0)

            if serviceDataText:
                self.serviceData = ServiceData(dataArray)

            self.operationMode = "NORMAL"
コード例 #4
0
 def writeMeshAccessAddress(self, meshAccessAddress):
     self._writeConfigPacket(
         WriteConfigPacket(
             ConfigurationType.MESH_ACCESS_ADDRESS).loadByteArray(
                 Conversion.hex_string_to_uint8_array(
                     meshAccessAddress)).getPacket())