示例#1
0
from readWrite import read, write, createApplication, doStop
from createDeviceChain import createChain 
from sql_insert import insertNewRow
import time, os, subprocess



#CHANGES
deviceChain = createChain()
device = deviceChain
setpoint = 72


i = 0

while device != None:
	try:
		if i < 2:
			createApplication(device)
	except:
		print "Except: "
	finally:
		device = device.getNext()
		i += 1


for x in range(0,2):
	device = deviceChain
	i = 0	
	while device != None:
import sys
sys.path.insert(0, '../database/database')
from sql_insert import insertNewRow
from createDeviceChain import createChain 
from cplReadWrite import doStart, doStop, read, write
import time, sys
from ErrorClasses import *

# STILL NEED TO DO ERROR CHECKING FOR WHOLE PROGRAM

setpoint = 80
deviceList = createChain()
started = False

#Testing Thread connections
connected = True
startM = time.time()
count = 0
run = True


#while run == True:
for x in range(0,1):
    count = count + 1
    start = time.time()                     ################################
    here = deviceList
    while here != None:
        try:
            print "Connecting to " + here.getObjectName()
            started = doStart(here)
            if started == True:
示例#3
0
from readWrite import read, write, createApplication, doStop
from createDeviceChain import createChain
from sql_insert import insertNewRow
import time, os, subprocess

#deviceChain holds a pointer to the start of the singly linked list of device objects
deviceChain = createChain()
#device is used to iterate through the linked list
device = deviceChain

#this is a hard coded value right now but  will need to be changed so that it gets the setpoint from a database table.
setpoint = 72

while device != None:
    try:
        createApplication(device)
    except:
        print "Except: "
    finally:
        device = device.getNext()

#This outer for loop determines how many times we ask the devices for information. Eventually this will be and infinite loop
#All of the print statements are here for diagnostic reasons. They will be removed from the final product
for x in range(0, 2):
    device = deviceChain
    i = 0
    while device != None:

        print device.getObjectName(
        )  #Prints what device you are talking with, i.e. controller one