浏览代码

update Project-Data

Tobias Müller 6 年之前
当前提交
57d1e97dc0

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 261 - 0
.gitignore

@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc

+ 32 - 0
Xcom-API.sln

@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.15
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test-Programs", "Test-Programs", "{664D3E14-9F68-4E17-9F1C-92DD170ED080}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xcom_API", "Xcom_API", "{123AE570-56FB-42AB-8831-B46F34F9D3D9}"
+EndProject
+Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Xcom_API", "Xcom-API\Xcom_API.pyproj", "{3905C665-5F14-4166-9263-F2B36F8AE666}"
+EndProject
+Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Xcom_Test_Program", "Xcom_Test_Program\Xcom_Test_Program.pyproj", "{9A291168-668C-4E76-B4D9-8437D2A91DB0}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3905C665-5F14-4166-9263-F2B36F8AE666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3905C665-5F14-4166-9263-F2B36F8AE666}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9A291168-668C-4E76-B4D9-8437D2A91DB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9A291168-668C-4E76-B4D9-8437D2A91DB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{3905C665-5F14-4166-9263-F2B36F8AE666} = {123AE570-56FB-42AB-8831-B46F34F9D3D9}
+		{9A291168-668C-4E76-B4D9-8437D2A91DB0} = {664D3E14-9F68-4E17-9F1C-92DD170ED080}
+	EndGlobalSection
+EndGlobal

+ 927 - 0
Xcom-API/Xcom_API.py

@@ -0,0 +1,927 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+##########################################################################################################################################
+#                                                        Python-File Information                                                         #
+##########################################################################################################################################
+#
+#   File:   Xcom_API.py
+#   Author: Tobias Müller
+#   Date:   2017.07.05
+#
+##########################################################################################################################################
+#                                                             Requirements                                                               #
+##########################################################################################################################################
+
+import struct
+
+##########################################################################################################################################
+#                                                     Class Definition & Description                                                     #
+##########################################################################################################################################
+
+#   This Class is used to generate Byte-Frames, which are needed to communicate with Xtender-Moduls over the RS232-BUS with the Xcom-232i.
+#   After generating  the Byte-Frame, you can use "pyserial" to communicate with the Serial-BUS and to put the Byte-Frame into the write-
+#   method of "pyserial". You can decode also Read-Frames of the Serial-BUS with this class. 
+#
+#   This class contains Methods to generate Read- or Write-Frames, and Methods to decode Frames. There are pre-defined types, properties 
+#   and formats for the most important Parameter- and Information-Numbers. This reduces the effort for generating Data-Frames, but there 
+#   are extended Methods to generate Byte-Frames with other Parameter- and Information-Numbers.
+
+class Xcom_API():
+
+    ##################################################################################################################################
+    #                                                     Program Information                                                        #
+    ##################################################################################################################################
+
+    __PROG_NAME                           = 'Xcom-API'
+    __PROG_Version                        = 'v1.0'   
+
+    ##################################################################################################################################
+    #                                                Private-Object-Instance-Counter                                                 #
+    ##################################################################################################################################
+
+    __object_counter                      = 0
+
+    ##################################################################################################################################
+    #                                                  Private-Attributes-Service_ID                                                 #
+    ##################################################################################################################################
+
+    __service_read                         = 1
+    __service_write                        = 2
+
+    ##################################################################################################################################
+    #                                                Protected-Attributes-Object_Type                                                #
+    ##################################################################################################################################
+
+    _object_type_info                     = 1
+    _object_type_parameter                = 2
+    _object_type_message                  = 3
+    _object_type_datalog_field            = 5
+    _object_type_datalog_transfer         = 257
+
+    ##################################################################################################################################
+    #                                              Protected-Attributes-Info-Object_ID                                               #
+    ##################################################################################################################################
+
+    _info_battery_voltage                 = 3000
+    _info_battery_temperature             = 3001
+    _info_battery_charge_current          = 3005
+    _info_battery_voltage_ripple          = 3006
+    _info_state_of_charge                 = 3007
+    _info_number_of_battery_elements      = 3050
+    _info_input_voltage                   = 3011
+    _info_input_current                   = 3012
+    _info_input_frequency                 = 3084
+    _info_input_power                     = 3138
+    _info_output_voltage                  = 3021
+    _info_output_current                  = 3022
+    _info_output_frequency                = 3085
+    _info_output_power                    = 3139
+    _info_operating_state                 = 3028
+    _info_boost_active                    = 3019
+    _info_state_of_inverter               = 3049
+    _info_state_of_transfer_relay         = 3020
+    _info_state_of_output_relay           = 3030
+    _info_state_of_aux_relay_1            = 3031
+    _info_state_of_aux_relay_2            = 3032
+    _info_state_of_ground_relay           = 3074
+    _info_state_of_neutral_transfer_relay = 3075
+    _info_state_of_remote_entry           = 3086
+
+    ##################################################################################################################################
+    #                                           Protected-Attributes-Parameter-Object_ID                                             #
+    ##################################################################################################################################
+
+    _para_maximum_current_of_ac_source    = 1107
+    _para_battery_charge_current          = 1138
+    _para_smart_boost_allowed             = 1126
+    _para_inverter_allowed                = 1124
+    _para_type_of_detection_of_grid_loss  = 1552
+    _para_charger_allowed                 = 1125
+    _para_charger_uses_only_power_from_ac = 1646
+    _para_ac_output_voltage               = 1286
+    _para_inverter_frequency              = 1112
+    _para_transfer_relay_allowed          = 1128
+    _para_limitation_of_the_power_boost   = 1607
+    _para_remote_entry_active             = 1545
+
+    ##################################################################################################################################
+    #                                               Protected-Attributes-Property_ID                                                 #
+    ##################################################################################################################################
+
+    _property_id_value                    = 1
+    _property_id_string                   = 1
+    _property_id_value_qsp                = 5
+    _property_id_min_qsp                  = 6
+    _property_id_max_qsp                  = 7
+    _property_id_level_qsp                = 8
+    _property_id_unsaved_value_qsp        = 13
+    _property_id_invalid_Action           = 0
+    _property_id_sd_start                 = 21
+    _property_id_sd_datablock             = 22
+    _property_id_sd_ack_continue          = 23
+    _property_id_sd_nack_retry            = 24
+    _property_id_sd_abort                 = 25
+    _property_id_sd_finish                = 26
+
+    ##################################################################################################################################
+    #                                                  Protected-Attributes-Format                                                   #
+    ##################################################################################################################################
+
+    _format_bool                          = [1,1]
+    _format_format                        = [2,2]
+    _format_short_int                     = [3,2]
+    _format_enum                          = [4,2]
+    _format_short_enum                    = [5,2]
+    _format_long_enum                     = [6,4]
+    _format_error                         = [7,2]
+    _format_int32                         = [8,4]
+    _format_float                         = [9,4]
+    _format_byte                          = [10,1]
+
+    ##################################################################################################################################
+    #                                                        Private-Level-QSP                                                       #
+    ##################################################################################################################################
+    
+    __level_qsp_view_only                 = 0x0000
+    __level_qsp_basic                     = 0x0010
+    __level_qsp_expert                    = 0x0020
+    __level_qsp_installer                 = 0x0030
+    __level_qsp_qsp                       = 0x0040
+
+    ##################################################################################################################################
+    #                                                       Private-Attributes                                                       #
+    ##################################################################################################################################
+                             
+    __start_byte                          = 0xAA
+    __frame_flags                         = 0x00
+    __data_flags                          = 0x00
+    __data_frame                          = 0x0A
+
+    #   Dictionary of Error-Codes-Descriptions
+
+    __error_code_dict   =  {0x0001  :   'INVALID_FRAME',
+                            0x0002  :   'DEVICE_NOT_FOUND',
+                            0x0003  :   'RESPONSE_TIMEOUT',
+                            0x0011  :   'SERVICE_NOT_SUPPORTED',
+                            0x0012  :   'INVALID_SERVICE_ARGUMENT',
+                            0x0013  :   'SCOM_ERROR_GATEWAY_BUSY',
+                            0x0021  :   'TYPE_NOT_SUPPORTED',
+                            0x0022  :   'OBJECT_ID_NOT_FOUND',
+                            0x0023  :   'PROPERTY_NOT_SUPPORTED',
+                            0x0024  :   'INVALID_DATA_LENGTH',
+                            0x0025  :   'PROPERTY_IS_READ_ONLY',
+                            0x0026  :   'INVALID_DATA',
+                            0x0027  :   'DATA_TOO_SMALL',
+                            0x0028  :   'DATA_TO_BIG',
+                            0x0029  :   'WRITE_PROPERTY_FAILED',
+                            0x002A  :   'READ_PROPERTY_FAILED',
+                            0X002B  :   'ACCESS_DENIED',
+                            0x002C  :   'SCOM_ERROR_OBJECT_NOT_SUPPORTED',
+                            0x002D  :   'SCOM_ERROR_MULTICAST_READ_NOT_SUPPORTED',
+                            0x002E  :   'OBJECT_PROPERTY_INVALID',
+                            0x002F  :   'FILE_OR_DIR_NOT_PRESENT',
+                            0x0030  :   'FILE_CORRUPTED',
+                            0x0081  :   'INVALID_SHELL_ARG'}
+
+    #   Dictionary of Parameter-Info-Numbers with type, property and format
+
+    __para_info_dict    =  {3000    :   [_object_type_info,_property_id_value,_format_float],
+                            3001    :   [_object_type_info,_property_id_value,_format_float],
+                            3005    :   [_object_type_info,_property_id_value,_format_float],
+                            3006    :   [_object_type_info,_property_id_value,_format_float],
+                            3007    :   [_object_type_info,_property_id_value,_format_float],
+                            3050    :   [_object_type_info,_property_id_value,_format_float],
+                            3011    :   [_object_type_info,_property_id_value,_format_float],
+                            3012    :   [_object_type_info,_property_id_value,_format_float],
+                            3084    :   [_object_type_info,_property_id_value,_format_float],
+                            3138    :   [_object_type_info,_property_id_value,_format_float],
+                            3020    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3021    :   [_object_type_info,_property_id_value,_format_float],
+                            3022    :   [_object_type_info,_property_id_value,_format_float],
+                            3085    :   [_object_type_info,_property_id_value,_format_float],
+                            3139    :   [_object_type_info,_property_id_value,_format_float],
+                            3028    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3019    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3049    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3030    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3031    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3032    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3074    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3075    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3086    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            1107    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1138    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1126    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1124    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1552    :   [_object_type_parameter,_property_id_value_qsp,_format_long_enum],
+                            1125    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1646    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1286    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1112    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1128    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1607    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1545    :   [_object_type_parameter,_property_id_value_qsp,_format_long_enum]}
+
+    ##################################################################################################################################
+    #                                                       Constructor-Method                                                       #
+    ##################################################################################################################################
+
+    #   This Method is used with generating an object of this class. There are pre-defined options (CRC-Check, source-address, 
+    #   destination-address) for this object, when you generate an objects without relevant arguments.
+
+    def __init__(self, crc = True, source = 1, destination = 101):
+        
+        # Check the type of the argument "crc". It raises a "ValueError" with a false type.
+        if not isinstance(crc, bool):
+            raise ValueError('CRC is not type \"bool\"!')
+
+        # Check the type of the argument "source". It raises a "ValueError" with a false type.
+        elif not isinstance(source, int) or isinstance(source, bool):
+            raise ValueError('Source-Address is not type \"int\"!')
+
+        # Check the range of the argument "source" It raises a "ValueError", if the argument is out of range.
+        elif not 0<source<100:
+            raise ValueError('Source-Address is out of range!')
+
+        # Check the type of the argument "destination" It raises a "ValueError" with a false type.
+        elif not isinstance(destination, int) or isinstance(destination, bool):
+            raise ValueError('Destination-Address is not type \"int\"!')
+
+        # Check the range of the argument "destination" It raises a "ValueError", if the argument is out of range.
+        elif not (destination==0 or destination==401 or destination==501 or destination==601 or 100<=destination<=109 or 
+                191<=destination<=193 or 300<=destination<=315 or 700<=destination<=715):
+            raise ValueError('Destination-Address is out of range!')
+
+        # If there is no error, the arguments will be stored in variables of the object. The object-counter will be increased.
+        else:
+            self.__dest                = destination
+            self.__source              = source
+            self.__crc                 = crc
+            self.__frame_check_done    = False
+            Xcom_API.__object_counter += 1
+
+    ##################################################################################################################################
+    #                                                     Deconstructor-Method                                                       #
+    ##################################################################################################################################
+
+    #   This Method delete an object of this class with the stored variables and decrease the object-counter.
+
+    def __del__(self):
+        del self.__crc
+        del self.__source
+        del self.__dest
+        del self.__frame_check_done
+        Xcom_API.__object_counter -= 1
+
+    ##################################################################################################################################
+    #                                                     Information-Methods                                                        #
+    ##################################################################################################################################
+
+    #   This method returns an integer-value of the source-address of an object
+
+    def get_source_address(self):
+        return self.__source
+
+    #   This method returns an integer-value of the destination-address of an object
+     
+    def get_destination_address(self):
+        return self.__dest
+
+    #   This method returns a boolean-value of the active-state of the CRC-Check of an object
+
+    def is_crc_check_active(self):
+        return self.__crc
+
+    #   This method returns a integer-value of the counter of active-objects of this class
+
+    @staticmethod
+    def get_object_counter():
+        return  Xcom_API.__object_counter
+    
+    #   This method returns a string of the of the program-name of this class
+
+    @staticmethod
+    def get_prog_name():
+        return Xcom_API.__PROG_NAME
+
+    #   This method returns a string of the of the program-version of this class
+
+    @staticmethod
+    def get_prog_version():
+        return Xcom_API.__PROG_Version
+
+    ##################################################################################################################################
+    #                                                       Private-Methods                                                          #
+    ##################################################################################################################################
+
+    #   This Method calculate the CRC-Values of a Frame. It returns the CRC-Values in a list.
+
+    def __calculate_checksum(byte_frame):
+
+        # Define two Buffers for the CRC-Values.
+        Buffer1 = 0xFF
+        Buffer2 = 0
+
+        # Calculate the CRC-Values of a Frame.
+        for i in range(0,len(byte_frame)):
+            Buffer1 = (Buffer1 + byte_frame[i]) % 256
+            Buffer2 = (Buffer1 + Buffer2) % 256
+            
+        # Return the CRC-Values in a list.
+        return [Buffer1, Buffer2]
+    
+    #   This Method generate a Byte-Frame of a Value depending of the format. It returns a list of Bytes, which are ordered in LSB to
+    #   MSB.
+
+    def __value_to_byte_frame(property_data, data_format):
+
+        # It checks the argument "data_format" for type "Bool" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the list of the Byte-Frame.
+        if   data_format==Xcom_API._format_bool:
+            if not 0<=property_data<=1 or not (isinstance(property_data, int) or isinstance(property_data, bool)):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"bool\"!')
+            else:
+                # Return a list of the Byte-Frame.
+                if property_data == 0 or property_data == False:
+                    return [0]
+                else:
+                    return [1]
+
+        # It checks the argument "data_format" for type "Byte" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_byte:
+            if not 0<=property_data<256 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Byte\"!')
+            else:
+                # Return a list of the Byte-Frame.
+                return [property_data]
+        
+        # It checks the argument "data_format" for type "Error" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_error:
+            if not 0<=property_data<=0x65535 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Error\"!')
+            else:
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Format" or "Short Integer" and check the range/type of "property_data", 
+        # depending of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of 
+        # the Byte-Frame.
+        elif data_format==Xcom_API._format_format or data_format==Xcom_API._format_short_int:
+            if not -32768<=property_data<=32767 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Format\" or \"Short Integer\"!')
+            else:
+                # Calculate the Byte-Frame.
+                if property_data<0:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(2**16 + property_data)
+
+                else:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(property_data)
+
+                    for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                        Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Enum" or "Short Enum" and check the range/type of "property_data", depending 
+        # of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame. 
+        # Only one Bit can be set in data_format of type "Enum".
+        elif data_format==Xcom_API._format_enum or data_format==Xcom_API._format_short_enum:
+            if not 0<=property_data<=32767 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+            else:
+                check = False
+                for i in range(0,16):
+                    if (2**i==2**i&property_data) and check:
+                        raise ValueError('Invalid \"property_data\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+                    elif 2**i==2**i&property_data:
+                        check = True
+
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Long Enum" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame. 
+        # Only one Bit can be set in data_format of type "Enum".
+        elif data_format==Xcom_API._format_long_enum:
+            if not 0<=property_data<=2147483647 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Long Enum\"!')
+            else:
+                check = False
+                for i in range(0,32):
+                    if (2**i==2**i&property_data) and check:
+                        raise ValueError('Invalid \"property_data\" for the data_format of type \"Long Enum\"!')
+                    elif 2**i==2**i&property_data:
+                        check = True
+
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[8:10],16),int(Buffer[6:8],16),int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "INT32" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_int32:
+            if not -2147483648<=property_data<=2147483647 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"INT32\"!')
+            else:
+                # Calculate the Byte-Frame.
+                if property_data<0:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(2**32 + property_data)
+
+                else:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(property_data)
+                    
+                    for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                        Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+                        
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[8:10],16),int(Buffer[6:8],16),int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Float" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_float:
+            if not -2147483648<=property_data<=2147483647 or not isinstance(property_data, float):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Float\"!')
+            else:
+                # Calculate the Byte-Frame.
+                Buffer = struct.pack("!f",property_data)
+
+                # Return a list of the Byte-Frame.
+                return [Buffer[3],Buffer[2],Buffer[1],Buffer[0]]
+
+        # It raises an Error, if the argument "data_format" doesn't fit.
+        else:
+            raise ValueError('data_format is unknown!')
+
+    #   This Method generate a Value of a Byte-Frame depending of the format. It returns the value as a integer.
+    
+    def __byte_frame_to_value(byte_frame, data_format):
+        
+        # It checks the argument "data_format" for type "Bool" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the value of the Byte-Frame.
+        if   data_format==Xcom_API._format_bool:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not 0<=byte_frame[0]<=1:
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"bool\"!')
+            else:
+                # Return the value of the Byte-Frame.
+                return byte_frame[0]
+            
+        # It checks the argument "data_format" for type "Byte" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_byte:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Byte\"!')
+            else:
+                # Return the value of the Byte-Frame.
+                return byte_frame[0]
+        
+        # It checks the argument "data_format" for type "Error" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_error:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Error\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                return int(Buffer,16)
+
+        # It checks the argument "data_format" for type "Format" or "Short Integer" and check the length/type of "byte_frame", depending 
+        # of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_format or data_format==Xcom_API._format_short_int:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Format\" or \"Short Integer\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<32768:
+                    return int(Buffer,16)
+                else:
+                    return (-65536 + int(Buffer,16))
+
+        # It checks the argument "data_format" for type "Enum" or "Short Enum" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_enum or data_format==Xcom_API._format_short_enum:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<32768:
+                    return int(Buffer,16)
+                else:
+                    raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+                
+        # It checks the argument "data_format" for type "Long Enum" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame. 
+        elif data_format==Xcom_API._format_long_enum:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame" for the data_format of type \"Long Enum\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<2147483648:
+                    return int(Buffer,16)
+                else:
+                    raise ValueError('Invalid \"byte_frame" for the data_format of type \"Long Enum\"!')
+
+        # It checks the argument "data_format" for type "INT32" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_int32:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"INT32\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<2147483648:
+                    return int(Buffer,16)
+                else:
+                    return (-4294967296 + int(Buffer,16))
+
+        # It checks the argument "data_format" for type "Float" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_float:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Float\"!')
+            else:
+                # Define a Buffer.
+                Buffer = bytearray([byte_frame[3],byte_frame[2],byte_frame[1],byte_frame[0]])
+
+                # Calculate and return the value of the Byte-Frame.
+                return struct.unpack("!f",Buffer)[0]     
+
+        # It raises an Error, if the argument "format" doesn't fit.
+        else:
+            raise ValueError('data_format is unknown!')
+
+    
+    #   This Method does a Frame-Check. It checks the startbyte, Frame-Length, the checksum and the response-flags. It returns a 
+    #   boolean-value of the result.
+
+    def __frame_check(self,bytearray_of_frame):
+        
+        # Define Buffer for Frame_check.
+        Buffer = list(bytearray_of_frame)
+        
+        try:
+            # Check Start-Byte available  
+            if not Buffer[0]==0xAA:
+                raise ValueError('Can\'t find Start-Frame (0xAA)')
+
+            # Check checksum if activated and check Frame-Length
+            if self.__crc and len(Buffer)>=14:
+                # check Header-Checksum
+                if not Xcom_API.__calculate_checksum(Buffer[1:12])==Buffer[12:14]:
+                    raise ValueError('Header-Checksum wrong!')
+                
+                # check Frame-Length
+                if not len(Buffer)==(Xcom_API.__value_to_byte_frame(Buffer[10:12],Xcom_API._format_short_int) + 16):
+                    raise ValueError('Frame is not complete!')
+                
+                # check Data-Checksum 
+                if not Xcom_API.__calculate_checksum(Buffer[14:(len(Buffer)-2)])==Buffer[(len(Buffer)-2):len(Buffer)]:
+                    raise ValueError('Data-Checksum wrong!')
+            
+            elif not self.__crc and len(Buffer)>=14:
+                # check Frame-Length
+                if not len(Buffer)==(Xcom_API.__value_to_byte_frame(Buffer[10:12],Xcom_API._format_short_int) + 16):
+                    raise ValueError('Frame is not complete!')                
+            
+            else:
+                raise ValueError('Frame is not complete!')
+            
+            # Check Response-Flags
+            if not Buffer[14]>0:
+                raise ValueError('Frame is not a Response-Frame!')
+            
+            return True
+               
+        except IndexError:
+            raise ValueError('Frame is not complete!') 
+        
+    ##################################################################################################################################
+    #                                                     Public-Methods                                                             #
+    ##################################################################################################################################
+
+    #   This method is used to generate a Byte-Frame for a 'read'-instruction. It Returns a List of Bytes.  
+    
+    def get_read_frame_ext(self, object_type, object_id, property_id):
+        
+        # Create Buffer
+        Buffer = []
+        
+        # Append Buffer with Start-Byte.
+        Buffer.append(Xcom_API.__start_byte)
+        
+        # Append Buffer with Frame-Flags.
+        Buffer.append(Xcom_API.__frame_flags)
+        
+        # Extend Buffer with Source-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__source,Xcom_API._format_int32))
+        
+        # Extend Buffer with Destination-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__dest,Xcom_API._format_int32))
+        
+        # Extend Buffer with Data-Length.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(Xcom_API.__data_frame,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Header-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[1:len(Buffer)]))
+        
+        # Append Buffer with Data-Flags.
+        Buffer.append(Xcom_API.__data_flags)
+        
+        # Append Buffer with Service_ID.
+        Buffer.append(Xcom_API.__service_read)
+        
+        # Extend Buffer with Opject_Type.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_type,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Object_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_id,Xcom_API._format_int32))
+        
+        # Extend Buffer with Property_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_id,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Data-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[14:len(Buffer)]))
+        
+        # Return Byte-Frame.
+        return bytearray(Buffer)
+        
+    #   This method is used to generate a Byte-Frame for a 'write'-instruction. It Returns a List of Bytes.
+    
+    def get_write_frame_ext(self, object_type, object_id, property_id, property_data, data_format):
+        
+        # Create Buffer
+        Buffer = []
+    
+        # Append Buffer with Start-Byte.
+        Buffer.append(Xcom_API.__start_byte)
+    
+        # Append Buffer with Frame-Flags.
+        Buffer.append(Xcom_API.__frame_flags)
+    
+        # Extend Buffer with Source-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__source,Xcom_API._format_int32))
+    
+        # Extend Buffer with Destination-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__dest,Xcom_API._format_int32))
+    
+        # Extend Buffer with Data-Length.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(Xcom_API.__data_frame + data_format[1],Xcom_API._format_short_int))
+    
+        # Extend Buffer with Header-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[1:len(Buffer)]))
+    
+        # Append Buffer with Data-Flags.
+        Buffer.append(Xcom_API.__data_flags)
+    
+        # Append Buffer with Service_ID.
+        Buffer.append(Xcom_API.__service_write)
+    
+        # Extend Buffer with Opject_Type.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_type,Xcom_API._format_short_int))
+    
+        # Extend Buffer with Object_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_id,Xcom_API._format_int32))
+    
+        # Extend Buffer with Property_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_id,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Property_Data.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_data,data_format))
+        
+        # Extend Buffer with Data-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[14:len(Buffer)]))
+    
+        # Return Byte-Frame.
+        return bytearray(Buffer)
+
+    #   This method is used to recieve Data from the Byte-Frame. It returns a List with the result of the returned Data and the Data 
+    #   itself.
+
+    def get_data_from_frame_ext(self, bytearray_of_frame, data_format):
+        
+        # Do a Frame-Check. If it fails, it returns a ValueError.
+        if not self.__frame_check_done:
+            if not Xcom_API.__frame_check(self, bytearray_of_frame):
+                raise ValueError('Frame-Check failed!')
+        self.__frame_check_done = False
+
+        # Check Frame for an Error and return the value.
+        if bytearray_of_frame[14] == 3:
+            return [True,Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:20]),Xcom_API._format_error)]
+        else:
+            return [False,Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:22]),data_format)]
+
+    #   This method is used to generate a Byte-Frame for a 'read'-instruction. It can only be used with a known Object_ID, otherwise it 
+    #   will raise a Value_Error. It Returns a List of Bytes.
+    
+    def get_read_frame(self, object_id):
+        
+        try:
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[object_id]
+            
+            # Return a Byte-Frame from the Read-Extenion method.
+            return self.get_read_frame_ext(Buffer[0],object_id,Buffer[1])
+        
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to generate a Byte-Frame for a 'write'-instruction. It can only be used with a known Object_ID, otherwise it 
+    #   will raise a Value_Error. It Returns a List of Bytes.
+        
+    def get_write_frame(self, object_id, property_data):
+        
+        try:
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[object_id]
+            
+            # Return a Byte-Frame from the Read-Extenion method.
+            return self.get_write_frame_ext(Buffer[0],object_id,Buffer[1],property_data,Buffer[2])
+        
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to recieve Data from the Byte-Frame. It can only be used with a known Object_ID, otherwise it will raise a 
+    #   Value_Error. It returns a List with the result of the returned Data and the Data itself.
+
+    def get_data_from_frame(self, bytearray_of_frame):
+
+        try:
+            # Do a Frame-Check. If it fails, it returns a ValueError.
+            if Xcom_API.__frame_check(self, bytearray_of_frame):
+                self.__frame_check_done = True
+            else:
+                raise ValueError('Frame-Check failed!')
+
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:22]),Xcom_API._format_int32)]
+
+            # Return a Byte-Frame from the Read-Extension method.
+            return self.get_data_from_frame_ext(bytearray_of_frame,Buffer[2])
+
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            self.__frame_check_done = False
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to return the frame-flags as a binary.
+
+    def get_bin_from_frame_flags(self, bytearray_of_frame):
+
+        # Do a Frame-Check. If it fails, it returns a ValueError.
+        if not Xcom_API.__frame_check(self, bytearray_of_frame):
+            raise ValueError('Frame-Check failed!')
+
+        # Create a Buffer with binary Information.
+        Buffer = bin(bytearray_of_frame)
+
+        # Extend Buffer to 8-bit
+        for i in range(0,10-len(Buffer)):
+            Buffer = Buffer[0:2] + '0' + Buffer[2:]
+        
+        # Return Buffer.
+        return Buffer
+
+    #   This method is used to return the frame-flags as a list with explanation (string) for each bit, starting with lsb.
+
+    def get_text_from_frame_flags(self, bytearray_of_frame):
+        
+        # Create Buffer and get binary from byte-frame.
+        Buffer = self.get_bin_from_frame_flags(bytearray_of_frame)
+        
+        # Create Out-Buffer.
+        BufferOut = []
+
+        # Check bit 0.
+        if int(Buffer[9]) == 1:
+            BufferOut.append('Messages are pending.')
+        else:
+            BufferOut.append('No messages are pending.')
+
+        # Check bit 1.
+        if int(Buffer[8]) == 1:
+            BufferOut.append('A reset or restart was carried out.')
+        else:
+            BufferOut.append('No reset or restart was carried out.')
+
+        # Check bit 2.
+        if int(Buffer[7]) == 1:
+            BufferOut.append('The SD-Card is present.')
+        else:
+            BufferOut.append('No SD-Card is present')
+
+        # Check bit 3.
+        if int(Buffer[6]) == 1:
+            BufferOut.append('The SD-Card is full.')
+        else:
+            BufferOut.append('The SD-Card is not full.')
+
+        # Check bit 4.
+        if int(Buffer[5]) == 1:
+            BufferOut.append('New datalog file on the SD-Card.')
+        else:
+            BufferOut.append('No new datalog file on the SD-Card.')
+
+        # Check bit 5.
+        if int(Buffer[4]) == 1:
+            BufferOut.append('Datalogger is supported.')
+        else:
+            BufferOut.append('Datalogger is not supported.')
+
+        # Return list with Frame-flag informations.
+        return BufferOut
+
+    #   This method is used to get the error message from the error-id.
+
+    def get_text_from_error_id(self, error_id):
+        
+        try:
+            # Check ID and store error-message in Buffer
+            Buffer = Xcom_API.__error_code_dict[error_id]
+
+            # return error-message
+            return Buffer
+
+        except KeyError:
+            # If Error ID is unknown
+            return 'Error-ID is unknown.'

+ 36 - 0
Xcom-API/Xcom_API.pyproj

@@ -0,0 +1,36 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>3905c665-5f14-4166-9263-f2b36f8ae666</ProjectGuid>
+    <ProjectHome>
+    </ProjectHome>
+    <StartupFile>Xcom_API.py</StartupFile>
+    <SearchPath>
+    </SearchPath>
+    <WorkingDirectory>.</WorkingDirectory>
+    <OutputPath>.</OutputPath>
+    <Name>Xcom_API</Name>
+    <RootNamespace>Xcom_API</RootNamespace>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="Xcom_API.py" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
+  <!-- Uncomment the CoreCompile target to enable the Build command in
+       Visual Studio and specify your pre- and post-build commands in
+       the BeforeBuild and AfterBuild targets below. -->
+  <!--<Target Name="CoreCompile" />-->
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+</Project>

+ 1 - 0
Xcom-API/readme.md

@@ -0,0 +1 @@
+#### Informations will be added soon

+ 927 - 0
Xcom_Test_Program/Xcom_API.py

@@ -0,0 +1,927 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+##########################################################################################################################################
+#                                                        Python-File Information                                                         #
+##########################################################################################################################################
+#
+#   File:   Xcom_API.py
+#   Author: Tobias Müller
+#   Date:   2017.07.05
+#
+##########################################################################################################################################
+#                                                             Requirements                                                               #
+##########################################################################################################################################
+
+import struct
+
+##########################################################################################################################################
+#                                                     Class Definition & Description                                                     #
+##########################################################################################################################################
+
+#   This Class is used to generate Byte-Frames, which are needed to communicate with Xtender-Moduls over the RS232-BUS with the Xcom-232i.
+#   After generating  the Byte-Frame, you can use "pyserial" to communicate with the Serial-BUS and to put the Byte-Frame into the write-
+#   method of "pyserial". You can decode also Read-Frames of the Serial-BUS with this class. 
+#
+#   This class contains Methods to generate Read- or Write-Frames, and Methods to decode Frames. There are pre-defined types, properties 
+#   and formats for the most important Parameter- and Information-Numbers. This reduces the effort for generating Data-Frames, but there 
+#   are extended Methods to generate Byte-Frames with other Parameter- and Information-Numbers.
+
+class Xcom_API():
+
+    ##################################################################################################################################
+    #                                                     Program Information                                                        #
+    ##################################################################################################################################
+
+    __PROG_NAME                           = 'Xcom-API'
+    __PROG_Version                        = 'v1.0'   
+
+    ##################################################################################################################################
+    #                                                Private-Object-Instance-Counter                                                 #
+    ##################################################################################################################################
+
+    __object_counter                      = 0
+
+    ##################################################################################################################################
+    #                                                  Private-Attributes-Service_ID                                                 #
+    ##################################################################################################################################
+
+    __service_read                         = 1
+    __service_write                        = 2
+
+    ##################################################################################################################################
+    #                                                Protected-Attributes-Object_Type                                                #
+    ##################################################################################################################################
+
+    _object_type_info                     = 1
+    _object_type_parameter                = 2
+    _object_type_message                  = 3
+    _object_type_datalog_field            = 5
+    _object_type_datalog_transfer         = 257
+
+    ##################################################################################################################################
+    #                                              Protected-Attributes-Info-Object_ID                                               #
+    ##################################################################################################################################
+
+    _info_battery_voltage                 = 3000
+    _info_battery_temperature             = 3001
+    _info_battery_charge_current          = 3005
+    _info_battery_voltage_ripple          = 3006
+    _info_state_of_charge                 = 3007
+    _info_number_of_battery_elements      = 3050
+    _info_input_voltage                   = 3011
+    _info_input_current                   = 3012
+    _info_input_frequency                 = 3084
+    _info_input_power                     = 3138
+    _info_output_voltage                  = 3021
+    _info_output_current                  = 3022
+    _info_output_frequency                = 3085
+    _info_output_power                    = 3139
+    _info_operating_state                 = 3028
+    _info_boost_active                    = 3019
+    _info_state_of_inverter               = 3049
+    _info_state_of_transfer_relay         = 3020
+    _info_state_of_output_relay           = 3030
+    _info_state_of_aux_relay_1            = 3031
+    _info_state_of_aux_relay_2            = 3032
+    _info_state_of_ground_relay           = 3074
+    _info_state_of_neutral_transfer_relay = 3075
+    _info_state_of_remote_entry           = 3086
+
+    ##################################################################################################################################
+    #                                           Protected-Attributes-Parameter-Object_ID                                             #
+    ##################################################################################################################################
+
+    _para_maximum_current_of_ac_source    = 1107
+    _para_battery_charge_current          = 1138
+    _para_smart_boost_allowed             = 1126
+    _para_inverter_allowed                = 1124
+    _para_type_of_detection_of_grid_loss  = 1552
+    _para_charger_allowed                 = 1125
+    _para_charger_uses_only_power_from_ac = 1646
+    _para_ac_output_voltage               = 1286
+    _para_inverter_frequency              = 1112
+    _para_transfer_relay_allowed          = 1128
+    _para_limitation_of_the_power_boost   = 1607
+    _para_remote_entry_active             = 1545
+
+    ##################################################################################################################################
+    #                                               Protected-Attributes-Property_ID                                                 #
+    ##################################################################################################################################
+
+    _property_id_value                    = 1
+    _property_id_string                   = 1
+    _property_id_value_qsp                = 5
+    _property_id_min_qsp                  = 6
+    _property_id_max_qsp                  = 7
+    _property_id_level_qsp                = 8
+    _property_id_unsaved_value_qsp        = 13
+    _property_id_invalid_Action           = 0
+    _property_id_sd_start                 = 21
+    _property_id_sd_datablock             = 22
+    _property_id_sd_ack_continue          = 23
+    _property_id_sd_nack_retry            = 24
+    _property_id_sd_abort                 = 25
+    _property_id_sd_finish                = 26
+
+    ##################################################################################################################################
+    #                                                  Protected-Attributes-Format                                                   #
+    ##################################################################################################################################
+
+    _format_bool                          = [1,1]
+    _format_format                        = [2,2]
+    _format_short_int                     = [3,2]
+    _format_enum                          = [4,2]
+    _format_short_enum                    = [5,2]
+    _format_long_enum                     = [6,4]
+    _format_error                         = [7,2]
+    _format_int32                         = [8,4]
+    _format_float                         = [9,4]
+    _format_byte                          = [10,1]
+
+    ##################################################################################################################################
+    #                                                        Private-Level-QSP                                                       #
+    ##################################################################################################################################
+    
+    __level_qsp_view_only                 = 0x0000
+    __level_qsp_basic                     = 0x0010
+    __level_qsp_expert                    = 0x0020
+    __level_qsp_installer                 = 0x0030
+    __level_qsp_qsp                       = 0x0040
+
+    ##################################################################################################################################
+    #                                                       Private-Attributes                                                       #
+    ##################################################################################################################################
+                             
+    __start_byte                          = 0xAA
+    __frame_flags                         = 0x00
+    __data_flags                          = 0x00
+    __data_frame                          = 0x0A
+
+    #   Dictionary of Error-Codes-Descriptions
+
+    __error_code_dict   =  {0x0001  :   'INVALID_FRAME',
+                            0x0002  :   'DEVICE_NOT_FOUND',
+                            0x0003  :   'RESPONSE_TIMEOUT',
+                            0x0011  :   'SERVICE_NOT_SUPPORTED',
+                            0x0012  :   'INVALID_SERVICE_ARGUMENT',
+                            0x0013  :   'SCOM_ERROR_GATEWAY_BUSY',
+                            0x0021  :   'TYPE_NOT_SUPPORTED',
+                            0x0022  :   'OBJECT_ID_NOT_FOUND',
+                            0x0023  :   'PROPERTY_NOT_SUPPORTED',
+                            0x0024  :   'INVALID_DATA_LENGTH',
+                            0x0025  :   'PROPERTY_IS_READ_ONLY',
+                            0x0026  :   'INVALID_DATA',
+                            0x0027  :   'DATA_TOO_SMALL',
+                            0x0028  :   'DATA_TO_BIG',
+                            0x0029  :   'WRITE_PROPERTY_FAILED',
+                            0x002A  :   'READ_PROPERTY_FAILED',
+                            0X002B  :   'ACCESS_DENIED',
+                            0x002C  :   'SCOM_ERROR_OBJECT_NOT_SUPPORTED',
+                            0x002D  :   'SCOM_ERROR_MULTICAST_READ_NOT_SUPPORTED',
+                            0x002E  :   'OBJECT_PROPERTY_INVALID',
+                            0x002F  :   'FILE_OR_DIR_NOT_PRESENT',
+                            0x0030  :   'FILE_CORRUPTED',
+                            0x0081  :   'INVALID_SHELL_ARG'}
+
+    #   Dictionary of Parameter-Info-Numbers with type, property and format
+
+    __para_info_dict    =  {3000    :   [_object_type_info,_property_id_value,_format_float],
+                            3001    :   [_object_type_info,_property_id_value,_format_float],
+                            3005    :   [_object_type_info,_property_id_value,_format_float],
+                            3006    :   [_object_type_info,_property_id_value,_format_float],
+                            3007    :   [_object_type_info,_property_id_value,_format_float],
+                            3050    :   [_object_type_info,_property_id_value,_format_float],
+                            3011    :   [_object_type_info,_property_id_value,_format_float],
+                            3012    :   [_object_type_info,_property_id_value,_format_float],
+                            3084    :   [_object_type_info,_property_id_value,_format_float],
+                            3138    :   [_object_type_info,_property_id_value,_format_float],
+                            3020    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3021    :   [_object_type_info,_property_id_value,_format_float],
+                            3022    :   [_object_type_info,_property_id_value,_format_float],
+                            3085    :   [_object_type_info,_property_id_value,_format_float],
+                            3139    :   [_object_type_info,_property_id_value,_format_float],
+                            3028    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3019    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3049    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3030    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3031    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3032    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3074    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3075    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            3086    :   [_object_type_info,_property_id_value,_format_short_enum],
+                            1107    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1138    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1126    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1124    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1552    :   [_object_type_parameter,_property_id_value_qsp,_format_long_enum],
+                            1125    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1646    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1286    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1112    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1128    :   [_object_type_parameter,_property_id_value_qsp,_format_bool],
+                            1607    :   [_object_type_parameter,_property_id_value_qsp,_format_float],
+                            1545    :   [_object_type_parameter,_property_id_value_qsp,_format_long_enum]}
+
+    ##################################################################################################################################
+    #                                                       Constructor-Method                                                       #
+    ##################################################################################################################################
+
+    #   This Method is used with generating an object of this class. There are pre-defined options (CRC-Check, source-address, 
+    #   destination-address) for this object, when you generate an objects without relevant arguments.
+
+    def __init__(self, crc = True, source = 1, destination = 101):
+        
+        # Check the type of the argument "crc". It raises a "ValueError" with a false type.
+        if not isinstance(crc, bool):
+            raise ValueError('CRC is not type \"bool\"!')
+
+        # Check the type of the argument "source". It raises a "ValueError" with a false type.
+        elif not isinstance(source, int) or isinstance(source, bool):
+            raise ValueError('Source-Address is not type \"int\"!')
+
+        # Check the range of the argument "source" It raises a "ValueError", if the argument is out of range.
+        elif not 0<source<100:
+            raise ValueError('Source-Address is out of range!')
+
+        # Check the type of the argument "destination" It raises a "ValueError" with a false type.
+        elif not isinstance(destination, int) or isinstance(destination, bool):
+            raise ValueError('Destination-Address is not type \"int\"!')
+
+        # Check the range of the argument "destination" It raises a "ValueError", if the argument is out of range.
+        elif not (destination==0 or destination==401 or destination==501 or destination==601 or 100<=destination<=109 or 
+                191<=destination<=193 or 300<=destination<=315 or 700<=destination<=715):
+            raise ValueError('Destination-Address is out of range!')
+
+        # If there is no error, the arguments will be stored in variables of the object. The object-counter will be increased.
+        else:
+            self.__dest                = destination
+            self.__source              = source
+            self.__crc                 = crc
+            self.__frame_check_done    = False
+            Xcom_API.__object_counter += 1
+
+    ##################################################################################################################################
+    #                                                     Deconstructor-Method                                                       #
+    ##################################################################################################################################
+
+    #   This Method delete an object of this class with the stored variables and decrease the object-counter.
+
+    def __del__(self):
+        del self.__crc
+        del self.__source
+        del self.__dest
+        del self.__frame_check_done
+        Xcom_API.__object_counter -= 1
+
+    ##################################################################################################################################
+    #                                                     Information-Methods                                                        #
+    ##################################################################################################################################
+
+    #   This method returns an integer-value of the source-address of an object
+
+    def get_source_address(self):
+        return self.__source
+
+    #   This method returns an integer-value of the destination-address of an object
+     
+    def get_destination_address(self):
+        return self.__dest
+
+    #   This method returns a boolean-value of the active-state of the CRC-Check of an object
+
+    def is_crc_check_active(self):
+        return self.__crc
+
+    #   This method returns a integer-value of the counter of active-objects of this class
+
+    @staticmethod
+    def get_object_counter():
+        return  Xcom_API.__object_counter
+    
+    #   This method returns a string of the of the program-name of this class
+
+    @staticmethod
+    def get_prog_name():
+        return Xcom_API.__PROG_NAME
+
+    #   This method returns a string of the of the program-version of this class
+
+    @staticmethod
+    def get_prog_version():
+        return Xcom_API.__PROG_Version
+
+    ##################################################################################################################################
+    #                                                       Private-Methods                                                          #
+    ##################################################################################################################################
+
+    #   This Method calculate the CRC-Values of a Frame. It returns the CRC-Values in a list.
+
+    def __calculate_checksum(byte_frame):
+
+        # Define two Buffers for the CRC-Values.
+        Buffer1 = 0xFF
+        Buffer2 = 0
+
+        # Calculate the CRC-Values of a Frame.
+        for i in range(0,len(byte_frame)):
+            Buffer1 = (Buffer1 + byte_frame[i]) % 256
+            Buffer2 = (Buffer1 + Buffer2) % 256
+            
+        # Return the CRC-Values in a list.
+        return [Buffer1, Buffer2]
+    
+    #   This Method generate a Byte-Frame of a Value depending of the format. It returns a list of Bytes, which are ordered in LSB to
+    #   MSB.
+
+    def __value_to_byte_frame(property_data, data_format):
+
+        # It checks the argument "data_format" for type "Bool" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the list of the Byte-Frame.
+        if   data_format==Xcom_API._format_bool:
+            if not 0<=property_data<=1 or not (isinstance(property_data, int) or isinstance(property_data, bool)):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"bool\"!')
+            else:
+                # Return a list of the Byte-Frame.
+                if property_data == 0 or property_data == False:
+                    return [0]
+                else:
+                    return [1]
+
+        # It checks the argument "data_format" for type "Byte" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_byte:
+            if not 0<=property_data<256 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Byte\"!')
+            else:
+                # Return a list of the Byte-Frame.
+                return [property_data]
+        
+        # It checks the argument "data_format" for type "Error" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_error:
+            if not 0<=property_data<=0x65535 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Error\"!')
+            else:
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Format" or "Short Integer" and check the range/type of "property_data", 
+        # depending of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of 
+        # the Byte-Frame.
+        elif data_format==Xcom_API._format_format or data_format==Xcom_API._format_short_int:
+            if not -32768<=property_data<=32767 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Format\" or \"Short Integer\"!')
+            else:
+                # Calculate the Byte-Frame.
+                if property_data<0:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(2**16 + property_data)
+
+                else:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(property_data)
+
+                    for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                        Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Enum" or "Short Enum" and check the range/type of "property_data", depending 
+        # of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame. 
+        # Only one Bit can be set in data_format of type "Enum".
+        elif data_format==Xcom_API._format_enum or data_format==Xcom_API._format_short_enum:
+            if not 0<=property_data<=32767 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+            else:
+                check = False
+                for i in range(0,16):
+                    if (2**i==2**i&property_data) and check:
+                        raise ValueError('Invalid \"property_data\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+                    elif 2**i==2**i&property_data:
+                        check = True
+
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Long Enum" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame. 
+        # Only one Bit can be set in data_format of type "Enum".
+        elif data_format==Xcom_API._format_long_enum:
+            if not 0<=property_data<=2147483647 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Long Enum\"!')
+            else:
+                check = False
+                for i in range(0,32):
+                    if (2**i==2**i&property_data) and check:
+                        raise ValueError('Invalid \"property_data\" for the data_format of type \"Long Enum\"!')
+                    elif 2**i==2**i&property_data:
+                        check = True
+
+                # Define a Buffer for calculating.
+                Buffer = hex(property_data)
+
+                # Calculate the Byte-Frame.
+                for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                    Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[8:10],16),int(Buffer[6:8],16),int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "INT32" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_int32:
+            if not -2147483648<=property_data<=2147483647 or not isinstance(property_data, int):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"INT32\"!')
+            else:
+                # Calculate the Byte-Frame.
+                if property_data<0:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(2**32 + property_data)
+
+                else:
+                    # Define a Buffer for calculating.
+                    Buffer = hex(property_data)
+                    
+                    for i in range(0,data_format[1]*2-(len(Buffer)-2)):
+                        Buffer = Buffer[0:2]+str(0)+Buffer[2:]
+                        
+                # Return a list of the Byte-Frame.
+                return [int(Buffer[8:10],16),int(Buffer[6:8],16),int(Buffer[4:6],16),int(Buffer[2:4],16)]
+
+        # It checks the argument "data_format" for type "Float" and check the range/type of "property_data", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the list of the Byte-Frame.
+        elif data_format==Xcom_API._format_float:
+            if not -2147483648<=property_data<=2147483647 or not isinstance(property_data, float):
+                raise ValueError('Invalid \"property_data\" for the data_format of type \"Float\"!')
+            else:
+                # Calculate the Byte-Frame.
+                Buffer = struct.pack("!f",property_data)
+
+                # Return a list of the Byte-Frame.
+                return [Buffer[3],Buffer[2],Buffer[1],Buffer[0]]
+
+        # It raises an Error, if the argument "data_format" doesn't fit.
+        else:
+            raise ValueError('data_format is unknown!')
+
+    #   This Method generate a Value of a Byte-Frame depending of the format. It returns the value as a integer.
+    
+    def __byte_frame_to_value(byte_frame, data_format):
+        
+        # It checks the argument "data_format" for type "Bool" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the value of the Byte-Frame.
+        if   data_format==Xcom_API._format_bool:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not 0<=byte_frame[0]<=1:
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"bool\"!')
+            else:
+                # Return the value of the Byte-Frame.
+                return byte_frame[0]
+            
+        # It checks the argument "data_format" for type "Byte" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_byte:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Byte\"!')
+            else:
+                # Return the value of the Byte-Frame.
+                return byte_frame[0]
+        
+        # It checks the argument "data_format" for type "Error" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_error:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Error\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                return int(Buffer,16)
+
+        # It checks the argument "data_format" for type "Format" or "Short Integer" and check the length/type of "byte_frame", depending 
+        # of the data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_format or data_format==Xcom_API._format_short_int:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Format\" or \"Short Integer\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<32768:
+                    return int(Buffer,16)
+                else:
+                    return (-65536 + int(Buffer,16))
+
+        # It checks the argument "data_format" for type "Enum" or "Short Enum" and check the length/type of "byte_frame", depending of the 
+        # data_format. It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_enum or data_format==Xcom_API._format_short_enum:
+            if not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<32768:
+                    return int(Buffer,16)
+                else:
+                    raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Enum\" or \"Short Enum\"!')
+                
+        # It checks the argument "data_format" for type "Long Enum" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame. 
+        elif data_format==Xcom_API._format_long_enum:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame" for the data_format of type \"Long Enum\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<2147483648:
+                    return int(Buffer,16)
+                else:
+                    raise ValueError('Invalid \"byte_frame" for the data_format of type \"Long Enum\"!')
+
+        # It checks the argument "data_format" for type "INT32" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_int32:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"INT32\"!')
+            else:
+                # Define a Buffer.
+                Buffer = '0x'
+
+                # Calculate the value.
+                for i in range(0,data_format[1]):
+                    if len(hex(byte_frame[data_format[1]-1-i]))==4:
+                        Buffer = Buffer + hex(byte_frame[data_format[1]-1-i])[2:]
+                    else:
+                        Buffer = Buffer + '0' + hex(byte_frame[data_format[1]-1-i])[2:]
+
+                # Return the value of the Byte-Frame.
+                if int(Buffer,16)<2147483648:
+                    return int(Buffer,16)
+                else:
+                    return (-4294967296 + int(Buffer,16))
+
+        # It checks the argument "data_format" for type "Float" and check the length/type of "byte_frame", depending of the data_format.
+        # It raises an ValueError if the checks failed, otherwise it calculate and returns the value of the Byte-Frame.
+        elif data_format==Xcom_API._format_float:
+            if (not len(byte_frame)==data_format[1] or not isinstance(byte_frame[0], int) or not isinstance(byte_frame[1], int)  
+                or not isinstance(byte_frame[2], int) or not isinstance(byte_frame[3], int)):
+                raise ValueError('Invalid \"byte_frame\" for the data_format of type \"Float\"!')
+            else:
+                # Define a Buffer.
+                Buffer = bytearray([byte_frame[3],byte_frame[2],byte_frame[1],byte_frame[0]])
+
+                # Calculate and return the value of the Byte-Frame.
+                return struct.unpack("!f",Buffer)[0]     
+
+        # It raises an Error, if the argument "format" doesn't fit.
+        else:
+            raise ValueError('data_format is unknown!')
+
+    
+    #   This Method does a Frame-Check. It checks the startbyte, Frame-Length, the checksum and the response-flags. It returns a boolean-value of 
+    #   the result.
+
+    def __frame_check(self,bytearray_of_frame):
+        
+        # Define Buffer for Frame_check.
+        Buffer = list(bytearray_of_frame)
+        
+        try:
+            # Check Start-Byte available  
+            if not Buffer[0]==0xAA:
+                raise ValueError('Can\'t find Start-Frame (0xAA)')
+
+            # Check checksum if activated and check Frame-Length
+            if self.__crc and len(Buffer)>=14:
+                # check Header-Checksum
+                if not Xcom_API.__calculate_checksum(Buffer[1:12])==Buffer[12:14]:
+                    raise ValueError('Header-Checksum wrong!')
+                
+                # check Frame-Length
+                if not len(Buffer)==(Xcom_API.__value_to_byte_frame(Buffer[10:12],Xcom_API._format_short_int) + 16):
+                    raise ValueError('Frame is not complete!')
+                
+                # check Data-Checksum 
+                if not Xcom_API.__calculate_checksum(Buffer[14:(len(Buffer)-2)])==Buffer[(len(Buffer)-2):len(Buffer)]:
+                    raise ValueError('Data-Checksum wrong!')
+            
+            elif not self.__crc and len(Buffer)>=14:
+                # check Frame-Length
+                if not len(Buffer)==(Xcom_API.__value_to_byte_frame(Buffer[10:12],Xcom_API._format_short_int) + 16):
+                    raise ValueError('Frame is not complete!')                
+            
+            else:
+                raise ValueError('Frame is not complete!')
+            
+            # Check Response-Flags
+            if not Buffer[14]>0:
+                raise ValueError('Frame is not a Response-Frame!')
+            
+            return True
+               
+        except IndexError:
+            raise ValueError('Frame is not complete!') 
+        
+    ##################################################################################################################################
+    #                                                     Public-Methods                                                             #
+    ##################################################################################################################################
+
+    #   This method is used to generate a Byte-Frame for a 'read'-instruction. It Returns a List of Bytes.  
+    
+    def get_read_frame_ext(self, object_type, object_id, property_id):
+        
+        # Create Buffer
+        Buffer = []
+        
+        # Append Buffer with Start-Byte.
+        Buffer.append(Xcom_API.__start_byte)
+        
+        # Append Buffer with Frame-Flags.
+        Buffer.append(Xcom_API.__frame_flags)
+        
+        # Extend Buffer with Source-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__source,Xcom_API._format_int32))
+        
+        # Extend Buffer with Destination-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__dest,Xcom_API._format_int32))
+        
+        # Extend Buffer with Data-Length.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(Xcom_API.__data_frame,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Header-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[1:len(Buffer)]))
+        
+        # Append Buffer with Data-Flags.
+        Buffer.append(Xcom_API.__data_flags)
+        
+        # Append Buffer with Service_ID.
+        Buffer.append(Xcom_API.__service_read)
+        
+        # Extend Buffer with Opject_Type.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_type,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Object_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_id,Xcom_API._format_int32))
+        
+        # Extend Buffer with Property_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_id,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Data-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[14:len(Buffer)]))
+        
+        # Return Byte-Frame.
+        return bytearray(Buffer)
+        
+    #   This method is used to generate a Byte-Frame for a 'write'-instruction. It Returns a List of Bytes.
+    
+    def get_write_frame_ext(self, object_type, object_id, property_id, property_data, data_format):
+        
+        # Create Buffer
+        Buffer = []
+    
+        # Append Buffer with Start-Byte.
+        Buffer.append(Xcom_API.__start_byte)
+    
+        # Append Buffer with Frame-Flags.
+        Buffer.append(Xcom_API.__frame_flags)
+    
+        # Extend Buffer with Source-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__source,Xcom_API._format_int32))
+    
+        # Extend Buffer with Destination-Address.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(self.__dest,Xcom_API._format_int32))
+    
+        # Extend Buffer with Data-Length.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(Xcom_API.__data_frame + data_format[1],Xcom_API._format_short_int))
+    
+        # Extend Buffer with Header-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[1:len(Buffer)]))
+    
+        # Append Buffer with Data-Flags.
+        Buffer.append(Xcom_API.__data_flags)
+    
+        # Append Buffer with Service_ID.
+        Buffer.append(Xcom_API.__service_write)
+    
+        # Extend Buffer with Opject_Type.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_type,Xcom_API._format_short_int))
+    
+        # Extend Buffer with Object_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(object_id,Xcom_API._format_int32))
+    
+        # Extend Buffer with Property_ID.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_id,Xcom_API._format_short_int))
+        
+        # Extend Buffer with Property_Data.
+        Buffer.extend(Xcom_API.__value_to_byte_frame(property_data,data_format))
+        
+        # Extend Buffer with Data-Checksum.
+        Buffer.extend(Xcom_API.__calculate_checksum(Buffer[14:len(Buffer)]))
+    
+        # Return Byte-Frame.
+        return bytearray(Buffer)
+
+    #   This method is used to recieve Data from the Byte-Frame. It returns a List with the result of the returned Data and the Data 
+    #   itself.
+
+    def get_data_from_frame_ext(self, bytearray_of_frame, data_format):
+        
+        # Do a Frame-Check. If it fails, it returns a ValueError.
+        if not self.__frame_check_done:
+            if not Xcom_API.__frame_check(self, bytearray_of_frame):
+                raise ValueError('Frame-Check failed!')
+        self.__frame_check_done = False
+
+        # Check Frame for an Error and return the value.
+        if bytearray_of_frame[14] == 3:
+            return [True,Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:20]),Xcom_API._format_error)]
+        else:
+            return [False,Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:22]),data_format)]
+
+    #   This method is used to generate a Byte-Frame for a 'read'-instruction. It can only be used with a known Object_ID, otherwise it 
+    #   will raise a Value_Error. It Returns a List of Bytes.
+    
+    def get_read_frame(self, object_id):
+        
+        try:
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[object_id]
+            
+            # Return a Byte-Frame from the Read-Extenion method.
+            return self.get_read_frame_ext(Buffer[0],object_id,Buffer[1])
+        
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to generate a Byte-Frame for a 'write'-instruction. It can only be used with a known Object_ID, otherwise it 
+    #   will raise a Value_Error. It Returns a List of Bytes.
+        
+    def get_write_frame(self, object_id, property_data):
+        
+        try:
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[object_id]
+            
+            # Return a Byte-Frame from the Read-Extenion method.
+            return self.get_write_frame_ext(Buffer[0],object_id,Buffer[1],property_data,Buffer[2])
+        
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to recieve Data from the Byte-Frame. It can only be used with a known Object_ID, otherwise it will raise a 
+    #   Value_Error. It returns a List with the result of the returned Data and the Data itself.
+
+    def get_data_from_frame(self, bytearray_of_frame):
+
+        try:
+            # Do a Frame-Check. If it fails, it returns a ValueError.
+            if Xcom_API.__frame_check(self, bytearray_of_frame):
+                self.__frame_check_done = True
+            else:
+                raise ValueError('Frame-Check failed!')
+
+            # Read Object-ID infomations from Dictionary and store it into a Buffer.
+            Buffer = Xcom_API.__para_info_dict[Xcom_API.__byte_frame_to_value(list(bytearray_of_frame[18:22]),Xcom_API._format_int32)]
+
+            # Return a Byte-Frame from the Read-Extension method.
+            return self.get_data_from_frame_ext(bytearray_of_frame,Buffer[2])
+
+        except KeyError:
+            # If the Object_ID is unknown, the method raise a ValueError.
+            self.__frame_check_done = False
+            raise ValueError('Object_ID unknown!')
+
+    #   This method is used to return the frame-flags as a binary.
+
+    def get_bin_from_frame_flags(self, bytearray_of_frame):
+
+        # Do a Frame-Check. If it fails, it returns a ValueError.
+        if not Xcom_API.__frame_check(self, bytearray_of_frame):
+            raise ValueError('Frame-Check failed!')
+
+        # Create a Buffer with binary Information.
+        Buffer = bin(bytearray_of_frame)
+
+        # Extend Buffer to 8-bit
+        for i in range(0,10-len(Buffer)):
+            Buffer = Buffer[0:2] + '0' + Buffer[2:]
+        
+        # Return Buffer.
+        return Buffer
+
+    #   This method is used to return the frame-flags as a list with explanation (string) for each bit, starting with lsb.
+
+    def get_text_from_frame_flags(self, bytearray_of_frame):
+        
+        # Create Buffer and get binary from byte-frame.
+        Buffer = self.get_bin_from_frame_flags(bytearray_of_frame)
+        
+        # Create Out-Buffer.
+        BufferOut = []
+
+        # Check bit 0.
+        if int(Buffer[9]) == 1:
+            BufferOut.append('Messages are pending.')
+        else:
+            BufferOut.append('No messages are pending.')
+
+        # Check bit 1.
+        if int(Buffer[8]) == 1:
+            BufferOut.append('A reset or restart was carried out.')
+        else:
+            BufferOut.append('No reset or restart was carried out.')
+
+        # Check bit 2.
+        if int(Buffer[7]) == 1:
+            BufferOut.append('The SD-Card is present.')
+        else:
+            BufferOut.append('No SD-Card is present')
+
+        # Check bit 3.
+        if int(Buffer[6]) == 1:
+            BufferOut.append('The SD-Card is full.')
+        else:
+            BufferOut.append('The SD-Card is not full.')
+
+        # Check bit 4.
+        if int(Buffer[5]) == 1:
+            BufferOut.append('New datalog file on the SD-Card.')
+        else:
+            BufferOut.append('No new datalog file on the SD-Card.')
+
+        # Check bit 5.
+        if int(Buffer[4]) == 1:
+            BufferOut.append('Datalogger is supported.')
+        else:
+            BufferOut.append('Datalogger is not supported.')
+
+        # Return list with Frame-flag informations.
+        return BufferOut
+
+    #   This method is used to get the error message from the error-id.
+
+    def get_text_from_error_id(self, error_id):
+        
+        try:
+            # Check ID and store error-message in Buffer
+            Buffer = Xcom_API.__error_code_dict[error_id]
+
+            # return error-message
+            return Buffer
+
+        except KeyError:
+            # If Error ID is unknown
+            return 'Error-ID is unknown.'

+ 220 - 0
Xcom_Test_Program/Xcom_Test_Program.py

@@ -0,0 +1,220 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import string
+import sys
+import signal
+import socket
+import ptvsd as debug
+import serial as UART
+import pigpio as GPIO
+from tkinter import *
+
+# ------------------------- Program Information -------------------------
+PROG_NAME    = 'Xcom-Terminal'
+PROG_VERSION = 'v0.5'
+
+# ------------------------- Debug-Server-Settings -------------------------
+# Enable Debug-Server
+debug.enable_attach(secret='Debug')
+
+# ------------------------- GPIO-Server-Settings -------------------------
+# LED-Ports
+LED1 = 18
+LED2 = 27
+
+# Detect GPIO-HOST
+Hostname = socket.gethostname()
+
+# GPIO-State-Variable
+GPIO_ENABLE = False
+
+# GPIO-ERROR_Variable
+GPIO_ERR    = False
+
+# ------------------------- COM-Port-Settings -------------------------
+# COM-Parameter-Variable
+COM_PARA = {'Port'               :   '/dev/ttyAMA0',
+            'Baudrate'           :   115200,
+            'Bytesize'           :   UART.EIGHTBITS,
+            'Parity'             :   UART.PARITY_EVEN,
+            'Stopbits'           :   UART.STOPBITS_ONE,
+            'Timeout'            :   2,
+            'XON_XOFF'           :   False,
+            'RTS_CTS'            :   False,
+            'DSR_DTR'            :   False}
+
+# COM-State-Variable
+COM_ENABLE   = False
+
+# COM-ERROR-Variable
+COM_ERR      = False
+COM_TIME_ERR = False
+
+# ------------------------- Functions -------------------------
+# exit Programm
+def exit():
+    print('Exit Program.')
+    sys.exit
+
+# open GPIOs
+def open_gpios(LED1,LED2,Hostname):
+    # Use Global-Variable
+    global GPIO_ERR
+    global GPIO_ENABLE
+
+    # Try Function
+    try:
+        # Enable GPIO-Server
+        LED_Handle = GPIO.pi(Hostname)
+
+        # GPIO-Mode
+        LED_Handle.set_mode(LED1, GPIO.OUTPUT)
+        LED_Handle.set_mode(LED2, GPIO.OUTPUT)
+
+        # GPIO-Start-State
+        LED_Handle.write(LED1, GPIO.LOW)
+        LED_Handle.write(LED2, GPIO.LOW)
+
+        GPIO_ENABLE = True
+
+        print('GPIOs on \"{}\" are configured.'.format(Hostname))
+        
+        return LED_Handle
+
+    # Handle Errors
+    except AttributeError:
+        print('There is no connection to the \"{}\" possible.\n Ensure that the Deamon-Host-Process \"pigpiod\" has started with root privileges on the Raspberry Pi to connect to the GPIOs.'.format(Hostname))
+        GPIO_ERR = True
+        exit()
+
+# close GPIOs
+def close_gpios(LED_Handle,Hostname,LED1,LED2):
+    # Use Global-Variable
+    global GPIO_ERR
+    global GPIO_ENABLE
+
+    # Try Function
+    try:
+        # Reset GPIOs
+        LED_Handle.clear_bank_1(1<<LED1)
+        LED_Handle.clear_bank_1(1<<LED2)
+
+        # close GPIO-Server
+        LED_Handle.stop()
+        GPIO_ENABLE = False
+
+        print('GPIOs closed.')
+
+    except AttributeError:
+        print('There is no connection to the \"{}\" possible.\n GPIOs can not be closed safely.'.format(Hostname))
+        GPIO_ERR = True
+        exit()
+
+# open COM-Port
+def open_com_port(LED_Handle,LED1,COM_PARA):
+    # Use Global-Variable
+    global COM_ENABLE
+    global COM_ERR
+
+    # Try Function
+    try:
+        COM_Handle = UART.Serial(port                = COM_PARA['Port'], 
+                                 baudrate            = COM_PARA['Baudrate'],
+                                 bytesize            = COM_PARA['Bytesize'],
+                                 parity              = COM_PARA['Parity'],
+                                 stopbits            = COM_PARA['Stopbits'],
+                                 timeout             = COM_PARA['Timeout'],
+                                 xonxoff             = COM_PARA['XON_XOFF'],
+                                 rtscts              = COM_PARA['RTS_CTS'],
+                                 dsrdtr              = COM_PARA['DSR_DTR'])
+       
+        COM_ENABLE = True
+        LED_Handle.write(LED1, GPIO.HIGH)
+
+        print('COM-Port: \"{}\", is opened.'.format(COM_Handle.port))
+                
+        return COM_Handle
+
+    # Handle Errors
+    except UART.SerialException:
+        print('COM-Port: \"{}\", can not be opened. Make sure it is available and not used by other programs.'.format(COM_PARA['Port']))
+        COM_ERR = True
+        exit()
+    except ValueError:
+        print('COM-Port-Parameters are out of spezifications.')
+        COM_ERR = True
+        exit()
+
+def close_com_port(COM_Handle,LED_Handle,LED1):
+    # Use Global-Variable
+    global COM_ENABLE
+    global COM_ERR
+
+    # Try Function
+    try:
+        port = COM_Handle.port
+        COM_Handle.close()
+        COM_ENABLE = False
+        LED_Handle.write(LED1, GPIO.LOW)
+
+        print('COM-Port: \"{}\", is closed.'.format(port))
+
+    # Handle Errors
+    except UART.SerialException:
+        print('COM-Port: \"{}\", can not be closed.'.format(port))
+        COM_ERR = True
+        exit()
+
+def com_wite(COM_Handle,BUFFER):
+    try:
+        print('Bytesize:',len(BUFFER))
+        for i in range(0,len(BUFFER)):
+            print('Send Byte {}: 0x{:X}'.format(i+1,BUFFER[i]))
+        COM_Handle.write(BUFFER)
+        a = COM_Handle.read(30)
+        print('')
+        a = list(a)
+        for i in range(0,len(a)):
+            print('Get Byte {}: 0x{:X}'.format(i+1,a[i]))
+
+    except:
+        pass
+    
+def com_read(COM_Handle,bytelength):
+    try:
+        BUFFER = COM_Handle.read(bytelength)
+        BUFFER_Display = list(BUFFER)
+        for i in range(0,len(BUFFER_Display)):
+            print('Get Byte {}: 0x{:X}'.format(i+1,BUFFER_Display[i]))
+       
+        return BUFFER
+
+    except:
+        pass
+
+# ------------------------- Main-Program -------------------------
+# Try Main-Program
+try:
+    print('Welcome to {0} Version: {1}'.format(PROG_NAME,PROG_VERSION))
+    LED_Handle = open_gpios(LED1,LED2,Hostname)
+    COM_Handle = open_com_port(LED_Handle,LED1,COM_PARA)
+    BUFFER = bytearray([0xAA,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x0A,0x00,0x6F,0x71,0x00,0x01,0x01,0x00,0xB8,0x0B,0x00,0x00,0x01,0x00,0xC5,0x90])
+    com_wite(COM_Handle,BUFFER)
+    BUFFER = com_read(COM_Handle,30)
+    close_com_port(COM_Handle,LED_Handle,LED1)
+    close_gpios(LED_Handle,Hostname,LED1,LED2)
+    exit()
+   
+# Handle Errors
+except KeyboardInterrupt:
+    if signal.SIGINT:
+        print('Program closed with Strg+c.')
+
+# Exit program safely.
+finally:
+    print('')
+    if 'COM_Handle' in locals() and COM_Handle and COM_ENABLE and not COM_ERR:
+        close_com_port(COM_Handle,LED_Handle,LED1)
+    if 'LED_Handle' in locals() and LED_Handle and GPIO_ENABLE and not GPIO_ERR:
+        close_gpios(LED_Handle,Hostname,LED1,LED2)
+    

+ 38 - 0
Xcom_Test_Program/Xcom_Test_Program.pyproj

@@ -0,0 +1,38 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>9a291168-668c-4e76-b4d9-8437d2a91db0</ProjectGuid>
+    <ProjectHome>
+    </ProjectHome>
+    <StartupFile>Xcom_Test_Program.py</StartupFile>
+    <SearchPath>
+    </SearchPath>
+    <WorkingDirectory>.</WorkingDirectory>
+    <OutputPath>.</OutputPath>
+    <Name>Xcom_Test_Program</Name>
+    <RootNamespace>Xcom_Terminal</RootNamespace>
+    <PublishUrl>\\192.168.137.2\pythonapps</PublishUrl>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="Xcom_API.py" />
+    <Compile Include="Xcom_Test_Program.py" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
+  <!-- Uncomment the CoreCompile target to enable the Build command in
+       Visual Studio and specify your pre- and post-build commands in
+       the BeforeBuild and AfterBuild targets below. -->
+  <!--<Target Name="CoreCompile" />-->
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+</Project>

+ 1 - 0
Xcom_Test_Program/readme.md

@@ -0,0 +1 @@
+#### Informations will be added soon

+ 47 - 0
readme.md

@@ -0,0 +1,47 @@
+# <p>&#x1F5C3; Xcom-API</p>
+## <p>&#x2139; Introduction</p>
+This project is about an API (Application Programming Interface) designed as a python-class, which generates and decode byte-frames for communication between a Xtender-System and a pc, especially a Raspberry Pi with a Raspicomm extension module.
+
+>**Note:** The program is created with Microsoft's IDE Visual Studio 2017. So you can easily add this project to VS2017 by cloning this Git-Repository. Of course you can open the python-files with other IDE's you prefer too.
+>
+>#### <p>&#x2601; Git-Repository-Link: http://es-lab.de:60080/tmueller/Xcom-API</p>
+
+## <p>&#x1F5C2; Project-Folders</p> 
+#### **Xcom_API**
+coming soon
+
+#### **Xcom_Test_Program**
+coming soon
+
+## <p>&#x1F4BB; Hardware-Configuration</p>  
+#### **Hardware Information**
+
+| Component | Function | Product Information | Documentation |
+|:----|:----|:----:|:----:|
+| Raspberry Pi 3 | single board computer, on which is running the program | [<p>&#x1F517;</p>](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) | [<p>&#x1F517;</p>](https://www.raspberrypi.org/documentation/) |
+| RasPiComm | expansion board for the raspberry Pi, which provides a RS232-Port over the GPIOs (UART) of the Raspberry Pi | [<p>&#x1F517;</p>](http://www.amescon.com/de/produkte/raspicomm.aspx) | [<p>&#x1F517;</p>](http://www.amescon.com/de/produkte/raspicomm/erste-schritte.aspx) |
+| Xcom-232i | CAN to RS232 Bridge, which is used to communicate with the Xtender-Modules | [<p>&#x1F517;</p>](http://www.studer-innotec.com/en/accessoires/xtender-series/communication-module-xcom-232i-770) | [<p>&#x1F517;</p>](http://www.studer-innotec.com/media/document/0/studer-manuel-xcom-232i-v1.3.0_en.pdf) |
+| RCC-02 | remote control and programming unit for displaying the status informations and to program parameters of the Xtender-Modules  | [<p>&#x1F517;</p>](http://www.studer-innotec.com/en/accessoires/xtender-series/rcc-02-remote-control-and-programming-centre-767) | [<p>&#x1F517;</p>](http://www.studer-innotec.com/media/document/0/manuel-rcc-v4.6.0_en.pdf) |
+| Xtender-Series| is used as Battery charger and as DC to AC converter and to supply electrical power | [<p>&#x1F517;</p>](http://www.studer-innotec.com/en/products/xtender-series/) | [<p>&#x1F517;</p>](http://www.studer-innotec.com/media/document/0/manuel-xtender-v4.7.0_en-1.pdf) |
+
+
+#### **Hardware Setup**
+
+The picture below shows the connection of the Hardware components.
+
+<a href="http://yuml.me/edit/5e876aef" target="_blank"><img src="http://yuml.me/5e876aef" /></a>
+
+
+## <p>&#x2611; ToDo-List</p>  
+
+- [x] create Git-Repository
+- [x] upload project-files
+- [ ] finish documentations
+- [ ] finish main-programm "Xcom-Terminal"
+- [ ] finish main-programm "Xcom-GUI"
+
+
+-----
+
+
+<p>&#x00A9; 2017 es-lab.de, Tobias M&uuml;ller&#x2122;</p>