Exemple #1
0
 /// <summary>
 /// Performs a fast initialization sequence
 /// </summary>
 /// <param name="TxMessage"></param>
 /// <returns></returns>
 public Message FastInit(Message TxMessage)
 {
     using (HeapMessage hInput = new HeapMessage(ProtocolID, TxMessage.TxFlags, TxMessage.Data))
         using (HeapMessage hOutput = new HeapMessage(ProtocolID))
         {
             lock (sync)
             {
                 API.CheckResult(API.PTIoctl(channelId, (int)IOCTL.FAST_INIT, (IntPtr)hInput, (IntPtr)hOutput));
             }
             return(hOutput.ToMessage());
         }
 }
Exemple #2
0
 /// <summary>
 /// Starts automated periodic transmission of a message
 /// </summary>
 /// <param name="PeriodicMessage">Periodic message object</param>
 /// <returns>Message index</returns>
 public int StartPeriodicMessage(PeriodicMessage PeriodicMessage)
 {
     using (HeapInt hMessageID = new HeapInt())
         using (HeapMessage hPeriodicMessage = new HeapMessage(ProtocolID, PeriodicMessage))
         {
             lock (sync)
             {
                 API.CheckResult(API.PTStartPeriodicMsg(channelId,
                                                        (IntPtr)hPeriodicMessage,
                                                        (IntPtr)hMessageID,
                                                        PeriodicMessage.Interval));
                 PeriodicMessage.MessageID = hMessageID.Value;
                 periodicMsgList.Add(PeriodicMessage);
             }
             return(periodicMsgList.IndexOf(PeriodicMessage));
         }
 }
Exemple #3
0
 /// <summary>
 /// Starts a message filter
 /// </summary>
 /// <param name="Filter">Message filter object</param>
 /// <returns>Filter index</returns>
 public int StartMsgFilter(MessageFilter Filter)
 {
     using (HeapInt hFilterID = new HeapInt())
         using (HeapMessage hMask = new HeapMessage(ProtocolID, Filter.TxFlags, Filter.Mask))
             using (HeapMessage hPattern = new HeapMessage(ProtocolID, Filter.TxFlags, Filter.Pattern))
                 using (HeapMessage hFlowControl = new HeapMessage(ProtocolID, Filter.TxFlags, Filter.FlowControl))
                 {
                     lock (sync)
                     {
                         API.CheckResult(API.PTStartMsgFilter(channelId,
                                                              (int)Filter.FilterType,
                                                              (IntPtr)hMask,
                                                              (IntPtr)hPattern,
                                                              Filter.FilterType == J2534.Filter.FLOW_CONTROL_FILTER ? (IntPtr)hFlowControl : IntPtr.Zero,
                                                              (IntPtr)hFilterID));
                         Filter.FilterId = hFilterID.Value;
                         filterList.Add(Filter);
                     }
                     return(filterList.IndexOf(Filter));
                 }
 }