示例#1
0
def generateReferenceCode(reference):
    if reference.isForward:
        return "retVal |= UA_Server_addReference(server, %s, %s, %s, true);" % \
               (generateNodeIdCode(reference.source),
                generateNodeIdCode(reference.referenceType),
                generateExpandedNodeIdCode(reference.target))
    else:
        return "retVal |= UA_Server_addReference(server, %s, %s, %s, false);" % \
               (generateNodeIdCode(reference.source),
                generateNodeIdCode(reference.referenceType),
                generateExpandedNodeIdCode(reference.target))
示例#2
0
def generateReferenceCode(reference):
    code = []
    forwardFlag = "true" if reference.isForward else "false"
    code.append("retVal |= UA_Server_addReference(server, %s, %s, %s, %s);" %
                (generateNodeIdCode(reference.source),
                 generateNodeIdCode(reference.referenceType),
                 generateExpandedNodeIdCode(reference.target), forwardFlag))
    code.append("if (retVal != UA_STATUSCODE_GOOD) return retVal;")
    return "\n".join(code)