Doug Anson / mbedEndpointNetwork_BLE

Dependencies:   libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler

Revision:
9:bf0cf5828378
Parent:
7:203c348ccc66
Child:
11:d601b867b297
--- a/bt_network/BleUartRPC/Dispatcher.h	Tue Feb 17 07:01:22 2015 +0000
+++ b/bt_network/BleUartRPC/Dispatcher.h	Wed Feb 18 06:58:01 2015 +0000
@@ -25,10 +25,11 @@
  
  #include "BLEDevice.h"
  #include "UARTService.h"
+ #include "SplitterAssembler.h"
   
- #define MAX_PACKET_LENGTH          256            // longest packet we will send
- #define MAX_ARGUMENT_LENGTH        256            // longest argument sent as parameter list
- #define MAX_RESULT_LENGTH          256            // longest result received 
+ #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)
  #define UART_SEGMENT_LENGTH        20             // BLE: max UART MTU (will trigger send immediately...)
  
  class Dispatcher {
@@ -51,12 +52,18 @@
         int dispatch(uint8_t fn_id,uint8_t *args,int args_length,uint8_t *response,int response_length);
         
      private:
-        int          uart_write(uint8_t *data,int data_length);
-        int          prepare_send_packet(uint8_t fn_id,uint8_t *args,int args_length);
+        void              onDataSent(unsigned count);
+        void              onDataWritten(const GattCharacteristicWriteCBParams *params);
         
-        uint8_t      m_send_packet[MAX_PACKET_LENGTH+1];
-
-        UARTService  m_uart;
+        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;
  };
  
  #endif // __RPC_DISPATCH_H__
\ No newline at end of file