### Wi-Fi Direct Initialization and Activation Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md This example demonstrates the basic lifecycle of Wi-Fi Direct: initialization, setting up state change callbacks, activation, starting discovery, and finally deactivation and cleanup. Ensure Wi-Fi Direct is activated before starting discovery and deactivated when no longer needed. ```c #include #include int function(void); bool device_selected = false; void peers_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { if (peer && !device_selected) { printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); device_selected = true; wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer } } int function(void) { int ret; char *ip; ret = wifi_direct_get_ip_address(&ip); // get ip address if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to connect the peer\n"); return -1; } printf("IP address=%s\n", ip); g_free(ip); return 0; } void callback_2(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTION_RSP: printf("Connected\n"); function(); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected\n"); break; } } void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); wifi_direct_foreach_discovered_peers(peers_cb, NULL); break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default: break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Client-side Query Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__IOT__CONNECTIVITY__COMMON__QUERY__MODULE.md Example demonstrating how to create, add a key-value pair to, and use a query handle for a GET request on the client side. ```C #include ... static void _request_get(iotcon_remote_resource_h resource) { int ret; iotcon_query_h query = NULL; ret = iotcon_query_create(&query); if (IOTCON_ERROR_NONE != ret) return; ret = iotcon_query_add(query, "key", "value"); if (IOTCON_ERROR_NONE != ret) { iotcon_query_destroy(query); return; } ret = iotcon_remote_resource_get(resource, query, _on_get, NULL); if (IOTCON_ERROR_NONE != ret) { iotcon_query_destroy(query); return; } iotcon_query_destroy(query); } ``` -------------------------------- ### Camera Display Setup and Preview Start Source: https://samsungtizenos.com/docs/application/dotnet/guides/multimedia/face-detection.md Configures the camera display, registers the preview event handler, and starts the camera preview. It also iterates through supported preview formats to set an appropriate one. ```csharp /// Set the camera display camera.Display = new Display(new Window("Preview")); /// Register the camera preview event handler camera.Preview += PreviewCallback; IList previewFormats = camera.Feature.SupportedPreviewPixelFormats.ToList(); foreach (CameraPixelFormat previewFormat in previewFormats) { camera.Setting.PreviewPixelFormat = previewFormat; break; } /// Start the camera preview camera.StartPreview(); ``` -------------------------------- ### Get Audio Channel Mask Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__MEDIA__TOOL__MEDIA__FORMAT__MODULE.md Example demonstrating how to retrieve audio channel mask and convert it to positions. Requires allocating memory for positions. ```c int channels; uint64_t channel_mask; media_format_channel_position_e *positions; media_format_get_audio_info(fmt, NULL, &channels, NULL, NULL, NULL); positions = malloc(channels * sizeof(media_format_channel_position_e)); media_format_get_audio_channel_mask(fmt, &channel_mask); media_format_channel_positions_from_mask(fmt, channel_mask, &positions); ... free(positions); ``` -------------------------------- ### Example of Publishing Multiple Sensor Events Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__SYSTEM__SENSOR__PROVIDER__MODULE.md Demonstrates the setup and publishing of an array of sensor events using `sensor_provider_publish_events()`. ```c ... sensor_event_s events[10]; ... for (int i = 0; i < 10; ++i) { events[i].accuracy = 3; events[i].timestamp = timestamp; events[i].value_count = 3; events[i].values[0] = i; events[i].values[1] = i + 2; events[i].values[2] = i + 4; } ... sensor_provider_publish_events(provider, events, 10); ``` -------------------------------- ### i18n_udate_get_2digit_year_start Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__BASE__UTILS__I18N__UDATE__MODULE.md Gets the year relative to which all 2-digit years are interpreted. For example, if the 2-digit start year is 2100, the year 99 will be interpreted as 2199. ```APIDOC ## i18n_udate_get_2digit_year_start ### Description Gets the year relative to which all 2-digit years are interpreted. For example, if the 2-digit start year is 2100, the year 99 will be interpreted as 2199. ### Parameters - **format** (const i18n_udate_format_h) - Required - The i18n_udate_format_h to get. - **year** (i18n_udate *) - Output - A pointer to the year relative to which all 2-digit years are interpreted. ### Returns - **I18N_ERROR_NONE** - Successful - **I18N_ERROR_INVALID_PARAMETER** - Invalid function parameter ### See Also - i18n_udate_set_2digit_year_start() ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates the complete lifecycle of Wi-Fi Direct, including initialization, activation, setting a discovery state callback, starting discovery, and subsequent cleanup. It also shows how to check if the device is discoverable within the callback and in the main function. ```c #include #include int function(void) { int ret; bool discoverable; ret = wifi_direct_is_discoverable(&discoverable); // check if device is discoverable if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to get discoverable property\n"); return -1; } printf("discoverable=%s\n", discoverable?"Yes":"No"); return 0; } void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); function(); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); function(); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); function(); break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default: break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_start_discovery(TRUE, 15); // Start discovery function(); // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Run the Example App Source: https://samsungtizenos.com/docs/application/flutter/guides/flutter-tizen/doc/develop-plugin-csharp.md Navigate to the example directory within your plugin project and run this command to test your plugin. ```bash cd plugin_name/example flutter-tizen run ``` -------------------------------- ### Get Installed Applications Async Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.Applications.ApplicationManager.md Retrieves information about all installed applications on the device. Use this to get a comprehensive list of installed apps. ```csharp var listApp = await ApplicationManager.GetInstalledApplicationsAsync(); Assert.IsNotEmpty(_listApp, "The list of installed app should not be empty."); foreach (ApplicationInfo instapp in _listApp) { Console.WriteLine(instapp.ApplicationId); } ``` -------------------------------- ### DownloadProgress Start Property Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.Multimedia.DownloadProgress.md Gets or sets the starting position of the download in percentage. ```csharp public int Start { readonly get; set; } ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates the complete lifecycle of Wi-Fi Direct, including initialization, activation, setting a discovery state callback, starting discovery, and subsequent cleanup. Ensure Wi-Fi Direct is properly initialized and deinitialized. ```c int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_start_discovery(TRUE, 15); // Start discovery function(); // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Get Battery Percent Example Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.System.Battery.md Example of how to retrieve and display the current battery percentage. ```APIDOC ## Example ```csharp Console.WriteLine("battery Percent is: {0}", Tizen.System.Battery.Percent); ``` ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates the complete lifecycle of Wi-Fi Direct usage, including initialization, setting up callbacks, activation, starting discovery, and cleanup. Ensure Wi-Fi Direct service is activated before use. ```c #include #include bool peer_selected = false; int connection_timeout = 0; int count = 0; // counter to wait for connection int function(char *mac); void peers_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { char *mac; if (peer && !peer_selected) { printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); peer_selected = true; function(peer->mac_address); wifi_direct_connect(peer->mac_address); // Connect to the selected peer } } int function(char *mac) { int ret; ret = wifi_direct_set_autoconnection_peer(mac); // set autoconnection if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to set autoconnection for peer\n"); return -1; } printf("set auto-connection success\n"); return 0; } void callback_2(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTON_RSP: printf("Connected\n"); g_source_remove(connection_timeout); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected\n"); break; } } void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); wifi_direct_foreach_discovered_peers(peers_cb, NULL); // Get discovered peer break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default:break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_connection_state_changed_cb(); // Deregister callback 2 wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback 1 wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Wi-Fi Direct Connection Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates how to initialize Wi-Fi Direct, set up callbacks for discovery and connection state changes, activate the service, start discovery, and then deactivate and clean up the service. This example connects to the first discovered peer. ```c #include #include bool device_selected = false; void peers_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { if (peer && !device_selected) { printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); device_selected = true; function(peer->mac_address); // Connect to the first discovered peer } } int function(const char *mac) { int ret; ret = wifi_direct_connect(mac); // connect to the peer device if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to connect the peer\n"); return -1; } return 0; } void callback_2(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTION_RSP: printf("Connected\n"); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected\n"); break; } } void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); wifi_direct_foreach_discovered_peers(peers_cb, NULL); // Get discovered peer break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default: break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Getting Power Source Example Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.System.Battery.md Example of how to retrieve the current power source of the device. ```APIDOC ## Example: Get Power Source ```csharp using Tizen.System; BatteryPowerSource PowerSourceType = Battery.PowerSource; if (PowerSourceType == BatteryPowerSource.None) // ... ``` ``` -------------------------------- ### Getting Battery Percent Example Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.System.Battery.md Example of how to retrieve and display the current battery percentage. ```APIDOC ## Example: Get Battery Percent ```csharp Console.WriteLine("battery Percent is: {0}", Tizen.System.Battery.Percent); ``` ``` -------------------------------- ### Manifest Start URL Get Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__WEBVIEW.md Retrieves the start URL from a manifest object. This API is deprecated. ```APIDOC ## ewk_manifest_start_url_get ### Description Get the start url of the manifest. ### Signature const char * | ewk_manifest_start_url_get (Ewk_View_Request_Manifest *manifest) ### Parameters * **manifest** (Ewk_View_Request_Manifest *) - The manifest object. ### Returns (const char *) - The start URL string. ### Remarks Deprecated API. ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates the complete lifecycle of Wi-Fi Direct, including initialization, setting up callbacks for discovery and connection states, activating the service, starting discovery, and finally deactivating the service. Ensure Wi-Fi Direct is activated before starting discovery and deactivated before deinitialization. ```c #include #include int function(void); bool device_selected = false; void peers_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { if (peer && !device_selected) { printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); device_selected = true; wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer } } int function(void) { int ret; char *subnet; char *ip; wifi_direct_get_ip_address(&ip); // get ip address ret = wifi_direct_get_subnet_mask(&subnet); // get subnet mask if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to get subnet mask\n"); return -1; } printf("subnet address=%s\n", subnet); g_free(ip); g_free(subnet); return 0; } void callback_2(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTON_RSP: printf("Connected\n"); function(); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected\n"); break; } *} void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); wifi_direct_foreach_discovered_peers(peers_cb, NULL); break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default:break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Get Battery Power Source Example Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.System.Battery.md Example of how to retrieve the current battery power source. ```APIDOC ## Example ```csharp using Tizen.System; ... BatteryPowerSource PowerSourceType = Battery.PowerSource; if (PowerSourceType == BatteryPowerSource.None) ... ... ``` ``` -------------------------------- ### VCE Initialization and Main Entry Point Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__UIX__VOICE__CONTROL__ENGINE__MODULE.md Demonstrates the setup of VCE callback functions and the invocation of the main VCE function. It also shows how to register service application event handlers. ```c #include // Required callback functions - MUST BE IMPLEMENTED static int vce_default_initialize(); static int vce_default_deinitialize(void); static int vce_default_get_info(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network); static int vce_default_get_recording_format(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels); static int vce_default_foreach_langs(vce_supported_language_cb callback, void* user_data); static bool vce_default_is_lang_supported(const char* lang); static int vce_default_set_language(const char* language); static int vce_default_set_commands(vce_cmd_h vc_command); static int vce_default_unset_commands(); static int vce_default_start(bool stop_by_silence); static int vce_default_set_recording(const void* data, unsigned int length, vce_speech_detect_e* silence_detected); static int vce_default_stop(); static int vce_default_cancel(void); static int vce_default_set_audio_type(const char* audio_type); static int vce_default_set_domain(const char* domain); static int vce_default_process_text(const char* text); static int vce_default_process_list_event(const char* event); static int vce_default_process_haptic_event(const char* event); // Optional callback function static int vce_default_private_data_set_cb(const char* key, const char* data); int main(int argc, char* argv[]) { // 1. Create a structure 'vce_request_callback_s' vce_request_callback_s callback = {0,}; callback.version = 1; callback.initialize = vce_default_initialize; callback.deinitialize = vce_default_deinitialize; callback.get_info = vce_default_get_info; callback.get_recording_format = vce_default_get_recording_format; callback.foreach_langs = vce_default_foreach_langs; callback.is_lang_supported = vce_default_is_lang_supported; callback.set_language = vce_default_set_language; callback.set_commands = vce_default_set_commands; callback.unset_commands = vce_default_unset_commands; callback.start = vce_default_start; callback.set_recording = vce_default_set_recording; callback.stop = vce_default_stop; callback.cancel = vce_default_cancel; callback.set_audio_type = vce_default_set_audio_type; callback.set_domain = vce_default_set_domain; callback.process_text = vce_default_process_text; callback.process_list_event = vce_default_process_list_event; callback.process_haptic_event = vce_default_process_haptic_event; // 2. Run 'vce_main()' if (0 != vce_main(argc, argv, &callback)) { SLOG(LOG_ERROR, TAG_VCE, "[ERROR] Fail to vce main"); return -1; } // Optional vce_set_private_data_set_cb(vce_default_private_data_set_cb); // 3. Set event callbacks for service app and Run 'service_app_main()' char ad[50] = {0,}; vce_request_callback_s callback = {0,}; service_app_lifecycle_callback_s event_callback; app_event_handler_h handlers[5] = {NULL, }; event_callback.create = service_app_create; event_callback.terminate = service_app_terminate; event_callback.app_control = service_app_control; service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); return service_app_main(argc, argv, &event_callback, ad); } ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Initializes Wi-Fi Direct, registers callbacks for discovery and connection state changes, activates the service, and starts the discovery process. Ensure cleanup is performed before exiting. ```c #include #include bool peer_selected = false; int connection_timeout = 0; int count = 0; // counter to wait for connection int function(char *mac); gboolean connection_timeout_cb(gpointer data) { char *mac = (char *)data; if (count < 3) { count++; return TRUE; } function(mac); // cancel ongoing connection g_free(mac); return FALSE; } void peers_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { char *mac; if (peer && !peer_selected) { printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); mac = g_strdup(peer->mac_address); peer_selected = true; wifi_direct_connect(mac); // Connect to the selected peer connection_timeout = g_timeout_add(1000, connection_timeout_cb, mac); // Add 3secs timeout } } int function(char *mac) { int ret; ret = wifi_direct_cancel_connection(mac); // cancel connection if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to cancel the ongoing connection\n"); return -1; } return 0; } void callback_2(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTION_RSP: printf("Connected\n"); g_source_remove(connection_timeout); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected\n"); break; } } void callback_1(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); wifi_direct_foreach_discovered_peers(peers_cb, NULL); // Get discovered peer break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default:break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1 wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_connection_state_changed_cb(); // Deregister callback 2 wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback 1 wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### StartRowIndex Property Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.Content.MediaContent.SelectArguments.md Gets or sets the starting row position of a query, where the index starts from zero. ```APIDOC ## Property StartRowIndex Gets or sets the starting row position of a query (starting from zero). ### Declaration ```csharp public int StartRowIndex { get; set; } ``` ### Property Value Type: int Description: An integer value that indicates the starting row position of a query. ### Remarks A filter is required for filtering information associated with Album, Folder, Tag, Bookmark, Playlist, and MediaInfo. ### Exceptions Type: ArgumentOutOfRangeException Condition: `value` is less than zero. ``` -------------------------------- ### Wi-Fi Direct Initialization and Usage Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md This example demonstrates the complete lifecycle of Wi-Fi Direct usage, including initialization, activation, setting callbacks, connecting to a peer, and deactivation. Ensure Wi-Fi Direct service is activated before use. ```c #include #include bool callback_2(wifi_direct_connected_peer_info_s* peer, void* user_data) { if (peer) { printf("connected device=%s mac=%s\n", peer->device_name, peer->mac_address); } } void callback_1(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { switch (state) { case WIFI_DIRECT_CONNECTION_IN_PROGRESS: printf("Connection in progress\n"); break; case WIFI_DIRECT_CONNECTION_RSP: printf("Connected\n"); break; case WIFI_DIRECT_DISCONNECTION_IND: printf("Disconnection IND\n"); break; case WIFI_DIRECT_DISCONNECTION_RSP; printf("Disconnected mac=%s\n", mac_address); // disconnect notification break; } } int function(char *mac) { int res; res = wifi_direct_disconnect(mac); // disconnect the connected peer with input mac if (res != WIFI_DIRECT_ERROR_NONE) { printf("Failed to disconnect all clients\n"); return -1; } return 0; } int main() { char mac[16] = {0,}; wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1 wifi_direct_activate(); // Activate Wi-Fi Direct * wifi_direct_foreach_connected_peers(callback_2, NULL); // Register callback_2 printf("Enter the connected peer mac address\n"); read(stdin, mac, 15); function(mac); // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_connection_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Get Animation Start Time List Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.NUI.Animation.md Retrieves a list of the start times for each property of the animation. ```csharp public IList StartTimeList { get; } ``` -------------------------------- ### Get Installed Autofill Service List Source: https://samsungtizenos.com/docs/application/native/guides/text-input/autofill-manager.md Implement a callback function to process information for each installed autofill service. Then, use `autofill_manager_foreach_autofill_service` to iterate through all installed services. ```c #include static bool autofill_service_info_cb(const char* app_id, void* user_data) { app_info_h app_h; char *label = NULL; app_info_create(app_id, &app_h); app_info_get_label(app_h, &label); dlog_print(DLOG_INFO, LOG_TAG, "app id : %s, label : %s", app_id, label); if (label) free(label); app_info_destroy(app_h); return true; } ``` ```c ret = autofill_manager_foreach_autofill_service(amh, autofill_service_info_cb, NULL); if (AUTOFILL_ERROR_NONE != ret) /* Error handling */ ``` -------------------------------- ### Create and Manage Accounts Source: https://samsungtizenos.com/docs/application/native/guides/personal/account.md Create accounts, insert them into the database, display them, and then destroy their handles. This example demonstrates creating multiple accounts and retrieving package names. ```c Create_Account(&account, "Updater", "Updated?", "ToUpdate", "not.up@to.date"); account_insert_to_db(account, &id); Show_Account(account); account_destroy(account); Create_Account(&account, "Another", "Updated?", "ToUpdate", "not.up@to.date"); account_insert_to_db(account, &id); account_get_package_name(account, &package_name); sprintf(buf, "Package_name: %s\n", package_name); Show_Account(account); account_destroy(account); ``` -------------------------------- ### Start() Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.Multimedia.Remoting.MediaControlServer.md Starts the media control server. When the server starts, ServerStarted will be raised. ```APIDOC ## Start() ### Description Starts the media control server. When the server starts, ServerStarted will be raised. ### Method public static void Start() ### Exceptions - System.InvalidOperationException: An internal error occurs. - System.UnauthorizedAccessException: Caller does not have required privilege. ### See Also - ServerStarted ``` -------------------------------- ### PreEditAttribute Start Property Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.Uix.InputMethod.PreEditAttribute.md Gets or sets the starting position of the attribute within the string. This indicates where the attribute begins. ```csharp public uint Start { get; set; } ``` -------------------------------- ### Basic GLView Initialization and Rendering Setup Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__Elm__Glview__Group.md Illustrates how to initialize a GLView widget and set up the necessary callback functions for rendering using OpenGL in an Elementary environment. This is a foundational example for GLView usage. ```c Evas_Object *glview; glview = elm_glview_add(win); elm_glview_render_func_set(glview, render_func); elm_glview_resize_func_set(glview, resize_func); elm_glview_del_func_set(glview, delete_func); elm_glview_mode_set(glview, ELM_GLVIEW_NONE); elm_glview_render_policy_set(glview, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); elm_glview_resize_policy_set(glview, ELM_GLVIEW_RESIZE_POLICY_DYNAMIC); evas_object_show(glview); ``` -------------------------------- ### Get All Installed Packages Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.Applications.PackageManager.md Retrieves information for all packages installed on the device. This is a fundamental operation for understanding the application landscape. ```csharp public static IEnumerable GetPackages() ``` -------------------------------- ### Wi-Fi Direct Initialization and Discovery Example Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Initializes Wi-Fi Direct, sets a callback for discovery state changes, activates the service, starts discovery, and then cleans up. The discovery callback handles events like discovery starting, stopping, and peers being found. ```c #include #include void function_cb(wifi_direct_discovered_peer_info_s* peer, void *user_data) { if (peer) printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address); } int function(void) { int ret; ret = wifi_direct_foreach_discovered_peers(function_cb, NULL); // get discovered peer devices info if (ret != WIFI_DIRECT_ERROR_NONE) { printf("Failed to get discovered peers\n"); return -1; } return 0; } void callback(int error_code, wifi_direct_discovery_state_e discovery_state, void *user_data) { switch(discovery_state) { case WIFI_DIRECT_DISCOVERY_STARTED: printf("Discovery started\n"); break; case WIFI_DIRECT_ONLY_LISTEN_STARTED: printf("listen started\n"); break; case WIFI_DIRECT_DISCOVERY_FINISHED: printf("Discovery finished\n"); function(); break; case WIFI_DIRECT_DISCOVERY_FOUND: printf("peer devices found\n"); break; case WIFI_DIRECT_DISCOVERY_LOST: printf("Discovery lost\n"); break; default: break; } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_discovery_state_changed_cb(callback, NULL); // Register callback wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_start_discovery(TRUE, 15); // Start discovery // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### Retrieve Installed Applications Source: https://samsungtizenos.com/docs/application/web/guides/app-management/app-controls.md Use getAppsInfo() to get a list of all installed applications. The callback receives an array of ApplicationInformation objects. ```javascript function onListInstalledApplications(applications) { console.log('The number of installed applications is ' + applications.length); } tizen.application.getAppsInfo(onListInstalledApplications); ``` -------------------------------- ### Get Installed Components Asynchronously Source: https://samsungtizenos.com/docs/application/dotnet/api/13.0.0/common/Tizen.Applications.ComponentBased.ComponentManager.md Retrieves a list of all components installed on the device. This method is useful for inventorying available components. ```csharp public static Task> GetInstalledComponentsAsync() ``` -------------------------------- ### Eina Prefix Initialization and Usage Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__Eina__Prefix__Group.md Demonstrates how to initialize the Eina prefix system using eina_prefix_new() and retrieve information about installation paths. It also shows how to free the prefix structure. ```APIDOC ## Eina Prefix Initialization and Usage ### Description This code snippet illustrates the fundamental usage of the Eina prefix system. It shows how to create a new prefix structure using `eina_prefix_new()`, which requires arguments like the executable path (`argv[0]`), a symbol function, an application name, and paths for binary, library, data, and locale directories. It then demonstrates how to retrieve and print the determined installation prefix and its subdirectories using functions like `eina_prefix_get()`, `eina_prefix_bin_get()`, `eina_prefix_lib_get()`, and `eina_prefix_data_get()`. Finally, it cleans up the allocated resources by calling `eina_prefix_free()`. ### Initialization ```c #include static Eina_Prefix *pfx = NULL; int main(int argc, char **argv) { eina_init(); pfx = eina_prefix_new(argv[0], main, "APPNAME", "appname", NULL, PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, LOCALE_DIR); if (!pfx) printf("ERROR: Critical error in finding prefix\n"); // ... rest of the code ... eina_prefix_free(pfx); eina_shutdown(); } ``` ### Retrieving Path Information ```c printf("install prefix is: %s\n", eina_prefix_get(pfx)); printf("binaries are in: %s\n", eina_prefix_bin_get(pfx)); printf("libraries are in: %s\n", eina_prefix_lib_get(pfx)); printf("data files are in: %s\n", eina_prefix_data_get(pfx)); ``` ### Cleanup ```c eina_prefix_free(pfx); eina_shutdown(); ``` ``` -------------------------------- ### Example: Starting Animation Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__Elm__Image.md Demonstrates how to enable and start an image animation if the image object supports it. It first checks for animation availability, then enables animation, and finally starts playback. ```c if (elm_image_animated_available_get(img)) { elm_image_animated_set(img, EINA_TRUE); elm_image_animated_play_set(img, EINA_TRUE); } ``` -------------------------------- ### Evas Initialization and Canvas Setup Example Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__Evas__Main__Group.md Demonstrates direct Evas initialization using evas_init() and setting up a canvas using the 'buffer' rendering engine. This is an alternative to using Ecore-Evas for canvas creation. ```c int main(void) { Evas *canvas; Evas_Object *bg, *r1, *r2, *r3; evas_init(); /* After turning Evas on, we create an Evas canvas to work in. * Canvases are graphical workspaces used for placing and organizing * graphical objects. Normally we'd be using Ecore-Evas to create * the canvas, but for this example we'll hide the details in a * separate routine for convenience. */ canvas = create_canvas(WIDTH, HEIGHT); if (!canvas) return -1; ``` ```c static Evas *create_canvas(int width, int height) { Evas *canvas; Evas_Engine_Info_Buffer *einfo; int method; void *pixels; /* Request a handle for the 'buffer' type of rendering engine. */ method = evas_render_method_lookup("buffer"); if (method <= 0) { fputs("ERROR: evas was not compiled with 'buffer' engine!\n", stderr); return NULL; } /* Create a general canvas object. * Note that we are responsible for freeing the canvas when we're done. */ canvas = evas_new(); if (!canvas) { fputs("ERROR: could not instantiate new evas canvas.\n", stderr); return NULL; } /* Specify that the canvas will be rendering using the buffer engine method. * We also size the canvas and viewport to the same width and height, with * the viewport set to the origin of the canvas. */ evas_output_method_set(canvas, method); evas_output_size_set(canvas, width, height); evas_output_viewport_set(canvas, 0, 0, width, height); ``` -------------------------------- ### Wi-Fi Direct Initialization and Group Creation Example Source: https://samsungtizenos.com/docs/application/native/api/7.0.0/iot-headed/group__CAPI__NETWORK__WIFI__DIRECT__MODULE.md Demonstrates the complete lifecycle of Wi-Fi Direct, including initialization, activation, group creation, and deactivation. It also shows how to register a callback for connection state changes. Ensure Wi-Fi Direct is activated before creating a group and deactivated before deinitialization. ```c #include #include void callback_1(int error_code, wifi_direct_connection_state_e state, const char *mac, void *user_data) { if (state == WIFI_DIRECT_GROUP_DESTROYED) { printf("Group destroyed\n"); } if (state == WIFI_DIRECT_GROUP_CREATED) { printf("Group created\n"); function(); } } int main() { wifi_direct_initialize(); // Initialize Wi-Fi Direct wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1 wifi_direct_activate(); // Activate Wi-Fi Direct wifi_direct_create_group(); // APP CODE HERE // App must clean up Wi-Fi Direct before exiting wifi_direct_deactivate(); // Deactivate Wi-Fi Direct wifi_direct_unset_connection_state_changed_cb(); // Deregister callback_1 wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct return 0; } ``` -------------------------------- ### evas_vg_gradient_linear_start_get Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__Evas__Object__Vg__Group.md Gets the start point of this linear gradient. ```APIDOC ## evas_vg_gradient_linear_start_get ### Description Gets the start point of this linear gradient. ### Parameters * **obj** (Evas_Vg_Gradient_Linear *) - The object. * **x** (double *) - The x co-ordinate of start point. * **y** (double *) - The y co-ordinate of start point. ``` -------------------------------- ### Start Property Source: https://samsungtizenos.com/docs/application/dotnet/api/13.0.0/common/Tizen.NUI.Extents.md Gets or sets the start extent value. Note: The setter is deprecated and should not be used; prefer using the Extents constructor. ```csharp public ushort Start { get; set; } ``` -------------------------------- ### Basic Usage Example Source: https://samsungtizenos.com/docs/application/dotnet/api/13.0.0/common/Tizen.Network.WiFiDirect.md Demonstrates how to activate Wi-Fi Direct, start peer discovery, handle peer found events, and manage connection state changes. ```APIDOC ## Basic Usage Example This section provides a C# code example demonstrating the fundamental operations of the `Tizen.Network.WiFiDirect` API. ### Code Example ```csharp using Tizen.Network.WiFiDirect; // Activate Wi-Fi Direct WiFiDirectManager.Activate(); // Start peer discovery for 30 seconds WiFiDirectManager.StartDiscovery(false, 30); // Handle peer found event WiFiDirectManager.PeerFound += (sender, e) => { if (e.Error == WiFiDirectError.None) { Console.WriteLine($"Found peer: {e.Peer.Name}"); // Connect to the peer e.Peer.Connect(); } }; // Handle connection state changes WiFiDirectManager.ConnectionStatusChanged += (sender, e) => { Console.WriteLine($"Connection state: {e.ConnectionState}"); }; ``` ### Requirements * **Tizen Version**: 3.0 or later * **Privilege**: `http://tizen.org/privilege/wifidirect` * **Feature**: `http://tizen.org/feature/network.wifidirect` ``` -------------------------------- ### PreEditAttribute Length Property Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.Uix.InputMethod.PreEditAttribute.md Gets or sets the character length of the attribute. The valid range for this length is from the 'Start' property up to 'Start + Length'. ```csharp public uint Length { get; set; } ``` -------------------------------- ### Example Usage Source: https://samsungtizenos.com/docs/application/native/api/10.0.0/common/group__Eina__Log__Group.md A straightforward example demonstrating the initialization, logging, and shutdown of the Eina log system. ```APIDOC ## Example Usage ### Description This example shows how to initialize the Eina library, set a log level, print a warning message, and then shut down the library. ### Code ```c //Compile with: //gcc -Wall -o eina_log_01 eina_log_01.c `pkg-config --cflags --libs eina` #include #include #include void test_warn(void) { EINA_LOG_WARN("Here is a warning message"); } int main(void) { if (!eina_init()) { printf("log during the initialization of Eina_Log module\n"); return EXIT_FAILURE; } eina_log_level_set(EINA_LOG_LEVEL_WARN); test_warn(); eina_shutdown(); return EXIT_SUCCESS; } ``` ### Compilation ```bash gcc -Wall -o eina_log_01 eina_log_01.c `pkg-config --cflags --libs eina` ``` ### Execution ```bash EINA_LOG_LEVEL=2 ./eina_log_01 ``` ### Expected Output A warning message should be displayed in the terminal. ``` -------------------------------- ### Start Property Source: https://samsungtizenos.com/docs/application/dotnet/api/12.0.0/common/Tizen.NUI.Extents.md Gets or sets the start extent value. Note: The setter is deprecated and will be removed in API10; use the constructor instead. ```csharp public ushort Start { get; set; } ``` -------------------------------- ### StartTime Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.NUI.Animation.md Gets or sets the start time for each property of the animation. ```APIDOC ## StartTime ### Description Gets or sets the start time for each property of the animation. ### Declaration ```csharp public int[] StartTime { get; set; } ``` ### Property Value - Type: int[] - Description: ``` -------------------------------- ### Create and Configure a Notification with Accessory Options Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.Applications.Notifications.Notification.md This example demonstrates how to create a basic notification and then configure its accessory options, including sound, vibration, and LED settings. Finally, it posts the notification using NotificationManager. ```csharp Notification notification = new Notification { Title = "Notification", Content = "Hello Tizen", Icon = "Icon path", Count = 3 }; Notification.AccessorySet accessory = new Notification.AccessorySet { SoundOption = AccessoryOption.Custom, SoundPath = "Sound File Path", CanVibrate = true, LedOption = AccessoryOption.Custom, LedOnMillisecond = 100, LedOffMillisecond = 50, LedColor = Tizen.Common.Color.Lime }; notification.Accessory = accessory; NotificationManager.Post(notification); ``` -------------------------------- ### MediaControlServerStartedEventArgs.Controller Property Source: https://samsungtizenos.com/docs/application/dotnet/api/14.0.0/common/Tizen.Multimedia.Remoting.MediaControlServerStartedEventArgs.md Gets the MediaController associated with the server that started. ```APIDOC ## Controller Property ### Description Gets the controller of the server added. ### Declaration ```csharp public MediaController Controller { get; } ``` ### Property Value * **MediaController** - A MediaController. ```