---
name: "synce_info_new"
section: "3"
platform: "linux"
package: "libsynce0-dev"
version: "0.15-1.1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/synce_info_new"
---

# synce\_info\_new(3)

allocate a new SynceInfo struct

## NAME

synce\_info\_new - allocate a new SynceInfo struct

## SYNOPSIS

```
#include <synce.h>

SynceInfo *synce_info_new(const char *device_name);

void synce_info_destroy(SynceInfo *info);

const char *synce_info_get_name(SynceInfo *info);
bool synce_info_get_os_version(SynceInfo *info, int os_major, int os_minor);
int synce_info_get_build_number(SynceInfo *info);
int synce_info_get_processor_type(SynceInfo *info);
const char *synce_info_get_os_name(SynceInfo *info);
const char *synce_info_get_model(SynceInfo *info);
const char *synce_info_get_device_ip(SynceInfo *info);
const char *synce_info_get_local_ip(SynceInfo *info);
int synce_info_get_partner_id_1(SynceInfo *info);
int synce_info_get_partner_id_2(SynceInfo *info);
const char *synce_info_get_object_path(SynceInfo *info);
pid_t synce_info_get_dccm_pid(SynceInfo *info);
const char *synce_info_get_transport(SynceInfo *info);
const char *synce_info_get_password(SynceInfo *info);
int synce_info_get_key(SynceInfo *info);
```

## DESCRIPTION

The **synce\_info\_new**() function returns a pointer to a newly allocated and populated SynceInfo struct for a mobile device.

If **device\_name** is non-NULL, the returned struct relates to a mobile device with that name, or NULL if no device of that name is connected.

If **device\_name** is NULL, the exact behaviour depends on the flavour of dccm daemon in use. When using [**vdccm**(1)](/vdccm/1.md) or the deprecated [**dccm**(1)](/dccm/1.md), the current active device is selected. This is usually the last device connected, specifically that described in the active\_connection file which is by default in the ~/.synce/ directory. With  [**odccm**(1)](/odccm/1.md) the first device connected will be returned. With  **synce-hal** this depends on the device(s) in question, and should be considered undefined.

This struct should be freed with [**synce\_info\_destroy**(3)](/synce_info_destroy/3.md).

```
typedef struct _SynceInfo {
    pid_t dccm_pid;       /* process id of dccm daemon */
    char* device_ip;      /* device ip address */
    char* local_iface_ip; /* local interface ip address */
    char* password;       /* device password */
    int key;              /* device pass key */
    int os_major;         /* device OS major version */
    int os_minor;         /* device OS minor version */
    int build_number;     /* OS build number */
    int processor_type;   /* device processor */
    int partner_id_1;     /* first sync partner id number */
    int partner_id_2;     /* second sync partner id number */
    char* name;           /* device name */
    char* os_name;        /* device OS name eg. PocketPC */
    char* model;          /* device hardware name */
    char* transport;      /* interface type */
    char* object_path;    /* path to device's information */
} SynceInfo;
```

These fields must be accessed with the  **synce\_info\_get\_** functions. The particular fields populated depend on the flavour of dccm daemon in use.

The use of [**dccm**(1)](/dccm/1.md) is deprecated. When using [**vdccm**(1)](/vdccm/1.md) all fields are populated except for  **local\_iface\_ip** and  **os\_minor**. With  [**odccm**(1)](/odccm/1.md) and **synce-hal,** **dccm\_pid,** **password,** **key,** **build\_number,** **partner\_id\_1** and  **partner\_id\_2** are not used. [**odccm**(1)](/odccm/1.md) also does not populate **local\_iface\_ip.**

## RETURN VALUE

The **synce\_info\_new**() function returns a pointer to the allocated SynceInfo struct, or NULL if an error occured.

## SEE ALSO

[**synce**(7)](/synce/7.md), [**odccm**(1)](/odccm/1.md), [**vdccm**(1)](/vdccm/1.md)
