2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _SDB_CLIENT_H_
18 #define _SDB_CLIENT_H_
22 /* connect to sdb, connect to the named service, and return
23 ** a valid fd for interacting with that service upon success
24 ** or a negative number on failure
26 int sdb_connect(const char *service);
27 int _sdb_connect(const char *service);
29 /* connect to sdb, connect to the named service, return 0 if
30 ** the connection succeeded AND the service returned OKAY
32 int sdb_command(const char *service);
34 /* connect to sdb, connect to the named service, return
35 ** a malloc'd string of its response upon success or NULL
39 char *sdb_query(const char *service);
41 /* Set the preferred transport to connect to.
43 void sdb_set_transport(transport_type type, const char* serial);
45 /* Set TCP specifics of the transport to use
47 void sdb_set_tcp_specifics(int server_port);
49 /* Return the console port of the currently connected emulator (if any)
50 * of -1 if there is no emulator, and -2 if there is more than one.
51 * assumes sdb_set_transport() was alled previously...
53 int sdb_get_emulator_console_port(void);
55 /* send commands to the current emulator instance. will fail if there
56 * is zero, or more than one emulator connected (or if you use -s <serial>
57 * with a <serial> that does not designate an emulator)
59 int sdb_send_emulator_command(int argc, char** argv);
61 /* return verbose error string from last operation */
62 const char *sdb_error(void);
64 /* read a standard sdb status response (OKAY|FAIL) and
65 ** return 0 in the event of OKAY, -1 in the event of FAIL
68 int sdb_status(int fd);