Knox Tizen Wearable SDK
roaming.h
1 /*
2  * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of
7  * SAMSUNG ELECTRONICS ("Confidential Information").
8  * You shall not disclose such Confidential Information and shall
9  * use it only in accordance with the terms of the license agreement
10  * you entered into with SAMSUNG ELECTRONICS.
11  * SAMSUNG make no representations or warranties about the suitability
12  * of the software, either express or implied, including but not
13  * limited to the implied warranties of merchantability, fitness for
14  * a particular purpose, or non-infringement.
15  * SAMSUNG shall not be liable for any damages suffered by licensee as
16  * a result of using, modifying or distributing this software or its derivatives.
17  */
18 
19 #ifndef LIBMDM_MDM_ROAMING_H
20 #define LIBMDM_MDM_ROAMING_H
21 
22 #include "mdm_client_type.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
70 MDM_DEPRECATED_API mdm_status_t mdm_get_allow_roaming_data(void);
71 
125 MDM_DEPRECATED_API mdm_result_t mdm_set_allow_roaming_data(mdm_status_t n_status);
126 
127 
128 /*
129  * @brief API to check whether cellular data usage during roaming is allowed or not for a specific SIM (based on slot
130  ID).
131  *
132  * @since_mdm 1.1.0
133  *
134  * @since_tizen 2.3.2.3
135  *
136  * @feature %http://developer.samsung.com/tizen/feature/mdm
137  *
138  * @par Usage:
139  * Admin can use this to check if cellular data usage during roaming is
140  * enabled or not, and take appropriate action based on enterprise policy.
141  *
142  * @code{.c}
143  mdm_status_t status = MDM_ALLOWED;
144 
145  // Get SIM card slot ID
146  mdm_data_t *result = mdm_msim_get_sim_ids();
147  GList *list = (GList *)result -> data;
148 
149  GList *item = g_list_first(list);
150  char *sim_id_0 = g_strdup((char *)(item -> data));
151 
152  status = mdm_msim_get_allow_roaming_data(sim_id_0);
153  if (status != MDM_STATUS_ERROR) {
154  if (status == MDM_ALLOWED) {
155  //ALLOWED
156  } else if (status == MDM_RESTRICTED) {
157  //RESTRICTED
158  }
159  } else {
160  //ERROR: fail to get the status.
161  }
162  *
163  * @endcode
164  *
165  * @param[in] id SIM card id
166  *
167  * @return #mdm_status_t : The current prevention status.
168  *
169  * @retval #MDM_ALLOWED Cellular data during roaming is allowed.
170  * @retval #MDM_RESTRICTED Cellular data during roaming is restricted.
171  * @retval #MDM_STATUS_ERROR Failure.
172  *
173  * @see mdm_msim_set_allow_roaming_data
174  *
175  */
176 mdm_status_t mdm_msim_get_allow_roaming_data(const char *id);
177 
178 /*
179  * @brief API to allow or restrict cellular data usage during roaming for
180  * specific SIM (based on slot ID).
181  *
182  * @since_mdm 1.1.0
183  *
184  * @since_tizen 2.3.2.3
185  *
186  * @feature %http://developer.samsung.com/tizen/feature/mdm
187  *
188  * @par Usage:
189  * An administrator can use this API to allow or restrict cellular data usage during roaming.
190  * Disabling prevents applications from connecting to the Internet while the device is in roaming mode.
191  * This setting is applied only when the device is in roaming mode.
192  * If the status is set to restricted, the user cannot change this setting because the corresponding UI will be
193  disabled.
194  * If the status is set to allowed, the corresponding UI for this setting is enabled and the user can change it.
195  *
196  * @code{.c}
197  mdm_result_t ret = MDM_RESULT_SUCCESS;
198  mdm_status_t n_status = MDM_RESTRICTED;
199 
200  // Get SIM card slot ID
201  mdm_data_t *result = mdm_msim_get_sim_ids();
202  GList *list = (GList *)result -> data;
203 
204  GList *item = g_list_first(list);
205  char *sim_id_0 = g_strdup((char *)(item -> data));
206 
207  ret = mdm_msim_set_allow_roaming_data(sim_id_0, n_status);
208  if (ret != MDM_RESULT_SUCCESS) {
209  //Fail
210  } else {
211  //Success
212  }
213  *
214  * @endcode
215  *
216  * @privlevel public
217  * @privilege %http://developer.samsung.com/tizen/privilege/mdm.roaming
218  *
219  * @param[in] id SIM card id
220  * @param[in] n_status #MDM_RESTRICTED: Restricts the user from changing this setting and turns off cellular data during
221  roaming.
222  * \n #MDM_ALLOWED: Allows the user to change this setting. Cellular data must be turned on manually.
223  *
224  * @return #mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
225  *
226  * @retval #MDM_RESULT_SUCCESS Successful
227  * @retval #MDM_RESULT_FAIL General failure
228  * @retval #MDM_RESULT_NOT_SUPPORTED Not supported
229  * @retval #MDM_RESULT_INVALID_PARAM Invalid parameter
230  * @retval #MDM_RESULT_ACCESS_DENIED The application does not have the privilege to call this function.
231  *
232  * @par Permission:
233  * Usage of this API is restricted to registered clients only.
234  *
235  * @see mdm_msim_get_allow_roaming_data
236  *
237  */
238 mdm_result_t mdm_msim_set_allow_roaming_data(const char *id, const mdm_status_t n_status);
239 
240 /*
241  * @brief API to allow or restrict cellular data usage while roaming.
242  *
243  * @since_mdm 2.2.0
244  *
245  * @since_tizen 3.0.0.1
246  *
247  * @feature %http://developer.samsung.com/tizen/feature/mdm
248  *
249  * @par Usage:
250  * The admin can use this API to allow or restrict cellular data usage for the end user while roaming.
251  * Disabling roaming mode prevents applications from connecting to the Internet.
252  *
253  * @remark
254  * Restriction of roaming change #mdm_status_t is written to #MDM_POLICY_ON_DATA_ROAMING_CHANGE notification file.
255  * You can register a callback for this event using #mdm_register_policy_receiver.
256  *
257  * @code{.c}
258  mdm_result_t result = knox_mdm_set_allow_data_roaming_change("SIM1", MDM_RESTRICTED);
259  if(result == MDM_RESULT_SUCCESS) {
260  // Success
261  ...
262  } else {
263  // Error
264  ...
265  }
266  * @endcode
267  *
268  * @privlevel public
269  * @privilege %http://developer.samsung.com/tizen/privilege/mdm.roaming
270  *
271  * @param[in] simid SIM identifier
272  * @param[in] status #MDM_RESTRICTED — The end user is restricted from changing the roaming setting and turns off
273  cellular data during roaming.
274  * \n #MDM_ALLOWED — The end user is allowed to change the roaming setting. Cellular data must be turned on
275  manually.
276  *
277  * @return #mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
278  *
279  * @retval MDM_RESULT_SUCCESS Successful
280  * @retval MDM_RESULT_FAIL General failure
281  * @retval MDM_RESULT_NOT_SUPPORTED Not supported
282  * @retval MDM_RESULT_INVALID_PARAM Invalid parameter
283  * @retval MDM_RESULT_ACCESS_DENIED The application does not have the privilege to call this function.
284  *
285  * @see knox_mdm_get_allow_roaming_data_change
286  */
287 mdm_result_t knox_mdm_set_allow_roaming_data_change(const char *id, const mdm_status_t status);
288 
289 /*
290  * @brief API to check if the end user is allowed to use mobile data while roaming.
291  *
292  * @since_mdm 2.2.0
293  *
294  * @since_tizen 3.0.0.1
295  *
296  * @feature %http://developer.samsung.com/tizen/feature/mdm
297  *
298  * @par Usage:
299  * Use this API to check if the end user is allowed to use mobile data while roaming, and take the appropriate action
300  based on enterprise policy.
301  *
302  * @code{.c}
303  mdm_status_t status = knox_mdm_get_allow_data_roaming_change("SIM1");
304  if(result == MDM_RESTRICTED) {
305  // Changes are blocked
306  ...
307  } else if(result == MDM_ALLOWED) {
308  // Changes are allowed
309  ...
310  }
311  else
312  {
313  // ERROR
314  ...
315  }
316  * @endcode
317  *
318  * @return #mdm_status_t : The current prevention status.
319  * @retval #MDM_RESTRICTED The end user is restricted from using mobile data while roaming.
320  * @retval #MDM_ALLOWED The end user is allowed to use mobile data while roaming.
321  * @retval #MDM_STATUS_ERROR On any error.
322  *
323  * @see knox_mdm_set_allow_roaming_data_change
324  */
325 mdm_status_t knox_mdm_get_allow_roaming_data_change(const char *id);
326 
327 /* --------------------------------------------------------------------------------------------------------
328  * HIDDEN DOCUMENTATION
329  * --------------------------------------------------------------------------------------------------------
330  *
331  * Hidden documentation won't be generated by doxygen unless
332  * ROAMING_HIDDEN_API section is added to the ENABLED_SECTIONS
333  * in the Doxygen configuration file.
334  */
336 
337 /*
338  * @brief API to check whether automatic syncing during roaming is allowed or not.
339  *
340  * @since_mdm 1.1.0
341  *
342  * @since_tizen 2.3.2.3
343  *
344  * @feature %http://developer.samsung.com/tizen/feature/mdm
345  *
346  * @par Usage:
347  * Admin can use this to check if the automatic sync of applications is
348  * allowed or not, and take appropriate action based on enterprise policy.
349  *
350  * @code{.c}
351  mdm_status_t status = MDM_ALLOWED;
352 
353  // Get SIM card slot ID
354  mdm_data_t *result = mdm_msim_get_sim_ids();
355  GList *list = (GList *)result -> data;
356 
357  GList *item = g_list_first(list);
358  char *sim_id_0 = g_strdup((char *)(item -> data));
359 
360  status = mdm_msim_get_allow_roaming_sync(sim_id_0);
361  if (status != MDM_STATUS_ERROR) {
362  if (status == MDM_ALLOWED) {
363  //ALLOWED
364  } else if (status == MDM_RESTRICTED) {
365  //RESTRICTED
366  }
367  } else {
368  //ERROR: fail to get the status.
369  }
370  *
371  * @endcode
372  *
373  * @param[in] id SIM card id
374  *
375  * @return #mdm_status_t : The current prevention status.
376  *
377  * @retval #MDM_ALLOWED Automatic sync during roaming is allowed.
378  * @retval #MDM_RESTRICTED Automatic sync during roaming is restricted.
379  * @retval #MDM_STATUS_ERROR Failure.
380  *
381  * @see mdm_msim_set_allow_roaming_sync
382  *
383  */
384 mdm_status_t mdm_msim_get_allow_roaming_sync(const char *id);
385 
386 /*
387  * @brief API to check whether processing of WAP PUSH messages during roaming is allowed or not.
388  *
389  * @since_mdm 1.1.0
390  *
391  * @since_tizen 2.3.2.3
392  *
393  * @feature %http://developer.samsung.com/tizen/feature/mdm
394  *
395  * @par Usage:
396  * Admin can use this to check if processing of WAP PUSH messages during roaming is
397  * enabled or not, and take appropriate action based on enterprise policy.
398  *
399  * @code{.c}
400  mdm_status_t status = MDM_ALLOWED;
401 
402  // Get SIM card slot ID
403  mdm_data_t *result = mdm_msim_get_sim_ids();
404  GList *list = (GList *)result -> data;
405 
406  GList *item = g_list_first(list);
407  char *sim_id_0 = g_strdup((char *)(item -> data));
408 
409  status = mdm_msim_get_allow_roaming_push(sim_id_0);
410  if (status != MDM_STATUS_ERROR) {
411  if (status == MDM_ALLOWED) {
412  //ALLOWED
413  } else if (status == MDM_RESTRICTED) {
414  //RESTRICTED
415  }
416  } else {
417  //ERROR: fail to get the status.
418  }
419  *
420  * @endcode
421  *
422  * @param[in] id SIM card id
423  *
424  * @return #mdm_status_t : The current prevention status.
425  *
426  * @retval #MDM_ALLOWED Processing of WAP PUSH messages during roaming is allowed.
427  * @retval #MDM_RESTRICTED Processing of WAP PUSH messages during roaming is restricted.
428  * @retval #MDM_STATUS_ERROR Failure.
429  *
430  * @see mdm_msim_set_allow_roaming_push
431  *
432  */
433 mdm_status_t mdm_msim_get_allow_roaming_push(const char *id);
434 
435 /*
436  * @brief API to allow or restrict automatic application sync during roaming.
437  *
438  * @since_mdm 1.1.0
439  *
440  * @since_tizen 2.3.2.3
441  *
442  * @feature %http://developer.samsung.com/tizen/feature/mdm
443  *
444  * @par Usage:
445  * An administrator can use this API to allow or restrict the automatic sync of applications such as
446  * email, gmail, contacts, calendar, and other application that requires the usage of an account.
447  * This setting is applied only when the device is in roaming mode.
448  * If the status is set to restricted, the user cannot change this setting because the corresponding UI will be
449  disabled.
450  * If the status is set to allowed, the corresponding UI for this setting is enabled and the user can change it.
451  *
452  * @remark
453  * Roaming sync restriction #mdm_status_t is written to #MDM_POLICY_ON_ROAMING_SYNC notification file.
454  * You can register a callback for this event using #mdm_register_policy_receiver.
455  *
456  * @code{.c}
457  mdm_result_t ret = MDM_RESULT_SUCCESS;
458  mdm_status_t n_status = MDM_RESTRICTED;
459 
460  // Get SIM card slot ID
461  mdm_data_t *result = mdm_msim_get_sim_ids();
462  GList *list = (GList *)result -> data;
463 
464  GList *item = g_list_first(list);
465  char *sim_id_0 = g_strdup((char *)(item -> data));
466 
467  ret = mdm_msim_set_allow_roaming_sync(sim_id_0, n_status);
468  if (ret != MDM_RESULT_SUCCESS) {
469  //Fail
470  } else {
471  //Success
472  }
473  *
474  * @endcode
475  *
476  * @privlevel public
477  * @privilege %http://developer.samsung.com/tizen/privilege/mdm.roaming
478  *
479  * @param[in] id SIM card id
480  * @param[in] n_status #MDM_RESTRICTED: Restricts the user from changing this setting and turns off automatic sync
481  during roaming.
482  * \n #MDM_ALLOWED: Allows the user to change this setting. Cellular data must be turn on manually.
483  *
484  * @return #mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
485  *
486  * @retval #MDM_RESULT_SUCCESS Successful
487  * @retval #MDM_RESULT_FAIL General failure
488  * @retval #MDM_RESULT_NOT_SUPPORTED Not supported
489  * @retval #MDM_RESULT_INVALID_PARAM Invalid parameter
490  * @retval #MDM_RESULT_ACCESS_DENIED The application does not have the privilege to call this function.
491  *
492  * @par Permission:
493  * Usage of this API is restricted to registered clients only.
494  *
495  * @see mdm_msim_get_allow_roaming_sync
496  *
497  */
498 mdm_result_t mdm_msim_set_allow_roaming_sync(const char *id, const mdm_status_t n_status);
499 
500 /*
501  * @brief API to allow or restrict processing of WAP Push messages during roaming.
502  *
503  * @since_mdm 1.1.0
504  *
505  * @since_tizen 2.3.2.3
506  *
507  * @feature %http://developer.samsung.com/tizen/feature/mdm
508  *
509  * @par Usage:
510  * An administrator can use this API to allow or restrict processing of WAP PUSH messages.
511  * Restricting this setting prevents MMS messages from being received during roaming.
512  * This setting is applied only when the device is in roaming mode.
513  * If the status is set to restricted, the user cannot change this setting because the corresponding UI will be
514  disabled.
515  * If the status is set to allowed, the corresponding UI for this setting is enabled and the user can change it.
516  *
517  * @remark
518  * Roaming push restriction #mdm_status_t is written to #MDM_POLICY_ON_ROAMING_PUSH notification file.
519  * You can register a callback for this event using #mdm_register_policy_receiver.
520  *
521  * @code{.c}
522  mdm_result_t ret = MDM_RESULT_SUCCESS;
523  mdm_status_t n_status = MDM_RESTRICTED;
524 
525  // Get SIM card slot ID
526  mdm_data_t *result = mdm_msim_get_sim_ids();
527  GList *list = (GList *)result -> data;
528 
529  GList *item = g_list_first(list);
530  char *sim_id_0 = g_strdup((char *)(item -> data));
531 
532  ret = mdm_msim_set_allow_roaming_push(sim_id_0, n_status);
533  if (ret != MDM_RESULT_SUCCESS) {
534  //Fail
535  } else {
536  //Success
537  }
538  *
539  * @endcode
540  *
541  * @privlevel public
542  * @privilege %http://developer.samsung.com/tizen/privilege/mdm.roaming
543  *
544  * @param[in] id SIM card id
545  * @param[in] n_status #MDM_RESTRICTED: Restricts the user from changing this setting and disables the processing of WAP
546  Push messages during roaming.
547  * \n #MDM_ALLOWED: Allows the user to change this setting. Enabling the processing of WAP Push
548  messages must be performed manually.
549  *
550  * @return #mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
551  *
552  * @retval #MDM_RESULT_SUCCESS Successful
553  * @retval #MDM_RESULT_FAIL General failure
554  * @retval #MDM_RESULT_NOT_SUPPORTED Not supported
555  * @retval #MDM_RESULT_INVALID_PARAM Invalid parameter
556  * @retval #MDM_RESULT_ACCESS_DENIED The application does not have the privilege to call this function.
557  *
558  * @par Permission:
559  * Usage of this API is restricted to registered clients only.
560  *
561  * @see mdm_msim_get_allow_roaming_push
562  *
563  */
564 mdm_result_t mdm_msim_set_allow_roaming_push(const char *id, const mdm_status_t n_status);
565 
567 /* -----------------------------------------------------------------------------------------------------------------
568  * END OF HIDDEN DOCUMENTATION
569  * -----------------------------------------------------------------------------------------------------------------
570  */
571 
576 #ifdef __cplusplus
577 }
578 #endif
579 
580 #endif //LIBMDM_MDM_ROAMING_H
mdm_result_t mdm_set_allow_roaming_data(mdm_status_t n_status)
API to allow or restrict the use of cellular data usage while roaming.
mdm_status_t
MDM Policy status.
mdm_result_t
MDM API result.
mdm_status_t mdm_get_allow_roaming_data(void)
API to check if cellular data usage is allowed while roaming.