This free software is distributed under the GNU General Public License.
See http://www.gnu.org/licenses/gpl.html for details.
This license restricts your usage of the software in derivative works.

* * * * * 

Module wide definitions

"""

import enumeration

ERROR_STATUS = enumeration.Enumeration([
    ('None', 0x0, "None"), ('InputVoltage', 0x1, "Input Voltage Error"),
    ('AngleLimit', 0x2, "Angle Limit Error"),
    ('Overheating', 0x4, "Overheating Error"), ('Range', 0x8, "Range Error"),
    ('Checksum', 0x10, "Checksum Error"), ('Overload', 0x20, "Overload Error"),
    ('Instruction', 0x40, "Instruction Error")
])

BAUD_RATE = enumeration.Enumeration([('Baud_1000000', 1), ('Baud_500000', 3),
                                     ('Baud_400000', 4), ('Baud_250000', 7),
                                     ('Baud_200000', 9), ('Baud_115200', 0x10),
                                     ('Baud_57600', 0x22),
                                     ('Baud_19200', 0x67),
                                     ('Baud_9600', 0xcf)])

REGISTER = enumeration.Enumeration([
    ('ModelNumber', 0, "Model Number"),
    ('FirmwareVersion', 2, "Firmware Version"), ('Id', 3, "Id"),
    ('BaudRate', 4, "Baud Rate"), ('ReturnDelay', 5, "Return Delay"),
Exemple #2
0
Module wide definitions

"""

import enumeration

ERROR_STATUS = enumeration.Enumeration([('None', 0x0, {
    'textDesc': "None"
}), ('InputVoltage', 0x1, {
    'textDesc': "Input Voltage Error"
}), ('AngleLimit', 0x2, {
    'textDesc': "Angle Limit Error"
}), ('Overheating', 0x4, {
    'textDesc': "Overheating Error"
}), ('Range', 0x8, {
    'textDesc': "Range Error"
}), ('Checksum', 0x10, {
    'textDesc': "Checksum Error"
}), ('Overload', 0x20, {
    'textDesc': "Overload Error"
}), ('Instruction', 0x40, {
    'textDesc': "Instruction Error"
})])

BAUD_RATE = enumeration.Enumeration([('Baud_1000000', 1), ('Baud_500000', 3),
                                     ('Baud_400000', 4), ('Baud_250000', 7),
                                     ('Baud_200000', 9), ('Baud_115200', 0x10),
                                     ('Baud_57600', 0x22),
                                     ('Baud_19200', 0x67),
                                     ('Baud_9600', 0xcf)])
Exemple #3
0
String = ctypes.c_char_p
StringPtr = ctypes.POINTER(String)
Int = ctypes.c_int
IntPtr = ctypes.POINTER(Int)
Enum = ctypes.c_int
Length = ctypes.c_uint
Bool = ctypes.c_short

c_tango = ctypes.CDLL(_tango_lib_name)

TangoDataType = Enum
TangoDataTypeEnum = enumeration.Enumeration(
    "TangoDataTypeEnum",
    ("DEV_VOID", "DEV_BOOLEAN", "DEV_SHORT", "DEV_LONG", "DEV_FLOAT",
     "DEV_DOUBLE", "DEV_USHORT", "DEV_ULONG", "DEV_STRING", "DEVVAR_CHARARRAY",
     "DEVVAR_SHORTARRAY", "DEVVAR_LONGARRAY", "DEVVAR_FLOATARRAY",
     "DEVVAR_DOUBLEARRAY", "DEVVAR_USHORTARRAY", "DEVVAR_ULONGARRAY",
     "DEVVAR_STRINGARRAY", "DEVVAR_LONGSTRINGARRAY",
     "DEVVAR_DOUBLESTRINGARRAY", "DEV_STATE", "CONST_DEV_STRING",
     "DEVVAR_BOOLEANARRAY", "DEV_UCHAR", "DEV_LONG64", "DEV_ULONG64",
     "DEVVAR_LONG64ARRAY", "DEVVAR_ULONG64ARRAY", "DEV_INT"))
locals().update(TangoDataTypeEnum.lookup)
TangoDataTypePtr = ctypes.POINTER(TangoDataType)


def _is_scalar(data_type):
    if data_type <= TangoDataTypeEnum.DEV_STRING: return True
    if data_type > TangoDataTypeEnum.DEV_STRING and data_type < TangoDataTypeEnum.DEV_STATE:
        return False
    if data_type == TangoDataTypeEnum.DEVVAR_BOOLEANARRAY or \
       data_type == TangoDataTypeEnum.DEVVAR_LONG64ARRAY or \
       data_type == TangoDataTypeEnum.DEVVAR_ULONG64ARRAY: