'''
Created on 5 set 2019

@author: Emanuele Trabattoni
'''
VAR_NAME = 0
VAR_REG = 1
VAR_ID = 2

SAM_TS = 0
SAM_VAL = 1

HTTP_HEADER = {
    'Content-Type':'text/xml',
    'Accept':'*/*',
    'Cache-Control':'no-cache'
    }

XML_HEADER = \
'<?xml version="1.0" encoding="utf-8"?>\r\n'

REQ_TEMPLATE = \
'<?xml version="1.0" encoding="utf-8"?> \
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> \
    <soap:Body> \
    </soap:Body> \
</soap:Envelope> '

RESP_TEMPLATE = \
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:OPENcontrol"> \
    <SOAP-ENV:Body> \
    </SOAP-ENV:Body> \
</SOAP-ENV:Envelope> \
'
XMLNS_ENV = {'xmlns:soap':'http://schemas.xmlsoap.org/soap/envelope/',
         'xmlns:xsi':'http://www.w3.org/2001/XMLSchema-instance',
         'xmlns:xsd':'http://www.w3.org/2001/XMLSchema'
         }

XMLNS_RESP = {'ns':'urn:OPENcontrol',
         'xsi':'http://www.w3.org/2001/XMLSchema-instance',
         'xsd':'http://www.w3.org/2001/XMLSchema',
         'SOAP-ENV':'http://schemas.xmlsoap.org/soap/envelope/',
         'SOAP-ENC':'http://schemas.xmlsoap.org/soap/encoding/'
         }

XMLNS_BODY = {'xmlns':'urn:OPENcontrol'}

COMMANDS = {
    'GetHWKey': {
        'attrib': XMLNS_BODY
        },
    'GetAvailableCustomEvents': {
        'attrib': XMLNS_BODY ,
        'elem': {
            'MaxEvents': '64'
            }
        },
    'GetProcessConfNum': {
        'attrib': XMLNS_BODY
        },
    'GetAxesInfo3': {
        'attrib': XMLNS_BODY,
        'elem': {
            'AxisId':'65535',
            'AxesNum': '64'
            }
        },
    'GetSysTick': {
        'attrib': XMLNS_BODY
        },
    'MonOpenChannel': {
        'attrib': XMLNS_BODY,
        'elem': {
            'Synchronized': 'false'
            }
        },
    'MonCloseChannel': {
        'attrib': XMLNS_BODY,
        'elem': {
            'Synchronized': 'false'
            }
        },
    'MonAddVariable': {
        'attrib': XMLNS_BODY,
        'elem': {
            'ChannelID': '0',
            'VarDescr': {
                'Class':'1',
                'SubClass':'0',
                'DeviceID': 'XXXX',
                'Code':'XXXX',
                'Address':'0',
                'Signal':'0',
                'SamplingPeriod':'XXXX'}
            }
        },
    'MonStartSampling': {
        'attrib': XMLNS_BODY,
        'elem': {
            'ChannelID': '0'
            }
        },
    'MonStopSampling': {
        'attrib': XMLNS_BODY,
        'elem': {
            'ChannelID': '0'
            }
        },
    'MonGetVariableS': {
        'attrib': XMLNS_BODY,
        'elem': {
            'ChannelID': '0',
            'VariableID': 'XXXX',
            }
        },
    }