I'm new to the PI SDK so please forgive me if this is a trivial question or I've got things completely wrong, however...
I'm trying to get a collection of all the digital states (believe this is a state set) for a tag (given a PIValue object that is a DigitalState). Essentially I would like the StateSet object which contains the DigitalState code I have. I got as far as using the Server.StateSets.Find method, however given this takes named values is this only going to search by name? What if two digital states have the same name - how will I know that I get the correct stateset?
My code so far is this (c#):
PISDK.Server server = SDK.Servers["myservername"];
PISDK.PIPoints pointObject = server.PIPoints;
PISDK.PIPoint snapPoint = pointObject["mytagname"];
PISDK.PIValue snapShot = snapPoint.Data.Snapshot;
//here I ensure this is a DigitalState object - omitted for brevity
PISDK.DigitalState digitalState = (PISDK.DigitalState)snapShot.Value;
String valueString = myDigState.Name;
Object digitalStateObject = myDigState;
PISDKCommon.NamedValues nvs = new PISDKCommon.NamedValues();
nvs.Add(myDigState.Name, ref digitalStateObject);
nvs = _server.StateSets.Find(nvs, PISDK.ContainsConstants.cntnsAll);
//now nvs holds all my possible states... Right?
Any and all help is appreciated, thank you for your time.