/*
* This file is part of libsamsung-ipc.
*
* Copyright (C) 2010-2011 Joerie de Gram .
*
*/
#include
#include
#include
void ipc_net_regist_get_setup(struct ipc_net_regist_get *message,
unsigned char domain)
{
/* FIXME: could that be IPC_NET_ACCESS_TECHNOLOGY_... (act) ? */
message->net = 0xff;
message->domain = domain;
}
void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_set *message,
unsigned char mode, char *plmn, unsigned char act)
{
int message_plmn_len;
int plmn_len;
int i;
if (message == NULL)
return;
message_plmn_len = sizeof(message->plmn);
memset(message, 0, sizeof(struct ipc_net_plmn_sel_set));
if (mode == IPC_NET_PLMN_SEL_AUTO)
{
message->mode = IPC_NET_PLMN_SEL_AUTO;
message->act = IPC_NET_ACCESS_TECHNOLOGY_UNKNOWN;
}
else if (mode == IPC_NET_PLMN_SEL_MANUAL)
{
plmn_len = strlen(plmn);
// Only copy the first (6) bytes if there are more
if(plmn_len > message_plmn_len)
plmn_len = message_plmn_len;
strncpy(message->plmn, plmn, plmn_len);
// If there are less (5 is the usual case) PLMN bytes, fill the rest with '#'
if (plmn_len < message_plmn_len)
memset((void *) (message->plmn + plmn_len), '#', message_plmn_len - plmn_len);
message->mode = IPC_NET_PLMN_SEL_MANUAL;
message->act = act;
}
}
// vim:ts=4:sw=4:expandtab