DPM: Add Error code for device policy restriction. 09/72309/3
authorh.sandeep <h.sandeep@samsung.com>
Tue, 31 May 2016 10:17:01 +0000 (15:47 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Tue, 31 May 2016 23:56:20 +0000 (16:56 -0700)
Added the Error code "BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION".

Change-Id: I303860eff6a5df40dccf641df390552d2c4cdb43
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
bt-api/bt-audio.c
bt-api/bt-avrcp.c
bt-api/bt-device.c
bt-api/bt-hid.c
bt-api/bt-network.c
bt-api/bt-opp-client.c
bt-api/bt-rfcomm-client.c
bt-api/bt-rfcomm-server.c
include/bluetooth-api.h

index 054c7c5..254c5df 100644 (file)
@@ -92,13 +92,13 @@ BT_EXPORT_API int bluetooth_audio_connect(bluetooth_device_address_t *remote_add
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED &&
                 _bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use HSP / A2DP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        } else if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use HSP profile");
                service_function = BT_AV_CONNECT;
@@ -116,7 +116,7 @@ BT_EXPORT_API int bluetooth_audio_connect(bluetooth_device_address_t *remote_add
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
 #endif
@@ -186,12 +186,12 @@ BT_EXPORT_API int bluetooth_ag_connect(bluetooth_device_address_t *remote_addres
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use HSP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
@@ -203,7 +203,7 @@ BT_EXPORT_API int bluetooth_ag_connect(bluetooth_device_address_t *remote_addres
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
 #endif
@@ -273,12 +273,12 @@ BT_EXPORT_API int bluetooth_av_connect(bluetooth_device_address_t *remote_addres
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use A2DP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
@@ -290,7 +290,7 @@ BT_EXPORT_API int bluetooth_av_connect(bluetooth_device_address_t *remote_addres
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
 #endif
@@ -329,12 +329,12 @@ BT_EXPORT_API int bluetooth_av_source_connect(bluetooth_device_address_t *remote
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use A2DP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -449,7 +449,7 @@ BT_EXPORT_API int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain)
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use HSP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index 2ec6536..4dc7173 100644 (file)
@@ -75,7 +75,7 @@ BT_EXPORT_API int bluetooth_media_player_change_property(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -104,7 +104,7 @@ BT_EXPORT_API int bluetooth_media_player_set_properties(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -133,7 +133,7 @@ BT_EXPORT_API int bluetooth_media_player_change_track(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -231,12 +231,12 @@ BT_EXPORT_API int bluetooth_media_control_connect(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -303,7 +303,7 @@ BT_EXPORT_API int bluetooth_media_control_command(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -331,7 +331,7 @@ BT_EXPORT_API int bluetooth_media_control_set_property(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -363,7 +363,7 @@ BT_EXPORT_API int bluetooth_media_control_get_property(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -396,7 +396,7 @@ BT_EXPORT_API int bluetooth_media_control_get_track_info(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use AVRCP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index 85701aa..d6bf2da 100644 (file)
@@ -43,12 +43,12 @@ BT_EXPORT_API int bluetooth_bond_device(const bluetooth_device_address_t *device
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_PAIRING, NULL) == BT_DPM_RESTRICTED) {
                        BT_ERR("Not allow to pair the device");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index e0693f7..6616778 100644 (file)
@@ -77,12 +77,12 @@ BT_EXPORT_API int bluetooth_hid_connect(hid_device_address_t *device_address)
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, device_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_UUID, BT_HID_UUID) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist uuid");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index 4b79358..88af272 100644 (file)
@@ -80,7 +80,7 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
        char *uuid = NULL;
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        switch (role) {
@@ -100,10 +100,10 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
        if (_bt_check_dpm(BT_DPM_UUID, uuid) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist uuid");
                g_free(uuid);
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
-       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) ==      BT_DPM_RESTRICTED) {
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
                char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                bluetooth_device_class_t dev_class;
 
@@ -112,7 +112,7 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
        g_free(uuid);
index e5b5ac5..014806f 100644 (file)
@@ -80,12 +80,12 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_OPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to send files");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
@@ -97,7 +97,7 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
 #endif
index d6d7c34..abe7a65 100644 (file)
@@ -574,13 +574,13 @@ BT_EXPORT_API int bluetooth_rfcomm_connect(
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_bt_address) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist device");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
                _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to connect the RFCOMM service");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
@@ -592,7 +592,7 @@ BT_EXPORT_API int bluetooth_rfcomm_connect(
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
 #endif
@@ -851,7 +851,7 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length)
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
                _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to write RFCOMM data");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index 4d7ffea..b542170 100644 (file)
@@ -392,7 +392,7 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -448,7 +448,7 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -683,7 +683,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pend
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -742,7 +742,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int ma
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -785,7 +785,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connect
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
@@ -851,7 +851,7 @@ BT_EXPORT_API int bluetooth_rfcomm_accept_connection(int server_fd)
 #ifdef TIZEN_DPM_ENABLE
        if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
                BT_ERR("Not allow to use SPP profile");
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 #endif
 
index 20f3a48..f69ee09 100644 (file)
@@ -165,6 +165,9 @@ extern "C" {
 #define BLUETOOTH_ERROR_NOT_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x26)
                                                                /**< Not initialized */
 
+#define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION    ((int)BLUETOOTH_ERROR_BASE - 0x27)
+                                                               /**< Device Policy Restricted */
+
 /**
 * Device disconnect reason
 */
@@ -1538,7 +1541,7 @@ typedef enum {
        BLUETOOTH_DPM_RESULT_ACCESS_DENIED = -4,                        /**< DPM API result access denied. */
        BLUETOOTH_DPM_RESULT_INVALID_PARAM = -3,                        /**< DPM API result invalid parameter. */
        BLUETOOTH_DPM_RESULT_NOT_SUPPORTED = -2,                        /**< DPM API result not supported. */
-       BLUETOOTH_DPM_RESULT_FAIL        = -1,                          /**< DPM API result fail. */
+       BLUETOOTH_DPM_RESULT_FAIL        = -1,                          /**< DPM API result fail. */
        BLUETOOTH_DPM_RESULT_SUCCESS     = 0,                           /**< DPM API result success. */
 } bt_dpm_result_t;
 
@@ -1549,11 +1552,11 @@ typedef enum {
 typedef enum {
        BLUETOOTH_DPM_STATUS_ERROR      = -1,
 
-       BLUETOOTH_DPM_ALLOWED           = 0,    /**< DPM Policy status allowed. */
+       BLUETOOTH_DPM_ALLOWED           = 0,    /**< DPM Policy status allowed. */
        BLUETOOTH_DPM_RESTRICTED                = 1,    /**< DPM Policy status restricted. */
 
        BLUETOOTH_DPM_ENABLE                    = 1,    /**< DPM Policy status enabled. */
-       BLUETOOTH_DPM_DISABLE   = 0,    /**< DPM Policy status disabled. */
+       BLUETOOTH_DPM_DISABLE   = 0,    /**< DPM Policy status disabled. */
 
        BLUETOOTH_DPM_FALSE                     = 0,    /**< DPM Policy status false. */
        BLUETOOTH_DPM_TRUE                      = 1,    /**< DPM Policy status true. */