simpleTest.c 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * main.c
  3. *
  4. * Created on: 07.03.2014
  5. * Author: mrt
  6. */
  7. #include <stdio.h>
  8. #include "opcua.h"
  9. void testString() {
  10. UA_Int32 pos = 0;
  11. UA_Int32 retval = UA_SUCCESS;
  12. UA_String string;
  13. UA_Byte binString[12] = {0x08,0x00,0x00,0x00,'A','C','P','L','T',' ','U','A'};
  14. UA_ByteString src = { 12, binString };
  15. retval = UA_String_decodeBinary(&src, &pos, &string);
  16. UA_String_deleteMembers(&string);
  17. }
  18. void testVariant() {
  19. // given
  20. UA_Int32 pos = 0;
  21. UA_Byte data[] = { UA_INT32_NS0 | UA_VARIANT_ENCODINGMASKTYPE_ARRAY, 0x02, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF};
  22. UA_ByteString src = { sizeof(data), data };
  23. UA_Variant dst;
  24. // when
  25. UA_Int32 retval = UA_Variant_decodeBinary(&src, &pos, &dst);
  26. UA_Variant_deleteMembers(&dst);
  27. }
  28. void testByte() {
  29. // given
  30. UA_Byte dst;
  31. UA_Byte data[] = { 0x08 };
  32. UA_ByteString src = { 1, data };
  33. UA_Int32 pos = 0;
  34. // when
  35. UA_Int32 retval = UA_Byte_decodeBinary(&src, &pos, &dst);
  36. }
  37. int main() {
  38. testByte();
  39. return 0;
  40. }