Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "common.h"
00012
00013 #include <opc/ua/protocol/extension_identifiers.h>
00014 #include <opc/ua/protocol/message_identifiers.h>
00015 #include <opc/ua/protocol/monitored_items.h>
00016 #include <opc/ua/protocol/binary/stream.h>
00017 #include <opc/ua/protocol/types.h>
00018
00019 #include <algorithm>
00020 #include <stdexcept>
00021 class MonitoredItemsSerialization : public OpcUaBinarySerialization
00022 {
00023 };
00024
00025 class MonitoredItemsDeserialization : public OpcUaBinaryDeserialization
00026 {
00027 };
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 TEST_F(MonitoredItemsSerialization, DISABLED_CreateMonitoredItemsResponse)
00073 {
00074 using namespace OpcUa;
00075 using namespace OpcUa::Binary;
00076
00077 CreateMonitoredItemsResponse response;
00078
00079 MonitoredItemCreateResult monitoringResult;
00080 monitoringResult.Status = StatusCode::BadNotImplemented;
00081 monitoringResult.MonitoredItemId = 1;
00082 monitoringResult.RevisedSamplingInterval = 1200000;
00083 monitoringResult.RevisedQueueSize = 3;
00084
00085
00086 response.Results.push_back(monitoringResult);
00087
00088
00089 ASSERT_EQ(response.TypeId.Encoding, EV_FOUR_BYTE);
00090 ASSERT_EQ(response.TypeId.FourByteData.NamespaceIndex, 0);
00091 ASSERT_EQ(response.TypeId.FourByteData.Identifier, OpcUa::CREATE_MONITORED_ITEMS_RESPONSE);
00092
00093 FILL_TEST_RESPONSE_HEADER(response.Header);
00094
00095 GetStream() << response << flush;
00096
00097 const std::vector<char> expectedData = {
00098 1, 0, (char)0xF2, 0x2,
00099
00100 TEST_RESPONSE_HEADER_BINARY_DATA,
00101
00102 1,0,0,0,
00103 0,0,(char)0x40,(char)0x80,
00104 1,0,0,0,
00105 0,0,0,0,(char)0x80,(char)0x4f,(char)0x32,(char)0x41,
00106 3,0,0,0,
00107 0,0,0,
00108
00109 0,0,0,0
00110 };
00111
00112 ASSERT_EQ(expectedData, GetChannel().SerializedData) <<
00113 "Expected: " << std::endl << PrintData(expectedData) << std::endl <<
00114 "Serialized: " << std::endl << PrintData(GetChannel().SerializedData) << std::endl;
00115 ASSERT_EQ(expectedData.size(), RawSize(response));
00116 }
00117