1 / 16

Embedded Systems Software Training Center

Embedded Systems Software Training Center. BluRapport SDK. Agenda. Continue l earn how to work with BluRapport SDK PIN code OBEX API Implement FTP browser. Questions. What is the Inquiry process? What is the Service Discovery process?. Common API.

hova
Download Presentation

Embedded Systems Software Training Center

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Embedded Systems Software Training Center BluRapport SDK

  2. Agenda • Continue learn how to work with BluRapport SDK • PIN code • OBEX API • Implement FTP browser

  3. Questions • What is the Inquiry process? • What is the Service Discovery process?

  4. Common API • Main Functions that are used to work with PIN code: • intrx_set_fixed_pin(TCHAR* pin) – setup pin code,After that call the stack will reply this PIN immediately, without calling PIN callback. • void rx_register_pin_request_callback(rx_pin_code_request_callback_tfunc, • void *user_ptr) - install PIN callback. • func- user-supplied function which should return PIN • user_ptr- pointer to user's private data to pass into callback as 1-st parameter • typedefrx_ret_t (*rx_pin_code_request_callback_t)(void * user_data, • unsigned timeout_ms, • rx_remote_device_user_t *remote_device, • TCHAR *out_pin_code) - callback to answer on PIN request • user_data- pointer passed to rx_register_pin_request_callback. • timeout_ms- time limit for PIN code request • remote_device- information about device which requested PIN. • out_pin_codePIN to pass to the stack

  5. Your Task 1 • Prepare application with support fixed pin code (use rx_set_fixed_pin()) • Prepare application with support user defined pin code (use rx_register_pin_request_callback())

  6. OBEX API Main Functions that are used to work with OBEX profile: rx_ret_trx_obex_initialize ()- function initializes OBEX subsystem. This function must be called first, othewise OBEX APIs will not work. When you are done using OBEX call rx_obex_deinitialize rx_ret_trx_obex_deinitialize () – Frees the resources that are allocated by rx_obex_initialize. This function must be called if rx_obex_initialize return RET_OK. It also stops all services started by rx_obex_register_service without need of the handles.

  7. Demo FTP browser Main Functions that are used to work with OBEX profile: rx_ret_trx_obex_connect(rx_obex_handle_t*connection_handle, rx_obex_connection_info_t *connection_info) - Establish OBEX connection. connection_info - structure containing connection parameters. rx_ret_t ret = RET_OK; rx_obex_handle_t handle = NULL; rx_obex_connection_info_tconnection_info; rx_bd_addr_tbd_addr; unsigned channel; ... memset(&connection_info, 0, sizeof(connection_info)); memcpy(connection_info.uuid, RX_OBEX_FTP_UUID, RX_OBEX_FTP_UUID_LEN); connection_info.address.proto = RX_PF_RFCOMM; connection_info.address.protocol.rfcomm.channel = channel;(see Task 2 from Lab03) memcpy(&connection_info.address.protocol.rfcomm.bd_addr, &bd_addr, sizeof(rx_bd_addr_t)); connection_info.uuid_len = RX_OBEX_FTP_UUID_LEN; ret = rx_obex_connect(TRS_CALL &handle, &connection_info);

  8. Demo FTP browser • Main Functions that are used to work with OBEX profile: • rx_ret_trx_obex_ftp_put_file(rx_obex_handle_tconnection_handle, • TCHAR *file_name, • TCHAR *src_dir, • rx_obex_ftp_operation_progress_t *progress) - Copies a single file to the current directory for this connection on OBEX server • connection_handle- handle obtained by call to rx_obex_connect() • file_name- file name of the file to be pushed. • src_dir- the directory from where file will be taken. If this parameter is NULL, file is taken from the current directory (specified in connection_info structure during connect). • progress - operation progress callback. Function will be called after sending every packet with file body. This parameter could be null if information about progress is useless.

  9. Demo FTP browser • Main Functions that are used to work with OBEX profile: • typedefstructrx_obex_ftp_operation_progress_s • { • rx_obex_ftp_operation_progress_callback_t callback; /* user callback function to be called • * during file operation */ • void *user_data; /* pointer to user data. This pointer will be returned in file operation callback */ • } • rx_obex_ftp_operation_progress_t; • typedefrx_bool_t (* rx_obex_ftp_operation_progress_callback_t)(void* user_data, • rx_uint32_t rest_bts, • rx_uint32_t total_rest_bts, • TCHAR *file_name) - OBEX file operation progress function. • user_data- pointer to user data. Filled by user in rx_obex_ftp_operation_progress_t structure before call FTP operation that support progress callbacks. • rest_bts- bytes rest to transfer current file. • total_rest_bts- total bytes rest to transfer. • file_name- pointer to the file name which is now transferred.

  10. Demo FTP browser Main Functions that are used to work with OBEX profile: Example of using progress callback: rx_bool_toperation_progress(void *d, rx_uint32_t rest_bts, rx_uint32_t total_rest_bts, TCHAR *name) { (void)d; xprintf(_T("file to transfer %s; %d bytes total; %d bytes left\n"), name, total_rest_bts, rest_bts); return RX_TRUE; } … prgs.callback = &operation_progress; prgs.user_data= NULL; ret = rx_obex_ftp_put_file(TRS_CALL gs_handle, gs_path, NULL, &prgs);

  11. Demo FTP browser • Main Functions that are used to work with OBEX profile: • rx_ret_trx_obex_ftp_get_file(TRS_PROTO • rx_obex_handle_tconnection_handle, • TCHAR* file_name, • TCHAR* dest_dir, • rx_obex_ftp_operation_progress_t *progress) - Gets a single file from the server • connection_handle- handle obtained by call to rx_obex_connect. • file_name- file name to get from the server. • dest_dir- the directory where the file should land (with the same name as the source). • progress - operation progress callback. Function will be called after sending every packet with file body. This parameter could be null if information about operation progress is useless. • NOTE: if dest_dir is NULL, the received file will be placed in the default directory (specified in connection_infostructure during connect).

  12. Demo FTP browser • Main Functions that are used to work with OBEX profile: • rx_ret_trx_obex_ftp_chdir(rx_obex_handle_tconnection_handle, TCHAR *dir) - Changes the current directory that the client sees on the server. • connection_handle- handle obtained by call to rx_obex_connect. • dir- path to the new directory. • rx_ret_trx_obex_ftp_find_first(rx_obex_handle_tconnection_handle, TCHAR *dir_name, • rx_obex_ftp_find_data_t *data) - Gets remote directory information • connection_handle- handle obtained by call to rx_obex_connect. • dir_name- remote directory name. • data - data about the first file found. • rx_ret_trx_obex_ftp_find_next(rx_obex_handle_tconnection_handle, • rx_obex_ftp_find_data_t *data)- Finds next remote file or folder. • connection_handle- handle obtained by call to rx_obex_connect. • data - data about the next file found. • NOTE: return RET_OK on success, RET_END_OF_LIST on end of list file, or errorcode- otherwise. • rx_ret_trx_obex_ftp_find_done(rx_obex_handle_tconnection_handle) - Clear the information • allocated by rx_obex_ftp_find_first. • connection_handle- handle obtained by call to rx_obex_connect.

  13. Demo FTP browser Main Functions that are used to work with OBEX profile: Example of getting contents of folder: rx_ret_tret = RET_OK; rx_obex_handle_t handle = NULL; rx_obex_ftp_find_data_t data; ... ret = rx_obex_ftp_find_first(TRS_CALL handle, &data); while(ret != RET_OK) { ret = rx_obex_ftp_find_next(TRS_CALL handle, &data); } ret = rx_obex_ftp_find_done(TRS_CALL handle);

  14. Your Task 2 • Prepare simple application for support FTP browsing on remote device. Use OBEX API: • rx_obex_ftp_find_xxx() • rx_obex_ftp_chdir()

  15. Your Task 3 • Prepare simple application for support file transporting feature. Use OBEX API: • rx_obex_ftp_get_file() • rx_obex_ftp_put_file() • Additional: • add support showing progress bar on sending/receiving process • Add supporting for "the interruption of send/recvdata"

  16. THANK YOU

More Related