Beispiel #1
0
class GCMLogic():

    def __init__(self, debug=None):
	setup = AllSetup()
        self.push_debug = setup.push_debug
        self.host = setup.host
        self.port = setup.port
        self.user = setup.user
        self.passwd = setup.passwd
        self.db = setup.db
        self.gcm_api_key = setup.gcm_api_key
        self.auth = ""
        self.gcm = None
        self.push = None

        try:
            self.conn = self.getConnection()
            self.cursor = self.conn.cursor(MySQLdb.cursors.DictCursor)
	    if(debug==1):
	        self.update_check('on')
            self.must_goon();
            self.gcm = GCM(self.gcm_api_key)
	    self.push = PushData()
	    self.push.readData(setup.push_file)

        except MySQLdb.Error, e:
            print "Error 1 %d: %s" % (e.args[0], e.args[1])
            self.closeAll()
            sys.exit(1)
Beispiel #2
0
    def __init__(self, debug=None):
        setup = AllSetup()
        self.push_debug = setup.push_debug
        self.host = setup.host
        self.port = setup.port
        self.user = setup.user
        self.passwd = setup.passwd
        self.db = setup.db
        self.gcm_api_key = setup.gcm_api_key
        self.auth = ""
        self.gcm = None
        self.push = None

        try:
            self.conn = self.getConnection()
            self.cursor = self.conn.cursor(MySQLdb.cursors.DictCursor)
            if (debug == 1):
                self.update_check('on')
            self.must_goon()
            self.gcm = GCM(self.gcm_api_key)
            self.push = PushData()
            self.push.readData(setup.push_file)

        except MySQLdb.Error, e:
            print "Error 1 %d: %s" % (e.args[0], e.args[1])
            self.closeAll()
            sys.exit(1)
Beispiel #3
0
#!/usr/bin/python

from gcm_push_data import PushData
from gcm_logic import GCMLogic
from gcm_setup import AllSetup
import push_gcm

if __name__ == "__main__":
    push = PushData()
    setup = AllSetup()
    push.setData(data=None,
                 collapse_key='push',
                 delay_while_idle=False,
                 time_to_live=86400)
    push.writeData(setup.push_file)

    logic = GCMLogic(1)
    devices = logic.getDevices()
    logic.sendPushToDevices(devices)
#!/usr/bin/python

from gcm_push_data import PushData
from gcm_logic import GCMLogic
from gcm_setup import AllSetup
import push_gcm

if __name__ == "__main__":
	push = PushData()
	setup = AllSetup()
	push.setData(data=None, collapse_key='push', delay_while_idle=False, time_to_live=86400)
	push.writeData(setup.push_file)

	logic = GCMLogic(1)
	devices = logic.getDevices()
        logic.sendPushToDevices(devices)