/**
 * Generated by Eclipse Mita 0.1.0.
 * @date 2022-05-14 23:02:01
 */


#include <BCDS_Basics.h>
#include <BSP_BoardType.h>
#include <BCDS_Retcode.h>
#include <BCDS_BSP_Button.h>
#include <math.h>
#include <BCDS_Magnetometer.h>
#include <BCDS_LightSensor.h>
#include <XdkSensorHandle.h>
#include <BCDS_Environmental.h>
#include <stdlib.h>
#include <stdio.h>
#include <bma2x2.h>
#include <stdbool.h>
#include <inttypes.h>
#include <string.h>
#include <stdint.h>
#include "ConnectivityLEDLed.h"
#include "PlatformXDK110.h"
#include "xdk110Types.h"
#include "InputOutputSDCardSDc.h"
#include "SensorMagnetometer.h"
#include "Noise_sensor.h"
#include "SensorLight.h"
#include "SensorEnvironment.h"
#include "ConnectivityMQTTMqttXDK.h"
#include "SensorAccelerometer.h"
#include "MitaExceptions.h"
#include "SensorButton_two.h"
#include "SensorButton_one.h"
#include "application.h"

#ifndef BCDS_MODULE_ID
#define BCDS_MODULE_ID 0xCAFE
#endif

int32_t tempCorrection = 3500;
int32_t firmwareMode = 1;
int32_t HelpVar = 0;
int32_t dataOut = 0;
char fileBuffer_buf[59] = {0};
char *fileBuffer = fileBuffer_buf;
int32_t bufferSize = 0;

Retcode_T initGlobalVariables_application() {
	Retcode_T exception = RETCODE_OK;
	
	if(exception != NO_EXCEPTION) return exception;
	
	if(exception != NO_EXCEPTION) return exception;
	
	if(exception != NO_EXCEPTION) return exception;
	
	if(exception != NO_EXCEPTION) return exception;
	
	char mainFileBuffer_24_buf[] = "";
	memcpy(fileBuffer, mainFileBuffer_24_buf, sizeof(mainFileBuffer_24_buf));
	if(exception != NO_EXCEPTION) return exception;
	
	if(exception != NO_EXCEPTION) return exception;
	
	return exception;
}

Retcode_T HandleEveryButton_twoPressed1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	firmwareMode++;
	if(firmwareMode > 6)
	{
		firmwareMode = 1;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEveryButton_onePressed1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	firmwareMode--;
	if(firmwareMode < 1)
	{
		firmwareMode = 6;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEvery50Millisecond1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(firmwareMode == 1)
	{
		struct bma2x2_accel_data sensorAccelerometerModalityPreparation_1;
		exception = SensorAccelerometer_ReadXYZ(&sensorAccelerometerModalityPreparation_1);
		if(exception != NO_EXCEPTION) return exception;
		
		int32_t Accelerometer_X;
		Accelerometer_X = sensorAccelerometerModalityPreparation_1.x;
		int32_t Accelerometer_Y;
		Accelerometer_Y = sensorAccelerometerModalityPreparation_1.y;
		int32_t Accelerometer_Z;
		Accelerometer_Z = sensorAccelerometerModalityPreparation_1.z;
		char result832365573_buf[12] = {0};
		char *result832365573 = result832365573_buf;
		
		char IfStatement4Result832365573_5_buf[12] = {0};
		snprintf(IfStatement4Result832365573_5_buf, sizeof(IfStatement4Result832365573_5_buf), "%" PRId32 "", Accelerometer_X);
		memcpy(result832365573, IfStatement4Result832365573_5_buf, sizeof(IfStatement4Result832365573_5_buf));
		
		char* _newConnectivityMQTTMqttXDK_Accelerometer_x_1 = result832365573;
		exception = ConnectivityMQTTMqttXDK_Accelerometer_x_Write(&_newConnectivityMQTTMqttXDK_Accelerometer_x_1);
		if(exception != NO_EXCEPTION) return exception;
		char result1069765045_buf[12] = {0};
		char *result1069765045 = result1069765045_buf;
		
		char IfStatement4Result1069765045_6_buf[12] = {0};
		snprintf(IfStatement4Result1069765045_6_buf, sizeof(IfStatement4Result1069765045_6_buf), "%" PRId32 "", Accelerometer_Y);
		memcpy(result1069765045, IfStatement4Result1069765045_6_buf, sizeof(IfStatement4Result1069765045_6_buf));
		
		char* _newConnectivityMQTTMqttXDK_Accelerometer_y_2 = result1069765045;
		exception = ConnectivityMQTTMqttXDK_Accelerometer_y_Write(&_newConnectivityMQTTMqttXDK_Accelerometer_y_2);
		if(exception != NO_EXCEPTION) return exception;
		char result173301336_buf[12] = {0};
		char *result173301336 = result173301336_buf;
		
		char IfStatement4Result173301336_7_buf[12] = {0};
		snprintf(IfStatement4Result173301336_7_buf, sizeof(IfStatement4Result173301336_7_buf), "%" PRId32 "", Accelerometer_Z);
		memcpy(result173301336, IfStatement4Result173301336_7_buf, sizeof(IfStatement4Result173301336_7_buf));
		
		char* _newConnectivityMQTTMqttXDK_Accelerometer_z_3 = result173301336;
		exception = ConnectivityMQTTMqttXDK_Accelerometer_z_Write(&_newConnectivityMQTTMqttXDK_Accelerometer_z_3);
		if(exception != NO_EXCEPTION) return exception;
		exception = SetLED(NULL);
		if(exception != NO_EXCEPTION) return exception;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEvery5Second1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(firmwareMode == 2)
	{
		char result369463916_buf[12] = {0};
		char *result369463916 = result369463916_buf;
		
		char IfStatement4Result369463916_2_buf[12] = {0};
		snprintf(IfStatement4Result369463916_2_buf, sizeof(IfStatement4Result369463916_2_buf), "%" PRId32 "", firmwareMode);
		memcpy(result369463916, IfStatement4Result369463916_2_buf, sizeof(IfStatement4Result369463916_2_buf));
		
		char* _newConnectivityMQTTMqttXDK_Version_1 = result369463916;
		exception = ConnectivityMQTTMqttXDK_Version_Write(&_newConnectivityMQTTMqttXDK_Version_1);
		if(exception != NO_EXCEPTION) return exception;
		Environmental_Data_T sensorEnvironmentModalityPreparation_1;
		exception = Environmental_readData(xdkEnvironmental_BME280_Handle, &sensorEnvironmentModalityPreparation_1);
		if(exception != NO_EXCEPTION) return exception;
		
		double HelpVar = (sensorEnvironmentModalityPreparation_1.temperature - tempCorrection) / 1000.0f;
		char result321928222_buf[15] = {0};
		char *result321928222 = result321928222_buf;
		
		char IfStatement4Result321928222_4_buf[15] = {0};
		snprintf(IfStatement4Result321928222_4_buf, sizeof(IfStatement4Result321928222_4_buf), "%.6g", HelpVar);
		memcpy(result321928222, IfStatement4Result321928222_4_buf, sizeof(IfStatement4Result321928222_4_buf));
		
		char* _newConnectivityMQTTMqttXDK_Temperature_2 = result321928222;
		exception = ConnectivityMQTTMqttXDK_Temperature_Write(&_newConnectivityMQTTMqttXDK_Temperature_2);
		if(exception != NO_EXCEPTION) return exception;
		char result1797975888_buf[11] = {0};
		char *result1797975888 = result1797975888_buf;
		
		char IfStatement4Result1797975888_5_buf[11] = {0};
		snprintf(IfStatement4Result1797975888_5_buf, sizeof(IfStatement4Result1797975888_5_buf), "%" PRIu32 "", sensorEnvironmentModalityPreparation_1.pressure);
		memcpy(result1797975888, IfStatement4Result1797975888_5_buf, sizeof(IfStatement4Result1797975888_5_buf));
		
		char* _newConnectivityMQTTMqttXDK_Pressure_3 = result1797975888;
		exception = ConnectivityMQTTMqttXDK_Pressure_Write(&_newConnectivityMQTTMqttXDK_Pressure_3);
		if(exception != NO_EXCEPTION) return exception;
		char result1466752100_buf[11] = {0};
		char *result1466752100 = result1466752100_buf;
		
		char IfStatement4Result1466752100_6_buf[11] = {0};
		snprintf(IfStatement4Result1466752100_6_buf, sizeof(IfStatement4Result1466752100_6_buf), "%" PRIu32 "", sensorEnvironmentModalityPreparation_1.humidity);
		memcpy(result1466752100, IfStatement4Result1466752100_6_buf, sizeof(IfStatement4Result1466752100_6_buf));
		
		char* _newConnectivityMQTTMqttXDK_Humidity_4 = result1466752100;
		exception = ConnectivityMQTTMqttXDK_Humidity_Write(&_newConnectivityMQTTMqttXDK_Humidity_4);
		if(exception != NO_EXCEPTION) return exception;
		uint32_t sensorLightModalityPreparation_2;
		exception = LightSensor_readLuxData(xdkLightSensor_MAX44009_Handle, &sensorLightModalityPreparation_2);
		if(exception != NO_EXCEPTION) return exception;
		
		char result1762046864_buf[11] = {0};
		char *result1762046864 = result1762046864_buf;
		
		char IfStatement4Result1762046864_7_buf[11] = {0};
		snprintf(IfStatement4Result1762046864_7_buf, sizeof(IfStatement4Result1762046864_7_buf), "%" PRIu32 "", sensorLightModalityPreparation_2);
		memcpy(result1762046864, IfStatement4Result1762046864_7_buf, sizeof(IfStatement4Result1762046864_7_buf));
		
		char* _newConnectivityMQTTMqttXDK_Light_5 = result1762046864;
		exception = ConnectivityMQTTMqttXDK_Light_Write(&_newConnectivityMQTTMqttXDK_Light_5);
		if(exception != NO_EXCEPTION) return exception;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEvery100Millisecond1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(((firmwareMode == 1) || (firmwareMode == 5)) || (firmwareMode == 6))
	{
		char result1215936441_buf[12] = {0};
		char *result1215936441 = result1215936441_buf;
		
		char IfStatement18Result1215936441_2_buf[12] = {0};
		snprintf(IfStatement18Result1215936441_2_buf, sizeof(IfStatement18Result1215936441_2_buf), "%" PRId32 "", firmwareMode);
		memcpy(result1215936441, IfStatement18Result1215936441_2_buf, sizeof(IfStatement18Result1215936441_2_buf));
		
		char* _newConnectivityMQTTMqttXDK_Version_1 = result1215936441;
		exception = ConnectivityMQTTMqttXDK_Version_Write(&_newConnectivityMQTTMqttXDK_Version_1);
		if(exception != NO_EXCEPTION) return exception;
	}
	
	if(firmwareMode == 4)
	{
		char result175130919_buf[12] = {0};
		char *result175130919 = result175130919_buf;
		
		char IfStatement4Result175130919_3_buf[12] = {0};
		snprintf(IfStatement4Result175130919_3_buf, sizeof(IfStatement4Result175130919_3_buf), "%" PRId32 "", firmwareMode);
		memcpy(result175130919, IfStatement4Result175130919_3_buf, sizeof(IfStatement4Result175130919_3_buf));
		
		char* _newConnectivityMQTTMqttXDK_Version_2 = result175130919;
		exception = ConnectivityMQTTMqttXDK_Version_Write(&_newConnectivityMQTTMqttXDK_Version_2);
		if(exception != NO_EXCEPTION) return exception;
		float noise_sensorModalityPreparation_1;
		exception = readNoiseSensor(&noise_sensorModalityPreparation_1);
		if(exception != NO_EXCEPTION) return exception;
		
		char result1975791661_buf[15] = {0};
		char *result1975791661 = result1975791661_buf;
		
		char IfStatement4Result1975791661_4_buf[15] = {0};
		snprintf(IfStatement4Result1975791661_4_buf, sizeof(IfStatement4Result1975791661_4_buf), "%.6g", noise_sensorModalityPreparation_1
		);
		memcpy(result1975791661, IfStatement4Result1975791661_4_buf, sizeof(IfStatement4Result1975791661_4_buf));
		
		char* _newConnectivityMQTTMqttXDK_Noise_3 = result1975791661;
		exception = ConnectivityMQTTMqttXDK_Noise_Write(&_newConnectivityMQTTMqttXDK_Noise_3);
		if(exception != NO_EXCEPTION) return exception;
	}
	
	if(firmwareMode == 3)
	{
		char result1298671689_buf[12] = {0};
		char *result1298671689 = result1298671689_buf;
		
		char IfStatement4Result1298671689_5_buf[12] = {0};
		snprintf(IfStatement4Result1298671689_5_buf, sizeof(IfStatement4Result1298671689_5_buf), "%" PRId32 "", firmwareMode);
		memcpy(result1298671689, IfStatement4Result1298671689_5_buf, sizeof(IfStatement4Result1298671689_5_buf));
		
		char* _newConnectivityMQTTMqttXDK_Version_4 = result1298671689;
		exception = ConnectivityMQTTMqttXDK_Version_Write(&_newConnectivityMQTTMqttXDK_Version_4);
		if(exception != NO_EXCEPTION) return exception;
		Magnetometer_XyzData_T sensorMagnetometerModalityPreparation_2;
		exception = Magnetometer_readXyzLsbData(XdkMagnetometer_BMM150_Handle, &sensorMagnetometerModalityPreparation_2);
		if(exception != NO_EXCEPTION) return exception;
		
		char result2080526207_buf[12] = {0};
		char *result2080526207 = result2080526207_buf;
		
		char IfStatement4Result2080526207_6_buf[12] = {0};
		snprintf(IfStatement4Result2080526207_6_buf, sizeof(IfStatement4Result2080526207_6_buf), "%" PRId32 "", sensorMagnetometerModalityPreparation_2.xAxisData);
		memcpy(result2080526207, IfStatement4Result2080526207_6_buf, sizeof(IfStatement4Result2080526207_6_buf));
		
		char* _newConnectivityMQTTMqttXDK_Magnetometer_x_5 = result2080526207;
		exception = ConnectivityMQTTMqttXDK_Magnetometer_x_Write(&_newConnectivityMQTTMqttXDK_Magnetometer_x_5);
		if(exception != NO_EXCEPTION) return exception;
		char result1207630598_buf[12] = {0};
		char *result1207630598 = result1207630598_buf;
		
		char IfStatement4Result1207630598_7_buf[12] = {0};
		snprintf(IfStatement4Result1207630598_7_buf, sizeof(IfStatement4Result1207630598_7_buf), "%" PRId32 "", sensorMagnetometerModalityPreparation_2.yAxisData);
		memcpy(result1207630598, IfStatement4Result1207630598_7_buf, sizeof(IfStatement4Result1207630598_7_buf));
		
		char* _newConnectivityMQTTMqttXDK_Magnetometer_y_6 = result1207630598;
		exception = ConnectivityMQTTMqttXDK_Magnetometer_y_Write(&_newConnectivityMQTTMqttXDK_Magnetometer_y_6);
		if(exception != NO_EXCEPTION) return exception;
		char result398443010_buf[12] = {0};
		char *result398443010 = result398443010_buf;
		
		char IfStatement4Result398443010_8_buf[12] = {0};
		snprintf(IfStatement4Result398443010_8_buf, sizeof(IfStatement4Result398443010_8_buf), "%" PRId32 "", sensorMagnetometerModalityPreparation_2.zAxisData);
		memcpy(result398443010, IfStatement4Result398443010_8_buf, sizeof(IfStatement4Result398443010_8_buf));
		
		char* _newConnectivityMQTTMqttXDK_Magnetometer_z_7 = result398443010;
		exception = ConnectivityMQTTMqttXDK_Magnetometer_z_Write(&_newConnectivityMQTTMqttXDK_Magnetometer_z_7);
		if(exception != NO_EXCEPTION) return exception;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEvery5Millisecond1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(firmwareMode == 5)
	{
		bufferSize++;
		HelpVar++;
		struct bma2x2_accel_data sensorAccelerometerModalityPreparation_1;
		exception = SensorAccelerometer_ReadXYZ(&sensorAccelerometerModalityPreparation_1);
		if(exception != NO_EXCEPTION) return exception;
		
		uint32_t Accelerometer_Mag;
		Accelerometer_Mag = (uint32_t)sqrt((sensorAccelerometerModalityPreparation_1.x * sensorAccelerometerModalityPreparation_1.x) + (sensorAccelerometerModalityPreparation_1.y * sensorAccelerometerModalityPreparation_1.y) + (sensorAccelerometerModalityPreparation_1.z * sensorAccelerometerModalityPreparation_1.z));
		exception = addToBuffer_uint32(NULL, Accelerometer_Mag);
		if(exception != NO_EXCEPTION) return exception;
		if(bufferSize >= 100)
		{
			char result1630208155_buf[61] = {0};
			char *result1630208155 = result1630208155_buf;
			
			char IfStatement4Result1630208155_3_buf[61] = {0};
			snprintf(IfStatement4Result1630208155_3_buf, sizeof(IfStatement4Result1630208155_3_buf), "%s\n", fileBuffer);
			memcpy(result1630208155, IfStatement4Result1630208155_3_buf, sizeof(IfStatement4Result1630208155_3_buf));
			
			char* _newInputOutputSDCardSDc_WriteToFile_1 = result1630208155;
			exception = InputOutputSDCardSDc_WriteToFile_Write(&_newInputOutputSDCardSDc_WriteToFile_1);
			if(exception != NO_EXCEPTION) return exception;
			char mainFileBuffer_11_buf[] = "";
			memcpy(fileBuffer, mainFileBuffer_11_buf, sizeof(mainFileBuffer_11_buf));
			bufferSize = 0;
		}
		
		if(HelpVar >= 50)
		{
			
			
			if((BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_1) == 1))
			{
				firmwareMode = 4;
			}
			else if((BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_2) == 1))
			{
				firmwareMode = 6;
			}
			
			HelpVar = 0;
		}
		
		exception = SetLED(NULL);
		if(exception != NO_EXCEPTION) return exception;
	}
	
	if(firmwareMode == 6)
	{
		HelpVar++;
		char result1873865535_buf[7] = {0};
		char *result1873865535 = result1873865535_buf;
		
		exception = InputOutputSDCardSDc_ReadFromFile_Read(&result1873865535);
		if(exception != NO_EXCEPTION) return exception;
		
		int32_t result863950439;
		result863950439 = atoi(result1873865535);
		char result1724337586_buf[12] = {0};
		char *result1724337586 = result1724337586_buf;
		
		char IfStatement4Result1724337586_6_buf[12] = {0};
		snprintf(IfStatement4Result1724337586_6_buf, sizeof(IfStatement4Result1724337586_6_buf), "%" PRId32 "", result863950439);
		memcpy(result1724337586, IfStatement4Result1724337586_6_buf, sizeof(IfStatement4Result1724337586_6_buf));
		
		char* _newConnectivityMQTTMqttXDK_FromSD_3 = result1724337586;
		exception = ConnectivityMQTTMqttXDK_FromSD_Write(&_newConnectivityMQTTMqttXDK_FromSD_3);
		if(exception != NO_EXCEPTION) return exception;
		if(HelpVar >= 30)
		{
			
			
			if((BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_1) == 1))
			{
				firmwareMode = 5;
			}
			else if((BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_2) == 1))
			{
				firmwareMode = 1;
			}
			
			HelpVar = 0;
		}
		
		exception = SetLED(NULL);
		if(exception != NO_EXCEPTION) return exception;
	}


	return NO_EXCEPTION;
}

Retcode_T HandleEvery5Minute1(void* userParameter1, uint32_t userParameter2)
{
	
	BCDS_UNUSED(userParameter1);
	BCDS_UNUSED(userParameter2);

	Retcode_T exception = NO_EXCEPTION;
	
	
	PowerStatus platformXDK110ModalityPreparation_1;
	exception = XDK110_powerStatus_read(&platformXDK110ModalityPreparation_1);
	if(exception != NO_EXCEPTION) return exception;
	
	PowerStatus ps;
	ps = platformXDK110ModalityPreparation_1;
	switch(ps.tag) {
		case PowerStatus_Battery_e: {
			float level = ps.data.Battery;
			
				char result860929497_buf[15] = {0};
				char *result860929497 = result860929497_buf;
				
				char IsDeconstructionCase0Result860929497_3_buf[15] = {0};
				snprintf(IsDeconstructionCase0Result860929497_3_buf, sizeof(IsDeconstructionCase0Result860929497_3_buf), "%.6g", level);
				memcpy(result860929497, IsDeconstructionCase0Result860929497_3_buf, sizeof(IsDeconstructionCase0Result860929497_3_buf));
				
				char* _newConnectivityMQTTMqttXDK_Power_1 = result860929497;
				exception = ConnectivityMQTTMqttXDK_Power_Write(&_newConnectivityMQTTMqttXDK_Power_1);
				if(exception != NO_EXCEPTION) return exception;
			
			break;
		}
		case PowerStatus_Corded_e: {
			
				char result532924013_buf[4] = {0};
				char *result532924013 = result532924013_buf;
				
				char IsTypeMatchCase0Result532924013_5_buf[4] = {0};
				snprintf(IsTypeMatchCase0Result532924013_5_buf, sizeof(IsTypeMatchCase0Result532924013_5_buf), "100");
				memcpy(result532924013, IsTypeMatchCase0Result532924013_5_buf, sizeof(IsTypeMatchCase0Result532924013_5_buf));
				
				char* _newConnectivityMQTTMqttXDK_Power_2 = result532924013;
				exception = ConnectivityMQTTMqttXDK_Power_Write(&_newConnectivityMQTTMqttXDK_Power_2);
				if(exception != NO_EXCEPTION) return exception;
			
			break;
		}
	}


	return NO_EXCEPTION;
}

Retcode_T addToBuffer_uint32(void* _result, uint32_t Value)
{

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(Value >= 1000)
	{
		char mainFileBuffer_2_buf[14] = {0};
		snprintf(mainFileBuffer_2_buf, sizeof(mainFileBuffer_2_buf), "%" PRIu32 " \n", Value);
		strcat(fileBuffer, mainFileBuffer_2_buf);
	}
	else if(Value >= 100)
	{
		char mainFileBuffer_5_buf[15] = {0};
		snprintf(mainFileBuffer_5_buf, sizeof(mainFileBuffer_5_buf), "0%" PRIu32 " \n", Value);
		strcat(fileBuffer, mainFileBuffer_5_buf);
	}
	else if(Value >= 10)
	{
		char mainFileBuffer_8_buf[16] = {0};
		snprintf(mainFileBuffer_8_buf, sizeof(mainFileBuffer_8_buf), "00%" PRIu32 " \n", Value);
		strcat(fileBuffer, mainFileBuffer_8_buf);
	}
	else if(Value >= 0)
	{
		char mainFileBuffer_11_buf[17] = {0};
		snprintf(mainFileBuffer_11_buf, sizeof(mainFileBuffer_11_buf), "000%" PRIu32 " \n", Value);
		strcat(fileBuffer, mainFileBuffer_11_buf);
	}

	return exception;
}

Retcode_T SetLED(void* _result)
{

	Retcode_T exception = NO_EXCEPTION;
	
	
	if(firmwareMode == 5)
	{
		bool result403879298;
		exception = ConnectivityLEDLed_Red_Read(&result403879298);
		if(exception != NO_EXCEPTION) return exception;
		
		if(!result403879298)
		{
			bool _newConnectivityLEDLed_Red_2 = true;
			exception = ConnectivityLEDLed_Red_Write(&_newConnectivityLEDLed_Red_2);
			if(exception != NO_EXCEPTION) return exception;
		}
	}
	else
	{
		bool result1647649224;
		exception = ConnectivityLEDLed_Red_Read(&result1647649224);
		if(exception != NO_EXCEPTION) return exception;
		
		if(result1647649224)
		{
			bool _newConnectivityLEDLed_Red_4 = false;
			exception = ConnectivityLEDLed_Red_Write(&_newConnectivityLEDLed_Red_4);
			if(exception != NO_EXCEPTION) return exception;
		}
	}
	
	if(firmwareMode == 6)
	{
		bool result644029852;
		exception = ConnectivityLEDLed_Orange_Read(&result644029852);
		if(exception != NO_EXCEPTION) return exception;
		
		if(!result644029852)
		{
			bool _newConnectivityLEDLed_Orange_6 = true;
			exception = ConnectivityLEDLed_Orange_Write(&_newConnectivityLEDLed_Orange_6);
			if(exception != NO_EXCEPTION) return exception;
		}
	}
	else
	{
		bool result2061814120;
		exception = ConnectivityLEDLed_Orange_Read(&result2061814120);
		if(exception != NO_EXCEPTION) return exception;
		
		if(result2061814120)
		{
			bool _newConnectivityLEDLed_Orange_8 = false;
			exception = ConnectivityLEDLed_Orange_Write(&_newConnectivityLEDLed_Orange_8);
			if(exception != NO_EXCEPTION) return exception;
		}
	}

	return exception;
}


