Hello,
I want the server raccoon starts a Symbian application when receives a HTTP request, is possible?
Thank you!
Hello,
I want the server raccoon starts a Symbian application when receives a HTTP request, is possible?
Thank you!
Sure you can.
Using Python you should (should, because I havn't tried it) be able to start another application using e32.start_exe(). From a native Apache module it can definitely be done.
However, if you want to use that other application in a CGI kind of way, so that the external application generates HTML and the communication is handled by reading/writing from/to stdout/stdin, some modifications might be needed.
Johan
Hi!
Which is the easier form to do it? is some example available?
I don´t know how to begin...
Thanks!
ok, the idea is:
I have a Symbian application that sends SMS to some contacts registered in a file, then I want the server, raccoon, starts this application when recives a HTTP request.
Thanks!
Do you have the source-code of that application? In that case, the best approach is probably to factor out the functionality you are interested in, and then create a custom Apache module that does exactly what you want.
What kind of application is it? Does it have a GUI?
Johan
It's a "console" application.
I have done it thinking about that it worked in background.
Thanks!
In that case you have alternatives; the program can run all the time as a server that the Apache request handler contacts using some IPC mechanism, or then you can invoke the program as the result of a HTTP request.
I assume you are using OpenC? Check 'Open C Documentation' -> 'Developer Guides' -> 'Threads,Processes,IPC, and Synchronization' for documentation on what kind of IPC mechanisms you have available. And check out posix_spawn for how to start an executable.
Johan
Hi!
I have been reading the documentation but I do not know how beginning the code… You know if there is some similar example that can serve me to begin?
Thanks again!
Hi!
The function:
int posix_spawn(pid_t * pid, const char * path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t * attrp,
char *const argv[], char *const envp[]);
The argument "const char * path", what kind of file can execute? a .sis file, a .exe file,...? I would like execute a "console" application, but I don´t know how to install it in my phone, I use Carbide and I don´t have a .sis of my application, only a .exe that I can run in the emulator when I do double click.
Thank you!
An executable file, but remember that on S60v3.0 you can only execute files that reside in the directory c:\sys\bin
You have to create a SIS-file, because only the installer can put a file to c:\sys\bin. Check from the documentation and the examples included with the S60 SDK how to do that.I would like execute a "console" application, but I don´t know how to install it in my phone, I use Carbide and I don´t have a .sis of my application, only a .exe that I can run in the emulator when I do double click.
Johan
Hi!
I tested the function posix_spawn to see if it can run an console application (SendSMS). I created a new project in Carbide, it creates a default console application: Hello World!.
The code is:
// Include Files
#include "StartApp.h"
#include <e32base.h>
#include <e32std.h>
#include <e32cons.h> // Console
#include <spawn.h>
// Constants
_LIT(KTextConsoleTitle, "Console");
_LIT(KTextFailed, " failed, leave code = %d");
_LIT(KTextPressAnyKey, " [press any key]\n");
// Global Variables
LOCAL_D CConsoleBase* console; // write all messages to this
// Local Functions
LOCAL_C void MainL()
{
//
// add your program code here, example code below
//
console->Write(_L("Hello, world!\n"));
pid_t* pid;
const char* path="..\\..\\Epoc32\\release\\winscw\\udeb\\SendSMS";
const posix_spawn_file_actions_t* file_actions=NULL;
const posix_spawnattr_t* attrp= NULL;
int result = posix_spawn(pid, path, file_actions, attrp, NULL, NULL);
}
....
....
That path is where I have the executable of the application I want to start, that is if I do double click it running on the emulator. But I do not think that it is ok ...
Additionally, the application does not compile, the error is:
Undefinied symbol: '_posix_spawn' referenced from 'void mainL(void) (?MainL@@YAXXZ)' in StartApp.cpp:45
Where I invoke the function posix_spawn.
Thanks again!
Probably not - just use SendSMS.exe. That should do the right thing on the emulator and on target.
Have you added the library libc.lib?Additionally, the application does not compile, the error is:
Undefinied symbol: '_posix_spawn' referenced from 'void mainL(void) (?MainL@@YAXXZ)' in StartApp.cpp:45
Where I invoke the function posix_spawn.
Johan
Hi!
I have solved the problem of compilation, it was by the library libc.lib. However, the application does something rare:
- Displays Hello World! If you do not write the function posix_spawn but if I write the function does not show Hello World! and it does nothing in the emulator.
- I believe that the parameters of the function posix_spawn are not properly (I think the path) but anyway it should print Hello World! because the code is before the function posix_spawn...
LOCAL_C void MainL()
{
//
// add your program code here, example code below
//
console->Write(_L("Hello, world!\n"));
pid_t pid;
const char* path = "..\\..\\epoc32\\release\\winscw\\udeb\\SendSMS.exe";
posix_spawn(&pid, path, NULL, NULL, NULL ,NULL);
}
The file SendSMS.exe that I want the function started is in this path, here is where Carbide save it to try it in the emulator ...
I searched on the Internet but did not find examples of the use of the function posix_spawn in Symbian ...
I don't know what can I do...
Thanks!!