Keeping Hardware Alive

corwinckler

Member
Licensed User
Hi

Erel you mentioned hardware.keepalive
Is this a device setting or something that can be done in the program?

Regards
--Cor
 

ashrafidkaidek

Member
Licensed User
Keep alive error message

i have tried to use the keepalive exactly as the example in the Basic4ppc documentation, but unfortunately i keep receive an error after 5 second from running the exe file in my PPC (LG Incite), i believe the error message show right after the hardware1.keepalive command handling, any help will be highly appreciated
 

specci48

Well-Known Member
Licensed User
You are trying to run this program on your desktop!

Excerpt from the help file of the hardware.dll:

This library is only functional on the device.
If you like to build the application on the desktop you can use the HardwareDesktop.dll file.
It is a shallow copy of the Hardware library (without any functionality).


So the error in your screenshot is not that one you'll get on your device.


specci48
 
Last edited:

Zenerdiode

Active Member
Licensed User
Ah, you're getting there. From your screen shot, I see you have the help file for the Hardware library open. See the line:

Hardware1.New1

This initialises the hardware object. I think you need to read the Libraries Tutorial.

To get you started very quickly, in the IDE, use 'Tools>Components' and add the Hardware.dll to the Device side and the HardwareDesktop.dll to the Desktop side. Then create your object. To do this, its 'Tools>Add object' and you will see 'HardWare'. Call it 'HardWare1'

Now in your AppStart sub, add a line Hardware1.New1 before your timer enabling and you should be up and running. But I must stress you should have a read of the tutorial, because the more you get into Basic4PPC - the more you will experience the need for libraries. :)
 

ashrafidkaidek

Member
Licensed User
KeepAlive error

Thank you everybody for your replies, unfortunately all what you have mentioned was already done:

Dear specci48, I never tried to run the exe from my PC, I have ran the file from PPC (LG Incite) as I mentioned before, and the Hardware.dll included in the same directory as the exe

Dear Zenerdiode, I’m not a new Basic4PPC user, actually I have already done what you have recommended, please see the new attached image

Any new ideas folks … thank you in advance
 

klaus

Expert
Licensed User
You haven't initialized the Harware1 object ?!
You are missing the line in red!

B4X:
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]
[SIZE=2][FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]App_Start[/SIZE][/FONT]
[SIZE=2][FONT=Courier New] [COLOR=red]Hardware1.New1[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Courier New] Form1.show[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] Timer1.Enabled = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE][/FONT]
 
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Timer1_Tick[/SIZE][/FONT]
[SIZE=2][FONT=Courier New] Hardware1.KeepAlive [/FONT][/SIZE]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
Best regards.
 
Top