[asterisk-commits] rizzo: trunk r48768 - /trunk/apps/app_sms.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 21 12:52:18 MST 2006


Author: rizzo
Date: Thu Dec 21 13:52:18 2006
New Revision: 48768

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48768
Log:
put generator functions next to each other.


Modified:
    trunk/apps/app_sms.c

Modified: trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sms.c?view=diff&rev=48768&r1=48767&r2=48768
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Thu Dec 21 13:52:18 2006
@@ -252,16 +252,6 @@
 #define is7bit(dcs) (((dcs)&0xC0)?(!((dcs)&4)):(!((dcs)&12)))
 #define is8bit(dcs) (((dcs)&0xC0)?(((dcs)&4)):(((dcs)&12)==4))
 #define is16bit(dcs) (((dcs)&0xC0)?0:(((dcs)&12)==8))
-
-static void *sms_alloc (struct ast_channel *chan, void *params)
-{
-	return params;
-}
-
-static void sms_release (struct ast_channel *chan, void *data)
-{
-	return;
-}
 
 static void sms_messagetx (sms_t * h);
 
@@ -1469,6 +1459,10 @@
 	h->obyten = len + 1;		/* bytes to send (including checksum) */
 }
 
+/*!
+ * outgoing data are produced by this generator function, that reads from
+ * the descriptor whether it has data to send and which ones.
+ */
 static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
 {
 	struct ast_frame f = { 0 };
@@ -1544,6 +1538,25 @@
 }
 
 /*!
+ * Just return the pointer to the descriptor that we received.
+ */
+static void *sms_alloc (struct ast_channel *chan, void *sms_t_ptr)
+{
+	return sms_t_ptr;
+}
+
+static void sms_release (struct ast_channel *chan, void *data)
+{
+	return;	/* nothing to do here. */
+}
+
+static struct ast_generator smsgen = {
+	.alloc = sms_alloc,
+	.release = sms_release,
+	.generate = sms_generate,
+};
+
+/*!
  * Process an incoming frame, trying to detect the carrier and
  * decode the message. The two frequencies are 1300 and 2100 Hz.
  * The decoder detects the amplitude of the signal over the last
@@ -1679,12 +1692,6 @@
 	}
 }
 
-static struct ast_generator smsgen = {
-	alloc:sms_alloc,
-	release:sms_release,
-	generate:sms_generate,
-};
-
 static int sms_exec (struct ast_channel *chan, void *data)
 {
 	int res = -1;



More information about the asterisk-commits mailing list