Exemple #1
0
    contenu = fichier.readlines()
    nombreLigne = len(contenu)
    i = 0
    while (i < (nombreLigne - 1)):
        i = i + 1
        Ligne = contenu[i]
        Separe = Ligne.split()
        if Alias == Separe[0]:
            #lance la video par windows media player
            callWMplayer(Separe[1])
            break

    fichier.close()


def OnExit():
    pass


def OnStart():
    # Register callback on package shutdown
    Constellation.OnExitCallback = OnExit

    # Last StateObjects of the previous instance
    if Constellation.LastStateObjects:
        for so in Constellation.LastStateObjects:
            Constellation.WriteInfo(" + %s @ %s" % (so.Name, so.LastUpdate))


Constellation.Start(OnStart)
                                device["RegisterAddress"],
                                device["RegistersCount"], device["SlaveID"])
                            result = {}
                            for prop in device["Properties"]:
                                try:
                                    result[prop["Name"]] = eval(
                                        prop["Selector"])
                                except Exception, e:
                                    Constellation.WriteError(
                                        "Error on the property '%s' of '%s' : %s"
                                        %
                                        (prop["Name"], device["Name"], str(e)))
                            Constellation.PushStateObject(
                                device["Name"],
                                result,
                                "Modbus.%s" % device["StateObjectTypeName"],
                                lifetime=(device["RequestInterval"] / 1000) *
                                2,
                                metadatas={"SlaveID": device["SlaveID"]})
                        except Exception, e:
                            Constellation.WriteError(
                                "Error while requesting %s : %s" %
                                (device["Name"], str(e)))
        except Exception, e:
            Constellation.WriteError("Error while reading configuration : %s" %
                                     str(e))
    time.sleep(1)


Constellation.Start(Start)