aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Storage/StorageFileHandlerStatus.cs
blob: 7fb30dd1668ee9d1abb1ec82e330ff32594711a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Integration.Storage
{
    public enum StorageFileHandlerStatus
    {
        Pending,
        Active,
        Canceled,
        Failed,
        Completed,
    }
}
"MessageType.pb-c.h" #include "UploadHardwareConfigurationRequest.pb-c.h"; using namespace std; namespace Tango { namespace Emulations { namespace Native { EmbeddedEmulator::EmbeddedEmulator() { } EmbeddedEmulator::~EmbeddedEmulator() { } MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t(*packPtr)(void*, uint8_t*), size_t(*sizePtr)(void*)) { MessageContainer container = MESSAGE_CONTAINER__INIT; container.completed = completed; container.token = token; container.has_completed = true; container.has_data = true; container.has_type = true; container.type = type; uint8_t* response_buffer = (uint8_t*)malloc((*sizePtr)(response)); size_t response_size = (*packPtr)(response, response_buffer); container.data.data = response_buffer; container.data.len = response_size; //free(response); return container; } size_t EmbeddedEmulator::ProcessMessage(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer) { MessageContainer * container = message_container__unpack(NULL, input_buffer_size, input_buffer); switch (container->type) { case MESSAGE_TYPE__UploadHardwareConfigurationRequest: UploadHardwareConfigurationRequest* hardwareRequest = upload_hardware_configuration_request__unpack(NULL, container->data.len, container->data.data); MessageContainer responseContainer = createContainer(MESSAGE_TYPE__UploadHardwareConfigurationRequest, container->token, true, hardwareRequest, (size_t(*)(void*, uint8_t*))&upload_hardware_configuration_request__pack, (size_t(*)(void*))&upload_hardware_configuration_request__get_packed_size); output_buffer = (uint8_t*)malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, output_buffer); return container_size; } return 0; } } } }