Are you trying to find the time range based on historical values for this tag or in real-time? If real-time, you can use AFDataPipe. An example from the AF SDK help is below:
Another example from PI Square is here:
Let us know if you have questions about any of these.
The PI Analysis Service could monitor your Boolean values and generate event frames for you. You are right when you say that event frames were invented to monitor... events with a start time b=1 and a end time b=0.
Unless you have a really exceptional use case I don't see the need to code something there.
I believe this video may help you getting started
When your event frame gets generated, it uses an event frame template, and its up to you to include attributes/aggregates you need to be contained into this template, so when it gets instanciated it will display the values for the Element(s) that are associated with the event frame.
Please let us know if you want to do something else... I may be wrong in my interpretation of what you want to do