Skip to content

Commit fd5f9a2

Browse files
pjh9216jykeon
authored andcommitted
[Tizen.Applications.Common] Extend parcel header API (#7418)
* Extend SetTag method using rpc_port_parcel_set_tag_ex() - tidlc will use this method to save more information Signed-off-by: jh9216.park <jh9216.park@samsung.com> * Check parameter Signed-off-by: jh9216.park <jh9216.park@samsung.com> * Remove a space Signed-off-by: jh9216.park <jh9216.park@samsung.com> --------- Signed-off-by: jh9216.park <jh9216.park@samsung.com>
1 parent 07801f3 commit fd5f9a2

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/Tizen.Applications.Common/Interop/Interop.RPCPort.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ internal static partial class Parcel
158158
[DllImport(Libraries.RpcPort, EntryPoint = "rpc_port_parcel_header_get_tag")]
159159
internal static extern ErrorCode GetTag(IntPtr parcelHeaderHandle, out string tag);
160160

161+
//int rpc_port_parcel_header_set_tag_ex(rpc_port_parcel_header_h header,
162+
// unsigned char tidlc_version_major, unsigned char tidlc_version_minor,
163+
// unsigned char tidlc_version_patch, unsigned char tidl_protocol_ver, unsigned char flags);
164+
[DllImport(Libraries.RpcPort, EntryPoint = "rpc_port_parcel_header_set_tag_ex")]
165+
internal static extern ErrorCode SetTagEx(IntPtr parcelHeaderHandle, byte major, byte minor, byte patch, byte protocol, byte flags);
166+
161167
//int rpc_port_parcel_header_set_seq_num(rpc_port_parcel_header_h header, int seq_num);
162168
[DllImport(Libraries.RpcPort, EntryPoint = "rpc_port_parcel_header_set_seq_num")]
163169
internal static extern ErrorCode SetSeqNum(IntPtr parcelHeaderHandle, int seq_num);

src/Tizen.Applications.Common/Tizen.Applications.RPCPort/Parcel.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,30 @@ internal ParcelHeader()
8282
/// <since_tizen> 9 </since_tizen>
8383
public void SetTag(string tag)
8484
{
85-
var r = Interop.LibRPCPort.Parcel.SetTag(_handle, tag);
86-
if (r != Interop.LibRPCPort.ErrorCode.None)
85+
if (tag == null)
86+
throw new InvalidIOException();
87+
string[] parts = tag.Split(new char[] {'.', ':'}, StringSplitOptions.RemoveEmptyEntries);
88+
if (parts.Length != 5)
89+
{
90+
var r = Interop.LibRPCPort.Parcel.SetTag(_handle, tag);
91+
if (r != Interop.LibRPCPort.ErrorCode.None)
92+
throw new InvalidIOException();
93+
return;
94+
}
95+
96+
if (!int.TryParse(parts[0], out int major))
97+
throw new InvalidIOException();
98+
if (!int.TryParse(parts[1], out int minor))
99+
throw new InvalidIOException();
100+
if (!int.TryParse(parts[2], out int patch))
101+
throw new InvalidIOException();
102+
if (!int.TryParse(parts[3], out int protocol))
103+
throw new InvalidIOException();
104+
if (!int.TryParse(parts[4], out int flags))
105+
throw new InvalidIOException();
106+
107+
var ret = Interop.LibRPCPort.Parcel.SetTagEx(_handle, (byte)major, (byte)minor, (byte)patch, (byte)protocol, (byte)flags);
108+
if (ret != Interop.LibRPCPort.ErrorCode.None)
87109
throw new InvalidIOException();
88110
}
89111

0 commit comments

Comments
 (0)