#endif
#include <time.h>
#include <cmsis_os2.h>
-#include <stdint.h>
-#include <stdlib.h>
#define alipay_transspecard_log 0 // 用于日志打印
#define ALIPAY_TRANSSPECARD_ERRCODE_SUCC 0
{
send_packet_total++;
}
-
+ printf("get_alipay_ble_nus_max_data_len: %u\r\n",get_alipay_ble_nus_max_data_len());
printf("总数据长度: %u 字节, 预计分包数量: %u 个\n", datalen, send_packet_total);
// 单包传输逻辑
// 多包传输逻辑
uint8_t current_packet = 1;
int all_packets_sent = 0;
- // 初始化信号量
+ if(g_transspecard_ack_sem != NULL)
+ {
+ osSemaphoreDelete(g_transspecard_ack_sem);
+ g_transspecard_ack_sem = NULL;
+ }
if (g_transspecard_ack_sem == NULL)
{
- g_transspecard_ack_sem = osSemaphoreNew(1, 0, NULL);
+ g_transspecard_ack_sem = osSemaphoreNew(1, 0, NULL);// 初始化信号量
}
// 先顺序发送所有数据包
#endif
// 接收缓冲区最大长度
-#define MAX_RECEIVE_BUFFER_SIZE (1024 * 4) //
+#define MAX_RECEIVE_BUFFER_SIZE (1024 * 5) //
#define RECEIVE_PACKET_FIRST 0x01 // 第一个包
#define RECEVIE_PACKET_COMPLETED_ACK 0x00 // 最后一个包接收完成ACK
#define RECEIVE_PACKET_HEADER 0x73 // 消息头
receive_packet_total = current_packet_total;
receive_total_datalen = current_total_datalen;
+ #if 0
if (receive_total_datalen > MAX_RECEIVE_BUFFER_SIZE)
{
- printf("Received data length exceeds buffer size!\r\n");
+ printf("Received data length exceeds buffer size,receive_total_datalen:%u!\r\n",receive_total_datalen);
isProcessingData = 0;
ble_transspecard_receive_cleanup_resources();
notify_resend(RECEIVE_PACKET_FIRST);
return ALIPAY_TRANSSPECARD_ERRCODE_FAIL;
}
+ #endif
packet_received_flags = (uint8_t *)malloc(receive_packet_total);
if (packet_received_flags == NULL)