00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <libsyncml/syncml.h>
00022 #include <libsyncml/syncml_internals.h>
00023 #include <libsyncml/sml_error_internals.h>
00024 #include <libsyncml/sml_transport_internals.h>
00025 #include "obex_client_internals.h"
00026
00027 SmlBool smlTransportObexVendorSamsungInit(SmlTransportObexClientEnv *env)
00028 {
00029 smlTrace(TRACE_EXIT, "%s(%p, %s)", __func__, VA_STRING(env->model));
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 if (
00043
00044 !g_strcasecmp("SGH-Z500", env->model) ||
00045 !g_strcasecmp("SGH-ZM60", env->model) ||
00046
00047
00048 !g_strcasecmp("SGH-D347", env->model) ||
00049 !g_strcasecmp("SGH-D357", env->model) ||
00050 !g_strcasecmp("SGH-D520", env->model) ||
00051 !g_strcasecmp("SGH-D830", env->model) ||
00052 !g_strcasecmp("SGH-D840", env->model) ||
00053 !g_strcasecmp("SGH-E770", env->model) ||
00054 !g_strcasecmp("SGH-E860", env->model) ||
00055 !g_strcasecmp("SGH-E900", env->model) ||
00056 !g_strcasecmp("SGH-F480", env->model) ||
00057 !g_strcasecmp("SGH-S500i", env->model) ||
00058 !g_strcasecmp("SGH-T609", env->model) ||
00059 !g_strcasecmp("SGH-X800", env->model) ||
00060 !g_strcasecmp("SGH-X810", env->model) ||
00061 !g_strcasecmp("SGH-X820", env->model) ||
00062 !g_strcasecmp("SGH-Z150", env->model) ||
00063 !g_strcasecmp("SGH-Z310", env->model) ||
00064 !g_strcasecmp("SGH-Z320i", env->model) ||
00065 !g_strcasecmp("SGH-Z400", env->model) ||
00066 !g_strcasecmp("SGH-Z510", env->model) ||
00067 !g_strcasecmp("SGH-Z540", env->model) ||
00068 !g_strcasecmp("SGH-Z560", env->model) ||
00069 !g_strcasecmp("SGH-ZV30", env->model)
00070 )
00071 {
00072 smlTrace(TRACE_INTERNAL, "%s: WebSync WiDESYNC III (Gumi, Suwon 3G)", __func__);
00073 smlTrace(TRACE_INTERNAL, "%s: %i datastores" , __func__, g_list_length(env->datastores));
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 env->at_command = g_strdup_printf("AT+SyncML=%i", g_list_length(env->datastores));
00086 unsigned int i;
00087 for(i = 0; i < g_list_length(env->datastores); i++)
00088 {
00089 char *tmp = g_strjoin("", env->at_command, "06", NULL);
00090 SmlTransportObexDatastoreType *type;
00091 type = g_list_nth_data(env->datastores, i);
00092 switch(*type)
00093 {
00094 case SML_TRANSPORT_OBEX_DATASTORE_CONTACT:
00095 env->at_command = g_strjoin ("", tmp, "1", NULL);
00096 break;
00097 case SML_TRANSPORT_OBEX_DATASTORE_EVENT:
00098 env->at_command = g_strjoin ("", tmp, "2", NULL);
00099 break;
00100 case SML_TRANSPORT_OBEX_DATASTORE_NOTE:
00101 env->at_command = g_strjoin ("", tmp, "3", NULL);
00102 break;
00103 case SML_TRANSPORT_OBEX_DATASTORE_TODO:
00104 env->at_command = g_strjoin ("", tmp, "4", NULL);
00105 break;
00106 default:
00107 smlSafeCFree(&tmp);
00108 g_warning("Unkown datastore type %d for Samsung mobiles.",
00109 *type);
00110 return FALSE;
00111 }
00112 smlSafeCFree(&tmp);
00113 }
00114 } else {
00115 g_warning("Unknown Samsung mobile device %s - using default AT command.",
00116 env->model);
00117 return TRUE;
00118 }
00119
00120 char *tmp = g_strjoin("", env->at_command, "\r", NULL);
00121 smlSafeCFree(&(env->at_command));
00122 env->at_command = tmp;
00123 tmp = NULL;
00124
00125 smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(env->at_command));
00126 return TRUE;
00127 }