<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Object:Protocol_Protocol</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>Recent changes to Object:Protocol_Protocol</description><atom:link href="https://sourceforge.net/p/sfence/wiki/Object:Protocol_Protocol/feed" rel="self"/><language>en</language><lastBuildDate>Sat, 16 Mar 2013 22:49:54 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/sfence/wiki/Object:Protocol_Protocol/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 22:49:54 -0000</pubDate><guid>https://sourceforge.netd8b3af865b7040f8a2b5e03af5e53f863359ab48</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 22:38:35 -0000</pubDate><guid>https://sourceforge.netf3606f09e42b89e532b0ae599d053f646368ce9e</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 22:13:21 -0000</pubDate><guid>https://sourceforge.net274f78db9db48cd1122345a81b0c718bdad1676d</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -51,7 +51,7 @@

     #define EXAMPLE_fromerror_protocol (EXAMPLE_fromerror+40)

-    //basic protocol cycle
+    // example of easy thread protocol cycle
     enum eSFENCE_Bool Example_ThreadProtocolCycle(struct sProtocol_Protocol *ps_protocol,
                                                   struct sThread_Thread *ps_thread,
                                                   struct sEvent_Generator *ps_generator,
@@ -135,11 +135,19 @@
             if (b_return==eSFECNE_Bool_True)
             {
               // send message to system
-              if (Event_Generator_Write_Event(ps_generator, ps_event)!=eSFENCE_Bool_Success)
+              if (Event_Generator_Lock(ps_generator)!=eSFENCE_Bool_Success)
               {
                  Have_Error(ps_pack, EXAMPLE_fromerror_protocol+9);
                  break;
               }
+              if (Event_Generator_Write_Event(ps_generator, ps_event)!=eSFENCE_Bool_Success)
+              {
+                 Event_Generator_Unlock(ps_generator);
+
+                 Have_Error(ps_pack, EXAMPLE_fromerror_protocol+10);
+                 break;
+              }
+              Event_Generator_Unlock(ps_generator);

               // check for next message for receive immediately
               continue;
@@ -153,7 +161,7 @@
         b_return = Thread_Thread_Have_End(ps_thread);
         if (b_return==eSFENCE_Bool_Fail)
         {
-           Have_Error(ps_pack, EXAMPLE_fromerror_protocol+10);
+           Have_Error(ps_pack, EXAMPLE_fromerror_protocol+15);
            break;
         }
         if (b_return==eSFENCE_Bool_True)
@@ -180,12 +188,17 @@
           b_return = Time_Delay(u0_delay-u0_diff, ps_pack);
           if (b_return==eSFENCE_Bool_Fail)
           {
-            Have_Error(ps_pack, EXAMPLE_fromerror_protocol+11);
+            Have_Error(ps_pack, EXAMPLE_fromerror_protocol+16);
             break;
           }
         }

-        // repeat cycle
+        // clear event and repeat cycle
+        if (Event_Event_Clear(ps_event)!=eSFENCE_Bool_Success)
+        {
+          Have_Error(ps_pack, EXAMPLE_fromerror_protocol+17);
+          break;
+        }
       }
       Event_Event_Destruct(ps_event, eSFENCE_Bool_False); 
       Time_Difference_Destruct(ps_diff, eSFENCE_Bool_False); 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 21:46:40 -0000</pubDate><guid>https://sourceforge.netb85b625cad557146d06595cc7875c9e7b195c3d3</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -34,4 +34,163 @@
   [fProtocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3ADriverFunction%3ASend_Message)  | f_send_message | send message
   [fProtocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3ADriverFunction%3AReceive_Message)  | f_receive_message | receive message

+######Example:######

+    #!C
+    
+    #include "SFENCEProtocol.h"
+    #include "SFENCEThread.h"
+    #include "SFENCEEvent.h"
+    #include "SFENCETime.h"
+    #include "SFENCEPack.h"
+    #include "SFENCEError.h"
+    
+    #define EXAMPLE_fromerror (200200)
+    
+    ...
+    
+    #define EXAMPLE_fromerror_protocol (EXAMPLE_fromerror+40)
+     
+    //basic protocol cycle
+    enum eSFENCE_Bool Example_ThreadProtocolCycle(struct sProtocol_Protocol *ps_protocol,
+                                                  struct sThread_Thread *ps_thread,
+                                                  struct sEvent_Generator *ps_generator,
+                                                  uintptr_t u0_delay,
+                                                  struct sPack_Pack *ps_pack)
+    {
+      Mac_Var_Event_Event_Declaration(event)
+      Mac_Var_Time_Difference_Declaration(diff)
+      enum eSFENCE_Bool b_return;
+      uintptr_t u0_diff;
+
+      if (Event_Event_Construct(ps_event, ps_pack)==NULL) 
+      {
+        Have_Error(ps_pack, EXAMPLE_fromerror_protocol+0);
+        return eSFENCE_Bool_Fail;
+      }
+      
+      if (Time_Difference_Construct(ps_diff, ps_pack)==NULL) 
+      {
+        Event_Event_Destruct(ps_value, eSFENCE_Bool_false);
+        
+        Have_Error(ps_pack, EXAMPLE_fromerror_protocol+1);
+        return eSFENCE_Bool_Fail;
+      }
+
+      // first protocol start
+      b_return = Protocol_Protocol_Start(ps_protocol);
+      if (b_return!=eSFENCE_Bool_Success)
+      {
+        Event_Event_Destruct(ps_value, eSFENCE_Bool_False);
+        Time_Difference_Destruct(ps_diff, eSFENCE_Bool_False);
+        
+        Have_Error(ps_pack, EXAMPLE_fromerror_protocol+2);
+        return b_return;
+      }
+
+      // reset time
+      Time_Difference_Reset(ps_diff);
+      
+      while (1)
+      {
+        // lock protocol for thread work
+        if (Protocol_Protocol_Lock(ps_protocol)!=eSFENCE_Bool_Success)
+        {
+          Have_Error(ps_pack, EXAMPLE_fromerror_protocol+5);
+          break;
+        }
+        
+        // check protocol
+        b_return Protocol_Protocol_Check(ps_protocol);
+        if (b_return==eSFENCE_Bool_Fail) 
+        {
+          Protocol_Protocol_Unlock(ps_protocol);
+          Have_Error(ps_pack, EXAMPLE_fromerror_protocol+6);
+          break;
+        }
+        
+        if (b_return==eSFENCE_Bool_True)
+        { 
+          // can I receive ?
+          b_return = Protocol_Protocol_Can_Receive(ps_protocol, NULL);
+          if (b_return==eSFENCE_Bool_Fail)
+          {
+            Protocol_Protocol_Unlock(ps_protocol);
+            Have_Error(ps_pack, EXAMPLE_fromerror_protocol+7);
+            break;
+          }
+
+          if (b_return==eSFENCE_Bool_True)
+          {
+            // receive message
+            b_return = Protocol_Protocol_Receive_Message(ps_protocol, &amp;amp;ps_event, NULL);
+            if (b_return==eSFENCE_Bool_Fail)
+            {
+              Protocol_Protocol_Unlock(ps_protocol);
+              Have_Error(ps_pack, EXAMPLE_fromerror_protocol+8);
+              break;
+            }
+            Protocol_Protocol_Unlock(ps_protocol);
+            
+            if (b_return==eSFECNE_Bool_True)
+            {
+              // send message to system
+              if (Event_Generator_Write_Event(ps_generator, ps_event)!=eSFENCE_Bool_Success)
+              {
+                 Have_Error(ps_pack, EXAMPLE_fromerror_protocol+9);
+                 break;
+              }
+
+              // check for next message for receive immediately
+              continue;
+            }
+          }
+          else Protocol_Protocol_Unlock(ps_protocol);
+        }
+        else Protocol_Protocol_Unlock(ps_protocol);
+        
+        // check if thread going to end
+        b_return = Thread_Thread_Have_End(ps_thread);
+        if (b_return==eSFENCE_Bool_Fail)
+        {
+           Have_Error(ps_pack, EXAMPLE_fromerror_protocol+10);
+           break;
+        }
+        if (b_return==eSFENCE_Bool_True)
+        {
+           Thread_Thread_Ending_Thread(ps_thread);
+
+           // stop protocol
+           Protocol_Protocol_Stop(ps_protocol);
+
+           // clean hel objects
+           Event_Event_Destruct(ps_event, eSFENCE_Bool_False); 
+           Time_Difference_Destruct(ps_diff, eSFENCE_Bool_False); 
+           return eSFENCE_Bool_Success;
+        }
+        
+        // time diff
+        u0_diff = Time_Difference_DifferenceWithNewTime(ps_diff);
+        
+        // if time difference is lower then wanted delay 
+        // between checking for messages for receive
+        if (u0_diff&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 21:40:52 -0000</pubDate><guid>https://sourceforge.net111a9050c90c05da205768d526aa5de8b162b4ed</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -20,6 +20,7 @@
   [Protocol_Protocol_Can_Receive](Object%3AProtocol_Protocol%3AFunction%3ACan_Receive)  | Can protocol receive message at the moment?
   [Protocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3AFunction%3ASend_Message)  | send message to protocol
   [Protocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3AFunction%3AReceive_Message)  | receive a message from protocol
+  [Protocol_Protocol_Receive_MessageUse](Object%3AProtocol_Protocol%3AFunction%3AReceive_MessageUse) | receive a message from protocol

 ####Special driver functions for Protocol_Protocol####

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 20:33:06 -0000</pubDate><guid>https://sourceforge.net87094f1fe034ce80c1ac2f23c1772b736f371153</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -25,6 +25,12 @@

   Function type  | Function name | Short description
   -------------- | ------------- | -----------------
-  [fProtocol_Protocol_Get_IDName](Object%3AProtocol_Protocol%3ADriverFunction%3ASet_IDName)  | f_set_IDName | set event name
-  [fProtocol_Protocol_Set_IDName](Object%3AProtocol_Protocol%3ADriverFunction%3ASet_IDName)  | f_set_IDName | set event name
+  [fProtocol_Protocol_Start](Object%3AProtocol_Protocol%3ADriverFunction%3AStart)  | f_start | would be call before call other of special API functions of object Protocol_Protocol
+  [fProtocol_Protocol_Stop](Object%3AProtocol_Protocol%3ADriverFunction%3AStop)  | f_stop | would be call after last call of other special API functions.
+  [fProtocol_Protocol_Check](Object%3AProtocol_Protocol%3ADriverFunction%3ACheck)  | f_check | check if there is any message for receive or if message can be sent.
+  [fProtocol_Protocol_Can_Send](Object%3AProtocol_Protocol%3ADriverFunction%3ACan_Send)  | f_can_send | check if any message can be sent.
+  [fProtocol_Protocol_Can_Receive](Object%3AProtocol_Protocol%3ADriverFunction%3ACan_Receive)  | f_can_receive | check if any message can be received
+  [fProtocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3ADriverFunction%3ASend_Message)  | f_send_message | send message
+  [fProtocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3ADriverFunction%3AReceive_Message)  | f_receive_message | receive message

+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 18:59:44 -0000</pubDate><guid>https://sourceforge.netb01d5fdd740b9bd56fdad64970bf7a990e487a3e</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -13,8 +13,13 @@

   Function name  | Short description
   -------------- | -----------------
-  [Protocol_Protocol_Start](Object%3AProtocol_Protocol%3AFunction%3AGetIDName_Event)  | return name and id of event
-  [Protocol_Protocol_Stop](Object%3AProtocol_Protocol%3AFunction%3ASetIDName_Event)  | set name and id of event
+  [Protocol_Protocol_Start](Object%3AProtocol_Protocol%3AFunction%3AStart)  | this function may be called before first call of functions [Protocol_Protocol_Check](Object%3AProtocol_Protocol%3AFunction%3ACheck), [Protocol_Protocol_Can_Send](Object%3AProtocol_Protocol%3AFunction%3ACan_Send), [Protocol_Protocol_Can_Receive](Object%3AProtocol_Protocol%3AFunction%3ACan_Receive), [Protocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3AFunction%3ASend_Message) and [Protocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3AFunction%3AReceive_Message)
+  [Protocol_Protocol_Stop](Object%3AProtocol_Protocol%3AFunction%3AStop)  | this function may be called after last call of functions [Protocol_Protocol_Check](Object%3AProtocol_Protocol%3AFunction%3ACheck), [Protocol_Protocol_Can_Send](Object%3AProtocol_Protocol%3AFunction%3ACan_Send), [Protocol_Protocol_Can_Receive](Object%3AProtocol_Protocol%3AFunction%3ACan_Receive), [Protocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3AFunction%3ASend_Message) and [Protocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3AFunction%3AReceive_Message)
+  [Protocol_Protocol_Check](Object%3AProtocol_Protocol%3AFunction%3ACheck)  | Can protocol receive or send message?
+  [Protocol_Protocol_Can_Send](Object%3AProtocol_Protocol%3AFunction%3ACan_Send)  | Can protocol send message at the moment?
+  [Protocol_Protocol_Can_Receive](Object%3AProtocol_Protocol%3AFunction%3ACan_Receive)  | Can protocol receive message at the moment?
+  [Protocol_Protocol_Send_Message](Object%3AProtocol_Protocol%3AFunction%3ASend_Message)  | send message to protocol
+  [Protocol_Protocol_Receive_Message](Object%3AProtocol_Protocol%3AFunction%3AReceive_Message)  | receive a message from protocol

 ####Special driver functions for Protocol_Protocol####

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 18:24:00 -0000</pubDate><guid>https://sourceforge.netb1303f0c0574be9204a3fd621c6f1fe23fea39d8</guid></item><item><title>WikiPage Object:Protocol_Protocol modified by SFENCE</title><link>https://sourceforge.net/p/sfence/wiki/Object%253AProtocol_Protocol/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="protocol_protocol"&gt;Protocol_Protocol&lt;/h1&gt;
&lt;p&gt;Protocol_Protocol is &lt;a class="" href="/p/sfence/wiki/Basic%3ADriverObject/"&gt;standard SFENCE objects with driver&lt;/a&gt;.&lt;br /&gt;
Object have standard &lt;a class="" href="/p/sfence/wiki/Basic%3ADriverObject%3AFunctions/"&gt;basic driver object functions&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="logic-of-protocol_protocol"&gt;Logic of Protocol_Protocol&lt;/h4&gt;
&lt;p&gt;Object Protocol_Protocol is used for sending and receiving events.&lt;/p&gt;
&lt;h4 id="special-api-functions-for-protocol_protocol"&gt;Special api functions for Protocol_Protocol&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function name&lt;/th&gt;
&lt;th&gt;Short description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="" href="Object%3AProtocol_Protocol%3AFunction%3AGetIDName_Event"&gt;Protocol_Protocol_Start&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;return name and id of event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="" href="Object%3AProtocol_Protocol%3AFunction%3ASetIDName_Event"&gt;Protocol_Protocol_Stop&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;set name and id of event&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id="special-driver-functions-for-protocol_protocol"&gt;Special driver functions for Protocol_Protocol&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function type&lt;/th&gt;
&lt;th&gt;Function name&lt;/th&gt;
&lt;th&gt;Short description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="" href="Object%3AProtocol_Protocol%3ADriverFunction%3ASet_IDName"&gt;fProtocol_Protocol_Get_IDName&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;f_set_IDName&lt;/td&gt;
&lt;td&gt;set event name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="" href="Object%3AProtocol_Protocol%3ADriverFunction%3ASet_IDName"&gt;fProtocol_Protocol_Set_IDName&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;f_set_IDName&lt;/td&gt;
&lt;td&gt;set event name&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SFENCE</dc:creator><pubDate>Sat, 16 Mar 2013 18:12:19 -0000</pubDate><guid>https://sourceforge.netefea79557dd0c6e8a7f624402f56b4d376e3cec9</guid></item></channel></rss>