Beispiel #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()))
Beispiel #2
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()))
Beispiel #3
0
 def setSmallInteger2(self,name, value, value2, ignoreCurrent=False):
     writer = RemoteMeDataWriter()
     writer.writeUInt16(remotemeStruct.VariableType.SMALL_INTEGER_2._value_)
     writer.writeString(name)
     writer.writeInt16(value)
     writer.writeInt16(value2)
     self.__remoteMe.send(
         remotemeMessages.getVariableChangeMessage(self.__remoteMe.getDeviceId(), ignoreCurrent, writer.getBytes()))
Beispiel #4
0
    def __sendNow(self,name,type):
        size = 2 + 2 + 2 + len(name) + 1

        wr = RemoteMeDataWriter()

        wr.writeInt16(remotemeStruct.MessageType.OBSERVER_REGISTER_MESSAGE.value)
        wr.writeInt16(size)
        wr.writeInt16(self.__remoteMe.getDeviceId())
        wr.writeInt16(1)
        wr.writeInt16(type.value)
        wr.writeString(name)

        self.__logger.debug("sending variable {} type:{}".format(name, type))
        self.__remoteMe.send(wr.getBytes())
Beispiel #5
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()