Skip to content

RscServiceManager DEBUG - Unknown service requested: Arp.Plc.Gds.Services.IDataAccessService

Wrote some simple code to use the DataAccessService to read and write from the GDS. It doesn't work.

with $ cat /opt/plcnext/projects/runtime/logs/runtime.log, I find the following line:
RscServiceManager DEBUG - Unknown service requested: Arp.Plc.Gds.Services.IDataAccessService

[code type="markup"]
#include "DataAccess.hpp"

#include "Arp/System/Rsc/ServiceManager.hpp"

using namespace Arp::System::Rsc;

void DataAccess::init()
{
Log::Info("Calling DataAccess::init");

DataAccessServicePtr = ServiceManager::GetService();

if(DataAccessServicePtr != NULL){
Log::Info("DataAccess class initialised");
}
}

bool DataAccess::read()
{
Log::Info("Calling DataAccess::read");

bool bool_in = false;

ReadItem readPortData = this->DataAccessServicePtr->ReadSingle("Arp.Plc.Eclr/ModbusTCP.test_port_in");
if(readPortData.Error == DataAccessError::None){
readPortData.Value.CopyTo(bool_in);
Log::Info("read from test port: ", bool_in);
}
else{
Log::Info("Error reading from GDS.");
}
return bool_in;
}
[/code]

[code type="markup"]
#include

#include "Arp/Plc/Gds/Services/IDataAccessService.hpp"
#include "Arp/System/Commons/Logging.h"

using namespace std;
using namespace Arp;
using namespace Arp::Plc::Gds::Services;
using namespace Arp::System::Commons::Diagnostics::Logging;

#ifndef DATA_ACCESS_H_
#define DATA_ACCESS_H_

class DataAccess
{
private:
bool initialised;

IDataAccessService::Ptr DataAccessServicePtr;

bool bool_in;

public:
void init();
bool read();
};

#endif // DATA_ACCESS_H_
[/code]

What have I done wrong?
Sign In or Register to comment.