Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
bt.cpp@19:1650bbc923cc, 2017-06-09 (annotated)
- Committer:
- nikitateggi
- Date:
- Fri Jun 09 17:12:21 2017 +0000
- Revision:
- 19:1650bbc923cc
- Child:
- 22:ffa88619551d
integrated code with bluetooth
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikitateggi | 19:1650bbc923cc | 1 | #include "mbed.h" |
nikitateggi | 19:1650bbc923cc | 2 | #include "sdcard.h" |
nikitateggi | 19:1650bbc923cc | 3 | #include "struct.h" |
nikitateggi | 19:1650bbc923cc | 4 | |
nikitateggi | 19:1650bbc923cc | 5 | BLEMsg_info *bt_file; //pointer to structure |
nikitateggi | 19:1650bbc923cc | 6 | Point *myBleMsg; // pointer to bluetooth structure |
nikitateggi | 19:1650bbc923cc | 7 | //bt_st *as; |
nikitateggi | 19:1650bbc923cc | 8 | Serial mc(USBTX,USBRX); // serial terminal |
nikitateggi | 19:1650bbc923cc | 9 | Serial blue(PTC4,PTC3); // bluetooth serial terminal |
nikitateggi | 19:1650bbc923cc | 10 | |
nikitateggi | 19:1650bbc923cc | 11 | uint32_t total_samples=0; // variable to hold total number of samples |
nikitateggi | 19:1650bbc923cc | 12 | //Timer t; // timer |
nikitateggi | 19:1650bbc923cc | 13 | uint8_t ack_rx; // varibale to receive ack from the bluetooth |
nikitateggi | 19:1650bbc923cc | 14 | Point b; // structure copy |
nikitateggi | 19:1650bbc923cc | 15 | BLEMsg_info bt_file1; // structure copy |
nikitateggi | 19:1650bbc923cc | 16 | |
nikitateggi | 19:1650bbc923cc | 17 | uint32_t total_file_size=0; // to determine the size of the file |
nikitateggi | 19:1650bbc923cc | 18 | uint32_t total_file_read=0; |
nikitateggi | 19:1650bbc923cc | 19 | |
nikitateggi | 19:1650bbc923cc | 20 | uint32_t file_start=0; // variable for 'for loop' |
nikitateggi | 19:1650bbc923cc | 21 | uint32_t j=0; |
nikitateggi | 19:1650bbc923cc | 22 | uint8_t k=0; |
nikitateggi | 19:1650bbc923cc | 23 | uint32_t file_pointer_position=0; |
nikitateggi | 19:1650bbc923cc | 24 | |
nikitateggi | 19:1650bbc923cc | 25 | |
nikitateggi | 19:1650bbc923cc | 26 | |
nikitateggi | 19:1650bbc923cc | 27 | |
nikitateggi | 19:1650bbc923cc | 28 | uint8_t bt_send(uint8_t state_tx) |
nikitateggi | 19:1650bbc923cc | 29 | { |
nikitateggi | 19:1650bbc923cc | 30 | uint32_t v1[150]; |
nikitateggi | 19:1650bbc923cc | 31 | blue.baud(115200); // baud rate of bluetooth |
nikitateggi | 19:1650bbc923cc | 32 | bt_file=&bt_file1; |
nikitateggi | 19:1650bbc923cc | 33 | myBleMsg=&b; |
nikitateggi | 19:1650bbc923cc | 34 | static uint8_t state_rx =0; |
nikitateggi | 19:1650bbc923cc | 35 | //t.start(); // timer start |
nikitateggi | 19:1650bbc923cc | 36 | |
nikitateggi | 19:1650bbc923cc | 37 | |
nikitateggi | 19:1650bbc923cc | 38 | switch(state_tx) |
nikitateggi | 19:1650bbc923cc | 39 | { |
nikitateggi | 19:1650bbc923cc | 40 | |
nikitateggi | 19:1650bbc923cc | 41 | case 1: sendinit(); |
nikitateggi | 19:1650bbc923cc | 42 | sd_open_read(1); // open the file for read |
nikitateggi | 19:1650bbc923cc | 43 | total_file_size=file_size() ; // determined the file size |
nikitateggi | 19:1650bbc923cc | 44 | // mc.printf("filesize=%d",total_file_size); |
nikitateggi | 19:1650bbc923cc | 45 | state_rx =1; |
nikitateggi | 19:1650bbc923cc | 46 | state_tx =0; |
nikitateggi | 19:1650bbc923cc | 47 | break; |
nikitateggi | 19:1650bbc923cc | 48 | |
nikitateggi | 19:1650bbc923cc | 49 | |
nikitateggi | 19:1650bbc923cc | 50 | case 2: total_samples=0; |
nikitateggi | 19:1650bbc923cc | 51 | sd_read1(bt_file1); // read the sd card file |
nikitateggi | 19:1650bbc923cc | 52 | myBleMsg->bt_msg=bt_file1; //copy the contents to the structure |
nikitateggi | 19:1650bbc923cc | 53 | send(); // send the structure |
nikitateggi | 19:1650bbc923cc | 54 | total_samples= myBleMsg->bt_msg.num_samples.num_sample_ppg_dummy+myBleMsg->bt_msg.num_samples.num_sample_ecg_OTtyp; |
nikitateggi | 19:1650bbc923cc | 55 | state_tx =0; |
nikitateggi | 19:1650bbc923cc | 56 | state_rx =2; |
nikitateggi | 19:1650bbc923cc | 57 | k=0; |
nikitateggi | 19:1650bbc923cc | 58 | mc.printf("samples=%d", total_samples); |
nikitateggi | 19:1650bbc923cc | 59 | total_file_read=file_size1(); // read the file size |
nikitateggi | 19:1650bbc923cc | 60 | //mc.printf("fileread=%d",total_file_read); |
nikitateggi | 19:1650bbc923cc | 61 | //mc.printf("pointer=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 62 | break; |
nikitateggi | 19:1650bbc923cc | 63 | |
nikitateggi | 19:1650bbc923cc | 64 | |
nikitateggi | 19:1650bbc923cc | 65 | case 3: |
nikitateggi | 19:1650bbc923cc | 66 | //mc.printf("kkkk=%d\n",k); |
nikitateggi | 19:1650bbc923cc | 67 | //mc.printf("samples=%d", total_samples); // send the raw data |
nikitateggi | 19:1650bbc923cc | 68 | if(k<(total_samples/150)) |
nikitateggi | 19:1650bbc923cc | 69 | { |
nikitateggi | 19:1650bbc923cc | 70 | sd_read(v1,150); //read 1500 samples |
nikitateggi | 19:1650bbc923cc | 71 | send_data_str1(); // send the initial structure |
nikitateggi | 19:1650bbc923cc | 72 | //mc.printf("file_start,j=%d %d\n",file_start,j); |
nikitateggi | 19:1650bbc923cc | 73 | for(file_start=j;file_start<(j+150);file_start++) |
nikitateggi | 19:1650bbc923cc | 74 | { |
nikitateggi | 19:1650bbc923cc | 75 | |
nikitateggi | 19:1650bbc923cc | 76 | blue.printf("%08x", v1[file_start]); |
nikitateggi | 19:1650bbc923cc | 77 | |
nikitateggi | 19:1650bbc923cc | 78 | } |
nikitateggi | 19:1650bbc923cc | 79 | // blue.printf("\n"); |
nikitateggi | 19:1650bbc923cc | 80 | // mc.printf("iiii,hjjjj=%d %d\n",file_start,j); |
nikitateggi | 19:1650bbc923cc | 81 | state_tx =0; |
nikitateggi | 19:1650bbc923cc | 82 | state_rx =3; |
nikitateggi | 19:1650bbc923cc | 83 | send_data_str2(); |
nikitateggi | 19:1650bbc923cc | 84 | |
nikitateggi | 19:1650bbc923cc | 85 | } |
nikitateggi | 19:1650bbc923cc | 86 | |
nikitateggi | 19:1650bbc923cc | 87 | else |
nikitateggi | 19:1650bbc923cc | 88 | { |
nikitateggi | 19:1650bbc923cc | 89 | for(int l=0;l<150;l++) |
nikitateggi | 19:1650bbc923cc | 90 | { |
nikitateggi | 19:1650bbc923cc | 91 | v1[l]=NULL; |
nikitateggi | 19:1650bbc923cc | 92 | } |
nikitateggi | 19:1650bbc923cc | 93 | |
nikitateggi | 19:1650bbc923cc | 94 | send_data_str1(); |
nikitateggi | 19:1650bbc923cc | 95 | sd_read(v1,(total_samples-(150*k))); |
nikitateggi | 19:1650bbc923cc | 96 | for(file_start=j;file_start<(total_samples-(150*k));file_start++) |
nikitateggi | 19:1650bbc923cc | 97 | { |
nikitateggi | 19:1650bbc923cc | 98 | blue.printf("%08x", v1[file_start]); |
nikitateggi | 19:1650bbc923cc | 99 | } |
nikitateggi | 19:1650bbc923cc | 100 | |
nikitateggi | 19:1650bbc923cc | 101 | // blue.printf("\n"); |
nikitateggi | 19:1650bbc923cc | 102 | state_tx=0; |
nikitateggi | 19:1650bbc923cc | 103 | state_rx=4; |
nikitateggi | 19:1650bbc923cc | 104 | send_data_str2(); |
nikitateggi | 19:1650bbc923cc | 105 | } |
nikitateggi | 19:1650bbc923cc | 106 | |
nikitateggi | 19:1650bbc923cc | 107 | total_file_read=file_size1(); |
nikitateggi | 19:1650bbc923cc | 108 | // mc.printf("fileread=%d",total_file_read ); |
nikitateggi | 19:1650bbc923cc | 109 | // mc.printf("pointer=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 110 | break; |
nikitateggi | 19:1650bbc923cc | 111 | |
nikitateggi | 19:1650bbc923cc | 112 | |
nikitateggi | 19:1650bbc923cc | 113 | case 4: total_file_read=file_size1(); |
nikitateggi | 19:1650bbc923cc | 114 | mc.printf("fileread=%d",total_file_read); |
nikitateggi | 19:1650bbc923cc | 115 | if(total_file_read==total_file_size) |
nikitateggi | 19:1650bbc923cc | 116 | { |
nikitateggi | 19:1650bbc923cc | 117 | |
nikitateggi | 19:1650bbc923cc | 118 | state_rx=6; |
nikitateggi | 19:1650bbc923cc | 119 | sd_close(); |
nikitateggi | 19:1650bbc923cc | 120 | // mc.printf("exit"); |
nikitateggi | 19:1650bbc923cc | 121 | } |
nikitateggi | 19:1650bbc923cc | 122 | else |
nikitateggi | 19:1650bbc923cc | 123 | { |
nikitateggi | 19:1650bbc923cc | 124 | state_rx=5; |
nikitateggi | 19:1650bbc923cc | 125 | total_file_read=file_size1(); |
nikitateggi | 19:1650bbc923cc | 126 | // mc.printf("fileread=%d",total_file_read ); |
nikitateggi | 19:1650bbc923cc | 127 | //mc.printf("pointer=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 128 | |
nikitateggi | 19:1650bbc923cc | 129 | } |
nikitateggi | 19:1650bbc923cc | 130 | |
nikitateggi | 19:1650bbc923cc | 131 | |
nikitateggi | 19:1650bbc923cc | 132 | //t.stop(); |
nikitateggi | 19:1650bbc923cc | 133 | |
nikitateggi | 19:1650bbc923cc | 134 | } |
nikitateggi | 19:1650bbc923cc | 135 | //mc.printf("time=%d\n",t.read_ms()); |
nikitateggi | 19:1650bbc923cc | 136 | return state_rx; |
nikitateggi | 19:1650bbc923cc | 137 | |
nikitateggi | 19:1650bbc923cc | 138 | } |
nikitateggi | 19:1650bbc923cc | 139 | |
nikitateggi | 19:1650bbc923cc | 140 | |
nikitateggi | 19:1650bbc923cc | 141 | |
nikitateggi | 19:1650bbc923cc | 142 | |
nikitateggi | 19:1650bbc923cc | 143 | uint8_t bt_receive (uint8_t state_rx) |
nikitateggi | 19:1650bbc923cc | 144 | { |
nikitateggi | 19:1650bbc923cc | 145 | |
nikitateggi | 19:1650bbc923cc | 146 | static unsigned char state_tx =1; //state for transmitting |
nikitateggi | 19:1650bbc923cc | 147 | |
nikitateggi | 19:1650bbc923cc | 148 | Timer t; // timer |
nikitateggi | 19:1650bbc923cc | 149 | uint8_t ack_rx; // varibale to receive ack from the bluetooth |
nikitateggi | 19:1650bbc923cc | 150 | //Point b; // structure copy |
nikitateggi | 19:1650bbc923cc | 151 | //myBleMsg=&b; |
nikitateggi | 19:1650bbc923cc | 152 | t.start(); // timer start |
nikitateggi | 19:1650bbc923cc | 153 | |
nikitateggi | 19:1650bbc923cc | 154 | switch(state_rx) |
nikitateggi | 19:1650bbc923cc | 155 | { |
nikitateggi | 19:1650bbc923cc | 156 | |
nikitateggi | 19:1650bbc923cc | 157 | case 1: // wait for the ack |
nikitateggi | 19:1650bbc923cc | 158 | state_rx=0; |
nikitateggi | 19:1650bbc923cc | 159 | myBleMsg->proto=ACK; |
nikitateggi | 19:1650bbc923cc | 160 | scanf("%02x",&ack_rx); // read the ack/nack from serial terminal |
nikitateggi | 19:1650bbc923cc | 161 | mc.printf("%02x",ack_rx); |
nikitateggi | 19:1650bbc923cc | 162 | if (ack_rx==myBleMsg->proto) // check for ack |
nikitateggi | 19:1650bbc923cc | 163 | { |
nikitateggi | 19:1650bbc923cc | 164 | |
nikitateggi | 19:1650bbc923cc | 165 | state_tx=2; |
nikitateggi | 19:1650bbc923cc | 166 | } |
nikitateggi | 19:1650bbc923cc | 167 | |
nikitateggi | 19:1650bbc923cc | 168 | else // its a nack |
nikitateggi | 19:1650bbc923cc | 169 | |
nikitateggi | 19:1650bbc923cc | 170 | { |
nikitateggi | 19:1650bbc923cc | 171 | |
nikitateggi | 19:1650bbc923cc | 172 | state_tx=1; |
nikitateggi | 19:1650bbc923cc | 173 | sd_close(); |
nikitateggi | 19:1650bbc923cc | 174 | } |
nikitateggi | 19:1650bbc923cc | 175 | break; |
nikitateggi | 19:1650bbc923cc | 176 | |
nikitateggi | 19:1650bbc923cc | 177 | case 2: state_rx =0; //wait for the ack |
nikitateggi | 19:1650bbc923cc | 178 | myBleMsg->proto=ACK; |
nikitateggi | 19:1650bbc923cc | 179 | |
nikitateggi | 19:1650bbc923cc | 180 | scanf("%02x", &ack_rx); |
nikitateggi | 19:1650bbc923cc | 181 | if (ack_rx==myBleMsg->proto) |
nikitateggi | 19:1650bbc923cc | 182 | { |
nikitateggi | 19:1650bbc923cc | 183 | |
nikitateggi | 19:1650bbc923cc | 184 | state_tx=3; |
nikitateggi | 19:1650bbc923cc | 185 | file_pointer_position=total_file_read; |
nikitateggi | 19:1650bbc923cc | 186 | } |
nikitateggi | 19:1650bbc923cc | 187 | |
nikitateggi | 19:1650bbc923cc | 188 | else |
nikitateggi | 19:1650bbc923cc | 189 | |
nikitateggi | 19:1650bbc923cc | 190 | { |
nikitateggi | 19:1650bbc923cc | 191 | |
nikitateggi | 19:1650bbc923cc | 192 | state_tx=2; |
nikitateggi | 19:1650bbc923cc | 193 | setpos1(file_pointer_position); // set the file pointer to send the previous data |
nikitateggi | 19:1650bbc923cc | 194 | // mc.printf("pointer=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 195 | } |
nikitateggi | 19:1650bbc923cc | 196 | |
nikitateggi | 19:1650bbc923cc | 197 | break; |
nikitateggi | 19:1650bbc923cc | 198 | |
nikitateggi | 19:1650bbc923cc | 199 | |
nikitateggi | 19:1650bbc923cc | 200 | case 3: |
nikitateggi | 19:1650bbc923cc | 201 | state_rx =0; |
nikitateggi | 19:1650bbc923cc | 202 | myBleMsg->proto=ACK; |
nikitateggi | 19:1650bbc923cc | 203 | scanf("%02x", &ack_rx); |
nikitateggi | 19:1650bbc923cc | 204 | if (ack_rx==myBleMsg->proto) |
nikitateggi | 19:1650bbc923cc | 205 | { |
nikitateggi | 19:1650bbc923cc | 206 | |
nikitateggi | 19:1650bbc923cc | 207 | state_tx=3; |
nikitateggi | 19:1650bbc923cc | 208 | k=k+1; |
nikitateggi | 19:1650bbc923cc | 209 | file_pointer_position=total_file_read; |
nikitateggi | 19:1650bbc923cc | 210 | } |
nikitateggi | 19:1650bbc923cc | 211 | |
nikitateggi | 19:1650bbc923cc | 212 | else |
nikitateggi | 19:1650bbc923cc | 213 | |
nikitateggi | 19:1650bbc923cc | 214 | { |
nikitateggi | 19:1650bbc923cc | 215 | |
nikitateggi | 19:1650bbc923cc | 216 | state_tx=3; |
nikitateggi | 19:1650bbc923cc | 217 | // mc.printf("j=%d\n",j); |
nikitateggi | 19:1650bbc923cc | 218 | file_start=file_start-150; |
nikitateggi | 19:1650bbc923cc | 219 | //mc.printf("j=%d\n",j); |
nikitateggi | 19:1650bbc923cc | 220 | // mc.printf("file_pointer_position=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 221 | setpos1(file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 222 | } |
nikitateggi | 19:1650bbc923cc | 223 | |
nikitateggi | 19:1650bbc923cc | 224 | break; |
nikitateggi | 19:1650bbc923cc | 225 | |
nikitateggi | 19:1650bbc923cc | 226 | case 4: |
nikitateggi | 19:1650bbc923cc | 227 | state_rx =0; |
nikitateggi | 19:1650bbc923cc | 228 | myBleMsg->proto=ACK; |
nikitateggi | 19:1650bbc923cc | 229 | scanf("%02x", &ack_rx); |
nikitateggi | 19:1650bbc923cc | 230 | if (ack_rx==myBleMsg->proto) |
nikitateggi | 19:1650bbc923cc | 231 | { |
nikitateggi | 19:1650bbc923cc | 232 | // bt_r.printf("sent"); |
nikitateggi | 19:1650bbc923cc | 233 | state_tx=4; |
nikitateggi | 19:1650bbc923cc | 234 | k=k+1; |
nikitateggi | 19:1650bbc923cc | 235 | file_pointer_position=total_file_read; |
nikitateggi | 19:1650bbc923cc | 236 | } |
nikitateggi | 19:1650bbc923cc | 237 | |
nikitateggi | 19:1650bbc923cc | 238 | else |
nikitateggi | 19:1650bbc923cc | 239 | |
nikitateggi | 19:1650bbc923cc | 240 | { |
nikitateggi | 19:1650bbc923cc | 241 | //bt_r.printf("no-ack"); |
nikitateggi | 19:1650bbc923cc | 242 | state_tx=3; |
nikitateggi | 19:1650bbc923cc | 243 | file_start=file_start-150; |
nikitateggi | 19:1650bbc923cc | 244 | mc.printf("file_pointer_position=%d\n",file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 245 | setpos1(file_pointer_position); |
nikitateggi | 19:1650bbc923cc | 246 | } |
nikitateggi | 19:1650bbc923cc | 247 | break; |
nikitateggi | 19:1650bbc923cc | 248 | |
nikitateggi | 19:1650bbc923cc | 249 | case 5: state_tx=2; |
nikitateggi | 19:1650bbc923cc | 250 | break; |
nikitateggi | 19:1650bbc923cc | 251 | |
nikitateggi | 19:1650bbc923cc | 252 | case 6: state_tx=0; |
nikitateggi | 19:1650bbc923cc | 253 | mc.printf("out"); |
nikitateggi | 19:1650bbc923cc | 254 | break; |
nikitateggi | 19:1650bbc923cc | 255 | |
nikitateggi | 19:1650bbc923cc | 256 | |
nikitateggi | 19:1650bbc923cc | 257 | |
nikitateggi | 19:1650bbc923cc | 258 | //t.stop(); |
nikitateggi | 19:1650bbc923cc | 259 | |
nikitateggi | 19:1650bbc923cc | 260 | } |
nikitateggi | 19:1650bbc923cc | 261 | //bt_r.printf("time=%d\n",t.read_ms()); |
nikitateggi | 19:1650bbc923cc | 262 | return state_tx; |
nikitateggi | 19:1650bbc923cc | 263 | } |
nikitateggi | 19:1650bbc923cc | 264 | |
nikitateggi | 19:1650bbc923cc | 265 | |
nikitateggi | 19:1650bbc923cc | 266 | |
nikitateggi | 19:1650bbc923cc | 267 | |
nikitateggi | 19:1650bbc923cc | 268 | |
nikitateggi | 19:1650bbc923cc | 269 | |
nikitateggi | 19:1650bbc923cc | 270 | |
nikitateggi | 19:1650bbc923cc | 271 | void send() |
nikitateggi | 19:1650bbc923cc | 272 | { |
nikitateggi | 19:1650bbc923cc | 273 | myBleMsg->start_end_of_string=sos; |
nikitateggi | 19:1650bbc923cc | 274 | myBleMsg->length_file=28; |
nikitateggi | 19:1650bbc923cc | 275 | myBleMsg->proto=start_of_file; |
nikitateggi | 19:1650bbc923cc | 276 | myBleMsg->chk_sum=32; |
nikitateggi | 19:1650bbc923cc | 277 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 278 | mc.printf("%08x",myBleMsg->length_file); |
nikitateggi | 19:1650bbc923cc | 279 | mc.printf("%02x",myBleMsg->proto); |
nikitateggi | 19:1650bbc923cc | 280 | mc.printf("%08x",myBleMsg->bt_msg.length); |
nikitateggi | 19:1650bbc923cc | 281 | mc.printf("%02x",myBleMsg->bt_msg.device_id); |
nikitateggi | 19:1650bbc923cc | 282 | mc.printf("%08x",myBleMsg->bt_msg.patient_id); |
nikitateggi | 19:1650bbc923cc | 283 | mc.printf("%02x",myBleMsg->bt_msg.date_time.date); |
nikitateggi | 19:1650bbc923cc | 284 | mc.printf("%02x",myBleMsg->bt_msg.date_time.month); |
nikitateggi | 19:1650bbc923cc | 285 | mc.printf("%02x",myBleMsg->bt_msg.date_time.year); |
nikitateggi | 19:1650bbc923cc | 286 | mc.printf("%02x",myBleMsg->bt_msg.date_time.hour); |
nikitateggi | 19:1650bbc923cc | 287 | mc.printf("%02x",myBleMsg->bt_msg.date_time.mins); |
nikitateggi | 19:1650bbc923cc | 288 | mc.printf("%02x",myBleMsg->bt_msg.date_time.sec); |
nikitateggi | 19:1650bbc923cc | 289 | mc.printf("%02x",myBleMsg->bt_msg.test_type); |
nikitateggi | 19:1650bbc923cc | 290 | mc.printf("%04x",myBleMsg->bt_msg.sampling_freq); |
nikitateggi | 19:1650bbc923cc | 291 | mc.printf("%04x",myBleMsg->bt_msg.num_samples. num_sample_ppg_dummy); |
nikitateggi | 19:1650bbc923cc | 292 | mc.printf("%04x",myBleMsg->bt_msg.num_samples.num_sample_ecg_OTtyp); |
nikitateggi | 19:1650bbc923cc | 293 | mc.printf("%04x",myBleMsg->bt_msg.cal_data.cal_sbp_dummy); |
nikitateggi | 19:1650bbc923cc | 294 | mc.printf("%04x",myBleMsg->bt_msg.cal_data.cal_dbp_OTtyp); |
nikitateggi | 19:1650bbc923cc | 295 | myBleMsg->start_end_of_string=eos; |
nikitateggi | 19:1650bbc923cc | 296 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 297 | mc.printf("%02x",myBleMsg->chk_sum); |
nikitateggi | 19:1650bbc923cc | 298 | |
nikitateggi | 19:1650bbc923cc | 299 | } |
nikitateggi | 19:1650bbc923cc | 300 | |
nikitateggi | 19:1650bbc923cc | 301 | void sendinit() |
nikitateggi | 19:1650bbc923cc | 302 | { |
nikitateggi | 19:1650bbc923cc | 303 | myBleMsg->start_end_of_string=sos; |
nikitateggi | 19:1650bbc923cc | 304 | myBleMsg->length_file=3; |
nikitateggi | 19:1650bbc923cc | 305 | myBleMsg->proto=start_of_file; |
nikitateggi | 19:1650bbc923cc | 306 | // myBleMsg->bt_msg=NULL; |
nikitateggi | 19:1650bbc923cc | 307 | myBleMsg->chk_sum=3; |
nikitateggi | 19:1650bbc923cc | 308 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 309 | mc.printf("%08x",myBleMsg->length_file); |
nikitateggi | 19:1650bbc923cc | 310 | mc.printf("%02x",myBleMsg->proto); |
nikitateggi | 19:1650bbc923cc | 311 | myBleMsg->start_end_of_string=eos; |
nikitateggi | 19:1650bbc923cc | 312 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 313 | mc.printf("%02x",myBleMsg->chk_sum); |
nikitateggi | 19:1650bbc923cc | 314 | |
nikitateggi | 19:1650bbc923cc | 315 | } |
nikitateggi | 19:1650bbc923cc | 316 | |
nikitateggi | 19:1650bbc923cc | 317 | |
nikitateggi | 19:1650bbc923cc | 318 | |
nikitateggi | 19:1650bbc923cc | 319 | void send_data_str1() |
nikitateggi | 19:1650bbc923cc | 320 | { |
nikitateggi | 19:1650bbc923cc | 321 | myBleMsg->start_end_of_string=sos; |
nikitateggi | 19:1650bbc923cc | 322 | myBleMsg->length_file=3; |
nikitateggi | 19:1650bbc923cc | 323 | myBleMsg->proto=start_of_file; |
nikitateggi | 19:1650bbc923cc | 324 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 325 | mc.printf("%08x",myBleMsg->length_file); |
nikitateggi | 19:1650bbc923cc | 326 | mc.printf("%02x",myBleMsg->proto); |
nikitateggi | 19:1650bbc923cc | 327 | } |
nikitateggi | 19:1650bbc923cc | 328 | |
nikitateggi | 19:1650bbc923cc | 329 | |
nikitateggi | 19:1650bbc923cc | 330 | |
nikitateggi | 19:1650bbc923cc | 331 | void send_data_str2() |
nikitateggi | 19:1650bbc923cc | 332 | { |
nikitateggi | 19:1650bbc923cc | 333 | myBleMsg->chk_sum=3; |
nikitateggi | 19:1650bbc923cc | 334 | myBleMsg->start_end_of_string=eos; |
nikitateggi | 19:1650bbc923cc | 335 | mc.printf("%02x",myBleMsg->start_end_of_string); |
nikitateggi | 19:1650bbc923cc | 336 | mc.printf("%02x",myBleMsg->chk_sum); |
nikitateggi | 19:1650bbc923cc | 337 | } |
nikitateggi | 19:1650bbc923cc | 338 | |
nikitateggi | 19:1650bbc923cc | 339 | |
nikitateggi | 19:1650bbc923cc | 340 | |
nikitateggi | 19:1650bbc923cc | 341 |