I need some help in figuring out AdhocCommand creation in Smack.
From this C++ gloox app: https://github.com/szatmary/iAlert/blob/master/logitechcameras.cpp
void Logitech700eCamera::commandNvrBasicGet()
{
gloox::DataForm *form = new gloox::DataForm(gloox::TypeSubmit,“Get NVR Basic Request”);
form->addField( gloox::DataFormField::TypeHidden, “FORM_TYPE”, “urn:logitech-com:logitech-alert:nvr:basic:get” );
gloox::Adhoc::Command *cmd = new gloox::Adhoc::Command(“urn:logitech-com:logitech-alert:nvr:basic:get”, gloox::Adhoc::Command::Execute, form);
m_xmppClient->sendCommand( cmd );
}
UPDATE: ok, so in the time since the posting was approved by moderators, I think I stumbled into the .execute method I needed I believe this is equal code in Smack:
Form form1 = new Form(Form.TYPE_SUBMIT);
form1.setTitle(“Get NVR Basic Request”);
FormField field1 = new FormField(“FORM_TYPE”);
field1.setType(FormField.TYPE_HIDDEN);
field1.addValue(“urn:logitech-com:logitech-alert:nvr:basic:get”);
form1.addField(field1);
AdHocCommandManager ahcmanager = AdHocCommandManager.getAddHocCommandsManager(connection);
RemoteCommand ahcommand = ahcmanager.getRemoteCommand("server@127.0.0.1/NvrCore", "urn:logitech-com:logitech-alert:nvr:basic:get");
ahcommand.execute(form1);
I’ll leave thread here in case anyone wants to suggest better technique. I found very few examples on the net of AdHocCommands for smack.