nerves-networking / vintage_net_mobile

Mobile networking for VintageNet
Apache License 2.0
27 stars 11 forks source link

Config #29

Closed LostKobrakai closed 4 years ago

LostKobrakai commented 4 years ago

I'm in the process of updating to the renamed vintage_net_mobile version and I'm wondering what the difference between extra_modems and extra_service_providers configs are to just providing those information in:

{"ppp0", %{type: VintageNetMobile, modem: your_modem, service_provider: your_service_provider}}
LostKobrakai commented 4 years ago

I think I get the benefit for having a "registration" of data and later using just the defaults. But currently VintageNetMobile.ServiceProviders does only support :apn as key, so even when building a fully custom modem and provider I cannot use further keys per provider to customize my callscripts dynamically.

mattludwigs commented 4 years ago

What are some other fields you are trying to provide for your service provider?

The current state of just the :apn key is mostly because that is all we needed to get things to work on our end and we did not really know the full scope of what could be placed in there.

The assumption is custom implementations can hardcore different values into their chatscript to get around the single key limitation at least as a short term solution, but maybe that was a bad assumption?

I am willing to work with you get your modem/provider officially supported if you are able to share that information. Maybe your use case can help drive a better design of the registration configuration.

LostKobrakai commented 4 years ago

There are two things. The number in OK ATDT*99***1# doesn't seem to work for me, but I'm not sure if that's a provider or modem thing. The other part is actually not a provider setting, but one for the config, which is an optional PIN. I'm aware that usually one would have a SIM without pin, but somehow the SIM I'm using is reseting again and again and for testing at home some people might just want to try things out with their own personal SIM.

mattludwigs commented 4 years ago

What modem are you using?

LostKobrakai commented 4 years ago

I'm using an huawei usb modem (e3372). I've implemented the modem behaviour for it. But as I'm still in development mode I'm using it with 3 different providers/SIMs :D

mattludwigs commented 4 years ago

Have you tried just hard coding the dialing digits and the SIM pin stuff in a chatscript for each APN that is sent in?

In your modem module:


def chatscript_provider_a(%{apn: "provider_a"}) do
   """
   specific provider A stuff
   """
end

def chatscript_provider_b(%{apn: "provider_b"}) do
   """
   specific provider B stuff
   """
end
  config :vintage_net_mobile,
    extra_service_providers: [
      {"Provider A" apn: "provider_a"},
      {"Provider B" apn: "provider_b"},
    ]

You can see: https://github.com/nerves-networking/vintage_net_mobile/blob/master/lib/vintage_net_mobile/modems/quectel_BG96.ex#L50 for reference too.

To be honest we are still figuring out the provider support stuff, so things will probably change a little from what it is now. But I think doing what I suggested should unblock you unless I am missing something.

LostKobrakai commented 4 years ago

I can certain work around those constraints for now. I'm mostly trying to add my perspective to the discussion.

fhunleth commented 4 years ago

@LostKobrakai Matt got pulled to work on another project. I'm trying to wrap up some updates that he was planning so that the volatility in the API calms down.

I vaguely remember you posting your modem configuration. Would you mind sending a link to it again? I'd like to make sure that the recent updates work for your modems too.

LostKobrakai commented 4 years ago

It was here: https://github.com/nerves-networking/vintage_net_mobile/pull/19#issuecomment-584692685

fhunleth commented 4 years ago

@LostKobrakai Just to confirm, you have to use ATDT*99# to initiate PPP and not ATDT*99***1#? Those commands should be the same since the ***1 part says to connect using PDP context 1 and that's what you're using in your script. It also looks like connecting using PDP context 1 is the default. While I think we could leave it off, I've seen it used so often in other scripts, it makes me wonder. At any rate, it's not a problem. I'm mostly curious.

The usb_modeswitch code will be more interesting. Somehow I've ended up with quite a few modems that don't require it.

LostKobrakai commented 4 years ago

I'm not to sure as well about it. All I know is that I couldn't make it connect with the long call and therefore left it like that. Lot's of my naive googling was suggesting the short number.

The usb modeswitch is certainly required for the modem I have. Took some time on my side to even get it to be usable with ppp.