Doug Anson / mbedEndpointNetwork_BLE

Dependencies:   libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler

Revision:
11:d601b867b297
Parent:
9:bf0cf5828378
Child:
30:13f78e38fae8
diff -r 95122a4a80cb -r d601b867b297 bt_network/BleUartRPC/Dispatcher.h
--- a/bt_network/BleUartRPC/Dispatcher.h	Wed Feb 18 07:11:45 2015 +0000
+++ b/bt_network/BleUartRPC/Dispatcher.h	Wed Feb 18 19:40:24 2015 +0000
@@ -26,10 +26,13 @@
  #include "BLEDevice.h"
  #include "UARTService.h"
  #include "SplitterAssembler.h"
-  
- #define MAX_PACKET_LENGTH          300            // longest packet we will send (aligns with 15x20 in SplitterAssembler)
- #define MAX_ARGUMENT_LENGTH        300            // longest argument sent as parameter list (aligns with 15x20 in SplitterAssembler)
- #define MAX_RESULT_LENGTH          300            // longest result received (aligns with 15x20 in SplitterAssembler)
+ 
+ // These are aligned with MAX_VALUE_BUFFER_LENGTH in mbedConnectorInterface.h 
+ #define MAX_PACKET_LENGTH          256            // longest packet we will send (aligns with 15x20 in SplitterAssembler)
+ #define MAX_ARGUMENT_LENGTH        256            // longest argument sent as parameter list (aligns with 15x20 in SplitterAssembler)
+ #define MAX_RESULT_LENGTH          256            // longest result received (aligns with 15x20 in SplitterAssembler)
+ 
+ // This is aligned with the value of DEF_FRAGMENT_LENGTH in SplitterAssembler.h and is also the max UART MTU for BLE
  #define UART_SEGMENT_LENGTH        20             // BLE: max UART MTU (will trigger send immediately...)
  
  class Dispatcher {
@@ -52,18 +55,18 @@
         int dispatch(uint8_t fn_id,uint8_t *args,int args_length,uint8_t *response,int response_length);
         
      private:
-        void              onDataSent(unsigned count);
-        void              onDataWritten(const GattCharacteristicWriteCBParams *params);
+        void                 onDataSent(unsigned count);
+        void                 onDataWritten(const GattCharacteristicWriteCBParams *params);
         
-        int               uart_write(bool send_ack = false);
-        int               uart_write(uint8_t *data,int data_length);
-        int               prepare_send_packet(uint8_t fn_id,uint8_t *args,int args_length);
+        int                  uart_write(bool send_ack = false);
+        int                  uart_write(uint8_t *data,int data_length);
+        int                  prepare_send_packet(uint8_t fn_id,uint8_t *args,int args_length);
         
-        uint8_t           m_send_packet[MAX_PACKET_LENGTH+1];
-        UARTService       m_uart;
-        SplitterAssembler m_splitter;
-        int               m_splitter_count;
-        int               m_splitter_index;
+        uint8_t              m_send_packet[MAX_PACKET_LENGTH+1];
+        UARTService          m_uart;
+        SplitterAssembler    m_splitter;
+        int                  m_splitter_count;
+        int                  m_splitter_index;
  };
  
  #endif // __RPC_DISPATCH_H__
\ No newline at end of file