Skip to content

Commit

Permalink
Various updates regarding better vala integration
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Busch <morphis@gravedo.de>
  • Loading branch information
morphis committed Oct 23, 2011
1 parent 3081adc commit a348eea
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 547 deletions.
101 changes: 50 additions & 51 deletions include/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,77 +21,76 @@
#ifndef __NET_H__
#define __NET_H__

#define IPC_NET_PREF_PLMN 0x0801
#define IPC_NET_PLMN_SEL 0x0802
#define IPC_NET_CURRENT_PLMN 0x0803
#define IPC_NET_PLMN_LIST 0x0804
#define IPC_NET_REGIST 0x0805
#define IPC_NET_SUBSCRIBER_NUM 0x0806
#define IPC_NET_BAND_SEL 0x0807
#define IPC_NET_SERVICE_DOMAIN_CONFIG 0x0808
#define IPC_NET_POWERON_ATTACH 0x0809
#define IPC_NET_MODE_SEL 0x080A
#define IPC_NET_ACQ_ORDER 0x080B
#define IPC_NET_IDENTITY 0x080C
#define IPC_NET_CURRENT_RRC_STATUS 0x080D
#define IPC_NET_PREF_PLMN 0x0801
#define IPC_NET_PLMN_SEL 0x0802
#define IPC_NET_CURRENT_PLMN 0x0803
#define IPC_NET_PLMN_LIST 0x0804
#define IPC_NET_REGIST 0x0805
#define IPC_NET_SUBSCRIBER_NUM 0x0806
#define IPC_NET_BAND_SEL 0x0807
#define IPC_NET_SERVICE_DOMAIN_CONFIG 0x0808
#define IPC_NET_POWERON_ATTACH 0x0809
#define IPC_NET_MODE_SEL 0x080A
#define IPC_NET_ACQ_ORDER 0x080B
#define IPC_NET_IDENTITY 0x080C
#define IPC_NET_CURRENT_RRC_STATUS 0x080D

#define IPC_NET_SERVICE_TYPE_GSM 0x01
#define IPC_NET_SERVICE_TYPE_GSM2 0x02
#define IPC_NET_SERVICE_TYPE_GPRS 0x03
#define IPC_NET_SERVICE_TYPE_EDGE 0x04
#define IPC_NET_SERVICE_TYPE_UMTS 0x05
#define IPC_NET_PLMN_STATUS_AVAILABLE 0x02
#define IPC_NET_PLMN_STATUS_CURRENT 0x03
#define IPC_NET_PLMN_STATUS_FORBIDDEN 0x04

#define IPC_NET_SERVICE_LEVEL_NONE 0x01
#define IPC_NET_SERVICE_LEVEL_HOME 0x02
#define IPC_NET_SERVICE_LEVEL_SEARCHING 0x03
#define IPC_NET_SERVICE_LEVEL_EMERGENCY 0x04
#define IPC_NET_SERVICE_LEVEL_NONE2 0x05
#define IPC_NET_SERVICE_LEVEL_ROAMING 0x06
#define IPC_NET_PLMN_SEL_MANUAL 0x00
#define IPC_NET_PLMN_SEL_AUTO 0x01

#define IPC_NET_PLMN_STATUS_AVAILABLE 2
#define IPC_NET_PLMN_STATUS_CURRENT 3
#define IPC_NET_PLMN_STATUS_FORBIDDEN 4
#define IPC_NET_ACCESS_TECHNOLOGY_UNKNOWN 0xff
#define IPC_NET_ACCESS_TECHNOLOGY_GSM 0x00
#define IPC_NET_ACCESS_TECHNOLOGY_GPRS 0x01
#define IPC_NET_ACCESS_TECHNOLOGY_GPRS2 0x02
#define IPC_NET_ACCESS_TECHNOLOGY_EDGE 0x03
#define IPC_NET_ACCESS_TECHNOLOGY_UMTS 0x04

#define IPC_NET_PLMN_SEL_MANUAL 0
#define IPC_NET_PLMN_SEL_AUTO 1
#define IPC_NET_REGISTRATION_STATE_NONE 0x01
#define IPC_NET_REGISTRATION_STATE_HOME 0x02
#define IPC_NET_REGISTRATION_STATE_SEARCHING 0x03
#define IPC_NET_REGISTRATION_STATE_EMERGENCY 0x04
#define IPC_NET_REGISTRATION_STATE_UNKNOWN 0x05
#define IPC_NET_REGISTRATION_STATE_ROAMING 0x06

struct ipc_net_current_plmn {
char unk;
unsigned char slevel;
char plmn[6];
unsigned char type;
unsigned short lac;
char unk;
unsigned char reg_state; // IPC_NET_REGISTRATION_STATE_...
char plmn[6];
unsigned char type; // IPC_NET_SERVICE_TYPE_... ?
unsigned short lac;
} __attribute__((__packed__));

struct ipc_net_regist_set {
unsigned char net;
unsigned char domain;
unsigned char net;
unsigned char domain;
} __attribute__((__packed__));


struct ipc_net_regist {
unsigned char act, domain, status, edge;
unsigned short lac;
unsigned int cid;
char rej_cause;
unsigned char act; // IPC_NET_ACCESS_TECHNOLOGY_...
unsigned char reg_state; // IPC_NET_REGISTRATION_STATE_...
unsigned char unk; // domain?
unsigned char edge;
unsigned short lac;
unsigned int cid;
char rej_cause;
} __attribute__((__packed__));

struct ipc_net_plmn_entry {
unsigned char status;
char plmn[6];
unsigned char type;
char unk[2];
unsigned char status; // IPC_NET_PLMN_STATUS_...
char plmn[6];
unsigned char type;
char unk[2];
} __attribute__((__packed__));

struct ipc_net_plmn_entries {
unsigned char num;
struct ipc_net_plmn_entry *data;
unsigned char num;
struct ipc_net_plmn_entry *data;
};

void ipc_net_current_plmn(int request_id);
void ipc_net_plmn_list(int request_id);
void ipc_net_identity(int request_id);
void ipc_net_regist(int request_id, unsigned char type);

#endif

38 changes: 21 additions & 17 deletions include/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,32 @@
#define IPC_CLIENT_TYPE_CRESPO_RFS 2
#define IPC_CLIENT_TYPE_H1 3

#define IPC_COMMAND(f) ((f->group << 8) | f->index)
#define IPC_GROUP(m) (m >> 8)
#define IPC_INDEX(m) (m & 0xff)
#define IPC_COMMAND(f) ((f->group << 8) | f->index)
#define IPC_GROUP(m) (m >> 8)
#define IPC_INDEX(m) (m & 0xff)

struct ipc_header {
unsigned short length;
unsigned char mseq, aseq;
unsigned char group, index, type;
unsigned short length;
unsigned char mseq, aseq;
unsigned char group, index, type;
} __attribute__((__packed__));

struct ipc_request {
unsigned char mseq, aseq, group, index, type;
unsigned int length;
unsigned char *data;
unsigned char mseq;
unsigned char aseq;
unsigned char group;
unsigned char index;
unsigned char type;
unsigned int length;
unsigned char *data;
};

struct ipc_response {
unsigned char mseq, aseq;
unsigned short command;
unsigned char type;
unsigned int data_length;
unsigned char *data;
unsigned char mseq, aseq;
unsigned short command;
unsigned char type;
unsigned int data_length;
unsigned char *data;
};

struct ipc_client;
Expand All @@ -72,10 +76,10 @@ int ipc_client_close(struct ipc_client *client);
int ipc_client_recv(struct ipc_client *client, struct ipc_response *response);

/* Convenience functions for ipc_send */
void ipc_client_send(struct ipc_client *client, const int command, const int type, unsigned char *data,
void ipc_client_send(struct ipc_client *client, const unsigned short command, const char type, unsigned char *data,
const int length, unsigned char mseq);
void ipc_client_send_get(struct ipc_client *client, const int command, unsigned char aseq);
void ipc_client_send_exec(struct ipc_client *client, const int command, unsigned char aseq);
void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char aseq);
void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char aseq);

/* Utility functions */
const char *ipc_command_type_to_str(int command);
Expand Down
6 changes: 3 additions & 3 deletions samsung-ipc/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ int _ipc_client_send(struct ipc_client *client, struct ipc_request *request)
}

/* Convenience functions for ipc_send */
inline void ipc_client_send_get(struct ipc_client *client, const int command, unsigned char aseq)
inline void ipc_client_send_get(struct ipc_client *client, const unsigned short command, unsigned char aseq)
{
ipc_client_send(client, command, IPC_TYPE_GET, 0, 0, aseq);
}

inline void ipc_client_send_exec(struct ipc_client *client, const int command, unsigned char aseq)
inline void ipc_client_send_exec(struct ipc_client *client, const unsigned short command, unsigned char aseq)
{
ipc_client_send(client, command, IPC_TYPE_EXEC, 0, 0, aseq);
}

/* Wrapper for ipc_send */
void ipc_client_send(struct ipc_client *client, const int command, const int type, unsigned char *data, const int length, unsigned char mseq)
void ipc_client_send(struct ipc_client *client, const unsigned short command, const char type, unsigned char *data, const int length, unsigned char mseq)
{
struct ipc_request request;

Expand Down
Loading

0 comments on commit a348eea

Please sign in to comment.