Ejemplo n.º 1
0
def timingLoopStart(num, time, mode, a, b):
    #check range of loop number
    if num < 41 or num > 60:
        print "ERROR:Loop number is out of bound!"

    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA3"
    list1[1] = "0x" + str(num)
    list1[2] = highValue(time)
    list1[3] = lowValue(time)
    list1[4] = mode
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 2
0
def sin(ZA, algorithm_mode, NID_A1, NID_A2, NID_A3, NID_A4, NID_A5, NID_A6,
        service_A, method_A, result_C, a, b):
    #result_C=math.sin(ZA)

    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA8"
    list1[1] = "0x01"
    list1[2] = algorithm_mode
    list1[3] = NID_A6
    list1[4] = NID_A5
    list1[5] = NID_A4
    list1[6] = NID_A3
    list1[7] = NID_A2
    list1[8] = NID_A1
    list1[9] = highValue(service_A)
    list1[10] = lowValue(service_A)
    list1[11] = highValue(method_A)
    list1[12] = lowValue(method_A)
    list1[23] = result_C
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    #print list1
    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 3
0
def timingLoopEnd(num, a, b):
    #check range of loop number
    if num < 41 or num > 60:
        print "ERROR:Loop number is out of bound!"

    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA3"

    if num > 40 and num < 50:
        n = num % 10
        list1[1] = "0xC" + str(n)

    if num >= 50 and num < 60:
        n = num % 10
        list1[1] = "0xD" + str(n)
    if num == 60:
        list1[1] = "0xE0"

    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    print output_bytes
    return output_bytes
Ejemplo n.º 4
0
def systemEnd(a,b):
	##generate list 1*30
	list1=[0]*30
	#fill in variables
	list1[0]="0xA2"
	list1[26]=highValue(a)
	list1[27]=lowValue(a)
	list1[28]=highValue(b)
	list1[29]=lowValue(b)
	##convert list to string
	string="".join(str(e) for e in list1)

	##convert string to bytes
	output_bytes=string.encode(encoding="utf-8")
	return output_bytes;
Ejemplo n.º 5
0
def exitLoop(a, b):
    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA3"
    list1[1] = "0x61"
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 6
0
def selfIncrease(result_C, a, b):

    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA6"
    list1[1] = "0x06"
    list1[2] = result_C
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 7
0
def infiniteLoopEnd(num, a, b):
    #check range of loop number
    if num <= 80 or num > 100:
        print "ERROR:Loop number is out of bound!"
    ##generate list 1*30
    list1 = [0] * 30
    #fill in variables
    list1[0] = "0xA3"
    list1[1] = "0x" + str(num)
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    print output_bytes
    return output_bytes
Ejemplo n.º 8
0
def delay03(time, mode, a, b):
    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA4"
    list1[1] = "0x03"
    list1[2] = highValue(time)
    list1[3] = lowValue(time)
    list1[4] = mode
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 9
0
def notEqual(ZA, ZB, algorithm_mode, NID_A1, NID_A2, NID_A3, NID_A4, NID_A5,
             NID_A6, service_A, method_A, NID_B1, NID_B2, NID_B3, NID_B4,
             NID_B5, NID_B6, service_B, method_B, a, b):

    if not (ZA == ZB):
        result_C = 1
    else:
        result_C = 0

    #print result_C

    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA7"
    list1[1] = "0x06"
    list1[2] = algorithm_mode
    list1[3] = NID_A6
    list1[4] = NID_A5
    list1[5] = NID_A4
    list1[6] = NID_A3
    list1[7] = NID_A2
    list1[8] = NID_A1
    list1[9] = highValue(service_A)
    list1[10] = lowValue(service_A)
    list1[11] = highValue(method_A)
    list1[12] = lowValue(method_A)
    list1[13] = NID_B6
    list1[14] = NID_B5
    list1[15] = NID_B4
    list1[16] = NID_B3
    list1[17] = NID_B2
    list1[18] = NID_B1
    list1[19] = highValue(service_B)
    list1[20] = lowValue(service_B)
    list1[21] = highValue(method_B)
    list1[22] = lowValue(method_B)
    list1[23] = result_C
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)
    #print list1
    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    #print output_bytes
    return output_bytes
Ejemplo n.º 10
0
def AND(algorithm_mode, NID_A1, NID_A2, NID_A3, NID_A4, NID_A5, NID_A6,
        service_A, method_A, NID_B1, NID_B2, NID_B3, NID_B4, NID_B5, NID_B6,
        service_B, method_B, ZA, ZB, a, b):
    ##generate list 1*30
    list1 = [0] * 30

    #fill in variables
    list1[0] = "0xA6"
    list1[1] = "0x20"
    list1[2] = algorithm_mode
    list1[3] = NID_A6
    list1[4] = NID_A5
    list1[5] = NID_A4
    list1[6] = NID_A3
    list1[7] = NID_A2
    list1[8] = NID_A1
    list1[9] = highValue(service_A)
    list1[10] = lowValue(service_A)
    list1[11] = highValue(method_A)
    list1[12] = lowValue(method_A)
    list1[13] = NID_B6
    list1[14] = NID_B5
    list1[15] = NID_B4
    list1[16] = NID_B3
    list1[17] = NID_B2
    list1[18] = NID_B1
    list1[19] = highValue(service_B)
    list1[20] = lowValue(service_B)
    list1[21] = highValue(method_B)
    list1[22] = lowValue(method_B)
    list1[23] = ZA and ZB
    list1[26] = highValue(a)
    list1[27] = lowValue(a)
    list1[28] = highValue(b)
    list1[29] = lowValue(b)

    ##convert list to string
    string = "".join(str(e) for e in list1)

    ##convert string to bytes
    output_bytes = string.encode(encoding="utf-8")
    print output_bytes
    return output_bytes