diff options
Diffstat (limited to 'dummyresource/facade.cpp')
-rw-r--r-- | dummyresource/facade.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index b7ba2c2..cd930f6 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -48,29 +48,14 @@ DummyResourceFacade::~DummyResourceFacade() | |||
48 | 48 | ||
49 | Async::Job<void> DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) | 49 | Async::Job<void> DummyResourceFacade::create(const Akonadi2::Domain::Event &domainObject) |
50 | { | 50 | { |
51 | //Create message buffer and send to resource | ||
52 | flatbuffers::FlatBufferBuilder eventFbb; | ||
53 | eventFbb.Clear(); | ||
54 | { | ||
55 | auto summary = eventFbb.CreateString("summary"); | ||
56 | // auto data = fbb.CreateUninitializedVector<uint8_t>(attachmentSize); | ||
57 | DummyCalendar::DummyEventBuilder eventBuilder(eventFbb); | ||
58 | eventBuilder.add_summary(summary); | ||
59 | auto eventLocation = eventBuilder.Finish(); | ||
60 | DummyCalendar::FinishDummyEventBuffer(eventFbb, eventLocation); | ||
61 | // memcpy((void*)DummyCalendar::GetDummyEvent(fbb.GetBufferPointer())->attachment()->Data(), rawData, attachmentSize); | ||
62 | } | ||
63 | flatbuffers::FlatBufferBuilder entityFbb; | 51 | flatbuffers::FlatBufferBuilder entityFbb; |
64 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), 0, 0); | 52 | mFactory->createBuffer(domainObject, entityFbb); |
65 | 53 | ||
66 | flatbuffers::FlatBufferBuilder fbb; | 54 | flatbuffers::FlatBufferBuilder fbb; |
67 | //This is the resource type and not the domain type | 55 | //This is the resource buffer type and not the domain type |
68 | auto type = fbb.CreateString("event"); | 56 | auto type = fbb.CreateString("event"); |
69 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 57 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
70 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 58 | auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); |
71 | builder.add_domainType(type); | ||
72 | builder.add_delta(delta); | ||
73 | auto location = builder.Finish(); | ||
74 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 59 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); |
75 | mResourceAccess->open(); | 60 | mResourceAccess->open(); |
76 | return mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); | 61 | return mResourceAccess->sendCommand(Akonadi2::Commands::CreateEntityCommand, fbb); |