Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
connector_api.c
00001 /* 00002 * Copyright (c) 2013 Digi International Inc., 00003 * All rights not expressly granted are reserved. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 00007 * You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 00010 * ======================================================================= 00011 */ 00012 00013 /* This was moved here to correct a software engineering defect. 00014 * These defines need to be private 00015 */ 00016 00017 #include <stddef.h> 00018 00019 #define CONNECTOR_CONST_PROTECTION 00020 00021 /* WARNING: connector_api.h must be the first connector_* header file 00022 * to guarantee CONNECTOR_VERSION is properly applied to all files */ 00023 00024 #include "connector_api.h" 00025 #include "connector_debug.h" 00026 00027 #include "connector_info.h" 00028 #include "connector_def.h" 00029 00030 #include "chk_config.h" 00031 #include "bele.h" 00032 00033 static connector_status_t notify_error_status(connector_callback_t const callback, connector_class_id_t const class_number, connector_request_id_t const request_number, connector_status_t const status); 00034 #include "os_intf.h" 00035 #include "connector_global_config.h" 00036 00037 static connector_status_t connector_stop_callback(connector_data_t * const connector_ptr, connector_transport_t const transport, void * const user_context); 00038 #if !(defined CONNECTOR_NETWORK_TCP_START) || (defined CONNECTOR_TRANSPORT_UDP) || defined (CONNECTOR_TRANSPORT_SMS) 00039 static connector_status_t get_config_connect_status(connector_data_t * const connector_ptr, connector_request_id_config_t const request_id, connector_config_connect_type_t * const config_ptr); 00040 #endif 00041 00042 #if (defined CONNECTOR_DATA_POINTS) 00043 #include "connector_data_point.h" 00044 #endif 00045 00046 #if (defined CONNECTOR_TRANSPORT_TCP) 00047 #include "connector_edp.h" 00048 #endif 00049 00050 #if (defined CONNECTOR_SHORT_MESSAGE) 00051 #include "connector_sm.h" 00052 #endif 00053 00054 #ifdef CONNECTOR_NO_MALLOC 00055 #include "connector_static_buffer.h" 00056 #endif 00057 00058 #define DEVICE_ID_LENGTH 16 00059 00060 00061 static char const connector_signature[] = CONNECTOR_SW_VERSION; 00062 00063 #if !(defined CONNECTOR_NETWORK_TCP_START) || (defined CONNECTOR_TRANSPORT_UDP) || defined (CONNECTOR_TRANSPORT_SMS) 00064 static connector_status_t get_config_connect_status(connector_data_t * const connector_ptr, 00065 connector_request_id_config_t const config_request_id, 00066 connector_config_connect_type_t * const config_connect) 00067 { 00068 connector_status_t result = connector_working; 00069 00070 ASSERT(config_connect != NULL); 00071 ASSERT((config_request_id == connector_request_id_config_network_tcp) || 00072 (config_request_id == connector_request_id_config_network_udp) || 00073 (config_request_id == connector_request_id_config_network_sms)); 00074 00075 config_connect->type = connector_connect_auto; 00076 00077 { 00078 connector_callback_status_t status; 00079 connector_request_id_t request_id; 00080 00081 request_id.config_request = config_request_id; 00082 status = connector_callback(connector_ptr->callback, connector_class_id_config, request_id, config_connect); 00083 00084 switch (status) 00085 { 00086 case connector_callback_continue: 00087 switch (config_connect->type) 00088 { 00089 case connector_connect_auto: 00090 case connector_connect_manual: 00091 break; 00092 default: 00093 notify_error_status(connector_ptr->callback, connector_class_id_config, request_id, connector_invalid_data_range); 00094 result = connector_abort; 00095 break; 00096 } 00097 break; 00098 00099 case connector_callback_busy: 00100 case connector_callback_abort: 00101 case connector_callback_error: 00102 result = connector_abort; 00103 break; 00104 00105 case connector_callback_unrecognized: 00106 break; 00107 } 00108 } 00109 return result; 00110 } 00111 #endif 00112 00113 static connector_status_t get_wan_device_id(connector_data_t * const connector_ptr, 00114 uint8_t * const device_id, 00115 connector_request_id_config_t config_request) 00116 { 00117 00118 enum { 00119 imei_device_id_prefix = 1, 00120 esn_hex_device_id_prefix, 00121 esn_dec_device_id_prefix, 00122 meid_hex_device_id_prefix, 00123 meid_dec_device_id_prefix 00124 }; 00125 00126 connector_status_t result; 00127 00128 result = get_config_wan_id(connector_ptr, config_request); 00129 if (result == connector_working) 00130 { 00131 uint8_t * dst = device_id + (DEVICE_ID_LENGTH - connector_ptr->wan_id_length); 00132 00133 #if (defined CONNECTOR_DEBUG) 00134 { 00135 char * wan_string = NULL; 00136 00137 switch (connector_ptr->wan_type) 00138 { 00139 case connector_wan_type_imei: 00140 wan_string = "IMEI"; 00141 break; 00142 case connector_wan_type_esn: 00143 wan_string = "ESN"; 00144 break; 00145 case connector_wan_type_meid: 00146 wan_string = "MEID"; 00147 break; 00148 } 00149 connector_debug_hexvalue(wan_string, connector_ptr->wan_id, connector_ptr->wan_id_length); 00150 } 00151 #endif 00152 memcpy(dst, connector_ptr->wan_id, connector_ptr->wan_id_length); 00153 00154 switch (connector_ptr->wan_type) 00155 { 00156 case connector_wan_type_imei: 00157 device_id[1] = imei_device_id_prefix; 00158 break; 00159 case connector_wan_type_esn: 00160 device_id[1] = esn_hex_device_id_prefix; 00161 break; 00162 case connector_wan_type_meid: 00163 device_id[1] = meid_hex_device_id_prefix; 00164 break; 00165 } 00166 } 00167 00168 return result; 00169 } 00170 00171 00172 static connector_status_t manage_device_id(connector_data_t * const connector_ptr) 00173 { 00174 connector_status_t result = connector_working; 00175 00176 connector_ptr->connector_got_device_id = connector_false; 00177 00178 result = get_config_device_id_method(connector_ptr); 00179 COND_ELSE_GOTO(result == connector_working, error); 00180 00181 switch (connector_ptr->device_id_method) 00182 { 00183 case connector_device_id_method_manual: 00184 result = get_config_device_id(connector_ptr); 00185 COND_ELSE_GOTO(result == connector_working, error); 00186 { 00187 uint8_t const null_device_id[DEVICE_ID_LENGTH] = {0x00}; 00188 /* If the returned Device ID is zero, Cloud Connector will ask the Device Cloud for a Device ID. */ 00189 if (memcmp(connector_ptr->device_id, null_device_id, sizeof null_device_id) == 0) 00190 connector_ptr->connector_got_device_id = connector_false; 00191 else 00192 connector_ptr->connector_got_device_id = connector_true; 00193 } 00194 break; 00195 00196 case connector_device_id_method_auto: 00197 { 00198 result = get_config_connection_type(connector_ptr); 00199 COND_ELSE_GOTO(result == connector_working, error); 00200 00201 switch (connector_ptr->connection_type) 00202 { 00203 case connector_connection_type_lan: 00204 { 00205 result = get_config_mac_addr(connector_ptr); 00206 COND_ELSE_GOTO(result == connector_working, error); 00207 00208 connector_ptr->device_id[8] = connector_ptr->mac_addr[0]; 00209 connector_ptr->device_id[9] = connector_ptr->mac_addr[1]; 00210 connector_ptr->device_id[10] = connector_ptr->mac_addr[2]; 00211 connector_ptr->device_id[11] = 0xFF; 00212 connector_ptr->device_id[12] = 0xFF; 00213 connector_ptr->device_id[13] = connector_ptr->mac_addr[3]; 00214 connector_ptr->device_id[14] = connector_ptr->mac_addr[4]; 00215 connector_ptr->device_id[15] = connector_ptr->mac_addr[5]; 00216 } 00217 break; 00218 00219 case connector_connection_type_wan: 00220 { 00221 result = get_config_wan_type(connector_ptr); 00222 COND_ELSE_GOTO(result == connector_working, error); 00223 00224 switch (connector_ptr->wan_type) 00225 { 00226 case connector_wan_type_imei: 00227 result = get_wan_device_id(connector_ptr, connector_ptr->device_id, connector_request_id_config_imei_number); 00228 break; 00229 case connector_wan_type_esn: 00230 result = get_wan_device_id(connector_ptr, connector_ptr->device_id, connector_request_id_config_esn); 00231 break; 00232 case connector_wan_type_meid: 00233 result = get_wan_device_id(connector_ptr, connector_ptr->device_id, connector_request_id_config_meid); 00234 break; 00235 } 00236 break; 00237 } 00238 } 00239 connector_ptr->connector_got_device_id = connector_true; 00240 break; 00241 } 00242 } 00243 COND_ELSE_GOTO(result == connector_working, error); 00244 00245 error: 00246 return result; 00247 } 00248 00249 static connector_status_t connector_stop_callback(connector_data_t * const connector_ptr, connector_transport_t const transport, void * const user_context) 00250 { 00251 connector_status_t result = connector_working; 00252 00253 connector_initiate_stop_request_t stop_request; 00254 00255 connector_request_id_t request_id; 00256 request_id.status_request = connector_request_id_status_stop_completed; 00257 00258 stop_request.transport = transport; 00259 stop_request.user_context = user_context; 00260 00261 { 00262 connector_callback_status_t const status = connector_callback(connector_ptr->callback, connector_class_id_status, request_id, &stop_request); 00263 00264 switch (status) 00265 { 00266 case connector_callback_continue: 00267 case connector_callback_unrecognized: 00268 break; 00269 case connector_callback_busy: 00270 result = connector_pending; 00271 break; 00272 default: 00273 result = connector_abort; 00274 break; 00275 } 00276 } 00277 00278 connector_debug_printf("connector_stop_callback: %s\n", transport_to_string(transport)); 00279 return result; 00280 } 00281 00282 00283 #define CONNECTOR_IS_STOP(state, value) ((state) == (value)) 00284 00285 static connector_bool_t is_connector_stopped(connector_data_t * const connector_ptr, connector_close_status_t const close_status) 00286 { 00287 int count = 0; 00288 connector_transport_state_t wait_state = (close_status == connector_close_status_device_stopped) ? connector_transport_idle : connector_transport_terminate; 00289 00290 #if (defined CONNECTOR_TRANSPORT_UDP) 00291 if (!connector_bool(CONNECTOR_IS_STOP(connector_ptr->sm_udp.transport.state, wait_state))) count++; 00292 #endif 00293 00294 #if (defined CONNECTOR_TRANSPORT_SMS) 00295 if (!connector_bool(CONNECTOR_IS_STOP(connector_ptr->sm_sms.transport.state, wait_state))) count++; 00296 #endif 00297 00298 #if (defined CONNECTOR_TRANSPORT_TCP) 00299 if (!connector_bool(CONNECTOR_IS_STOP(edp_get_active_state(connector_ptr), wait_state))) count++; 00300 #endif 00301 00302 return connector_bool(count == 0); 00303 } 00304 00305 static void abort_connector(connector_data_t * const connector_ptr) 00306 { 00307 switch (connector_ptr->stop.state) 00308 { 00309 case connector_state_terminate_by_initiate_action: 00310 case connector_state_abort_by_callback: 00311 /* already shutting down - nothing to do here. */ 00312 break; 00313 00314 default: 00315 { 00316 connector_status_t status; 00317 00318 #if (defined CONNECTOR_TRANSPORT_UDP) ||(defined CONNECTOR_TRANSPORT_SMS) 00319 status = sm_initiate_action(connector_ptr, connector_initiate_terminate, NULL); 00320 if (status != connector_success) 00321 connector_debug_printf("abort_connector: sm_initiate_action returns error %d\n", status); 00322 00323 #if (defined CONNECTOR_TRANSPORT_UDP) 00324 connector_ptr->sm_udp.close.status = connector_close_status_abort; 00325 #endif 00326 00327 #if (defined CONNECTOR_TRANSPORT_SMS) 00328 connector_ptr->sm_sms.close.status = connector_close_status_abort; 00329 #endif 00330 #endif 00331 00332 00333 #if (defined CONNECTOR_TRANSPORT_TCP) 00334 status = edp_initiate_action(connector_ptr, connector_initiate_terminate, NULL); 00335 if (status != connector_success) 00336 connector_debug_printf("abort_connector: edp_initiate_action returns error %d\n", status); 00337 00338 edp_set_close_status(connector_ptr, connector_close_status_abort); 00339 #endif 00340 00341 connector_ptr->stop.state = connector_state_abort_by_callback; 00342 break; 00343 } 00344 } 00345 } 00346 00347 connector_handle_t connector_init(connector_callback_t const callback) 00348 { 00349 00350 connector_data_t * connector_handle = NULL; 00351 connector_status_t status; 00352 00353 #if (defined CONNECTOR_SW_DESCRIPTION) 00354 connector_debug_printf("Cloud Connector v%s %s\n", CONNECTOR_SW_VERSION, CONNECTOR_SW_DESCRIPTION); 00355 #else 00356 connector_debug_printf("Cloud Connector v%s\n", CONNECTOR_SW_VERSION); 00357 #endif 00358 00359 { 00360 void * handle; 00361 00362 #if (defined CONNECTOR_NO_MALLOC) 00363 status = malloc_data_buffer(NULL, sizeof *connector_handle, named_buffer_id(connector_data), &handle); 00364 #else 00365 status = malloc_cb(callback, sizeof *connector_handle, &handle); 00366 #endif 00367 00368 COND_ELSE_GOTO(status == connector_working, done); 00369 memset(handle, 0x00, sizeof *connector_handle); /* Init structure, all pointers to NULL */ 00370 connector_handle = handle; 00371 } 00372 00373 connector_handle->callback = callback; 00374 00375 status = manage_device_id(connector_handle); 00376 COND_ELSE_GOTO(status == connector_working, error); 00377 00378 /* make a copy of the cloud url */ 00379 #if (defined CONNECTOR_TRANSPORT_TCP) || (defined CONNECTOR_TRANSPORT_UDP) 00380 #if (defined CONNECTOR_CLOUD_URL) 00381 { 00382 static char const connector_device_cloud_url[]= CONNECTOR_CLOUD_URL; 00383 connector_handle->device_cloud_url = (char *)connector_device_cloud_url; 00384 connector_handle->device_cloud_url_length = sizeof connector_device_cloud_url -1; 00385 } 00386 #else 00387 status = get_config_device_cloud_url(connector_handle); 00388 COND_ELSE_GOTO(status == connector_working, error); 00389 #endif 00390 #endif /* (defined CONNECTOR_TRANSPORT_TCP) || (defined CONNECTOR_TRANSPORT_UDP) */ 00391 00392 /* make a copy of the cloud phone */ 00393 #if (defined CONNECTOR_TRANSPORT_SMS) 00394 #if (defined CONNECTOR_CLOUD_PHONE) 00395 { 00396 static char const connector_device_cloud_phone[]= CONNECTOR_CLOUD_PHONE; 00397 connector_handle->device_cloud_phone = (char *)connector_device_cloud_phone; 00398 connector_handle->device_cloud_phone_length = sizeof connector_device_cloud_phone -1; 00399 } 00400 #else 00401 status = get_config_device_cloud_phone(connector_handle); 00402 COND_ELSE_GOTO(status == connector_working, error); 00403 #endif 00404 00405 #if (defined CONNECTOR_CLOUD_SERVICE_ID) 00406 { 00407 static char const connector_device_cloud_service_id[]= CONNECTOR_CLOUD_SERVICE_ID; 00408 connector_handle->device_cloud_service_id = (char *)connector_device_cloud_service_id; 00409 connector_handle->device_cloud_service_id_length = sizeof connector_device_cloud_service_id -1; 00410 } 00411 #else 00412 status = get_config_device_cloud_service_id(connector_handle); 00413 COND_ELSE_GOTO(status == connector_working, error); 00414 #endif 00415 #endif /* (defined CONNECTOR_TRANSPORT_SMS) */ 00416 00417 #if (defined CONNECTOR_TRANSPORT_TCP) 00418 status = connector_edp_init(connector_handle); 00419 COND_ELSE_GOTO(status == connector_working, error); 00420 #endif 00421 00422 #if (defined CONNECTOR_TRANSPORT_UDP) || (defined CONNECTOR_TRANSPORT_SMS) 00423 status = connector_sm_init(connector_handle); 00424 COND_ELSE_GOTO(status == connector_working, error); 00425 #endif 00426 00427 #if (defined CONNECTOR_TRANSPORT_COUNT > 1) 00428 connector_handle->first_running_network = (connector_network_type_t) 0; 00429 #endif 00430 00431 connector_handle->signature = connector_signature; 00432 goto done; 00433 00434 error: 00435 free_data_buffer(connector_handle, named_buffer_id(connector_data), connector_handle); 00436 connector_handle = NULL; 00437 00438 done: 00439 return connector_handle; 00440 } 00441 00442 00443 connector_status_t connector_step(connector_handle_t const handle) 00444 { 00445 connector_status_t result = connector_init_error; 00446 connector_data_t * const connector_ptr = handle; 00447 00448 ASSERT_GOTO(handle != NULL, done); 00449 00450 if (connector_ptr->signature != connector_signature) goto done; 00451 00452 switch (connector_ptr->stop.state) 00453 { 00454 case connector_state_running: 00455 break; 00456 case connector_state_stop_by_initiate_action: 00457 if (is_connector_stopped(connector_ptr, connector_close_status_device_stopped)) 00458 { 00459 result = connector_stop_callback(connector_ptr, connector_transport_all, connector_ptr->stop.user_context); 00460 if (result == connector_abort) 00461 { 00462 goto error; 00463 } 00464 else if (result == connector_working) 00465 { 00466 connector_ptr->stop.state = connector_state_running; 00467 } 00468 } 00469 break; 00470 case connector_state_abort_by_callback: 00471 case connector_state_terminate_by_initiate_action: 00472 if (is_connector_stopped(connector_ptr, connector_close_status_device_terminated)) 00473 { 00474 connector_ptr->connector_got_device_id = connector_false; /* TODO, Probably this should not be done with provisioning! */ 00475 connector_ptr->signature = NULL; 00476 free_data_buffer(connector_ptr, named_buffer_id(connector_data), connector_ptr); 00477 connector_debug_printf("connector_step: free Cloud Connector\n"); 00478 00479 result = (connector_ptr->stop.state == connector_state_terminate_by_initiate_action) ? connector_device_terminated : connector_abort; 00480 goto done; 00481 } 00482 break; 00483 default: 00484 break; 00485 } 00486 00487 #if (CONNECTOR_TRANSPORT_COUNT == 1) 00488 #if (defined CONNECTOR_TRANSPORT_TCP) 00489 result = connector_edp_step(connector_ptr); 00490 #endif 00491 #if (defined CONNECTOR_TRANSPORT_UDP) 00492 result = connector_udp_step(connector_ptr); 00493 #endif 00494 #if (defined CONNECTOR_TRANSPORT_SMS) 00495 result = connector_sms_step(connector_ptr); 00496 #endif 00497 00498 #else 00499 { 00500 #define next_network(current_network) (((current_network) == last_network_index) ? first_network_index : (connector_network_type_t) ((current_network) + 1)) 00501 00502 connector_network_type_t const first_network_index = (connector_network_type_t) 0; 00503 connector_network_type_t const last_network_index = (connector_network_type_t) (connector_network_count - 1); 00504 connector_network_type_t const first_network_checked = connector_ptr->first_running_network; 00505 connector_network_type_t current_network = first_network_checked; 00506 00507 do 00508 { 00509 connector_status_t (*step_func)(connector_data_t * const connector_ptr); 00510 00511 switch (current_network) 00512 { 00513 #if (defined CONNECTOR_TRANSPORT_TCP) 00514 case connector_network_tcp: step_func = connector_edp_step; break; 00515 #endif 00516 #if (defined CONNECTOR_TRANSPORT_UDP) 00517 case connector_network_udp: step_func = connector_udp_step; break; 00518 #endif 00519 #if (defined CONNECTOR_TRANSPORT_SMS) 00520 case connector_network_sms: step_func = connector_sms_step; break; 00521 #endif 00522 default: 00523 ASSERT(connector_false); 00524 result = connector_abort; 00525 goto error; break; 00526 } 00527 00528 result = step_func(connector_ptr); 00529 00530 current_network = next_network(current_network); 00531 } while ((current_network != first_network_checked) && (result == connector_idle)); 00532 00533 connector_ptr->first_running_network = (result == connector_idle) ? next_network(first_network_checked): current_network; 00534 00535 #undef next_network 00536 } 00537 #endif 00538 00539 error: 00540 switch (result) 00541 { 00542 case connector_abort: 00543 abort_connector(connector_ptr); 00544 /* no break; */ 00545 case connector_device_terminated: 00546 result = connector_working; 00547 break; 00548 default: 00549 break; 00550 } 00551 00552 done: 00553 return result; 00554 } 00555 00556 connector_status_t connector_run(connector_handle_t const handle) 00557 { 00558 connector_status_t rc; 00559 00560 do { 00561 rc = connector_step(handle); 00562 00563 if (rc == connector_idle || rc == connector_working || rc == connector_pending || rc == connector_active || rc == connector_success) 00564 { 00565 if (yield_process(handle, rc) != connector_working) 00566 { 00567 abort_connector(handle); 00568 rc = connector_success; 00569 } 00570 } 00571 00572 } while (rc == connector_idle || rc == connector_working || rc == connector_pending || rc == connector_active || rc == connector_success); 00573 00574 return rc; 00575 } 00576 00577 connector_status_t connector_initiate_action(connector_handle_t const handle, connector_initiate_request_t const request, void const * const request_data) 00578 { 00579 connector_status_t result = connector_init_error; 00580 connector_data_t * connector_ptr = (connector_data_t *)handle; 00581 00582 ASSERT_GOTO(handle != NULL, done); 00583 00584 if (connector_ptr->signature != connector_signature) goto done; 00585 00586 switch (request) 00587 { 00588 case connector_initiate_terminate: 00589 00590 #if (defined CONNECTOR_TRANSPORT_TCP) 00591 result = edp_initiate_action(connector_ptr, request, request_data); 00592 COND_ELSE_GOTO(result == connector_success, done); 00593 #endif 00594 00595 #if (defined CONNECTOR_SHORT_MESSAGE) 00596 result = sm_initiate_action(connector_ptr, request, request_data); 00597 COND_ELSE_GOTO(result == connector_success, done); 00598 #endif 00599 00600 connector_ptr->stop.state = connector_state_terminate_by_initiate_action; 00601 result = connector_success; 00602 break; 00603 00604 default: 00605 if (connector_ptr->stop.state == connector_state_terminate_by_initiate_action) 00606 { 00607 result = connector_device_terminated; 00608 goto done; 00609 } 00610 00611 { 00612 connector_transport_t const * const transport = request_data; 00613 00614 result = connector_unavailable; 00615 00616 if (transport == NULL) 00617 { 00618 result = connector_invalid_data; 00619 goto done; 00620 } 00621 00622 switch (*transport) 00623 { 00624 case connector_transport_all: 00625 if (request != connector_initiate_transport_stop) 00626 { 00627 result = connector_invalid_data; 00628 goto done; 00629 } 00630 00631 if (connector_ptr->stop.state != connector_state_running) 00632 { 00633 /* already in close state */ 00634 result = (connector_ptr->stop.state == connector_state_terminate_by_initiate_action) ? connector_device_terminated: connector_service_busy; 00635 goto done; 00636 } 00637 00638 /* no break */ 00639 00640 #if (defined CONNECTOR_SHORT_MESSAGE) 00641 #if (defined CONNECTOR_TRANSPORT_UDP) 00642 case connector_transport_udp: 00643 #endif 00644 #if (defined CONNECTOR_TRANSPORT_SMS) 00645 case connector_transport_sms: 00646 #endif 00647 result = sm_initiate_action(connector_ptr, request, request_data); 00648 00649 if (*transport != connector_transport_all) break; 00650 else if (result != connector_success) break; 00651 else if (request != connector_initiate_transport_stop) break; 00652 /* no break; */ 00653 #endif 00654 00655 #if (defined CONNECTOR_TRANSPORT_TCP) 00656 case connector_transport_tcp: 00657 result = edp_initiate_action(connector_ptr, request, request_data); 00658 00659 if (*transport != connector_transport_all) break; 00660 else if (result != connector_success) break; 00661 else if (request != connector_initiate_transport_stop) break; 00662 #endif 00663 { 00664 connector_initiate_stop_request_t const * const stop_request = request_data; 00665 connector_ptr->stop.condition = stop_request->condition; 00666 connector_ptr->stop.user_context = stop_request->user_context; 00667 connector_ptr->stop.state = connector_state_stop_by_initiate_action; 00668 result = connector_success; 00669 } 00670 break; 00671 00672 default: 00673 result = connector_invalid_data; 00674 goto done; 00675 } 00676 } 00677 } 00678 done: 00679 return result; 00680 }
Generated on Tue Jul 12 2022 19:18:38 by
1.7.2