aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DAL.Local/DB/ADDRESS.cs
blob: edecaf25005fedae10f2442488463e7ef3d26b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated from a template.
//
//     Manual changes to this file may cause unexpected behavior in your application.
//     Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Tango.DAL.Local.DB
{
    using System;
    using System.Collections.Generic;
    
    public partial class ADDRESS
    {
        public long ID { get; set; }
        public string GUID { get; set; }
        public System.DateTime LAST_UPDATED { get; set; }
        public bool DELETED { get; set; }
        public string ADDRESS_STRING { get; set; }
        public string LOCALITY { get; set; }
        public string COUNTRY { get; set; }
        public string CITY { get; set; }
        public string STATE { get; set; }
        public string COUNTRY_CODE { get; set; }
        public string POSTAL_CODE { get; set; }
    }
}
e.pb-c.h> #include <PMR/Connection/KeepAliveRequest.pb-c.h> #include <PMR/Connection/KeepAliveResponse.pb-c.h> #include <PMR/Connection/DeviceInformation.pb-c.h> #include "Common/SWUpdate/FileSystem.h" #include "Common/SW_Info/SW_Info.h" #include "Common/report/report.h" #include <utils/ustdlib.h> #include "drivers/FPGA/FPGA.h" #include "Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "StateMachines/Printing/PrintingSTM.h" #include "Modules/heaters/heaters_ex.h" #include "modules/Diagnostics/Diagnostics.h" #include "Modules/AlarmHandling/AlarmHandling.h" #include "Modules/Stubs_Handler/Stub_HW_Version.h" bool FirstConnection = true; char HexToDecimal(char hex) { int i = hex % 0x10; int j = hex / 0x10; return j*10+i; } void ConnectionRequest(MessageContainer* requestContainer) { MessageContainer responseContainer; ConnectRequest* request = connect_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); DeviceInformation DevInfo = DEVICE_INFORMATION__INIT; ConnectResponse response = CONNECT_RESPONSE__INIT; /*if (GeneralHwReady == false) { return; }*/ unsigned char Major = 0; unsigned char Year = 0 ; unsigned char Month = 0; unsigned char Day = 0; char Version[30] = {0}; char FPGA1Version[30] = {0}; char FPGA2Version[30] = {0}; char FPGA3Version[30] = {0}; char BoardVersion[30] = {0}; char AssyVersion[30] = {0}; response.deviceinformation = &DevInfo; if (request->has_unixtime) utilsUpdateDateTime(request->unixtime);//(request->seconds); ReportStopReporting(); DiagnosticsStop(); JobStopReporting(); AlarmHandlingStop(); /* extern TangoVersion_t _gTangoVersion; extern char Dat[50]; extern char _gTangoName [MAX_STRING_LEN];//d */ DevInfo.builddate = Dat; DevInfo.name = _gTangoName; usnprintf(Version, 30, "%d.%d.%d.%d",_gTangoVersion.m_major,_gTangoVersion.m_minor,_gTangoVersion.m_patch,_gTangoVersion.m_build); DevInfo.version = Version; FPGA_ReadVersion(1, &Major, &Year, &Month, &Day); usnprintf(FPGA1Version, 30, "FPGA1: Ver %d %d/%d/20%d",HexToDecimal(Major), HexToDecimal(Day),HexToDecimal(Month),HexToDecimal(Year)); DevInfo.fpga1version = FPGA1Version; FPGA_ReadVersion(2, &Major, &Year, &Month, &Day); usnprintf(FPGA2Version, 30, "FPGA2: Ver %d %d/%d/20%d",HexToDecimal(Major), HexToDecimal(Day),HexToDecimal(Month),HexToDecimal(Year)); DevInfo.fpga2version = FPGA2Version; FPGA_ReadVersion(3, &Major, &Year, &Month, &Day); usnprintf(FPGA3Version, 30, "FPGA3: Ver %d %d/%d/20%d",HexToDecimal(Major), HexToDecimal(Day),HexToDecimal(Month),HexToDecimal(Year)); DevInfo.fpga3version = FPGA3Version; Read_HW_Version(BoardVersion, AssyVersion); DevInfo.boardrevision = BoardVersion; DevInfo.assemblyversion = AssyVersion; DevInfo.has_diagnosticsinterval = true; DevInfo.diagnosticsinterval = GetDiagnosticCollectionLimit(); response.has_isafterreset = true; response.isafterreset = FirstConnection; FirstConnection = false; responseContainer = createContainer(MESSAGE_TYPE__ConnectResponse, requestContainer->token, true, &response, &connect_response__pack, &connect_response__get_packed_size); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); SendChars((char*)container_buffer, container_size); connect_request__free_unpacked(request,NULL); } void DisconnectionRequest(MessageContainer* requestContainer) { MessageContainer responseContainer; //DisconnectRequest* request = disconnect_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); DisconnectResponse response = DISCONNECT_RESPONSE__INIT; responseContainer = createContainer(MESSAGE_TYPE__DisconnectResponse, requestContainer->token, true, &response, &disconnect_response__pack, &disconnect_response__get_packed_size); ReportStopReporting(); DiagnosticsStop(); JobStopReporting(); AlarmHandlingStop(); //UART_ResetBuffers(); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); SendChars((char*)container_buffer, container_size); //disconnect_request__free_unpacked(request,NULL); //CommunicationMailboxFlush(); //USBCDCD_Reinit(); } int KeepAliveOneSecondCounter = 0; #define KEEPALIVE_COMMUNICATION_ABORT_LIMIT 10 bool KeepAliveActive = false; bool keepalivetest = false; void KeepAliveRequestFunc(MessageContainer* requestContainer) { MessageContainer responseContainer; //KeepAliveRequest* request = keep_alive_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); KeepAliveResponse response = KEEP_ALIVE_RESPONSE__INIT; if (keepalivetest == false) KeepAliveOneSecondCounter = 0; KeepAliveActive = true; responseContainer = createContainer(MESSAGE_TYPE__KeepAliveResponse, requestContainer->token, true, &response, &keep_alive_response__pack, &keep_alive_response__get_packed_size); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); SendChars((char*)container_buffer, container_size); //keep_alive_request__free_unpacked(request,NULL); } void KeepAliveOneSecondCall(void) { if (KeepAliveActive == false) return; if (FileUploadGetState()==false) return; KeepAliveOneSecondCounter++; if (KeepAliveOneSecondCounter > (KEEPALIVE_COMMUNICATION_ABORT_LIMIT/2)) { Report("keepalive danger",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0); } if (KeepAliveOneSecondCounter > KEEPALIVE_COMMUNICATION_ABORT_LIMIT) { Report("keepalive ",__FILE__,__LINE__,KeepAliveOneSecondCounter,RpWarning,msec_millisecondCounter, 0); //LOG_ERROR(KeepAliveOneSecondCounter, "Communication keepalive failed"); KeepAliveOneSecondCounter = 0; KeepAliveActive = false; //ReportStopReporting(); DiagnosticsStop(); JobStopReporting(); //AlarmHandlingStop(); //CommunicationMailboxFlush(); keepalivetest = false; //USBCDCD_init(); USBCDCD_Reinit(); //UART_ResetBuffers(); } }