Ask our Experts
Didn't find what you are looking for? Ask our experts!
Launch of Consumer/Home Owner registration process! We are pleased to announce the commencement of the Consumer/Home Owner Registration Process on Community. Consumers/Home Owners may now proceed to register by clicking on Login/Register. The process is straightforward and designed to be completed in just a few steps.
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Search in
Link copied. Please paste this link to share this article on your social media post.
Hi All,
I have the latest 2.3CTP release of SmartConnector which includes the CSP integration.
When I initialize the CSP from the MongooseObjectFactory, my container (var client) is always null... is there anything that I am missing here? I have checked over the docs, but can't seem to find any code examples.
var client = MongooseObjectFactory.Current.GetInstance<IManagedCspClient>();
var server = new CspEndpoint
{
Address = endpoint.Endpoint,
Password = endpoint.Password,
UserName = endpoint.Username
};
var response = client.RetrieveAlarmEvents(server, new CspQuery()
{
IncludeHidden = true,
IncludeSystemFolderWhenSearching = true
});
return response;
Thanks in advance!
Mark
Link copied. Please paste this link to share this article on your social media post.
Mark,
Yeah, the docs don't include anything on the CspClient at this point.
What you have should work. Remember, when running in a Unit Test environment you need to call InitIoC on your back reference to the service EXE. You can use the new class in Mongoose.Test to help. See below.
...
using SmartConnectorService = Mongoose.Service.Mongoose;
namespace MyProcessorExtention.Test
{
public class MyTestFixtureFixture : SmartConnectorTestFixtureBase
{
#region FixtureOneTimeSetup_Base - Override
protected override void FixtureOneTimeSetup_Base()
{
SmartConnectorService.InitIoC();
}
#endregion
#region MyTest
[Test]
public void MyTest()
{
var client = MongooseObjectFactory.Current.GetInstance<IManagedCspClient>();
Assert.IsNotNull(client);
var server = new CspEndpoint
{
Address = endpoint.Endpoint,
Password = endpoint.Password,
UserName = endpoint.Username
};
var verison = NativeClient.ServerVersion(server);
Assert.IsNotNull(version);
var response = client.RetrieveAlarmEvents(server, new CspQuery()
{
IncludeHidden = true,
IncludeSystemFolderWhenSearching = true
});
Assert.IsNotNull(response);
}
#endregion
}
}
You’ve reached the end of your document
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.