-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Hi,
First of all I would like to express my appreciation of this library. When I first read up on the documentation I was imagining having some kind of collection in Mid classes to cover the specific data for different revisions of the messages. This library really does a great job of covering that.
Now as for my issue.
I am trying to subscribe to the tightening results for a client I am developing for a MTF6000.
At first I was trying to do this by directly sending out a Mid0060, but this results in a Mid0004 containing error code UNKNOWN_MID.
Next I tried subscribing to a different event, the Alarms, again I received an UNKNOWN_MID.
After some Googling I found some documentation on interfacing with a MTF0600, this states that for this device you need to send a Mid0008 with the required subscription Mid + revision.
After finding this I was quite hopeful, however when I tried this I received a Mid0004 with error code INVALID_DATA.
From this I take that the message is probably missing some data, however I cannot find any documentation on Mid0008.
Does anybody have any experience in subscribing to events through the Mid0008 message?
Below an excerpt of my Subscribe method, which is determining which Mid to pass to Mid0008 to setup a subscription.
The mid being generated: "00290008001 006000700"
public bool Subscribe(ACEventSubscription eventSubscription)
{
bool subscribeResult = false;
Mid midResponse = null;
Mid subscriptionMid = null;
switch (eventSubscription)
{
case ACEventSubscription.TighteningResultData:
subscriptionMid = new Mid0060();
break;
case ACEventSubscription.Alarm:
subscriptionMid = new Mid0070();
break;
case ACEventSubscription.ParameterSetSelected:
subscriptionMid = new Mid0014();
break;
default:
throw new NotImplementedException($"Event subscription {eventSubscription} not supported.");
}
Trace.WriteInformation($"Subscribing to {eventSubscription}", nameof(Subscribe), CLASSNAME);
midResponse = SendAndWaitForResponse(new Mid0008(subscriptionMid.Header.Mid.ToString(), subscriptionMid.Header.Revision, null).Pack(), TimeSpan.FromSeconds(2));
if (midResponse != null)
{
if (midResponse.Header.Mid == Mid0004.MID)
{
subscribeResult = false;
var mid0004 = midResponse as Mid0004;
Trace.WriteWarning($"Failed to subscribe to {eventSubscription}", nameof(Subscribe), CLASSNAME);
HandleDefaultCommmandError(mid0004);
}
else
{
Trace.WriteInformation($"Subscribed to {eventSubscription} events", nameof(Subscribe), CLASSNAME);
subscribeResult = true;
}
}
return subscribeResult;
}Any help is greatly appreciated :)
Thanks in advance,
Lon Heijnen