The response to AT+COPS=? is a list of available network operators; eg,
Does anyone have any suggestions for easy ways to extract the operator details from this?
wm_strGetParameterString doesn’t work:
u8 dst[80];
u8 src[]="+COPS: (2,\"vodafone UK\",\"voda UK\",\"23415\"),(3,\"O2 - UK\",\"O2 -UK\",\"23410\"),(3,\"Orange\",\"Orange\",\"23433\"),(3,\"T-Mobile UK\",\"TMO UK\",\"23430\")";
u8 *ptr;
u8 idx;
// Get the 1st 7 parameters
for( idx=1; idx<8; ++idx )
{
// Get the next parameter
ptr = wm_strGetParameterString( dst, src, idx );
// Trace the return value
TRACE(( 1, "%u: ptr=%p", idx, ptr ));
// If the return value indicates that a parameter was found, trace it
if( ptr )
{
TRACE(( 1, dst ));
}
}
Result:
In other words, it gets the details of the 1st operator (vodafone, in the above example) OK, but then considers the whole of the rest of the string to be one parameter!
It’s also a bit poor the way it includes the bracket in the 1st parameter.