summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eldbus_mono/eldbus_common.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/eldbus_mono/eldbus_common.cs')
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_common.cs408
1 files changed, 327 insertions, 81 deletions
diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs
index 34f6482..9d6a408 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_common.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs
@@ -1,8 +1,24 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#pragma warning disable 1591 16#pragma warning disable 1591
2 17
3using System; 18using System;
4using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
5using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.CodeAnalysis;
6 22
7using static eldbus.EldbusMessageNativeFunctions; 23using static eldbus.EldbusMessageNativeFunctions;
8 24
@@ -26,7 +42,7 @@ public static class Timeout
26/// <para>Since EFL 1.23.</para> 42/// <para>Since EFL 1.23.</para>
27/// </summary> 43/// </summary>
28[StructLayout(LayoutKind.Sequential)] 44[StructLayout(LayoutKind.Sequential)]
29public struct ObjectPath 45public struct ObjectPath : IEquatable<ObjectPath>
30{ 46{
31 /// <summary> 47 /// <summary>
32 /// The string of the path. 48 /// The string of the path.
@@ -49,20 +65,71 @@ public struct ObjectPath
49 /// <para>Since EFL 1.23.</para> 65 /// <para>Since EFL 1.23.</para>
50 /// </summary> 66 /// </summary>
51 /// <param name="str">The string of the path.</param> 67 /// <param name="str">The string of the path.</param>
52 public static implicit operator ObjectPath(string str) 68 public static implicit operator ObjectPath(string str) => FromString(str);
53 { 69
54 return new ObjectPath(str); 70 /// <summary>
55 } 71 /// Converts a <see cref="string" /> to a <see cref="ObjectPath" />.
72 /// <para>Since EFL 1.23.</para>
73 /// </summary>
74 /// <param name="str">The <see cref="string" /> of the path.</param>
75 public static ObjectPath FromString(string str) => new ObjectPath(str);
56 76
57 /// <summary> 77 /// <summary>
58 /// Conversion operator of string from ObjectPath. 78 /// Conversion operator of string from ObjectPath.
59 /// <para>Since EFL 1.23.</para> 79 /// <para>Since EFL 1.23.</para>
60 /// </summary> 80 /// </summary>
61 /// <param name="path">The ObjectPath to be converted.</param> 81 /// <param name="path">The ObjectPath to be converted.</param>
62 public static implicit operator string(ObjectPath path) 82 public static implicit operator string(ObjectPath path) => ToString(path);
63 { 83
64 return path.value; 84 /// <summary>
65 } 85 /// Converts a <see cref="ObjectPath" /> to a <see cref="string" />.
86 /// <para>Since EFL 1.23.</para>
87 /// </summary>
88 /// <param name="path">The ObjectPath to be converted.</param>
89 public static string ToString(ObjectPath path) => path.value;
90
91 /// <summary>
92 /// Gets a hash for <see cref="ObjectPath" />.
93 /// <para>Since EFL 1.24.</para>
94 /// </summary>
95 /// <returns>A hash code.</returns>
96 public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal);
97
98 /// <summary>Returns whether this <see cref="ObjectPath" />
99 /// is equal to the given <see cref="object" />.
100 /// <para>Since EFL 1.24.</para>
101 /// </summary>
102 /// <param name="other">The <see cref="object" /> to be compared to.</param>
103 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
104 public override bool Equals(object other)
105 => (!(other is ObjectPath)) ? false : Equals((ObjectPath)other);
106
107 /// <summary>Returns whether this <see cref="ObjectPath" /> is equal
108 /// to the given <see cref="ObjectPath" />.
109 /// <para>Since EFL 1.24.</para>
110 /// </summary>
111 /// <param name="other">The <see cref="ObjectPath" /> to be compared to.</param>
112 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
113 public bool Equals(ObjectPath other) => value == other.value;
114
115 /// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
116 /// <para>Since EFL 1.24.</para>
117 /// </summary>
118 /// <param name="lhs">The left hand side of the operator.</param>
119 /// <param name="rhs">The right hand side of the operator.</param>
120 /// <returns><c>true</c> if <c>lhs</c> is equal
121 /// to <c>rhs</c>.</returns>
122 public static bool operator==(ObjectPath lhs, ObjectPath rhs) => lhs.Equals(rhs);
123
124 /// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
125 /// <para>Since EFL 1.24.</para>
126 /// </summary>
127 /// <param name="lhs">The left hand side of the operator.</param>
128 /// <param name="rhs">The right hand side of the operator.</param>
129 /// <returns><c>true</c> if <c>lhs</c> is not equal
130 /// to <c>rhs</c>.</returns>
131 public static bool operator!=(ObjectPath lhs, ObjectPath rhs) => !(lhs == rhs);
132
66} 133}
67 134
68/// <summary> 135/// <summary>
@@ -70,7 +137,7 @@ public struct ObjectPath
70/// <para>Since EFL 1.23.</para> 137/// <para>Since EFL 1.23.</para>
71/// </summary> 138/// </summary>
72[StructLayout(LayoutKind.Sequential)] 139[StructLayout(LayoutKind.Sequential)]
73public struct SignatureString 140public struct SignatureString : IEquatable<SignatureString>
74{ 141{
75 /// <summary> 142 /// <summary>
76 /// The string of the signature. 143 /// The string of the signature.
@@ -94,9 +161,15 @@ public struct SignatureString
94 /// </summary> 161 /// </summary>
95 /// <param name="str">The string of the signature.</param> 162 /// <param name="str">The string of the signature.</param>
96 public static implicit operator SignatureString(string str) 163 public static implicit operator SignatureString(string str)
97 { 164 => FromString(str);
98 return new SignatureString(str); 165
99 } 166 /// <summary>
167 /// Converts a <see cref="string" /> to a <see cref="SignatureString" />
168 /// <para>Since EFL 1.23.</para>
169 /// </summary>
170 /// <param name="str">The string of the signature.</param>
171 public static SignatureString FromString(string str)
172 => new SignatureString(str);
100 173
101 /// <summary> 174 /// <summary>
102 /// Conversion operator of string from SignatureString. 175 /// Conversion operator of string from SignatureString.
@@ -104,9 +177,51 @@ public struct SignatureString
104 /// </summary> 177 /// </summary>
105 /// <param name="sig">The SignatureString to be conversion.</param> 178 /// <param name="sig">The SignatureString to be conversion.</param>
106 public static implicit operator string(SignatureString sig) 179 public static implicit operator string(SignatureString sig)
107 { 180 => ToString(sig);
108 return sig.value; 181
109 } 182 public static string ToString(SignatureString sig) => sig.value;
183
184 /// <summary>
185 /// Gets a hash for <see cref="SignatureString" />.
186 /// <para>Since EFL 1.24.</para>
187 /// </summary>
188 /// <returns>A hash code.</returns>
189 public override int GetHashCode() => value.GetHashCode(StringComparison.Ordinal);
190
191 /// <summary>Returns whether this <see cref="SignatureString" />
192 /// is equal to the given <see cref="object" />.
193 /// <para>Since EFL 1.24.</para>
194 /// </summary>
195 /// <param name="other">The <see cref="object" /> to be compared to.</param>
196 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
197 public override bool Equals(object other)
198 => (!(other is SignatureString)) ? false : Equals((SignatureString)other);
199
200 /// <summary>Returns whether this <see cref="SignatureString" /> is equal
201 /// to the given <see cref="SignatureString" />.
202 /// <para>Since EFL 1.24.</para>
203 /// </summary>
204 /// <param name="other">The <see cref="SignatureString" /> to be compared to.</param>
205 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
206 public bool Equals(SignatureString other) => value == other.value;
207
208 /// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
209 /// <para>Since EFL 1.24.</para>
210 /// </summary>
211 /// <param name="lhs">The left hand side of the operator.</param>
212 /// <param name="rhs">The right hand side of the operator.</param>
213 /// <returns><c>true</c> if <c>lhs</c> is equal
214 /// to <c>rhs</c>.</returns>
215 public static bool operator==(SignatureString lhs, SignatureString rhs) => lhs.Equals(rhs);
216
217 /// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
218 /// <para>Since EFL 1.24.</para>
219 /// </summary>
220 /// <param name="lhs">The left hand side of the operator.</param>
221 /// <param name="rhs">The right hand side of the operator.</param>
222 /// <returns><c>true</c> if <c>lhs</c> is not equal
223 /// to <c>rhs</c>.</returns>
224 public static bool operator!=(SignatureString lhs, SignatureString rhs) => !(lhs == rhs);
110} 225}
111 226
112/// <summary> 227/// <summary>
@@ -114,7 +229,7 @@ public struct SignatureString
114/// <para>Since EFL 1.23.</para> 229/// <para>Since EFL 1.23.</para>
115/// </summary> 230/// </summary>
116[StructLayout(LayoutKind.Sequential)] 231[StructLayout(LayoutKind.Sequential)]
117public struct UnixFd 232public struct UnixFd : IEquatable<UnixFd>
118{ 233{
119 /// <summary> 234 /// <summary>
120 /// The value of the file descriptor. 235 /// The value of the file descriptor.
@@ -137,22 +252,71 @@ public struct UnixFd
137 /// <para>Since EFL 1.23.</para> 252 /// <para>Since EFL 1.23.</para>
138 /// </summary> 253 /// </summary>
139 /// <param name="fd">The file descriptor.</param> 254 /// <param name="fd">The file descriptor.</param>
140 public static implicit operator UnixFd(Int32 fd) 255 public static implicit operator UnixFd(Int32 fd) => FromInt32(fd);
141 { 256
142 return new UnixFd(fd); 257 /// <summary>
143 } 258 /// Converts a <see cref="Int32" /> to a <see cref="UnixFd" />.
259 /// <para>Since EFL 1.23.</para>
260 /// </summary>
261 /// <param name="fd">The file descriptor.</param>
262 public static UnixFd FromInt32(Int32 fd) => new UnixFd(fd);
144 263
145 /// <summary> 264 /// <summary>
146 /// Conversion operator of Int32 from UnixFd. 265 /// Conversion operator of Int32 from UnixFd.
147 /// <para>Since EFL 1.23.</para> 266 /// <para>Since EFL 1.23.</para>
148 /// </summary> 267 /// </summary>
149 /// <param name="unix_fd">The UnixFd to be converted.</param> 268 /// <param name="unix_fd">The UnixFd to be converted.</param>
150 public static implicit operator Int32(UnixFd unix_fd) 269 public static implicit operator Int32(UnixFd unix_fd) => ToInt32(unix_fd);
151 {
152 return unix_fd.value;
153 }
154}
155 270
271 /// <summary>
272 /// Converts a <see cref="UnixFd" /> to a <see cref="Int32" />.
273 /// <para>Since EFL 1.23.</para>
274 /// </summary>
275 /// <param name="unix_fd">The <see cref="UnixFd" /> to be converted.</param>
276 public static Int32 ToInt32(UnixFd unix_fd) => unix_fd.value;
277
278 /// <summary>
279 /// Gets a hash for <see cref="UnixFd" />.
280 /// <para>Since EFL 1.24.</para>
281 /// </summary>
282 /// <returns>A hash code.</returns>
283 public override int GetHashCode() => value.GetHashCode();
284
285 /// <summary>Returns whether this <see cref="UnixFd" />
286 /// is equal to the given <see cref="object" />.
287 /// <para>Since EFL 1.24.</para>
288 /// </summary>
289 /// <param name="other">The <see cref="object" /> to be compared to.</param>
290 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
291 public override bool Equals(object other)
292 => (!(other is UnixFd)) ? false : Equals((UnixFd)other);
293
294 /// <summary>Returns whether this <see cref="UnixFd" /> is equal
295 /// to the given <see cref="UnixFd" />.
296 /// <para>Since EFL 1.24.</para>
297 /// </summary>
298 /// <param name="other">The <see cref="UnixFd" /> to be compared to.</param>
299 /// <returns><c>true</c> if is equal to <c>other</c>.</returns>
300 public bool Equals(UnixFd other) => value == other.value;
301
302 /// <summary>Returns whether <c>lhs</c> is equal to <c>rhs</c>.
303 /// <para>Since EFL 1.24.</para>
304 /// </summary>
305 /// <param name="lhs">The left hand side of the operator.</param>
306 /// <param name="rhs">The right hand side of the operator.</param>
307 /// <returns><c>true</c> if <c>lhs</c> is equal
308 /// to <c>rhs</c>.</returns>
309 public static bool operator==(UnixFd lhs, UnixFd rhs) => lhs.Equals(rhs);
310
311 /// <summary>Returns whether <c>lhs</c> is not equal to <c>rhs</c>.
312 /// <para>Since EFL 1.24.</para>
313 /// </summary>
314 /// <param name="lhs">The left hand side of the operator.</param>
315 /// <param name="rhs">The right hand side of the operator.</param>
316 /// <returns><c>true</c> if <c>lhs</c> is not equal
317 /// to <c>rhs</c>.</returns>
318 public static bool operator!=(UnixFd lhs, UnixFd rhs) => !(lhs == rhs);
319}
156/// <summary> 320/// <summary>
157/// Arguments of EldBus. 321/// Arguments of EldBus.
158/// <para>Since EFL 1.23.</para> 322/// <para>Since EFL 1.23.</para>
@@ -163,7 +327,7 @@ public static class Argument
163 /// The type of a byte. 327 /// The type of a byte.
164 /// <para>Since EFL 1.23.</para> 328 /// <para>Since EFL 1.23.</para>
165 /// </summary> 329 /// </summary>
166 public static class ByteType 330 internal static class ByteType
167 { 331 {
168 /// <summary> 332 /// <summary>
169 /// The code of the byte. 333 /// The code of the byte.
@@ -181,7 +345,7 @@ public static class Argument
181 /// The type of a boolean 345 /// The type of a boolean
182 /// <para>Since EFL 1.23.</para> 346 /// <para>Since EFL 1.23.</para>
183 /// </summary> 347 /// </summary>
184 public static class BooleanType 348 internal static class BooleanType
185 { 349 {
186 /// <summary> 350 /// <summary>
187 /// The code of the boolean. 351 /// The code of the boolean.
@@ -199,7 +363,7 @@ public static class Argument
199 /// The type of a Int16. 363 /// The type of a Int16.
200 /// <para>Since EFL 1.23.</para> 364 /// <para>Since EFL 1.23.</para>
201 /// </summary> 365 /// </summary>
202 public static class Int16Type 366 internal static class Int16Type
203 { 367 {
204 /// <summary> 368 /// <summary>
205 /// The code of the Int16. 369 /// The code of the Int16.
@@ -217,7 +381,7 @@ public static class Argument
217 /// The type of an unsigned Int16. 381 /// The type of an unsigned Int16.
218 /// <para>Since EFL 1.23.</para> 382 /// <para>Since EFL 1.23.</para>
219 /// </summary> 383 /// </summary>
220 public static class UInt16Type 384 internal static class UInt16Type
221 { 385 {
222 /// <summary> 386 /// <summary>
223 /// The code of the unsigned Int16. 387 /// The code of the unsigned Int16.
@@ -235,7 +399,7 @@ public static class Argument
235 /// The type of a Int32. 399 /// The type of a Int32.
236 /// <para>Since EFL 1.23.</para> 400 /// <para>Since EFL 1.23.</para>
237 /// </summary> 401 /// </summary>
238 public static class Int32Type 402 internal static class Int32Type
239 { 403 {
240 /// <summary> 404 /// <summary>
241 /// The code of the Int32. 405 /// The code of the Int32.
@@ -253,7 +417,7 @@ public static class Argument
253 /// The type of an unsigned Int32. 417 /// The type of an unsigned Int32.
254 /// <para>Since EFL 1.23.</para> 418 /// <para>Since EFL 1.23.</para>
255 /// </summary> 419 /// </summary>
256 public static class UInt32Type 420 internal static class UInt32Type
257 { 421 {
258 /// <summary> 422 /// <summary>
259 /// The code of the unsigned Int32. 423 /// The code of the unsigned Int32.
@@ -271,7 +435,7 @@ public static class Argument
271 /// The type of a Int64. 435 /// The type of a Int64.
272 /// <para>Since EFL 1.23.</para> 436 /// <para>Since EFL 1.23.</para>
273 /// </summary> 437 /// </summary>
274 public static class Int64Type 438 internal static class Int64Type
275 { 439 {
276 /// <summary> 440 /// <summary>
277 /// The code of the Int64. 441 /// The code of the Int64.
@@ -289,7 +453,7 @@ public static class Argument
289 /// The type of an unsigned Int64. 453 /// The type of an unsigned Int64.
290 /// <para>Since EFL 1.23.</para> 454 /// <para>Since EFL 1.23.</para>
291 /// </summary> 455 /// </summary>
292 public static class UInt64Type 456 internal static class UInt64Type
293 { 457 {
294 /// <summary> 458 /// <summary>
295 /// The code of the unsigned Int64. 459 /// The code of the unsigned Int64.
@@ -307,7 +471,7 @@ public static class Argument
307 /// The type of the double. 471 /// The type of the double.
308 /// <para>Since EFL 1.23.</para> 472 /// <para>Since EFL 1.23.</para>
309 /// </summary> 473 /// </summary>
310 public static class DoubleType 474 internal static class DoubleType
311 { 475 {
312 /// <summary> 476 /// <summary>
313 /// The code of the double. 477 /// The code of the double.
@@ -325,7 +489,7 @@ public static class Argument
325 /// The type of a string. 489 /// The type of a string.
326 /// <para>Since EFL 1.23.</para> 490 /// <para>Since EFL 1.23.</para>
327 /// </summary> 491 /// </summary>
328 public static class StringType 492 internal static class StringType
329 { 493 {
330 /// <summary> 494 /// <summary>
331 /// The code of the string. 495 /// The code of the string.
@@ -343,7 +507,7 @@ public static class Argument
343 /// The type of an object path. 507 /// The type of an object path.
344 /// <para>Since EFL 1.23.</para> 508 /// <para>Since EFL 1.23.</para>
345 /// </summary> 509 /// </summary>
346 public static class ObjectPathType 510 internal static class ObjectPathType
347 { 511 {
348 /// <summary> 512 /// <summary>
349 /// The code of the object path. 513 /// The code of the object path.
@@ -361,7 +525,7 @@ public static class Argument
361 /// The type of a signature. 525 /// The type of a signature.
362 /// <para>Since EFL 1.23.</para> 526 /// <para>Since EFL 1.23.</para>
363 /// </summary> 527 /// </summary>
364 public static class SignatureType 528 internal static class SignatureType
365 { 529 {
366 /// <summary> 530 /// <summary>
367 /// The code of the signature. 531 /// The code of the signature.
@@ -379,7 +543,7 @@ public static class Argument
379 /// The type of a array. 543 /// The type of a array.
380 /// <para>Since EFL 1.23.</para> 544 /// <para>Since EFL 1.23.</para>
381 /// </summary> 545 /// </summary>
382 public static class ArrayType 546 internal static class ArrayType
383 { 547 {
384 /// <summary> 548 /// <summary>
385 /// The code of the array. 549 /// The code of the array.
@@ -397,7 +561,7 @@ public static class Argument
397 /// The type of a struct. 561 /// The type of a struct.
398 /// <para>Since EFL 1.23.</para> 562 /// <para>Since EFL 1.23.</para>
399 /// </summary> 563 /// </summary>
400 public static class StructType 564 internal static class StructType
401 { 565 {
402 /// <summary> 566 /// <summary>
403 /// The code of the struct. 567 /// The code of the struct.
@@ -415,7 +579,7 @@ public static class Argument
415 /// The type of a variant. 579 /// The type of a variant.
416 /// <para>Since EFL 1.23.</para> 580 /// <para>Since EFL 1.23.</para>
417 /// </summary> 581 /// </summary>
418 public static class VariantType 582 internal static class VariantType
419 { 583 {
420 /// <summary> 584 /// <summary>
421 /// The code of the variant. 585 /// The code of the variant.
@@ -433,7 +597,7 @@ public static class Argument
433 /// The type of a dictionary. 597 /// The type of a dictionary.
434 /// <para>Since EFL 1.23.</para> 598 /// <para>Since EFL 1.23.</para>
435 /// </summary> 599 /// </summary>
436 public static class DictEntryType 600 internal static class DictEntryType
437 { 601 {
438 /// <summary> 602 /// <summary>
439 /// The code of the dictionary. 603 /// The code of the dictionary.
@@ -451,7 +615,7 @@ public static class Argument
451 /// The type of an unix file descriptor. 615 /// The type of an unix file descriptor.
452 /// <para>Since EFL 1.23.</para> 616 /// <para>Since EFL 1.23.</para>
453 /// </summary> 617 /// </summary>
454 public static class UnixFdType 618 internal static class UnixFdType
455 { 619 {
456 /// <summary> 620 /// <summary>
457 /// The code of unix fd. 621 /// The code of unix fd.
@@ -558,9 +722,15 @@ public abstract class BasicMessageArgument
558 /// </summary> 722 /// </summary>
559 /// <param name="arg">The byte to be converted.</param> 723 /// <param name="arg">The byte to be converted.</param>
560 public static implicit operator BasicMessageArgument(byte arg) 724 public static implicit operator BasicMessageArgument(byte arg)
561 { 725 => FromByte(arg);
562 return new ByteMessageArgument(arg); 726
563 } 727 /// <summary>
728 /// Converts a <see cref="byte" /> to a <see cref="BasicMessageArgument" />.
729 /// <para>Since EFL 1.23.</para>
730 /// </summary>
731 /// <param name="arg">The <see cref="byte" /> to be converted.</param>
732 public static BasicMessageArgument FromByte(byte arg)
733 => new ByteMessageArgument(arg);
564 734
565 /// <summary> 735 /// <summary>
566 /// Conversion operator of BasicMessageArgument from bool. 736 /// Conversion operator of BasicMessageArgument from bool.
@@ -568,9 +738,15 @@ public abstract class BasicMessageArgument
568 /// </summary> 738 /// </summary>
569 /// <param name="arg">The bool to be converted.</param> 739 /// <param name="arg">The bool to be converted.</param>
570 public static implicit operator BasicMessageArgument(bool arg) 740 public static implicit operator BasicMessageArgument(bool arg)
571 { 741 => FromBoolean(arg);
572 return new BoolMessageArgument(arg); 742
573 } 743 /// <summary>
744 /// Converts a <see cref="bool" /> to a <see cref="BasicMessageArgument" />.
745 /// <para>Since EFL 1.23.</para>
746 /// </summary>
747 /// <param name="arg">The <see cref="bool" /> to be converted.</param>
748 public static BasicMessageArgument FromBoolean(bool arg)
749 => new BoolMessageArgument(arg);
574 750
575 /// <summary> 751 /// <summary>
576 /// Conversion operator of BasicMessageArgument from Int16. 752 /// Conversion operator of BasicMessageArgument from Int16.
@@ -578,9 +754,15 @@ public abstract class BasicMessageArgument
578 /// </summary> 754 /// </summary>
579 /// <param name="arg">The int16 to be converted.</param> 755 /// <param name="arg">The int16 to be converted.</param>
580 public static implicit operator BasicMessageArgument(Int16 arg) 756 public static implicit operator BasicMessageArgument(Int16 arg)
581 { 757 => FromInt16(arg);
582 return new Int16MessageArgument(arg); 758
583 } 759 /// <summary>
760 /// Converts a <see cref="Int16" /> to a <see cref="BasicMessageArgument" />.
761 /// <para>Since EFL 1.23.</para>
762 /// </summary>
763 /// <param name="arg">The <see cref="Int16" /> to be converted.</param>
764 public static BasicMessageArgument FromInt16(Int16 arg)
765 => new Int16MessageArgument(arg);
584 766
585 /// <summary> 767 /// <summary>
586 /// Conversion operator of BasicMessageArgument from unsigned int16. 768 /// Conversion operator of BasicMessageArgument from unsigned int16.
@@ -588,9 +770,15 @@ public abstract class BasicMessageArgument
588 /// </summary> 770 /// </summary>
589 /// <param name="arg">The unsigned int16 to be converted.</param> 771 /// <param name="arg">The unsigned int16 to be converted.</param>
590 public static implicit operator BasicMessageArgument(UInt16 arg) 772 public static implicit operator BasicMessageArgument(UInt16 arg)
591 { 773 => FromUInt16(arg);
592 return new UInt16MessageArgument(arg); 774
593 } 775 /// <summary>
776 /// Converts a <see cref="UInt16" /> to a <see cref="BasicMessageArgument" />.
777 /// <para>Since EFL 1.23.</para>
778 /// </summary>
779 /// <param name="arg">The <see cref="UInt16" /> to be converted.</param>
780 public static BasicMessageArgument FromUInt16(UInt16 arg)
781 => new UInt16MessageArgument(arg);
594 782
595 /// <summary> 783 /// <summary>
596 /// Conversion operator of BasicMessageArgument from int32. 784 /// Conversion operator of BasicMessageArgument from int32.
@@ -598,9 +786,15 @@ public abstract class BasicMessageArgument
598 /// </summary> 786 /// </summary>
599 /// <param name="arg">The int32 to be converted.</param> 787 /// <param name="arg">The int32 to be converted.</param>
600 public static implicit operator BasicMessageArgument(Int32 arg) 788 public static implicit operator BasicMessageArgument(Int32 arg)
601 { 789 => FromInt32(arg);
602 return new Int32MessageArgument(arg); 790
603 } 791 /// <summary>
792 /// Converts a <see cref="Int32" /> to a <see cref="BasicMessageArgument" />.
793 /// <para>Since EFL 1.23.</para>
794 /// </summary>
795 /// <param name="arg">The <see cref="Int32" /> to be converted.</param>
796 public static BasicMessageArgument FromInt32(Int32 arg)
797 => new Int32MessageArgument(arg);
604 798
605 /// <summary> 799 /// <summary>
606 /// Conversion operator of BasicMessageArgument from unsigned int32. 800 /// Conversion operator of BasicMessageArgument from unsigned int32.
@@ -608,9 +802,15 @@ public abstract class BasicMessageArgument
608 /// </summary> 802 /// </summary>
609 /// <param name="arg">The unsigned int32 to be converted.</param> 803 /// <param name="arg">The unsigned int32 to be converted.</param>
610 public static implicit operator BasicMessageArgument(UInt32 arg) 804 public static implicit operator BasicMessageArgument(UInt32 arg)
611 { 805 => FromUInt32(arg);
612 return new UInt32MessageArgument(arg); 806
613 } 807 /// <summary>
808 /// Converts a <see cref="UInt32" /> to a <see cref="BasicMessageArgument" />.
809 /// <para>Since EFL 1.23.</para>
810 /// </summary>
811 /// <param name="arg">The <see cref="UInt32" /> to be converted.</param>
812 public static BasicMessageArgument FromUInt32(UInt32 arg)
813 => new UInt32MessageArgument(arg);
614 814
615 /// <summary> 815 /// <summary>
616 /// Conversion operator of BasicMessageArgument from int64. 816 /// Conversion operator of BasicMessageArgument from int64.
@@ -618,9 +818,15 @@ public abstract class BasicMessageArgument
618 /// </summary> 818 /// </summary>
619 /// <param name="arg">The int64 to be converted.</param> 819 /// <param name="arg">The int64 to be converted.</param>
620 public static implicit operator BasicMessageArgument(Int64 arg) 820 public static implicit operator BasicMessageArgument(Int64 arg)
621 { 821 => FromInt64(arg);
622 return new Int64MessageArgument(arg); 822
623 } 823 /// <summary>
824 /// Converts a <see cref="Int64" /> to a <see cref="BasicMessageArgument" />.
825 /// <para>Since EFL 1.23.</para>
826 /// </summary>
827 /// <param name="arg">The <see cref="Int64" /> to be converted.</param>
828 public static BasicMessageArgument FromInt64(Int64 arg)
829 => new Int64MessageArgument(arg);
624 830
625 /// <summary> 831 /// <summary>
626 /// Conversion operator of BasicMessageArgument from unsigned int64. 832 /// Conversion operator of BasicMessageArgument from unsigned int64.
@@ -628,9 +834,15 @@ public abstract class BasicMessageArgument
628 /// </summary> 834 /// </summary>
629 /// <param name="arg">The unsigned int64 to be converted.</param> 835 /// <param name="arg">The unsigned int64 to be converted.</param>
630 public static implicit operator BasicMessageArgument(UInt64 arg) 836 public static implicit operator BasicMessageArgument(UInt64 arg)
631 { 837 => FromUInt64(arg);
632 return new UInt64MessageArgument(arg); 838
633 } 839 /// <summary>
840 /// Converts a <see cref="UInt64" /> to a <see cref="BasicMessageArgument" />.
841 /// <para>Since EFL 1.23.</para>
842 /// </summary>
843 /// <param name="arg">The <see cref="UInt64" /> to be converted.</param>
844 public static BasicMessageArgument FromUInt64(UInt64 arg)
845 => new UInt64MessageArgument(arg);
634 846
635 /// <summary> 847 /// <summary>
636 /// Conversion operator of BasicMessageArgument from string. 848 /// Conversion operator of BasicMessageArgument from string.
@@ -638,9 +850,15 @@ public abstract class BasicMessageArgument
638 /// </summary> 850 /// </summary>
639 /// <param name="arg">the string to be converted.</param> 851 /// <param name="arg">the string to be converted.</param>
640 public static implicit operator BasicMessageArgument(string arg) 852 public static implicit operator BasicMessageArgument(string arg)
641 { 853 => FromString(arg);
642 return new StringMessageArgument(arg); 854
643 } 855 /// <summary>
856 /// Converts a <see cref="string" /> to a <see cref="BasicMessageArgument" />.
857 /// <para>Since EFL 1.23.</para>
858 /// </summary>
859 /// <param name="arg">The <see cref="string" /> to be converted.</param>
860 public static BasicMessageArgument FromString(string arg)
861 => new StringMessageArgument(arg);
644 862
645 /// <summary> 863 /// <summary>
646 /// Conversion operator of BasicMessageArgument from signature. 864 /// Conversion operator of BasicMessageArgument from signature.
@@ -648,9 +866,15 @@ public abstract class BasicMessageArgument
648 /// </summary> 866 /// </summary>
649 /// <param name="arg">The signature to be converted.</param> 867 /// <param name="arg">The signature to be converted.</param>
650 public static implicit operator BasicMessageArgument(SignatureString arg) 868 public static implicit operator BasicMessageArgument(SignatureString arg)
651 { 869 => FromSignatureString(arg);
652 return new SignatureMessageArgument(arg); 870
653 } 871 /// <summary>
872 /// Converts a <see cref="SignatureString" /> to a <see cref="BasicMessageArgument" />.
873 /// <para>Since EFL 1.23.</para>
874 /// </summary>
875 /// <param name="arg">The <see cref="SignatureString" /> to be converted.</param>
876 public static BasicMessageArgument FromSignatureString(SignatureString arg)
877 => new SignatureMessageArgument(arg);
654 878
655 /// <summary> 879 /// <summary>
656 /// Conversion operator of BasicMessageArgument from object path. 880 /// Conversion operator of BasicMessageArgument from object path.
@@ -658,9 +882,15 @@ public abstract class BasicMessageArgument
658 /// </summary> 882 /// </summary>
659 /// <param name="arg">The object path to be converted.</param> 883 /// <param name="arg">The object path to be converted.</param>
660 public static implicit operator BasicMessageArgument(ObjectPath arg) 884 public static implicit operator BasicMessageArgument(ObjectPath arg)
661 { 885 => FromObjectPath(arg);
662 return new ObjectPathMessageArgument(arg); 886
663 } 887 /// <summary>
888 /// Converts a <see cref="ObjectPath" /> to a <see cref="BasicMessageArgument" />.
889 /// <para>Since EFL 1.23.</para>
890 /// </summary>
891 /// <param name="arg">The <see cref="ObjectPath" /> to be converted.</param>
892 public static BasicMessageArgument FromObjectPath(ObjectPath arg)
893 => new ObjectPathMessageArgument(arg);
664 894
665 /// <summary> 895 /// <summary>
666 /// Conversion operator of BasicMessageArgument from unix fd. 896 /// Conversion operator of BasicMessageArgument from unix fd.
@@ -668,9 +898,15 @@ public abstract class BasicMessageArgument
668 /// </summary> 898 /// </summary>
669 /// <param name="arg">The unix fd to be converted.</param> 899 /// <param name="arg">The unix fd to be converted.</param>
670 public static implicit operator BasicMessageArgument(UnixFd arg) 900 public static implicit operator BasicMessageArgument(UnixFd arg)
671 { 901 => FromUnixFd(arg);
672 return new UnixFdMessageArgument(arg); 902
673 } 903 /// <summary>
904 /// Converts a <see cref="UnixFd" /> to a <see cref="BasicMessageArgument" />.
905 /// <para>Since EFL 1.23.</para>
906 /// </summary>
907 /// <param name="arg">The <see cref="UnixFd" /> to be converted.</param>
908 public static BasicMessageArgument FromUnixFd(UnixFd arg)
909 => new UnixFdMessageArgument(arg);
674} 910}
675 911
676/// <summary> 912/// <summary>
@@ -1308,6 +1544,7 @@ public delegate void MessageDelegate(eldbus.Message msg, eldbus.Pending pending)
1308/// Commons for eldbus. 1544/// Commons for eldbus.
1309/// <para>Since EFL 1.23.</para> 1545/// <para>Since EFL 1.23.</para>
1310/// </summary> 1546/// </summary>
1547[SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
1311public static class Common 1548public static class Common
1312{ 1549{
1313 /// <summary> 1550 /// <summary>
@@ -1372,8 +1609,8 @@ public static class Common
1372 return; 1609 return;
1373 } 1610 }
1374 1611
1375 eldbus.Message msg; 1612 eldbus.Message msg = null;
1376 eldbus.Pending pending; 1613 eldbus.Pending pending = null;
1377 1614
1378 try 1615 try
1379 { 1616 {
@@ -1383,6 +1620,11 @@ public static class Common
1383 catch (Exception e) 1620 catch (Exception e)
1384 { 1621 {
1385 Eina.Log.Error("Eldbus: could not convert Eldbus_Message_Cb parameters. Exception: " + e.ToString()); 1622 Eina.Log.Error("Eldbus: could not convert Eldbus_Message_Cb parameters. Exception: " + e.ToString());
1623
1624 if (msg != null)
1625 {
1626 msg.Dispose(); // CA2000
1627 }
1386 return; 1628 return;
1387 } 1629 }
1388 1630
@@ -1394,6 +1636,10 @@ public static class Common
1394 { 1636 {
1395 Eina.Log.Error("Eldbus: Eldbus_Message_Cb delegate error. Exception: " + e.ToString()); 1637 Eina.Log.Error("Eldbus: Eldbus_Message_Cb delegate error. Exception: " + e.ToString());
1396 } 1638 }
1639 finally
1640 {
1641 msg.Dispose(); // CA2000
1642 }
1397 } 1643 }
1398 1644
1399 private static Eldbus_Message_Cb message_cb_wrapper = null; 1645 private static Eldbus_Message_Cb message_cb_wrapper = null;