示例#1
0
 def setDouble(self,name, value, ignoreCurrent=False):
     writer = RemoteMeDataWriter()
     writer.writeUInt16(remotemeStruct.VariableType.DOUBLE._value_)
     writer.writeString(name)
     writer.writeDouble(1 if value else 0)
     self.__remoteMe.send(
         remotemeMessages.getVariableChangeMessage(self.__remoteMe.getDeviceId(), ignoreCurrent, writer.getBytes()))
示例#2
0
 def setText2(self, name, value, value2, ignoreCurrent=False):
     writer = RemoteMeDataWriter()
     writer.writeUInt16(remotemeStruct.VariableType.TEXT_2._value_)
     writer.writeString(name)
     writer.writeString(value)
     writer.writeString(value2)
     self.__remoteMe.send(
         remotemeMessages.getVariableChangeMessage(self.__remoteMe.getDeviceId(), ignoreCurrent, writer.getBytes()))
示例#3
0
 def setIntegerBoolean(self,name, value, value2, ignoreCurrent=False):
     writer = RemoteMeDataWriter()
     writer.writeUInt16(remotemeStruct.VariableType.INTEGER_BOOLEAN._value_)
     writer.writeString(name)
     writer.writeInt32(value)
     writer.writeUInt8(1 if value2 else 0)
     self.__remoteMe.send(
         remotemeMessages.getVariableChangeMessage(self.__remoteMe.getDeviceId(), ignoreCurrent, writer.getBytes()))
示例#4
0
 def setSmallInteger3(self,name, value, value2, value3, ignoreCurrent=False):
     writer = RemoteMeDataWriter()
     writer.writeUInt16(remotemeStruct.VariableType.SMALL_INTEGER_3._value_)
     writer.writeString(name)
     writer.writeInt16(value)
     writer.writeInt16(value2)
     writer.writeInt16(value3)
     self.__remoteMe.send(
         remotemeMessages.getVariableChangeMessage(self.__remoteMe.getDeviceId(), ignoreCurrent, writer.getBytes()))
示例#5
0
def getDecreaseGuestKeyCreditAndTimeMessage(senderDeviceId, sessionId, credit,
                                            time):
    writer = RemoteMeDataWriter()
    writer.writeUInt16(
        remotemeStruct.MessageType.DECREASE_GUEST_CREDIT_AND_TIME._value_)
    writer.writeUInt16(8)

    writer.writeUInt16(senderDeviceId)
    writer.writeUInt16(sessionId)
    writer.writeInt16(credit)
    writer.writeInt16(time)

    return writer.getBytes()
示例#6
0
def getVariableChangeMessage(senderDeviceId, ignoreCurrent, data):
    size = 5 + len(data)
    if ignoreCurrent:
        size += 2

    writer = RemoteMeDataWriter()
    writer.writeUInt16(
        remotemeStruct.MessageType.VARIABLE_CHANGE_MESSAGE._value_)
    writer.writeUInt16(size)

    writer.writeUInt16(senderDeviceId)
    if ignoreCurrent:
        writer.writeUInt8(1)
        writer.writeUInt16(senderDeviceId)
    else:
        writer.writeUInt8(0)

    writer.writeUInt16(1)
    writer.writeData(data)

    return writer.getBytes()
示例#7
0
def getSubscribeMessage(types):
    writer = RemoteMeDataWriter()
    writer.writeUInt16(remotemeStruct.MessageType.EVENT_SUBSCRIBER._value_)
    writer.writeUInt16(2 * len(types))
    for x in types:
        writer.writeUInt16(x._value_)
    return writer.getBytes()
示例#8
0
def getPushNotificationMessage(webPageDeviceId,
                               title,
                               body,
                               badge,
                               icon,
                               image,
                               vibrate=None):
    if vibrate is None:
        vibrate = []

    stringSize = 0
    stringSize += len(getByteArray(title))
    stringSize += len(getByteArray(body))
    stringSize += len(getByteArray(badge))
    stringSize += len(getByteArray(icon))
    stringSize += len(getByteArray(image))

    size = 2 + 5 + stringSize + 1 + len(vibrate)

    writer = RemoteMeDataWriter()
    writer.writeUInt16(
        remotemeStruct.MessageType.SEND_PUSH_NOTIFICATION._value_)
    writer.writeUInt16(size)

    writer.writeUInt16(webPageDeviceId)

    writer.writeString(title)
    writer.writeString(body)
    writer.writeString(badge)
    writer.writeString(icon)
    writer.writeString(image)
    writer.writeUInt16(len(vibrate))

    for x in vibrate:
        writer.writeUInt8(x / 10)

    return writer.getBytes()