2323using Orts . Simulation . RollingStocks ;
2424using ORTS . Common ;
2525using ORTS . Common . Input ;
26- using PIEHidDotNet ;
26+
27+ using RailDriver ;
2728
2829namespace Orts . Viewer3D
2930{
3031 /// <summary>
3132 /// Class to get data from RailDriver and translate it into something useful for UserInput
3233 /// </summary>
33- public class UserInputRailDriver : PIEDataHandler , PIEErrorHandler
34+ public class UserInputRailDriver : IDataHandler , IErrorHandler
3435 {
3536 PIEDevice Device ; // Our RailDriver
3637 byte [ ] WriteBuffer ; // Buffer for sending data to RailDriver
@@ -69,15 +70,15 @@ public UserInputRailDriver(string basePath)
6970 {
7071 try
7172 {
72- PIEDevice [ ] devices = PIEHidDotNet . PIEDevice . EnumeratePIE ( ) ;
73+ PIEDevice [ ] devices = PIEDevice . EnumeratePIE ( ) ;
7374 for ( int i = 0 ; i < devices . Length ; i ++ )
7475 {
7576 if ( devices [ i ] . HidUsagePage == 0xc && devices [ i ] . Pid == 210 )
7677 {
7778 Device = devices [ i ] ;
7879 Device . SetupInterface ( ) ;
7980 Device . SetErrorCallback ( this ) ;
80- Device . SetDataCallback ( this , DataCallbackFilterType . callOnChangedData ) ;
81+ Device . SetDataCallback ( this ) ;
8182 WriteBuffer = new byte [ Device . WriteLength ] ;
8283 State = new RailDriverState ( ) ;
8384 SetLEDs ( 0x40 , 0x40 , 0x40 ) ;
@@ -98,7 +99,7 @@ public UserInputRailDriver(string basePath)
9899 /// </summary>
99100 /// <param name="data"></param>
100101 /// <param name="sourceDevice"></param>
101- public void HandlePIEHidData ( Byte [ ] data , PIEDevice sourceDevice )
102+ public void HandleHidData ( byte [ ] data , PIEDevice sourceDevice , int error )
102103 {
103104 if ( sourceDevice != Device )
104105 return ;
@@ -157,7 +158,7 @@ public void HandlePIEHidData(Byte[] data, PIEDevice sourceDevice)
157158 /// </summary>
158159 /// <param name="error"></param>
159160 /// <param name="sourceDevice"></param>
160- public void HandlePIEHidError ( Int32 error , PIEDevice sourceDevice )
161+ public void HandleHidError ( PIEDevice sourceDevice , int error )
161162 {
162163 Trace . TraceWarning ( "RailDriver Error: {0}" , error ) ;
163164 }
0 commit comments