Example #1
0
// Connects to phone
func (g *GSM) Connect() (err error) {
	e := C.GSM_InitConnection(g.sm, 1) // 1 means number of replies to wait for
	if e != ERR_NONE {
		err = errors.New(errorString(int(e)))
	}

	// set callback for message sending
	C.GSM_SetSendSMSStatusCallback(g.sm, (C.SendSMSStatusCallback)(unsafe.Pointer(C.sendSMSCallback)), nil)
	return
}
Example #2
0
func (sm *StateMachine) Connect() error {
	if e := C.GSM_InitConnection(sm.g, 1); e != C.ERR_NONE {
		return Error{"InitConnection", e}
	}
	C.setStatusCallback(sm.g, &sm.status)
	sm.smsc.Location = 1
	if e := C.GSM_GetSMSC(sm.g, &sm.smsc); e != C.ERR_NONE {
		return Error{"GetSMSC", e}
	}
	return nil
}