First version, development moved to 5110-connected machine
[gnokii.git] / common / protocol / fbus.c
index 46a6e8f..2cc8aae 100644 (file)
@@ -10,6 +10,8 @@
 
 */
 
+#include "config.h"
+
 /* "Turn on" prototypes in fbus.h */
 #define __fbus_c 
 
 #include "protocol/fbus.h"
 #include "protocol/at.h"
 #include "newmodules/newat.h"
+#ifndef UCLINUX
 #include "newmodules/n6110.h"
+#endif /* UCLINUX */
 #include "misc.h"
 
+static GSM_Error FBUS_Initialise(char *port_device, char *initlength,
+                          GSM_ConnectionType connection,
+                          void (*rlp_callback)(RLP_F96Frame *frame));
+
+static int FBUS_SendMessage(u16 message_length, u8 message_type, u8 *buffer);
+static int FBUS_SendFrame(u16 message_length, u8 message_type, u8 *buffer);
+static void FBUS_Terminate(void);
+static void FBUS_RX_StateMachine(unsigned char rx_byte);
+
 GSM_Protocol FBUS_Functions = {
   FBUS_Initialise,
   FBUS_SendMessage,
@@ -44,24 +57,24 @@ GSM_Protocol FBUS_Functions = {
 };
 
 /* Local variables */
-enum FBUS_RX_States RX_State;
+static enum FBUS_RX_States RX_State;
 
-u8 MessageDestination, MessageSource;
+static u8 MessageDestination, MessageSource;
 
-u16 BufferCount, MultiBufferCount;
+static u16 BufferCount;
 
-u16 MessageLength, MultiMessageLength;
+static u16 MessageLength, MultiMessageLength;
 
-bool RX_Multiple = false;
+static bool RX_Multiple = false;
 
-u8 MessageType,MultiMessageType;
+static u8 MessageType,MultiMessageType;
 
-u8 MessageBuffer[FBUS_MAX_RECEIVE_LENGTH * 6],MultiMessageBuffer[FBUS_MAX_RECEIVE_LENGTH * 6];
+static u8 MessageBuffer[FBUS_MAX_RECEIVE_LENGTH * 6],MultiMessageBuffer[FBUS_MAX_RECEIVE_LENGTH * 6];
 
-u8        RequestSequenceNumber = 0x00;
+static u8        RequestSequenceNumber = 0x00;
 
 #ifdef DEBUG   
-char *N61_PrintDevice(int Device)
+static char *N61_PrintDevice(int Device)
 {
   switch (Device) {
 
@@ -75,7 +88,7 @@ char *N61_PrintDevice(int Device)
 /* N61_RX_DisplayMessage is called when a message we don't know about is
    received so that the user can see what is going back and forth, and perhaps
    shed some more light/explain another message type! */
-void N61_RX_DisplayMessage()
+static void N61_RX_DisplayMessage()
 {
 #ifdef DEBUG
   fprintf(stdout, _("Msg Dest: %s\n"), N61_PrintDevice(MessageDestination));
@@ -203,7 +216,7 @@ int FBUS_SendMessage(u16 message_length, u8 message_type, u8 *buffer) {
   return (true);
 }
 
-int FBUS_SendAck(u8 message_type, u8 message_seq) {
+static int FBUS_SendAck(u8 message_type, u8 message_seq) {
 
   unsigned char request[6];
 
@@ -276,8 +289,8 @@ void FBUS_RX_StateMachine(unsigned char rx_byte) {
   case FBUS_RX_Sync:
 
       if ((CurrentConnectionType==GCT_FBUS && rx_byte == FBUS_FRAME_ID) ||
-          ((CurrentConnectionType==GCT_Infrared ||
-          CurrentConnectionType==GCT_Tekram) && rx_byte == FBUS_IR_FRAME_ID)) {
+          0/*((CurrentConnectionType==GCT_Infrared ||
+          CurrentConnectionType==GCT_Tekram) && rx_byte == FBUS_IR_FRAME_ID)*/) {
 
         BufferCount = 0;
 
@@ -511,7 +524,7 @@ void FBUS_RX_StateMachine(unsigned char rx_byte) {
 }
   
 /* Called by initialisation code to open comm port in asynchronous mode. */
-bool FBUS_OpenSerial(void)
+static bool FBUS_OpenSerial(void)
 {
   /* Uncomment, if want to test first method for DLR3 */
 //  unsigned char req[3] = {"AT\r"};  
@@ -547,6 +560,7 @@ bool FBUS_OpenSerial(void)
        device_setdtrrts(1, 0);
 
        break;
+#ifndef UCLINUX
      case GCT_DLR3:
 
 #ifdef DEBUG
@@ -627,6 +641,7 @@ bool FBUS_OpenSerial(void)
        /* It's more complicated and not done here */
        break;
 
+#endif /* UCLINUX */
      default:
 #ifdef DEBUG
        fprintf(stdout,_("Wrong connection type for fbus module. Inform marcin-wiacek@topnet.pl about it\n"));
@@ -638,7 +653,7 @@ bool FBUS_OpenSerial(void)
 }
 
 /* Initialise variables and state machine. */
-GSM_Error FBUS_Initialise(char *port_device, char *initlength,
+static GSM_Error FBUS_Initialise(char *port_device, char *initlength,
                           GSM_ConnectionType connection,
                           void (*rlp_callback)(RLP_F96Frame *frame))
 {