Home NetLinx Studio

Islamic Prayer time module.

Hi All,

I Want to write a program for Islamic prayer timings. I need to play the music automatically when the prayer time comes. There are 5 different times in a day and everyday the time will change.
Can anyone guide me on this?

Please share if anyone have module.

Thanks in advance.

Comments

  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    There are any number of ways to accomplish this. but, the easiest would be to just watch the "time" the keyword "Time" is a little function that when called sends you back a text message in the format <HH:MM:SS> which is based on the master's clock.
    {'05:00:00'}
    So a very simple way is to just look for the strings you want.

    This code snpet is just for the theory of it. You'll need to decide how you want to implement it in your code...
    DEFINE_VARIABLE
    
    volatile char Prayer_Times[][8]={
      {'05:00:00'}  // These are just initial values that can be changed dynamically
      ,{'10:00:00'}
      ,{'12:00:00'}
      ,{'15:00:00'}
      ,{'21:00:00'}
    }
    
    DEFINE_EVENT
    
    TIMLINE_EVENT[Prayer_Timer]{ // A timeline that triggers once very minute...
    sack_var char MyTIme[8]
    stack_var integer nloop;
    MyTime=TIME;
    for(nloop=length_array(Prayer_Times);nloop;nloop--){
      if(MyTime==Prayer_Times[nloop]){
        // it's prayer time X, where X=nloop, do something
        }
    }
    

    this should get you started. You can use a variable to dynamically alter the prayer times if you with or just keep them at the exact same time. You'll have to setup the timeline, of course. And like I say, there are any number of ways to approach this. This is just a basic start to get you going.
  • KanagarajKanagaraj Member Posts: 6

    Thanks for your reply. The main problem i am facing is to pull the 5 different times from the internet. Also its not the same time for everyday .

    Please guide me on this.

    Thanks.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    Yeah, I realized that the times are different. However, that is a whole other issue. My best advice is to see if you can find an RSS type feed that can provide it. Or, if you have access to some kind of document like an excel spread sheet that might have the times. You can then just parse for the data. I do not know of any such things. Sorry.
  • HARMAN_icraigieHARMAN_icraigie Technical Trainer II, Harman Professional University Posts: 568
    I wrote one in Duet awhile ago. Scraped the math out of some open source javascript. In the end we just subscribed to a service that provides the time based on location and wrote a simple Nelinx layer web client to handle the data.
  • mmelsadekmmelsadek Professional Programmer Posts: 3
    I can help you on that, I have been working on this module for sometime and it is already done now, I have built a Netlinx module that will do the calculation based on your location and it will notify the Netlinx code through 7 channel events, one for each pray time plus sunrise and sunset
    I'm afraid that I will not be able to share the code with you because I have done it for commercial use, if you wish I can share the module with you but you will need to buy a license for it to have it fully working
    the module doesn't use any online services to calculate the times, everything is done locally in the Netlinx master
    Please let me know if this works for you
  • sling100sling100 Junior Member Posts: 110
    Have a look at this

    http://praytimes.org/calculation/
    http://praytimes.org/wiki/Code

    If you are familiar with Julian dates I reckon you could write something in Netlinx.
    There's a number of examples in other languages on the wiki page that you could adapt fairly easily too.

    Simon
Sign In or Register to comment.