Problem with the adl_fcmSendData()


#1

hi, i am a beginer in wavecom.maybe you can help me .
i want to send a command to read the data of an ammeter by FCM.
but the problem is i cannt find the address of the ammeter.therefore,i think the hardware Q2406B directly connects with the ammeter.and no address is needed.then i use the function adl_fcmSendData() to send the reading_ammeter command .but this time ,what puzzles me is the lengh of the data(the commad).you know the commmand is a fixed string .when i set a variable and evaluate it with the command string.i dont know how to deal with the parameter length in the function adl_fcmSendData();
regards.waiting for seniors’ coming to help.


#2

Hi,
If you ammeter expects a command from the serial port (COM port), in that case, you can send the command using FCM.
The length parameter of adl_fcmSendData () specifies the length of data to be sent. In this case, it would be your command length. For instance, suppose your command to be sent to ammeter constitutes the following hex sequence:
0x10 0x22 0x33 0x42 0xa0
Let’s suppose, that you have stored these values in an u8 array, i.e. you have declared:
u8 ammeter_command[]={0x10,0x22,0x33,0x42,0xa0};
Hence, while sending data using FCM you have to give:
adl_fcmSendData (fcm_handle, &ammeter_command,5); //as the length of //your array which contains the command is 5. This is because, your //command consists of 5 bytes.

Please note that in order to send data using UART FCM, you have to switch the FCM to data mode. Hence, you should proceed as follows:

  1. Subscribe to FCM and get the handle returned by adl_fcmSubscribe () API.
  2. When the FCM flow is opened, you will receive ADL_FCM_EVENT_FLOW_OPENNED in the FCM control handler function.
  3. From the control handler function, switch the state of FCM to data so that you can send raw data on the FCM flow (which is associated with the UART on which the ammeter is connected). You can use adl_fcmSwitchV24State () API to do so.
  4. When you receive, ADL_FCM_EVENT_DATA_MODE in the FCM control handler function, it means that you are now in data mode and can now use adl_fcmSendData () API. Now, you call adl_fcmSendData () API and provide the length parameter as mentioned above.

This would send the data on the associated flow. Please refer to ADL user guide for more details on how to send/receive data on the flow.

Best Regards,
Open AT Fan.


#3

Before you even start thinking about how to use Open-AT, you need to understand how the ammeter’s interface works! :open_mouth:

Once you understand how the ammeter’s interface, then - and only then - can you you start thinking about how to achieve that using Open-AT! :unamused:

Obviously, the first thing you need to confirm is how you will physically connect to the ammeter;

Then you need to determine the formats of commands, responses, etc - including whether any addresses, etc, are required.

Then you can start thinking about how to implement this!


#4

thank you very much for your reply.
now ,i have got rid of the problem.
i also want to undersdant the ammeter interface, have a general idea and know the steps in detail.but i am a chinese student and can understand the guide well.meanwhile,i am beginer in embedded programming.therefore ,sometimes i maybe ask some weak_minded questions.
but thanks again for you suggestions. i will try my best to think about the problems that i face in future,before i ask them.
hi,i have learned embedded applications send commands to the hardware by the function adl_atCmdCreate() and deal with UnsolicitedResponses by adl_atUnsosubscribe().now,i think the communication between ammeter and Q2406B fall into the kind. but when i analyse the naming of the adl_atCmdCreate() ,i have an idea that adl_atCmdCreate() is used to send AT commands.the ammeter command is 6801000000000068010243c3da16 not a AT command.now, i am puzzled again.
regards.