Topic: Get the commands that each unit
Hello team,
I have a little problem, I 'm developing an app to get the commands with each unit counts but can not find a function for java . Any suggestions or opinion. Thank you very much.
Hello team,
I have a little problem, I 'm developing an app to get the commands with each unit counts but can not find a function for java . Any suggestions or opinion. Thank you very much.
Hello.
Sorry, I can't clearly understand what do you mean by "commands with each unit counts". Please select which unit's data you want to receive from server here http://sdk.wialon.com/wiki/en/sidebar/r … ormat/unit
kopa
No, I need to know about the implementation of method getCommands() in java the packages is "com.wialon.item" classes "Unit"
Denisse
You can find it at the Unit.class.
kopa
Woow, thank you very much. I am very grateful.
kopa
Sorry Kopa, but I dont understand the implementation of class Unit for get ListCommands of each unit. Can I help you, please?
deal kopa
Can I help you? with an example for get the list commands of each unit, I have of ID of ech unit but I dont understand as join them. Suggest please. My app is in java.
You can look at unit search example , but for commands you need to add data flags:
1.
Unit.dataFlag.commandAliases
if you want to get all commands by
Unit.getCommands()
2.
Unit.dataFlag.commands
if you want to get commands, which available for executing by
Unit.getCommandDefinitionsPlugin()
And finally your search items call will look like:
session.searchItems(searchSpec, 1, Item.dataFlag.base.getValue()|Unit.dataFlag.commandAliases.getValue()|Unit.dataFlag.commands.getValue(), 0, Integer.MAX_VALUE, new SearchResponseHandler())
Aftrer at SearchResponseHandler you can iterate items and get commands:
public void onSuccessSearch(Item... items) {
super.onSuccessSearch(items);
//TODO: Your code
for (Item item : items){
((Unit)item).getCommands();
((Unit)item).getCommandDefinitionsPlugin();
}
}
kopa
Thank you very much.
And one question more, If I want get Properties Basics of each unit for example telephone, deviceId and namedevice, same I have to get add some flag? or need to add some more.
Denisse yes, you need to add flag. You can find descriptions of them for each type at data format section
kopa
Sorry Kopa, but Can I help you? with example for get the PhoneNumber of each Unit, please.
I am very grateful.
Denisse
Unit's phone number is under a data flag with value 0x100 or at java unit's class is under a constant with value
Unit.dataFlag.restricted
To get first or second phone number use methods:
Unit.getPhoneNumber();
Unit.getPhoneNumber2();
kopa
I am very grateful for this help. Thank you very much.
Denisse you are welcome.