Merge remote-tracking branch 'location/tizen'
[platform/core/csapi/tizenfx.git] / src / Test.cs
1 using System;
2 using System.Runtime.InteropServices;
3 using System.Threading;
4 using System.Threading.Tasks;
5
6 using Tizen.Security.TEEC;
7
8 class Test {
9         static void Main() {
10                 Guid ta_uuid = new Guid();
11                 Context ctx = new Context(null);
12                 Session ses = null;
13
14                 ctx.OpenSession(ta_uuid);
15                 ses.Close();
16
17                 CancellationTokenSource token = new CancellationTokenSource();
18                 Task<Session> ses_task = ctx.OpenSessionAsync(ta_uuid, token.Token);
19                 ses = ses_task.Result;
20                 ses.Close();
21
22                 IntPtr buf = Marshal.AllocHGlobal(20*1024);
23                 SharedMemory shm = ctx.RegisterSharedMemory(buf, 20*1024, SharedMemoryFlags.Input|SharedMemoryFlags.Output);
24                 ctx.ReleaseSharedMemory(shm);
25                 Marshal.FreeHGlobal(buf);
26
27                 shm = ctx.AllocateSharedMemory(10*1024, SharedMemoryFlags.Input);
28                 ctx.ReleaseSharedMemory(shm);
29         }
30 }