This commit is contained in:
parent
313b1df8fa
commit
21023ce2fa
9 changed files with 83 additions and 11 deletions
|
|
@ -298,7 +298,13 @@ namespace DMX2
|
||||||
return "Boitier V1";
|
return "Boitier V1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
IFeedbackInfo IEventProvider.GetFeedbackInfo (string eventId)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region implemented abstract members of DMX2.DriverDMX
|
#region implemented abstract members of DMX2.DriverDMX
|
||||||
public override void Save (System.Xml.XmlElement parent)
|
public override void Save (System.Xml.XmlElement parent)
|
||||||
|
|
|
||||||
|
|
@ -533,6 +533,12 @@ namespace DMX2
|
||||||
return "Boitier V2";
|
return "Boitier V2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IFeedbackInfo IEventProvider.GetFeedbackInfo (string eventId)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region implemented abstract members of DMX2.DriverDMX
|
#region implemented abstract members of DMX2.DriverDMX
|
||||||
|
|
|
||||||
|
|
@ -590,6 +590,12 @@ namespace DMX2
|
||||||
return "Boitier V3";
|
return "Boitier V3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IFeedbackInfo IEventProvider.GetFeedbackInfo (string eventId)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region implemented abstract members of DMX2.DriverDMX
|
#region implemented abstract members of DMX2.DriverDMX
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace DMX2
|
||||||
/// <param name='callback'>Fonction a appeler pour chaque evenement.</param>
|
/// <param name='callback'>Fonction a appeler pour chaque evenement.</param>
|
||||||
void ProcessEvents(EventManagerCallback callback);
|
void ProcessEvents(EventManagerCallback callback);
|
||||||
|
|
||||||
|
IFeedbackInfo GetFeedbackInfo(string eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -84,6 +84,13 @@ namespace DMX2
|
||||||
/// <param name='id'>l'id de l'evenement</param>
|
/// <param name='id'>l'id de l'evenement</param>
|
||||||
void Unbind(string id);
|
void Unbind(string id);
|
||||||
|
|
||||||
|
bool CanFeedback{ get; }
|
||||||
|
void AddFeedback(IFeedbackInfo info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IFeedbackInfo {
|
||||||
|
bool FeedBack(byte data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -115,16 +122,19 @@ namespace DMX2
|
||||||
|
|
||||||
void IEventTarget.Bind (string id){} // Rien a faire ici
|
void IEventTarget.Bind (string id){} // Rien a faire ici
|
||||||
void IEventTarget.Unbind (string id){}
|
void IEventTarget.Unbind (string id){}
|
||||||
|
bool IEventTarget.CanFeedback { get { return false; } }
|
||||||
|
void IEventTarget.AddFeedback (IFeedbackInfo info)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException ();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class EventManager
|
public class EventManager
|
||||||
{
|
{
|
||||||
Dictionary<string,eventBinding> bindings = new Dictionary<string,eventBinding>();
|
Dictionary<string,eventBinding> bindings = new Dictionary<string,eventBinding>();
|
||||||
List<IEventProvider> providers = new List<IEventProvider>();
|
List<IEventProvider> providers = new List<IEventProvider>();
|
||||||
Dictionary<string,IEventProvider> feedbackLookup = new Dictionary<string, IEventProvider>();
|
|
||||||
|
|
||||||
class eventBinding
|
class eventBinding
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +165,11 @@ namespace DMX2
|
||||||
providers.Add (prov);
|
providers.Add (prov);
|
||||||
foreach (var bind in bindings) {
|
foreach (var bind in bindings) {
|
||||||
if (prov.Bind (bind.Key)) {
|
if (prov.Bind (bind.Key)) {
|
||||||
feedbackLookup[bind.Key] = prov;
|
IFeedbackInfo info = prov.GetFeedbackInfo(bind.Key);
|
||||||
|
if(info!=null)
|
||||||
|
foreach(IEventTarget target in bind.Value.Targets)
|
||||||
|
if(target.CanFeedback)
|
||||||
|
target.AddFeedback(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,9 +233,6 @@ namespace DMX2
|
||||||
public void UnregisterProvider (IEventProvider prov)
|
public void UnregisterProvider (IEventProvider prov)
|
||||||
{
|
{
|
||||||
providers.Remove(prov);
|
providers.Remove(prov);
|
||||||
var q = from feedback in feedbackLookup where feedback.Value == prov select feedback.Key;
|
|
||||||
foreach(string id in q.ToArray())
|
|
||||||
feedbackLookup.Remove(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary> Enregistrement d'une association id => cible
|
///<summary> Enregistrement d'une association id => cible
|
||||||
|
|
@ -233,7 +244,10 @@ namespace DMX2
|
||||||
target.Bind(eventId);
|
target.Bind(eventId);
|
||||||
foreach (IEventProvider prov in providers) {
|
foreach (IEventProvider prov in providers) {
|
||||||
if(prov.Bind(eventId)) {
|
if(prov.Bind(eventId)) {
|
||||||
feedbackLookup[eventId] = prov;
|
if(target.CanFeedback){
|
||||||
|
IFeedbackInfo info = prov.GetFeedbackInfo(eventId);
|
||||||
|
if(info!=null) target.AddFeedback(info);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,17 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class midiFeedbackInfo : IFeedbackInfo {
|
||||||
|
#region IFeedbackInfo implementation
|
||||||
|
bool IFeedbackInfo.FeedBack (byte data)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException ();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string,internalEvent> eventlist = new Dictionary<string, internalEvent>();
|
Dictionary<string,internalEvent> eventlist = new Dictionary<string, internalEvent>();
|
||||||
|
|
||||||
EventData last;
|
EventData last;
|
||||||
internalEvent levent=null;
|
internalEvent levent=null;
|
||||||
bool connected=false;
|
bool connected=false;
|
||||||
|
|
@ -201,8 +211,13 @@ namespace DMX2
|
||||||
return "Midi";
|
return "Midi";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IFeedbackInfo IEventProvider.GetFeedbackInfo (string eventId)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,20 @@ namespace DMX2
|
||||||
valeursrecues.Remove(id);
|
valeursrecues.Remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<IFeedbackInfo> feedbacks = new List<IFeedbackInfo>();
|
||||||
|
|
||||||
|
bool IEventTarget.CanFeedback { get { return false; } }
|
||||||
|
|
||||||
|
void IEventTarget.AddFeedback (IFeedbackInfo info)
|
||||||
|
{
|
||||||
|
feedbacks.Add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FeedBack(byte data){
|
||||||
|
foreach (var fb in feedbacks)
|
||||||
|
fb.FeedBack(data);
|
||||||
|
}
|
||||||
|
|
||||||
/*IEnumerable<string> IEventTarget.IDs {
|
/*IEnumerable<string> IEventTarget.IDs {
|
||||||
get {
|
get {
|
||||||
return valeursrecues.Keys;
|
return valeursrecues.Keys;
|
||||||
|
|
@ -316,6 +330,9 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
valeurschangees [c] = true;
|
valeurschangees [c] = true;
|
||||||
valeurscourantes [c] = value;
|
valeurscourantes [c] = value;
|
||||||
|
lock(this)
|
||||||
|
if(targets.ContainsKey(c))
|
||||||
|
targets[c].FeedBack((byte)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EstChange (Circuit c)
|
public bool EstChange (Circuit c)
|
||||||
|
|
@ -357,6 +374,8 @@ namespace DMX2
|
||||||
foreach (Circuit c in circuitsSeq) {
|
foreach (Circuit c in circuitsSeq) {
|
||||||
if (valeurscourantes [c] != effetcourrant [c] && !valeurschangees.ContainsKey (c)) {
|
if (valeurscourantes [c] != effetcourrant [c] && !valeurschangees.ContainsKey (c)) {
|
||||||
valeurscourantes [c] = (int)(progression * (effetcourrant [c] - valeursinitiales [c]) + valeursinitiales [c]);
|
valeurscourantes [c] = (int)(progression * (effetcourrant [c] - valeursinitiales [c]) + valeursinitiales [c]);
|
||||||
|
if(targets.ContainsKey(c))
|
||||||
|
targets[c].FeedBack((byte)valeurscourantes [c]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -380,8 +399,11 @@ namespace DMX2
|
||||||
lock(this) {
|
lock(this) {
|
||||||
enTransition = false;
|
enTransition = false;
|
||||||
foreach (Circuit c in circuitsSeq)
|
foreach (Circuit c in circuitsSeq)
|
||||||
if (!valeurschangees.ContainsKey (c))
|
if (!valeurschangees.ContainsKey (c)){
|
||||||
valeurscourantes [c] = effetcourrant [c];
|
valeurscourantes [c] = effetcourrant [c];
|
||||||
|
if(targets.ContainsKey(c))
|
||||||
|
targets[c].FeedBack((byte)valeurscourantes [c]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ namespace DMX2
|
||||||
w1.Fill = false;
|
w1.Fill = false;
|
||||||
// Container child vbox2.Gtk.Box+BoxChild
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false);
|
this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false);
|
||||||
|
this.table1.Name = "table1";
|
||||||
this.table1.RowSpacing = ((uint)(6));
|
this.table1.RowSpacing = ((uint)(6));
|
||||||
this.table1.ColumnSpacing = ((uint)(6));
|
this.table1.ColumnSpacing = ((uint)(6));
|
||||||
// Container child table1.Gtk.Table+TableChild
|
// Container child table1.Gtk.Table+TableChild
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ namespace DMX2
|
||||||
w1.Fill = false;
|
w1.Fill = false;
|
||||||
// Container child vbox2.Gtk.Box+BoxChild
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
this.table1 = new global::Gtk.Table (((uint)(4)), ((uint)(5)), false);
|
this.table1 = new global::Gtk.Table (((uint)(4)), ((uint)(5)), false);
|
||||||
|
this.table1.Name = "table1";
|
||||||
this.table1.RowSpacing = ((uint)(6));
|
this.table1.RowSpacing = ((uint)(6));
|
||||||
this.table1.ColumnSpacing = ((uint)(6));
|
this.table1.ColumnSpacing = ((uint)(6));
|
||||||
// Container child table1.Gtk.Table+TableChild
|
// Container child table1.Gtk.Table+TableChild
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ namespace DMX2
|
||||||
w1.Fill = false;
|
w1.Fill = false;
|
||||||
// Container child vbox2.Gtk.Box+BoxChild
|
// Container child vbox2.Gtk.Box+BoxChild
|
||||||
this.table1 = new global::Gtk.Table (((uint)(5)), ((uint)(4)), false);
|
this.table1 = new global::Gtk.Table (((uint)(5)), ((uint)(4)), false);
|
||||||
|
this.table1.Name = "table1";
|
||||||
this.table1.RowSpacing = ((uint)(6));
|
this.table1.RowSpacing = ((uint)(6));
|
||||||
this.table1.ColumnSpacing = ((uint)(6));
|
this.table1.ColumnSpacing = ((uint)(6));
|
||||||
// Container child table1.Gtk.Table+TableChild
|
// Container child table1.Gtk.Table+TableChild
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue