Skip to content

Commit

Permalink
fix: x64 item address corruption issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfganggriech committed Oct 11, 2021
1 parent ac8335f commit 1cb133b
Show file tree
Hide file tree
Showing 26 changed files with 2,734 additions and 1,676 deletions.
231 changes: 113 additions & 118 deletions LocalSyncWrapper/LocalSyncOPCCLient.cpp

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions LocalSyncWrapper/LocalSyncOPCCLient.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#pragma once
#ifndef OPC_LOCAL_CLIENT_H
#define OPC_LOCAL_CLIENT_H

#include <cstdint>
#include <map>
#include <string>
#include <vector>

/// the following includes are being used for WS2S, S2WS, WS2T and WS2LPCTSTR
#include <codecvt>
#include <locale>

#include "../OPCClientToolKit/OPCClient.h"
#include "../OPCClientToolKit/OPCGroup.h"
#include "../OPCClientToolKit/OPCHost.h"
Expand Down Expand Up @@ -36,22 +38,22 @@ class LocalSyncOPCCLient
// OPC API
bool IsOPCRuning();

virtual bool IsOPCConnectedPLC(); // this function relis on the specific device
virtual bool ItemNameFilter(std::string item_name); // if a item's name cannot pass the
// name fitler, it will not be added.
virtual bool IsOPCConnectedPLC(); // this function relis on the specific device
virtual bool ItemNameFilter(
std::string item_name); // if a item's name cannot pass the name fitler, it will not be added.

// Basic Read Write API
inline bool SyncWriteItem(std::string item_name, VARIANT *var);

inline bool SyncReadItem(std::string item_name, VARIANT *var);

inline bool SyncWriteItem(std::string item_name, VARIANT *var);

bool ReadBool(std::string item_name);

bool WriteBool(std::string item_name, bool item_value);

float ReadFloat(std::string item_name);

bool WirteFloat(std::string item_name, float item_value);
bool WriteFloat(std::string item_name, float item_value);

uint16_t ReadUint16(std::string item_name);

Expand All @@ -62,7 +64,7 @@ class LocalSyncOPCCLient
bool WriteUint16Array(std::string item_name, uint16_t *item_value_array, int array_size);

protected:
std::map<std::string, COPCItem *> name_item_map_;
std::map<std::wstring, COPCItem *> name_item_map_;
COPCGroup *p_group_;
unsigned long refresh_rate_;
COPCHost *p_host_;
Expand All @@ -71,9 +73,8 @@ class LocalSyncOPCCLient

bool CleanOPCMember();

bool DetectService(char *ServiceName);
bool DetectService(std::string ServiceName);

VARIANT read_tmp_variant_;
};

#endif // OPCONTROLLER_H
}; // LocalSyncOPCCLient
Loading

0 comments on commit 1cb133b

Please sign in to comment.