Define strings for wfd rtsp message and use these
[archive/platform/core/multimedia/libmm-scmirroring-common.git] / wfdconfig / wfdconfigmessage.c
index 06dcdf3..2e5744f 100755 (executable)
@@ -268,13 +268,13 @@ wfdconfig_message_as_text(const WFDMessage *msg)
                guint i = 0;
                g_string_append_printf(lines, STRING_WFD_AUDIO_CODECS);
                if (msg->audio_codecs->list) {
-                       g_string_append_printf(lines, ":");
+                       g_string_append_printf(lines, STRING_WFD_COLON);
                        for (; i < msg->audio_codecs->count; i++) {
                                g_string_append_printf(lines, " %s", msg->audio_codecs->list[i].audio_format);
                                g_string_append_printf(lines, " %08x", msg->audio_codecs->list[i].modes);
                                g_string_append_printf(lines, " %02x", msg->audio_codecs->list[i].latency);
                                if ((i + 1) < msg->audio_codecs->count)
-                                       g_string_append_printf(lines, ",");
+                                       g_string_append_printf(lines, STRING_WFD_COMMA);
                        }
                }
                g_string_append_printf(lines, STRING_WFD_CRLF);
@@ -284,7 +284,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
        if (msg->video_formats) {
                g_string_append_printf(lines, STRING_WFD_VIDEO_FORMATS);
                if (msg->video_formats->list) {
-                       g_string_append_printf(lines, ":");
+                       g_string_append_printf(lines, STRING_WFD_COLON);
                        g_string_append_printf(lines, " %02x", msg->video_formats->list->native);
                        g_string_append_printf(lines, " %02x", msg->video_formats->list->preferred_display_mode_supported);
                        g_string_append_printf(lines, " %02x", msg->video_formats->list->H264_codec.profile);
@@ -316,7 +316,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
        /* list of video 3D codecs */
        if (msg->video_3d_formats) {
                g_string_append_printf(lines, STRING_WFD_3D_VIDEO_FORMATS);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->video_3d_formats->list) {
                        g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->native);
                        g_string_append_printf(lines, " %02x", msg->video_3d_formats->list->preferred_display_mode_supported);
@@ -349,7 +349,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->content_protection) {
                g_string_append_printf(lines, STRING_WFD_CONTENT_PROTECTION);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->content_protection->hdcp2_spec) {
                        if (msg->content_protection->hdcp2_spec->hdcpversion) {
                                g_string_append_printf(lines, " %s", msg->content_protection->hdcp2_spec->hdcpversion);
@@ -367,7 +367,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->display_edid) {
                g_string_append_printf(lines, STRING_WFD_DISPLAY_EDID);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->display_edid->edid_supported) {
                        g_string_append_printf(lines, " %d", msg->display_edid->edid_supported);
                        if (msg->display_edid->edid_block_count) {
@@ -385,7 +385,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->coupled_sink) {
                g_string_append_printf(lines, STRING_WFD_COUPLED_SINK);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->coupled_sink->coupled_sink_cap) {
                        g_string_append_printf(lines, " %02x", msg->coupled_sink->coupled_sink_cap->status);
                        if (msg->coupled_sink->coupled_sink_cap->sink_address) {
@@ -403,14 +403,14 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->trigger_method) {
                g_string_append_printf(lines, STRING_WFD_TRIGGER_METHOD);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, " %s", msg->trigger_method->wfd_trigger_method);
                g_string_append_printf(lines, STRING_WFD_CRLF);
        }
 
        if (msg->presentation_url) {
                g_string_append_printf(lines, STRING_WFD_PRESENTATION_URL);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->presentation_url->wfd_url0) {
                        g_string_append_printf(lines, " %s", msg->presentation_url->wfd_url0);
                } else {
@@ -429,7 +429,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
        if (msg->client_rtp_ports) {
                g_string_append_printf(lines, STRING_WFD_CLIENT_RTP_PORTS);
                if (msg->client_rtp_ports->profile) {
-                       g_string_append_printf(lines, ":");
+                       g_string_append_printf(lines, STRING_WFD_COLON);
                        g_string_append_printf(lines, " %s", msg->client_rtp_ports->profile);
                        g_string_append_printf(lines, " %d", msg->client_rtp_ports->rtp_port0);
                        g_string_append_printf(lines, " %d", msg->client_rtp_ports->rtp_port1);
@@ -440,14 +440,14 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->route) {
                g_string_append_printf(lines, STRING_WFD_ROUTE);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, " %s", msg->route->destination);
                g_string_append_printf(lines, STRING_WFD_CRLF);
        }
 
        if (msg->I2C) {
                g_string_append_printf(lines, STRING_WFD_I2C);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, STRING_WFD_SPACE);
                if (msg->I2C->I2CPresent) {
                        g_string_append_printf(lines, "%x", msg->I2C->I2C_port);
@@ -459,7 +459,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->av_format_change_timing) {
                g_string_append_printf(lines, STRING_WFD_AV_FORMAT_CHANGE_TIMING);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->PTS);
                g_string_append_printf(lines, " %010llx", msg->av_format_change_timing->DTS);
                g_string_append_printf(lines, STRING_WFD_CRLF);
@@ -467,7 +467,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->preferred_display_mode) {
                g_string_append_printf(lines, STRING_WFD_PREFERRED_DISPLAY_MODE);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->preferred_display_mode->displaymodesupported) {
                        g_string_append_printf(lines, " %06llx", msg->preferred_display_mode->p_clock);
                        g_string_append_printf(lines, " %04x", msg->preferred_display_mode->H);
@@ -490,83 +490,91 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->uibc_capability) {
                g_string_append_printf(lines, STRING_WFD_UIBC_CAPABILITY);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                if (msg->uibc_capability->uibcsupported) {
                        g_string_append_printf(lines, STRING_WFD_SPACE);
                        g_string_append_printf(lines, STRING_WFD_INPUT_CATEGORY_LIST);
-                       g_string_append_printf(lines, "=");
+                       g_string_append_printf(lines, STRING_WFD_EQUALS);
                        if (msg->uibc_capability->input_category_list.input_cat) {
                                guint32 tempcap = 0;
                                if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_GENERIC) {
                                        tempcap |= WFD_UIBC_INPUT_CAT_GENERIC;
                                        g_string_append_printf(lines, STRING_WFD_GENERIC);
                                        if (msg->uibc_capability->input_category_list.input_cat != tempcap) {
-                                               g_string_append_printf(lines, ", ");
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                        }
                                }
                                if (msg->uibc_capability->input_category_list.input_cat & WFD_UIBC_INPUT_CAT_HIDC) {
                                        tempcap |= WFD_UIBC_INPUT_CAT_HIDC;
                                        g_string_append_printf(lines, STRING_WFD_HIDC);
                                        if (msg->uibc_capability->input_category_list.input_cat != tempcap) {
-                                               g_string_append_printf(lines, ", ");
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                        }
                                }
                        } else {
                                g_string_append_printf(lines, STRING_WFD_NONE);
                        }
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        g_string_append_printf(lines, STRING_WFD_SPACE);
                        g_string_append_printf(lines, STRING_WFD_GENERIC_CAP_LIST);
-                       g_string_append_printf(lines, "=");
+                       g_string_append_printf(lines, STRING_WFD_EQUALS);
                        if (msg->uibc_capability->generic_cap_list.inp_type) {
                                guint32 tempcap = 0;
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_KEYBOARD) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_KEYBOARD;
                                        g_string_append_printf(lines, STRING_WFD_KEYBOARD);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MOUSE) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_MOUSE;
                                        g_string_append_printf(lines, STRING_WFD_MOUSE);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_SINGLETOUCH) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_SINGLETOUCH;
                                        g_string_append_printf(lines, STRING_WFD_SINGLE_TOUCH);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_MULTITOUCH) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_MULTITOUCH;
                                        g_string_append_printf(lines, STRING_WFD_MULTI_TOUCH);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_JOYSTICK) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_JOYSTICK;
                                        g_string_append_printf(lines, STRING_WFD_JOYSTICK);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_CAMERA) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_CAMERA;
                                        g_string_append_printf(lines, STRING_WFD_CAMERA);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_GESTURE) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_GESTURE;
                                        g_string_append_printf(lines, STRING_WFD_GESTURE);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                                if (msg->uibc_capability->generic_cap_list.inp_type & WFD_UIBC_INPUT_TYPE_REMOTECONTROL) {
                                        tempcap |= WFD_UIBC_INPUT_TYPE_REMOTECONTROL;
                                        g_string_append_printf(lines, STRING_WFD_REMOTE_CONTROL);
-                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap) g_string_append_printf(lines, ", ");
+                                       if (msg->uibc_capability->generic_cap_list.inp_type != tempcap)
+                                               g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                        } else {
                                g_string_append_printf(lines, STRING_WFD_NONE);
                        }
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        g_string_append_printf(lines, STRING_WFD_SPACE);
                        g_string_append_printf(lines, STRING_WFD_HIDC_CAP_LIST);
-                       g_string_append_printf(lines, "=");
+                       g_string_append_printf(lines, STRING_WFD_EQUALS);
                        if (msg->uibc_capability->hidc_cap_list.cap_count) {
                                detailed_cap *temp_cap = msg->uibc_capability->hidc_cap_list.next;
                                while (temp_cap) {
@@ -578,7 +586,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
                                        else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_CAMERA) g_string_append_printf(lines, STRING_WFD_CAMERA);
                                        else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_GESTURE) g_string_append_printf(lines, STRING_WFD_GESTURE);
                                        else if (temp_cap->p.inp_type == WFD_UIBC_INPUT_TYPE_REMOTECONTROL) g_string_append_printf(lines, STRING_WFD_REMOTE_CONTROL);
-                                       g_string_append_printf(lines, "/");
+                                       g_string_append_printf(lines, STRING_WFD_SLASH);
                                        if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_INFRARED) g_string_append_printf(lines, STRING_WFD_INFRARED);
                                        else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_USB) g_string_append_printf(lines, STRING_WFD_USB);
                                        else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_BT) g_string_append_printf(lines, STRING_WFD_BT);
@@ -586,18 +594,19 @@ wfdconfig_message_as_text(const WFDMessage *msg)
                                        else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_WIFI) g_string_append_printf(lines, STRING_WFD_WIFI);
                                        else if (temp_cap->p.inp_path == WFD_UIBC_INPUT_PATH_NOSP) g_string_append_printf(lines, STRING_WFD_NO_SP);
                                        temp_cap = temp_cap->next;
-                                       if (temp_cap) g_string_append_printf(lines, ", ");
+                                       if (temp_cap) g_string_append_printf(lines, STRING_WFD_COMMA STRING_WFD_SPACE);
                                }
                        } else {
                                g_string_append_printf(lines, STRING_WFD_NONE);
                        }
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        if (msg->uibc_capability->tcp_port) {
                                g_string_append_printf(lines, STRING_WFD_PORT);
-                               g_string_append_printf(lines, "=%u", msg->uibc_capability->tcp_port);
+                               g_string_append_printf(lines, STRING_WFD_EQUALS);
+                               g_string_append_printf(lines, "%u", msg->uibc_capability->tcp_port);
                        } else {
                                g_string_append_printf(lines, STRING_WFD_PORT);
-                               g_string_append_printf(lines, "=");
+                               g_string_append_printf(lines, STRING_WFD_EQUALS);
                                g_string_append_printf(lines, STRING_WFD_NONE);
                        }
                } else {
@@ -609,7 +618,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->uibc_setting) {
                g_string_append_printf(lines, STRING_WFD_UIBC_SETTING);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, STRING_WFD_SPACE);
                if (msg->uibc_setting->uibc_setting)
                        g_string_append_printf(lines, STRING_WFD_ENABLE);
@@ -620,7 +629,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->standby_resume_capability) {
                g_string_append_printf(lines, STRING_WFD_STANDBY_RESUME_CAPABILITY);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, STRING_WFD_SPACE);
                if (msg->standby_resume_capability->standby_resume_cap)
                        g_string_append_printf(lines, STRING_WFD_SUPPORTED);
@@ -636,7 +645,7 @@ wfdconfig_message_as_text(const WFDMessage *msg)
 
        if (msg->connector_type) {
                g_string_append_printf(lines, STRING_WFD_CONNECTOR_TYPE);
-               g_string_append_printf(lines, ":");
+               g_string_append_printf(lines, STRING_WFD_COLON);
                g_string_append_printf(lines, STRING_WFD_CRLF);
        }
 
@@ -1813,9 +1822,9 @@ WFDResult wfdconfig_get_contentprotection_type(WFDMessage *msg, WFDHDCPProtectio
                        return WFD_OK;
                }
 
-               result = strtok_r(msg->content_protection->hdcp2_spec->TCPPort, "=", &ptr);
+               result = strtok_r(msg->content_protection->hdcp2_spec->TCPPort, STRING_WFD_EQUALS, &ptr);
                while (result != NULL) {
-                       result = strtok_r(NULL, "=", &ptr);
+                       result = strtok_r(NULL, STRING_WFD_EQUALS, &ptr);
                        *TCPPort = atoi(result);
                        break;
                }
@@ -1950,24 +1959,24 @@ WFDResult wfdconfig_set_prefered_RTP_ports(WFDMessage *msg, WFDRTSPTransMode tra
                if (trans == WFD_RTSP_TRANS_RTP)        g_string_append_printf(lines, STRING_WFD_RTP);
                else if (trans == WFD_RTSP_TRANS_RDT) g_string_append_printf(lines, STRING_WFD_RDT);
 
-               if (profile != WFD_RTSP_PROFILE_UNKNOWN) g_string_append_printf(lines, "/");
+               if (profile != WFD_RTSP_PROFILE_UNKNOWN) g_string_append_printf(lines, STRING_WFD_SLASH);
 
                if (profile == WFD_RTSP_PROFILE_AVP) g_string_append_printf(lines, STRING_WFD_AVP);
                else if (profile == WFD_RTSP_PROFILE_SAVP) g_string_append_printf(lines, STRING_WFD_SAVP);
 
-               if (lowertrans != WFD_RTSP_LOWER_TRANS_UNKNOWN) g_string_append_printf(lines, "/");
+               if (lowertrans != WFD_RTSP_LOWER_TRANS_UNKNOWN) g_string_append_printf(lines, STRING_WFD_SLASH);
 
                if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP) {
                        g_string_append_printf(lines, STRING_WFD_UDP);
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        g_string_append_printf(lines, STRING_WFD_UNICAST);
                } else if (lowertrans == WFD_RTSP_LOWER_TRANS_UDP_MCAST) {
                        g_string_append_printf(lines, STRING_WFD_UDP);
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        g_string_append_printf(lines, STRING_WFD_MULTICAST);
                } else if (lowertrans == WFD_RTSP_LOWER_TRANS_TCP) {
                        g_string_append_printf(lines, STRING_WFD_TCP);
-                       g_string_append_printf(lines, ";");
+                       g_string_append_printf(lines, STRING_WFD_SEMI_COLON);
                        g_string_append_printf(lines, STRING_WFD_UNICAST);
                } else if (lowertrans == WFD_RTSP_LOWER_TRANS_HTTP) {
                        g_string_append_printf(lines, STRING_WFD_TCP_HTTP);